@internetstiftelsen/styleguide 2.22.3-beta.0.7 → 2.22.4

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.
Files changed (71) hide show
  1. package/dist/assets/js/objToQuery.js +2 -2
  2. package/dist/components.js +1 -9
  3. package/dist/molecules/glider/glider-course.js +7 -7
  4. package/package.json +3 -7
  5. package/src/app.scss +2 -6
  6. package/src/assets/css/footer/isolated-footer.css +7367 -0
  7. package/src/assets/css/footer/isolated-footer.css.map +1 -0
  8. package/src/assets/css/footer/isolated-footer.min.css +2 -0
  9. package/src/assets/js/objToQuery.js +2 -2
  10. package/src/atoms/button/_button.scss +9 -6
  11. package/src/atoms/icon/_all-icons.zip +0 -0
  12. package/src/atoms/icon/spinner-white.svg +9 -1
  13. package/src/atoms/icon/spinner.svg +9 -1
  14. package/src/atoms/icon/sprite.svg +0 -17
  15. package/src/atoms/meta/meta.config.js +1 -1
  16. package/src/base/_normalize.scss +1 -1
  17. package/src/base/fonts/_fonts.scss +8 -8
  18. package/src/brandbook/internetstiftelsen/bildman/303/251r/bildman/303/251r.config.js +5 -0
  19. package/src/brandbook/internetstiftelsen/tonalitet och spr/303/245kbruk/tonalitet och spr/303/245kbruk.config.js" +5 -0
  20. package/src/components.js +0 -4
  21. package/src/configurations/_extends.scss +1 -5
  22. package/src/configurations/_variables.scss +3 -3
  23. package/src/configurations/grid/_grid.scss +2 -17
  24. package/src/configurations/icons.json +1 -1
  25. package/src/configurations/typography/_typography.scss +4 -57
  26. package/src/molecules/glider/_glider.scss +116 -3
  27. package/src/molecules/glider/glider-course.js +7 -7
  28. package/src/molecules/glider/glider.config.js +0 -7
  29. package/src/organisms/hero/_hero.scss +0 -16
  30. package/src/organisms/hero/hero.config.js +1 -10
  31. package/src/pages/timeline/timeline.config.js +19 -0
  32. package/src/structures/_article.scss +3 -3
  33. package/dist/.DS_Store +0 -0
  34. package/dist/assets/js/anchorScroll.js +0 -16
  35. package/dist/assets/js/offset.js +0 -26
  36. package/dist/assets/js/parallax.js +0 -17
  37. package/dist/molecules/continue-video-guide/continue-video-guide.js +0 -91
  38. package/dist/molecules/glider/glider-hero.js +0 -23
  39. package/dist/organisms/timeline/timeline.js +0 -154
  40. package/dist/organisms/video-guide/video-guide.js +0 -298
  41. package/src/.DS_Store +0 -0
  42. package/src/assets/.DS_Store +0 -0
  43. package/src/assets/js/anchorScroll.js +0 -10
  44. package/src/assets/js/offset.js +0 -22
  45. package/src/assets/js/parallax.js +0 -15
  46. package/src/assets/video/.DS_Store +0 -0
  47. package/src/assets/video/Internets-Historia-HEVC-h265-HEVC-h265.mov +0 -0
  48. package/src/assets/video/Internets-Historia-HEVC-h265-vp9-chrome.webm +0 -0
  49. package/src/assets/video/chapters.vtt +0 -25
  50. package/src/assets/video/metadata.vtt +0 -25
  51. package/src/assets/video/movie-webm.webm +0 -0
  52. package/src/assets/video/videoplayer.vtt +0 -25
  53. package/src/atoms/.DS_Store +0 -0
  54. package/src/atoms/icon/step-backwards.svg +0 -1
  55. package/src/atoms/icon/step-forwards.svg +0 -1
  56. package/src/atoms/icon/subtitles.svg +0 -1
  57. package/src/molecules/.DS_Store +0 -0
  58. package/src/molecules/continue-video-guide/continue-video-guide.config.js +0 -7
  59. package/src/molecules/continue-video-guide/continue-video-guide.js +0 -84
  60. package/src/molecules/continue-video-guide/continue-video-guide.scss +0 -104
  61. package/src/molecules/continue-video-guide/readme.md +0 -3
  62. package/src/molecules/glider/_glider-course.scss +0 -121
  63. package/src/molecules/glider/_glider-hero.scss +0 -325
  64. package/src/molecules/glider/glider-hero.js +0 -17
  65. package/src/organisms/hero/_hero--dynamic-headline.scss +0 -161
  66. package/src/organisms/timeline/_timeline.scss +0 -292
  67. package/src/organisms/timeline/timeline.config.js +0 -7
  68. package/src/organisms/timeline/timeline.js +0 -146
  69. package/src/organisms/video-guide/_video-guide.scss +0 -337
  70. package/src/organisms/video-guide/video-guide.config.js +0 -17
  71. package/src/organisms/video-guide/video-guide.js +0 -293
