@internetstiftelsen/styleguide 5.0.14-beta.0.4 → 5.0.14-beta.0.6

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.
@@ -23,7 +23,7 @@ var missingConsentMessage = 'För att spela Youtubefilmer krävs att "Riktade ka
23
23
  function loadYoutubeAPI() {
24
24
  var id = 'iisYoutubeAPI';
25
25
 
26
- if (document.getElementById(id && !consent)) {
26
+ if (document.getElementById(id)) {
27
27
  return;
28
28
  }
29
29
 
@@ -174,6 +174,7 @@ function setupPlayers(container) {
174
174
  return;
175
175
  }
176
176
 
177
+ loadYoutubeAPI();
177
178
  [].forEach.call(players, createCover);
178
179
  }
179
180
 
@@ -182,11 +183,9 @@ window.onYouTubeIframeAPIReady = function () {
182
183
  };
183
184
 
184
185
  setupPlayers(document);
185
- loadYoutubeAPI();
186
186
 
187
187
  window.addEventListener('consent.onetrust', function (e) {
188
188
  consent = e.detail.includes('C0004');
189
189
 
190
190
  setupPlayers(document);
191
- loadYoutubeAPI();
192
191
  });
@@ -8,6 +8,8 @@ var _hasCookieConsent = require('../../assets/js/hasCookieConsent');
8
8
 
9
9
  var _hasCookieConsent2 = _interopRequireDefault(_hasCookieConsent);
10
10
 
11
+ var _youtube = require('../../assets/js/youtube');
12
+
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
 
13
15
  var consent = (0, _hasCookieConsent2.default)('C0003');
@@ -96,6 +98,7 @@ var elementIsInViewport = (0, _debounce2.default)(function () {
96
98
  window.addEventListener('scroll', function () {
97
99
  elementIsInViewport();
98
100
  });
101
+
99
102
  function closeForm() {
100
103
  setCookie(cookieName, 'YES', 7);
101
104
  slidingForm.classList.remove(visibleClass);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "5.0.14-beta.0.4",
3
+ "version": "5.0.14-beta.0.6",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -8,7 +8,7 @@ const missingConsentMessage = 'För att spela Youtubefilmer krävs att "Riktade
8
8
  function loadYoutubeAPI() {
9
9
  const id = 'iisYoutubeAPI';
10
10
 
11
- if (document.getElementById(id && !consent)) {
11
+ if (document.getElementById(id)) {
12
12
  return;
13
13
  }
14
14
 
@@ -157,6 +157,7 @@ export function setupPlayers(container) {
157
157
  return;
158
158
  }
159
159
 
160
+ loadYoutubeAPI();
160
161
  [].forEach.call(players, createCover);
161
162
  }
162
163
 
@@ -165,11 +166,9 @@ window.onYouTubeIframeAPIReady = () => {
165
166
  };
166
167
 
167
168
  setupPlayers(document);
168
- loadYoutubeAPI();
169
169
 
170
170
  window.addEventListener('consent.onetrust', (e) => {
171
171
  consent = e.detail.includes('C0004');
172
172
 
173
173
  setupPlayers(document);
174
- loadYoutubeAPI();
175
174
  });
@@ -1,5 +1,6 @@
1
1
  import debounce from '../../assets/js/debounce';
2
2
  import hasCookieConsent from '../../assets/js/hasCookieConsent';
3
+ import { setupPlayers } from '../../assets/js/youtube';
3
4
 
4
5
  let consent = hasCookieConsent('C0003');
5
6
 
@@ -90,6 +91,8 @@ const elementIsInViewport = debounce(() => {
90
91
  window.addEventListener('scroll', () => {
91
92
  elementIsInViewport();
92
93
  });
94
+
95
+
93
96
  function closeForm() {
94
97
  setCookie(cookieName, 'YES', 7);
95
98
  slidingForm.classList.remove(visibleClass);