@internetstiftelsen/styleguide 2.22.3 → 2.23.1

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 (67) hide show
  1. package/dist/assets/js/anchorScroll.js +16 -0
  2. package/dist/assets/js/objToQuery.js +2 -2
  3. package/dist/assets/js/offset.js +26 -0
  4. package/dist/assets/js/parallax.js +17 -0
  5. package/dist/assets/js/youtube.js +38 -9
  6. package/dist/components.js +2 -0
  7. package/dist/molecules/continue-video-guide/continue-video-guide.js +91 -0
  8. package/dist/molecules/glider/glider-course.js +7 -7
  9. package/dist/molecules/glider/glider-hero.js +46 -0
  10. package/dist/organisms/timeline/timeline.js +155 -0
  11. package/dist/organisms/video-guide/video-guide.js +312 -0
  12. package/package.json +7 -3
  13. package/src/app.scss +3 -2
  14. package/src/assets/js/anchorScroll.js +10 -0
  15. package/src/assets/js/objToQuery.js +2 -2
  16. package/src/assets/js/offset.js +22 -0
  17. package/src/assets/js/parallax.js +15 -0
  18. package/src/assets/js/youtube.js +34 -9
  19. package/src/assets/video/Internets-Historia-HEVC-h265-HEVC-h265.mov +0 -0
  20. package/src/assets/video/Internets-Historia-HEVC-h265-vp9-chrome.webm +0 -0
  21. package/src/assets/video/chapters.vtt +25 -0
  22. package/src/assets/video/metadata.vtt +28 -0
  23. package/src/assets/video/movie-webm.webm +0 -0
  24. package/src/assets/video/videoplayer.vtt +25 -0
  25. package/src/atoms/button/_button.scss +6 -9
  26. package/src/atoms/icon/_all-icons.zip +0 -0
  27. package/src/atoms/icon/spinner-white.svg +1 -9
  28. package/src/atoms/icon/spinner.svg +1 -9
  29. package/src/atoms/icon/sprite.svg +17 -0
  30. package/src/atoms/icon/step-backwards.svg +1 -0
  31. package/src/atoms/icon/step-forwards.svg +1 -0
  32. package/src/atoms/icon/subtitles.svg +1 -0
  33. package/src/atoms/meta/meta.config.js +1 -1
  34. package/src/atoms/tag/_tag.scss +2 -2
  35. package/src/base/_normalize.scss +1 -1
  36. package/src/base/fonts/_fonts.scss +8 -8
  37. package/src/components.js +1 -0
  38. package/src/configurations/_extends.scss +5 -1
  39. package/src/configurations/_variables.scss +3 -3
  40. package/src/configurations/colors/_colors-functions.scss +2 -3
  41. package/src/configurations/grid/_grid.scss +26 -7
  42. package/src/configurations/icons.json +1 -1
  43. package/src/configurations/typography/_typography.scss +61 -7
  44. package/src/molecules/glider/_glider-course.scss +121 -0
  45. package/src/molecules/glider/_glider-hero.scss +327 -0
  46. package/src/molecules/glider/_glider.scss +3 -116
  47. package/src/molecules/glider/glider-course.js +7 -7
  48. package/src/molecules/glider/glider-hero.js +40 -0
  49. package/src/molecules/glider/glider.config.js +7 -0
  50. package/src/organisms/hero/_hero--dynamic-headline.scss +168 -0
  51. package/src/organisms/hero/_hero.scss +16 -0
  52. package/src/organisms/hero/hero.config.js +10 -1
  53. package/src/structures/_article.scss +3 -3
  54. package/src/utilities/_hide.scss +4 -0
  55. package/src/utilities/_links.scss +11 -0
  56. package/dist/.DS_Store +0 -0
  57. package/src/.DS_Store +0 -0
  58. package/src/assets/.DS_Store +0 -0
  59. package/src/assets/css/footer/isolated-footer.css +0 -7367
  60. package/src/assets/css/footer/isolated-footer.css.map +0 -1
  61. package/src/assets/css/footer/isolated-footer.min.css +0 -2
  62. package/src/assets/video/.DS_Store +0 -0
  63. package/src/atoms/.DS_Store +0 -0
  64. package/src/brandbook/internetstiftelsen/bildman/303/251r/bildman/303/251r.config.js +0 -5
  65. package/src/brandbook/internetstiftelsen/tonalitet och spr/303/245kbruk/tonalitet och spr/303/245kbruk.config.js" +0 -5
  66. package/src/molecules/.DS_Store +0 -0
  67. package/src/pages/timeline/timeline.config.js +0 -19
