hr-design-system-handlebars 1.40.3 → 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 +24 -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/base/image/responsive_image.hbs +4 -4
- 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/base/image/responsive_image.hbs +4 -4
- 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/base/image/responsive_image.hbs +4 -4
- 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
|
@@ -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
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<picture class="{{~#if ../_addClass}} {{../_addClass}}{{/if}}">
|
|
17
17
|
{{#unless _disableNoScript}}
|
|
18
18
|
<noscript>
|
|
19
|
-
<img class="{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" src="{{this.fallback}}" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}">
|
|
19
|
+
<img class="w-full{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" src="{{this.fallback}}" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}">
|
|
20
20
|
</noscript>
|
|
21
21
|
{{/unless}}
|
|
22
22
|
{{#with this.sources}}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{{#with this.srcset}} srcset="{{this}}"{{/with}}>
|
|
27
27
|
{{/each}}
|
|
28
28
|
{{/with}}
|
|
29
|
-
<img class="{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" loading="{{#if ../_noDelay}}auto{{else}}lazy{{/if}}" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}" {{~#if ../_errorHandler }} onerror="this.onerror=null; {{../_errorHandler}}"{{/if}}>
|
|
29
|
+
<img class="w-full{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" loading="{{#if ../_noDelay}}auto{{else}}lazy{{/if}}" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}" {{~#if ../_errorHandler }} onerror="this.onerror=null; {{../_errorHandler}}"{{/if}}>
|
|
30
30
|
</picture>
|
|
31
31
|
{{/if}}
|
|
32
32
|
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
{{~#with ../../_addClass }}<div class="{{this}}">{{/with}}
|
|
36
36
|
{{#unless ../../_disableNoScript}}
|
|
37
37
|
<noscript>
|
|
38
|
-
<img class="{{~#if ../../_addClassImg}} {{../../_addClassImg}}{{/if}}" src="{{../this.fallback}}" alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}">
|
|
38
|
+
<img class="w-full{{~#if ../../_addClassImg}} {{../../_addClassImg}}{{/if}}" src="{{../this.fallback}}" alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}">
|
|
39
39
|
</noscript>
|
|
40
40
|
{{/unless}}
|
|
41
41
|
<img {{#with this.sizes}}sizes="{{this}}" {{/with~}}
|
|
42
42
|
loading="{{#if ../../_noDelay}}auto{{else}}lazy{{/if}}"
|
|
43
43
|
{{#with this.srcset}} {{#if ../../../_noDelay}}srcset{{else}}data-srcset{{/if}}="{{this}}"{{/with}}
|
|
44
44
|
src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
|
|
45
|
-
alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}" class="{{~#with ../../_addClassImg }} {{this}}{{/with}}" {{~#if ../../_errorHandler}} onerror="this.onerror=null; {{../../_errorHandler}}" {{~/if}}>
|
|
45
|
+
alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}" class="w-full{{~#with ../../_addClassImg }} {{this}}{{/with}}" {{~#if ../../_errorHandler}} onerror="this.onerror=null; {{../../_errorHandler}}" {{~/if}}>
|
|
46
46
|
{{~#with ../../_addClass }}</div>{{/with}}
|
|
47
47
|
{{/with}}
|
|
48
48
|
|
|
@@ -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()
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<picture class="{{~#if ../_addClass}} {{../_addClass}}{{/if}}">
|
|
17
17
|
{{#unless _disableNoScript}}
|
|
18
18
|
<noscript>
|
|
19
|
-
<img class="{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" src="{{this.fallback}}" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}">
|
|
19
|
+
<img class="w-full{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" src="{{this.fallback}}" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}">
|
|
20
20
|
</noscript>
|
|
21
21
|
{{/unless}}
|
|
22
22
|
{{#with this.sources}}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{{#with this.srcset}} srcset="{{this}}"{{/with}}>
|
|
27
27
|
{{/each}}
|
|
28
28
|
{{/with}}
|
|
29
|
-
<img class="{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" loading="{{#if ../_noDelay}}auto{{else}}lazy{{/if}}" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}" {{~#if ../_errorHandler }} onerror="this.onerror=null; {{../_errorHandler}}"{{/if}}>
|
|
29
|
+
<img class="w-full{{~#if ../_addClassImg}} {{../_addClassImg}}{{/if}}" loading="{{#if ../_noDelay}}auto{{else}}lazy{{/if}}" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="{{#if ../_alttext}}{{../_alttext}}{{else}}{{../this.alttext}}{{/if}}" {{~#if ../_errorHandler }} onerror="this.onerror=null; {{../_errorHandler}}"{{/if}}>
|
|
30
30
|
</picture>
|
|
31
31
|
{{/if}}
|
|
32
32
|
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
{{~#with ../../_addClass }}<div class="{{this}}">{{/with}}
|
|
36
36
|
{{#unless ../../_disableNoScript}}
|
|
37
37
|
<noscript>
|
|
38
|
-
<img class="{{~#if ../../_addClassImg}} {{../../_addClassImg}}{{/if}}" src="{{../this.fallback}}" alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}">
|
|
38
|
+
<img class="w-full{{~#if ../../_addClassImg}} {{../../_addClassImg}}{{/if}}" src="{{../this.fallback}}" alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}">
|
|
39
39
|
</noscript>
|
|
40
40
|
{{/unless}}
|
|
41
41
|
<img {{#with this.sizes}}sizes="{{this}}" {{/with~}}
|
|
42
42
|
loading="{{#if ../../_noDelay}}auto{{else}}lazy{{/if}}"
|
|
43
43
|
{{#with this.srcset}} {{#if ../../../_noDelay}}srcset{{else}}data-srcset{{/if}}="{{this}}"{{/with}}
|
|
44
44
|
src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
|
|
45
|
-
alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}" class="{{~#with ../../_addClassImg }} {{this}}{{/with}}" {{~#if ../../_errorHandler}} onerror="this.onerror=null; {{../../_errorHandler}}" {{~/if}}>
|
|
45
|
+
alt="{{#if ../../_alttext}}{{../../_alttext}}{{else}}{{../../this.alttext}}{{/if}}" class="w-full{{~#with ../../_addClassImg }} {{this}}{{/with}}" {{~#if ../../_errorHandler}} onerror="this.onerror=null; {{../../_errorHandler}}" {{~/if}}>
|
|
46
46
|
{{~#with ../../_addClass }}</div>{{/with}}
|
|
47
47
|
{{/with}}
|
|
48
48
|
|
|
@@ -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
|
+
})
|