@internetstiftelsen/styleguide 5.0.14-beta.0.9 → 5.0.15-beta.0.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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _hasCookieConsent = require('../../assets/js/hasCookieConsent');
|
|
4
|
+
|
|
5
|
+
var _hasCookieConsent2 = _interopRequireDefault(_hasCookieConsent);
|
|
6
|
+
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
+
|
|
9
|
+
var readspeakerMenuItem = document.querySelector('#readspeakerMenuItem');
|
|
10
|
+
var consent = (0, _hasCookieConsent2.default)('C0003');
|
|
11
|
+
|
|
12
|
+
if (!consent) {
|
|
13
|
+
readspeakerMenuItem.addEventListener('click', function (e) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
|
|
16
|
+
console.log('Please approve Functional Cookies to use ReadSpeaker');
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -18,6 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
|
|
19
19
|
// TODO: Should probably implement a way to localize texts in the styleguide
|
|
20
20
|
var consent = (0, _hasCookieConsent2.default)('C0004');
|
|
21
|
+
|
|
21
22
|
var missingConsentMessage = 'För att spela Youtubefilmer krävs att "Riktade kakor" tillåts. Tryck för att "Anpassa kakor"';
|
|
22
23
|
|
|
23
24
|
function loadYoutubeAPI() {
|
|
@@ -71,6 +72,7 @@ function createConsentWarning(el) {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
function destroyConsentWarning(el) {
|
|
75
|
+
loadYoutubeAPI();
|
|
74
76
|
var div = el.querySelector('[data-youtube-consent-warning]');
|
|
75
77
|
|
|
76
78
|
if (div) {
|
|
@@ -146,7 +148,6 @@ function delegateClick(e) {
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
if (!el.youtube) {
|
|
149
|
-
loadYoutubeAPI();
|
|
150
151
|
setupYoutubePlayer(el);
|
|
151
152
|
|
|
152
153
|
return;
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import hasCookieConsent from '../../assets/js/hasCookieConsent';
|
|
2
|
+
|
|
3
|
+
const readspeakerMenuItem = document.querySelector('#readspeakerMenuItem');
|
|
4
|
+
let consent = hasCookieConsent('C0003');
|
|
5
|
+
|
|
6
|
+
if(!consent) {
|
|
7
|
+
readspeakerMenuItem.addEventListener('click', (e) => {
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
|
|
10
|
+
console.log('Please approve Functional Cookies to use ReadSpeaker');
|
|
11
|
+
});
|
|
12
|
+
}
|
package/src/assets/js/youtube.js
CHANGED
|
@@ -3,6 +3,7 @@ import className from './className';
|
|
|
3
3
|
import hasCookieConsent from './hasCookieConsent';
|
|
4
4
|
|
|
5
5
|
let consent = hasCookieConsent('C0004');
|
|
6
|
+
|
|
6
7
|
const missingConsentMessage = 'För att spela Youtubefilmer krävs att "Riktade kakor" tillåts. Tryck för att "Anpassa kakor"';
|
|
7
8
|
|
|
8
9
|
function loadYoutubeAPI() {
|
|
@@ -56,6 +57,7 @@ function createConsentWarning(el) {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
function destroyConsentWarning(el) {
|
|
60
|
+
loadYoutubeAPI();
|
|
59
61
|
const div = el.querySelector('[data-youtube-consent-warning]');
|
|
60
62
|
|
|
61
63
|
if (div) {
|
|
@@ -129,7 +131,6 @@ function delegateClick(e) {
|
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
if (!el.youtube) {
|
|
132
|
-
loadYoutubeAPI();
|
|
133
134
|
setupYoutubePlayer(el);
|
|
134
135
|
|
|
135
136
|
return;
|