@@ -0,0 +1,312 @@
1
+ 'use strict';
2
+
3
+ var video = document.querySelector('.js-video-guide');
4
+ var playBtn = document.querySelector('.js-play-btn');
5
+ var playIcon = document.querySelector('.js-play-icon');
6
+ var pauseIcon = document.querySelector('.js-pause-icon');
7
+ var subtitlesBtn = document.querySelector('.js-subtitles-btn');
8
+ var abortButton = document.querySelector('.js-abort-guide');
9
+ var subtitlesElement = document.getElementById('video-subtitles');
10
+ var subtitlesContainer = document.querySelector('.js-subtitles-container');
11
+ var locationList = document.querySelector('.js-chapters');
12
+ var chapterTrackElement = document.getElementById('video-chapters');
13
+ var trackMetadataElement = document.getElementById('video-metadata');
14
+ var subtitlesTrack = subtitlesElement === null ? '' : subtitlesElement.track;
15
+ var chapterTrack = chapterTrackElement === null ? '' : chapterTrackElement.track;
16
+ var metadataTrack = trackMetadataElement === null ? '' : trackMetadataElement.track;
17
+ var forwardsButton = document.querySelector('.js-next-chapter');
18
+ var backwardsButton = document.querySelector('.js-previous-chapter');
19
+ var timelinePosts = document.querySelectorAll('.js-timeline-post');
20
+ var navigationButton = document.querySelector('.js-show-timelineposts');
21
+ var timeLinePosts = document.querySelector('.js-timeline-posts');
22
+ var currentChapter = 1;
23
+ var manualStep = false;
24
+ var sourceElement = null;
25
+
26
+ // Has src attributes been set already?
27
+ if (sourceElement) {
28
+ document.location.reload();
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
+ // Store current time in on page reload
39
+ window.addEventListener('unload', function () {
40
+ // Set localStorage if video has started playing
41
+ if (video.currentTime > 0) {
42
+ var currentGuideURL = window.location.href;
43
+ var currentGuideImage = document.querySelector('.js-guide-continue-image').src;
44
+ localStorage.setItem('InmsCurrentTime', video.currentTime);
45
+ localStorage.setItem('InmsDuration', video.duration); // Get totalt duration of video
46
+ localStorage.setItem('InmsCurrentGuideURL', currentGuideURL);
47
+ localStorage.setItem('InmsCurrentGuideImage', currentGuideImage);
48
+ }
49
+ });
50
+
51
+ // Get value from localStorage in present
52
+ if (localStorage.getItem('InmsCurrentTime')) {
53
+ var videoCurrentTime = localStorage.getItem('InmsCurrentTime');
54
+
55
+ if (videoCurrentTime > 0) {
56
+ video.currentTime = videoCurrentTime;
57
+ }
58
+ }
59
+
60
+ // Toggle subtitles
61
+ if (subtitlesBtn) {
62
+ subtitlesBtn.addEventListener('click', function () {
63
+ subtitlesBtn.classList.toggle('is-active');
64
+ subtitlesContainer.classList.toggle('is-visible');
65
+ });
66
+ }
67
+
68
+ // Play / pause
69
+ if (playBtn) {
70
+ playBtn.addEventListener('click', function () {
71
+ if (video.paused) {
72
+ video.play();
73
+ pauseIcon.classList.remove('is-hidden');
74
+ playIcon.classList.add('is-hidden');
75
+ manualStep = false;
76
+ } else {
77
+ video.pause();
78
+ pauseIcon.classList.add('is-hidden');
79
+ playIcon.classList.remove('is-hidden');
80
+ manualStep = true;
81
+ }
82
+ });
83
+
84
+ video.addEventListener('playing', function () {
85
+ pauseIcon.classList.remove('is-hidden');
86
+ playIcon.classList.add('is-hidden');
87
+ manualStep = false;
88
+ });
89
+
90
+ video.addEventListener('ended', function () {
91
+ pauseIcon.classList.add('is-hidden');
92
+ playIcon.classList.remove('is-hidden');
93
+ video.currentTime = 0;
94
+ currentChapter = 1;
95
+ manualStep = false;
96
+ forwardsButton.removeAttribute('disabled');
97
+ subtitlesContainer.innerHTML = '';
98
+ localStorage.removeItem('InmsCurrentTime');
99
+ localStorage.removeItem('InmsDuration');
100
+ localStorage.removeItem('InmsCurrentGuideURL');
101
+ localStorage.removeItem('InmsCurrentGuideImage');
102
+ });
103
+ }
104
+
105
+ if (abortButton) {
106
+ abortButton.addEventListener('click', function (e) {
107
+ e.preventDefault();
108
+ var urlTarget = abortButton.getAttribute('href');
109
+ video.pause();
110
+ video.currentTime = 0;
111
+ forwardsButton.removeAttribute('disabled');
112
+ currentChapter = 1;
113
+ manualStep = false;
114
+ localStorage.removeItem('InmsCurrentTime');
115
+ localStorage.removeItem('InmsDuration');
116
+ localStorage.removeItem('InmsCurrentGuideURL');
117
+ localStorage.removeItem('InmsCurrentGuideImage');
118
+ window.location.href = urlTarget;
119
+ });
120
+ }
121
+
122
+ if (navigationButton) {
123
+ navigationButton.addEventListener('click', function () {
124
+ navigationButton.classList.toggle('is-toggeled');
125
+ timeLinePosts.classList.toggle('is-visible');
126
+ });
127
+ }
128
+ }
129
+
130
+ function displayChapters() {
131
+ if (chapterTrackElement && trackMetadataElement) {
132
+ // Set all track elements to hidden mode to allow scripting
133
+ [].forEach.call(video.textTracks, function (txtTrack) {
134
+ txtTrack.mode = 'hidden';
135
+ });
136
+
137
+ if (chapterTrack.kind === 'chapters') {
138
+ video.addEventListener('loadedmetadata', function () {
139
+ // Loop through chapters and create chapter list
140
+ // Let data load
141
+ setTimeout(function () {
142
+ video.classList.remove('is-loading');
143
+ [].forEach.call(chapterTrack.cues, function (cues) {
144
+ var chapterName = cues.text;
145
+ var start = cues.startTime;
146
+ var newLocale = document.createElement('li');
147
+ var location = document.createElement('a');
148
+
149
+ location.setAttribute('rel', start);
150
+ newLocale.setAttribute('id', start);
151
+ location.setAttribute('tabindex', '0');
152
+
153
+ // Plain text from the chapter file into HTML text
154
+ var localeDescription = chapterName;
155
+ location.innerHTML = localeDescription;
156
+ newLocale.appendChild(location);
157
+ locationList.appendChild(newLocale);
158
+
159
+ location.addEventListener('click', function () {
160
+ video.currentTime = location.id;
161
+ }, false);
162
+ });
163
+
164
+ // If not set in sessionStorgare, set first cue on forward button on page load
165
+ if (!localStorage.getItem('InmsCurrentTime')) {
166
+ forwardsButton.setAttribute('data-id', chapterTrack.cues[0].endTime);
167
+ }
168
+ }, 100);
169
+ });
170
+
171
+ forwardsButton.addEventListener('click', function () {
172
+ var dataId = forwardsButton.dataset.id;
173
+ var currentTime = parseInt(dataId, 10);
174
+ manualStep = true;
175
+ currentTime += 1;
176
+ video.currentTime = currentTime;
177
+ currentChapter += 1;
178
+ });
179
+
180
+ backwardsButton.addEventListener('click', function () {
181
+ var dataId = backwardsButton.dataset.id;
182
+ var lastTime = parseInt(dataId, 10);
183
+ lastTime -= 1;
184
+ video.currentTime = lastTime;
185
+ forwardsButton.removeAttribute('disabled');
186
+ manualStep = true;
187
+ currentChapter -= 1;
188
+
189
+ if (video.currentTime <= 0) {
190
+ backwardsButton.removeAttribute('data-id');
191
+ }
192
+ });
193
+
194
+ chapterTrack.addEventListener('cuechange', function () {
195
+ // Fire this whenever the chapters changes
196
+ var myCues = chapterTrack.activeCues;
197
+ if (myCues.length > 0) {
198
+ var currentLocation = chapterTrack.activeCues[0].startTime;
199
+ var nextLocation = chapterTrack.activeCues[0].endTime;
200
+ var cueMatch = chapterTrack.activeCues[0].text;
201
+ var matchingCueArray = document.querySelectorAll('[rel="' + currentLocation + '"]');
202
+
203
+ // Set Forward and backwards buttons timestamps
204
+ forwardsButton.setAttribute('data-id', nextLocation);
205
+ backwardsButton.setAttribute('data-id', currentLocation);
206
+
207
+ // Add chapter stepping even when video is played
208
+ if (manualStep === false) {
209
+ currentChapter += 1;
210
+ }
211
+
212
+ // Disable forwardsbutton when on last chapter
213
+ if (currentChapter >= chapterTrack.cues.length) {
214
+ forwardsButton.setAttribute('disabled', 'disabled');
215
+ }
216
+
217
+ // Handle current and watched items
218
+ [].forEach.call(matchingCueArray, function (matchingCue) {
219
+ var thisChapter = matchingCue;
220
+ if (thisChapter.innerHTML === cueMatch) {
221
+ var chapter = thisChapter;
222
+
223
+ if (chapter === thisChapter) {
224
+ // get the chapter <li> elements based on the currentLocation
225
+ var locations = [].slice.call(chapter.closest('figure').querySelectorAll('.js-chapters li'));
226
+
227
+ var counter = 0;
228
+
229
+ [].forEach.call(locations, function (location) {
230
+ // remove current classes from all items on page refresh
231
+ location.classList.remove('is-current-item');
232
+ 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
+ });
245
+ chapter.parentNode.classList.add('is-current-item');
246
+ chapter.classList.add('is-current');
247
+ }
248
+ }
249
+ });
250
+ }
251
+ }, false);
252
+
253
+ // Get timeline post IDs from metadata.vtt
254
+ metadataTrack.addEventListener('cuechange', function () {
255
+ var metadataCues = metadataTrack.activeCues;
256
+ var chapterCues = chapterTrack.activeCues[0];
257
+
258
+ if (metadataCues.length > 0) {
259
+ var metadataCueMatch = metadataTrack.activeCues[0].text;
260
+
261
+ [].forEach.call(timelinePosts, function (timelinePost) {
262
+ timelinePost.classList.remove('is-current');
263
+ });
264
+
265
+ var idSelectors = document.querySelectorAll('[data-id="' + metadataCueMatch + '"]');
266
+
267
+ [].forEach.call(idSelectors, function (idSelector) {
268
+ idSelector.classList.add('is-current');
269
+ idSelector.focus();
270
+ });
271
+
272
+ if (chapterCues) {
273
+ var chapterStartTime = chapterCues.startTime;
274
+
275
+ // Let stuff load
276
+ var listElement = void 0;
277
+ var timeOut = null;
278
+
279
+ setTimeout(function () {
280
+ listElement = document.getElementById(chapterStartTime);
281
+ }, 100);
282
+
283
+ timeOut = function wait(condition, callback) {
284
+ if (typeof condition() !== 'undefined' && listElement) {
285
+ listElement.classList.add('is-current-item');
286
+ } else {
287
+ setTimeout(function () {
288
+ wait(condition, callback);
289
+ }, 0);
290
+ }
291
+ };
292
+ timeOut(function () {
293
+ return listElement;
294
+ }, function () {});
295
+ }
296
+ }
297
+ }, false);
298
+
299
+ // Get subtitles cues from subtitles.vtt
300
+ subtitlesTrack.addEventListener('cuechange', function () {
301
+ var subtitlesCues = subtitlesTrack.activeCues;
302
+
303
+ if (subtitlesCues.length > 0) {
304
+ var subtitlesCuesMatch = subtitlesTrack.activeCues[0].text;
305
+ subtitlesContainer.innerHTML = '<span>' + subtitlesCuesMatch + '</span>';
306
+ }
307
+ }, false);
308
+ }
309
+ }
310
+ }
311
+
312
+ displayChapters(chapterTrackElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "2.22.3",
3
+ "version": "2.23.1",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -26,13 +26,15 @@
26
26
  "watch:icons": "onchange 'src/atoms/icon/*.svg' -- npm run create-icons-config",
27
27
  "watch": "concurrently \"npm:watch:css\" \"npm:watch:js\" \"npm:watch:icons\"",
28
28
  "copy:images": "copyfiles -f src/assets/images/* public/assets/images",
29
+ "copy:videos": "copyfiles -f src/assets/video/* public/assets/video",
29
30
  "copy:fonts": "copyfiles -f src/base/fonts/* public/assets/fonts",
30
31
  "copy:zip": "copyfiles -f src/assets/zip/* public/assets/zip",
31
- "copy:local-assets": "npm run copy:images && npm run copy:fonts && npm run copy:zip",
32
+ "copy:local-assets": "npm run copy:images && npm run copy:fonts && npm run copy:videos && npm run copy:zip",
32
33
  "copy:images:build": "copyfiles -f src/assets/images/* build/assets/images",
34
+ "copy:videos:build": "copyfiles -f src/assets/video/* build/assets/video",
33
35
  "copy:zip:build": "copyfiles -f src/assets/zip/* build/assets/zip",
34
36
  "copy:fonts:build": "copyfiles -f src/base/fonts/* build/assets/fonts",
35
- "copy:build": "npm run copy:images:build && npm run copy:zip:build && npm run copy:fonts:build",
37
+ "copy:build": "npm run copy:images:build && npm run copy:zip:build && npm run copy:fonts:build && npm run copy:videos:build",
36
38
  "build": "npm run build:css && npm run build:js && npm run uglify && npm run build:fractal && npm run copy:build",
37
39
  "dev": "concurrently \"npm:start:fractal\" \"npm:watch\" \"npm:copy:local-assets\"",
38
40
  "package-js": "NODE_ENV=production babel src --out-dir dist --ignore src/**/*.config.js,src/app.js",
@@ -48,6 +50,8 @@
48
50
  "babel-eslint": "^10.0.3",
49
51
  "babel-plugin-syntax-dynamic-import": "^6.18.0",
50
52
  "babel-plugin-transform-class-properties": "^6.24.1",
53
+ "babel-plugin-transform-custom-element-classes": "^0.1.0",
54
+ "babel-plugin-transform-es2015-classes": "^6.24.1",
51
55
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
52
56
  "babel-preset-env": "^1.7.0",
53
57
  "browserify": "^16.5.0",
package/src/app.scss CHANGED
@@ -42,7 +42,6 @@ $namespace: '';
42
42
  @import 'atoms/ribbon/ribbon';
43
43
  @import 'atoms/quote/quote';
44
44
  @import 'atoms/rating/rating';
45
- @import 'atoms/timeline/timeline';
46
45
 
47
46
  // Molecules
48
47
  @import 'molecules/breadcrumb/breadcrumb';
@@ -65,13 +64,15 @@ $namespace: '';
65
64
  @import 'molecules/icon-overlay/icon-overlay';
66
65
  @import 'molecules/submenu/submenu';
67
66
  @import 'molecules/glider/glider';
68
- @import 'molecules/timeline-navigation/timeline-navigation';
67
+ @import 'molecules/glider/glider-course';
68
+ @import 'molecules/glider/glider-hero';
69
69
 
70
70
  // Organisms
71
71
  @import 'organisms/header/header';
72
72
  @import 'organisms/footer/footer';
73
73
  @import 'organisms/mega-menu/mega-menu';
74
74
  @import 'organisms/hero/hero';
75
+ @import 'organisms/hero/hero--dynamic-headline';
75
76
  @import 'organisms/sections/sections';
76
77
  @import 'organisms/accordion/accordion';
77
78
  @import 'organisms/domain-search/domain-search';
@@ -0,0 +1,10 @@
1
+ import SmoothScroll from 'smooth-scroll';
2
+
3
+ const anchorScroll = new SmoothScroll('a[href*="#"]', {
4
+ speed: 1500,
5
+ speedAsDuration: true,
6
+ easing: 'easeOutCubic',
7
+ ignore: '[data-scroll-ignore]',
8
+ });
9
+
10
+ module.exports = anchorScroll;
@@ -9,11 +9,11 @@ const objToQuery = (obj, exclude = [], parent = null) => {
9
9
  const queryKey = (parent) ? `${parent}[${key}]` : key;
10
10
 
11
11
  if (Array.isArray(value)) {
12
- value.forEach((subValue) => query.push(`${queryKey}[]=${subValue}`));
12
+ value.forEach((subValue) => query.push(`${queryKey}[]=${encodeURIComponent(subValue)}`));
13
13
  } else if (typeof value === 'object') {
14
14
  query.push(objToQuery(value, exclude, queryKey));
15
15
  } else {
16
- query.push(`${queryKey}=${value}`);
16
+ query.push(`${queryKey}=${encodeURIComponent(value)}`);
17
17
  }
18
18
  });
