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.
- package/.storybook/preview-head.html +0 -5
- package/.storybook/preview.js +1 -1
- package/CHANGELOG.md +12 -0
- package/build/scripts/build.js +4 -1
- package/dist/assets/index.css +3 -3
- package/dist/assets/js/alpine.js +47 -0
- package/{src/assets/vendor/js → dist/assets/js/components/podcast}/podcast_player.alpine.js +0 -92
- package/dist/assets/js/components/site_header/dropdown.alpine.js +77 -0
- package/dist/assets/js/components/site_header/flyoutHandler.alpine.js +54 -0
- package/dist/assets/js/components/site_header/mainNavigationHandler.alpine.js +219 -0
- package/dist/assets/js/components/site_header/overlayHandler.alpine.js +20 -0
- package/dist/assets/js/empty.js +0 -0
- package/dist/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs +0 -1
- package/dist/views/components/podcast/podcast_player.hbs +2 -3
- package/dist/views/components/podcast/podcast_playlist_player-inline.hbs +2 -3
- package/dist/views/components/podcast/podcast_playlist_player.hbs +2 -3
- package/dist/views/components/podcast/podcast_playlist_player_all_episodes.hbs +2 -3
- package/dist/views_static/components/horizontal_scroll_container/horizontal_scroll_container.hbs +0 -1
- package/dist/views_static/components/podcast/podcast_player.hbs +2 -3
- package/dist/views_static/components/podcast/podcast_playlist_player-inline.hbs +2 -3
- package/dist/views_static/components/podcast/podcast_playlist_player.hbs +2 -3
- package/dist/views_static/components/podcast/podcast_playlist_player_all_episodes.hbs +2 -3
- package/package.json +1 -1
- package/src/assets/js/alpine.js +47 -0
- package/src/stories/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs +0 -1
- package/src/stories/views/components/podcast/podcast_player.alpine.js +194 -0
- package/src/stories/views/components/podcast/podcast_player.hbs +2 -3
- package/src/stories/views/components/podcast/podcast_playlist_player-inline.hbs +2 -3
- package/src/stories/views/components/podcast/podcast_playlist_player.hbs +2 -3
- package/src/stories/views/components/podcast/podcast_playlist_player_all_episodes.hbs +2 -3
- package/src/stories/views/components/site_header/dropdown.alpine.js +77 -0
- package/src/stories/views/components/site_header/flyoutHandler.alpine.js +54 -0
- package/src/stories/views/components/site_header/mainNavigationHandler.alpine.js +219 -0
- package/src/stories/views/components/site_header/overlayHandler.alpine.js +20 -0
- package/dist/assets/vendor/js/header.alpine.js +0 -414
- package/src/assets/vendor/js/header.alpine.js +0 -414
- /package/dist/assets/{vendor/js → js/components/horizontal_scroll_container}/horizontal_scroll_container.alpine.js +0 -0
- /package/src/{assets/vendor/js → stories/views/components/horizontal_scroll_container}/horizontal_scroll_container.alpine.js +0 -0
- /package/{dist/assets/vendor/js/podcast_player.alpine.js → src/stories/views/components/podcast/podcast_player.alpine.new.js} +0 -0
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
|
|
47
47
|
{{!-- Player UI --}}
|
|
48
48
|
<div class="flex flex-col col-span-12 gap-5 px-5"
|
|
49
|
-
x-data="
|
|
49
|
+
x-data="podcastPlayer()"
|
|
50
50
|
x-init="listenToGlobalStop()"
|
|
51
51
|
ax-load
|
|
52
|
-
x-ignore
|
|
53
|
-
ax-load-src={{resourceUrl "assets/js/vendor/podcast_player.alpine.js" }}>
|
|
52
|
+
x-ignore>
|
|
54
53
|
{{#each this.allPlaylistItems}}
|
|
55
54
|
<div class="flex pb-5 {{#unless @last}}border-white border-b{{/unless}}">
|
|
56
55
|
{{> components/podcast/components/podcast_player_ui
|
|
@@ -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="
|
|
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="
|
|
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="
|
|
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
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
|
|
47
47
|
{{!-- Player UI --}}
|
|
48
48
|
<div class="flex flex-col col-span-12 gap-5 px-5"
|
|
49
|
-
x-data="
|
|
49
|
+
x-data="podcastPlayer()"
|
|
50
50
|
x-init="listenToGlobalStop()"
|
|
51
51
|
ax-load
|
|
52
|
-
x-ignore
|
|
53
|
-
ax-load-src={{resourceUrl "assets/js/vendor/podcast_player.alpine.js" }}>
|
|
52
|
+
x-ignore>
|
|
54
53
|
{{#each this.allPlaylistItems}}
|
|
55
54
|
<div class="flex pb-5 {{#unless @last}}border-white border-b{{/unless}}">
|
|
56
55
|
{{> components/podcast/components/podcast_player_ui
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"repository": "https://github.com/szuelch/hr-design-system-handlebars",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.42.0",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"storybook": "storybook dev -p 6006 public",
|
|
@@ -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()
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
export default function playaudio() {
|
|
2
|
+
return {
|
|
3
|
+
dispatchCustomEvent(
|
|
4
|
+
eventName,
|
|
5
|
+
{ data = undefined, element = document, handleIframe = false, id = undefined } = {}
|
|
6
|
+
) {
|
|
7
|
+
let event
|
|
8
|
+
|
|
9
|
+
if (undefined != data) {
|
|
10
|
+
data = { detail: data }
|
|
11
|
+
event = new CustomEvent(eventName, data)
|
|
12
|
+
} else {
|
|
13
|
+
if (typeof Event === 'function') {
|
|
14
|
+
event = new Event(eventName)
|
|
15
|
+
} else {
|
|
16
|
+
event = document.createEvent('Event')
|
|
17
|
+
event.initEvent(eventName, true, true)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (undefined !== id) {
|
|
21
|
+
event.id = id
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (handleIframe) {
|
|
25
|
+
if (document.getElementById('js-iFrame')) {
|
|
26
|
+
document.getElementById('js-iFrame').contentWindow.document.dispatchEvent(event)
|
|
27
|
+
}
|
|
28
|
+
if (this.inIframe()) {
|
|
29
|
+
parent.document.dispatchEvent(event)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
element.dispatchEvent(event)
|
|
34
|
+
},
|
|
35
|
+
inIframe() {
|
|
36
|
+
try {
|
|
37
|
+
return window.self !== window.top
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
playerCount: 0,
|
|
43
|
+
playlist: {},
|
|
44
|
+
registerPlayer(duration, id) {
|
|
45
|
+
let _player = {}
|
|
46
|
+
_player.id = id
|
|
47
|
+
_player.button = document.querySelector('#playbutton' + id)
|
|
48
|
+
_player.playIcon = _player.button.querySelector('.js-playbutton')
|
|
49
|
+
_player.pauseIcon = _player.button.querySelector('.js-pausebutton')
|
|
50
|
+
_player.range = document.querySelector('#range' + id)
|
|
51
|
+
_player.timeDisplay = document.querySelector('#timedisplay' + id)
|
|
52
|
+
_player.audioElement = this.$el
|
|
53
|
+
_player.audioSrc = this.$el.querySelector('source').src
|
|
54
|
+
_player.duration = duration
|
|
55
|
+
_player.currentlyPlaying = false
|
|
56
|
+
_player.init = false
|
|
57
|
+
_player.firstPlay = true
|
|
58
|
+
|
|
59
|
+
// this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
|
|
60
|
+
this.playerCount++
|
|
61
|
+
|
|
62
|
+
this.playlist[id] = _player
|
|
63
|
+
},
|
|
64
|
+
listenToGlobalStop() {
|
|
65
|
+
console.log('global listener init')
|
|
66
|
+
document.addEventListener(
|
|
67
|
+
'hr:global:stopOtherAVs',
|
|
68
|
+
this.stopAllPlayersBecauseOfGlobalStop.bind(this)
|
|
69
|
+
)
|
|
70
|
+
},
|
|
71
|
+
rangeInput(id) {
|
|
72
|
+
if (this.playlist[id].init == false) {
|
|
73
|
+
this.playAndStop(id)
|
|
74
|
+
this.playAndStop(id)
|
|
75
|
+
}
|
|
76
|
+
this.playlist[id].audioElement.currentTime =
|
|
77
|
+
(this.playlist[id].range.value / 1000) * this.playlist[id].audioElement.duration
|
|
78
|
+
},
|
|
79
|
+
setTime(duration, id) {
|
|
80
|
+
console.log('time set: ' + duration)
|
|
81
|
+
|
|
82
|
+
let parts = duration.split(':')
|
|
83
|
+
if (parts.length < 3) {
|
|
84
|
+
let minutes = +parts[0]
|
|
85
|
+
let seconds = +parts[1]
|
|
86
|
+
var durationSeconds = (minutes * 60 + seconds).toFixed(3)
|
|
87
|
+
} else {
|
|
88
|
+
let hours = +parts[0]
|
|
89
|
+
let minutes = +parts[1]
|
|
90
|
+
let seconds = +parts[2]
|
|
91
|
+
var durationSeconds = (hours * 3600 + minutes * 60 + seconds).toFixed(3)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let range = document.getElementById('range' + id)
|
|
95
|
+
range.value = 0
|
|
96
|
+
this.$el.querySelector('.js-currentTime').innerHTML = this.fancyTimeFormat('0', false)
|
|
97
|
+
this.$el.querySelector('.js-audioDuration').innerHTML = this.fancyTimeFormat(
|
|
98
|
+
durationSeconds,
|
|
99
|
+
true
|
|
100
|
+
)
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
updateCurrentTime(range, timeDisplay, newTime, id) {
|
|
104
|
+
timeDisplay.querySelector('.js-currentTime').innerHTML = this.fancyTimeFormat(
|
|
105
|
+
newTime,
|
|
106
|
+
false
|
|
107
|
+
)
|
|
108
|
+
range.style.background =
|
|
109
|
+
'linear-gradient(to right, var(--color-podcast) ' +
|
|
110
|
+
range.value / 10 +
|
|
111
|
+
'%, white ' +
|
|
112
|
+
range.value / 10 +
|
|
113
|
+
'% )'
|
|
114
|
+
range.value = ((100 * newTime) / this.playlist[id].audioElement.duration) * 10
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
playAndStop(id) {
|
|
118
|
+
console.log('event target: ' + this.$event.currentTarget.id)
|
|
119
|
+
console.log('playlist: ', this.playlist)
|
|
120
|
+
if (this.playlist[id].init == true) {
|
|
121
|
+
this.stopAudio(id)
|
|
122
|
+
} else {
|
|
123
|
+
this.stopAllOtherPlayers(id, false)
|
|
124
|
+
this.startAudio(id)
|
|
125
|
+
this.playlist[id].range.parentNode.classList.remove('max-h-0')
|
|
126
|
+
this.playlist[id].range.parentNode.classList.add('max-h-9')
|
|
127
|
+
this.playlist[id].playIcon.classList.add('hidden')
|
|
128
|
+
this.playlist[id].pauseIcon.classList.remove('hidden')
|
|
129
|
+
this.dispatchCustomEvent('hr:global:stopOtherAVs', { handleIframe: true, id: id })
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
stopAllOtherPlayers(id, preventMinimize) {
|
|
134
|
+
for (const index in this.playlist) {
|
|
135
|
+
if (index != id) {
|
|
136
|
+
console.log('STOP: ', index)
|
|
137
|
+
this.stopAudio(index)
|
|
138
|
+
if (!preventMinimize) {
|
|
139
|
+
this.playlist[index].range.parentNode.classList.add('max-h-0')
|
|
140
|
+
this.playlist[index].range.parentNode.classList.remove('max-h-9')
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
stopAllPlayersBecauseOfGlobalStop(event) {
|
|
146
|
+
this.stopAllOtherPlayers(event.id, true)
|
|
147
|
+
},
|
|
148
|
+
startAudio(id) {
|
|
149
|
+
console.log('start audio ' + id)
|
|
150
|
+
if (this.playlist[id].init == false) {
|
|
151
|
+
this.initAudioEventListener(id)
|
|
152
|
+
this.playlist[id].init = true
|
|
153
|
+
}
|
|
154
|
+
this.playlist[id].audioElement.play()
|
|
155
|
+
this.playlist[id].currentlyPlaying = true
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
stopAudio(id) {
|
|
159
|
+
this.playlist[id].audioElement.pause()
|
|
160
|
+
this.playlist[id].init = false
|
|
161
|
+
this.playlist[id].currentlyPlaying = false
|
|
162
|
+
this.playlist[id].playIcon.classList.remove('hidden')
|
|
163
|
+
this.playlist[id].pauseIcon.classList.add('hidden')
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
initAudioEventListener(id) {
|
|
167
|
+
let _audioElement = this.playlist[id].audioElement
|
|
168
|
+
let _range = this.playlist[id].range
|
|
169
|
+
let _timeDisplay = this.playlist[id].timeDisplay
|
|
170
|
+
_audioElement.ontimeupdate = (event) => {
|
|
171
|
+
this.updateCurrentTime(_range, _timeDisplay, _audioElement.currentTime, id)
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
fancyTimeFormat(duration, measure) {
|
|
176
|
+
var hrs = ~~(duration / 3600)
|
|
177
|
+
var mins = ~~((duration % 3600) / 60)
|
|
178
|
+
var secs = ~~duration % 60
|
|
179
|
+
|
|
180
|
+
var ret = ''
|
|
181
|
+
if (hrs > 0) {
|
|
182
|
+
ret += '' + hrs + ':' + (mins < 10 ? '0' : '')
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
ret += '' + mins + ':' + (secs < 10 ? '0' : '')
|
|
186
|
+
ret += '' + secs
|
|
187
|
+
|
|
188
|
+
if (measure) {
|
|
189
|
+
hrs > 0 ? (ret += ' Std.') : (ret += ' Min.')
|
|
190
|
+
}
|
|
191
|
+
return ret
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -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="
|
|
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="
|
|
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="
|
|
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
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
|
|
47
47
|
{{!-- Player UI --}}
|
|
48
48
|
<div class="flex flex-col col-span-12 gap-5 px-5"
|
|
49
|
-
x-data="
|
|
49
|
+
x-data="podcastPlayer()"
|
|
50
50
|
x-init="listenToGlobalStop()"
|
|
51
51
|
ax-load
|
|
52
|
-
x-ignore
|
|
53
|
-
ax-load-src={{resourceUrl "assets/js/vendor/podcast_player.alpine.js" }}>
|
|
52
|
+
x-ignore>
|
|
54
53
|
{{#each this.allPlaylistItems}}
|
|
55
54
|
<div class="flex pb-5 {{#unless @last}}border-white border-b{{/unless}}">
|
|
56
55
|
{{> components/podcast/components/podcast_player_ui
|
|
@@ -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
|
+
})
|