@internetstiftelsen/styleguide 3.0.6 → 3.0.8
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.
|
@@ -19,6 +19,7 @@ if (gliderElementCourse) {
|
|
|
19
19
|
var prevBtns = document.querySelectorAll('.js-glider-prev');
|
|
20
20
|
var siteMain = document.querySelector('#siteMain');
|
|
21
21
|
var zoomImages = document.querySelectorAll('.js-zoom.zoom');
|
|
22
|
+
var youtubeVideos = document.querySelectorAll('[data-youtube]');
|
|
22
23
|
var slideIndex = GliderCourse.getCurrentSlide();
|
|
23
24
|
var bounding = 0;
|
|
24
25
|
|
|
@@ -31,6 +32,10 @@ if (gliderElementCourse) {
|
|
|
31
32
|
nextBtn.addEventListener('click', function () {
|
|
32
33
|
GliderCourse.scrollItem(slideIndex += 1, true);
|
|
33
34
|
|
|
35
|
+
[].forEach.call(youtubeVideos, function (el) {
|
|
36
|
+
return el.youtube && el.youtube.pauseVideo();
|
|
37
|
+
});
|
|
38
|
+
|
|
34
39
|
if (siteMain) {
|
|
35
40
|
bounding = siteMain.getBoundingClientRect();
|
|
36
41
|
if (bounding.top < 0) {
|
|
@@ -45,6 +50,9 @@ if (gliderElementCourse) {
|
|
|
45
50
|
[].forEach.call(prevBtns, function (prevBtn) {
|
|
46
51
|
prevBtn.addEventListener('click', function () {
|
|
47
52
|
GliderCourse.scrollItem(slideIndex -= 1, true);
|
|
53
|
+
[].forEach.call(youtubeVideos, function (el) {
|
|
54
|
+
return el.youtube && el.youtube.pauseVideo();
|
|
55
|
+
});
|
|
48
56
|
|
|
49
57
|
if (siteMain) {
|
|
50
58
|
bounding = siteMain.getBoundingClientRect();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetstiftelsen/styleguide",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"main": "dist/components.js",
|
|
5
5
|
"ports": {
|
|
6
6
|
"fractal": "3000"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@frctl/fractal": "^1.5.14",
|
|
45
|
-
"@frctl/mandelbrot": "^1.10.
|
|
45
|
+
"@frctl/mandelbrot": "^1.10.3",
|
|
46
46
|
"@internetstiftelsen/eslint-config": "^0.0.5",
|
|
47
47
|
"@internetstiftelsen/stylelint-config": "^1.0.0",
|
|
48
48
|
"babel-cli": "^6.26.0",
|
|
@@ -13,6 +13,7 @@ if (gliderElementCourse) {
|
|
|
13
13
|
const prevBtns = document.querySelectorAll('.js-glider-prev');
|
|
14
14
|
const siteMain = document.querySelector('#siteMain');
|
|
15
15
|
const zoomImages = document.querySelectorAll('.js-zoom.zoom');
|
|
16
|
+
const youtubeVideos = document.querySelectorAll('[data-youtube]');
|
|
16
17
|
let slideIndex = GliderCourse.getCurrentSlide();
|
|
17
18
|
let bounding = 0;
|
|
18
19
|
|
|
@@ -25,6 +26,8 @@ if (gliderElementCourse) {
|
|
|
25
26
|
nextBtn.addEventListener('click', () => {
|
|
26
27
|
GliderCourse.scrollItem(slideIndex += 1, true);
|
|
27
28
|
|
|
29
|
+
[].forEach.call(youtubeVideos, (el) => el.youtube && el.youtube.pauseVideo());
|
|
30
|
+
|
|
28
31
|
if (siteMain) {
|
|
29
32
|
bounding = siteMain.getBoundingClientRect();
|
|
30
33
|
if (bounding.top < 0) {
|
|
@@ -39,6 +42,7 @@ if (gliderElementCourse) {
|
|
|
39
42
|
[].forEach.call(prevBtns, (prevBtn) => {
|
|
40
43
|
prevBtn.addEventListener('click', () => {
|
|
41
44
|
GliderCourse.scrollItem(slideIndex -= 1, true);
|
|
45
|
+
[].forEach.call(youtubeVideos, (el) => el.youtube && el.youtube.pauseVideo());
|
|
42
46
|
|
|
43
47
|
if (siteMain) {
|
|
44
48
|
bounding = siteMain.getBoundingClientRect();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// DUMMY TIMELINE ITEM OPEN/CLOSE
|
|
2
|
+
function wrap(el, wrapper) {
|
|
3
|
+
el.parentNode.insertBefore(wrapper, el);
|
|
4
|
+
wrapper.classList.add('wrapper');
|
|
5
|
+
wrapper.appendChild(el);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const timeLineItems = document.querySelectorAll('.js-timeline-item');
|
|
9
|
+
let timeLineItemScrollPosition = 0;
|
|
10
|
+
|
|
11
|
+
[].forEach.call(timeLineItems, (timeLineItem) => {
|
|
12
|
+
const timeLineItemLink = timeLineItem.querySelector('a');
|
|
13
|
+
const timeLineItemClose = timeLineItem.querySelector('.js-timeline-item-close');
|
|
14
|
+
const timeLineItemBottomClose = timeLineItem.querySelector('.js-timeline-item-bottom-close');
|
|
15
|
+
|
|
16
|
+
timeLineItemLink.addEventListener('click', () => {
|
|
17
|
+
timeLineItemScrollPosition = window.pageYOffset;
|
|
18
|
+
sessionStorage.setItem('scroll-position', timeLineItemScrollPosition);
|
|
19
|
+
|
|
20
|
+
if (!timeLineItem.classList.contains('is-open')) {
|
|
21
|
+
timeLineItem.classList.add('is-open');
|
|
22
|
+
timeLineItem.closest('.row')
|
|
23
|
+
.classList
|
|
24
|
+
.add('row-has-open-child');
|
|
25
|
+
|
|
26
|
+
// Wrap open timeline item
|
|
27
|
+
wrap(timeLineItem.querySelector('.wp-block-iis-timeline-post'),
|
|
28
|
+
document.createElement('div'));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
timeLineItemClose.addEventListener('click', () => {
|
|
33
|
+
timeLineItem.classList.remove('is-open');
|
|
34
|
+
timeLineItem.closest('.row')
|
|
35
|
+
.classList
|
|
36
|
+
.remove('row-has-open-child');
|
|
37
|
+
|
|
38
|
+
// Destroy generated wrapper
|
|
39
|
+
const wrapper = timeLineItemClose.nextElementSibling;
|
|
40
|
+
wrapper.replaceWith(...wrapper.childNodes);
|
|
41
|
+
|
|
42
|
+
const top = sessionStorage.getItem('scroll-position');
|
|
43
|
+
if (top !== null) {
|
|
44
|
+
window.scrollTo(0, parseInt(top, 10));
|
|
45
|
+
}
|
|
46
|
+
sessionStorage.removeItem('scroll-position');
|
|
47
|
+
|
|
48
|
+
// Trigger scroll event to reveal timeline items not yet parallaxed into view
|
|
49
|
+
window.dispatchEvent(new CustomEvent('scroll'));
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
timeLineItemBottomClose.addEventListener('click', () => {
|
|
53
|
+
timeLineItemClose.click();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -137,55 +137,3 @@ if (progressBar) {
|
|
|
137
137
|
decadeIsVisible();
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
// DUMMY TIMELINE ITEM OPEN/CLOSE
|
|
142
|
-
// function wrap(el, wrapper) {
|
|
143
|
-
// el.parentNode.insertBefore(wrapper, el);
|
|
144
|
-
// wrapper.classList.add('wrapper');
|
|
145
|
-
// wrapper.appendChild(el);
|
|
146
|
-
// }
|
|
147
|
-
//
|
|
148
|
-
// const timeLineItems = document.querySelectorAll('.js-timeline-item');
|
|
149
|
-
// let timeLineItemScrollPosition = 0;
|
|
150
|
-
//
|
|
151
|
-
// [].forEach.call(timeLineItems, (timeLineItem) => {
|
|
152
|
-
// const timeLineItemLink = timeLineItem.querySelector('a');
|
|
153
|
-
// const timeLineItemClose = timeLineItem.querySelector('.js-timeline-item-close');
|
|
154
|
-
// const timeLineItemBottomClose = timeLineItem.querySelector('.js-timeline-item-bottom-close');
|
|
155
|
-
//
|
|
156
|
-
// timeLineItemLink.addEventListener('click', () => {
|
|
157
|
-
// timeLineItemScrollPosition = window.pageYOffset;
|
|
158
|
-
// sessionStorage.setItem('scroll-position', timeLineItemScrollPosition);
|
|
159
|
-
//
|
|
160
|
-
// if (!timeLineItem.classList.contains('is-open')) {
|
|
161
|
-
// timeLineItem.classList.add('is-open');
|
|
162
|
-
// timeLineItem.closest('.row').classList.add('row-has-open-child');
|
|
163
|
-
//
|
|
164
|
-
// // Wrap open timeline item
|
|
165
|
-
// wrap(timeLineItem.querySelector('.wp-block-iis-timeline-post'),
|
|
166
|
-
// document.createElement('div'));
|
|
167
|
-
// }
|
|
168
|
-
// });
|
|
169
|
-
//
|
|
170
|
-
// timeLineItemClose.addEventListener('click', () => {
|
|
171
|
-
// timeLineItem.classList.remove('is-open');
|
|
172
|
-
// timeLineItem.closest('.row').classList.remove('row-has-open-child');
|
|
173
|
-
//
|
|
174
|
-
// // Destroy generated wrapper
|
|
175
|
-
// const wrapper = timeLineItemClose.nextElementSibling;
|
|
176
|
-
// wrapper.replaceWith(...wrapper.childNodes);
|
|
177
|
-
//
|
|
178
|
-
// const top = sessionStorage.getItem('scroll-position');
|
|
179
|
-
// if (top !== null) {
|
|
180
|
-
// window.scrollTo(0, parseInt(top, 10));
|
|
181
|
-
// }
|
|
182
|
-
// sessionStorage.removeItem('scroll-position');
|
|
183
|
-
//
|
|
184
|
-
// // Trigger scroll event to reveal timeline items not yet parallaxed into view
|
|
185
|
-
// window.dispatchEvent(new CustomEvent('scroll'));
|
|
186
|
-
// });
|
|
187
|
-
//
|
|
188
|
-
// timeLineItemBottomClose.addEventListener('click', () => {
|
|
189
|
-
// timeLineItemClose.click();
|
|
190
|
-
// });
|
|
191
|
-
// });
|