19
19
 
@@ -0,0 +1,22 @@
1
+ module.exports = {
2
+ // Get top of element relative to window
3
+ offsetTop(el) {
4
+ const rect = el.getBoundingClientRect();
5
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
6
+ return rect.top + scrollTop;
7
+ },
8
+
9
+ // Get bottom of element relative to window
10
+ offsetBottom(el) {
11
+ const rect = el.getBoundingClientRect();
12
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
13
+ return rect.bottom + scrollTop;
14
+ },
15
+
16
+ // Get left of element relative to window
17
+ offsetLeft(el) {
18
+ const rect = el.getBoundingClientRect();
19
+ const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
20
+ return rect.left + scrollLeft;
21
+ },
22
+ };
@@ -0,0 +1,15 @@
1
+ function isInView(el) {
2
+ const box = el.getBoundingClientRect();
3
+ return box.top < window.innerHeight && box.bottom >= 0;
4
+ }
5
+
6
+ const parallaxes = document.querySelectorAll('.js-parallax');
7
+
8
+ window.addEventListener('scroll', () => {
9
+ [].forEach.call(parallaxes, (parallax) => {
10
+ const visible = isInView(parallax);
11
+ if (visible) {
12
+ parallax.classList.add('animate');
13
+ }
14
+ });
15
+ });
@@ -7,10 +7,8 @@ function loadYoutubeAPI() {
7
7
  firstScript.parentNode.insertBefore(tag, firstScript);
8
8
  }
