@internetstiftelsen/styleguide 2.24.34 → 2.24.35
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/dist/molecules/glider/glider-hero.js +28 -28
- package/dist/organisms/timeline/timeline.js +6 -1
- package/dist/organisms/video-guide/VideoGuidePlayback.js +46 -0
- package/dist/organisms/video-guide/VideoGuideSubtitles.js +12 -0
- package/package.json +1 -1
- package/src/molecules/glider/glider-hero.js +28 -28
- package/src/organisms/timeline/timeline.js +7 -1
- package/src/organisms/video-guide/VideoGuidePlayback.js +46 -0
- package/src/organisms/video-guide/VideoGuideSubtitles.js +12 -0
|
@@ -58,44 +58,44 @@ function initHeroGlider(node) {
|
|
|
58
58
|
}, parseInt(autoplayDelay, 10));
|
|
59
59
|
}
|
|
60
60
|
}, 0);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
document.querySelector('.js-glider-prev').addEventListener('click', function () {
|
|
64
|
+
dataLayer.push({
|
|
65
|
+
event: 'carousel',
|
|
66
|
+
eventInfo: {
|
|
67
|
+
category: 'carousel',
|
|
68
|
+
action: 'click',
|
|
69
|
+
label: 'arrow_left'
|
|
70
|
+
}
|
|
71
71
|
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
document.querySelector('.js-glider-next').addEventListener('click', function () {
|
|
75
|
+
dataLayer.push({
|
|
76
|
+
event: 'carousel',
|
|
77
|
+
eventInfo: {
|
|
78
|
+
category: 'carousel',
|
|
79
|
+
action: 'click',
|
|
80
|
+
label: 'arrow_right'
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
72
84
|
|
|
73
|
-
|
|
85
|
+
[].forEach.call(gliderLinks, function (gliderLink) {
|
|
86
|
+
gliderLink.addEventListener('click', function () {
|
|
87
|
+
var linkTarget = gliderLink.href;
|
|
88
|
+
console.log(linkTarget);
|
|
74
89
|
dataLayer.push({
|
|
75
90
|
event: 'carousel',
|
|
76
91
|
eventInfo: {
|
|
77
92
|
category: 'carousel',
|
|
78
93
|
action: 'click',
|
|
79
|
-
label:
|
|
94
|
+
label: linkTarget
|
|
80
95
|
}
|
|
81
96
|
});
|
|
82
97
|
});
|
|
83
|
-
|
|
84
|
-
[].forEach.call(gliderLinks, function (gliderLink) {
|
|
85
|
-
gliderLink.addEventListener('click', function () {
|
|
86
|
-
var linkTarget = gliderLink.href;
|
|
87
|
-
console.log(linkTarget);
|
|
88
|
-
dataLayer.push({
|
|
89
|
-
event: 'carousel',
|
|
90
|
-
eventInfo: {
|
|
91
|
-
category: 'carousel',
|
|
92
|
-
action: 'click',
|
|
93
|
-
label: linkTarget
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
98
|
+
});
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
(0, _nodeAdded2.default)('.js-glider-hero', initHeroGlider);
|
|
@@ -131,7 +131,12 @@ if (progressBar) {
|
|
|
131
131
|
});
|
|
132
132
|
window.addEventListener('scroll', function () {
|
|
133
133
|
animateProgressBar();
|
|
134
|
-
|
|
134
|
+
|
|
135
|
+
// Don't trigger Decade Visible too fast to prevent dataLayer.push
|
|
136
|
+
// to trigger while user is scrolled past a decade.
|
|
137
|
+
setTimeout(function () {
|
|
138
|
+
decadeIsVisible();
|
|
139
|
+
}, 1500);
|
|
135
140
|
});
|
|
136
141
|
}
|
|
137
142
|
|
|
@@ -59,6 +59,15 @@ var VideoGuidePlayback = function () {
|
|
|
59
59
|
_this.setForwardState(false);
|
|
60
60
|
|
|
61
61
|
_this.video.currentTime = 0;
|
|
62
|
+
|
|
63
|
+
_this.dataLayer.push({
|
|
64
|
+
event: 'guided_tour',
|
|
65
|
+
eventInfo: {
|
|
66
|
+
category: 'guided_tour',
|
|
67
|
+
action: 'guide_completed',
|
|
68
|
+
label: window.location.href
|
|
69
|
+
}
|
|
70
|
+
});
|
|
62
71
|
};
|
|
63
72
|
|
|
64
73
|
this.onAbort = function () {
|
|
@@ -103,6 +112,15 @@ var VideoGuidePlayback = function () {
|
|
|
103
112
|
if (activeCueIndex < cues.length - 1) {
|
|
104
113
|
_this.video.currentTime = cues[activeCueIndex + 1].startTime + 0.01;
|
|
105
114
|
_this.updateChapterState();
|
|
115
|
+
|
|
116
|
+
_this.dataLayer.push({
|
|
117
|
+
event: 'guided_tour',
|
|
118
|
+
eventInfo: {
|
|
119
|
+
category: 'guided_tour',
|
|
120
|
+
action: 'player_click',
|
|
121
|
+
label: 'Forward'
|
|
122
|
+
}
|
|
123
|
+
});
|
|
106
124
|
}
|
|
107
125
|
};
|
|
108
126
|
|
|
@@ -114,9 +132,19 @@ var VideoGuidePlayback = function () {
|
|
|
114
132
|
if (activeCueIndex > 0) {
|
|
115
133
|
_this.video.currentTime = Math.max(0, cues[activeCueIndex - 1].startTime + 0.01);
|
|
116
134
|
_this.updateChapterState();
|
|
135
|
+
|
|
136
|
+
_this.dataLayer.push({
|
|
137
|
+
event: 'guided_tour',
|
|
138
|
+
eventInfo: {
|
|
139
|
+
category: 'guided_tour',
|
|
140
|
+
action: 'player_click',
|
|
141
|
+
label: 'Backward'
|
|
142
|
+
}
|
|
143
|
+
});
|
|
117
144
|
}
|
|
118
145
|
};
|
|
119
146
|
|
|
147
|
+
this.dataLayer = window.dataLayer || [];
|
|
120
148
|
this.video = video;
|
|
121
149
|
this.playBtn = element.querySelector('.js-play-btn');
|
|
122
150
|
this.playIcon = element.querySelector('.js-play-icon');
|
|
@@ -199,12 +227,30 @@ var VideoGuidePlayback = function () {
|
|
|
199
227
|
value: function setPlayActive() {
|
|
200
228
|
this.pauseIcon.classList.remove('is-hidden');
|
|
201
229
|
this.playIcon.classList.add('is-hidden');
|
|
230
|
+
|
|
231
|
+
this.dataLayer.push({
|
|
232
|
+
event: 'guided_tour',
|
|
233
|
+
eventInfo: {
|
|
234
|
+
category: 'guided_tour',
|
|
235
|
+
action: 'player_click',
|
|
236
|
+
label: 'Play'
|
|
237
|
+
}
|
|
238
|
+
});
|
|
202
239
|
}
|
|
203
240
|
}, {
|
|
204
241
|
key: 'setPauseActive',
|
|
205
242
|
value: function setPauseActive() {
|
|
206
243
|
this.pauseIcon.classList.add('is-hidden');
|
|
207
244
|
this.playIcon.classList.remove('is-hidden');
|
|
245
|
+
|
|
246
|
+
this.dataLayer.push({
|
|
247
|
+
event: 'guided_tour',
|
|
248
|
+
eventInfo: {
|
|
249
|
+
category: 'guided_tour',
|
|
250
|
+
action: 'player_click',
|
|
251
|
+
label: 'Pause'
|
|
252
|
+
}
|
|
253
|
+
});
|
|
208
254
|
}
|
|
209
255
|
}, {
|
|
210
256
|
key: 'setForwardState',
|
|
@@ -32,8 +32,20 @@ var VideoGuideSubtitles = function () {
|
|
|
32
32
|
this.toggleSubtitles = function () {
|
|
33
33
|
_this.subtitlesBtn.classList.toggle('is-active');
|
|
34
34
|
_this.subtitlesContainer.classList.toggle('is-visible');
|
|
35
|
+
|
|
36
|
+
_this.dataLayer.push({
|
|
37
|
+
event: 'guided_tour',
|
|
38
|
+
eventInfo: {
|
|
39
|
+
category: 'guided_tour',
|
|
40
|
+
action: 'player_click',
|
|
41
|
+
label: 'Subtitles'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log(_this.dataLayer);
|
|
35
46
|
};
|
|
36
47
|
|
|
48
|
+
this.dataLayer = window.dataLayer || [];
|
|
37
49
|
this.element = element;
|
|
38
50
|
this.video = video;
|
|
39
51
|
this.subtitlesBtn = element.querySelector('.js-subtitles-btn');
|
package/package.json
CHANGED
|
@@ -44,44 +44,44 @@ export function initHeroGlider(node) {
|
|
|
44
44
|
}, parseInt(autoplayDelay, 10));
|
|
45
45
|
}
|
|
46
46
|
}, 0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
document.querySelector('.js-glider-prev').addEventListener('click', () => {
|
|
50
|
+
dataLayer.push({
|
|
51
|
+
event: 'carousel',
|
|
52
|
+
eventInfo: {
|
|
53
|
+
category: 'carousel',
|
|
54
|
+
action: 'click',
|
|
55
|
+
label: 'arrow_left',
|
|
56
|
+
},
|
|
57
57
|
});
|
|
58
|
+
});
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
document.querySelector('.js-glider-next').addEventListener('click', () => {
|
|
61
|
+
dataLayer.push({
|
|
62
|
+
event: 'carousel',
|
|
63
|
+
eventInfo: {
|
|
64
|
+
category: 'carousel',
|
|
65
|
+
action: 'click',
|
|
66
|
+
label: 'arrow_right',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
[].forEach.call(gliderLinks, (gliderLink) => {
|
|
72
|
+
gliderLink.addEventListener('click', () => {
|
|
73
|
+
const linkTarget = gliderLink.href;
|
|
74
|
+
console.log(linkTarget);
|
|
60
75
|
dataLayer.push({
|
|
61
76
|
event: 'carousel',
|
|
62
77
|
eventInfo: {
|
|
63
78
|
category: 'carousel',
|
|
64
79
|
action: 'click',
|
|
65
|
-
label:
|
|
80
|
+
label: linkTarget,
|
|
66
81
|
},
|
|
67
82
|
});
|
|
68
83
|
});
|
|
69
|
-
|
|
70
|
-
[].forEach.call(gliderLinks, (gliderLink) => {
|
|
71
|
-
gliderLink.addEventListener('click', () => {
|
|
72
|
-
const linkTarget = gliderLink.href;
|
|
73
|
-
console.log(linkTarget);
|
|
74
|
-
dataLayer.push({
|
|
75
|
-
event: 'carousel',
|
|
76
|
-
eventInfo: {
|
|
77
|
-
category: 'carousel',
|
|
78
|
-
action: 'click',
|
|
79
|
-
label: linkTarget,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
84
|
+
});
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
nodeAdded('.js-glider-hero', initHeroGlider);
|
|
@@ -109,6 +109,7 @@ function decadeIsVisible() {
|
|
|
109
109
|
label: decade,
|
|
110
110
|
},
|
|
111
111
|
});
|
|
112
|
+
|
|
112
113
|
} else if (!isInViewport(decadeSection)) {
|
|
113
114
|
decadeSection.classList.remove('is-in-view');
|
|
114
115
|
}
|
|
@@ -128,7 +129,12 @@ if (progressBar) {
|
|
|
128
129
|
});
|
|
129
130
|
window.addEventListener('scroll', () => {
|
|
130
131
|
animateProgressBar();
|
|
131
|
-
|
|
132
|
+
|
|
133
|
+
// Don't trigger Decade Visible too fast to prevent dataLayer.push
|
|
134
|
+
// to trigger while user is scrolled past a decade.
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
decadeIsVisible();
|
|
137
|
+
}, 1500);
|
|
132
138
|
});
|
|
133
139
|
}
|
|
134
140
|
|
|
@@ -2,6 +2,7 @@ import getCurrentCueIndex from './getCurrentCueIndex';
|
|
|
2
2
|
|
|
3
3
|
export default class VideoGuidePlayback {
|
|
4
4
|
constructor(element, video) {
|
|
5
|
+
this.dataLayer = window.dataLayer || [];
|
|
5
6
|
this.video = video;
|
|
6
7
|
this.playBtn = element.querySelector('.js-play-btn');
|
|
7
8
|
this.playIcon = element.querySelector('.js-play-icon');
|
|
@@ -77,11 +78,29 @@ export default class VideoGuidePlayback {
|
|
|
77
78
|
setPlayActive() {
|
|
78
79
|
this.pauseIcon.classList.remove('is-hidden');
|
|
79
80
|
this.playIcon.classList.add('is-hidden');
|
|
81
|
+
|
|
82
|
+
this.dataLayer.push({
|
|
83
|
+
event: 'guided_tour',
|
|
84
|
+
eventInfo: {
|
|
85
|
+
category: 'guided_tour',
|
|
86
|
+
action: 'player_click',
|
|
87
|
+
label: 'Play',
|
|
88
|
+
},
|
|
89
|
+
});
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
setPauseActive() {
|
|
83
93
|
this.pauseIcon.classList.add('is-hidden');
|
|
84
94
|
this.playIcon.classList.remove('is-hidden');
|
|
95
|
+
|
|
96
|
+
this.dataLayer.push({
|
|
97
|
+
event: 'guided_tour',
|
|
98
|
+
eventInfo: {
|
|
99
|
+
category: 'guided_tour',
|
|
100
|
+
action: 'player_click',
|
|
101
|
+
label: 'Pause',
|
|
102
|
+
},
|
|
103
|
+
});
|
|
85
104
|
}
|
|
86
105
|
|
|
87
106
|
setForwardState(active) {
|
|
@@ -155,6 +174,15 @@ export default class VideoGuidePlayback {
|
|
|
155
174
|
this.setForwardState(false);
|
|
156
175
|
|
|
157
176
|
this.video.currentTime = 0;
|
|
177
|
+
|
|
178
|
+
this.dataLayer.push({
|
|
179
|
+
event: 'guided_tour',
|
|
180
|
+
eventInfo: {
|
|
181
|
+
category: 'guided_tour',
|
|
182
|
+
action: 'guide_completed',
|
|
183
|
+
label: window.location.href,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
158
186
|
};
|
|
159
187
|
|
|
160
188
|
onAbort = () => {
|
|
@@ -198,6 +226,15 @@ export default class VideoGuidePlayback {
|
|
|
198
226
|
if (activeCueIndex < cues.length - 1) {
|
|
199
227
|
this.video.currentTime = cues[activeCueIndex + 1].startTime + 0.01;
|
|
200
228
|
this.updateChapterState();
|
|
229
|
+
|
|
230
|
+
this.dataLayer.push({
|
|
231
|
+
event: 'guided_tour',
|
|
232
|
+
eventInfo: {
|
|
233
|
+
category: 'guided_tour',
|
|
234
|
+
action: 'player_click',
|
|
235
|
+
label: 'Forward',
|
|
236
|
+
},
|
|
237
|
+
});
|
|
201
238
|
}
|
|
202
239
|
};
|
|
203
240
|
|
|
@@ -208,6 +245,15 @@ export default class VideoGuidePlayback {
|
|
|
208
245
|
if (activeCueIndex > 0) {
|
|
209
246
|
this.video.currentTime = Math.max(0, cues[activeCueIndex - 1].startTime + 0.01);
|
|
210
247
|
this.updateChapterState();
|
|
248
|
+
|
|
249
|
+
this.dataLayer.push({
|
|
250
|
+
event: 'guided_tour',
|
|
251
|
+
eventInfo: {
|
|
252
|
+
category: 'guided_tour',
|
|
253
|
+
action: 'player_click',
|
|
254
|
+
label: 'Backward',
|
|
255
|
+
},
|
|
256
|
+
});
|
|
211
257
|
}
|
|
212
258
|
}
|
|
213
259
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default class VideoGuideSubtitles {
|
|
2
2
|
constructor(element, video) {
|
|
3
|
+
this.dataLayer = window.dataLayer || [];
|
|
3
4
|
this.element = element;
|
|
4
5
|
this.video = video;
|
|
5
6
|
this.subtitlesBtn = element.querySelector('.js-subtitles-btn');
|
|
@@ -39,5 +40,16 @@ export default class VideoGuideSubtitles {
|
|
|
39
40
|
toggleSubtitles = () => {
|
|
40
41
|
this.subtitlesBtn.classList.toggle('is-active');
|
|
41
42
|
this.subtitlesContainer.classList.toggle('is-visible');
|
|
43
|
+
|
|
44
|
+
this.dataLayer.push({
|
|
45
|
+
event: 'guided_tour',
|
|
46
|
+
eventInfo: {
|
|
47
|
+
category: 'guided_tour',
|
|
48
|
+
action: 'player_click',
|
|
49
|
+
label: 'Subtitles',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
console.log(this.dataLayer);
|
|
42
54
|
};
|
|
43
55
|
}
|