@@ -1,6 +1,6 @@
1
1
  @charset "UTF-8";
2
2
 
3
- // The Glider components is dependant on JS-classes and is therefore not namespaced
3
+ // The Glider component is dependant on JS-classes and is therefore not namespaced
4
4
 
5
5
  .glider-contain {
6
6
  display: flex;
@@ -12,6 +12,16 @@
12
12
  padding-left: rhythm(8);
13
13
  }
14
14
 
15
+ .glider-contain-course {
16
+ display: flex;
17
+ position: relative;
18
+ align-items: center;
19
+ margin-top: 0;
20
+ margin-bottom: rhythm(2);
21
+ padding-left: 0;
22
+ padding-right: 0;
23
+ }
24
+
15
25
  .glider {
16
26
  position: relative;
17
27
  margin: 0 auto;
@@ -91,17 +101,120 @@
91
101
  }
92
102
  }
93
103
  }
104
+
105
+ @include m(course) {
106
+ margin-left: 0;
107
+ padding-left: 0;
108
+ padding-right: 0;
109
+
110
+ &::after {
111
+ display: none;
112
+ }
113
+
114
+ @include e(navigation) {
115
+ display: flex;
116
+ justify-content: space-between;
117
+
118
+ @include bp-up(lg) {
119
+ justify-content: flex-start;
120
+ }
121
+ }
122
+
123
+ @include e(media) {
124
+
125
+ &.zoom {
126
+ pointer-events: none;
127
+
128
+ @include bp-up(lg) {
129
+ pointer-events: auto;
130
+ cursor: zoom-in;
131
+ transition: all 0.15s ease-out;
132
+ position: relative;
133
+
134
+ &::after {
135
+ content: 'Förstora bilden';
136
+ color: $color-snow;
137
+ padding: rhythm(1) rhythm(2) rhythm(1) rhythm(4);
138
+ display: block;
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ border-top-left-radius: $border-radius;
143
+ border-bottom-right-radius: $border-radius;
144
+ width: auto;
145
+ line-height: 1;
146
+ height: $icon-size-large * 1.4;
147
+ background-color: rgba($color-cyberspace, 0.8);
148
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' id='icon-search' viewbox='0 0 32 32' width='32' height='32' fill='%23ffffff'%3E%3Cpath d='M24,21.8l8,8L29.9,32l-8-8c-5.9,4.6-14.3,3.6-19-2.2S-0.7,7.6,5.1,2.9S19.3-0.7,24,5.1C27.9,10,27.9,16.9,24,21.8L24,21.8z M13.4,23.9c5.8,0,10.5-4.7,10.5-10.5S19.2,3,13.4,3S3,7.7,3,13.4S7.7,23.9,13.4,23.9z'/%3E%3C/svg%3E");
149
+ background-position: rhythm(1) center;
150
+ background-size: $icon-size-medium $icon-size-medium;
151
+ background-repeat: no-repeat;
152
+
153
+ }
154
+
155
+ img {
156
+ transition: all 0.25s ease-out;
157
+ }
158
+
159
+ // Image zooming
160
+ &.is-zoomed {
161
+ cursor: zoom-out !important;
162
+ position: fixed;
163
+ left: 0;
164
+ right: 0;
165
+ top: 0;
166
+ bottom: 0;
167
+ z-index: z_index(foreground);
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ background-color: rgba($color-cyberspace, 0.8);
172
+ flex-direction: column;
173
+
174
+ &::after {
175
+ display: none;
176
+ }
177
+
178
+ img {
179
+ cursor: zoom-out;
180
+ max-width: 100%;
181
+ max-height: 100vh;
182
+ padding: rhythm(1);
183
+ height: auto;
184
+ }
185
+
186
+ figcaption {
187
+ max-width: rem(612px);
188
+ text-align: center;
189
+ color: $color-snow;
190
+ padding-left: rhythm(2);
191
+ padding-right: rhythm(2);
192
+ margin-bottom: 0 !important;
193
+ padding-bottom: 0 !important;
194
+ }
195
+ }
196
+ }
197
+ }
198
+
199
+ figcaption {
200
+ margin-top: rhythm(1);
201
+ }
202
+ @include bp-up(lg) {
203
+ display: flex;
204
+ flex-direction: column-reverse;
205
+ margin-top: 0;
206
+ }
207
+ }
208
+ }
94
209
  }
