hr-design-system-handlebars 1.41.0 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.storybook/preview-head.html +0 -5
  2. package/.storybook/preview.js +1 -1
  3. package/CHANGELOG.md +12 -0
  4. package/build/scripts/build.js +4 -1
  5. package/dist/assets/index.css +3 -3
  6. package/dist/assets/js/alpine.js +47 -0
  7. package/{src/assets/vendor/js → dist/assets/js/components/podcast}/podcast_player.alpine.js +0 -92
  8. package/dist/assets/js/components/site_header/dropdown.alpine.js +77 -0
  9. package/dist/assets/js/components/site_header/flyoutHandler.alpine.js +54 -0
  10. package/dist/assets/js/components/site_header/mainNavigationHandler.alpine.js +219 -0
  11. package/dist/assets/js/components/site_header/overlayHandler.alpine.js +20 -0
  12. package/dist/assets/js/empty.js +0 -0
  13. package/dist/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs +0 -1
  14. package/dist/views/components/podcast/podcast_player.hbs +2 -3
  15. package/dist/views/components/podcast/podcast_playlist_player-inline.hbs +2 -3
  16. package/dist/views/components/podcast/podcast_playlist_player.hbs +2 -3
  17. package/dist/views/components/podcast/podcast_playlist_player_all_episodes.hbs +2 -3
  18. package/dist/views_static/components/horizontal_scroll_container/horizontal_scroll_container.hbs +0 -1
  19. package/dist/views_static/components/podcast/podcast_player.hbs +2 -3
  20. package/dist/views_static/components/podcast/podcast_playlist_player-inline.hbs +2 -3
  21. package/dist/views_static/components/podcast/podcast_playlist_player.hbs +2 -3
  22. package/dist/views_static/components/podcast/podcast_playlist_player_all_episodes.hbs +2 -3
  23. package/package.json +1 -1
  24. package/src/assets/js/alpine.js +47 -0
  25. package/src/stories/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs +0 -1
  26. package/src/stories/views/components/podcast/podcast_player.alpine.js +194 -0
  27. package/src/stories/views/components/podcast/podcast_player.hbs +2 -3
  28. package/src/stories/views/components/podcast/podcast_playlist_player-inline.hbs +2 -3
  29. package/src/stories/views/components/podcast/podcast_playlist_player.hbs +2 -3
  30. package/src/stories/views/components/podcast/podcast_playlist_player_all_episodes.hbs +2 -3
  31. package/src/stories/views/components/site_header/dropdown.alpine.js +77 -0
  32. package/src/stories/views/components/site_header/flyoutHandler.alpine.js +54 -0
  33. package/src/stories/views/components/site_header/mainNavigationHandler.alpine.js +219 -0
  34. package/src/stories/views/components/site_header/overlayHandler.alpine.js +20 -0
  35. package/dist/assets/vendor/js/header.alpine.js +0 -414
  36. package/src/assets/vendor/js/header.alpine.js +0 -414
  37. /package/dist/assets/{vendor/js → js/components/horizontal_scroll_container}/horizontal_scroll_container.alpine.js +0 -0
  38. /package/src/{assets/vendor/js → stories/views/components/horizontal_scroll_container}/horizontal_scroll_container.alpine.js +0 -0
  39. /package/{dist/assets/vendor/js/podcast_player.alpine.js → src/stories/views/components/podcast/podcast_player.alpine.new.js} +0 -0
@@ -1,9 +1,4 @@
1
- <script defer src="https://unpkg.com/async-alpine@1.0.0/dist/async-alpine.script.js"></script>
2
- <script defer src="https://unpkg.com/@alpinejs/collapse@3.8.1/dist/cdn.min.js"></script>
3
- <script defer src="https://unpkg.com/@alpine-collective/toolkit@1.0.0/dist/cdn.min.js"></script>
4
- <script defer src="https://unpkg.com/alpinejs@3.8.1/dist/cdn.min.js"></script>
5
1
  <script src="vendor/modernizr/modernizr.cust.js"></script>
6
- <script src="vendor/js/header.alpine.js"></script>
7
2
  <!--to be sure hyphems work correctly lang Attribute needs to be "de"
8
3
  see: https://github.com/storybookjs/storybook/issues/11706 -->
9
4
  <script>
@@ -8,7 +8,7 @@ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'
8
8
 
