hr-design-system-handlebars 1.31.3 → 1.31.4
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,15 @@
|
|
|
1
|
+
# v1.31.4 (Fri Jul 14 2023)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- BUGFIX: When content is located in an iframe [#681](https://github.com/mumprod/hr-design-system-handlebars/pull/681) ([@szuelch](https://github.com/szuelch))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- [@szuelch](https://github.com/szuelch)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v1.31.3 (Fri Jul 14 2023)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/dist/assets/index.css
CHANGED
|
@@ -2817,7 +2817,7 @@ video {
|
|
|
2817
2817
|
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
2818
2818
|
}
|
|
2819
2819
|
.counter-reset {
|
|
2820
|
-
counter-reset:
|
|
2820
|
+
counter-reset: cnt1689338001771;
|
|
2821
2821
|
}
|
|
2822
2822
|
.hyphens-auto {
|
|
2823
2823
|
-webkit-hyphens: auto;
|
|
@@ -3052,7 +3052,7 @@ video {
|
|
|
3052
3052
|
--tw-ring-color: rgba(255, 255, 255, 0.5);
|
|
3053
3053
|
}
|
|
3054
3054
|
.-ordered {
|
|
3055
|
-
counter-increment:
|
|
3055
|
+
counter-increment: cnt1689338001771 1;
|
|
3056
3056
|
}
|
|
3057
3057
|
.-ordered::before {
|
|
3058
3058
|
position: absolute;
|
|
@@ -3068,7 +3068,7 @@ video {
|
|
|
3068
3068
|
letter-spacing: .0125em;
|
|
3069
3069
|
--tw-text-opacity: 1;
|
|
3070
3070
|
color: rgba(0, 0, 0, var(--tw-text-opacity));
|
|
3071
|
-
content: counter(
|
|
3071
|
+
content: counter(cnt1689338001771);
|
|
3072
3072
|
}
|
|
3073
3073
|
/*! ****************************/
|
|
3074
3074
|
/*! text-shadow */
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
export default function playaudio() {
|
|
2
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
|
+
},
|
|
3
42
|
playerCount: 0,
|
|
4
43
|
playlist: {},
|
|
5
44
|
registerPlayer(duration, id) {
|
|
@@ -17,11 +56,11 @@ export default function playaudio() {
|
|
|
17
56
|
_player.init = false
|
|
18
57
|
_player.firstPlay = true
|
|
19
58
|
|
|
20
|
-
_player.audioElement.addEventListener('play', handlePlay)
|
|
21
|
-
_player.audioElement.addEventListener('playing', handlePlaying)
|
|
22
|
-
_player.audioElement.addEventListener('pause', handlePause)
|
|
23
|
-
_player.audioElement.addEventListener('waiting', handleWaiting)
|
|
24
|
-
_player.audioElement.addEventListener('ended', handleStopped)
|
|
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))
|
|
25
64
|
|
|
26
65
|
// this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
|
|
27
66
|
this.playerCount++
|
|
@@ -48,51 +87,63 @@ export default function playaudio() {
|
|
|
48
87
|
}
|
|
49
88
|
|
|
50
89
|
function handlePlay(event) {
|
|
51
|
-
dispatchCustomEvent('hr-avInsights:play', {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
90
|
+
this.dispatchCustomEvent('hr-avInsights:play', {
|
|
91
|
+
data: {
|
|
92
|
+
playerId: getPlayerIdForAvInsights(),
|
|
93
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
94
|
+
avContent: avContent,
|
|
95
|
+
},
|
|
55
96
|
})
|
|
56
97
|
}
|
|
57
98
|
|
|
58
99
|
function handlePlaying(event) {
|
|
59
100
|
if (_player.firstPlay) {
|
|
60
|
-
dispatchCustomEvent('hr-avInsights:playback-start', {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
101
|
+
this.dispatchCustomEvent('hr-avInsights:playback-start', {
|
|
102
|
+
data: {
|
|
103
|
+
playerId: getPlayerIdForAvInsights(),
|
|
104
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
105
|
+
avContent: avContent,
|
|
106
|
+
},
|
|
64
107
|
})
|
|
65
108
|
_player.firstPlay = false
|
|
66
109
|
} else {
|
|
67
|
-
dispatchCustomEvent('hr-avInsights:playback-resumed', {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
110
|
+
this.dispatchCustomEvent('hr-avInsights:playback-resumed', {
|
|
111
|
+
data: {
|
|
112
|
+
playerId: getPlayerIdForAvInsights(),
|
|
113
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
114
|
+
avContent: avContent,
|
|
115
|
+
},
|
|
71
116
|
})
|
|
72
117
|
}
|
|
73
118
|
}
|
|
74
119
|
|
|
75
120
|
function handleWaiting(event) {
|
|
76
|
-
dispatchCustomEvent('hr-avInsights:buffer-start', {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
121
|
+
this.dispatchCustomEvent('hr-avInsights:buffer-start', {
|
|
122
|
+
data: {
|
|
123
|
+
playerId: getPlayerIdForAvInsights(),
|
|
124
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
125
|
+
avContent: avContent,
|
|
126
|
+
},
|
|
80
127
|
})
|
|
81
128
|
}
|
|
82
129
|
|
|
83
130
|
function handlePause(event) {
|
|
84
|
-
dispatchCustomEvent('hr-avInsights:playback-paused', {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
131
|
+
this.dispatchCustomEvent('hr-avInsights:playback-paused', {
|
|
132
|
+
data: {
|
|
133
|
+
playerId: getPlayerIdForAvInsights(),
|
|
134
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
135
|
+
avContent: avContent,
|
|
136
|
+
},
|
|
88
137
|
})
|
|
89
138
|
}
|
|
90
139
|
|
|
91
140
|
function handleStopped(event) {
|
|
92
|
-
dispatchCustomEvent('hr-avInsights:playback-stopped', {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
141
|
+
this.dispatchCustomEvent('hr-avInsights:playback-stopped', {
|
|
142
|
+
data: {
|
|
143
|
+
playerId: getPlayerIdForAvInsights(),
|
|
144
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
145
|
+
avContent: avContent,
|
|
146
|
+
},
|
|
96
147
|
})
|
|
97
148
|
_player.firstPlay = true
|
|
98
149
|
}
|
|
@@ -100,28 +151,11 @@ export default function playaudio() {
|
|
|
100
151
|
function getPlayerIdForAvInsights() {
|
|
101
152
|
return _player.id + '-' + avContent.av_content_id
|
|
102
153
|
}
|
|
103
|
-
|
|
104
|
-
function dispatchCustomEvent(eventName, data = undefined, element = document) {
|
|
105
|
-
let event
|
|
106
|
-
|
|
107
|
-
if (undefined != data) {
|
|
108
|
-
data = { detail: data }
|
|
109
|
-
event = new CustomEvent(eventName, data)
|
|
110
|
-
} else {
|
|
111
|
-
if (typeof Event === 'function') {
|
|
112
|
-
event = new Event(eventName)
|
|
113
|
-
} else {
|
|
114
|
-
event = document.createEvent('Event')
|
|
115
|
-
event.initEvent(eventName, true, true)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
element.dispatchEvent(event)
|
|
120
|
-
}
|
|
121
154
|
},
|
|
155
|
+
|
|
122
156
|
listenToGlobalStop() {
|
|
123
157
|
console.log('global listener init')
|
|
124
|
-
|
|
158
|
+
document.addEventListener(
|
|
125
159
|
'hr:global:stopOtherAVs',
|
|
126
160
|
this.stopAllPlayersBecauseOfGlobalStop.bind(this)
|
|
127
161
|
)
|
|
@@ -184,9 +218,7 @@ export default function playaudio() {
|
|
|
184
218
|
this.playlist[id].range.parentNode.classList.add('max-h-9')
|
|
185
219
|
this.playlist[id].playIcon.classList.add('hidden')
|
|
186
220
|
this.playlist[id].pauseIcon.classList.remove('hidden')
|
|
187
|
-
|
|
188
|
-
event.id = id
|
|
189
|
-
window.dispatchEvent(event)
|
|
221
|
+
this.dispatchCustomEvent('hr:global:stopOtherAVs', { handleIframe: true, id: id })
|
|
190
222
|
}
|
|
191
223
|
},
|
|
192
224
|
|
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.31.
|
|
9
|
+
"version": "1.31.4",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"storybook": "storybook dev -p 6006 public",
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
export default function playaudio() {
|
|
2
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
|
+
},
|
|
3
42
|
playerCount: 0,
|
|
4
43
|
playlist: {},
|
|
5
44
|
registerPlayer(duration, id) {
|
|
@@ -17,11 +56,11 @@ export default function playaudio() {
|
|
|
17
56
|
_player.init = false
|
|
18
57
|
_player.firstPlay = true
|
|
19
58
|
|
|
20
|
-
_player.audioElement.addEventListener('play', handlePlay)
|
|
21
|
-
_player.audioElement.addEventListener('playing', handlePlaying)
|
|
22
|
-
_player.audioElement.addEventListener('pause', handlePause)
|
|
23
|
-
_player.audioElement.addEventListener('waiting', handleWaiting)
|
|
24
|
-
_player.audioElement.addEventListener('ended', handleStopped)
|
|
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))
|
|
25
64
|
|
|
26
65
|
// this.playerCount == 0 ? _player.range.parentNode.classList.remove('hidden') : _player.range.parentNode.classList.add('hidden')
|
|
27
66
|
this.playerCount++
|
|
@@ -48,51 +87,63 @@ export default function playaudio() {
|
|
|
48
87
|
}
|
|
49
88
|
|
|
50
89
|
function handlePlay(event) {
|
|
51
|
-
dispatchCustomEvent('hr-avInsights:play', {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
90
|
+
this.dispatchCustomEvent('hr-avInsights:play', {
|
|
91
|
+
data: {
|
|
92
|
+
playerId: getPlayerIdForAvInsights(),
|
|
93
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
94
|
+
avContent: avContent,
|
|
95
|
+
},
|
|
55
96
|
})
|
|
56
97
|
}
|
|
57
98
|
|
|
58
99
|
function handlePlaying(event) {
|
|
59
100
|
if (_player.firstPlay) {
|
|
60
|
-
dispatchCustomEvent('hr-avInsights:playback-start', {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
101
|
+
this.dispatchCustomEvent('hr-avInsights:playback-start', {
|
|
102
|
+
data: {
|
|
103
|
+
playerId: getPlayerIdForAvInsights(),
|
|
104
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
105
|
+
avContent: avContent,
|
|
106
|
+
},
|
|
64
107
|
})
|
|
65
108
|
_player.firstPlay = false
|
|
66
109
|
} else {
|
|
67
|
-
dispatchCustomEvent('hr-avInsights:playback-resumed', {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
110
|
+
this.dispatchCustomEvent('hr-avInsights:playback-resumed', {
|
|
111
|
+
data: {
|
|
112
|
+
playerId: getPlayerIdForAvInsights(),
|
|
113
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
114
|
+
avContent: avContent,
|
|
115
|
+
},
|
|
71
116
|
})
|
|
72
117
|
}
|
|
73
118
|
}
|
|
74
119
|
|
|
75
120
|
function handleWaiting(event) {
|
|
76
|
-
dispatchCustomEvent('hr-avInsights:buffer-start', {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
121
|
+
this.dispatchCustomEvent('hr-avInsights:buffer-start', {
|
|
122
|
+
data: {
|
|
123
|
+
playerId: getPlayerIdForAvInsights(),
|
|
124
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
125
|
+
avContent: avContent,
|
|
126
|
+
},
|
|
80
127
|
})
|
|
81
128
|
}
|
|
82
129
|
|
|
83
130
|
function handlePause(event) {
|
|
84
|
-
dispatchCustomEvent('hr-avInsights:playback-paused', {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
131
|
+
this.dispatchCustomEvent('hr-avInsights:playback-paused', {
|
|
132
|
+
data: {
|
|
133
|
+
playerId: getPlayerIdForAvInsights(),
|
|
134
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
135
|
+
avContent: avContent,
|
|
136
|
+
},
|
|
88
137
|
})
|
|
89
138
|
}
|
|
90
139
|
|
|
91
140
|
function handleStopped(event) {
|
|
92
|
-
dispatchCustomEvent('hr-avInsights:playback-stopped', {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
141
|
+
this.dispatchCustomEvent('hr-avInsights:playback-stopped', {
|
|
142
|
+
data: {
|
|
143
|
+
playerId: getPlayerIdForAvInsights(),
|
|
144
|
+
cursorPosition: _player.audioElement.currentTime * 1000,
|
|
145
|
+
avContent: avContent,
|
|
146
|
+
},
|
|
96
147
|
})
|
|
97
148
|
_player.firstPlay = true
|
|
98
149
|
}
|
|
@@ -100,28 +151,11 @@ export default function playaudio() {
|
|
|
100
151
|
function getPlayerIdForAvInsights() {
|
|
101
152
|
return _player.id + '-' + avContent.av_content_id
|
|
102
153
|
}
|
|
103
|
-
|
|
104
|
-
function dispatchCustomEvent(eventName, data = undefined, element = document) {
|
|
105
|
-
let event
|
|
106
|
-
|
|
107
|
-
if (undefined != data) {
|
|
108
|
-
data = { detail: data }
|
|
109
|
-
event = new CustomEvent(eventName, data)
|
|
110
|
-
} else {
|
|
111
|
-
if (typeof Event === 'function') {
|
|
112
|
-
event = new Event(eventName)
|
|
113
|
-
} else {
|
|
114
|
-
event = document.createEvent('Event')
|
|
115
|
-
event.initEvent(eventName, true, true)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
element.dispatchEvent(event)
|
|
120
|
-
}
|
|
121
154
|
},
|
|
155
|
+
|
|
122
156
|
listenToGlobalStop() {
|
|
123
157
|
console.log('global listener init')
|
|
124
|
-
|
|
158
|
+
document.addEventListener(
|
|
125
159
|
'hr:global:stopOtherAVs',
|
|
126
160
|
this.stopAllPlayersBecauseOfGlobalStop.bind(this)
|
|
127
161
|
)
|
|
@@ -184,9 +218,7 @@ export default function playaudio() {
|
|
|
184
218
|
this.playlist[id].range.parentNode.classList.add('max-h-9')
|
|
185
219
|
this.playlist[id].playIcon.classList.add('hidden')
|
|
186
220
|
this.playlist[id].pauseIcon.classList.remove('hidden')
|
|
187
|
-
|
|
188
|
-
event.id = id
|
|
189
|
-
window.dispatchEvent(event)
|
|
221
|
+
this.dispatchCustomEvent('hr:global:stopOtherAVs', { handleIframe: true, id: id })
|
|
190
222
|
}
|
|
191
223
|
},
|
|
192
224
|
|