@internetstiftelsen/styleguide 2.22.3-beta.0.6 → 2.22.3-beta.0.60
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 +62 -75
- package/package.json +2 -4
- 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/continue-video-guide/continue-video-guide.scss +7 -1
- 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 +12 -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 +62 -75
- 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,38 +17,29 @@ 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
|
-
var sourceElement = null;
|
|
23
24
|
|
|
24
25
|
// Has src attributes been set already?
|
|
25
|
-
if (
|
|
26
|
-
document.location.reload();
|
|
27
|
-
} else if (video) {
|
|
28
|
-
var dataSrc = video.dataset.src;
|
|
29
|
-
|
|
30
|
-
sourceElement = document.createElement('source');
|
|
31
|
-
sourceElement.setAttribute('src', dataSrc);
|
|
32
|
-
sourceElement.setAttribute('type', 'video/mp4');
|
|
33
|
-
|
|
34
|
-
video.appendChild(sourceElement);
|
|
35
|
-
|
|
26
|
+
if (video) {
|
|
36
27
|
// Store current time in on page reload
|
|
37
28
|
window.addEventListener('unload', function () {
|
|
38
|
-
// Set
|
|
29
|
+
// Set localStorage if video has started playing
|
|
39
30
|
if (video.currentTime > 0) {
|
|
40
31
|
var currentGuideURL = window.location.href;
|
|
41
|
-
var currentGuideImage =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
var currentGuideImage = video.dataset.featuredImage;
|
|
33
|
+
localStorage.setItem('InmsCurrentTime', video.currentTime);
|
|
34
|
+
localStorage.setItem('InmsDuration', video.duration); // Get totalt duration of video
|
|
35
|
+
localStorage.setItem('InmsCurrentGuideURL', currentGuideURL);
|
|
36
|
+
localStorage.setItem('InmsCurrentGuideImage', currentGuideImage);
|
|
46
37
|
}
|
|
47
38
|
});
|
|
48
39
|
|
|
49
|
-
// Get value from
|
|
50
|
-
if (
|
|
51
|
-
var videoCurrentTime =
|
|
40
|
+
// Get value from localStorage in present
|
|
41
|
+
if (localStorage.getItem('InmsCurrentTime')) {
|
|
42
|
+
var videoCurrentTime = localStorage.getItem('InmsCurrentTime');
|
|
52
43
|
|
|
53
44
|
if (videoCurrentTime > 0) {
|
|
54
45
|
video.currentTime = videoCurrentTime;
|
|
@@ -93,10 +84,10 @@ if (sourceElement) {
|
|
|
93
84
|
manualStep = false;
|
|
94
85
|
forwardsButton.removeAttribute('disabled');
|
|
95
86
|
subtitlesContainer.innerHTML = '';
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
localStorage.removeItem('InmsCurrentTime');
|
|
88
|
+
localStorage.removeItem('InmsDuration');
|
|
89
|
+
localStorage.removeItem('InmsCurrentGuideURL');
|
|
90
|
+
localStorage.removeItem('InmsCurrentGuideImage');
|
|
100
91
|
});
|
|
101
92
|
}
|
|
102
93
|
|
|
@@ -109,13 +100,20 @@ if (sourceElement) {
|
|
|
109
100
|
forwardsButton.removeAttribute('disabled');
|
|
110
101
|
currentChapter = 1;
|
|
111
102
|
manualStep = false;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
localStorage.removeItem('InmsCurrentTime');
|
|
104
|
+
localStorage.removeItem('InmsDuration');
|
|
105
|
+
localStorage.removeItem('InmsCurrentGuideURL');
|
|
106
|
+
localStorage.removeItem('InmsCurrentGuideImage');
|
|
116
107
|
window.location.href = urlTarget;
|
|
117
108
|
});
|
|
118
109
|
}
|
|
110
|
+
|
|
111
|
+
if (navigationButton) {
|
|
112
|
+
navigationButton.addEventListener('click', function () {
|
|
113
|
+
navigationButton.classList.toggle('is-toggeled');
|
|
114
|
+
timeLinePosts.classList.toggle('is-visible');
|
|
115
|
+
});
|
|
116
|
+
}
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
function displayChapters() {
|
|
@@ -126,38 +124,36 @@ function displayChapters() {
|
|
|
126
124
|
});
|
|
127
125
|
|
|
128
126
|
if (chapterTrack.kind === 'chapters') {
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, 100);
|
|
160
|
-
});
|
|
127
|
+
// Loop through chapters and create chapter list
|
|
128
|
+
// Let data load
|
|
129
|
+
setTimeout(function () {
|
|
130
|
+
video.classList.remove('is-loading');
|
|
131
|
+
[].forEach.call(chapterTrack.cues, function (cues) {
|
|
132
|
+
var chapterName = cues.text;
|
|
133
|
+
var start = cues.startTime;
|
|
134
|
+
var newLocale = document.createElement('li');
|
|
135
|
+
var location = document.createElement('a');
|
|
136
|
+
|
|
137
|
+
location.setAttribute('rel', start);
|
|
138
|
+
newLocale.setAttribute('id', start);
|
|
139
|
+
location.setAttribute('tabindex', '0');
|
|
140
|
+
|
|
141
|
+
// Plain text from the chapter file into HTML text
|
|
142
|
+
var localeDescription = chapterName;
|
|
143
|
+
location.innerHTML = localeDescription;
|
|
144
|
+
newLocale.appendChild(location);
|
|
145
|
+
locationList.appendChild(newLocale);
|
|
146
|
+
|
|
147
|
+
location.addEventListener('click', function () {
|
|
148
|
+
video.currentTime = location.id;
|
|
149
|
+
}, false);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// If not set in sessionStorgare, set first cue on forward button on page load
|
|
153
|
+
if (!localStorage.getItem('InmsCurrentTime')) {
|
|
154
|
+
forwardsButton.setAttribute('data-id', chapterTrack.cues[0].endTime);
|
|
155
|
+
}
|
|
156
|
+
}, 100);
|
|
161
157
|
|
|
162
158
|
forwardsButton.addEventListener('click', function () {
|
|
163
159
|
var dataId = forwardsButton.dataset.id;
|
|
@@ -215,23 +211,10 @@ function displayChapters() {
|
|
|
215
211
|
// get the chapter <li> elements based on the currentLocation
|
|
216
212
|
var locations = [].slice.call(chapter.closest('figure').querySelectorAll('.js-chapters li'));
|
|
217
213
|
|
|
218
|
-
var counter = 0;
|
|
219
|
-
|
|
220
214
|
[].forEach.call(locations, function (location) {
|
|
221
215
|
// remove current classes from all items on page refresh
|
|
222
216
|
location.classList.remove('is-current-item');
|
|
223
217
|
location.querySelector('a').classList.remove('is-current');
|
|
224
|
-
|
|
225
|
-
if (location.classList.contains('is-current-item')) {
|
|
226
|
-
counter += 1; // iterate counter when active chapter is reached
|
|
227
|
-
}
|
|
228
|
-
if (counter < 1) {
|
|
229
|
-
// add watched class to everything before the current chapter to show progress
|
|
230
|
-
location.classList.add('is-watched');
|
|
231
|
-
} else {
|
|
232
|
-
// remove watched on all other items
|
|
233
|
-
location.classList.remove('is-watched');
|
|
234
|
-
}
|
|
235
218
|
});
|
|
236
219
|
chapter.parentNode.classList.add('is-current-item');
|
|
237
220
|
chapter.classList.add('is-current');
|
|
@@ -253,7 +236,11 @@ function displayChapters() {
|
|
|
253
236
|
timelinePost.classList.remove('is-current');
|
|
254
237
|
});
|
|
255
238
|
|
|
256
|
-
document.
|
|
239
|
+
var idSelectors = document.querySelectorAll('[data-id="' + metadataCueMatch + '"]');
|
|
240
|
+
|
|
241
|
+
[].forEach.call(idSelectors, function (idSelector) {
|
|
242
|
+
idSelector.classList.add('is-current');
|
|
243
|
+
});
|
|
257
244
|
|
|
258
245
|
if (chapterCues) {
|
|
259
246
|
var chapterStartTime = chapterCues.startTime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetstiftelsen/styleguide",
|
|
3
|
-
"version": "2.22.3-beta.0.
|
|
3
|
+
"version": "2.22.3-beta.0.60",
|
|
4
4
|
"main": "dist/components.js",
|
|
5
5
|
"ports": {
|
|
6
6
|
"fractal": "3000"
|
|
@@ -11,14 +11,13 @@
|
|
|
11
11
|
"build:fractal": "fractal build",
|
|
12
12
|
"scss": "sass src/app.scss public/assets/css/app.css",
|
|
13
13
|
"stylelint": "stylelint 'src/**/*.scss' '!**/vendor/**' '!**/colors/_colors-functions.scss' --fix --cache --cache-location '.stylelintcache'",
|
|
14
|
-
"autoprefixer": "postcss --use autoprefixer -b 'last 2 versions' public/assets/css/app.css -d public/assets/css/",
|
|
15
14
|
"cssmin": "postcss --use cssnano -b '' public/assets/css/app.css > public/assets/css/app.min.css",
|
|
16
15
|
"browserify": "browserify public/assets/js/cjs/app.js -o public/assets/js/scripts.js",
|
|
17
16
|
"babel": "npx babel src --out-dir public/assets/js/cjs --ignore src/**/*.config.js",
|
|
18
17
|
"eslint": "eslint --fix src",
|
|
19
18
|
"uglify": "uglifyjs -o public/assets/js/scripts.js public/assets/js/scripts.js",
|
|
20
19
|
"imagemin": "imagemin --out-dir=public/assets/img src/**/*.{png,jpg,gif}",
|
|
21
|
-
"build:css": "npm run stylelint && npm run scss && npm run
|
|
20
|
+
"build:css": "npm run stylelint && npm run scss && npm run cssmin",
|
|
22
21
|
"build:js": "npm run eslint && npm run babel && npm run browserify",
|
|
23
22
|
"build:img": "npm run imagemin",
|
|
24
23
|
"watch:css": "onchange 'src/**/*.scss' -- npm run build:css",
|
|
@@ -45,7 +44,6 @@
|
|
|
45
44
|
"@frctl/mandelbrot": "^1.9.2",
|
|
46
45
|
"@internetstiftelsen/eslint-config": "^0.0.5",
|
|
47
46
|
"@internetstiftelsen/stylelint-config": "^1.0.0",
|
|
48
|
-
"autoprefixer": "^10.2.6",
|
|
49
47
|
"babel-cli": "^6.26.0",
|
|
50
48
|
"babel-eslint": "^10.0.3",
|
|
51
49
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
package/src/.DS_Store
CHANGED
|
Binary file
|