@internetstiftelsen/styleguide 2.22.3-beta.0.5 → 2.22.3-beta.0.52
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/assets/js/youtube.js +43 -9
- package/dist/molecules/continue-video-guide/continue-video-guide.js +6 -6
- package/dist/molecules/glider/glider-hero.js +63 -0
- package/dist/organisms/timeline/timeline.js +85 -51
- package/dist/organisms/video-guide/video-guide.js +32 -18
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/assets/js/youtube.js +39 -9
- package/src/assets/video/chapters.vtt +8 -8
- package/src/assets/video/metadata.vtt +12 -9
- package/src/atoms/tag/tag.config.js +10 -0
- package/src/{assets/video → brandbook}/.DS_Store +0 -0
- package/src/configurations/colors/_colors-functions.scss +2 -3
- package/src/configurations/typography/_typography.scss +9 -8
- package/src/globals.scss +1 -27
- package/src/molecules/continue-video-guide/continue-video-guide.js +6 -6
- package/src/molecules/glider/_glider-hero.scss +3 -6
- package/src/molecules/glider/glider-hero.js +63 -0
- package/src/organisms/hero/_hero--dynamic-headline.scss +19 -8
- package/src/organisms/hero/hero.config.js +1 -1
- package/src/organisms/timeline/_timeline.scss +38 -2
- package/src/organisms/timeline/timeline.js +88 -49
- package/src/organisms/video-guide/_video-guide.scss +165 -17
- package/src/organisms/video-guide/video-guide.js +32 -18
- package/src/structures/_article.scss +1 -3
- package/src/utilities/_hide.scss +4 -0
- package/src/utilities/_links.scss +11 -0
- package/src/utilities/_manifest.scss +29 -0
- package/dist/.DS_Store +0 -0
- package/src/assets/.DS_Store +0 -0
- package/src/atoms/.DS_Store +0 -0
- package/src/molecules/.DS_Store +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setupPlayers = setupPlayers;
|
|
3
7
|
function loadYoutubeAPI() {
|
|
4
8
|
var tag = document.createElement('script');
|
|
5
9
|
var firstScript = document.getElementsByTagName('script')[0];
|
|
@@ -9,16 +13,17 @@ function loadYoutubeAPI() {
|
|
|
9
13
|
firstScript.parentNode.insertBefore(tag, firstScript);
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
function onPlayerReady(el
|
|
13
|
-
el.
|
|
14
|
-
e.target.playVideo();
|
|
15
|
-
});
|
|
16
|
+
function onPlayerReady(el) {
|
|
17
|
+
el.setAttribute('data-youtube-ready', 'true');
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
function onPlayerStateChange(el, e) {
|
|
19
21
|
if (e.data === YT.PlayerState.PLAYING) {
|
|
20
22
|
el.getElementsByTagName('img')[0].style.zIndex = '-1';
|
|
21
23
|
el.getElementsByTagName('button')[0].style.display = 'none';
|
|
24
|
+
} else if (e.data === YT.PlayerState.UNSTARTED) {
|
|
25
|
+
el.getElementsByTagName('img')[0].style.zIndex = null;
|
|
26
|
+
el.getElementsByTagName('button')[0].style.display = null;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
|
|
@@ -32,16 +37,30 @@ function createCover(el, id) {
|
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
function setupYoutubePlayer(el) {
|
|
35
|
-
var playerEl =
|
|
40
|
+
var playerEl = void 0;
|
|
36
41
|
var id = el.getAttribute('data-youtube');
|
|
37
42
|
|
|
43
|
+
if (el.youtube) {
|
|
44
|
+
playerEl = el.querySelector('[data-youtube-container]');
|
|
45
|
+
|
|
46
|
+
playerEl.parentNode.removeChild(playerEl);
|
|
47
|
+
el.youtube.destroy();
|
|
48
|
+
el.youtube = null;
|
|
49
|
+
el.removeAttribute('data-youtube-ready');
|
|
50
|
+
el.getElementsByTagName('img')[0].style.zIndex = null;
|
|
51
|
+
el.getElementsByTagName('button')[0].style.display = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
playerEl = document.createElement('div');
|
|
55
|
+
|
|
38
56
|
if (!el.getElementsByTagName('img').length) {
|
|
39
57
|
createCover(el, id);
|
|
40
58
|
}
|
|
41
59
|
|
|
60
|
+
playerEl.setAttribute('data-youtube-container', true);
|
|
42
61
|
el.appendChild(playerEl);
|
|
43
62
|
|
|
44
|
-
|
|
63
|
+
el.youtube = new YT.Player(playerEl, {
|
|
45
64
|
height: '100%',
|
|
46
65
|
width: '100%',
|
|
47
66
|
videoId: id,
|
|
@@ -59,18 +78,33 @@ function setupYoutubePlayer(el) {
|
|
|
59
78
|
}
|
|
60
79
|
}
|
|
61
80
|
});
|
|
81
|
+
}
|
|
62
82
|
|
|
63
|
-
|
|
83
|
+
function delegateClick(e) {
|
|
84
|
+
var el = e.target.closest('[data-youtube]');
|
|
85
|
+
|
|
86
|
+
if (!el || !el.youtube) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
el.youtube.playVideo();
|
|
64
91
|
}
|
|
65
92
|
|
|
66
|
-
|
|
67
|
-
|
|
93
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
94
|
+
function setupPlayers(container) {
|
|
95
|
+
var players = container.querySelectorAll('[data-youtube]');
|
|
68
96
|
|
|
69
97
|
if (!players.length) {
|
|
70
98
|
return;
|
|
71
99
|
}
|
|
72
100
|
|
|
73
101
|
[].forEach.call(players, setupYoutubePlayer);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
window.onYouTubeIframeAPIReady = function () {
|
|
105
|
+
setupPlayers(document);
|
|
106
|
+
|
|
107
|
+
document.body.addEventListener('click', delegateClick);
|
|
74
108
|
};
|
|
75
109
|
|
|
76
110
|
loadYoutubeAPI();
|
|
@@ -66,15 +66,15 @@ var ProgressRing = function (_CustomElement2) {
|
|
|
66
66
|
|
|
67
67
|
window.customElements.define('progress-ring', ProgressRing);
|
|
68
68
|
|
|
69
|
-
// Get value from
|
|
70
|
-
if (
|
|
71
|
-
var videoCurrentTime =
|
|
72
|
-
var videoDuration =
|
|
69
|
+
// Get value from localStorage if present
|
|
70
|
+
if (localStorage.getItem('InmsCurrentTime')) {
|
|
71
|
+
var videoCurrentTime = localStorage.getItem('InmsCurrentTime');
|
|
72
|
+
var videoDuration = localStorage.getItem('InmsDuration');
|
|
73
73
|
var continueElement = document.querySelector('.js-guide-continue');
|
|
74
74
|
var progressRing = document.querySelector('progress-ring');
|
|
75
75
|
var continueLink = document.querySelector('.js-guide-continue-link');
|
|
76
|
-
var guideURL =
|
|
77
|
-
var guideImage =
|
|
76
|
+
var guideURL = localStorage.getItem('InmsCurrentGuideURL');
|
|
77
|
+
var guideImage = localStorage.getItem('InmsCurrentGuideImage');
|
|
78
78
|
|
|
79
79
|
if (videoCurrentTime > 0 && progressRing && continueElement && guideImage && continueLink) {
|
|
80
80
|
var alternativeText = continueLink.dataset.altText;
|
|
@@ -7,17 +7,80 @@ var _gliderJs2 = _interopRequireDefault(_gliderJs);
|
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
8
|
|
|
9
9
|
var gliderElementHero = document.querySelector('.js-glider-hero');
|
|
10
|
+
var dataLayer = window.dataLayer || [];
|
|
11
|
+
var gliderLinks = document.querySelectorAll('.glider-slide a');
|
|
10
12
|
|
|
11
13
|
if (gliderElementHero) {
|
|
12
14
|
var GliderHero = new _gliderJs2.default(gliderElementHero, {
|
|
13
15
|
scrollLock: true,
|
|
14
16
|
slidesToShow: 1,
|
|
15
17
|
slidesToScroll: 1,
|
|
18
|
+
rewind: true,
|
|
16
19
|
arrows: {
|
|
17
20
|
prev: '.js-glider-prev',
|
|
18
21
|
next: '.js-glider-next'
|
|
19
22
|
}
|
|
20
23
|
});
|
|
21
24
|
|
|
25
|
+
var autoplayDelay = gliderElementHero.dataset.timeout;
|
|
26
|
+
|
|
27
|
+
if (autoplayDelay) {
|
|
28
|
+
var autoplay = setInterval(function () {
|
|
29
|
+
GliderHero.scrollItem('next');
|
|
30
|
+
}, autoplayDelay);
|
|
31
|
+
|
|
32
|
+
gliderElementHero.addEventListener('mouseover', function () {
|
|
33
|
+
if (autoplay !== null) {
|
|
34
|
+
clearInterval(autoplay);
|
|
35
|
+
autoplay = null;
|
|
36
|
+
}
|
|
37
|
+
}, 0);
|
|
38
|
+
|
|
39
|
+
gliderElementHero.addEventListener('mouseout', function () {
|
|
40
|
+
if (autoplay === null) {
|
|
41
|
+
autoplay = setInterval(function () {
|
|
42
|
+
GliderHero.scrollItem('next');
|
|
43
|
+
}, autoplayDelay);
|
|
44
|
+
}
|
|
45
|
+
}, 0);
|
|
46
|
+
} else {
|
|
47
|
+
document.querySelector('.js-glider-prev').addEventListener('click', function () {
|
|
48
|
+
dataLayer.push({
|
|
49
|
+
event: 'carousel',
|
|
50
|
+
eventInfo: {
|
|
51
|
+
category: 'carousel',
|
|
52
|
+
action: 'click',
|
|
53
|
+
label: 'arrow_left'
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
document.querySelector('.js-glider-next').addEventListener('click', function () {
|
|
59
|
+
dataLayer.push({
|
|
60
|
+
event: 'carousel',
|
|
61
|
+
eventInfo: {
|
|
62
|
+
category: 'carousel',
|
|
63
|
+
action: 'click',
|
|
64
|
+
label: 'arrow_right'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
[].forEach.call(gliderLinks, function (gliderLink) {
|
|
70
|
+
gliderLink.addEventListener('click', function () {
|
|
71
|
+
var linkTarget = gliderLink.href;
|
|
72
|
+
console.log(linkTarget);
|
|
73
|
+
dataLayer.push({
|
|
74
|
+
event: 'carousel',
|
|
75
|
+
eventInfo: {
|
|
76
|
+
category: 'carousel',
|
|
77
|
+
action: 'click',
|
|
78
|
+
label: linkTarget
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
22
85
|
module.exports = GliderHero;
|
|
23
86
|
}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require('../../assets/js/parallax');
|
|
4
4
|
|
|
5
|
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
6
|
-
|
|
7
5
|
var _require = require('../../assets/js/offset'),
|
|
8
6
|
offsetTop = _require.offsetTop,
|
|
9
7
|
offsetBottom = _require.offsetBottom,
|
|
10
8
|
offsetLeft = _require.offsetLeft;
|
|
11
9
|
|
|
10
|
+
var dataLayer = window.dataLayer || [];
|
|
12
11
|
var progressBar = document.querySelector('.js-progress-bar');
|
|
13
12
|
var decadeContainer = document.querySelector('.js-decade-container');
|
|
14
13
|
var decadeSections = document.querySelectorAll('.js-timeline-decade');
|
|
@@ -86,6 +85,39 @@ function animateProgressBar() {
|
|
|
86
85
|
progressBar.style.width = progressBarWidth + 'px';
|
|
87
86
|
}
|
|
88
87
|
|
|
88
|
+
function isInViewport(element) {
|
|
89
|
+
var top = element.offsetTop;
|
|
90
|
+
var height = element.offsetHeight;
|
|
91
|
+
|
|
92
|
+
while (element.offsetParent) {
|
|
93
|
+
element = element.offsetParent; // eslint-disable-line
|
|
94
|
+
top += element.offsetTop;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return top < window.pageYOffset + window.innerHeight && top + height > window.pageYOffset;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function decadeIsVisible() {
|
|
101
|
+
[].forEach.call(decadeSections, function (decadeSection) {
|
|
102
|
+
if (isInViewport(decadeSection) && !decadeSection.classList.contains('is-in-view')) {
|
|
103
|
+
decadeSection.classList.add('is-in-view');
|
|
104
|
+
|
|
105
|
+
var decade = decadeSection.id;
|
|
106
|
+
|
|
107
|
+
dataLayer.push({
|
|
108
|
+
event: 'timeline',
|
|
109
|
+
eventInfo: {
|
|
110
|
+
category: 'timeline',
|
|
111
|
+
action: 'active_year',
|
|
112
|
+
label: decade
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
} else if (!isInViewport(decadeSection)) {
|
|
116
|
+
decadeSection.classList.remove('is-in-view');
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
89
121
|
// Run functions on page load
|
|
90
122
|
if (progressBar) {
|
|
91
123
|
buildTimelineNavigation();
|
|
@@ -99,56 +131,58 @@ if (progressBar) {
|
|
|
99
131
|
});
|
|
100
132
|
window.addEventListener('scroll', function () {
|
|
101
133
|
animateProgressBar();
|
|
134
|
+
decadeIsVisible();
|
|
102
135
|
});
|
|
103
136
|
}
|
|
104
137
|
|
|
105
138
|
// DUMMY TIMELINE ITEM OPEN/CLOSE
|
|
106
|
-
function wrap(el, wrapper) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
[].forEach.call(timeLineItems,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
139
|
+
// function wrap(el, wrapper) {
|
|
140
|
+
// el.parentNode.insertBefore(wrapper, el);
|
|
141
|
+
// wrapper.classList.add('wrapper');
|
|
142
|
+
// wrapper.appendChild(el);
|
|
143
|
+
// }
|
|
144
|
+
//
|
|
145
|
+
// const timeLineItems = document.querySelectorAll('.js-timeline-item');
|
|
146
|
+
// let timeLineItemScrollPosition = 0;
|
|
147
|
+
//
|
|
148
|
+
// [].forEach.call(timeLineItems, (timeLineItem) => {
|
|
149
|
+
// const timeLineItemLink = timeLineItem.querySelector('a');
|
|
150
|
+
// const timeLineItemClose = timeLineItem.querySelector('.js-timeline-item-close');
|
|
151
|
+
// const timeLineItemBottomClose = timeLineItem.querySelector('.js-timeline-item-bottom-close');
|
|
152
|
+
//
|
|
153
|
+
// timeLineItemLink.addEventListener('click', () => {
|
|
154
|
+
// timeLineItemScrollPosition = window.pageYOffset;
|
|
155
|
+
// sessionStorage.setItem('scroll-position', timeLineItemScrollPosition);
|
|
156
|
+
//
|
|
157
|
+
// if (!timeLineItem.classList.contains('is-open')) {
|
|
158
|
+
// timeLineItem.classList.add('is-open');
|
|
159
|
+
// timeLineItem.closest('.row').classList.add('row-has-open-child');
|
|
160
|
+
//
|
|
161
|
+
// // Wrap open timeline item
|
|
162
|
+
// wrap(timeLineItem.querySelector('.wp-block-iis-timeline-post'),
|
|
163
|
+
// document.createElement('div'));
|
|
164
|
+
// }
|
|
165
|
+
// });
|
|
166
|
+
//
|
|
167
|
+
// timeLineItemClose.addEventListener('click', () => {
|
|
168
|
+
// timeLineItem.classList.remove('is-open');
|
|
169
|
+
// timeLineItem.closest('.row').classList.remove('row-has-open-child');
|
|
170
|
+
//
|
|
171
|
+
// // Destroy generated wrapper
|
|
172
|
+
// const wrapper = timeLineItemClose.nextElementSibling;
|
|
173
|
+
// wrapper.replaceWith(...wrapper.childNodes);
|
|
174
|
+
//
|
|
175
|
+
// const top = sessionStorage.getItem('scroll-position');
|
|
176
|
+
// if (top !== null) {
|
|
177
|
+
// window.scrollTo(0, parseInt(top, 10));
|
|
178
|
+
// }
|
|
179
|
+
// sessionStorage.removeItem('scroll-position');
|
|
180
|
+
//
|
|
181
|
+
// // Trigger scroll event to reveal timeline items not yet parallaxed into view
|
|
182
|
+
// window.dispatchEvent(new CustomEvent('scroll'));
|
|
183
|
+
// });
|
|
184
|
+
//
|
|
185
|
+
// timeLineItemBottomClose.addEventListener('click', () => {
|
|
186
|
+
// timeLineItemClose.click();
|
|
187
|
+
// });
|
|
188
|
+
// });
|
|
@@ -17,6 +17,8 @@ var metadataTrack = trackMetadataElement === null ? '' : trackMetadataElement.tr
|
|
|
17
17
|
var forwardsButton = document.querySelector('.js-next-chapter');
|
|
18
18
|
var backwardsButton = document.querySelector('.js-previous-chapter');
|
|
19
19
|
var timelinePosts = document.querySelectorAll('.js-timeline-post');
|
|
20
|
+
var navigationButton = document.querySelector('.js-show-timelineposts');
|
|
21
|
+
var timeLinePosts = document.querySelector('.js-timeline-posts');
|
|
20
22
|
var currentChapter = 1;
|
|
21
23
|
var manualStep = false;
|
|
22
24
|
var sourceElement = null;
|
|
@@ -35,20 +37,20 @@ if (sourceElement) {
|
|
|
35
37
|
|
|
36
38
|
// Store current time in on page reload
|
|
37
39
|
window.addEventListener('unload', function () {
|
|
38
|
-
// Set
|
|
40
|
+
// Set localStorage if video has started playing
|
|
39
41
|
if (video.currentTime > 0) {
|
|
40
42
|
var currentGuideURL = window.location.href;
|
|
41
43
|
var currentGuideImage = document.querySelector('.js-guide-continue-image').src;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
localStorage.setItem('InmsCurrentTime', video.currentTime);
|
|
45
|
+
localStorage.setItem('InmsDuration', video.duration); // Get totalt duration of video
|
|
46
|
+
localStorage.setItem('InmsCurrentGuideURL', currentGuideURL);
|
|
47
|
+
localStorage.setItem('InmsCurrentGuideImage', currentGuideImage);
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
|
|
49
|
-
// Get value from
|
|
50
|
-
if (
|
|
51
|
-
var videoCurrentTime =
|
|
51
|
+
// Get value from localStorage in present
|
|
52
|
+
if (localStorage.getItem('InmsCurrentTime')) {
|
|
53
|
+
var videoCurrentTime = localStorage.getItem('InmsCurrentTime');
|
|
52
54
|
|
|
53
55
|
if (videoCurrentTime > 0) {
|
|
54
56
|
video.currentTime = videoCurrentTime;
|
|
@@ -93,10 +95,10 @@ if (sourceElement) {
|
|
|
93
95
|
manualStep = false;
|
|
94
96
|
forwardsButton.removeAttribute('disabled');
|
|
95
97
|
subtitlesContainer.innerHTML = '';
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
localStorage.removeItem('InmsCurrentTime');
|
|
99
|
+
localStorage.removeItem('InmsDuration');
|
|
100
|
+
localStorage.removeItem('InmsCurrentGuideURL');
|
|
101
|
+
localStorage.removeItem('InmsCurrentGuideImage');
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -109,13 +111,20 @@ if (sourceElement) {
|
|
|
109
111
|
forwardsButton.removeAttribute('disabled');
|
|
110
112
|
currentChapter = 1;
|
|
111
113
|
manualStep = false;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
localStorage.removeItem('InmsCurrentTime');
|
|
115
|
+
localStorage.removeItem('InmsDuration');
|
|
116
|
+
localStorage.removeItem('InmsCurrentGuideURL');
|
|
117
|
+
localStorage.removeItem('InmsCurrentGuideImage');
|
|
116
118
|
window.location.href = urlTarget;
|
|
117
119
|
});
|
|
118
120
|
}
|
|
121
|
+
|
|
122
|
+
if (navigationButton) {
|
|
123
|
+
navigationButton.addEventListener('click', function () {
|
|
124
|
+
navigationButton.classList.toggle('is-toggeled');
|
|
125
|
+
timeLinePosts.classList.toggle('is-visible');
|
|
126
|
+
});
|
|
127
|
+
}
|
|
119
128
|
}
|
|
120
129
|
|
|
121
130
|
function displayChapters() {
|
|
@@ -153,7 +162,7 @@ function displayChapters() {
|
|
|
153
162
|
});
|
|
154
163
|
|
|
155
164
|
// If not set in sessionStorgare, set first cue on forward button on page load
|
|
156
|
-
if (!
|
|
165
|
+
if (!localStorage.getItem('InmsCurrentTime')) {
|
|
157
166
|
forwardsButton.setAttribute('data-id', chapterTrack.cues[0].endTime);
|
|
158
167
|
}
|
|
159
168
|
}, 100);
|
|
@@ -253,7 +262,12 @@ function displayChapters() {
|
|
|
253
262
|
timelinePost.classList.remove('is-current');
|
|
254
263
|
});
|
|
255
264
|
|
|
256
|
-
document.
|
|
265
|
+
var idSelectors = document.querySelectorAll('[data-id="' + metadataCueMatch + '"]');
|
|
266
|
+
|
|
267
|
+
[].forEach.call(idSelectors, function (idSelector) {
|
|
268
|
+
idSelector.classList.add('is-current');
|
|
269
|
+
idSelector.focus();
|
|
270
|
+
});
|
|
257
271
|
|
|
258
272
|
if (chapterCues) {
|
|
259
273
|
var chapterStartTime = chapterCues.startTime;
|
package/package.json
CHANGED
package/src/.DS_Store
CHANGED
|
Binary file
|
package/src/assets/js/youtube.js
CHANGED
|
@@ -7,16 +7,17 @@ function loadYoutubeAPI() {
|
|
|
7
7
|
firstScript.parentNode.insertBefore(tag, firstScript);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function onPlayerReady(el
|
|
11
|
-
el.
|
|
12
|
-
e.target.playVideo();
|
|
13
|
-
});
|
|
10
|
+
function onPlayerReady(el) {
|
|
11
|
+
el.setAttribute('data-youtube-ready', 'true');
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
function onPlayerStateChange(el, e) {
|
|
17
15
|
if (e.data === YT.PlayerState.PLAYING) {
|
|
18
16
|
el.getElementsByTagName('img')[0].style.zIndex = '-1';
|
|
19
17
|
el.getElementsByTagName('button')[0].style.display = 'none';
|
|
18
|
+
} else if (e.data === YT.PlayerState.UNSTARTED) {
|
|
19
|
+
el.getElementsByTagName('img')[0].style.zIndex = null;
|
|
20
|
+
el.getElementsByTagName('button')[0].style.display = null;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -30,16 +31,30 @@ function createCover(el, id) {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function setupYoutubePlayer(el) {
|
|
33
|
-
|
|
34
|
+
let playerEl;
|
|
34
35
|
const id = el.getAttribute('data-youtube');
|
|
35
36
|
|
|
37
|
+
if (el.youtube) {
|
|
38
|
+
playerEl = el.querySelector('[data-youtube-container]');
|
|
39
|
+
|
|
40
|
+
playerEl.parentNode.removeChild(playerEl);
|
|
41
|
+
el.youtube.destroy();
|
|
42
|
+
el.youtube = null;
|
|
43
|
+
el.removeAttribute('data-youtube-ready');
|
|
44
|
+
el.getElementsByTagName('img')[0].style.zIndex = null;
|
|
45
|
+
el.getElementsByTagName('button')[0].style.display = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
playerEl = document.createElement('div');
|
|
49
|
+
|
|
36
50
|
if (!el.getElementsByTagName('img').length) {
|
|
37
51
|
createCover(el, id);
|
|
38
52
|
}
|
|
39
53
|
|
|
54
|
+
playerEl.setAttribute('data-youtube-container', true);
|
|
40
55
|
el.appendChild(playerEl);
|
|
41
56
|
|
|
42
|
-
|
|
57
|
+
el.youtube = new YT.Player(playerEl, {
|
|
43
58
|
height: '100%',
|
|
44
59
|
width: '100%',
|
|
45
60
|
videoId: id,
|
|
@@ -53,18 +68,33 @@ function setupYoutubePlayer(el) {
|
|
|
53
68
|
onStateChange: (e) => onPlayerStateChange(el, e),
|
|
54
69
|
},
|
|
55
70
|
});
|
|
71
|
+
}
|
|
56
72
|
|
|
57
|
-
|
|
73
|
+
function delegateClick(e) {
|
|
74
|
+
const el = e.target.closest('[data-youtube]');
|
|
75
|
+
|
|
76
|
+
if (!el || !el.youtube) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
el.youtube.playVideo();
|
|
58
81
|
}
|
|
59
82
|
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
84
|
+
export function setupPlayers(container) {
|
|
85
|
+
const players = container.querySelectorAll('[data-youtube]');
|
|
62
86
|
|
|
63
87
|
if (!players.length) {
|
|
64
88
|
return;
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
[].forEach.call(players, setupYoutubePlayer);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
window.onYouTubeIframeAPIReady = () => {
|
|
95
|
+
setupPlayers(document);
|
|
96
|
+
|
|
97
|
+
document.body.addEventListener('click', delegateClick);
|
|
68
98
|
};
|
|
69
99
|
|
|
70
100
|
loadYoutubeAPI();
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
WEBVTT
|
|
2
2
|
|
|
3
3
|
00:00:00.000 --> 00:00:39.000
|
|
4
|
-
1 / 8: Introduktion
|
|
4
|
+
Kapitel 1 / 8: Introduktion
|
|
5
5
|
|
|
6
6
|
00:00:39.000 --> 00:01:51.500
|
|
7
|
-
2 / 8: Idén om internet
|
|
7
|
+
Kapitel 2 / 8: Idén om internet
|
|
8
8
|
|
|
9
9
|
00:01:51.500 --> 00:02:53.000
|
|
10
|
-
3 / 8: Arpanet blir till
|
|
10
|
+
Kapitel 3 / 8: Arpanet blir till
|
|
11
11
|
|
|
12
12
|
00:02:53.000 --> 00:03:27.000
|
|
13
|
-
4 / 8: TCP/IP uppfinns
|
|
13
|
+
Kapitel 4 / 8: TCP/IP uppfinns
|
|
14
14
|
|
|
15
15
|
00:03:27.000 --> 00:03:56.500
|
|
16
|
-
5 / 8: Sveriges första internetnod
|
|
16
|
+
Kapitel 5 / 8: Sveriges första internetnod
|
|
17
17
|
|
|
18
18
|
00:03:56.500 --> 00:04:34.000
|
|
19
|
-
6 / 8: Toppdomänen .se registreras
|
|
19
|
+
Kapitel 6 / 8: Toppdomänen .se registreras
|
|
20
20
|
|
|
21
21
|
00:04:34.000 --> 00:05:17.000
|
|
22
|
-
7 / 8: World Wide Web
|
|
22
|
+
Kapitel 7 / 8: World Wide Web
|
|
23
23
|
|
|
24
24
|
00:05:17.000 --> 00:06:28.000
|
|
25
|
-
8 / 8: Mosaic - den grafiska webbläsaren
|
|
25
|
+
Kapitel 8 / 8: Mosaic - den grafiska webbläsaren
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
WEBVTT
|
|
2
2
|
|
|
3
|
-
00:00:00.000 --> 00:00:
|
|
4
|
-
|
|
3
|
+
00:00:00.000 --> 00:00:25.000
|
|
4
|
+
91058
|
|
5
|
+
|
|
6
|
+
00:00:25.000 --> 00:00:39.000
|
|
7
|
+
91027
|
|
5
8
|
|
|
6
9
|
00:00:39.000 --> 00:01:51.500
|
|
7
|
-
|
|
10
|
+
81345
|
|
8
11
|
|
|
9
12
|
00:01:51.500 --> 00:02:23.000
|
|
10
|
-
|
|
13
|
+
76810
|
|
11
14
|
|
|
12
15
|
00:02:23.000 --> 00:03:27.000
|
|
13
|
-
|
|
16
|
+
86454
|
|
14
17
|
|
|
15
18
|
00:03:27.000 --> 00:03:56.500
|
|
16
|
-
|
|
19
|
+
80127
|
|
17
20
|
|
|
18
21
|
00:03:56.500 --> 00:04:34.000
|
|
19
|
-
|
|
22
|
+
76325
|
|
20
23
|
|
|
21
24
|
00:04:34.000 --> 00:05:17.000
|
|
22
|
-
|
|
25
|
+
76280
|
|
23
26
|
|
|
24
27
|
00:05:17.000 --> 00:06:28.000
|
|
25
|
-
|
|
28
|
+
80725
|
|
Binary file
|