@internetstiftelsen/styleguide 2.22.3-beta.0.11 → 2.22.3-beta.0.12
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/package.json
CHANGED
|
@@ -55,15 +55,15 @@ class ProgressRing extends HTMLElement {
|
|
|
55
55
|
|
|
56
56
|
window.customElements.define('progress-ring', ProgressRing);
|
|
57
57
|
|
|
58
|
-
// Get value from
|
|
59
|
-
if (
|
|
60
|
-
const videoCurrentTime =
|
|
61
|
-
const videoDuration =
|
|
58
|
+
// Get value from localStorage if present
|
|
59
|
+
if (localStorage.getItem('InmsCurrentTime')) {
|
|
60
|
+
const videoCurrentTime = localStorage.getItem('InmsCurrentTime');
|
|
61
|
+
const videoDuration = localStorage.getItem('InmsDuration');
|
|
62
62
|
const continueElement = document.querySelector('.js-guide-continue');
|
|
63
63
|
const progressRing = document.querySelector('progress-ring');
|
|
64
64
|
const continueLink = document.querySelector('.js-guide-continue-link');
|
|
65
|
-
const guideURL =
|
|
66
|
-
const guideImage =
|
|
65
|
+
const guideURL = localStorage.getItem('InmsCurrentGuideURL');
|
|
66
|
+
const guideImage = localStorage.getItem('InmsCurrentGuideImage');
|
|
67
67
|
|
|
68
68
|
if ((videoCurrentTime > 0)
|
|
69
69
|
&& progressRing
|
|
@@ -33,20 +33,20 @@ if (sourceElement) {
|
|
|
33
33
|
|
|
34
34
|
// Store current time in on page reload
|
|
35
35
|
window.addEventListener('unload', () => {
|
|
36
|
-
// Set
|
|
36
|
+
// Set localStorage if video has started playing
|
|
37
37
|
if (video.currentTime > 0) {
|
|
38
38
|
const currentGuideURL = window.location.href;
|
|
39
39
|
const currentGuideImage = document.querySelector('.js-guide-continue-image').src;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
localStorage.setItem('InmsCurrentTime', video.currentTime);
|
|
41
|
+
localStorage.setItem('InmsDuration', video.duration); // Get totalt duration of video
|
|
42
|
+
localStorage.setItem('InmsCurrentGuideURL', currentGuideURL);
|
|
43
|
+
localStorage.setItem('InmsCurrentGuideImage', currentGuideImage);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
// Get value from
|
|
48
|
-
if (
|
|
49
|
-
const videoCurrentTime =
|
|
47
|
+
// Get value from localStorage in present
|
|
48
|
+
if (localStorage.getItem('InmsCurrentTime')) {
|
|
49
|
+
const videoCurrentTime = localStorage.getItem('InmsCurrentTime');
|
|
50
50
|
|
|
51
51
|
if (videoCurrentTime > 0) {
|
|
52
52
|
video.currentTime = videoCurrentTime;
|
|
@@ -91,10 +91,10 @@ if (sourceElement) {
|
|
|
91
91
|
manualStep = false;
|
|
92
92
|
forwardsButton.removeAttribute('disabled');
|
|
93
93
|
subtitlesContainer.innerHTML = '';
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
localStorage.removeItem('InmsCurrentTime');
|
|
95
|
+
localStorage.removeItem('InmsDuration');
|
|
96
|
+
localStorage.removeItem('InmsCurrentGuideURL');
|
|
97
|
+
localStorage.removeItem('InmsCurrentGuideImage');
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -107,10 +107,10 @@ if (sourceElement) {
|
|
|
107
107
|
forwardsButton.removeAttribute('disabled');
|
|
108
108
|
currentChapter = 1;
|
|
109
109
|
manualStep = false;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
localStorage.removeItem('InmsCurrentTime');
|
|
111
|
+
localStorage.removeItem('InmsDuration');
|
|
112
|
+
localStorage.removeItem('InmsCurrentGuideURL');
|
|
113
|
+
localStorage.removeItem('InmsCurrentGuideImage');
|
|
114
114
|
window.location.href = urlTarget;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
@@ -151,7 +151,7 @@ function displayChapters() {
|
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
// If not set in sessionStorgare, set first cue on forward button on page load
|
|
154
|
-
if (!
|
|
154
|
+
if (!localStorage.getItem('InmsCurrentTime')) {
|
|
155
155
|
forwardsButton.setAttribute('data-id', chapterTrack.cues[0].endTime);
|
|
156
156
|
}
|
|
157
157
|
}, 100);
|