@internetstiftelsen/styleguide 2.22.3-beta.0.58 → 2.22.3-beta.0.59
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.
|
@@ -27,14 +27,6 @@ var sourceElement = null;
|
|
|
27
27
|
if (sourceElement) {
|
|
28
28
|
document.location.reload();
|
|
29
29
|
} else if (video) {
|
|
30
|
-
var dataSrc = video.dataset.src;
|
|
31
|
-
|
|
32
|
-
sourceElement = document.createElement('source');
|
|
33
|
-
sourceElement.setAttribute('src', dataSrc);
|
|
34
|
-
sourceElement.setAttribute('type', 'video/mp4');
|
|
35
|
-
|
|
36
|
-
video.appendChild(sourceElement);
|
|
37
|
-
|
|
38
30
|
// Store current time in on page reload
|
|
39
31
|
window.addEventListener('unload', function () {
|
|
40
32
|
// Set localStorage if video has started playing
|
|
@@ -224,23 +216,10 @@ function displayChapters() {
|
|
|
224
216
|
// get the chapter <li> elements based on the currentLocation
|
|
225
217
|
var locations = [].slice.call(chapter.closest('figure').querySelectorAll('.js-chapters li'));
|
|
226
218
|
|
|
227
|
-
var counter = 0;
|
|
228
|
-
|
|
229
219
|
[].forEach.call(locations, function (location) {
|
|
230
220
|
// remove current classes from all items on page refresh
|
|
231
221
|
location.classList.remove('is-current-item');
|
|
232
222
|
location.querySelector('a').classList.remove('is-current');
|
|
233
|
-
|
|
234
|
-
if (location.classList.contains('is-current-item')) {
|
|
235
|
-
counter += 1; // iterate counter when active chapter is reached
|
|
236
|
-
}
|
|
237
|
-
if (counter < 1) {
|
|
238
|
-
// add watched class to everything before the current chapter to show progress
|
|
239
|
-
location.classList.add('is-watched');
|
|
240
|
-
} else {
|
|
241
|
-
// remove watched on all other items
|
|
242
|
-
location.classList.remove('is-watched');
|
|
243
|
-
}
|
|
244
223
|
});
|
|
245
224
|
chapter.parentNode.classList.add('is-current-item');
|
|
246
225
|
chapter.classList.add('is-current');
|
|
@@ -253,7 +232,7 @@ function displayChapters() {
|
|
|
253
232
|
// Get timeline post IDs from metadata.vtt
|
|
254
233
|
metadataTrack.addEventListener('cuechange', function () {
|
|
255
234
|
var metadataCues = metadataTrack.activeCues;
|
|
256
|
-
var chapterCues = chapterTrack.activeCues;
|
|
235
|
+
var chapterCues = chapterTrack.activeCues[0];
|
|
257
236
|
|
|
258
237
|
if (metadataCues.length > 0) {
|
|
259
238
|
var metadataCueMatch = metadataTrack.activeCues[0].text;
|
package/package.json
CHANGED
|
@@ -19,20 +19,12 @@ const navigationButton = document.querySelector('.js-show-timelineposts');
|
|
|
19
19
|
const timeLinePosts = document.querySelector('.js-timeline-posts');
|
|
20
20
|
let currentChapter = 1;
|
|
21
21
|
let manualStep = false;
|
|
22
|
-
|
|
22
|
+
const sourceElement = null;
|
|
23
23
|
|
|
24
24
|
// Has src attributes been set already?
|
|
25
25
|
if (sourceElement) {
|
|
26
26
|
document.location.reload();
|
|
27
27
|
} else if (video) {
|
|
28
|
-
const 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
|
-
|
|
36
28
|
// Store current time in on page reload
|
|
37
29
|
window.addEventListener('unload', () => {
|
|
38
30
|
// Set localStorage if video has started playing
|
|
@@ -223,23 +215,10 @@ function displayChapters() {
|
|
|
223
215
|
const locations = [].slice.call(chapter.closest('figure')
|
|
224
216
|
.querySelectorAll('.js-chapters li'));
|
|
225
217
|
|
|
226
|
-
let counter = 0;
|
|
227
|
-
|
|
228
218
|
[].forEach.call(locations, (location) => {
|
|
229
219
|
// remove current classes from all items on page refresh
|
|
230
220
|
location.classList.remove('is-current-item');
|
|
231
221
|
location.querySelector('a').classList.remove('is-current');
|
|
232
|
-
|
|
233
|
-
if (location.classList.contains('is-current-item')) {
|
|
234
|
-
counter += 1; // iterate counter when active chapter is reached
|
|
235
|
-
}
|
|
236
|
-
if (counter < 1) {
|
|
237
|
-
// add watched class to everything before the current chapter to show progress
|
|
238
|
-
location.classList.add('is-watched');
|
|
239
|
-
} else {
|
|
240
|
-
// remove watched on all other items
|
|
241
|
-
location.classList.remove('is-watched');
|
|
242
|
-
}
|
|
243
222
|
});
|
|
244
223
|
chapter.parentNode.classList.add('is-current-item');
|
|
245
224
|
chapter.classList.add('is-current');
|
|
@@ -252,7 +231,7 @@ function displayChapters() {
|
|
|
252
231
|
// Get timeline post IDs from metadata.vtt
|
|
253
232
|
metadataTrack.addEventListener('cuechange', () => {
|
|
254
233
|
const metadataCues = metadataTrack.activeCues;
|
|
255
|
-
const chapterCues = chapterTrack.activeCues;
|
|
234
|
+
const chapterCues = chapterTrack.activeCues[0];
|
|
256
235
|
|
|
257
236
|
if (metadataCues.length > 0) {
|
|
258
237
|
const metadataCueMatch = metadataTrack.activeCues[0].text;
|