hr-design-system-handlebars 1.33.1 → 1.33.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # v1.33.3 (Tue Jul 25 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Add hover effect to Ticker-Teaser headline [#687](https://github.com/mumprod/hr-design-system-handlebars/pull/687) (saad.elbaciri@hr.de [@selbaciri](https://github.com/selbaciri))
6
+
7
+ #### Authors: 2
8
+
9
+ - Saad El Baciri ([@selbaciri](https://github.com/selbaciri))
10
+ - selbaciri (saad.elbaciri@hr.de)
11
+
12
+ ---
13
+
14
+ # v1.33.2 (Thu Jul 20 2023)
15
+
16
+ #### 🐛 Bug Fix
17
+
18
+ - DPE-2419 - JS-Fehler in der Konsole [#686](https://github.com/mumprod/hr-design-system-handlebars/pull/686) ([@vascoeduardo](https://github.com/vascoeduardo))
19
+
20
+ #### Authors: 1
21
+
22
+ - Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
23
+
24
+ ---
25
+
1
26
  # v1.33.1 (Wed Jul 19 2023)
2
27
 
3
28
  #### 🐛 Bug Fix
@@ -2676,9 +2676,18 @@ video {
2676
2676
  -webkit-text-decoration-line: none;
2677
2677
  text-decoration-line: none;
2678
2678
  }
2679
+ .decoration-tickerTeaserHeadlineUnderline {
2680
+ -webkit-text-decoration-color: #ffffff;
2681
+ text-decoration-color: #ffffff;
2682
+ -webkit-text-decoration-color: var(--color-ticker-teaser-headline-underline);
2683
+ text-decoration-color: var(--color-ticker-teaser-headline-underline);
2684
+ }
2679
2685
  .decoration-1 {
2680
2686
  text-decoration-thickness: 1px;
2681
2687
  }
2688
+ .decoration-2 {
2689
+ text-decoration-thickness: 2px;
2690
+ }
2682
2691
  .placeholder-primary::-webkit-input-placeholder {
2683
2692
  color: #005293;
2684
2693
  color: var(--color-primary-ds);
@@ -2817,7 +2826,7 @@ video {
2817
2826
  transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
2818
2827
  }
2819
2828
  .counter-reset {
2820
- counter-reset: cnt1689780802351;
2829
+ counter-reset: cnt1690287794197;
2821
2830
  }
2822
2831
  .hyphens-auto {
2823
2832
  -webkit-hyphens: auto;
@@ -3052,7 +3061,7 @@ video {
3052
3061
  --tw-ring-color: rgba(255, 255, 255, 0.5);
3053
3062
  }
3054
3063
  .-ordered {
3055
- counter-increment: cnt1689780802351 1;
3064
+ counter-increment: cnt1690287794197 1;
3056
3065
  }
3057
3066
  .-ordered::before {
3058
3067
  position: absolute;
@@ -3068,7 +3077,7 @@ video {
3068
3077
  letter-spacing: .0125em;
3069
3078
  --tw-text-opacity: 1;
3070
3079
  color: rgba(0, 0, 0, var(--tw-text-opacity));
3071
- content: counter(cnt1689780802351);
3080
+ content: counter(cnt1690287794197);
3072
3081
  }
3073
3082
  /*! ****************************/
3074
3083
  /*! text-shadow */
@@ -3240,6 +3249,7 @@ video {
3240
3249
  --color-ticker-teaser-footer: #ffffff;
3241
3250
  --search-border-color-desktop: transparent;
3242
3251
  --search-border-color-mobile: var(--color-primary-ds);
3252
+ --color-ticker-teaser-headline-underline : #ffffff;
3243
3253
  }
3244
3254
  [data-theme='hessenschau'] {
3245
3255
  --color-primary-ds: #005293;
@@ -3319,10 +3329,10 @@ video {
3319
3329
  /* Border */
3320
3330
  --border-radius-hr: 1.5rem;
3321
3331
  /* ticker-Teaser*/
3322
- --color-ticker-teaser-headline: #ffffff;
3323
3332
  --color-ticker-teaser-label-byline: #ffffff;
3324
3333
  --color-ticker-teaser-timeline-score: #d34600;
3325
3334
  --color-ticker-teaser-footer: #ffffff;
3335
+ --color-ticker-teaser-headline : #ffffff;
3326
3336
  }
3327
3337
  [data-theme='hr-fernsehen'] {
3328
3338
  --color-primary-ds: #a00d65;
@@ -56,103 +56,12 @@ 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
63
 
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
64
  },
155
-
156
65
  listenToGlobalStop() {
157
66
  console.log('global listener init')
158
67
  document.addEventListener(
@@ -0,0 +1,286 @@
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
+ _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
+ // this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
66
+ this.playerCount++
67
+
68
+ 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
+ },
155
+
156
+ listenToGlobalStop() {
157
+ console.log('global listener init')
158
+ document.addEventListener(
159
+ 'hr:global:stopOtherAVs',
160
+ this.stopAllPlayersBecauseOfGlobalStop.bind(this)
161
+ )
162
+ },
163
+ rangeInput(id) {
164
+ if (this.playlist[id].init == false) {
165
+ this.playAndStop(id)
166
+ this.playAndStop(id)
167
+ }
168
+ this.playlist[id].audioElement.currentTime =
169
+ (this.playlist[id].range.value / 1000) * this.playlist[id].audioElement.duration
170
+ },
171
+ setTime(duration, id) {
172
+ console.log('time set: ' + duration)
173
+
174
+ let parts = duration.split(':')
175
+ if (parts.length < 3) {
176
+ let minutes = +parts[0]
177
+ let seconds = +parts[1]
178
+ var durationSeconds = (minutes * 60 + seconds).toFixed(3)
179
+ } else {
180
+ let hours = +parts[0]
181
+ let minutes = +parts[1]
182
+ let seconds = +parts[2]
183
+ var durationSeconds = (hours * 3600 + minutes * 60 + seconds).toFixed(3)
184
+ }
185
+
186
+ let range = document.getElementById('range' + id)
187
+ range.value = 0
188
+ this.$el.querySelector('.js-currentTime').innerHTML = this.fancyTimeFormat('0', false)
189
+ this.$el.querySelector('.js-audioDuration').innerHTML = this.fancyTimeFormat(
190
+ durationSeconds,
191
+ true
192
+ )
193
+ },
194
+
195
+ updateCurrentTime(range, timeDisplay, newTime, id) {
196
+ timeDisplay.querySelector('.js-currentTime').innerHTML = this.fancyTimeFormat(
197
+ newTime,
198
+ false
199
+ )
200
+ range.style.background =
201
+ 'linear-gradient(to right, var(--color-podcast) ' +
202
+ range.value / 10 +
203
+ '%, white ' +
204
+ range.value / 10 +
205
+ '% )'
206
+ range.value = ((100 * newTime) / this.playlist[id].audioElement.duration) * 10
207
+ },
208
+
209
+ playAndStop(id) {
210
+ console.log('event target: ' + this.$event.currentTarget.id)
211
+ console.log('playlist: ', this.playlist)
212
+ if (this.playlist[id].init == true) {
213
+ this.stopAudio(id)
214
+ } else {
215
+ this.stopAllOtherPlayers(id, false)
216
+ this.startAudio(id)
217
+ this.playlist[id].range.parentNode.classList.remove('max-h-0')
218
+ this.playlist[id].range.parentNode.classList.add('max-h-9')
219
+ this.playlist[id].playIcon.classList.add('hidden')
220
+ this.playlist[id].pauseIcon.classList.remove('hidden')
221
+ this.dispatchCustomEvent('hr:global:stopOtherAVs', { handleIframe: true, id: id })
222
+ }
223
+ },
224
+
225
+ stopAllOtherPlayers(id, preventMinimize) {
226
+ for (const index in this.playlist) {
227
+ if (index != id) {
228
+ console.log('STOP: ', index)
229
+ this.stopAudio(index)
230
+ if (!preventMinimize) {
231
+ this.playlist[index].range.parentNode.classList.add('max-h-0')
232
+ this.playlist[index].range.parentNode.classList.remove('max-h-9')
233
+ }
234
+ }
235
+ }
236
+ },
237
+ stopAllPlayersBecauseOfGlobalStop(event) {
238
+ this.stopAllOtherPlayers(event.id, true)
239
+ },
240
+ startAudio(id) {
241
+ console.log('start audio ' + id)
242
+ if (this.playlist[id].init == false) {
243
+ this.initAudioEventListener(id)
244
+ this.playlist[id].init = true
245
+ }
246
+ this.playlist[id].audioElement.play()
247
+ this.playlist[id].currentlyPlaying = true
248
+ },
249
+
250
+ stopAudio(id) {
251
+ this.playlist[id].audioElement.pause()
252
+ this.playlist[id].init = false
253
+ this.playlist[id].currentlyPlaying = false
254
+ this.playlist[id].playIcon.classList.remove('hidden')
255
+ this.playlist[id].pauseIcon.classList.add('hidden')
256
+ },
257
+
258
+ initAudioEventListener(id) {
259
+ let _audioElement = this.playlist[id].audioElement
260
+ let _range = this.playlist[id].range
261
+ let _timeDisplay = this.playlist[id].timeDisplay
262
+ _audioElement.ontimeupdate = (event) => {
263
+ this.updateCurrentTime(_range, _timeDisplay, _audioElement.currentTime, id)
264
+ }
265
+ },
266
+
267
+ fancyTimeFormat(duration, measure) {
268
+ var hrs = ~~(duration / 3600)
269
+ var mins = ~~((duration % 3600) / 60)
270
+ var secs = ~~duration % 60
271
+
272
+ var ret = ''
273
+ if (hrs > 0) {
274
+ ret += '' + hrs + ':' + (mins < 10 ? '0' : '')
275
+ }
276
+
277
+ ret += '' + mins + ':' + (secs < 10 ? '0' : '')
278
+ ret += '' + secs
279
+
280
+ if (measure) {
281
+ hrs > 0 ? (ret += ' Std.') : (ret += ' Min.')
282
+ }
283
+ return ret
284
+ },
285
+ }
286
+ }
@@ -1,14 +1,14 @@
1
1
  <div class="h-full flex-col flex w-full{{#if _outerCssClasses}} {{_outerCssClasses}}{{/if}}">
2
2
 
3
3
  {{#> components/teaser/components/teaser_header _css=(if this.isStandardTeaser "px-5" "px-5 md:px-0")}}
4
- {{#>components/base/link _link=this.link _css="block link-focus-white cy-teaser-link hover:text-toplineColor" }}
4
+ {{#>components/base/link _link=this.link _css="block link-focus-white cy-teaser-link" }}
5
5
  {{#with this.label}}
6
6
  {{#> components/label/label_group}}
7
7
  {{> components/label/label _type=this.type _text=(loca this.loca) }}
8
8
  {{> components/label/label_byline _css="ml-2 text-tickerTeaserlabelByline" _text=../../../this.tickerTopic }}
9
9
  {{/components/label/label_group}}
10
10
  {{/with~}}
11
- {{#> components/teaser/components/teaser_headline _headlineTag=this.headlineTag _css="overflow-anywhere hyphens-auto"}}
11
+ {{#> components/teaser/components/teaser_headline _headlineTag=this.headlineTag _css="overflow-anywhere hyphens-auto hover:underline decoration-2 decoration-tickerTeaserHeadlineUnderline"}}
12
12
  {{> components/teaser/components/teaser_title _css="text-tickerTeaserHeadline" _text=this.title _size=this.realTeaserSize _teaserType=this.teaserType _isMobile1to1=this.isMobile1to1}}
13
13
  {{#if this.extendedTitle}}
14
14
  {{> components/teaser/components/teaser_subline _text=this.extendedTitle}}
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.33.1",
9
+ "version": "1.33.3",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "storybook dev -p 6006 public",
@@ -110,6 +110,7 @@
110
110
  --color-ticker-teaser-footer: theme('colors.white.DEFAULT');
111
111
  --search-border-color-desktop: theme('colors.transparent');
112
112
  --search-border-color-mobile: var(--color-primary-ds);
113
+ --color-ticker-teaser-headline-underline : theme('colors.white.DEFAULT');
113
114
  }
114
115
 
115
116
  [data-theme='hessenschau'] {
@@ -194,6 +195,7 @@
194
195
  --color-ticker-teaser-label-byline: theme('colors.white.DEFAULT');
195
196
  --color-ticker-teaser-timeline-score: theme('colors.orange.spicyCarrot');
196
197
  --color-ticker-teaser-footer: theme('colors.white.DEFAULT');
198
+ --color-ticker-teaser-headline : theme('colors.white.DEFAULT');
197
199
  }
198
200
 
199
201
  [data-theme='hr-fernsehen'] {
@@ -56,103 +56,12 @@ 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
63
 
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
64
  },
155
-
156
65
  listenToGlobalStop() {
157
66
  console.log('global listener init')
158
67
  document.addEventListener(
@@ -0,0 +1,286 @@
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
+ _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
+ // this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
66
+ this.playerCount++
67
+
68
+ 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
+ },
155
+
156
+ listenToGlobalStop() {
157
+ console.log('global listener init')
158
+ document.addEventListener(
159
+ 'hr:global:stopOtherAVs',
160
+ this.stopAllPlayersBecauseOfGlobalStop.bind(this)
161
+ )
162
+ },
163
+ rangeInput(id) {
164
+ if (this.playlist[id].init == false) {
165
+ this.playAndStop(id)
166
+ this.playAndStop(id)
167
+ }
168
+ this.playlist[id].audioElement.currentTime =
169
+ (this.playlist[id].range.value / 1000) * this.playlist[id].audioElement.duration
170
+ },
171
+ setTime(duration, id) {
172
+ console.log('time set: ' + duration)
173
+
174
+ let parts = duration.split(':')
175
+ if (parts.length < 3) {
176
+ let minutes = +parts[0]
177
+ let seconds = +parts[1]
178
+ var durationSeconds = (minutes * 60 + seconds).toFixed(3)
179
+ } else {
180
+ let hours = +parts[0]
181
+ let minutes = +parts[1]
182
+ let seconds = +parts[2]
183
+ var durationSeconds = (hours * 3600 + minutes * 60 + seconds).toFixed(3)
184
+ }
185
+
186
+ let range = document.getElementById('range' + id)
187
+ range.value = 0
188
+ this.$el.querySelector('.js-currentTime').innerHTML = this.fancyTimeFormat('0', false)
189
+ this.$el.querySelector('.js-audioDuration').innerHTML = this.fancyTimeFormat(
190
+ durationSeconds,
191
+ true
192
+ )
193
+ },
194
+
195
+ updateCurrentTime(range, timeDisplay, newTime, id) {
196
+ timeDisplay.querySelector('.js-currentTime').innerHTML = this.fancyTimeFormat(
197
+ newTime,
198
+ false
199
+ )
200
+ range.style.background =
201
+ 'linear-gradient(to right, var(--color-podcast) ' +
202
+ range.value / 10 +
203
+ '%, white ' +
204
+ range.value / 10 +
205
+ '% )'
206
+ range.value = ((100 * newTime) / this.playlist[id].audioElement.duration) * 10
207
+ },
208
+
209
+ playAndStop(id) {
210
+ console.log('event target: ' + this.$event.currentTarget.id)
211
+ console.log('playlist: ', this.playlist)
212
+ if (this.playlist[id].init == true) {
213
+ this.stopAudio(id)
214
+ } else {
215
+ this.stopAllOtherPlayers(id, false)
216
+ this.startAudio(id)
217
+ this.playlist[id].range.parentNode.classList.remove('max-h-0')
218
+ this.playlist[id].range.parentNode.classList.add('max-h-9')
219
+ this.playlist[id].playIcon.classList.add('hidden')
220
+ this.playlist[id].pauseIcon.classList.remove('hidden')
221
+ this.dispatchCustomEvent('hr:global:stopOtherAVs', { handleIframe: true, id: id })
222
+ }
223
+ },
224
+
225
+ stopAllOtherPlayers(id, preventMinimize) {
226
+ for (const index in this.playlist) {
227
+ if (index != id) {
228
+ console.log('STOP: ', index)
229
+ this.stopAudio(index)
230
+ if (!preventMinimize) {
231
+ this.playlist[index].range.parentNode.classList.add('max-h-0')
232
+ this.playlist[index].range.parentNode.classList.remove('max-h-9')
233
+ }
234
+ }
235
+ }
236
+ },
237
+ stopAllPlayersBecauseOfGlobalStop(event) {
238
+ this.stopAllOtherPlayers(event.id, true)
239
+ },
240
+ startAudio(id) {
241
+ console.log('start audio ' + id)
242
+ if (this.playlist[id].init == false) {
243
+ this.initAudioEventListener(id)
244
+ this.playlist[id].init = true
245
+ }
246
+ this.playlist[id].audioElement.play()
247
+ this.playlist[id].currentlyPlaying = true
248
+ },
249
+
250
+ stopAudio(id) {
251
+ this.playlist[id].audioElement.pause()
252
+ this.playlist[id].init = false
253
+ this.playlist[id].currentlyPlaying = false
254
+ this.playlist[id].playIcon.classList.remove('hidden')
255
+ this.playlist[id].pauseIcon.classList.add('hidden')
256
+ },
257
+
258
+ initAudioEventListener(id) {
259
+ let _audioElement = this.playlist[id].audioElement
260
+ let _range = this.playlist[id].range
261
+ let _timeDisplay = this.playlist[id].timeDisplay
262
+ _audioElement.ontimeupdate = (event) => {
263
+ this.updateCurrentTime(_range, _timeDisplay, _audioElement.currentTime, id)
264
+ }
265
+ },
266
+
267
+ fancyTimeFormat(duration, measure) {
268
+ var hrs = ~~(duration / 3600)
269
+ var mins = ~~((duration % 3600) / 60)
270
+ var secs = ~~duration % 60
271
+
272
+ var ret = ''
273
+ if (hrs > 0) {
274
+ ret += '' + hrs + ':' + (mins < 10 ? '0' : '')
275
+ }
276
+
277
+ ret += '' + mins + ':' + (secs < 10 ? '0' : '')
278
+ ret += '' + secs
279
+
280
+ if (measure) {
281
+ hrs > 0 ? (ret += ' Std.') : (ret += ' Min.')
282
+ }
283
+ return ret
284
+ },
285
+ }
286
+ }
@@ -1,14 +1,14 @@
1
1
  <div class="h-full flex-col flex w-full{{#if _outerCssClasses}} {{_outerCssClasses}}{{/if}}">
2
2
 
3
3
  {{#> components/teaser/components/teaser_header _css=(if this.isStandardTeaser "px-5" "px-5 md:px-0")}}
4
- {{#>components/base/link _link=this.link _css="block link-focus-white cy-teaser-link hover:text-toplineColor" }}
4
+ {{#>components/base/link _link=this.link _css="block link-focus-white cy-teaser-link" }}
5
5
  {{#with this.label}}
6
6
  {{#> components/label/label_group}}
7
7
  {{> components/label/label _type=this.type _text=(loca this.loca) }}
8
8
  {{> components/label/label_byline _css="ml-2 text-tickerTeaserlabelByline" _text=../../../this.tickerTopic }}
9
9
  {{/components/label/label_group}}
10
10
  {{/with~}}
11
- {{#> components/teaser/components/teaser_headline _headlineTag=this.headlineTag _css="overflow-anywhere hyphens-auto"}}
11
+ {{#> components/teaser/components/teaser_headline _headlineTag=this.headlineTag _css="overflow-anywhere hyphens-auto hover:underline decoration-2 decoration-tickerTeaserHeadlineUnderline"}}
12
12
  {{> components/teaser/components/teaser_title _css="text-tickerTeaserHeadline" _text=this.title _size=this.realTeaserSize _teaserType=this.teaserType _isMobile1to1=this.isMobile1to1}}
13
13
  {{#if this.extendedTitle}}
14
14
  {{> components/teaser/components/teaser_subline _text=this.extendedTitle}}
@@ -376,7 +376,8 @@ module.exports = {
376
376
  'tickerTeaserHeadline': 'var(--color-ticker-teaser-headline,#000)',
377
377
  'tickerTeaserlabelByline': 'var(--color-ticker-teaser-label-byline)',
378
378
  'tickerTeaserTimelineScore': 'var(--color-ticker-teaser-timeline-score)',
379
- 'tickerTeaserFooter': 'var(--color-ticker-teaser-footer)'
379
+ 'tickerTeaserFooter': 'var(--color-ticker-teaser-footer)',
380
+ 'tickerTeaserHeadlineUnderline': 'var(--color-ticker-teaser-headline-underline)'
380
381
  },
381
382
  },
382
383
  },