@internetstiftelsen/styleguide 5.0.13 → 5.0.14-beta.0.2

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)) {
26
+ if (document.getElementById(id && _hasCookieConsent2.default)) {
27
27
  return;
28
28
  }
29
29
 
@@ -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);
@@ -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.2",
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)) {
11
+ if (document.getElementById(id && hasCookieConsent)) {
12
12
  return;
13
13
  }
14
14
 
@@ -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);