9
9
 
10
- function onPlayerReady(el, e) {
11
- el.addEventListener('click', () => {
12
- e.target.playVideo();
13
- });
10
+ function onPlayerReady(el) {
11
+ el.setAttribute('data-youtube-ready', 'true');
14
12
  }
15
13
 
16
14
  function onPlayerStateChange(el, e) {
@@ -30,16 +28,28 @@ function createCover(el, id) {
30
28
  }
31
29
 
32
30
  function setupYoutubePlayer(el) {
33
- const playerEl = document.createElement('div');
31
+ let playerEl;
34
32
  const id = el.getAttribute('data-youtube');
35
33
 
34
+ if (el.youtube) {
35
+ playerEl = el.querySelector('[data-youtube-container]');
36
+
37
+ playerEl.parentNode.removeChild(playerEl);
38
+ el.youtube.destroy();
39
+ el.youtube = null;
40
+ el.removeAttribute('data-youtube-ready');
41
+ }
42
+
43
+ playerEl = document.createElement('div');
44
+
36
45
  if (!el.getElementsByTagName('img').length) {
37
46
  createCover(el, id);
38
47
  }
39
48
 
49
+ playerEl.setAttribute('data-youtube-container', true);
40
50
  el.appendChild(playerEl);
41
51
 
42
- const player = new YT.Player(playerEl, {
52
+ el.youtube = new YT.Player(playerEl, {
43
53
  height: '100%',
44
54
  width: '100%',
45
55
  videoId: id,
@@ -53,18 +63,33 @@ function setupYoutubePlayer(el) {
53
63
  onStateChange: (e) => onPlayerStateChange(el, e),
54
64
  },
55
65
  });
66
+ }
56
67
 
57
- el.youtube = player;
68
+ function delegateClick(e) {
69
+ const el = e.target.closest('[data-youtube]');
70
+
71
+ if (!el || !el.youtube) {
72
+ return;
73
+ }
74
+
75
+ el.youtube.playVideo();
58
76
  }
59
77
 
60
- window.onYouTubeIframeAPIReady = () => {
61
- const players = document.querySelectorAll('[data-youtube]');
78
+ // eslint-disable-next-line import/prefer-default-export
79
+ export function setupPlayers(container) {
80
+ const players = container.querySelectorAll('[data-youtube]');
62
81
 
63
82
  if (!players.length) {
64
83
  return;
65
84
  }
66
85
 
67
86
  [].forEach.call(players, setupYoutubePlayer);
87
+ }
88
+
89
+ window.onYouTubeIframeAPIReady = () => {
90
+ setupPlayers(document);
91
+
92
+ document.body.addEventListener('click', delegateClick);
68
93
  };
69
94
 
70
95
  loadYoutubeAPI();
@@ -0,0 +1,25 @@
1
+ WEBVTT
2
+
3
+ 00:00:00.000 --> 00:00:39.000
4
+ Kapitel 1 / 8: Introduktion
5
+
6
+ 00:00:39.000 --> 00:01:51.500
7
+ Kapitel 2 / 8: Idén om internet
8
+
9
+ 00:01:51.500 --> 00:02:53.000
10
+ Kapitel 3 / 8: Arpanet blir till
11
+
12
+ 00:02:53.000 --> 00:03:27.000
13
+ Kapitel 4 / 8: TCP/IP uppfinns
14
+
15
+ 00:03:27.000 --> 00:03:56.500
16
+ Kapitel 5 / 8: Sveriges första internetnod
17
+
18
+ 00:03:56.500 --> 00:04:34.000
19
+ Kapitel 6 / 8: Toppdomänen .se registreras
20
+
21
+ 00:04:34.000 --> 00:05:17.000
22
+ Kapitel 7 / 8: World Wide Web
23
+
24
+ 00:05:17.000 --> 00:06:28.000
25
+ Kapitel 8 / 8: Mosaic - den grafiska webbläsaren
@@ -0,0 +1,28 @@
1
+ WEBVTT
2
+
3
+ 00:00:00.000 --> 00:00:25.000
4
+ 6513
5
+
6
+ 00:00:25.000 --> 00:00:39.000
7
+ 5555
8
+
9
+ 00:00:39.000 --> 00:01:51.500
10
+ 1376
11
+
12
+ 00:01:51.500 --> 00:02:23.000
13
+ 666
14
+
15
+ 00:02:23.000 --> 00:03:27.000
16
+ 777
17
+
18
+ 00:03:27.000 --> 00:03:56.500
19
+ 888
20
+
21
+ 00:03:56.500 --> 00:04:34.000
22
+ 242
23
+
24
+ 00:04:34.000 --> 00:05:17.000
25
+ 1337
26
+
27
+ 00:05:17.000 --> 00:06:28.000
28
+ 1177
Binary file
@@ -0,0 +1,25 @@
1
+ WEBVTT
2
+
3
+ 1
4
+ 00:00:00.500 --> 00:00:02.000
5
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit
6
+
7
+ 2
8
+ 00:00:02.100 --> 00:00:03.000
9
+ Phasellus eget lorem dui
10
+
11
+ 3
12
+ 00:00:03.100 --> 00:00:04.500
13
+ Morbi ac nisi ac purus maximus semper a vitae diam fusce sit amet libero non tortor
14
+
15
+ 4
16
+ 00:00:04.600 --> 00:00:05.500
17
+ Ut scelerisque sagittis justo vitae viverra
18
+
19
+ 5
20
+ 00:00:05.600 --> 00:00:06.500
21
+ unc blandit justo sed odio tempus ultrices. Pellentesque sollicitudin justo.
22
+
23
+ 6
24
+ 00:00:06.100 --> 00:00:08.000
25
+ Etiam ut volutpat tortor. Nunc iaculis luctus sapien.
@@ -64,7 +64,6 @@
64
64
 
65
65
  @include e(text) {
66
66
  position: relative;
67
- top: -#{rhythm(0.2)};
68
67
  transform: translateY(0);
69
68
  transition: 0.3s opacity, 0.3s transform;
70
69
  transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
@@ -172,8 +171,8 @@
172
171
 
173
172
  @include e(icon) {
174
173
  position: static;
175
- width: $icon-size-medium;
176
- height: $icon-size-medium;
174
+ width: $icon-size;
175
+ height: $icon-size;
177
176
  transform: none;
178
177
  fill: $color-cyberspace;
179
178
  }
@@ -246,22 +245,20 @@
246
245
  }
247
246
  }
248
247
 
249
- @include m(sandstone) {
250
- color: $color-sandstone;
248
+ @include m(snow) {
249
+ color: transparent;
251
250
 
252
251
  &:hover,
253
252
  &:focus {
254
- color: darken($color-sandstone, 12%);
255
- text-shadow: none;
253
+ color: $color-snow;
256
254
  }
257
255
 
258
256
  @include e(text) {
259
257
  color: $color-snow;
260
- text-shadow: 0 0 rhythm(2) $color-sandstone-dark;
261
258
  }
262
259
 
263
260
  @include e(icon) {
264
- fill: $color-cyberspace;
261
+ fill: $color-snow;
265
262
  }
266
263
  }
267
264
 
Binary file
@@ -1,9 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" id="icon-spinner-white" viewbox="0 0 100 100" class="spinner" width="100" height="100">
2
- <g>
3
- <circle cx="50" cy="50" fill="none" r="43" stroke="none" stroke-width="7"></circle>
4
- <circle cx="50" cy="50" fill="none" r="43" stroke="#fff" stroke-width="7" stroke-linecap="square" transform="rotate(27.6965 50 50)">
5
- <animatetransform attributename="transform" type="rotate" calcmode="linear" values="0 50 50;180 50 50;720 50 50" keytimes="0;0.5;1" dur="2.5s" begin="0s" repeatcount="indefinite"></animatetransform>
6
- <animate attributename="stroke-dasharray" calcmode="linear" values="9.42477796076938 179.0707812546182;188.4955592153876 -2.842170943040401e-14;9.42477796076938 179.0707812546182" keytimes="0;0.5;1" dur="2.5" begin="0s" repeatcount="indefinite"></animate>
7
- </circle>
8
- </g>
9
- </svg>
1
+ <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-ring" style="background: none;"><circle cx="50" cy="50" ng-attr-r="{{config.radius}}" ng-attr-stroke="{{config.base}}" ng-attr-stroke-width="{{config.width}}" fill="none" r="43" stroke="transparent" stroke-width="7"></circle><circle cx="50" cy="50" ng-attr-r="{{config.radius}}" ng-attr-stroke="{{config.stroke}}" ng-attr-stroke-width="{{config.innerWidth}}" ng-attr-stroke-linecap="{{config.linecap}}" fill="none" r="43" stroke="#ffffff" stroke-width="7" stroke-linecap="square" transform="rotate(27.6965 50 50)"><animateTransform attributeName="transform" type="rotate" calcMode="linear" values="0 50 50;180 50 50;720 50 50" keyTimes="0;0.5;1" dur="2.5s" begin="0s" repeatCount="indefinite"></animateTransform><animate attributeName="stroke-dasharray" calcMode="linear" values="9.42477796076938 179.0707812546182;188.4955592153876 -2.842170943040401e-14;9.42477796076938 179.0707812546182" keyTimes="0;0.5;1" dur="2.5" begin="0s" repeatCount="indefinite"></animate></circle></svg>