9
9
  import Initializer from '../build/webpack/feature-loader/initializer/initializer'
10
10
  import loadFeature from '../build/webpack/feature-loader/initializer/loader'
11
- import '../src/assets/vendor/js/header.alpine'
11
+ import '../src/assets/js/alpine.js'
12
12
  import '../src/assets/tailwind.css'
13
13
 
14
14
  function loadDelayedImages() {
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v1.42.0 (Thu Oct 12 2023)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Feature/dpe 2416 [#731](https://github.com/mumprod/hr-design-system-handlebars/pull/731) ([@szuelch](https://github.com/szuelch))
6
+
7
+ #### Authors: 1
8
+
9
+ - [@szuelch](https://github.com/szuelch)
10
+
11
+ ---
12
+
1
13
  # v1.41.0 (Fri Oct 06 2023)
2
14
 
3
15
  #### 🚀 Enhancement
@@ -8,7 +8,10 @@ const run = (cmd) => execSync(cmd, { stdio: 'inherit', cwd: root })
8
8
  run(`npx copyfiles \"./src/index.js\" dist --up=1`)
9
9
  //run(`npx copyfiles \"./src/stories/views/**/*.hbs\" dist --up=2`)
10
10
  run(`npx copyfiles \"./src/assets/vendor/**/*.{css,js}\" dist --up=1`)
11
- run(`npx copyfiles \"./src/stories/views/**/*.{feature,subfeature}.js\" dist/assets/js --up=3`)
11
+ run(`npx copyfiles \"./src/assets/js/**/*.js\" dist --up=1`)
12
+ run(
13
+ `npx copyfiles \"./src/stories/views/**/*.{feature,subfeature,alpine}.js\" dist/assets/js --up=3`
14
+ )
12
15
  run(`npx copyfiles \"./src/assets/brand/*/icons/logo/*.svg\" dist --up=1`)
13
16
  run(`npx copyfiles \"./src/assets/**/*.{woff,svg}\" dist --up=1`)
14
17
  run(`npx copyfiles \"./src/assets/brand/*/conf/locatags.json\" dist --up=1`)
@@ -3035,7 +3035,7 @@ video {
3035
3035
  border-bottom-color: var(--color-secondary-ds);
3036
3036
  }
3037
3037
  .counter-reset {
3038
- counter-reset: cnt1696588796618;
3038
+ counter-reset: cnt1697119994052;
3039
3039
  }
3040
3040
  .hyphens-auto {
3041
3041
  -webkit-hyphens: auto;
@@ -3270,7 +3270,7 @@ video {
3270
3270
  --tw-ring-color: rgba(255, 255, 255, 0.5);
3271
3271
  }
3272
3272
  .-ordered {
3273
- counter-increment: cnt1696588796618 1;
3273
+ counter-increment: cnt1697119994052 1;
3274
3274
  }
3275
3275
  .-ordered::before {
3276
3276
  position: absolute;
@@ -3286,7 +3286,7 @@ video {
3286
3286
  letter-spacing: .0125em;
3287
3287
  --tw-text-opacity: 1;
3288
3288
  color: rgba(0, 0, 0, var(--tw-text-opacity));
3289
- content: counter(cnt1696588796618);
3289
+ content: counter(cnt1697119994052);
3290
3290
  }
3291
3291
  /*! ****************************/
3292
3292
  /*! DataPolicy stuff */
@@ -0,0 +1,47 @@
1
+ import AsyncAlpine from 'async-alpine'
2
+ import collapse from '@alpinejs/collapse'
3
+ import Toolkit from '@alpine-collective/toolkit'
4
+ import Alpine from 'alpinejs'
5
+ import mainNavigationHandler from 'components/site_header/mainNavigationHandler.alpine'
6
+ import flyoutHandler from 'components/site_header/flyoutHandler.alpine'
7
+ import overlayHandler from 'components/site_header/overlayHandler.alpine'
8
+ import dropdown from 'components/site_header/dropdown.alpine'
9
+
10
+ AsyncAlpine.init(Alpine)
11
+ .data('podcastPlayer', () => import('components/podcast/podcast_player.alpine.js'))
12
+ .data('slider', () =>
13
+ import('components/horizontal_scroll_container/horizontal_scroll_container.alpine.js')
14
+ )
15
+ .start()
16
+
17
+ window.Alpine = Alpine
18
+
19
+ // Initialization of plugins, stores and data needs to be done before the call the Alpine.start()
20
+
21
+ // Initialization of stores
22
+ Alpine.store('clientHeight', document.documentElement.clientHeight || document.body.clientHeight)
23
+ Alpine.store('clientWidth', document.documentElement.clientWidth || document.body.clientWidth)
24
+ Alpine.store('burgeropen', false)
25
+ Alpine.store('searchFieldOpen', false)
26
+ Alpine.store('serviceNavIsOpen', false)
27
+ Alpine.store('searchID', {
28
+ current: '{{nextRandom}}',
29
+ })
30
+ Alpine.store('serviceID', {
31
+ open: false,
32
+ current: '0',
33
+ })
34
+ Alpine.store('navIsVisible', true)
35
+ Alpine.store('subNavIsVisible', false)
36
+
37
+ // Initialization of data handlers
38
+ Alpine.data('mainNavigationHandler', mainNavigationHandler)
39
+ Alpine.data('overlayHandler', overlayHandler)
40
+ Alpine.data('flyoutHandler', flyoutHandler)
41
+ Alpine.data('dropdown', dropdown)
42
+
43
+ // Initialization of plugins
44
+ Alpine.plugin(Toolkit)
45
+ Alpine.plugin(collapse)
46
+
47
+ Alpine.start()
@@ -56,103 +56,11 @@ export default function playaudio() {
56
56
  _player.init = false
57
57
  _player.firstPlay = true
58
58
 
59
- _player.audioElement.addEventListener('play', handlePlay.bind(this))
60
- _player.audioElement.addEventListener('playing', handlePlaying.bind(this))
61
- _player.audioElement.addEventListener('pause', handlePause.bind(this))
62
- _player.audioElement.addEventListener('waiting', handleWaiting.bind(this))
63
- _player.audioElement.addEventListener('ended', handleStopped.bind(this))
64
-
65
59
  // this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
66
60
  this.playerCount++
67
61
 
68
62
  this.playlist[id] = _player
69
-
70
- const settings = JSON.parse(this.playlist[id].audioElement.dataset.propMediaMetadata)
71
- const avContent = {
72
- av_content_id: settings.piano.av_content_id,
73
- av_content: settings.piano.av_content,
74
- av_content_type: settings.piano.av_content_type,
75
- av_content_duration: settings.piano.av_content_duration,
76
- av_broadcasting_type: settings.piano.av_broadcasting_type,
77
- av_content_theme1: settings.piano.av_content_theme1,
78
- hr_document_type: settings.piano.hr_document_type,
79
- site_level2_id: settings.piano.site_level2_id,
80
- }
81
-
82
- if (settings.piano.av_content_theme2) {
83
- avContent.av_content_theme2 = settings.piano.av_content_theme2
84
- }
85
- if (settings.piano.av_content_theme3) {
86
- avContent.av_content_theme3 = settings.piano.av_content_theme3
87
- }
88
-
89
- function handlePlay(event) {
90
- this.dispatchCustomEvent('hr-avInsights:play', {
91
- data: {
92
- playerId: getPlayerIdForAvInsights(),
93
- cursorPosition: _player.audioElement.currentTime * 1000,
94
- avContent: avContent,
95
- },
96
- })
97
- }
98
-
99
- function handlePlaying(event) {
100
- if (_player.firstPlay) {
101
- this.dispatchCustomEvent('hr-avInsights:playback-start', {
102
- data: {
103
- playerId: getPlayerIdForAvInsights(),
104
- cursorPosition: _player.audioElement.currentTime * 1000,
105
- avContent: avContent,
106
- },
107
- })
108
- _player.firstPlay = false
109
- } else {
110
- this.dispatchCustomEvent('hr-avInsights:playback-resumed', {
111
- data: {
112
- playerId: getPlayerIdForAvInsights(),
113
- cursorPosition: _player.audioElement.currentTime * 1000,
114
- avContent: avContent,
115
- },
116
- })
117
- }
118
- }
119
-
120
- function handleWaiting(event) {
121
- this.dispatchCustomEvent('hr-avInsights:buffer-start', {
122
- data: {
123
- playerId: getPlayerIdForAvInsights(),
124
- cursorPosition: _player.audioElement.currentTime * 1000,
125
- avContent: avContent,
126
- },
127
- })
128
- }
129
-
130
- function handlePause(event) {
131
- this.dispatchCustomEvent('hr-avInsights:playback-paused', {
132
- data: {
133
- playerId: getPlayerIdForAvInsights(),
134
- cursorPosition: _player.audioElement.currentTime * 1000,
135
- avContent: avContent,
136
- },
137
- })
138
- }
139
-
140
- function handleStopped(event) {
141
- this.dispatchCustomEvent('hr-avInsights:playback-stopped', {
142
- data: {
143
- playerId: getPlayerIdForAvInsights(),
144
- cursorPosition: _player.audioElement.currentTime * 1000,
145
- avContent: avContent,
146
- },
147
- })
148
- _player.firstPlay = true
149
- }
150
-
151
- function getPlayerIdForAvInsights() {
152
- return _player.id + '-' + avContent.av_content_id
153
- }
154
63
  },
155
-
156
64
  listenToGlobalStop() {
157
65
  console.log('global listener init')
158
66
  document.addEventListener(
@@ -0,0 +1,77 @@
1
+ export default () => ({
2
+ // state of the dropdown
3
+ dropped: false,
4
+ preventDefault(prevDefault, e) {
5
+ if (prevDefault) {
6
+ e.preventDefault()
7
+ }
8
+ },
9
+ isDesktopView() {
10
+ return this.$screen('lg')
11
+ },
12
+ // toggle() interpolates state
13
+ toggle() {
14
+ this.dropped = !this.dropped
15
+ },
16
+ correctFlyoutPos() {
17
+ if (this.$screen('lg')) {
18
+ let elementBoundingClientRec = this.$el.getBoundingClientRect()
19
+ let parentElementBoundingClientRec = this.$el
20
+ .closest('.relative')
21
+ .getBoundingClientRect()
22
+ this.$el.parentNode.querySelector('.sb-navigation-flyout').style.left =
23
+ elementBoundingClientRec.left - Math.abs(parentElementBoundingClientRec.left) + 'px'
24
+ } else {
25
+ this.$el.parentNode.querySelector('.sb-navigation-flyout').style.left = '0px'
26
+ }
27
+ },
28
+ // toggles visibility of service nav and sets global variables in stores
29
+ toggleServiceNav() {
30
+ this.dropped = !this.dropped
31
+
32
+ // close search if open
33
+ this.$store.searchFieldOpen = false
34
+
35
+ // if clicked element is not the current serviceID, leave the servicenav open, else interpolate servicenav state
36
+ this.$el.id != this.$store.serviceID.current
37
+ ? (this.$store.serviceNavIsOpen = true)
38
+ : this.$el.id == this.$store.serviceID.current
39
+ ? (this.$store.serviceNavIsOpen = !this.$store.serviceNavIsOpen)
40
+ : null
41
+
42
+ //if burger is open, dispatch event to close it
43
+ this.$store.burgeropen == true ? this.$dispatch('burger-close') : null
44
+
45
+ console.log('currentID: ' + this.$store.serviceID.current)
46
+ console.log('target-id: ' + this.$event.target.id)
47
+ console.log('element-id: ' + this.$el.id)
48
+ console.log('serviceNav is open:' + this.$store.serviceNavIsOpen)
49
+
50
+ //set the serviceID to the current element´s ID.
51
+ this.$store.serviceID.current = this.$el.id
52
+
53
+ //enable/disable scrolling
54
+ this.toggleScrolling(!this.$store.serviceNavIsOpen)
55
+
56
+ //defines behaviour for servicenav on mobile viewports, taking care of viewport sizes
57
+ let myFlyout = document.querySelector('#flyout-' + this.$el.id)
58
+ let brandNavHeight = this.percent > 0 ? 40 : 0
59
+
60
+ if (this.$store.serviceNavIsOpen == true && this.dropped == true) {
61
+ window.setTimeout(function () {
62
+ if (myFlyout.scrollHeight > window.innerHeight - myFlyout.offsetTop) {
63
+ myFlyout.style.height = 'auto'
64
+ window.innerWidth < 768
65
+ ? (myFlyout.style.maxHeight =
66
+ window.innerHeight - myFlyout.offsetTop - 80 + brandNavHeight + 'px')
67
+ : (myFlyout.style.maxHeight =
68
+ window.innerHeight - myFlyout.offsetTop - 40 + brandNavHeight + 'px')
69
+ myFlyout.style.overflowY = 'scroll'
70
+ } else {
71
+ myFlyout.style.maxHeight = ''
72
+ //myFlyout.style.overflowY = 'hidden'
73
+ }
74
+ }, 150)
75
+ }
76
+ },
77
+ })
@@ -0,0 +1,54 @@
1
+ export default () => ({
2
+ init() {
3
+ //Initial: x-collapse only on mobile/tablet
4
+ if (window.innerWidth < 1024) {
5
+ this.$el.setAttribute('x-collapse', '')
6
+ }
7
+ },
8
+
9
+ //Adds scrollheight of the flyout to sectionNav container to make sure all following items stay visible
10
+ sectionNavFlyoutWatcher() {
11
+ this.$watch('dropped', (value) => {
12
+ let a = this.$refs.sectionnavigation.scrollHeight + this.$el.scrollHeight
13
+ let brandNavHeight = this.percent > 0 ? 40 : 0
14
+ if (window.innerWidth < 1024) {
15
+ if (value == true) {
16
+ if (a < window.innerHeight - this.$refs.sectionnavigation.offsetTop) {
17
+ this.$refs.sectionnavigation.style.maxHeight = a + 'px'
18
+ this.$refs.sectionnavigation.style.overflowY = 'hidden'
19
+ } else {
20
+ this.$refs.sectionnavigation.style.maxHeight =
21
+ window.innerHeight -
22
+ this.$refs.sectionnavigation.offsetTop +
23
+ brandNavHeight +
24
+ 'px'
25
+ this.$refs.sectionnavigation.style.overflowY = 'scroll'
26
+ }
27
+ } else {
28
+ if (a < window.innerHeight - this.$refs.sectionnavigation.offsetTop) {
29
+ this.$refs.sectionnavigation.style.overflowY = 'hidden'
30
+ } else {
31
+ this.$refs.sectionnavigation.style.overflowY = 'scroll'
32
+ }
33
+ }
34
+ }
35
+ })
36
+ },
37
+
38
+ //sets/cleansup the x-collapse attributes depending on window.innerWidth, gets fired @resize.window in NavigationFlyout.hbs
39
+ setFlyoutAnimationStyle() {
40
+ if (window.innerWidth > 1023) {
41
+ if (this.$el.hasAttribute('x-collapse.duration.500ms')) {
42
+ this.$el.removeAttribute('x-collapse.duration.500ms')
43
+ delete this.$el._x_transition
44
+ this.$el.style.removeProperty('overflow')
45
+ this.$el.style.removeProperty('height')
46
+ if (!this.$el._x_isShown) this.$el.style.display = 'none'
47
+ if (this.$el.hasAttribute('hidden')) this.$el.removeAttribute('hidden')
48
+ }
49
+ } else {
50
+ if (!this.$el.hasAttribute('x-collapse.duration.500ms'))
51
+ this.$el.setAttribute('x-collapse.duration.500ms', '')
52
+ }
53
+ },
54
+ })
@@ -0,0 +1,219 @@
1
+ export default () => ({
2
+ debounce(callback, wait) {
3
+ let timeoutId = null
4
+ return (...args) => {
5
+ window.clearTimeout(timeoutId)
6
+ timeoutId = window.setTimeout(() => {
7
+ callback.apply(null, args)
8
+ }, wait)
9
+ }
10
+ },
11
+ start() {
12
+ let lastScrollTop = 0
13
+ let height = window.innerHeight
14
+
15
+ //Globale Variable, true = user initiated scroll / false = programmatic scroll via JS (e.g. click on Anchor Link)
16
+ let userScroll = false
17
+ window.userScroll = userScroll
18
+
19
+ // gets fired when user initated scroll happened, global variable is used in Ticker-Topnews and other anchor links to prevent expanding of the navigation if scrollposition gets corrected by JS.
20
+ const mouseEvent = () => {
21
+ userScroll = true
22
+ window.userScroll = true
23
+ }
24
+ // detect if the user clicked/dragged the scrollbar manually
25
+ const clickedOnScrollbar = (mouseX) => {
26
+ return document.documentElement.offsetWidth <= mouseX ? true : false
27
+ }
28
+ // if clicked on scrollbar, fire user initiated mouse event
29
+ const mouseDownHandler = (e) => {
30
+ clickedOnScrollbar(e.clientX) ? mouseEvent() : null
31
+ }
32
+ // main scroll handler, defines scroll direction, percent of viewport scrolled, visibility of navigation and subnavigation
33
+ const scrollHandler = () => {
34
+ let winScroll = document.body.scrollTop || document.documentElement.scrollTop
35
+ winScroll > lastScrollTop ? (this.scrollingDown = true) : (this.scrollingDown = false)
36
+ this.percent = Math.round((winScroll / height) * 100)
37
+ lastScrollTop = winScroll
38
+ this.$store.navIsVisible = !this.isNavHidden()
39
+ this.$store.subNavIsVisible = !this.isSubNavHidden()
40
+ //console.log('winscroll: '+winScroll+' screen height: '+height + ' percent scrolled: '+ this.percent)
41
+ //console.log('Scroll initiated by ' + (window.userScroll == true ? "user" : "browser"));
42
+ }
43
+ // Listeners
44
+ window.addEventListener('mousedown', mouseDownHandler, false)
45
+ window.addEventListener('wheel', mouseEvent, false)
46
+ window.addEventListener('touchmove', mouseEvent, false)
47
+ window.addEventListener('scroll', this.debounce(scrollHandler, 50), { passive: true })
48
+ },
49
+ //Holds the percentage of scrolled viewport
50
+ percent: 0,
51
+
52
+ //defines the scroll direction
53
+ scrollingDown: true,
54
+
55
+ //returns true if section navigation is hidden on desktop OR service navigation is hidden on mobile
56
+ isNavHidden() {
57
+ if (this.$screen('lg')) {
58
+ return this.shouldSectionNavBeHidden()
59
+ } else {
60
+ return this.shouldServiceNavBeHidden()
61
+ }
62
+ },
63
+
64
+ //returns false if subnav is visible and true if subnav is hidden
65
+ isSubNavHidden() {
66
+ if (this.$screen('lg')) {
67
+ if (document.querySelector('.isSelectedAndOpen') !== null) {
68
+ return false
69
+ } else {
70
+ return true
71
+ }
72
+ } else {
73
+ return true
74
+ }
75
+ },
76
+
77
+ // returns true if the user scrolled at least 1px from top
78
+ shouldBrandNavBeHidden() {
79
+ return this.percent > 0
80
+ },
81
+
82
+ // returns true if user scrolled >50% and scrolls down, no burger menu is open and the screen size is desktop. If scroll was initiated by script, ignore scroll direction.
83
+ shouldSectionNavBeHidden() {
84
+ if (window.userScroll == true) {
85
+ return (
86
+ this.percent > 50 &&
87
+ this.scrollingDown &&
88
+ this.$store.burgeropen == false &&
89
+ this.$screen('lg')
90
+ )
91
+ } else {
92
+ return this.percent > 50 && this.$store.burgeropen == false && this.$screen('lg')
93
+ }
94
+ },
95
+
96
+ // returns true if user scrolled >90% and scrolls further down, no burger menu is open and the screen is NOT desktop. If scroll was initiated by script, ignore scroll direction.
97
+ shouldServiceNavBeHidden() {
98
+ if (window.userScroll == true) {
99
+ return (
100
+ this.percent > 90 &&
101
+ !this.$screen('lg') &&
102
+ this.scrollingDown &&
103
+ this.$store.burgeropen == false
104
+ )
105
+ } else {
106
+ return this.percent > 90 && !this.$screen('lg') && this.$store.burgeropen == false
107
+ }
108
+ },
109
+
110
+ //returns true if user scrolled >50% and scrolls further down, no burger menu is open, no serviceNav is open and screen is not larger than mobile. OR: same same, but scrolling up.
111
+ shouldServiceIconsBeHidden() {
112
+ return (
113
+ (this.percent > 50 &&
114
+ !this.$screen('md') &&
115
+ this.$store.burgeropen == false &&
116
+ this.$store.serviceNavIsOpen == false &&
117
+ this.scrollingDown == true) ||
118
+ (this.percent > 50 &&
119
+ !this.$screen('md') &&
120
+ this.$store.burgeropen == false &&
121
+ this.$store.serviceNavIsOpen == false &&
122
+ this.scrollingDown == false)
123
+ )
124
+ },
125
+
126
+ // returns true if user scrolled >50% and scrolls further down and is a desktop viewport
127
+ shouldFlyoutBeHidden() {
128
+ return this.percent > 50 && this.scrollingDown && this.$screen('lg')
129
+ },
130
+
131
+ // resets the navigation back to the initial state. Happens f.ex. on resize of window.
132
+ resetNav() {
133
+ if (window.innerWidth > 1023) {
134
+ this.$refs.sectionnavigation.setAttribute('style', '')
135
+ } else {
136
+ // todo vasco: checken ob das wieder rein sollte
137
+ // hidden needs to be set here to avoid flickering of the sectionNav on viewport change, gets removed in timeout
138
+ // this.$refs.sectionnavigation.classList.add('hidden')
139
+ // this.$refs.sectionnavigation.style.maxHeight="0px"
140
+ }
141
+
142
+ let nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight
143
+ let nowClientWidth = document.documentElement.clientWidth || document.body.clientWidth
144
+ let nextNowClientHeight = this.$store.clientHeight
145
+ if (nextNowClientHeight >= nowClientHeight && this.$store.clientWidth == nowClientWidth) {
146
+ // Event handling of keyboard pop-up
147
+ nextNowClientHeight = nowClientHeight
148
+ this.$store.clientWidth = nowClientWidth
149
+ } else {
150
+ // timeout is used to dispatch events after the resize is done
151
+ let timeout
152
+ clearTimeout(timeout)
153
+ timeout = setTimeout(() => {
154
+ this.$refs.sectionnavigation.classList.remove('hidden')
155
+ this.$store.burgeropen == true ? this.$dispatch('burger-close') : null
156
+ this.$store.searchFieldOpen === true
157
+ ? this.$dispatch('search-mobile-click-outside')
158
+ : null
159
+ this.$store.searchFieldOpen === true ? this.$dispatch('search-close') : null
160
+ this.$store.serviceNavIsOpen === true ? this.$dispatch('close-servicemenu') : null
161
+ this.toggleScrolling(true)
162
+ }, 250)
163
+ // Event handling of keyboard pop-up
164
+ nextNowClientHeight = nowClientHeight
165
+ this.$store.clientWidth = nowClientWidth
166
+ }
167
+ },
168
+
169
+ // toggles the maxHeight of the section nav and makes sure there is enough space to display all items.
170
+ toggleSectionNav() {
171
+ //false = sectionNav schließt ( mobile/tablet? --> maxHeight = 0 /// desktop? just clear maxHeight attribute )
172
+ //true = sectionNav öffnet (maxheight = scrollheight)
173
+ console.log('toggleSectionNav, Event: ' + this.$event.detail)
174
+ if (this.$event.detail === false) {
175
+ if (window.innerWidth < 1024) {
176
+ this.$refs.sectionnavigation.style.maxHeight = '0px'
177
+ } else {
178
+ this.$refs.sectionnavigation.style.maxHeight = ''
179
+ }
180
+ } else {
181
+ let winheightcorr =
182
+ parseInt(window.innerHeight) - this.$refs.sectionnavigation.offsetTop
183
+ let navheight = parseInt(this.$refs.sectionnavigation.scrollHeight)
184
+ let brandNavHeight = this.percent > 0 ? 40 : 0
185
+
186
+ if (navheight > winheightcorr) {
187
+ this.$refs.sectionnavigation.style.overflowY = 'scroll'
188
+ this.$refs.sectionnavigation.style.maxHeight = winheightcorr + brandNavHeight + 'px'
189
+ } else {
190
+ this.$refs.sectionnavigation.style.overflowY = 'hidden'
191
+ this.$refs.sectionnavigation.style.maxHeight = this.$el.scrollHeight + 'px'
192
+ }
193
+ }
194
+ },
195
+
196
+ // no scrolling when overlay is visible
197
+ disableScrolling() {
198
+ document.body.classList.add('overflow-hidden', 'h-full', 'w-full')
199
+ this.$refs.myOverlay.ontouchmove = (e) => e.preventDefault()
200
+ console.log('disableScrolling')
201
+ },
202
+
203
+ //only scroll when no overlay is visible
204
+ enableScrolling() {
205
+ document.body.classList.remove('overflow-hidden', 'h-full', 'w-full')
206
+ this.$refs.myOverlay.ontouchmove = (e) => true
207
+ console.log('enableScrolling')
208
+ },
209
+
210
+ // toggles scrolling ability
211
+ toggleScrolling(mode) {
212
+ if (this.$screen(0) && !this.$screen('lg')) {
213
+ mode == false ? this.disableScrolling() : this.enableScrolling()
214
+ }
215
+ if (this.$screen('lg') && mode == true) {
216
+ this.enableScrolling()
217
+ }
218
+ },
219
+ })
@@ -0,0 +1,20 @@
1
+ export default () => ({
2
+ // show the overlay on mobile and tablet if burger menu is open OR service nav is open OR search field is open
3
+ shouldOverlayBeShown() {
4
+ return (
5
+ !this.$screen('lg') &&
6
+ (this.$store.burgeropen == true ||
7
+ this.$store.serviceNavIsOpen == true ||
8
+ this.$store.searchFieldOpen == true)
9
+ )
10
+ },
11
+
12
+ // on click on overlay change global var for servicenav, dispatch events to close burger and service menu, re-enable scrolling.
13
+ overlayWasClicked() {
14
+ this.$store.serviceNavIsOpen ? (this.$store.serviceNavIsOpen = false) : null
15
+ this.$dispatch('burger-close')
16
+ this.$dispatch('close-servicemenu')
17
+ // this.$dispatch('toggleScrolling', true )
18
+ this.toggleScrolling(true)
19
+ },
20
+ })
File without changes
@@ -4,7 +4,6 @@
4
4
  class="relative w-full"
5
5
  ax-load
6
6
  x-ignore
7
- ax-load-src={{resourceUrl "assets/js/vendor/horizontal_scroll_container.alpine.js" }}
8
7
  >
9
8
  <template x-if="isScrollable && $screen('{{_viewport}}')">
10
9
  <div>
@@ -52,11 +52,10 @@
52
52
 
53
53
  {{!-- Player UI --}}
54
54
  <div class="flex {{inline-switch this.realTeaserSize '["100","50"]' '["lg:pr-48 lg:-mt-14"," "]'}}"
55
- x-data="playaudio()"
55
+ x-data="podcastPlayer()"
56
56
  x-init="listenToGlobalStop()"
57
57
  ax-load
58
- x-ignore
59
- ax-load-src={{resourceUrl "assets/js/vendor/podcast_player.alpine.js" }}>
58
+ x-ignore>
60
59
  {{> components/podcast/components/podcast_player_ui
61
60
  _isPlaylistPlayer=false
62
61
  _podcastDuration=duration
@@ -1,11 +1,10 @@
1
1
  {{~#with this.remainingPlaylistItems}}
2
2
 
3
3
  <div class="flex flex-col col-span-12 gap-5 px-5"
4
- x-data="playaudio()"
4
+ x-data="podcastPlayer()"
5
5
  x-init="listenToGlobalStop()"
6
6
  ax-load
7
- x-ignore
8
- ax-load-src={{resourceUrl "assets/js/vendor/podcast_player.alpine.js" }}>
7
+ x-ignore>
9
8
  {{#each this}}
10
9
  <div class="flex pb-5 {{#if @first}}pt-5 border-t border-white {{/if}}{{#unless @last}}border-white border-b{{/unless}}">
11
10
  {{> components/podcast/components/podcast_player_ui
@@ -44,11 +44,10 @@
44
44
 
45
45
  {{!-- Player UI --}}
46
46
  <div class="flex flex-col col-span-12 gap-5 px-5 {{#if _isArticlePlayer }}pt-5 {{/if}} "
47
- x-data="playaudio()"
47
+ x-data="podcastPlayer()"
48
48
  x-init="listenToGlobalStop()"
49
49
  ax-load
50
- x-ignore
51
- ax-load-src={{resourceUrl "assets/js/vendor/podcast_player.alpine.js" }}>
50
+ x-ignore>
52
51
  {{#each this.playlistItems}}
53
52
  <div class="flex pb-5 {{#unless @last}}border-white border-b{{/unless}}">
54
53
  {{> components/podcast/components/podcast_player_ui