95
210
 
96
211
  .glider-nav {
97
212
  position: absolute;
98
213
  top: 50%;
99
214
  left: 0;
100
- z-index: z_index(middleground);
101
215
  transform: translateY(-50%);
102
216
  transition: background-color 0.25s ease-out;
103
217
  user-select: none;
104
- cursor: pointer;
105
218
 
106
219
  &:focus {
107
220
  background-color: $color-snow;
@@ -1,9 +1,9 @@
1
1
  import Glider from 'glider-js';
2
2
 
3
- const gliderElementCourse = document.querySelector('.js-glider-course');
3
+ const gliderElementSingle = document.querySelector('.js-glider-course');
4
4
 
5
- if (gliderElementCourse) {
6
- const GliderCourse = new Glider(gliderElementCourse, {
5
+ if (gliderElementSingle) {
6
+ const GliderSingle = new Glider(gliderElementSingle, {
7
7
  scrollLock: true,
8
8
  slidesToShow: 1,
9
9
  slidesToScroll: 1,
@@ -13,7 +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
- let slideIndex = GliderCourse.getCurrentSlide();
16
+ let slideIndex = GliderSingle.getCurrentSlide();
17
17
  let bounding = 0;
18
18
 
19
19
  const scrollTop = () => {
@@ -23,7 +23,7 @@ if (gliderElementCourse) {
23
23
  if (nextBtns) {
24
24
  [].forEach.call(nextBtns, (nextBtn) => {
25
25
  nextBtn.addEventListener('click', () => {
26
- GliderCourse.scrollItem(slideIndex += 1, true);
26
+ GliderSingle.scrollItem(slideIndex += 1, true);
27
27
 
28
28
  if (siteMain) {
29
29
  bounding = siteMain.getBoundingClientRect();
@@ -38,7 +38,7 @@ if (gliderElementCourse) {
38
38
  if (prevBtns) {
39
39
  [].forEach.call(prevBtns, (prevBtn) => {
40
40
  prevBtn.addEventListener('click', () => {
41
- GliderCourse.scrollItem(slideIndex -= 1, true);
41
+ GliderSingle.scrollItem(slideIndex -= 1, true);
42
42
 
43
43
  if (siteMain) {
44
44
  bounding = siteMain.getBoundingClientRect();
@@ -58,5 +58,5 @@ if (gliderElementCourse) {
58
58
  });
59
59
  }
60
60
 
61
- module.exports = GliderCourse;
61
+ module.exports = GliderSingle;
62
62
  }
@@ -17,13 +17,6 @@ module.exports = {
17
17
  context: {
18
18
  single: true
19
19
  }
20
- },
21
- {
22
- name: 'Hero',
23
- status: 'wip',
24
- context: {
25
- single: true
26
- }
27
20
  }
28
21
  ]
29
22
  }
@@ -376,22 +376,6 @@
376
376
  }
377
377
  }
378
378
 
379
- @include m(video-wide) {
380
- width: 100%;
381
-
382
- @include e(video) {
383
- width: 100%;
384
- object-fit: cover;
385
- object-position: 50% center;
386
-
387
- @include bp-up(sm) {
388
- min-height: rem(500px);
389
- max-height: 50vh;
390
- }
391
-
392
- }
393
- }
394
-
395
379
  // Event
396
380
  @include m(event) {
397
381
  width: 100%;
@@ -77,7 +77,7 @@ module.exports = {
77
77
  },
78
78
  {
79
79
  name: 'Event hero with button',
80
- status: 'ready',
80
+ status: 'wip',
81
81
  context: {
82
82
  event_title: 'Framtidsoptimism och problemlösning i en uppkopplad värld',
83
83
  organizer: 'Heja framtiden',
@@ -113,14 +113,5 @@ module.exports = {
113
113
  has_buttons: false,
114
114
  }
115
115
  },
116
- {
117
- name: 'Dynamic headline',
118
- status: 'wip',
119
- context: {
120
- has_image: true,
121
- hero_image: '/assets/images/Reprogramming_ENIAC2.png',
122
- heading: 'Datadamer - Kvinnorna som digitaliserade världen',
123
- }
124
- },
125
116
  ]
126
117
  }
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ status: 'prototype',
3
+
4
+ context: {
5
+ alt: 'Hands typing on laptop',
6
+ img_url: '/assets/images/ALX_0876.jpg',
7
+ title: 'Gymnasieskolor med hög bandbredd har bättre skolresultat',
8
+ url: 'http://www.google.se',
9
+ exerpt: 'Eget nulla <strong>facilisi etiam</strong> dignissim diam quis enim lobortis scelerisque. Faucibus a pellentesque sit amet porttitor.',
10
+ is_padded: true,
11
+ is_wide: true,
12
+ has_shadow: false,
13
+ has_button: false,
14
+ read_time: true,
15
+ has_border: false,
16
+ has_image: true,
17
+ has_radius: true
18
+ }
19
+ }
@@ -38,9 +38,9 @@
38
38
  > ul,
39
39
  > ol,
40
40
  > div:not(.wp-block-iis-info):not(.wp-block-image):not(.wp-block-iis-hero):not(.wp-block-iis-grid):not([class*='accordion']),
41
- > figure:not(.wp-block-iis-info):not(.wp-block-image):not(.wp-block-iis-hero):not(.wp-block-iis-grid):not([class*='accordion']),
42
41
  > .wp-block-iis-card,
43
42
  > .wp-block-image > figure,
43
+ > figure,
44
44
  > blockquote {
45
45
  &:not(.alignfull):not(.alignleft):not(.alignright):not(.alignwide) {
46
46
  max-width: calc(#{rem(612px)} + #{($indent * 2)});
@@ -75,8 +75,8 @@
75
75
  > ul,
76
76
  > ol,
77
77
  > div:not(.wp-block-iis-info):not(.wp-block-image):not(.wp-block-iis-hero):not(.wp-block-iis-grid):not([class*='accordion']),
78
- > figure:not(.wp-block-iis-info):not(.wp-block-image):not(.wp-block-iis-hero):not(.wp-block-iis-grid):not([class*='accordion']),
79
78
  > .wp-block-iis-card,
79
+ > figure,
80
80
  > blockquote {
81
81
  &:not(.alignfull):not(.alignleft):not(.alignright):not(.alignwide) {
82
82
  max-width: 46.364%;
@@ -103,8 +103,8 @@
103
103
  > ul,
104
104
  > ol,
105
105
  > div:not(.wp-block-iis-info):not(.wp-block-image):not(.wp-block-iis-hero):not(.wp-block-iis-grid):not([class*='accordion']),
106
- > figure:not(.wp-block-iis-info):not(.wp-block-image):not(.wp-block-iis-hero):not(.wp-block-iis-grid):not([class*='accordion']),
107
106
  > .wp-block-iis-card,
107
+ > figure,
108
108
  > blockquote {
109
109
  &:not(.alignfull):not(.alignleft):not(.alignright):not(.alignwide) {
110
110
  margin-right: $grid-margin-right;
package/dist/.DS_Store DELETED
Binary file
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var _smoothScroll = require('smooth-scroll');
4
-
5
- var _smoothScroll2 = _interopRequireDefault(_smoothScroll);
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
- var anchorScroll = new _smoothScroll2.default('a[href*="#"]', {
10
- speed: 1500,
11
- speedAsDuration: true,
12
- easing: 'easeOutCubic',
13
- ignore: '[data-scroll-ignore]'
14
- });
15
-
16
- module.exports = anchorScroll;
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- // Get top of element relative to window
5
- offsetTop: function offsetTop(el) {
6
- var rect = el.getBoundingClientRect();
7
- var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
8
- return rect.top + scrollTop;
9
- },
10
-
11
-
12
- // Get bottom of element relative to window
13
- offsetBottom: function offsetBottom(el) {
14
- var rect = el.getBoundingClientRect();
15
- var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
16
- return rect.bottom + scrollTop;
17
- },
18
-
19
-
20
- // Get left of element relative to window
21
- offsetLeft: function offsetLeft(el) {
22
- var rect = el.getBoundingClientRect();
23
- var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
24
- return rect.left + scrollLeft;
25
- }
26
- };
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- function isInView(el) {
4
- var box = el.getBoundingClientRect();
5
- return box.top < window.innerHeight && box.bottom >= 0;
6
- }
7
-
8
- var parallaxes = document.querySelectorAll('.js-parallax');
9
-
10
- window.addEventListener('scroll', function () {
11
- [].forEach.call(parallaxes, function (parallax) {
12
- var visible = isInView(parallax);
13
- if (visible) {
14
- parallax.classList.add('animate');
15
- }
16
- });
17
- });
@@ -1,91 +0,0 @@
1
- 'use strict';
2
-
3
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
-
5
- var _className = require('../../assets/js/className');
6
-
7
- var _className2 = _interopRequireDefault(_className);
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
-
13
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
14
-
15
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
16
-
17
- function _CustomElement() {
18
- return Reflect.construct(HTMLElement, [], this.__proto__.constructor);
19
- }
20
-
21
- ;
22
- Object.setPrototypeOf(_CustomElement.prototype, HTMLElement.prototype);
23
- Object.setPrototypeOf(_CustomElement, HTMLElement);
24
-
25
- var ProgressRing = function (_CustomElement2) {
26
- _inherits(ProgressRing, _CustomElement2);
27
-
28
- function ProgressRing() {
29
- _classCallCheck(this, ProgressRing);
30
-
31
- var _this = _possibleConstructorReturn(this, (ProgressRing.__proto__ || Object.getPrototypeOf(ProgressRing)).call(this));
32
-
33
- var stroke = _this.getAttribute('stroke');
34
- var radius = _this.getAttribute('radius');
35
- var normalizedRadius = radius - stroke * 2;
36
- _this.circumference = normalizedRadius * 2 * Math.PI;
37
-
38
- _this.root = _this.attachShadow({ mode: 'open' });
39
- _this.root.innerHTML = '\n\t\t<svg\n\t\theight="' + radius * 2 + '"\n\t\twidth="' + radius * 2 + '"\n\t\t>\n\t\t<circle\n\t\tstroke="white"\n\t\tstroke-dasharray="' + _this.circumference + ' ' + _this.circumference + '"\n\t\tstyle="stroke-dashoffset:' + _this.circumference + '"\n\t\tstroke-width="' + stroke + '"\n\t\tfill="transparent"\n\t\tr="' + normalizedRadius + '"\n\t\tcx="' + radius + '"\n\t\tcy="' + radius + '"\n\t\t/>\n\t\t</svg>\n\n\t\t<style>\n\t\tcircle {\n\t\t\ttransition: stroke-dashoffset 0.35s;\n\t\t\ttransform: rotate(-90deg);\n\t\t\ttransform-origin: 50% 50%;\n\t\t}\n\t\t</style>\n\t\t';
40
- return _this;
41
- }
42
-
43
- _createClass(ProgressRing, [{
44
- key: 'setProgress',
45
- value: function setProgress(percent) {
46
- var offset = this.circumference - percent / 100 * this.circumference;
47
- var circle = this.root.querySelector('circle');
48
- circle.style.strokeDashoffset = offset;
49
- }
50
- }, {
51
- key: 'attributeChangedCallback',
52
- value: function attributeChangedCallback(name, oldValue, newValue) {
53
- if (name === 'progress') {
54
- this.setProgress(newValue);
55
- }
56
- }
57
- }], [{
58
- key: 'observedAttributes',
59
- get: function get() {
60
- return ['progress'];
61
- }
62
- }]);
63
-
64
- return ProgressRing;
65
- }(_CustomElement);
66
-
67
- window.customElements.define('progress-ring', ProgressRing);
68
-
69
- // Get value from sessionStorage if present
70
- if (sessionStorage.getItem('InmsCurrentTime')) {
71
- var videoCurrentTime = sessionStorage.getItem('InmsCurrentTime');
72
- var videoDuration = sessionStorage.getItem('InmsDuration');
73
- var continueElement = document.querySelector('.js-guide-continue');
74
- var progressRing = document.querySelector('progress-ring');
75
- var continueLink = document.querySelector('.js-guide-continue-link');
76
- var guideURL = sessionStorage.getItem('InmsCurrentGuideURL');
77
- var guideImage = sessionStorage.getItem('InmsCurrentGuideImage');
78
-
79
- if (videoCurrentTime > 0 && progressRing && continueElement && guideImage && continueLink) {
80
- var alternativeText = continueLink.dataset.altText;
81
- var currentProgress = videoCurrentTime / videoDuration;
82
- var currentGuideImage = document.querySelector('.js-guide-continue-image');
83
-
84
- continueElement.classList.add((0, _className2.default)('m-continue-video-guide--has-progress'));
85
- continueLink.setAttribute('href', guideURL);
86
- currentGuideImage.src = guideImage;
87
- continueLink.querySelector('span').innerText = alternativeText;
88
- // Calculate percentage played
89
- progressRing.setAttribute('progress', Math.floor(currentProgress * 100));
90
- }
91
- }
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- var _gliderJs = require('glider-js');
4
-
5
- var _gliderJs2 = _interopRequireDefault(_gliderJs);
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
- var gliderElementHero = document.querySelector('.js-glider-hero');
10
-
11
- if (gliderElementHero) {
12
- var GliderHero = new _gliderJs2.default(gliderElementHero, {
13
- scrollLock: true,
14
- slidesToShow: 1,
15
- slidesToScroll: 1,
16
- arrows: {
17
- prev: '.js-glider-prev',
18
- next: '.js-glider-next'
19
- }
20
- });
21
-
22
- module.exports = GliderHero;
23
- }
@@ -1,154 +0,0 @@
1
- 'use strict';
2
-
3
- require('../../assets/js/parallax');
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
- var _require = require('../../assets/js/offset'),
8
- offsetTop = _require.offsetTop,
9
- offsetBottom = _require.offsetBottom,
10
- offsetLeft = _require.offsetLeft;
11
-
12
- var progressBar = document.querySelector('.js-progress-bar');
13
- var decadeContainer = document.querySelector('.js-decade-container');
14
- var decadeSections = document.querySelectorAll('.js-timeline-decade');
15
- var firstDecade = document.querySelector('h2.godzilla');
16
- var decades = document.querySelectorAll('h2.godzilla');
17
- var triggerPoint = 0;
18
-
19
- // Create decade links in timeline
20
- function buildTimelineNavigation() {
21
- [].forEach.call(decades, function (decade) {
22
- var decadeLink = document.createElement('a');
23
- var textContent = decade.textContent;
24
-
25
- decadeLink.setAttribute('href', '#' + textContent);
26
- decadeLink.innerText = textContent;
27
- decadeContainer.appendChild(decadeLink);
28
- });
29
- }
30
-
31
- /* Set trigger point (vertical position in viewport)
32
- for when a new decade should start being "active" */
33
- function setTriggerPoint() {
34
- triggerPoint = window.innerHeight * 0.5;
35
- }
36
-
37
- // Animate progress bar when user is scolling within the timeline
38
- function animateProgressBar() {
39
- var currentSection = 0;
40
- var sectionIndex = 0;
41
- var currentPosition = document.documentElement.scrollTop + triggerPoint;
42
- var decadeLinks = document.querySelectorAll('.js-decade-container a');
43
- var progressBarWidth = 0;
44
-
45
- // Check if we are above the first section
46
- if (currentPosition < offsetTop(firstDecade)) {
47
- currentSection = 0;
48
- progressBarWidth = 0;
49
- progressBar.style.width = '0';
50
-
51
- [].forEach.call(decadeLinks, function (decadeLink) {
52
- decadeLink.classList.remove('is-reading');
53
- });
54
- } else {
55
- // Otherwise add 1 to sectionIndex while scrolling;
56
- [].forEach.call(decades, function (decade) {
57
- var sectionTop = offsetTop(decade);
58
-
59
- if (currentPosition >= sectionTop) {
60
- currentSection = sectionIndex;
61
-
62
- [].forEach.call(decadeLinks, function (decadeLink) {
63
- decadeLink.classList.remove('is-reading');
64
- });
65
-
66
- decadeLinks[sectionIndex].classList.add('is-reading');
67
- }
68
-
69
- sectionIndex += 1;
70
- });
71
- }
72
-
73
- // Calculate speed of the progressBar width while scrolling based on section height
74
- var startPoint = decadeLinks[currentSection];
75
- var startPointX = offsetLeft(startPoint);
76
- var startPointWidth = startPoint.offsetWidth;
77
- var startSection = decadeSections[currentSection];
78
- var startSectionY = offsetTop(startSection);
79
- var endSectionY = offsetBottom(startSection);
80
- var sectionLength = endSectionY - startSectionY;
81
- var scrollY = currentPosition - startSectionY;
82
- var sectionProgress = scrollY / sectionLength;
83
- progressBarWidth = startPointX + startPointWidth * sectionProgress;
84
-
85
- // Use result to animate progressbar
86
- progressBar.style.width = progressBarWidth + 'px';
87
- }
88
-
89
- // Run functions on page load
90
- if (progressBar) {
91
- buildTimelineNavigation();
92
- setTriggerPoint();
93
- animateProgressBar();
94
-
95
- // Re-run functions on window events
96
- window.addEventListener('resize', function () {
97
- setTriggerPoint();
98
- animateProgressBar();
99
- });
100
- window.addEventListener('scroll', function () {
101
- animateProgressBar();
102
- });
103
- }
104
-
105
- // DUMMY TIMELINE ITEM OPEN/CLOSE
106
- function wrap(el, wrapper) {
107
- el.parentNode.insertBefore(wrapper, el);
108
- wrapper.classList.add('wrapper');
109
- wrapper.appendChild(el);
110
- }
111
-
112
- var timeLineItems = document.querySelectorAll('.js-timeline-item');
113
- var timeLineItemScrollPosition = 0;
114
-
115
- [].forEach.call(timeLineItems, function (timeLineItem) {
116
- var timeLineItemLink = timeLineItem.querySelector('a');
117
- var timeLineItemClose = timeLineItem.querySelector('.js-timeline-item-close');
118
- var timeLineItemBottomClose = timeLineItem.querySelector('.js-timeline-item-bottom-close');
119
-
120
- timeLineItemLink.addEventListener('click', function () {
121
- timeLineItemScrollPosition = window.pageYOffset;
122
- sessionStorage.setItem('scroll-position', timeLineItemScrollPosition);
123
-
124
- if (!timeLineItem.classList.contains('is-open')) {
125
- timeLineItem.classList.add('is-open');
126
- timeLineItem.closest('.row').classList.add('row-has-open-child');
127
-
128
- // Wrap open timeline item
129
- wrap(timeLineItem.querySelector('.wp-block-iis-card'), document.createElement('div'));
130
- }
131
- });
132
-
133
- timeLineItemClose.addEventListener('click', function () {
134
- timeLineItem.classList.remove('is-open');
135
- timeLineItem.closest('.row').classList.remove('row-has-open-child');
136
-
137
- // Destroy generated wrapper
138
- var wrapper = timeLineItemClose.nextElementSibling;
139
- wrapper.replaceWith.apply(wrapper, _toConsumableArray(wrapper.childNodes));
140
-
141
- var top = sessionStorage.getItem('scroll-position');
142
- if (top !== null) {
143
- window.scrollTo(0, parseInt(top, 10));
144
- }
145
- sessionStorage.removeItem('scroll-position');
146
-
147
- // Trigger scroll event to reveal timeline items not yet parallaxed into view
148
- window.dispatchEvent(new CustomEvent('scroll'));
149
- });
150
-
151
- timeLineItemBottomClose.addEventListener('click', function () {
152
- timeLineItemClose.click();
153
- });
154
- });