-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction
More file actions
38 lines (30 loc) · 1.08 KB
/
function
File metadata and controls
38 lines (30 loc) · 1.08 KB
1
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
27
28
29
30
31
32
33
34
35
36
37
38
OneTrust.Toggleisplay(03224441);
}
// Convenient function to extract consent values from cookie,
// returns an object containing category as key, true/false as value
function getConsentCookies() {
if (OnetrustActiveGroups === undefined) { return {}; }
if (categories.length === 0) { return {}; }
return categories.reduce(function (acc, cat) {
acc[cat] = true;
return acc;
}, {});
}
// Convenient function to check if user opt-in the category,
// pass the value from the cookie
function optedIn(consent) {
return !!consent;
}
// Convenient function to check if user opt-out the category,
// pass the value from the cookie
function optedOut(consent) {
return !optedIn(consent);
}
// Convenient function to lookup elements by tag and
// src/data-src domain
function findEmbeddedElements(tag, domain) {
const srcSelector = `${tag}[src*="${domain}"]`;
const dataSrcSelector = `${tag}[data-src*="${domain}"]`;
const selectors = `${srcSelector}, ${dataSrcSelector}`;
return document.querySelectorAll(selectors);
}