@internetstiftelsen/styleguide 5.0.18 → 5.1.0
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.
- package/dist/app.js +71 -0
- package/dist/assets/js/Events.js +43 -77
- package/dist/assets/js/RequestError.js +16 -31
- package/dist/assets/js/anchorScroll.js +22 -15
- package/dist/assets/js/charCounter.js +100 -142
- package/dist/assets/js/className.js +19 -20
- package/dist/assets/js/conditional.js +96 -152
- package/dist/assets/js/debounce.js +15 -22
- package/dist/assets/js/el.js +108 -159
- package/dist/assets/js/getCookieByName.js +13 -11
- package/dist/assets/js/hasCookieConsent.js +30 -40
- package/dist/assets/js/htmlTextLength.js +12 -10
- package/dist/assets/js/iconToggle.js +16 -20
- package/dist/assets/js/nodeAdded.js +40 -53
- package/dist/assets/js/objToQuery.js +25 -41
- package/dist/assets/js/offset.js +29 -25
- package/dist/assets/js/ot.js +10 -13
- package/dist/assets/js/parallax.js +23 -23
- package/dist/assets/js/queryToObj.js +16 -22
- package/dist/assets/js/readSpeakerHandling.js +26 -28
- package/dist/assets/js/request.js +43 -52
- package/dist/assets/js/responsivePosition.js +46 -74
- package/dist/assets/js/stringToNode.js +11 -10
- package/dist/assets/js/template.js +15 -21
- package/dist/assets/js/textToggle.js +19 -24
- package/dist/assets/js/track.js +14 -12
- package/dist/assets/js/uid.js +10 -6
- package/dist/assets/js/utmGenerator.js +27 -33
- package/dist/assets/js/validationMessage.js +18 -25
- package/dist/assets/js/youtube.js +134 -170
- package/dist/atoms/button/Button.js +42 -55
- package/dist/atoms/file/file.js +25 -29
- package/dist/atoms/file/filePreview.js +27 -31
- package/dist/atoms/grid-toggle/grid-toggle.js +6 -9
- package/dist/atoms/height-limiter/height-limiter.js +37 -50
- package/dist/atoms/password-toggle/password-toggle.js +9 -11
- package/dist/atoms/range/range.js +32 -39
- package/dist/atoms/textarea/rich-text.js +223 -205
- package/dist/atoms/tooltip/tooltip.js +13 -17
- package/dist/components.js +42 -77
- package/dist/focusTrap.js +66 -77
- package/dist/molecules/alert/alert.js +15 -20
- package/dist/molecules/context-menu/context-menu.js +11 -16
- package/dist/molecules/continue-video-guide/continue-video-guide.js +90 -101
- package/dist/molecules/cookie-disclaimer/cookie-disclaimer.js +24 -33
- package/dist/molecules/form/Form.js +242 -352
- package/dist/molecules/form/index.js +15 -14
- package/dist/molecules/glider/glider-course.js +62 -75
- package/dist/molecules/glider/glider-hero.js +88 -101
- package/dist/molecules/glider/glider.js +49 -45
- package/dist/molecules/modal/modal.js +256 -325
- package/dist/molecules/multi-select/multi-select.js +198 -304
- package/dist/molecules/natural-language-form/natural-language-form.js +32 -46
- package/dist/molecules/overview-navigation/overview-navigation.js +90 -141
- package/dist/molecules/share/share.js +15 -20
- package/dist/molecules/system-error/system-error.js +6 -9
- package/dist/organisms/accordion/accordion.js +44 -50
- package/dist/organisms/footer/footer.js +1 -1
- package/dist/organisms/haveibeenpwned/haveibeenpwned.js +17 -16
- package/dist/organisms/mailchimp/mailchimp.js +72 -89
- package/dist/organisms/map-box/map-box.js +3 -4
- package/dist/organisms/mega-menu/mega-menu.js +177 -212
- package/dist/organisms/podcast/podcast.js +192 -215
- package/dist/organisms/schedule/schedule-filter.js +9 -15
- package/dist/organisms/tabs/tabs.js +194 -253
- package/dist/organisms/timeline/openTimelineItem.js +38 -51
- package/dist/organisms/timeline/timeline.js +111 -128
- package/dist/organisms/video-guide/VideoGuidePlayback.js +210 -286
- package/dist/organisms/video-guide/VideoGuideSubtitles.js +57 -80
- package/dist/organisms/video-guide/VideoGuideTimeline.js +74 -108
- package/dist/organisms/video-guide/getCurrentCueIndex.js +11 -9
- package/dist/organisms/video-guide/video-guide.js +66 -103
- package/dist/utilities/tab-highlighting/tab-highlighting.js +14 -22
- package/dist/vendor/toggle/a11y.toggle-switcher.js +10 -16
- package/package.json +78 -99
- package/src/app.js +5 -5
- package/src/assets/js/anchorScroll.js +1 -1
- package/src/assets/js/offset.js +1 -1
- package/src/atoms/button/Button.js +1 -1
- package/src/atoms/icon/richtext-ordered-list.svg +1 -1
- package/src/atoms/icon/sprite.svg +6 -5
- package/src/molecules/glider/glider-course.js +0 -2
- package/src/molecules/glider/glider.js +2 -2
- package/src/organisms/accordion/accordion.js +1 -2
- package/src/organisms/timeline/timeline.js +2 -3
- package/dist/atoms/timeline/anchorScroll.js +0 -13
- package/dist/atoms/toggle-high-contrast/toggle-high-contrast.js +0 -12
- package/dist/molecules/glider/glider-single.js +0 -68
- package/dist/molecules/modal/modal-graph.js +0 -40
- package/dist/molecules/timeline-navigation/timeline-navigation.js +0 -34
- /package/src/atoms/icon/{heading-3.svg → richtext-heading-3.svg} +0 -0
- /package/src/molecules/alert/{_alert.scss → alert.scss} +0 -0
|
@@ -1,42 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return group.trim().split(':');
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
if (!(category in groups)) {
|
|
38
|
-
return defaultIfNoCookie;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return groups[category] === '1';
|
|
42
|
-
}
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return hasCookieConsent;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _getCookieByName = /*#__PURE__*/ _interop_require_default(require("./getCookieByName"));
|
|
12
|
+
const _queryToObj = /*#__PURE__*/ _interop_require_default(require("./queryToObj"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function hasCookieConsent(category, defaultIfNoCookie = true) {
|
|
19
|
+
const cookie = (0, _getCookieByName.default)('OptanonConsent');
|
|
20
|
+
if (!cookie) {
|
|
21
|
+
return defaultIfNoCookie;
|
|
22
|
+
}
|
|
23
|
+
const cookieObj = (0, _queryToObj.default)(cookie);
|
|
24
|
+
if (!('groups' in cookieObj)) {
|
|
25
|
+
return defaultIfNoCookie;
|
|
26
|
+
}
|
|
27
|
+
const groups = Object.fromEntries(cookieObj.groups.split(',').map((group)=>group.trim().split(':')));
|
|
28
|
+
if (!(category in groups)) {
|
|
29
|
+
return defaultIfNoCookie;
|
|
30
|
+
}
|
|
31
|
+
return groups[category] === '1';
|
|
32
|
+
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return htmlTextLength;
|
|
9
|
+
}
|
|
5
10
|
});
|
|
6
|
-
exports.default = htmlTextLength;
|
|
7
11
|
function htmlTextLength(html) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return div.textContent.length;
|
|
13
|
-
}
|
|
12
|
+
const div = document.createElement('div');
|
|
13
|
+
div.innerHTML = html;
|
|
14
|
+
return div.textContent.length;
|
|
15
|
+
}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// Usage: data-toggle-icon-target="targetSvg" data-toggle-icon="copy|check"
|
|
2
|
+
"use strict";
|
|
4
3
|
function toggleIconOnClick(el) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
useElement.setAttribute('xlink:href', '#icon-' + options[nextIteration]);
|
|
4
|
+
const target = el.dataset.toggleIconTarget ? document.getElementById(el.dataset.toggleIconTarget) : el;
|
|
5
|
+
const i = parseInt(el.dataset.iconIteration || 0, 10);
|
|
6
|
+
const options = el.dataset.toggleIcon.split('|');
|
|
7
|
+
const nextIteration = i + 1 === options.length ? 0 : i + 1;
|
|
8
|
+
el.dataset.iconIteration = nextIteration;
|
|
9
|
+
const useElement = target.querySelector('use');
|
|
10
|
+
useElement.setAttribute('xlink:href', `#icon-${options[nextIteration]}`);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
});
|
|
12
|
+
document.addEventListener('click', (e)=>{
|
|
13
|
+
let target = e.target.closest('[data-toggle-icon]');
|
|
14
|
+
if (target) {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
toggleIconOnClick(target);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return nodeAdded;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const callbacks = {};
|
|
12
12
|
function dispatch(node, cbs) {
|
|
13
|
-
|
|
14
|
-
return cb(node);
|
|
15
|
-
});
|
|
13
|
+
cbs.forEach((cb)=>cb(node));
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
15
|
+
const observer = new MutationObserver((mutations)=>{
|
|
16
|
+
mutations.forEach((mutation)=>{
|
|
17
|
+
mutation.addedNodes.forEach((node)=>{
|
|
18
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
19
|
+
Object.entries(callbacks).forEach(([selector, selectorCallbacks])=>{
|
|
20
|
+
if (node.matches(selector)) {
|
|
21
|
+
dispatch(node, selectorCallbacks);
|
|
22
|
+
} else if (node.id === 'siteMain') {
|
|
23
|
+
const child = node.querySelector(selector);
|
|
24
|
+
if (child) {
|
|
25
|
+
dispatch(child, selectorCallbacks);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
40
32
|
});
|
|
41
|
-
|
|
42
33
|
observer.observe(document.body, {
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
childList: true,
|
|
35
|
+
subtree: true
|
|
45
36
|
});
|
|
46
|
-
|
|
47
37
|
function nodeAdded(selector, callback) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
38
|
+
if (!(selector in callbacks)) {
|
|
39
|
+
callbacks[selector] = [];
|
|
40
|
+
}
|
|
41
|
+
callbacks[selector].push(callback);
|
|
42
|
+
return function unsubscribe() {
|
|
43
|
+
const index = callbacks[selector].indexOf(callback);
|
|
44
|
+
if (index > -1) {
|
|
45
|
+
callbacks[selector].splice(index, 1);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (Array.isArray(value)) {
|
|
29
|
-
value.forEach(function (subValue) {
|
|
30
|
-
return query.push(queryKey + '[]=' + encodeURIComponent(subValue));
|
|
31
|
-
});
|
|
32
|
-
} else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
|
|
33
|
-
query.push(objToQuery(value, exclude, queryKey));
|
|
34
|
-
} else {
|
|
35
|
-
query.push(queryKey + '=' + encodeURIComponent(value));
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return query.join('&');
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const objToQuery = (obj, exclude = [], parent = null)=>{
|
|
12
|
+
const query = [];
|
|
13
|
+
Object.entries(obj).forEach(([key, value])=>{
|
|
14
|
+
if (exclude.indexOf(key) > -1) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const queryKey = parent ? `${parent}[${key}]` : key;
|
|
18
|
+
if (Array.isArray(value)) {
|
|
19
|
+
value.forEach((subValue)=>query.push(`${queryKey}[]=${encodeURIComponent(subValue)}`));
|
|
20
|
+
} else if (typeof value === 'object') {
|
|
21
|
+
query.push(objToQuery(value, exclude, queryKey));
|
|
22
|
+
} else {
|
|
23
|
+
query.push(`${queryKey}=${encodeURIComponent(value)}`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return query.join('&');
|
|
40
27
|
};
|
|
41
|
-
|
|
42
|
-
exports.default = function (obj, exclude) {
|
|
43
|
-
return objToQuery(obj, exclude);
|
|
44
|
-
};
|
|
28
|
+
const _default = (obj, exclude)=>objToQuery(obj, exclude);
|
package/dist/assets/js/offset.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _default = {
|
|
12
|
+
// Get top of element relative to window
|
|
13
|
+
offsetTop (el) {
|
|
14
|
+
const rect = el.getBoundingClientRect();
|
|
15
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
16
|
+
return rect.top + scrollTop;
|
|
17
|
+
},
|
|
18
|
+
// Get bottom of element relative to window
|
|
19
|
+
offsetBottom (el) {
|
|
20
|
+
const rect = el.getBoundingClientRect();
|
|
21
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
22
|
+
return rect.bottom + scrollTop;
|
|
23
|
+
},
|
|
24
|
+
// Get left of element relative to window
|
|
25
|
+
offsetLeft (el) {
|
|
26
|
+
const rect = el.getBoundingClientRect();
|
|
27
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
28
|
+
return rect.left + scrollLeft;
|
|
29
|
+
}
|
|
30
|
+
};
|
package/dist/assets/js/ot.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
document.addEventListener('click', (e)=>{
|
|
3
|
+
const el = e.target.closest('[data-ot-dynamic-show-settings]');
|
|
4
|
+
if (el) {
|
|
5
|
+
const otButton = document.getElementById('ot-sdk-btn');
|
|
6
|
+
if (otButton) {
|
|
7
|
+
otButton.click();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "cache", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return cache;
|
|
9
|
+
}
|
|
5
10
|
});
|
|
6
|
-
exports.cache = cache;
|
|
7
11
|
function isInView(el) {
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
const box = el.getBoundingClientRect();
|
|
13
|
+
return box.top < window.innerHeight && box.bottom >= 0;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
var parallaxes = [];
|
|
15
|
+
let parallaxes = [];
|
|
13
16
|
function cache() {
|
|
14
|
-
|
|
17
|
+
parallaxes = document.querySelectorAll('.js-parallax');
|
|
15
18
|
}
|
|
16
|
-
|
|
17
19
|
cache();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
});
|
|
20
|
+
window.addEventListener('scroll', ()=>{
|
|
21
|
+
[].forEach.call(parallaxes, (parallax)=>{
|
|
22
|
+
if (parallax.classList.contains('animate')) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const visible = isInView(parallax);
|
|
26
|
+
if (visible) {
|
|
27
|
+
parallax.classList.add('animate');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** Parse query string to object */ "use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return queryToObj;
|
|
9
|
+
}
|
|
5
10
|
});
|
|
6
|
-
|
|
7
|
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
8
|
-
|
|
9
|
-
exports.default = queryToObj;
|
|
10
|
-
/** Parse query string to object */
|
|
11
11
|
function queryToObj(query) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
obj[decodeURIComponent(key)] = decodeURIComponent(value || '');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return obj;
|
|
25
|
-
}
|
|
12
|
+
const obj = {};
|
|
13
|
+
const pairs = query.split('&');
|
|
14
|
+
pairs.forEach((pair)=>{
|
|
15
|
+
const [key, value] = pair.split('=');
|
|
16
|
+
obj[decodeURIComponent(key)] = decodeURIComponent(value || '');
|
|
17
|
+
});
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _hasCookieConsent = /*#__PURE__*/ _interop_require_default(require("../../assets/js/hasCookieConsent"));
|
|
6
|
+
function _interop_require_default(obj) {
|
|
7
|
+
return obj && obj.__esModule ? obj : {
|
|
8
|
+
default: obj
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const readspeakerMenuItem = document.querySelector('#readspeakerMenuItem div');
|
|
12
|
+
const readspeakerBtn = document.querySelector('#readspeakerBtn');
|
|
13
|
+
let consent = (0, _hasCookieConsent.default)('C0003');
|
|
13
14
|
function readSpeakerConsent() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (readspeakerBtn && !consent) {
|
|
16
|
+
readspeakerMenuItem.removeAttribute('id');
|
|
17
|
+
readspeakerMenuItem.removeAttribute('class');
|
|
18
|
+
readspeakerBtn.removeAttribute('role');
|
|
19
|
+
readspeakerBtn.removeAttribute('href');
|
|
20
|
+
readspeakerBtn.setAttribute('href', '/om-webbplatsen/lyssna-pa-webbplatsen/');
|
|
21
|
+
}
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readSpeakerConsent();
|
|
28
|
-
}
|
|
23
|
+
window.addEventListener('consent.onetrust', (e)=>{
|
|
24
|
+
consent = e.detail.includes('C0003');
|
|
25
|
+
if (!consent) {
|
|
26
|
+
readSpeakerConsent();
|
|
27
|
+
}
|
|
29
28
|
});
|
|
30
|
-
|
|
31
|
-
readSpeakerConsent();
|
|
29
|
+
readSpeakerConsent();
|
|
@@ -1,54 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (r.status > 299) {
|
|
48
|
-
throw new _RequestError2.default(r.statusText, json, r.status);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return json;
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return request;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _objToQuery = /*#__PURE__*/ _interop_require_default(require("./objToQuery"));
|
|
12
|
+
const _RequestError = /*#__PURE__*/ _interop_require_default(require("./RequestError"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function request(endpoint, data = null, method = 'POST') {
|
|
19
|
+
let url = endpoint;
|
|
20
|
+
const query = data ? (0, _objToQuery.default)(data) : null;
|
|
21
|
+
const headers = {
|
|
22
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
23
|
+
};
|
|
24
|
+
if ('wpApiSettings' in window) {
|
|
25
|
+
headers['X-WP-Nonce'] = window.wpApiSettings.nonce;
|
|
26
|
+
}
|
|
27
|
+
if (method === 'GET' && query) {
|
|
28
|
+
if (url.indexOf('?') > -1) {
|
|
29
|
+
url += query;
|
|
30
|
+
} else {
|
|
31
|
+
url += `?${query}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return fetch(url, {
|
|
35
|
+
method,
|
|
36
|
+
credentials: 'same-origin',
|
|
37
|
+
body: method !== 'GET' ? query : null,
|
|
38
|
+
headers
|
|
39
|
+
}).then((r)=>r.json().then((json)=>{
|
|
40
|
+
if (r.status > 299) {
|
|
41
|
+
throw new _RequestError.default(r.statusText, json, r.status);
|
|
42
|
+
}
|
|
43
|
+
return json;
|
|
44
|
+
}));
|
|
45
|
+
}
|