@internetstiftelsen/styleguide 5.0.13 → 5.0.14-beta.0.10

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.
@@ -151,6 +151,7 @@ function delegateClick(e) {
151
151
  return;
152
152
  }
153
153
 
154
+ loadYoutubeAPI();
154
155
  el.youtube.playVideo();
155
156
  }
156
157
 
@@ -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
  });
@@ -4,8 +4,14 @@ var _debounce = require('../../assets/js/debounce');
4
4
 
5
5
  var _debounce2 = _interopRequireDefault(_debounce);
6
6
 
7
+ var _hasCookieConsent = require('../../assets/js/hasCookieConsent');
8
+
9
+ var _hasCookieConsent2 = _interopRequireDefault(_hasCookieConsent);
10
+
7
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
12
 
13
+ var consent = (0, _hasCookieConsent2.default)('C0003');
14
+
9
15
  var slidingForm = document.querySelector('[class*="--sliding"]');
10
16
  var staticForm = document.querySelector('[class*="--static"]');
11
17
  var closeButton = document.querySelector('[class*="--sliding"] .js-close-mailchimp-popup');
@@ -82,7 +88,7 @@ function slideForm() {
82
88
  }
83
89
 
84
90
  var elementIsInViewport = (0, _debounce2.default)(function () {
85
- if (slidingForm) {
91
+ if (consent && slidingForm) {
86
92
  slideForm();
87
93
  }
88
94
  }, throttle);
@@ -90,6 +96,7 @@ var elementIsInViewport = (0, _debounce2.default)(function () {
90
96
  window.addEventListener('scroll', function () {
91
97
  elementIsInViewport();
92
98
  });
99
+
93
100
  function closeForm() {
94
101
  setCookie(cookieName, 'YES', 7);
95
102
  slidingForm.classList.remove(visibleClass);
@@ -249,4 +249,4 @@ if (closeMegaMenuBtn) {
249
249
  document.querySelector('#readspeakerBtn [class*=a-button--icon]').classList.add('u-hide-md');
250
250
  });
251
251
  });
252
- }
252
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "5.0.13",
3
+ "version": "5.0.14-beta.0.10",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -134,6 +134,7 @@ function delegateClick(e) {
134
134
  return;
135
135
  }
136
136
 
137
+ loadYoutubeAPI();
137
138
  el.youtube.playVideo();
138
139
  }
139
140
 
@@ -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,4 +1,7 @@
1
1
  import debounce from '../../assets/js/debounce';
2
+ import hasCookieConsent from '../../assets/js/hasCookieConsent';
3
+
4
+ let consent = hasCookieConsent('C0003');
2
5
 
3
6
  const slidingForm = document.querySelector('[class*="--sliding"]');
4
7
  const staticForm = document.querySelector('[class*="--static"]');
@@ -79,7 +82,7 @@ function slideForm() {
79
82
  }
80
83
 
81
84
  const elementIsInViewport = debounce(() => {
82
- if (slidingForm) {
85
+ if (consent && slidingForm) {
83
86
  slideForm();
84
87
  }
85
88
  }, throttle);
@@ -87,6 +90,8 @@ const elementIsInViewport = debounce(() => {
87
90
  window.addEventListener('scroll', () => {
88
91
  elementIsInViewport();
89
92
  });
93
+
94
+
90
95
  function closeForm() {
91
96
  setCookie(cookieName, 'YES', 7);
92
97
  slidingForm.classList.remove(visibleClass);