@duckduckgo/autoconsent 5.3.0 → 6.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/.eslintrc +1 -1
- package/CHANGELOG.md +47 -0
- package/data/coverage.json +958 -1010
- package/dist/addon-firefox/background.bundle.js +13 -12
- package/dist/addon-firefox/content.bundle.js +1086 -942
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rules.json +112 -83
- package/dist/addon-mv3/background.bundle.js +13 -12
- package/dist/addon-mv3/content.bundle.js +1086 -942
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/popup.bundle.js +38 -0
- package/dist/addon-mv3/popup.html +2 -1
- package/dist/addon-mv3/rules.json +112 -83
- package/dist/autoconsent.cjs.js +1579 -1442
- package/dist/autoconsent.esm.js +1566 -1424
- package/dist/autoconsent.playwright.js +1 -1
- package/lib/cmps/airbnb.ts +1 -3
- package/lib/cmps/all.ts +13 -22
- package/lib/cmps/base.ts +123 -92
- package/lib/cmps/consentmanager.ts +7 -10
- package/lib/cmps/conversant.ts +1 -4
- package/lib/cmps/cookiebot.ts +6 -10
- package/lib/cmps/evidon.ts +1 -3
- package/lib/cmps/klaro.ts +3 -7
- package/lib/cmps/onetrust.ts +3 -7
- package/lib/cmps/sourcepoint-frame.ts +1 -4
- package/lib/cmps/tiktok.ts +1 -3
- package/lib/cmps/trustarc-frame.ts +4 -6
- package/lib/cmps/trustarc-top.ts +6 -5
- package/lib/cmps/uniconsent.ts +1 -3
- package/lib/eval-snippets.ts +105 -0
- package/lib/rule-executors.ts +0 -8
- package/lib/rules.ts +3 -1
- package/lib/types.ts +1 -1
- package/lib/web.ts +26 -13
- package/package.json +4 -4
- package/readme.md +3 -3
- package/rules/autoconsent/192.json +1 -1
- package/rules/autoconsent/activobank-pt.json +19 -0
- package/rules/autoconsent/adroll.json +1 -1
- package/rules/autoconsent/affinity-serif-com.json +1 -1
- package/rules/autoconsent/axeptio.json +1 -1
- package/rules/autoconsent/bing.json +1 -1
- package/rules/autoconsent/borlabs.json +1 -1
- package/rules/autoconsent/bundesregierung-de.json +1 -1
- package/rules/autoconsent/canva.json +1 -1
- package/rules/autoconsent/clickio.json +1 -1
- package/rules/autoconsent/clinch.json +1 -1
- package/rules/autoconsent/coinbase.json +1 -1
- package/rules/autoconsent/complianz-banner.json +1 -1
- package/rules/autoconsent/complianz-categories.json +1 -1
- package/rules/autoconsent/complianz-optin.json +1 -1
- package/rules/autoconsent/cookie-law-info.json +2 -2
- package/rules/autoconsent/cookie-manager-popup.json +1 -1
- package/rules/autoconsent/cookiealert.json +3 -3
- package/rules/autoconsent/cookiefirst.json +7 -8
- package/rules/autoconsent/cookieinformation.json +3 -3
- package/rules/autoconsent/dailymotion.json +1 -1
- package/rules/autoconsent/dsgvo.json +1 -1
- package/rules/autoconsent/dunelm.json +1 -1
- package/rules/autoconsent/etsy.json +2 -2
- package/rules/autoconsent/eu-cookie-compliance.json +1 -1
- package/rules/autoconsent/eu-cookie-law.json +1 -1
- package/rules/autoconsent/ezoic.json +2 -2
- package/rules/autoconsent/google.json +1 -1
- package/rules/autoconsent/iubenda.json +2 -2
- package/rules/autoconsent/jquery-cookiebar.json +1 -1
- package/rules/autoconsent/mediavine.json +1 -1
- package/rules/autoconsent/microsoft.json +3 -3
- package/rules/autoconsent/moove.json +1 -1
- package/rules/autoconsent/paypal.json +1 -1
- package/rules/autoconsent/primebox.json +1 -1
- package/rules/autoconsent/pubtech.json +1 -1
- package/rules/autoconsent/reddit.json +1 -1
- package/rules/autoconsent/sibbo.json +1 -1
- package/rules/autoconsent/sirdata.json +1 -1
- package/rules/autoconsent/snigel.json +1 -1
- package/rules/autoconsent/steampowered.json +1 -1
- package/rules/autoconsent/tarteaucitron.json +3 -3
- package/rules/autoconsent/tealium.json +4 -4
- package/rules/autoconsent/testcmp-cosmetic.json +1 -1
- package/rules/autoconsent/testcmp.json +1 -1
- package/rules/autoconsent/thefreedictionary.json +2 -2
- package/rules/autoconsent/theverge.json +1 -1
- package/rules/autoconsent/twitter.json +1 -1
- package/rules/autoconsent/ubuntu.com.json +1 -1
- package/rules/autoconsent/uk-cookie-consent.json +1 -1
- package/rules/autoconsent/usercentrics-api.json +7 -7
- package/rules/autoconsent/usercentrics-button.json +1 -1
- package/rules/autoconsent/waitrose.json +2 -2
- package/rules/autoconsent/wp-cookie-notice.json +1 -1
- package/rules/autoconsent/xing.json +1 -1
- package/rules/autoconsent/youtube-desktop.json +1 -1
- package/rules/autoconsent/youtube-mobile.json +1 -1
- package/rules/rules.json +112 -83
- package/tests/activobank-pt.spec.ts +6 -0
- package/lib/index.ts +0 -4
package/dist/autoconsent.cjs.js
CHANGED
|
@@ -19,1088 +19,1105 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// lib/web.ts
|
|
20
20
|
var web_exports = {};
|
|
21
21
|
__export(web_exports, {
|
|
22
|
-
|
|
23
|
-
default: () => AutoConsent,
|
|
24
|
-
rules: () => rules2
|
|
22
|
+
default: () => AutoConsent
|
|
25
23
|
});
|
|
26
24
|
module.exports = __toCommonJS(web_exports);
|
|
27
25
|
|
|
28
|
-
// lib/
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
function getRandomID() {
|
|
33
|
-
if (crypto && typeof crypto.randomUUID !== "undefined") {
|
|
34
|
-
return crypto.randomUUID();
|
|
35
|
-
}
|
|
36
|
-
return Math.random().toString();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// lib/eval-handler.ts
|
|
40
|
-
var Deferred = class {
|
|
41
|
-
constructor(id, timeout = 1e3) {
|
|
42
|
-
this.id = id;
|
|
43
|
-
this.promise = new Promise((resolve, reject) => {
|
|
44
|
-
this.resolve = resolve;
|
|
45
|
-
this.reject = reject;
|
|
46
|
-
});
|
|
47
|
-
this.timer = window.setTimeout(() => {
|
|
48
|
-
this.reject(new Error("timeout"));
|
|
49
|
-
}, timeout);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var evalState = {
|
|
53
|
-
pending: /* @__PURE__ */ new Map(),
|
|
54
|
-
sendContentMessage: null
|
|
55
|
-
};
|
|
56
|
-
function requestEval(code) {
|
|
57
|
-
const id = getRandomID();
|
|
58
|
-
evalState.sendContentMessage({
|
|
59
|
-
type: "eval",
|
|
60
|
-
id,
|
|
61
|
-
code
|
|
62
|
-
});
|
|
63
|
-
const deferred = new Deferred(id);
|
|
64
|
-
evalState.pending.set(deferred.id, deferred);
|
|
65
|
-
return deferred.promise;
|
|
66
|
-
}
|
|
67
|
-
function resolveEval(id, value) {
|
|
68
|
-
const deferred = evalState.pending.get(id);
|
|
69
|
-
if (deferred) {
|
|
70
|
-
evalState.pending.delete(id);
|
|
71
|
-
deferred.timer && window.clearTimeout(deferred.timer);
|
|
72
|
-
deferred.resolve(value);
|
|
73
|
-
} else {
|
|
74
|
-
console.warn("no eval #", id);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// lib/utils.ts
|
|
79
|
-
function getStyleElement(styleOverrideElementId = "autoconsent-css-rules") {
|
|
80
|
-
const styleSelector = `style#${styleOverrideElementId}`;
|
|
81
|
-
const existingElement = document.querySelector(styleSelector);
|
|
82
|
-
if (existingElement && existingElement instanceof HTMLStyleElement) {
|
|
83
|
-
return existingElement;
|
|
84
|
-
} else {
|
|
85
|
-
const parent = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
|
86
|
-
const css = document.createElement("style");
|
|
87
|
-
css.id = styleOverrideElementId;
|
|
88
|
-
parent.appendChild(css);
|
|
89
|
-
return css;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function hideElements(styleEl, selectors, method = "display") {
|
|
93
|
-
const hidingSnippet = method === "opacity" ? `opacity: 0` : `display: none`;
|
|
94
|
-
const rule = `${selectors.join(
|
|
95
|
-
","
|
|
96
|
-
)} { ${hidingSnippet} !important; z-index: -1 !important; pointer-events: none !important; } `;
|
|
97
|
-
if (styleEl instanceof HTMLStyleElement) {
|
|
98
|
-
styleEl.innerText += rule;
|
|
99
|
-
return selectors.length > 0;
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
async function waitFor(predicate, maxTimes, interval) {
|
|
104
|
-
const result = await predicate();
|
|
105
|
-
if (!result && maxTimes > 0) {
|
|
106
|
-
return new Promise((resolve) => {
|
|
107
|
-
setTimeout(async () => {
|
|
108
|
-
resolve(waitFor(predicate, maxTimes - 1, interval));
|
|
109
|
-
}, interval);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return Promise.resolve(result);
|
|
113
|
-
}
|
|
114
|
-
function isElementVisible(elem) {
|
|
115
|
-
if (!elem) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
if (elem.offsetParent !== null) {
|
|
119
|
-
return true;
|
|
120
|
-
} else {
|
|
121
|
-
const css = window.getComputedStyle(elem);
|
|
122
|
-
if (css.position === "fixed" && css.display !== "none") {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
26
|
+
// lib/consentomatic/tools.ts
|
|
27
|
+
var _Tools = class _Tools {
|
|
28
|
+
static setBase(base) {
|
|
29
|
+
_Tools.base = base;
|
|
125
30
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
function doEval(expr) {
|
|
131
|
-
return requestEval(expr).catch((e) => {
|
|
132
|
-
enableLogs && console.error("error evaluating rule", expr, e);
|
|
133
|
-
return false;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function click(selector, all = false) {
|
|
137
|
-
const elem = elementSelector(selector);
|
|
138
|
-
enableLogs && console.log("[click]", selector, all, elem);
|
|
139
|
-
if (elem.length > 0) {
|
|
140
|
-
if (all) {
|
|
141
|
-
elem.forEach((e) => e.click());
|
|
31
|
+
static findElement(options, parent = null, multiple = false) {
|
|
32
|
+
let possibleTargets = null;
|
|
33
|
+
if (parent != null) {
|
|
34
|
+
possibleTargets = Array.from(parent.querySelectorAll(options.selector));
|
|
142
35
|
} else {
|
|
143
|
-
|
|
36
|
+
if (_Tools.base != null) {
|
|
37
|
+
possibleTargets = Array.from(
|
|
38
|
+
_Tools.base.querySelectorAll(options.selector)
|
|
39
|
+
);
|
|
40
|
+
} else {
|
|
41
|
+
possibleTargets = Array.from(
|
|
42
|
+
document.querySelectorAll(options.selector)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
144
45
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return false;
|
|
162
|
-
} else if (check === "any") {
|
|
163
|
-
return results.some((r) => r);
|
|
164
|
-
}
|
|
165
|
-
return results.every((r) => r);
|
|
166
|
-
}
|
|
167
|
-
function waitForElement(selector, timeout = 1e4) {
|
|
168
|
-
const interval = 200;
|
|
169
|
-
const times = Math.ceil(timeout / interval);
|
|
170
|
-
return waitFor(
|
|
171
|
-
() => elementSelector(selector).length > 0,
|
|
172
|
-
times,
|
|
173
|
-
interval
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
function waitForVisible(selector, timeout = 1e4, check = "any") {
|
|
177
|
-
const interval = 200;
|
|
178
|
-
const times = Math.ceil(timeout / interval);
|
|
179
|
-
return waitFor(
|
|
180
|
-
() => elementVisible(selector, check),
|
|
181
|
-
times,
|
|
182
|
-
interval
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
async function waitForThenClick(selector, timeout = 1e4, all = false) {
|
|
186
|
-
await waitForElement(selector, timeout);
|
|
187
|
-
return click(selector, all);
|
|
188
|
-
}
|
|
189
|
-
function wait(ms) {
|
|
190
|
-
return new Promise((resolve) => {
|
|
191
|
-
setTimeout(() => {
|
|
192
|
-
resolve(true);
|
|
193
|
-
}, ms);
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
function hide(selectors, method) {
|
|
197
|
-
const styleEl = getStyleElement();
|
|
198
|
-
return hideElements(styleEl, selectors, method);
|
|
199
|
-
}
|
|
200
|
-
function prehide(selectors) {
|
|
201
|
-
const styleEl = getStyleElement("autoconsent-prehide");
|
|
202
|
-
enableLogs && console.log("[prehide]", styleEl, location.href);
|
|
203
|
-
return hideElements(styleEl, selectors, "opacity");
|
|
204
|
-
}
|
|
205
|
-
function undoPrehide() {
|
|
206
|
-
const existingElement = getStyleElement("autoconsent-prehide");
|
|
207
|
-
enableLogs && console.log("[undoprehide]", existingElement, location.href);
|
|
208
|
-
if (existingElement) {
|
|
209
|
-
existingElement.remove();
|
|
210
|
-
}
|
|
211
|
-
return !!existingElement;
|
|
212
|
-
}
|
|
213
|
-
function querySingleReplySelector(selector, parent = document) {
|
|
214
|
-
if (selector.startsWith("aria/")) {
|
|
215
|
-
return [];
|
|
216
|
-
}
|
|
217
|
-
if (selector.startsWith("xpath/")) {
|
|
218
|
-
const xpath = selector.slice(6);
|
|
219
|
-
const result = document.evaluate(xpath, parent, null, XPathResult.ANY_TYPE, null);
|
|
220
|
-
let node = null;
|
|
221
|
-
const elements = [];
|
|
222
|
-
while (node = result.iterateNext()) {
|
|
223
|
-
elements.push(node);
|
|
46
|
+
if (options.textFilter != null) {
|
|
47
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
48
|
+
const textContent = possibleTarget.textContent.toLowerCase();
|
|
49
|
+
if (Array.isArray(options.textFilter)) {
|
|
50
|
+
let foundText = false;
|
|
51
|
+
for (const text of options.textFilter) {
|
|
52
|
+
if (textContent.indexOf(text.toLowerCase()) !== -1) {
|
|
53
|
+
foundText = true;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return foundText;
|
|
58
|
+
} else if (options.textFilter != null) {
|
|
59
|
+
return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
224
62
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
let parent = document;
|
|
240
|
-
let matches2;
|
|
241
|
-
for (const selector of selectors) {
|
|
242
|
-
matches2 = querySingleReplySelector(selector, parent);
|
|
243
|
-
if (matches2.length === 0) {
|
|
244
|
-
return [];
|
|
63
|
+
if (options.styleFilters != null) {
|
|
64
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
65
|
+
const styles = window.getComputedStyle(possibleTarget);
|
|
66
|
+
let keep = true;
|
|
67
|
+
for (const styleFilter of options.styleFilters) {
|
|
68
|
+
const option = styles[styleFilter.option];
|
|
69
|
+
if (styleFilter.negated) {
|
|
70
|
+
keep = keep && option !== styleFilter.value;
|
|
71
|
+
} else {
|
|
72
|
+
keep = keep && option === styleFilter.value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return keep;
|
|
76
|
+
});
|
|
245
77
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return querySelectorChain(selector);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// lib/cmps/base.ts
|
|
258
|
-
var defaultRunContext = {
|
|
259
|
-
main: true,
|
|
260
|
-
frame: false,
|
|
261
|
-
urlPattern: ""
|
|
262
|
-
};
|
|
263
|
-
var AutoConsentCMPBase = class {
|
|
264
|
-
constructor(name) {
|
|
265
|
-
this.runContext = defaultRunContext;
|
|
266
|
-
this.name = name;
|
|
267
|
-
}
|
|
268
|
-
get hasSelfTest() {
|
|
269
|
-
throw new Error("Not Implemented");
|
|
270
|
-
}
|
|
271
|
-
get isIntermediate() {
|
|
272
|
-
throw new Error("Not Implemented");
|
|
273
|
-
}
|
|
274
|
-
get isCosmetic() {
|
|
275
|
-
throw new Error("Not Implemented");
|
|
276
|
-
}
|
|
277
|
-
checkRunContext() {
|
|
278
|
-
const runCtx = {
|
|
279
|
-
...defaultRunContext,
|
|
280
|
-
...this.runContext
|
|
281
|
-
};
|
|
282
|
-
const isTop = window.top === window;
|
|
283
|
-
if (isTop && !runCtx.main) {
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
if (!isTop && !runCtx.frame) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
if (runCtx.urlPattern && !window.location.href.match(runCtx.urlPattern)) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
|
-
detectCmp() {
|
|
295
|
-
throw new Error("Not Implemented");
|
|
296
|
-
}
|
|
297
|
-
async detectPopup() {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
optOut() {
|
|
301
|
-
throw new Error("Not Implemented");
|
|
302
|
-
}
|
|
303
|
-
optIn() {
|
|
304
|
-
throw new Error("Not Implemented");
|
|
305
|
-
}
|
|
306
|
-
openCmp() {
|
|
307
|
-
throw new Error("Not Implemented");
|
|
308
|
-
}
|
|
309
|
-
async test() {
|
|
310
|
-
return Promise.resolve(true);
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
async function evaluateRuleStep(rule) {
|
|
314
|
-
const results = [];
|
|
315
|
-
if (rule.exists) {
|
|
316
|
-
results.push(elementExists(rule.exists));
|
|
317
|
-
}
|
|
318
|
-
if (rule.visible) {
|
|
319
|
-
results.push(elementVisible(rule.visible, rule.check));
|
|
320
|
-
}
|
|
321
|
-
if (rule.eval) {
|
|
322
|
-
const res = doEval(rule.eval);
|
|
323
|
-
results.push(res);
|
|
324
|
-
}
|
|
325
|
-
if (rule.waitFor) {
|
|
326
|
-
results.push(waitForElement(rule.waitFor, rule.timeout));
|
|
327
|
-
}
|
|
328
|
-
if (rule.waitForVisible) {
|
|
329
|
-
results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
|
|
330
|
-
}
|
|
331
|
-
if (rule.click) {
|
|
332
|
-
results.push(click(rule.click, rule.all));
|
|
333
|
-
}
|
|
334
|
-
if (rule.waitForThenClick) {
|
|
335
|
-
results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
336
|
-
}
|
|
337
|
-
if (rule.wait) {
|
|
338
|
-
results.push(wait(rule.wait));
|
|
339
|
-
}
|
|
340
|
-
if (rule.hide) {
|
|
341
|
-
results.push(hide(rule.hide, rule.method));
|
|
342
|
-
}
|
|
343
|
-
if (rule.if) {
|
|
344
|
-
if (!rule.if.exists && !rule.if.visible) {
|
|
345
|
-
console.error("invalid conditional rule", rule.if);
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
const condition = await evaluateRuleStep(rule.if);
|
|
349
|
-
enableLogs && console.log("Condition is", condition);
|
|
350
|
-
if (condition) {
|
|
351
|
-
results.push(_runRulesSequentially(rule.then));
|
|
352
|
-
} else if (rule.else) {
|
|
353
|
-
results.push(_runRulesSequentially(rule.else));
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
if (rule.any) {
|
|
357
|
-
for (const step of rule.any) {
|
|
358
|
-
if (await evaluateRuleStep(step)) {
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
return false;
|
|
363
|
-
}
|
|
364
|
-
if (results.length === 0) {
|
|
365
|
-
enableLogs && console.warn("Unrecognized rule", rule);
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
const all = await Promise.all(results);
|
|
369
|
-
return all.reduce((a, b) => a && b, true);
|
|
370
|
-
}
|
|
371
|
-
async function _runRulesParallel(rules3) {
|
|
372
|
-
const results = rules3.map((rule) => evaluateRuleStep(rule));
|
|
373
|
-
const detections = await Promise.all(results);
|
|
374
|
-
return detections.every((r) => !!r);
|
|
375
|
-
}
|
|
376
|
-
async function _runRulesSequentially(rules3) {
|
|
377
|
-
for (const rule of rules3) {
|
|
378
|
-
enableLogs && console.log("Running rule...", rule);
|
|
379
|
-
const result = await evaluateRuleStep(rule);
|
|
380
|
-
enableLogs && console.log("...rule result", result);
|
|
381
|
-
if (!result && !rule.optional) {
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
var AutoConsentCMP = class extends AutoConsentCMPBase {
|
|
388
|
-
constructor(config) {
|
|
389
|
-
super(config.name);
|
|
390
|
-
this.config = config;
|
|
391
|
-
this.runContext = config.runContext || defaultRunContext;
|
|
392
|
-
}
|
|
393
|
-
get hasSelfTest() {
|
|
394
|
-
return !!this.config.test;
|
|
395
|
-
}
|
|
396
|
-
get isIntermediate() {
|
|
397
|
-
return !!this.config.intermediate;
|
|
398
|
-
}
|
|
399
|
-
get isCosmetic() {
|
|
400
|
-
return !!this.config.cosmetic;
|
|
401
|
-
}
|
|
402
|
-
get prehideSelectors() {
|
|
403
|
-
return this.config.prehideSelectors;
|
|
404
|
-
}
|
|
405
|
-
async detectCmp() {
|
|
406
|
-
if (this.config.detectCmp) {
|
|
407
|
-
return _runRulesParallel(this.config.detectCmp);
|
|
408
|
-
}
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
async detectPopup() {
|
|
412
|
-
if (this.config.detectPopup) {
|
|
413
|
-
return _runRulesSequentially(this.config.detectPopup);
|
|
414
|
-
}
|
|
415
|
-
return false;
|
|
416
|
-
}
|
|
417
|
-
async optOut() {
|
|
418
|
-
if (this.config.optOut) {
|
|
419
|
-
enableLogs && console.log("Initiated optOut()", this.config.optOut);
|
|
420
|
-
return _runRulesSequentially(this.config.optOut);
|
|
421
|
-
}
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
async optIn() {
|
|
425
|
-
if (this.config.optIn) {
|
|
426
|
-
enableLogs && console.log("Initiated optIn()", this.config.optIn);
|
|
427
|
-
return _runRulesSequentially(this.config.optIn);
|
|
428
|
-
}
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
async openCmp() {
|
|
432
|
-
if (this.config.openCmp) {
|
|
433
|
-
return _runRulesSequentially(this.config.openCmp);
|
|
434
|
-
}
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
async test() {
|
|
438
|
-
if (this.hasSelfTest) {
|
|
439
|
-
return _runRulesSequentially(this.config.test);
|
|
440
|
-
}
|
|
441
|
-
return super.test();
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
// lib/cmps/trustarc-top.ts
|
|
446
|
-
var cookieSettingsButton = "#truste-show-consent";
|
|
447
|
-
var shortcutOptOut = "#truste-consent-required";
|
|
448
|
-
var shortcutOptIn = "#truste-consent-button";
|
|
449
|
-
var popupContent = "#truste-consent-content";
|
|
450
|
-
var bannerOverlay = "#trustarc-banner-overlay";
|
|
451
|
-
var bannerContainer = "#truste-consent-track";
|
|
452
|
-
var TrustArcTop = class extends AutoConsentCMPBase {
|
|
453
|
-
constructor() {
|
|
454
|
-
super("TrustArc-top");
|
|
455
|
-
this.prehideSelectors = [
|
|
456
|
-
".trustarc-banner-container",
|
|
457
|
-
`.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`
|
|
458
|
-
];
|
|
459
|
-
this.runContext = {
|
|
460
|
-
main: true,
|
|
461
|
-
frame: false
|
|
462
|
-
};
|
|
463
|
-
this._shortcutButton = null;
|
|
464
|
-
this._optInDone = false;
|
|
465
|
-
}
|
|
466
|
-
get hasSelfTest() {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
get isIntermediate() {
|
|
470
|
-
if (this._optInDone) {
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
return !this._shortcutButton;
|
|
474
|
-
}
|
|
475
|
-
get isCosmetic() {
|
|
476
|
-
return false;
|
|
477
|
-
}
|
|
478
|
-
async detectCmp() {
|
|
479
|
-
const result = elementExists(`${cookieSettingsButton},${bannerContainer}`);
|
|
480
|
-
if (result) {
|
|
481
|
-
this._shortcutButton = document.querySelector(shortcutOptOut);
|
|
482
|
-
}
|
|
483
|
-
return result;
|
|
484
|
-
}
|
|
485
|
-
async detectPopup() {
|
|
486
|
-
return elementVisible(`${popupContent},${bannerOverlay},${bannerContainer}`, "all");
|
|
487
|
-
}
|
|
488
|
-
openFrame() {
|
|
489
|
-
click(cookieSettingsButton);
|
|
490
|
-
}
|
|
491
|
-
async optOut() {
|
|
492
|
-
if (this._shortcutButton) {
|
|
493
|
-
this._shortcutButton.click();
|
|
494
|
-
return true;
|
|
495
|
-
}
|
|
496
|
-
hideElements(
|
|
497
|
-
getStyleElement(),
|
|
498
|
-
[".truste_popframe", ".truste_overlay", ".truste_box_overlay", bannerContainer]
|
|
499
|
-
);
|
|
500
|
-
click(cookieSettingsButton);
|
|
501
|
-
setTimeout(() => {
|
|
502
|
-
getStyleElement().remove();
|
|
503
|
-
}, 1e4);
|
|
504
|
-
return true;
|
|
505
|
-
}
|
|
506
|
-
async optIn() {
|
|
507
|
-
this._optInDone = true;
|
|
508
|
-
return click(shortcutOptIn);
|
|
509
|
-
}
|
|
510
|
-
async openCmp() {
|
|
511
|
-
return true;
|
|
512
|
-
}
|
|
513
|
-
async test() {
|
|
514
|
-
return await doEval("window && window.truste && window.truste.eu.bindMap.prefCookie === '0'");
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
// lib/cmps/trustarc-frame.ts
|
|
519
|
-
var TrustArcFrame = class extends AutoConsentCMPBase {
|
|
520
|
-
constructor() {
|
|
521
|
-
super("TrustArc-frame");
|
|
522
|
-
this.runContext = {
|
|
523
|
-
main: false,
|
|
524
|
-
frame: true,
|
|
525
|
-
urlPattern: "^https://consent-pref\\.trustarc\\.com/\\?"
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
get hasSelfTest() {
|
|
529
|
-
return false;
|
|
530
|
-
}
|
|
531
|
-
get isIntermediate() {
|
|
532
|
-
return false;
|
|
533
|
-
}
|
|
534
|
-
get isCosmetic() {
|
|
535
|
-
return false;
|
|
536
|
-
}
|
|
537
|
-
async detectCmp() {
|
|
538
|
-
return true;
|
|
539
|
-
}
|
|
540
|
-
async detectPopup() {
|
|
541
|
-
return elementVisible("#defaultpreferencemanager", "any") && elementVisible(".mainContent", "any");
|
|
542
|
-
}
|
|
543
|
-
async navigateToSettings() {
|
|
544
|
-
await waitFor(
|
|
545
|
-
async () => {
|
|
546
|
-
return elementExists(".shp") || elementVisible(".advance", "any") || elementExists(".switch span:first-child");
|
|
547
|
-
},
|
|
548
|
-
10,
|
|
549
|
-
500
|
|
550
|
-
);
|
|
551
|
-
if (elementExists(".shp")) {
|
|
552
|
-
click(".shp");
|
|
553
|
-
}
|
|
554
|
-
await waitForElement(".prefPanel", 5e3);
|
|
555
|
-
if (elementVisible(".advance", "any")) {
|
|
556
|
-
click(".advance");
|
|
557
|
-
}
|
|
558
|
-
return await waitFor(
|
|
559
|
-
() => elementVisible(".switch span:first-child", "any"),
|
|
560
|
-
5,
|
|
561
|
-
1e3
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
async optOut() {
|
|
565
|
-
await waitFor(() => document.readyState === "complete", 20, 100);
|
|
566
|
-
await waitForElement(".mainContent[aria-hidden=false]", 5e3);
|
|
567
|
-
if (click(".rejectAll")) {
|
|
568
|
-
return true;
|
|
569
|
-
}
|
|
570
|
-
if (elementExists(".prefPanel")) {
|
|
571
|
-
await waitForElement('.prefPanel[style="visibility: visible;"]', 3e3);
|
|
572
|
-
}
|
|
573
|
-
if (click("#catDetails0")) {
|
|
574
|
-
click(".submit");
|
|
575
|
-
return true;
|
|
576
|
-
}
|
|
577
|
-
if (click(".required")) {
|
|
578
|
-
return true;
|
|
579
|
-
}
|
|
580
|
-
await this.navigateToSettings();
|
|
581
|
-
click(".switch span:nth-child(1):not(.active)", true);
|
|
582
|
-
click(".submit");
|
|
583
|
-
waitForElement("#gwt-debug-close_id", 3e5).then(() => {
|
|
584
|
-
click("#gwt-debug-close_id");
|
|
585
|
-
});
|
|
586
|
-
return true;
|
|
587
|
-
}
|
|
588
|
-
async optIn() {
|
|
589
|
-
if (click(".call")) {
|
|
590
|
-
return true;
|
|
591
|
-
}
|
|
592
|
-
await this.navigateToSettings();
|
|
593
|
-
click(".switch span:nth-child(2)", true);
|
|
594
|
-
click(".submit");
|
|
595
|
-
waitForElement("#gwt-debug-close_id", 3e5).then(() => {
|
|
596
|
-
click("#gwt-debug-close_id");
|
|
597
|
-
});
|
|
598
|
-
return true;
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
// lib/cmps/cookiebot.ts
|
|
603
|
-
var Cookiebot = class extends AutoConsentCMPBase {
|
|
604
|
-
constructor() {
|
|
605
|
-
super("Cybotcookiebot");
|
|
606
|
-
this.prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"];
|
|
607
|
-
}
|
|
608
|
-
get hasSelfTest() {
|
|
609
|
-
return true;
|
|
610
|
-
}
|
|
611
|
-
get isIntermediate() {
|
|
612
|
-
return false;
|
|
613
|
-
}
|
|
614
|
-
get isCosmetic() {
|
|
615
|
-
return false;
|
|
616
|
-
}
|
|
617
|
-
async detectCmp() {
|
|
618
|
-
return elementExists("#CybotCookiebotDialogBodyLevelButtonPreferences");
|
|
619
|
-
}
|
|
620
|
-
async detectPopup() {
|
|
621
|
-
return elementExists("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner");
|
|
622
|
-
}
|
|
623
|
-
async optOut() {
|
|
624
|
-
if (click(".cookie-alert-extended-detail-link")) {
|
|
625
|
-
await waitForElement(".cookie-alert-configuration", 2e3);
|
|
626
|
-
click(".cookie-alert-configuration-input:checked", true);
|
|
627
|
-
click(".cookie-alert-extended-button-secondary");
|
|
628
|
-
return true;
|
|
629
|
-
}
|
|
630
|
-
if (elementExists("#dtcookie-container")) {
|
|
631
|
-
return click(".h-dtcookie-decline");
|
|
78
|
+
if (options.displayFilter != null) {
|
|
79
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
80
|
+
if (options.displayFilter) {
|
|
81
|
+
return possibleTarget.offsetHeight !== 0;
|
|
82
|
+
} else {
|
|
83
|
+
return possibleTarget.offsetHeight === 0;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
632
86
|
}
|
|
633
|
-
if (
|
|
634
|
-
|
|
87
|
+
if (options.iframeFilter != null) {
|
|
88
|
+
possibleTargets = possibleTargets.filter(() => {
|
|
89
|
+
if (options.iframeFilter) {
|
|
90
|
+
return window.location !== window.parent.location;
|
|
91
|
+
} else {
|
|
92
|
+
return window.location === window.parent.location;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
635
95
|
}
|
|
636
|
-
if (
|
|
637
|
-
|
|
96
|
+
if (options.childFilter != null) {
|
|
97
|
+
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
98
|
+
const oldBase = _Tools.base;
|
|
99
|
+
_Tools.setBase(possibleTarget);
|
|
100
|
+
const childResults = _Tools.find(options.childFilter);
|
|
101
|
+
_Tools.setBase(oldBase);
|
|
102
|
+
return childResults.target != null;
|
|
103
|
+
});
|
|
638
104
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
click("#CybotCookiebotDialogBodyButtonDecline");
|
|
642
|
-
click("input[id^=CybotCookiebotDialogBodyLevelButton]:checked", true);
|
|
643
|
-
if (elementExists("#CybotCookiebotDialogBodyButtonAcceptSelected")) {
|
|
644
|
-
click("#CybotCookiebotDialogBodyButtonAcceptSelected");
|
|
105
|
+
if (multiple) {
|
|
106
|
+
return possibleTargets;
|
|
645
107
|
} else {
|
|
646
|
-
|
|
108
|
+
if (possibleTargets.length > 1) {
|
|
109
|
+
console.warn(
|
|
110
|
+
"Multiple possible targets: ",
|
|
111
|
+
possibleTargets,
|
|
112
|
+
options,
|
|
113
|
+
parent
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return possibleTargets[0];
|
|
647
117
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
118
|
+
}
|
|
119
|
+
static find(options, multiple = false) {
|
|
120
|
+
const results = [];
|
|
121
|
+
if (options.parent != null) {
|
|
122
|
+
const parent = _Tools.findElement(options.parent, null, multiple);
|
|
123
|
+
if (parent != null) {
|
|
124
|
+
if (parent instanceof Array) {
|
|
125
|
+
parent.forEach((p) => {
|
|
126
|
+
const targets = _Tools.findElement(options.target, p, multiple);
|
|
127
|
+
if (targets instanceof Array) {
|
|
128
|
+
targets.forEach((target) => {
|
|
129
|
+
results.push({
|
|
130
|
+
parent: p,
|
|
131
|
+
target
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
results.push({
|
|
136
|
+
parent: p,
|
|
137
|
+
target: targets
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
return results;
|
|
142
|
+
} else {
|
|
143
|
+
const targets = _Tools.findElement(options.target, parent, multiple);
|
|
144
|
+
if (targets instanceof Array) {
|
|
145
|
+
targets.forEach((target) => {
|
|
146
|
+
results.push({
|
|
147
|
+
parent,
|
|
148
|
+
target
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
results.push({
|
|
153
|
+
parent,
|
|
154
|
+
target: targets
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
const targets = _Tools.findElement(options.target, null, multiple);
|
|
161
|
+
if (targets instanceof Array) {
|
|
162
|
+
targets.forEach((target) => {
|
|
163
|
+
results.push({
|
|
164
|
+
parent: null,
|
|
165
|
+
target
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
} else {
|
|
169
|
+
results.push({
|
|
170
|
+
parent: null,
|
|
171
|
+
target: targets
|
|
172
|
+
});
|
|
173
|
+
}
|
|
651
174
|
}
|
|
652
|
-
if (
|
|
653
|
-
|
|
175
|
+
if (results.length === 0) {
|
|
176
|
+
results.push({
|
|
177
|
+
parent: null,
|
|
178
|
+
target: null
|
|
179
|
+
});
|
|
654
180
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
181
|
+
if (multiple) {
|
|
182
|
+
return results;
|
|
183
|
+
} else {
|
|
184
|
+
if (results.length !== 1) {
|
|
185
|
+
console.warn(
|
|
186
|
+
"Multiple results found, even though multiple false",
|
|
187
|
+
results
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
return results[0];
|
|
660
191
|
}
|
|
661
|
-
click(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled", true);
|
|
662
|
-
click("#CybotCookiebotDialogBodyLevelButtonAccept");
|
|
663
|
-
click("#CybotCookiebotDialogBodyButtonAccept");
|
|
664
|
-
return true;
|
|
665
|
-
}
|
|
666
|
-
async test() {
|
|
667
|
-
return doEval("window.CookieConsent.declined === true");
|
|
668
192
|
}
|
|
669
193
|
};
|
|
194
|
+
_Tools.base = null;
|
|
195
|
+
var Tools = _Tools;
|
|
670
196
|
|
|
671
|
-
// lib/
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
this.runContext = {
|
|
679
|
-
main: false,
|
|
680
|
-
frame: true
|
|
681
|
-
};
|
|
197
|
+
// lib/consentomatic/index.ts
|
|
198
|
+
function matches(config) {
|
|
199
|
+
const result = Tools.find(config);
|
|
200
|
+
if (config.type === "css") {
|
|
201
|
+
return !!result.target;
|
|
202
|
+
} else if (config.type === "checkbox") {
|
|
203
|
+
return !!result.target && result.target.checked;
|
|
682
204
|
}
|
|
683
|
-
|
|
684
|
-
|
|
205
|
+
}
|
|
206
|
+
async function executeAction(config, param) {
|
|
207
|
+
switch (config.type) {
|
|
208
|
+
case "click":
|
|
209
|
+
return clickAction(config);
|
|
210
|
+
case "list":
|
|
211
|
+
return listAction(config, param);
|
|
212
|
+
case "consent":
|
|
213
|
+
return consentAction(config, param);
|
|
214
|
+
case "ifcss":
|
|
215
|
+
return ifCssAction(config, param);
|
|
216
|
+
case "waitcss":
|
|
217
|
+
return waitCssAction(config);
|
|
218
|
+
case "foreach":
|
|
219
|
+
return forEachAction(config, param);
|
|
220
|
+
case "hide":
|
|
221
|
+
return hideAction(config);
|
|
222
|
+
case "slide":
|
|
223
|
+
return slideAction(config);
|
|
224
|
+
case "close":
|
|
225
|
+
return closeAction();
|
|
226
|
+
case "wait":
|
|
227
|
+
return waitAction(config);
|
|
228
|
+
case "eval":
|
|
229
|
+
return evalAction(config);
|
|
230
|
+
default:
|
|
231
|
+
throw "Unknown action type: " + config.type;
|
|
685
232
|
}
|
|
686
|
-
|
|
687
|
-
|
|
233
|
+
}
|
|
234
|
+
var STEP_TIMEOUT = 0;
|
|
235
|
+
function waitTimeout(timeout) {
|
|
236
|
+
return new Promise((resolve) => {
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
resolve();
|
|
239
|
+
}, timeout);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async function clickAction(config) {
|
|
243
|
+
const result = Tools.find(config);
|
|
244
|
+
if (result.target != null) {
|
|
245
|
+
result.target.click();
|
|
688
246
|
}
|
|
689
|
-
|
|
690
|
-
|
|
247
|
+
return waitTimeout(STEP_TIMEOUT);
|
|
248
|
+
}
|
|
249
|
+
async function listAction(config, param) {
|
|
250
|
+
for (const action of config.actions) {
|
|
251
|
+
await executeAction(action, param);
|
|
691
252
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
253
|
+
}
|
|
254
|
+
async function consentAction(config, consentTypes) {
|
|
255
|
+
for (const consentConfig of config.consents) {
|
|
256
|
+
const shouldEnable = consentTypes.indexOf(consentConfig.type) !== -1;
|
|
257
|
+
if (consentConfig.matcher && consentConfig.toggleAction) {
|
|
258
|
+
const isEnabled = matches(consentConfig.matcher);
|
|
259
|
+
if (isEnabled !== shouldEnable) {
|
|
260
|
+
await executeAction(consentConfig.toggleAction);
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
if (shouldEnable) {
|
|
264
|
+
await executeAction(consentConfig.trueAction);
|
|
265
|
+
} else {
|
|
266
|
+
await executeAction(consentConfig.falseAction);
|
|
267
|
+
}
|
|
701
268
|
}
|
|
702
|
-
return (url.pathname === "/index.html" || url.pathname === "/privacy-manager/index.html") && (url.searchParams.has("message_id") || url.searchParams.has("requestUUID") || url.searchParams.has("consentUUID"));
|
|
703
269
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
270
|
+
}
|
|
271
|
+
async function ifCssAction(config, param) {
|
|
272
|
+
const result = Tools.find(config);
|
|
273
|
+
if (!result.target) {
|
|
274
|
+
if (config.trueAction) {
|
|
275
|
+
await executeAction(config.trueAction, param);
|
|
707
276
|
}
|
|
708
|
-
|
|
709
|
-
|
|
277
|
+
} else {
|
|
278
|
+
if (config.falseAction) {
|
|
279
|
+
await executeAction(config.falseAction, param);
|
|
710
280
|
}
|
|
711
|
-
await waitForElement(".sp_choice_type_11,.sp_choice_type_12,.sp_choice_type_13,.sp_choice_type_ACCEPT_ALL", 2e3);
|
|
712
|
-
return !elementExists(".sp_choice_type_9");
|
|
713
281
|
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
282
|
+
}
|
|
283
|
+
async function waitCssAction(config) {
|
|
284
|
+
await new Promise((resolve) => {
|
|
285
|
+
let numRetries = config.retries || 10;
|
|
286
|
+
const waitTime = config.waitTime || 250;
|
|
287
|
+
const checkCss = () => {
|
|
288
|
+
const result = Tools.find(config);
|
|
289
|
+
if (config.negated && result.target || !config.negated && !result.target) {
|
|
290
|
+
if (numRetries > 0) {
|
|
291
|
+
numRetries -= 1;
|
|
292
|
+
setTimeout(checkCss, waitTime);
|
|
293
|
+
} else {
|
|
294
|
+
resolve();
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
resolve();
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
checkCss();
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
async function forEachAction(config, param) {
|
|
304
|
+
const results = Tools.find(config, true);
|
|
305
|
+
const oldBase = Tools.base;
|
|
306
|
+
for (const result of results) {
|
|
307
|
+
if (result.target) {
|
|
308
|
+
Tools.setBase(result.target);
|
|
309
|
+
await executeAction(config.action, param);
|
|
721
310
|
}
|
|
722
|
-
return false;
|
|
723
311
|
}
|
|
724
|
-
|
|
725
|
-
|
|
312
|
+
Tools.setBase(oldBase);
|
|
313
|
+
}
|
|
314
|
+
async function hideAction(config) {
|
|
315
|
+
const result = Tools.find(config);
|
|
316
|
+
if (result.target) {
|
|
317
|
+
result.target.classList.add("Autoconsent-Hidden");
|
|
726
318
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
319
|
+
}
|
|
320
|
+
async function slideAction(config) {
|
|
321
|
+
const result = Tools.find(config);
|
|
322
|
+
const dragResult = Tools.find(config.dragTarget);
|
|
323
|
+
if (result.target) {
|
|
324
|
+
const targetBounds = result.target.getBoundingClientRect();
|
|
325
|
+
const dragTargetBounds = dragResult.target.getBoundingClientRect();
|
|
326
|
+
let yDiff = dragTargetBounds.top - targetBounds.top;
|
|
327
|
+
let xDiff = dragTargetBounds.left - targetBounds.left;
|
|
328
|
+
if (this.config.axis.toLowerCase() === "y") {
|
|
329
|
+
xDiff = 0;
|
|
738
330
|
}
|
|
739
|
-
if (
|
|
740
|
-
|
|
741
|
-
if (!actionable) {
|
|
742
|
-
return false;
|
|
743
|
-
}
|
|
744
|
-
if (!elementExists(".sp_choice_type_12")) {
|
|
745
|
-
return click(".sp_choice_type_13");
|
|
746
|
-
}
|
|
747
|
-
click(".sp_choice_type_12");
|
|
748
|
-
await waitFor(
|
|
749
|
-
() => this.isManagerOpen(),
|
|
750
|
-
200,
|
|
751
|
-
100
|
|
752
|
-
);
|
|
331
|
+
if (this.config.axis.toLowerCase() === "x") {
|
|
332
|
+
yDiff = 0;
|
|
753
333
|
}
|
|
754
|
-
|
|
334
|
+
const screenX = window.screenX + targetBounds.left + targetBounds.width / 2;
|
|
335
|
+
const screenY = window.screenY + targetBounds.top + targetBounds.height / 2;
|
|
336
|
+
const clientX = targetBounds.left + targetBounds.width / 2;
|
|
337
|
+
const clientY = targetBounds.top + targetBounds.height / 2;
|
|
338
|
+
const mouseDown = document.createEvent("MouseEvents");
|
|
339
|
+
mouseDown.initMouseEvent(
|
|
340
|
+
"mousedown",
|
|
341
|
+
true,
|
|
342
|
+
true,
|
|
343
|
+
window,
|
|
344
|
+
0,
|
|
345
|
+
screenX,
|
|
346
|
+
screenY,
|
|
347
|
+
clientX,
|
|
348
|
+
clientY,
|
|
349
|
+
false,
|
|
350
|
+
false,
|
|
351
|
+
false,
|
|
352
|
+
false,
|
|
353
|
+
0,
|
|
354
|
+
result.target
|
|
355
|
+
);
|
|
356
|
+
const mouseMove = document.createEvent("MouseEvents");
|
|
357
|
+
mouseMove.initMouseEvent(
|
|
358
|
+
"mousemove",
|
|
359
|
+
true,
|
|
360
|
+
true,
|
|
361
|
+
window,
|
|
362
|
+
0,
|
|
363
|
+
screenX + xDiff,
|
|
364
|
+
screenY + yDiff,
|
|
365
|
+
clientX + xDiff,
|
|
366
|
+
clientY + yDiff,
|
|
367
|
+
false,
|
|
368
|
+
false,
|
|
369
|
+
false,
|
|
370
|
+
false,
|
|
371
|
+
0,
|
|
372
|
+
result.target
|
|
373
|
+
);
|
|
374
|
+
const mouseUp = document.createEvent("MouseEvents");
|
|
375
|
+
mouseUp.initMouseEvent(
|
|
376
|
+
"mouseup",
|
|
377
|
+
true,
|
|
378
|
+
true,
|
|
379
|
+
window,
|
|
380
|
+
0,
|
|
381
|
+
screenX + xDiff,
|
|
382
|
+
screenY + yDiff,
|
|
383
|
+
clientX + xDiff,
|
|
384
|
+
clientY + yDiff,
|
|
385
|
+
false,
|
|
386
|
+
false,
|
|
387
|
+
false,
|
|
388
|
+
false,
|
|
389
|
+
0,
|
|
390
|
+
result.target
|
|
391
|
+
);
|
|
392
|
+
result.target.dispatchEvent(mouseDown);
|
|
393
|
+
await this.waitTimeout(10);
|
|
394
|
+
result.target.dispatchEvent(mouseMove);
|
|
395
|
+
await this.waitTimeout(10);
|
|
396
|
+
result.target.dispatchEvent(mouseUp);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
async function waitAction(config) {
|
|
400
|
+
await waitTimeout(config.waitTime);
|
|
401
|
+
}
|
|
402
|
+
async function closeAction() {
|
|
403
|
+
window.close();
|
|
404
|
+
}
|
|
405
|
+
async function evalAction(config) {
|
|
406
|
+
console.log("eval!", config.code);
|
|
407
|
+
return new Promise((resolve) => {
|
|
755
408
|
try {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
if (path === 0) {
|
|
764
|
-
await wait(1e3);
|
|
765
|
-
return click(rejectSelector1);
|
|
766
|
-
} else if (path === 1) {
|
|
767
|
-
click(rejectSelector2);
|
|
768
|
-
} else if (path === 2) {
|
|
769
|
-
await waitForElement(".pm-features", 1e4);
|
|
770
|
-
click(".checked > span", true);
|
|
771
|
-
click(".chevron");
|
|
409
|
+
if (config.async) {
|
|
410
|
+
window.eval(config.code);
|
|
411
|
+
setTimeout(() => {
|
|
412
|
+
resolve(window.eval("window.__consentCheckResult"));
|
|
413
|
+
}, config.timeout || 250);
|
|
414
|
+
} else {
|
|
415
|
+
resolve(window.eval(config.code));
|
|
772
416
|
}
|
|
773
417
|
} catch (e) {
|
|
774
|
-
|
|
418
|
+
console.warn("eval error", e, config.code);
|
|
419
|
+
resolve(false);
|
|
775
420
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
};
|
|
421
|
+
});
|
|
422
|
+
}
|
|
779
423
|
|
|
780
|
-
// lib/
|
|
781
|
-
var
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
424
|
+
// lib/config.ts
|
|
425
|
+
var enableLogs = false;
|
|
426
|
+
|
|
427
|
+
// lib/utils.ts
|
|
428
|
+
function getStyleElement(styleOverrideElementId = "autoconsent-css-rules") {
|
|
429
|
+
const styleSelector = `style#${styleOverrideElementId}`;
|
|
430
|
+
const existingElement = document.querySelector(styleSelector);
|
|
431
|
+
if (existingElement && existingElement instanceof HTMLStyleElement) {
|
|
432
|
+
return existingElement;
|
|
433
|
+
} else {
|
|
434
|
+
const parent = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
|
435
|
+
const css = document.createElement("style");
|
|
436
|
+
css.id = styleOverrideElementId;
|
|
437
|
+
parent.appendChild(css);
|
|
438
|
+
return css;
|
|
786
439
|
}
|
|
787
|
-
|
|
788
|
-
|
|
440
|
+
}
|
|
441
|
+
function hideElements(styleEl, selectors, method = "display") {
|
|
442
|
+
const hidingSnippet = method === "opacity" ? `opacity: 0` : `display: none`;
|
|
443
|
+
const rule = `${selectors.join(
|
|
444
|
+
","
|
|
445
|
+
)} { ${hidingSnippet} !important; z-index: -1 !important; pointer-events: none !important; } `;
|
|
446
|
+
if (styleEl instanceof HTMLStyleElement) {
|
|
447
|
+
styleEl.innerText += rule;
|
|
448
|
+
return selectors.length > 0;
|
|
789
449
|
}
|
|
790
|
-
|
|
791
|
-
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
async function waitFor(predicate, maxTimes, interval) {
|
|
453
|
+
const result = await predicate();
|
|
454
|
+
if (!result && maxTimes > 0) {
|
|
455
|
+
return new Promise((resolve) => {
|
|
456
|
+
setTimeout(async () => {
|
|
457
|
+
resolve(waitFor(predicate, maxTimes - 1, interval));
|
|
458
|
+
}, interval);
|
|
459
|
+
});
|
|
792
460
|
}
|
|
793
|
-
|
|
461
|
+
return Promise.resolve(result);
|
|
462
|
+
}
|
|
463
|
+
function isElementVisible(elem) {
|
|
464
|
+
if (!elem) {
|
|
794
465
|
return false;
|
|
795
466
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
return true;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
async detectPopup() {
|
|
805
|
-
if (this.apiAvailable) {
|
|
806
|
-
await wait(500);
|
|
807
|
-
return await doEval("!__cmp('consentStatus').userChoiceExists");
|
|
808
|
-
}
|
|
809
|
-
return elementVisible("#cmpbox .cmpmore", "any");
|
|
810
|
-
}
|
|
811
|
-
async optOut() {
|
|
812
|
-
await wait(500);
|
|
813
|
-
if (this.apiAvailable) {
|
|
814
|
-
return await doEval("__cmp('setConsent', 0)");
|
|
815
|
-
}
|
|
816
|
-
if (click(".cmpboxbtnno")) {
|
|
817
|
-
return true;
|
|
818
|
-
}
|
|
819
|
-
if (elementExists(".cmpwelcomeprpsbtn")) {
|
|
820
|
-
click(".cmpwelcomeprpsbtn > a[aria-checked=true]", true);
|
|
821
|
-
click(".cmpboxbtnsave");
|
|
822
|
-
return true;
|
|
823
|
-
}
|
|
824
|
-
click(".cmpboxbtncustom");
|
|
825
|
-
await waitForElement(".cmptblbox", 2e3);
|
|
826
|
-
click(".cmptdchoice > a[aria-checked=true]", true);
|
|
827
|
-
click(".cmpboxbtnyescustomchoices");
|
|
828
|
-
return true;
|
|
829
|
-
}
|
|
830
|
-
async optIn() {
|
|
831
|
-
if (this.apiAvailable) {
|
|
832
|
-
return await doEval("__cmp('setConsent', 1)");
|
|
833
|
-
}
|
|
834
|
-
return click(".cmpboxbtnyes");
|
|
835
|
-
}
|
|
836
|
-
async test() {
|
|
837
|
-
if (this.apiAvailable) {
|
|
838
|
-
return await doEval("__cmp('consentStatus').userChoiceExists");
|
|
467
|
+
if (elem.offsetParent !== null) {
|
|
468
|
+
return true;
|
|
469
|
+
} else {
|
|
470
|
+
const css = window.getComputedStyle(elem);
|
|
471
|
+
if (css.position === "fixed" && css.display !== "none") {
|
|
472
|
+
return true;
|
|
839
473
|
}
|
|
840
474
|
}
|
|
841
|
-
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
842
477
|
|
|
843
|
-
// lib/
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
478
|
+
// lib/rule-executors.ts
|
|
479
|
+
function click(selector, all = false) {
|
|
480
|
+
const elem = elementSelector(selector);
|
|
481
|
+
enableLogs && console.log("[click]", selector, all, elem);
|
|
482
|
+
if (elem.length > 0) {
|
|
483
|
+
if (all) {
|
|
484
|
+
elem.forEach((e) => e.click());
|
|
485
|
+
} else {
|
|
486
|
+
elem[0].click();
|
|
487
|
+
}
|
|
847
488
|
}
|
|
848
|
-
|
|
489
|
+
return elem.length > 0;
|
|
490
|
+
}
|
|
491
|
+
function elementExists(selector) {
|
|
492
|
+
const exists = elementSelector(selector).length > 0;
|
|
493
|
+
return exists;
|
|
494
|
+
}
|
|
495
|
+
function elementVisible(selector, check) {
|
|
496
|
+
const elem = elementSelector(selector);
|
|
497
|
+
const results = new Array(elem.length);
|
|
498
|
+
elem.forEach((e, i) => {
|
|
499
|
+
results[i] = isElementVisible(e);
|
|
500
|
+
});
|
|
501
|
+
if (check === "none") {
|
|
502
|
+
return results.every((r) => !r);
|
|
503
|
+
} else if (results.length === 0) {
|
|
849
504
|
return false;
|
|
505
|
+
} else if (check === "any") {
|
|
506
|
+
return results.some((r) => r);
|
|
850
507
|
}
|
|
851
|
-
|
|
852
|
-
|
|
508
|
+
return results.every((r) => r);
|
|
509
|
+
}
|
|
510
|
+
function waitForElement(selector, timeout = 1e4) {
|
|
511
|
+
const interval = 200;
|
|
512
|
+
const times = Math.ceil(timeout / interval);
|
|
513
|
+
return waitFor(
|
|
514
|
+
() => elementSelector(selector).length > 0,
|
|
515
|
+
times,
|
|
516
|
+
interval
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
function waitForVisible(selector, timeout = 1e4, check = "any") {
|
|
520
|
+
const interval = 200;
|
|
521
|
+
const times = Math.ceil(timeout / interval);
|
|
522
|
+
return waitFor(
|
|
523
|
+
() => elementVisible(selector, check),
|
|
524
|
+
times,
|
|
525
|
+
interval
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
async function waitForThenClick2(selector, timeout = 1e4, all = false) {
|
|
529
|
+
await waitForElement(selector, timeout);
|
|
530
|
+
return click(selector, all);
|
|
531
|
+
}
|
|
532
|
+
function wait(ms) {
|
|
533
|
+
return new Promise((resolve) => {
|
|
534
|
+
setTimeout(() => {
|
|
535
|
+
resolve(true);
|
|
536
|
+
}, ms);
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
function hide(selectors, method) {
|
|
540
|
+
const styleEl = getStyleElement();
|
|
541
|
+
return hideElements(styleEl, selectors, method);
|
|
542
|
+
}
|
|
543
|
+
function prehide(selectors) {
|
|
544
|
+
const styleEl = getStyleElement("autoconsent-prehide");
|
|
545
|
+
enableLogs && console.log("[prehide]", styleEl, location.href);
|
|
546
|
+
return hideElements(styleEl, selectors, "opacity");
|
|
547
|
+
}
|
|
548
|
+
function undoPrehide() {
|
|
549
|
+
const existingElement = getStyleElement("autoconsent-prehide");
|
|
550
|
+
enableLogs && console.log("[undoprehide]", existingElement, location.href);
|
|
551
|
+
if (existingElement) {
|
|
552
|
+
existingElement.remove();
|
|
853
553
|
}
|
|
854
|
-
|
|
855
|
-
|
|
554
|
+
return !!existingElement;
|
|
555
|
+
}
|
|
556
|
+
function querySingleReplySelector(selector, parent = document) {
|
|
557
|
+
if (selector.startsWith("aria/")) {
|
|
558
|
+
return [];
|
|
856
559
|
}
|
|
857
|
-
|
|
858
|
-
|
|
560
|
+
if (selector.startsWith("xpath/")) {
|
|
561
|
+
const xpath = selector.slice(6);
|
|
562
|
+
const result = document.evaluate(xpath, parent, null, XPathResult.ANY_TYPE, null);
|
|
563
|
+
let node = null;
|
|
564
|
+
const elements = [];
|
|
565
|
+
while (node = result.iterateNext()) {
|
|
566
|
+
elements.push(node);
|
|
567
|
+
}
|
|
568
|
+
return elements;
|
|
859
569
|
}
|
|
860
|
-
|
|
861
|
-
return
|
|
570
|
+
if (selector.startsWith("text/")) {
|
|
571
|
+
return [];
|
|
862
572
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
573
|
+
if (selector.startsWith("pierce/")) {
|
|
574
|
+
return [];
|
|
575
|
+
}
|
|
576
|
+
if (parent.shadowRoot) {
|
|
577
|
+
return Array.from(parent.shadowRoot.querySelectorAll(selector));
|
|
578
|
+
}
|
|
579
|
+
return Array.from(parent.querySelectorAll(selector));
|
|
580
|
+
}
|
|
581
|
+
function querySelectorChain(selectors) {
|
|
582
|
+
let parent = document;
|
|
583
|
+
let matches2;
|
|
584
|
+
for (const selector of selectors) {
|
|
585
|
+
matches2 = querySingleReplySelector(selector, parent);
|
|
586
|
+
if (matches2.length === 0) {
|
|
587
|
+
return [];
|
|
866
588
|
}
|
|
867
|
-
|
|
868
|
-
click("#_evidon-option-button");
|
|
869
|
-
await waitForElement("#evidon-prefdiag-overlay", 5e3);
|
|
870
|
-
click("#evidon-prefdiag-decline");
|
|
871
|
-
return true;
|
|
589
|
+
parent = matches2[0];
|
|
872
590
|
}
|
|
873
|
-
|
|
874
|
-
|
|
591
|
+
return matches2;
|
|
592
|
+
}
|
|
593
|
+
function elementSelector(selector) {
|
|
594
|
+
if (typeof selector === "string") {
|
|
595
|
+
return querySingleReplySelector(selector);
|
|
596
|
+
}
|
|
597
|
+
return querySelectorChain(selector);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// lib/random.ts
|
|
601
|
+
function getRandomID() {
|
|
602
|
+
if (crypto && typeof crypto.randomUUID !== "undefined") {
|
|
603
|
+
return crypto.randomUUID();
|
|
604
|
+
}
|
|
605
|
+
return Math.random().toString();
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// lib/eval-handler.ts
|
|
609
|
+
var Deferred = class {
|
|
610
|
+
constructor(id, timeout = 1e3) {
|
|
611
|
+
this.id = id;
|
|
612
|
+
this.promise = new Promise((resolve, reject) => {
|
|
613
|
+
this.resolve = resolve;
|
|
614
|
+
this.reject = reject;
|
|
615
|
+
});
|
|
616
|
+
this.timer = window.setTimeout(() => {
|
|
617
|
+
this.reject(new Error("timeout"));
|
|
618
|
+
}, timeout);
|
|
875
619
|
}
|
|
876
620
|
};
|
|
621
|
+
var evalState = {
|
|
622
|
+
pending: /* @__PURE__ */ new Map(),
|
|
623
|
+
sendContentMessage: null
|
|
624
|
+
};
|
|
625
|
+
function requestEval(code) {
|
|
626
|
+
const id = getRandomID();
|
|
627
|
+
evalState.sendContentMessage({
|
|
628
|
+
type: "eval",
|
|
629
|
+
id,
|
|
630
|
+
code
|
|
631
|
+
});
|
|
632
|
+
const deferred = new Deferred(id);
|
|
633
|
+
evalState.pending.set(deferred.id, deferred);
|
|
634
|
+
return deferred.promise;
|
|
635
|
+
}
|
|
636
|
+
function resolveEval(id, value) {
|
|
637
|
+
const deferred = evalState.pending.get(id);
|
|
638
|
+
if (deferred) {
|
|
639
|
+
evalState.pending.delete(id);
|
|
640
|
+
deferred.timer && window.clearTimeout(deferred.timer);
|
|
641
|
+
deferred.resolve(value);
|
|
642
|
+
} else {
|
|
643
|
+
console.warn("no eval #", id);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
877
646
|
|
|
878
|
-
// lib/
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
647
|
+
// lib/eval-snippets.ts
|
|
648
|
+
var snippets = {
|
|
649
|
+
// code-based rules
|
|
650
|
+
EVAL_0: () => console.log(1),
|
|
651
|
+
EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
|
|
652
|
+
EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
|
|
653
|
+
EVAL_CONSENTMANAGER_3: () => __cmp("setConsent", 0),
|
|
654
|
+
EVAL_CONSENTMANAGER_4: () => __cmp("setConsent", 1),
|
|
655
|
+
EVAL_CONSENTMANAGER_5: () => __cmp("consentStatus").userChoiceExists,
|
|
656
|
+
EVAL_COOKIEBOT_1: () => window.CookieConsent.hasResponse !== true,
|
|
657
|
+
EVAL_COOKIEBOT_2: () => window.Cookiebot.dialog.submitConsent(),
|
|
658
|
+
EVAL_COOKIEBOT_3: () => endCookieProcess(),
|
|
659
|
+
EVAL_COOKIEBOT_4: () => window.CookieConsent.declined === true,
|
|
660
|
+
EVAL_KLARO_1: () => klaro.getManager().config.services.every((c) => c.required || !klaro.getManager().consents[c.name]),
|
|
661
|
+
EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
|
|
662
|
+
EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
|
|
663
|
+
// declarative rules
|
|
664
|
+
EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
|
|
665
|
+
EVAL_AFFINITY_SERIF_COM_0: () => document.cookie.includes("serif_manage_cookies_viewed") && !document.cookie.includes("serif_allow_analytics"),
|
|
666
|
+
EVAL_AXEPTIO_0: () => document.cookie.includes("axeptio_authorized_vendors=%2C%2C"),
|
|
667
|
+
EVAL_BING_0: () => document.cookie.includes("AL=0") && document.cookie.includes("AD=0") && document.cookie.includes("SM=0"),
|
|
668
|
+
EVAL_BORLABS_0: () => !JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("borlabs-cookie") !== -1).split("=", 2)[1])).consents.statistics,
|
|
669
|
+
EVAL_BUNDESREGIERUNG_DE_0: () => document.cookie.match("cookie-allow-tracking=0"),
|
|
670
|
+
EVAL_CANVA_0: () => !document.cookie.includes("gtm_fpc_engagement_event"),
|
|
671
|
+
EVAL_CLICKIO_0: () => document.cookie.includes("__lxG__consent__v2_daisybit="),
|
|
672
|
+
EVAL_CLINCH_0: () => document.cookie.includes("ctc_rejected=1"),
|
|
673
|
+
EVAL_COINBASE_0: () => JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1,
|
|
674
|
+
EVAL_COMPLIANZ_BANNER_0: () => document.cookie.includes("cmplz_banner-status=dismissed"),
|
|
675
|
+
EVAL_COMPLIANZ_CATEGORIES_0: () => !!document.cookie.match(/cmplz_[^=]+=deny/),
|
|
676
|
+
EVAL_COMPLIANZ_OPTIN_0: () => !!document.cookie.match(/cookieconsent_preferences_disabled=[^;]+/),
|
|
677
|
+
EVAL_COOKIE_LAW_INFO_0: () => CLI.disableAllCookies() || CLI.reject_close() || true,
|
|
678
|
+
EVAL_COOKIE_LAW_INFO_1: () => document.cookie.indexOf("cookielawinfo-checkbox-non-necessary=yes") === -1,
|
|
679
|
+
EVAL_COOKIE_MANAGER_POPUP_0: () => JSON.parse(document.cookie.split(";").find((c) => c.trim().startsWith("CookieLevel")).split("=")[1]).social === false,
|
|
680
|
+
EVAL_COOKIEALERT_0: () => document.querySelector("body").removeAttribute("style") || true,
|
|
681
|
+
EVAL_COOKIEALERT_1: () => document.querySelector("body").removeAttribute("style") || true,
|
|
682
|
+
EVAL_COOKIEALERT_2: () => window.CookieConsent.declined === true,
|
|
683
|
+
EVAL_COOKIEFIRST_0: () => ((o) => o.performance === false && o.functional === false && o.advertising === false)(JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("cookiefirst") !== -1).trim()).split("=")[1])),
|
|
684
|
+
EVAL_COOKIEFIRST_1: () => document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach((i) => i.getAttribute("aria-checked") == "true" && i.click()) || true,
|
|
685
|
+
EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
|
|
686
|
+
EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
|
|
687
|
+
EVAL_COOKIEINFORMATION_2: () => document.cookie.includes("CookieInformationConsent="),
|
|
688
|
+
EVAL_DAILYMOTION_0: () => !!document.cookie.match("dm-euconsent-v2"),
|
|
689
|
+
EVAL_DSGVO_0: () => !document.cookie.includes("sp_dsgvo_cookie_settings"),
|
|
690
|
+
EVAL_DUNELM_0: () => document.cookie.includes("cc_functional=0") && document.cookie.includes("cc_targeting=0"),
|
|
691
|
+
EVAL_ETSY_0: () => document.querySelectorAll(".gdpr-overlay-body input").forEach((toggle) => {
|
|
692
|
+
toggle.checked = false;
|
|
693
|
+
}) || true,
|
|
694
|
+
EVAL_ETSY_1: () => document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click() || true,
|
|
695
|
+
EVAL_EU_COOKIE_COMPLIANCE_0: () => document.cookie.indexOf("cookie-agreed=2") === -1,
|
|
696
|
+
EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes("euCookie"),
|
|
697
|
+
EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
|
|
698
|
+
EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
|
|
699
|
+
EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
|
|
700
|
+
EVAL_IUBENDA_0: () => document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach((x) => {
|
|
701
|
+
if (x.checked)
|
|
702
|
+
x.click();
|
|
703
|
+
}) || true,
|
|
704
|
+
EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
|
|
705
|
+
EVAL_JQUERY_COOKIEBAR_0: () => !document.cookie.includes("cookies-state=accepted"),
|
|
706
|
+
EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
|
|
707
|
+
EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
|
|
708
|
+
EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
|
|
709
|
+
EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
|
|
710
|
+
EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
|
|
711
|
+
if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
|
|
712
|
+
i.checked = false;
|
|
713
|
+
}) || true,
|
|
714
|
+
EVAL_ONENINETWO_0: () => document.cookie.includes("CC_ADVERTISING=NO") && document.cookie.includes("CC_ANALYTICS=NO"),
|
|
715
|
+
EVAL_PAYPAL_0: () => document.cookie.includes("cookie_prefs") === true,
|
|
716
|
+
EVAL_PRIMEBOX_0: () => !document.cookie.includes("cb-enabled=accepted"),
|
|
717
|
+
EVAL_PUBTECH_0: () => document.cookie.includes("euconsent-v2") && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)),
|
|
718
|
+
EVAL_REDDIT_0: () => document.cookie.includes("eu_cookie={%22opted%22:true%2C%22nonessential%22:false}"),
|
|
719
|
+
EVAL_SIBBO_0: () => !!window.localStorage.getItem("euconsent-v2"),
|
|
720
|
+
EVAL_SIRDATA_0: () => document.cookie.includes("euconsent-v2"),
|
|
721
|
+
EVAL_SNIGEL_0: () => !!document.cookie.match("snconsent"),
|
|
722
|
+
EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1])).preference_state === 2,
|
|
723
|
+
EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
|
|
724
|
+
EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
|
|
725
|
+
EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
|
|
726
|
+
EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
|
|
727
|
+
EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
|
|
728
|
+
EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
|
|
729
|
+
EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
|
|
730
|
+
EVAL_TESTCMP_0: () => window.results.results[0] === "button_clicked",
|
|
731
|
+
EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === "banner_hidden",
|
|
732
|
+
EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
|
|
733
|
+
EVAL_THEFREEDICTIONARY_1: () => cmpUi.allowAll() || true,
|
|
734
|
+
EVAL_THEVERGE_0: () => document.cookie.includes("_duet_gdpr_acknowledged=1"),
|
|
735
|
+
EVAL_UBUNTU_COM_0: () => document.cookie === "_cookies_accepted=essential",
|
|
736
|
+
EVAL_UK_COOKIE_CONSENT_0: () => !document.cookie.includes("catAccCookies"),
|
|
737
|
+
EVAL_USERCENTRICS_API_0: () => typeof UC_UI === "object",
|
|
738
|
+
EVAL_USERCENTRICS_API_1: () => !!UC_UI.closeCMP(),
|
|
739
|
+
EVAL_USERCENTRICS_API_2: () => !!UC_UI.denyAllConsents(),
|
|
740
|
+
EVAL_USERCENTRICS_API_3: () => !!UC_UI.acceptAllConsents(),
|
|
741
|
+
EVAL_USERCENTRICS_API_4: () => !!UC_UI.closeCMP(),
|
|
742
|
+
EVAL_USERCENTRICS_API_5: () => UC_UI.areAllConsentsAccepted() === true,
|
|
743
|
+
EVAL_USERCENTRICS_API_6: () => UC_UI.areAllConsentsAccepted() === false,
|
|
744
|
+
EVAL_USERCENTRICS_BUTTON_0: () => JSON.parse(localStorage.getItem("usercentrics")).consents.every((c) => c.isEssential || !c.consentStatus),
|
|
745
|
+
EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach((e) => e.click()) || true,
|
|
746
|
+
EVAL_WAITROSE_1: () => document.cookie.includes("wtr_cookies_advertising=0") && document.cookie.includes("wtr_cookies_analytics=0"),
|
|
747
|
+
EVAL_WP_COOKIE_NOTICE_0: () => document.cookie.includes("wpl_viewed_cookie=no"),
|
|
748
|
+
EVAL_XING_0: () => document.cookie.includes("userConsent=%7B%22marketing%22%3Afalse"),
|
|
749
|
+
EVAL_YOUTUBE_DESKTOP_0: () => !!document.cookie.match(/SOCS=CAE/),
|
|
750
|
+
EVAL_YOUTUBE_MOBILE_0: () => !!document.cookie.match(/SOCS=CAE/)
|
|
751
|
+
};
|
|
752
|
+
function getFunctionBody(snippetFunc) {
|
|
753
|
+
const snippetStr = snippetFunc.toString();
|
|
754
|
+
return snippetStr.substring(snippetStr.indexOf("=>") + 2);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// lib/cmps/base.ts
|
|
758
|
+
var defaultRunContext = {
|
|
759
|
+
main: true,
|
|
760
|
+
frame: false,
|
|
761
|
+
urlPattern: ""
|
|
762
|
+
};
|
|
763
|
+
var AutoConsentCMPBase = class {
|
|
764
|
+
constructor(autoconsentInstance) {
|
|
765
|
+
this.runContext = defaultRunContext;
|
|
766
|
+
this.autoconsent = autoconsentInstance;
|
|
886
767
|
}
|
|
887
768
|
get hasSelfTest() {
|
|
888
|
-
|
|
769
|
+
throw new Error("Not Implemented");
|
|
889
770
|
}
|
|
890
771
|
get isIntermediate() {
|
|
891
|
-
|
|
772
|
+
throw new Error("Not Implemented");
|
|
892
773
|
}
|
|
893
774
|
get isCosmetic() {
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
async detectCmp() {
|
|
897
|
-
return elementExists("#onetrust-banner-sdk");
|
|
775
|
+
throw new Error("Not Implemented");
|
|
898
776
|
}
|
|
899
|
-
|
|
900
|
-
|
|
777
|
+
mainWorldEval(snippetId) {
|
|
778
|
+
const snippet = snippets[snippetId];
|
|
779
|
+
if (!snippet) {
|
|
780
|
+
console.warn("Snippet not found", snippetId);
|
|
781
|
+
return Promise.resolve(false);
|
|
782
|
+
}
|
|
783
|
+
if (this.autoconsent.config.isMainWorld) {
|
|
784
|
+
enableLogs && console.log("inline eval:", snippetId, snippet);
|
|
785
|
+
let result = false;
|
|
786
|
+
try {
|
|
787
|
+
result = !!snippet.call(globalThis);
|
|
788
|
+
} catch (e) {
|
|
789
|
+
enableLogs && console.error("error evaluating rule", snippetId, e);
|
|
790
|
+
}
|
|
791
|
+
return Promise.resolve(result);
|
|
792
|
+
}
|
|
793
|
+
const snippetSrc = getFunctionBody(snippet);
|
|
794
|
+
enableLogs && console.log("async eval:", snippetId, snippetSrc);
|
|
795
|
+
return requestEval(snippetSrc).catch((e) => {
|
|
796
|
+
enableLogs && console.error("error evaluating rule", snippetId, e);
|
|
797
|
+
return false;
|
|
798
|
+
});
|
|
901
799
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
800
|
+
checkRunContext() {
|
|
801
|
+
const runCtx = {
|
|
802
|
+
...defaultRunContext,
|
|
803
|
+
...this.runContext
|
|
804
|
+
};
|
|
805
|
+
const isTop = window.top === window;
|
|
806
|
+
if (isTop && !runCtx.main) {
|
|
807
|
+
return false;
|
|
808
|
+
}
|
|
809
|
+
if (!isTop && !runCtx.frame) {
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
if (runCtx.urlPattern && !window.location.href.match(runCtx.urlPattern)) {
|
|
813
|
+
return false;
|
|
907
814
|
}
|
|
908
|
-
await waitForElement("#onetrust-consent-sdk", 2e3);
|
|
909
|
-
await wait(1e3);
|
|
910
|
-
click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
|
|
911
|
-
await wait(1e3);
|
|
912
|
-
await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
|
|
913
|
-
click(".save-preference-btn-handler,.js-consent-save");
|
|
914
|
-
await waitFor(
|
|
915
|
-
() => elementVisible("#onetrust-banner-sdk", "none"),
|
|
916
|
-
10,
|
|
917
|
-
500
|
|
918
|
-
);
|
|
919
815
|
return true;
|
|
920
816
|
}
|
|
921
|
-
|
|
922
|
-
|
|
817
|
+
detectCmp() {
|
|
818
|
+
throw new Error("Not Implemented");
|
|
819
|
+
}
|
|
820
|
+
async detectPopup() {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
optOut() {
|
|
824
|
+
throw new Error("Not Implemented");
|
|
825
|
+
}
|
|
826
|
+
optIn() {
|
|
827
|
+
throw new Error("Not Implemented");
|
|
828
|
+
}
|
|
829
|
+
openCmp() {
|
|
830
|
+
throw new Error("Not Implemented");
|
|
923
831
|
}
|
|
924
832
|
async test() {
|
|
925
|
-
return
|
|
833
|
+
return Promise.resolve(true);
|
|
926
834
|
}
|
|
927
835
|
};
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
this.
|
|
934
|
-
this.settingsOpen = false;
|
|
836
|
+
var AutoConsentCMP = class extends AutoConsentCMPBase {
|
|
837
|
+
constructor(config, autoconsentInstance) {
|
|
838
|
+
super(autoconsentInstance);
|
|
839
|
+
this.config = config;
|
|
840
|
+
this.name = config.name;
|
|
841
|
+
this.runContext = config.runContext || defaultRunContext;
|
|
935
842
|
}
|
|
936
843
|
get hasSelfTest() {
|
|
937
|
-
return
|
|
844
|
+
return !!this.config.test;
|
|
938
845
|
}
|
|
939
846
|
get isIntermediate() {
|
|
940
|
-
return
|
|
847
|
+
return !!this.config.intermediate;
|
|
941
848
|
}
|
|
942
849
|
get isCosmetic() {
|
|
943
|
-
return
|
|
850
|
+
return !!this.config.cosmetic;
|
|
851
|
+
}
|
|
852
|
+
get prehideSelectors() {
|
|
853
|
+
return this.config.prehideSelectors;
|
|
944
854
|
}
|
|
945
855
|
async detectCmp() {
|
|
946
|
-
if (
|
|
947
|
-
this.
|
|
948
|
-
return true;
|
|
856
|
+
if (this.config.detectCmp) {
|
|
857
|
+
return this._runRulesParallel(this.config.detectCmp);
|
|
949
858
|
}
|
|
950
|
-
return
|
|
859
|
+
return false;
|
|
951
860
|
}
|
|
952
861
|
async detectPopup() {
|
|
953
|
-
|
|
862
|
+
if (this.config.detectPopup) {
|
|
863
|
+
return this._runRulesSequentially(this.config.detectPopup);
|
|
864
|
+
}
|
|
865
|
+
return false;
|
|
954
866
|
}
|
|
955
867
|
async optOut() {
|
|
956
|
-
if (
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
if (!this.settingsOpen) {
|
|
960
|
-
click(".klaro .cn-learn-more");
|
|
961
|
-
await waitForElement(".klaro > .cookie-modal", 2e3);
|
|
962
|
-
this.settingsOpen = true;
|
|
963
|
-
}
|
|
964
|
-
if (click(".klaro .cn-decline")) {
|
|
965
|
-
return true;
|
|
868
|
+
if (this.config.optOut) {
|
|
869
|
+
enableLogs && console.log("Initiated optOut()", this.config.optOut);
|
|
870
|
+
return this._runRulesSequentially(this.config.optOut);
|
|
966
871
|
}
|
|
967
|
-
|
|
968
|
-
return click(".cm-btn-accept");
|
|
872
|
+
return false;
|
|
969
873
|
}
|
|
970
874
|
async optIn() {
|
|
971
|
-
if (
|
|
972
|
-
|
|
875
|
+
if (this.config.optIn) {
|
|
876
|
+
enableLogs && console.log("Initiated optIn()", this.config.optIn);
|
|
877
|
+
return this._runRulesSequentially(this.config.optIn);
|
|
973
878
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
async openCmp() {
|
|
882
|
+
if (this.config.openCmp) {
|
|
883
|
+
return this._runRulesSequentially(this.config.openCmp);
|
|
977
884
|
}
|
|
978
|
-
return
|
|
885
|
+
return false;
|
|
979
886
|
}
|
|
980
887
|
async test() {
|
|
981
|
-
|
|
888
|
+
if (this.hasSelfTest) {
|
|
889
|
+
return this._runRulesSequentially(this.config.test);
|
|
890
|
+
}
|
|
891
|
+
return super.test();
|
|
982
892
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
893
|
+
async evaluateRuleStep(rule) {
|
|
894
|
+
const results = [];
|
|
895
|
+
if (rule.exists) {
|
|
896
|
+
results.push(elementExists(rule.exists));
|
|
897
|
+
}
|
|
898
|
+
if (rule.visible) {
|
|
899
|
+
results.push(elementVisible(rule.visible, rule.check));
|
|
900
|
+
}
|
|
901
|
+
if (rule.eval) {
|
|
902
|
+
const res = this.mainWorldEval(rule.eval);
|
|
903
|
+
results.push(res);
|
|
904
|
+
}
|
|
905
|
+
if (rule.waitFor) {
|
|
906
|
+
results.push(waitForElement(rule.waitFor, rule.timeout));
|
|
907
|
+
}
|
|
908
|
+
if (rule.waitForVisible) {
|
|
909
|
+
results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
|
|
910
|
+
}
|
|
911
|
+
if (rule.click) {
|
|
912
|
+
results.push(click(rule.click, rule.all));
|
|
913
|
+
}
|
|
914
|
+
if (rule.waitForThenClick) {
|
|
915
|
+
results.push(waitForThenClick2(rule.waitForThenClick, rule.timeout, rule.all));
|
|
916
|
+
}
|
|
917
|
+
if (rule.wait) {
|
|
918
|
+
results.push(wait(rule.wait));
|
|
919
|
+
}
|
|
920
|
+
if (rule.hide) {
|
|
921
|
+
results.push(hide(rule.hide, rule.method));
|
|
922
|
+
}
|
|
923
|
+
if (rule.if) {
|
|
924
|
+
if (!rule.if.exists && !rule.if.visible) {
|
|
925
|
+
console.error("invalid conditional rule", rule.if);
|
|
926
|
+
return false;
|
|
927
|
+
}
|
|
928
|
+
const condition = await this.evaluateRuleStep(rule.if);
|
|
929
|
+
enableLogs && console.log("Condition is", condition);
|
|
930
|
+
if (condition) {
|
|
931
|
+
results.push(this._runRulesSequentially(rule.then));
|
|
932
|
+
} else if (rule.else) {
|
|
933
|
+
results.push(this._runRulesSequentially(rule.else));
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (rule.any) {
|
|
937
|
+
for (const step of rule.any) {
|
|
938
|
+
if (await this.evaluateRuleStep(step)) {
|
|
939
|
+
return true;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
return false;
|
|
943
|
+
}
|
|
944
|
+
if (results.length === 0) {
|
|
945
|
+
enableLogs && console.warn("Unrecognized rule", rule);
|
|
946
|
+
return false;
|
|
947
|
+
}
|
|
948
|
+
const all = await Promise.all(results);
|
|
949
|
+
return all.reduce((a, b) => a && b, true);
|
|
989
950
|
}
|
|
990
|
-
|
|
991
|
-
|
|
951
|
+
async _runRulesParallel(rules) {
|
|
952
|
+
const results = rules.map((rule) => this.evaluateRuleStep(rule));
|
|
953
|
+
const detections = await Promise.all(results);
|
|
954
|
+
return detections.every((r) => !!r);
|
|
992
955
|
}
|
|
993
|
-
|
|
956
|
+
async _runRulesSequentially(rules) {
|
|
957
|
+
for (const rule of rules) {
|
|
958
|
+
enableLogs && console.log("Running rule...", rule);
|
|
959
|
+
const result = await this.evaluateRuleStep(rule);
|
|
960
|
+
enableLogs && console.log("...rule result", result);
|
|
961
|
+
if (!result && !rule.optional) {
|
|
962
|
+
return false;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
994
965
|
return true;
|
|
995
966
|
}
|
|
967
|
+
};
|
|
968
|
+
|
|
969
|
+
// lib/cmps/consentomatic.ts
|
|
970
|
+
var ConsentOMaticCMP = class {
|
|
971
|
+
constructor(name, config) {
|
|
972
|
+
this.name = name;
|
|
973
|
+
this.config = config;
|
|
974
|
+
this.methods = /* @__PURE__ */ new Map();
|
|
975
|
+
this.runContext = defaultRunContext;
|
|
976
|
+
this.isCosmetic = false;
|
|
977
|
+
config.methods.forEach((methodConfig) => {
|
|
978
|
+
if (methodConfig.action) {
|
|
979
|
+
this.methods.set(methodConfig.name, methodConfig.action);
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
this.hasSelfTest = false;
|
|
983
|
+
}
|
|
996
984
|
get isIntermediate() {
|
|
997
985
|
return false;
|
|
998
986
|
}
|
|
999
|
-
|
|
1000
|
-
return
|
|
987
|
+
checkRunContext() {
|
|
988
|
+
return true;
|
|
1001
989
|
}
|
|
1002
990
|
async detectCmp() {
|
|
1003
|
-
|
|
991
|
+
const matchResults = this.config.detectors.map(
|
|
992
|
+
(detectorConfig) => matches(detectorConfig.presentMatcher)
|
|
993
|
+
);
|
|
994
|
+
return matchResults.some((r) => !!r);
|
|
1004
995
|
}
|
|
1005
996
|
async detectPopup() {
|
|
1006
|
-
|
|
997
|
+
const matchResults = this.config.detectors.map(
|
|
998
|
+
(detectorConfig) => matches(detectorConfig.showingMatcher)
|
|
999
|
+
);
|
|
1000
|
+
return matchResults.some((r) => !!r);
|
|
1007
1001
|
}
|
|
1008
|
-
async
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
const text = button.textContent;
|
|
1012
|
-
if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
|
|
1013
|
-
button.click();
|
|
1014
|
-
}
|
|
1015
|
-
});
|
|
1016
|
-
if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
|
|
1017
|
-
await waitForElement(".unic button", 1e3);
|
|
1018
|
-
document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
|
|
1019
|
-
if (c.checked) {
|
|
1020
|
-
c.click();
|
|
1021
|
-
}
|
|
1022
|
-
});
|
|
1023
|
-
for (const b of document.querySelectorAll(".unic button")) {
|
|
1024
|
-
const text = b.textContent;
|
|
1025
|
-
for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
|
|
1026
|
-
if (text.includes(pattern)) {
|
|
1027
|
-
b.click();
|
|
1028
|
-
await wait(500);
|
|
1029
|
-
return true;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1002
|
+
async executeAction(method, param) {
|
|
1003
|
+
if (this.methods.has(method)) {
|
|
1004
|
+
return executeAction(this.methods.get(method), param);
|
|
1033
1005
|
}
|
|
1034
|
-
return
|
|
1006
|
+
return true;
|
|
1007
|
+
}
|
|
1008
|
+
async optOut() {
|
|
1009
|
+
await this.executeAction("HIDE_CMP");
|
|
1010
|
+
await this.executeAction("OPEN_OPTIONS");
|
|
1011
|
+
await this.executeAction("HIDE_CMP");
|
|
1012
|
+
await this.executeAction("DO_CONSENT", []);
|
|
1013
|
+
await this.executeAction("SAVE_CONSENT");
|
|
1014
|
+
return true;
|
|
1035
1015
|
}
|
|
1036
1016
|
async optIn() {
|
|
1037
|
-
|
|
1017
|
+
await this.executeAction("HIDE_CMP");
|
|
1018
|
+
await this.executeAction("OPEN_OPTIONS");
|
|
1019
|
+
await this.executeAction("HIDE_CMP");
|
|
1020
|
+
await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
|
|
1021
|
+
await this.executeAction("SAVE_CONSENT");
|
|
1022
|
+
return true;
|
|
1023
|
+
}
|
|
1024
|
+
async openCmp() {
|
|
1025
|
+
await this.executeAction("HIDE_CMP");
|
|
1026
|
+
await this.executeAction("OPEN_OPTIONS");
|
|
1027
|
+
return true;
|
|
1038
1028
|
}
|
|
1039
1029
|
async test() {
|
|
1040
|
-
|
|
1041
|
-
const res = elementExists(".unic .unic-box,.unic .unic-bar");
|
|
1042
|
-
return !res;
|
|
1030
|
+
return true;
|
|
1043
1031
|
}
|
|
1044
1032
|
};
|
|
1045
1033
|
|
|
1046
|
-
// lib/cmps/
|
|
1047
|
-
var
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1034
|
+
// lib/cmps/trustarc-top.ts
|
|
1035
|
+
var cookieSettingsButton = "#truste-show-consent";
|
|
1036
|
+
var shortcutOptOut = "#truste-consent-required";
|
|
1037
|
+
var shortcutOptIn = "#truste-consent-button";
|
|
1038
|
+
var popupContent = "#truste-consent-content";
|
|
1039
|
+
var bannerOverlay = "#trustarc-banner-overlay";
|
|
1040
|
+
var bannerContainer = "#truste-consent-track";
|
|
1041
|
+
var TrustArcTop = class extends AutoConsentCMPBase {
|
|
1042
|
+
constructor(autoconsentInstance) {
|
|
1043
|
+
super(autoconsentInstance);
|
|
1044
|
+
this.name = "TrustArc-top";
|
|
1045
|
+
this.prehideSelectors = [
|
|
1046
|
+
".trustarc-banner-container",
|
|
1047
|
+
`.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`
|
|
1048
|
+
];
|
|
1049
|
+
this.runContext = {
|
|
1050
|
+
main: true,
|
|
1051
|
+
frame: false
|
|
1052
|
+
};
|
|
1053
|
+
this._shortcutButton = null;
|
|
1054
|
+
this._optInDone = false;
|
|
1051
1055
|
}
|
|
1052
1056
|
get hasSelfTest() {
|
|
1053
|
-
return
|
|
1057
|
+
return false;
|
|
1054
1058
|
}
|
|
1055
1059
|
get isIntermediate() {
|
|
1056
|
-
|
|
1060
|
+
if (this._optInDone) {
|
|
1061
|
+
return false;
|
|
1062
|
+
}
|
|
1063
|
+
return !this._shortcutButton;
|
|
1057
1064
|
}
|
|
1058
1065
|
get isCosmetic() {
|
|
1059
1066
|
return false;
|
|
1060
1067
|
}
|
|
1061
1068
|
async detectCmp() {
|
|
1062
|
-
|
|
1069
|
+
const result = elementExists(`${cookieSettingsButton},${bannerContainer}`);
|
|
1070
|
+
if (result) {
|
|
1071
|
+
this._shortcutButton = document.querySelector(shortcutOptOut);
|
|
1072
|
+
}
|
|
1073
|
+
return result;
|
|
1063
1074
|
}
|
|
1064
1075
|
async detectPopup() {
|
|
1065
|
-
return elementVisible(
|
|
1076
|
+
return elementVisible(`${popupContent},${bannerOverlay},${bannerContainer}`, "all");
|
|
1077
|
+
}
|
|
1078
|
+
openFrame() {
|
|
1079
|
+
click(cookieSettingsButton);
|
|
1066
1080
|
}
|
|
1067
1081
|
async optOut() {
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
if (!await waitForElement(".cmp-view-tab-tabs")) {
|
|
1072
|
-
return false;
|
|
1073
|
-
}
|
|
1074
|
-
await waitForThenClick(".cmp-view-tab-tabs > :first-child");
|
|
1075
|
-
await waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
|
|
1076
|
-
for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
|
|
1077
|
-
item.querySelector(".cmp-accordion-item-title").click();
|
|
1078
|
-
await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
|
|
1079
|
-
const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
|
|
1080
|
-
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
|
|
1081
|
-
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
|
|
1082
|
+
if (this._shortcutButton) {
|
|
1083
|
+
this._shortcutButton.click();
|
|
1084
|
+
return true;
|
|
1082
1085
|
}
|
|
1083
|
-
|
|
1086
|
+
hideElements(
|
|
1087
|
+
getStyleElement(),
|
|
1088
|
+
[".truste_popframe", ".truste_overlay", ".truste_box_overlay", bannerContainer]
|
|
1089
|
+
);
|
|
1090
|
+
click(cookieSettingsButton);
|
|
1091
|
+
setTimeout(() => {
|
|
1092
|
+
getStyleElement().remove();
|
|
1093
|
+
}, 1e4);
|
|
1084
1094
|
return true;
|
|
1085
1095
|
}
|
|
1086
|
-
async optIn() {
|
|
1087
|
-
|
|
1096
|
+
async optIn() {
|
|
1097
|
+
this._optInDone = true;
|
|
1098
|
+
return click(shortcutOptIn);
|
|
1099
|
+
}
|
|
1100
|
+
async openCmp() {
|
|
1101
|
+
return true;
|
|
1088
1102
|
}
|
|
1089
1103
|
async test() {
|
|
1090
|
-
return
|
|
1104
|
+
return await this.mainWorldEval("EVAL_TRUSTARC_TOP");
|
|
1091
1105
|
}
|
|
1092
1106
|
};
|
|
1093
1107
|
|
|
1094
|
-
// lib/cmps/
|
|
1095
|
-
var
|
|
1108
|
+
// lib/cmps/trustarc-frame.ts
|
|
1109
|
+
var TrustArcFrame = class extends AutoConsentCMPBase {
|
|
1096
1110
|
constructor() {
|
|
1097
|
-
super(
|
|
1111
|
+
super(...arguments);
|
|
1112
|
+
this.name = "TrustArc-frame";
|
|
1098
1113
|
this.runContext = {
|
|
1099
|
-
|
|
1114
|
+
main: false,
|
|
1115
|
+
frame: true,
|
|
1116
|
+
urlPattern: "^https://consent-pref\\.trustarc\\.com/\\?"
|
|
1100
1117
|
};
|
|
1101
1118
|
}
|
|
1102
1119
|
get hasSelfTest() {
|
|
1103
|
-
return
|
|
1120
|
+
return false;
|
|
1104
1121
|
}
|
|
1105
1122
|
get isIntermediate() {
|
|
1106
1123
|
return false;
|
|
@@ -1108,63 +1125,77 @@ var Tiktok = class extends AutoConsentCMPBase {
|
|
|
1108
1125
|
get isCosmetic() {
|
|
1109
1126
|
return false;
|
|
1110
1127
|
}
|
|
1111
|
-
getShadowRoot() {
|
|
1112
|
-
const container = document.querySelector("tiktok-cookie-banner");
|
|
1113
|
-
if (!container) {
|
|
1114
|
-
return null;
|
|
1115
|
-
}
|
|
1116
|
-
return container.shadowRoot;
|
|
1117
|
-
}
|
|
1118
1128
|
async detectCmp() {
|
|
1119
|
-
return
|
|
1129
|
+
return true;
|
|
1120
1130
|
}
|
|
1121
1131
|
async detectPopup() {
|
|
1122
|
-
|
|
1123
|
-
|
|
1132
|
+
return elementVisible("#defaultpreferencemanager", "any") && elementVisible(".mainContent", "any");
|
|
1133
|
+
}
|
|
1134
|
+
async navigateToSettings() {
|
|
1135
|
+
await waitFor(
|
|
1136
|
+
async () => {
|
|
1137
|
+
return elementExists(".shp") || elementVisible(".advance", "any") || elementExists(".switch span:first-child");
|
|
1138
|
+
},
|
|
1139
|
+
10,
|
|
1140
|
+
500
|
|
1141
|
+
);
|
|
1142
|
+
if (elementExists(".shp")) {
|
|
1143
|
+
click(".shp");
|
|
1144
|
+
}
|
|
1145
|
+
await waitForElement(".prefPanel", 5e3);
|
|
1146
|
+
if (elementVisible(".advance", "any")) {
|
|
1147
|
+
click(".advance");
|
|
1148
|
+
}
|
|
1149
|
+
return await waitFor(
|
|
1150
|
+
() => elementVisible(".switch span:first-child", "any"),
|
|
1151
|
+
5,
|
|
1152
|
+
1e3
|
|
1153
|
+
);
|
|
1124
1154
|
}
|
|
1125
1155
|
async optOut() {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
declineButton.click();
|
|
1156
|
+
await waitFor(() => document.readyState === "complete", 20, 100);
|
|
1157
|
+
await waitForElement(".mainContent[aria-hidden=false]", 5e3);
|
|
1158
|
+
if (click(".rejectAll")) {
|
|
1130
1159
|
return true;
|
|
1131
|
-
} else {
|
|
1132
|
-
enableLogs && console.log("no decline button found");
|
|
1133
|
-
return false;
|
|
1134
1160
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
if (
|
|
1139
|
-
|
|
1140
|
-
|
|
1161
|
+
if (elementExists(".prefPanel")) {
|
|
1162
|
+
await waitForElement('.prefPanel[style="visibility: visible;"]', 3e3);
|
|
1163
|
+
}
|
|
1164
|
+
if (click("#catDetails0")) {
|
|
1165
|
+
click(".submit");
|
|
1166
|
+
waitForThenClick("#gwt-debug-close_id", 5e3);
|
|
1167
|
+
return true;
|
|
1168
|
+
}
|
|
1169
|
+
if (click(".required")) {
|
|
1170
|
+
waitForThenClick("#gwt-debug-close_id", 5e3);
|
|
1141
1171
|
return true;
|
|
1142
|
-
} else {
|
|
1143
|
-
enableLogs && console.log("no accept button found");
|
|
1144
|
-
return false;
|
|
1145
1172
|
}
|
|
1173
|
+
await this.navigateToSettings();
|
|
1174
|
+
click(".switch span:nth-child(1):not(.active)", true);
|
|
1175
|
+
click(".submit");
|
|
1176
|
+
waitForThenClick("#gwt-debug-close_id", 3e5);
|
|
1177
|
+
return true;
|
|
1146
1178
|
}
|
|
1147
|
-
async
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
return false;
|
|
1179
|
+
async optIn() {
|
|
1180
|
+
if (click(".call")) {
|
|
1181
|
+
return true;
|
|
1151
1182
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1183
|
+
await this.navigateToSettings();
|
|
1184
|
+
click(".switch span:nth-child(2)", true);
|
|
1185
|
+
click(".submit");
|
|
1186
|
+
waitForElement("#gwt-debug-close_id", 3e5).then(() => {
|
|
1187
|
+
click("#gwt-debug-close_id");
|
|
1188
|
+
});
|
|
1189
|
+
return true;
|
|
1154
1190
|
}
|
|
1155
1191
|
};
|
|
1156
1192
|
|
|
1157
|
-
// lib/cmps/
|
|
1158
|
-
var
|
|
1193
|
+
// lib/cmps/cookiebot.ts
|
|
1194
|
+
var Cookiebot = class extends AutoConsentCMPBase {
|
|
1159
1195
|
constructor() {
|
|
1160
|
-
super(
|
|
1161
|
-
this.
|
|
1162
|
-
|
|
1163
|
-
};
|
|
1164
|
-
this.prehideSelectors = [
|
|
1165
|
-
"div[data-testid=main-cookies-banner-container]",
|
|
1166
|
-
'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
|
|
1167
|
-
];
|
|
1196
|
+
super(...arguments);
|
|
1197
|
+
this.name = "Cybotcookiebot";
|
|
1198
|
+
this.prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"];
|
|
1168
1199
|
}
|
|
1169
1200
|
get hasSelfTest() {
|
|
1170
1201
|
return true;
|
|
@@ -1176,520 +1207,619 @@ var Airbnb = class extends AutoConsentCMPBase {
|
|
|
1176
1207
|
return false;
|
|
1177
1208
|
}
|
|
1178
1209
|
async detectCmp() {
|
|
1179
|
-
return elementExists("
|
|
1210
|
+
return elementExists("#CybotCookiebotDialogBodyLevelButtonPreferences");
|
|
1180
1211
|
}
|
|
1181
1212
|
async detectPopup() {
|
|
1182
|
-
return
|
|
1213
|
+
return elementExists("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner");
|
|
1183
1214
|
}
|
|
1184
1215
|
async optOut() {
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1216
|
+
if (click(".cookie-alert-extended-detail-link")) {
|
|
1217
|
+
await waitForElement(".cookie-alert-configuration", 2e3);
|
|
1218
|
+
click(".cookie-alert-configuration-input:checked", true);
|
|
1219
|
+
click(".cookie-alert-extended-button-secondary");
|
|
1220
|
+
return true;
|
|
1221
|
+
}
|
|
1222
|
+
if (elementExists("#dtcookie-container")) {
|
|
1223
|
+
return click(".h-dtcookie-decline");
|
|
1224
|
+
}
|
|
1225
|
+
if (click(".cookiebot__button--settings")) {
|
|
1226
|
+
return true;
|
|
1227
|
+
}
|
|
1228
|
+
if (click("#CybotCookiebotDialogBodyButtonDecline")) {
|
|
1229
|
+
return true;
|
|
1230
|
+
}
|
|
1231
|
+
click(".cookiebanner__link--details");
|
|
1232
|
+
click('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled', true);
|
|
1233
|
+
click("#CybotCookiebotDialogBodyButtonDecline");
|
|
1234
|
+
click("input[id^=CybotCookiebotDialogBodyLevelButton]:checked", true);
|
|
1235
|
+
if (elementExists("#CybotCookiebotDialogBodyButtonAcceptSelected")) {
|
|
1236
|
+
click("#CybotCookiebotDialogBodyButtonAcceptSelected");
|
|
1237
|
+
} else {
|
|
1238
|
+
click("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection", true);
|
|
1189
1239
|
}
|
|
1190
|
-
|
|
1240
|
+
if (await this.mainWorldEval("EVAL_COOKIEBOT_1")) {
|
|
1241
|
+
await this.mainWorldEval("EVAL_COOKIEBOT_2");
|
|
1242
|
+
await wait(500);
|
|
1243
|
+
}
|
|
1244
|
+
if (elementExists("#cb-confirmedSettings")) {
|
|
1245
|
+
await this.mainWorldEval("EVAL_COOKIEBOT_3");
|
|
1246
|
+
}
|
|
1247
|
+
return true;
|
|
1191
1248
|
}
|
|
1192
1249
|
async optIn() {
|
|
1193
|
-
|
|
1250
|
+
if (elementExists("#dtcookie-container")) {
|
|
1251
|
+
return click(".h-dtcookie-accept");
|
|
1252
|
+
}
|
|
1253
|
+
click(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled", true);
|
|
1254
|
+
click("#CybotCookiebotDialogBodyLevelButtonAccept");
|
|
1255
|
+
click("#CybotCookiebotDialogBodyButtonAccept");
|
|
1256
|
+
return true;
|
|
1194
1257
|
}
|
|
1195
1258
|
async test() {
|
|
1196
|
-
return
|
|
1197
|
-
() => !!document.cookie.match("OptanonAlertBoxClosed"),
|
|
1198
|
-
20,
|
|
1199
|
-
200
|
|
1200
|
-
);
|
|
1259
|
+
return this.mainWorldEval("EVAL_COOKIEBOT_4");
|
|
1201
1260
|
}
|
|
1202
1261
|
};
|
|
1203
1262
|
|
|
1204
|
-
// lib/cmps/
|
|
1205
|
-
var
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
new Tiktok(),
|
|
1217
|
-
new Airbnb()
|
|
1218
|
-
];
|
|
1219
|
-
function createAutoCMP(config) {
|
|
1220
|
-
return new AutoConsentCMP(config);
|
|
1221
|
-
}
|
|
1222
|
-
var all_default = rules;
|
|
1223
|
-
|
|
1224
|
-
// lib/index.ts
|
|
1225
|
-
var rules2 = all_default;
|
|
1226
|
-
|
|
1227
|
-
// lib/consentomatic/tools.ts
|
|
1228
|
-
var _Tools = class _Tools {
|
|
1229
|
-
static setBase(base) {
|
|
1230
|
-
_Tools.base = base;
|
|
1263
|
+
// lib/cmps/sourcepoint-frame.ts
|
|
1264
|
+
var SourcePoint = class extends AutoConsentCMPBase {
|
|
1265
|
+
constructor() {
|
|
1266
|
+
super(...arguments);
|
|
1267
|
+
this.name = "Sourcepoint-frame";
|
|
1268
|
+
this.prehideSelectors = ["div[id^='sp_message_container_'],.message-overlay", "#sp_privacy_manager_container"];
|
|
1269
|
+
this.ccpaNotice = false;
|
|
1270
|
+
this.ccpaPopup = false;
|
|
1271
|
+
this.runContext = {
|
|
1272
|
+
main: false,
|
|
1273
|
+
frame: true
|
|
1274
|
+
};
|
|
1231
1275
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1247
|
-
if (options.textFilter != null) {
|
|
1248
|
-
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
1249
|
-
const textContent = possibleTarget.textContent.toLowerCase();
|
|
1250
|
-
if (Array.isArray(options.textFilter)) {
|
|
1251
|
-
let foundText = false;
|
|
1252
|
-
for (const text of options.textFilter) {
|
|
1253
|
-
if (textContent.indexOf(text.toLowerCase()) !== -1) {
|
|
1254
|
-
foundText = true;
|
|
1255
|
-
break;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
return foundText;
|
|
1259
|
-
} else if (options.textFilter != null) {
|
|
1260
|
-
return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
if (options.styleFilters != null) {
|
|
1265
|
-
possibleTargets = possibleTargets.filter((possibleTarget) => {
|
|
1266
|
-
const styles = window.getComputedStyle(possibleTarget);
|
|
1267
|
-
let keep = true;
|
|
1268
|
-
for (const styleFilter of options.styleFilters) {
|
|
1269
|
-
const option = styles[styleFilter.option];
|
|
1270
|
-
if (styleFilter.negated) {
|
|
1271
|
-
keep = keep && option !== styleFilter.value;
|
|
1272
|
-
} else {
|
|
1273
|
-
keep = keep && option === styleFilter.value;
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
return keep;
|
|
1277
|
-
});
|
|
1276
|
+
get hasSelfTest() {
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
get isIntermediate() {
|
|
1280
|
+
return false;
|
|
1281
|
+
}
|
|
1282
|
+
get isCosmetic() {
|
|
1283
|
+
return false;
|
|
1284
|
+
}
|
|
1285
|
+
async detectCmp() {
|
|
1286
|
+
const url = new URL(location.href);
|
|
1287
|
+
if (url.searchParams.has("message_id") && url.hostname === "ccpa-notice.sp-prod.net") {
|
|
1288
|
+
this.ccpaNotice = true;
|
|
1289
|
+
return true;
|
|
1278
1290
|
}
|
|
1279
|
-
if (
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
return possibleTarget.offsetHeight !== 0;
|
|
1283
|
-
} else {
|
|
1284
|
-
return possibleTarget.offsetHeight === 0;
|
|
1285
|
-
}
|
|
1286
|
-
});
|
|
1291
|
+
if (url.hostname === "ccpa-pm.sp-prod.net") {
|
|
1292
|
+
this.ccpaPopup = true;
|
|
1293
|
+
return true;
|
|
1287
1294
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
return window.location === window.parent.location;
|
|
1294
|
-
}
|
|
1295
|
-
});
|
|
1295
|
+
return (url.pathname === "/index.html" || url.pathname === "/privacy-manager/index.html") && (url.searchParams.has("message_id") || url.searchParams.has("requestUUID") || url.searchParams.has("consentUUID"));
|
|
1296
|
+
}
|
|
1297
|
+
async detectPopup() {
|
|
1298
|
+
if (this.ccpaNotice) {
|
|
1299
|
+
return true;
|
|
1296
1300
|
}
|
|
1297
|
-
if (
|
|
1298
|
-
|
|
1299
|
-
const oldBase = _Tools.base;
|
|
1300
|
-
_Tools.setBase(possibleTarget);
|
|
1301
|
-
const childResults = _Tools.find(options.childFilter);
|
|
1302
|
-
_Tools.setBase(oldBase);
|
|
1303
|
-
return childResults.target != null;
|
|
1304
|
-
});
|
|
1301
|
+
if (this.ccpaPopup) {
|
|
1302
|
+
return await waitForElement(".priv-save-btn", 2e3);
|
|
1305
1303
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
}
|
|
1317
|
-
return possibleTargets[0];
|
|
1304
|
+
await waitForElement(".sp_choice_type_11,.sp_choice_type_12,.sp_choice_type_13,.sp_choice_type_ACCEPT_ALL", 2e3);
|
|
1305
|
+
return !elementExists(".sp_choice_type_9");
|
|
1306
|
+
}
|
|
1307
|
+
async optIn() {
|
|
1308
|
+
await waitForElement(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL", 2e3);
|
|
1309
|
+
if (click(".sp_choice_type_11")) {
|
|
1310
|
+
return true;
|
|
1311
|
+
}
|
|
1312
|
+
if (click(".sp_choice_type_ACCEPT_ALL")) {
|
|
1313
|
+
return true;
|
|
1318
1314
|
}
|
|
1315
|
+
return false;
|
|
1319
1316
|
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
if (targets instanceof Array) {
|
|
1329
|
-
targets.forEach((target) => {
|
|
1330
|
-
results.push({
|
|
1331
|
-
parent: p,
|
|
1332
|
-
target
|
|
1333
|
-
});
|
|
1334
|
-
});
|
|
1335
|
-
} else {
|
|
1336
|
-
results.push({
|
|
1337
|
-
parent: p,
|
|
1338
|
-
target: targets
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
});
|
|
1342
|
-
return results;
|
|
1343
|
-
} else {
|
|
1344
|
-
const targets = _Tools.findElement(options.target, parent, multiple);
|
|
1345
|
-
if (targets instanceof Array) {
|
|
1346
|
-
targets.forEach((target) => {
|
|
1347
|
-
results.push({
|
|
1348
|
-
parent,
|
|
1349
|
-
target
|
|
1350
|
-
});
|
|
1351
|
-
});
|
|
1352
|
-
} else {
|
|
1353
|
-
results.push({
|
|
1354
|
-
parent,
|
|
1355
|
-
target: targets
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1317
|
+
isManagerOpen() {
|
|
1318
|
+
return location.pathname === "/privacy-manager/index.html";
|
|
1319
|
+
}
|
|
1320
|
+
async optOut() {
|
|
1321
|
+
if (this.ccpaPopup) {
|
|
1322
|
+
const toggles = document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.neutral.on .right");
|
|
1323
|
+
for (const t of toggles) {
|
|
1324
|
+
t.click();
|
|
1359
1325
|
}
|
|
1360
|
-
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
targets.forEach((target) => {
|
|
1364
|
-
results.push({
|
|
1365
|
-
parent: null,
|
|
1366
|
-
target
|
|
1367
|
-
});
|
|
1368
|
-
});
|
|
1369
|
-
} else {
|
|
1370
|
-
results.push({
|
|
1371
|
-
parent: null,
|
|
1372
|
-
target: targets
|
|
1373
|
-
});
|
|
1326
|
+
const switches = document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.switch-bg.on");
|
|
1327
|
+
for (const t of switches) {
|
|
1328
|
+
t.click();
|
|
1374
1329
|
}
|
|
1330
|
+
return click(".priv-save-btn");
|
|
1375
1331
|
}
|
|
1376
|
-
if (
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
}
|
|
1332
|
+
if (!this.isManagerOpen()) {
|
|
1333
|
+
const actionable = await waitForElement(".sp_choice_type_12,.sp_choice_type_13");
|
|
1334
|
+
if (!actionable) {
|
|
1335
|
+
return false;
|
|
1336
|
+
}
|
|
1337
|
+
if (!elementExists(".sp_choice_type_12")) {
|
|
1338
|
+
return click(".sp_choice_type_13");
|
|
1339
|
+
}
|
|
1340
|
+
click(".sp_choice_type_12");
|
|
1341
|
+
await waitFor(
|
|
1342
|
+
() => this.isManagerOpen(),
|
|
1343
|
+
200,
|
|
1344
|
+
100
|
|
1345
|
+
);
|
|
1381
1346
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
)
|
|
1347
|
+
await waitForElement(".type-modal", 2e4);
|
|
1348
|
+
try {
|
|
1349
|
+
const rejectSelector1 = ".sp_choice_type_REJECT_ALL";
|
|
1350
|
+
const rejectSelector2 = ".reject-toggle";
|
|
1351
|
+
const path = await Promise.race([
|
|
1352
|
+
waitForElement(rejectSelector1, 2e3).then((success) => success ? 0 : -1),
|
|
1353
|
+
waitForElement(rejectSelector2, 2e3).then((success) => success ? 1 : -1),
|
|
1354
|
+
waitForElement(".pm-features", 2e3).then((success) => success ? 2 : -1)
|
|
1355
|
+
]);
|
|
1356
|
+
if (path === 0) {
|
|
1357
|
+
await wait(1e3);
|
|
1358
|
+
return click(rejectSelector1);
|
|
1359
|
+
} else if (path === 1) {
|
|
1360
|
+
click(rejectSelector2);
|
|
1361
|
+
} else if (path === 2) {
|
|
1362
|
+
await waitForElement(".pm-features", 1e4);
|
|
1363
|
+
click(".checked > span", true);
|
|
1364
|
+
click(".chevron");
|
|
1390
1365
|
}
|
|
1391
|
-
|
|
1366
|
+
} catch (e) {
|
|
1367
|
+
enableLogs && console.warn(e);
|
|
1392
1368
|
}
|
|
1369
|
+
return click(".sp_choice_type_SAVE_AND_EXIT");
|
|
1393
1370
|
}
|
|
1394
1371
|
};
|
|
1395
|
-
_Tools.base = null;
|
|
1396
|
-
var Tools = _Tools;
|
|
1397
1372
|
|
|
1398
|
-
// lib/
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1373
|
+
// lib/cmps/consentmanager.ts
|
|
1374
|
+
var ConsentManager = class extends AutoConsentCMPBase {
|
|
1375
|
+
constructor() {
|
|
1376
|
+
super(...arguments);
|
|
1377
|
+
this.name = "consentmanager.net";
|
|
1378
|
+
this.prehideSelectors = ["#cmpbox,#cmpbox2"];
|
|
1379
|
+
this.apiAvailable = false;
|
|
1405
1380
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
switch (config.type) {
|
|
1409
|
-
case "click":
|
|
1410
|
-
return clickAction(config);
|
|
1411
|
-
case "list":
|
|
1412
|
-
return listAction(config, param);
|
|
1413
|
-
case "consent":
|
|
1414
|
-
return consentAction(config, param);
|
|
1415
|
-
case "ifcss":
|
|
1416
|
-
return ifCssAction(config, param);
|
|
1417
|
-
case "waitcss":
|
|
1418
|
-
return waitCssAction(config);
|
|
1419
|
-
case "foreach":
|
|
1420
|
-
return forEachAction(config, param);
|
|
1421
|
-
case "hide":
|
|
1422
|
-
return hideAction(config);
|
|
1423
|
-
case "slide":
|
|
1424
|
-
return slideAction(config);
|
|
1425
|
-
case "close":
|
|
1426
|
-
return closeAction();
|
|
1427
|
-
case "wait":
|
|
1428
|
-
return waitAction(config);
|
|
1429
|
-
case "eval":
|
|
1430
|
-
return evalAction(config);
|
|
1431
|
-
default:
|
|
1432
|
-
throw "Unknown action type: " + config.type;
|
|
1381
|
+
get hasSelfTest() {
|
|
1382
|
+
return this.apiAvailable;
|
|
1433
1383
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
function waitTimeout(timeout) {
|
|
1437
|
-
return new Promise((resolve) => {
|
|
1438
|
-
setTimeout(() => {
|
|
1439
|
-
resolve();
|
|
1440
|
-
}, timeout);
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
async function clickAction(config) {
|
|
1444
|
-
const result = Tools.find(config);
|
|
1445
|
-
if (result.target != null) {
|
|
1446
|
-
result.target.click();
|
|
1384
|
+
get isIntermediate() {
|
|
1385
|
+
return false;
|
|
1447
1386
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
async function listAction(config, param) {
|
|
1451
|
-
for (const action of config.actions) {
|
|
1452
|
-
await executeAction(action, param);
|
|
1387
|
+
get isCosmetic() {
|
|
1388
|
+
return false;
|
|
1453
1389
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
if (consentConfig.matcher && consentConfig.toggleAction) {
|
|
1459
|
-
const isEnabled = matches(consentConfig.matcher);
|
|
1460
|
-
if (isEnabled !== shouldEnable) {
|
|
1461
|
-
await executeAction(consentConfig.toggleAction);
|
|
1462
|
-
}
|
|
1390
|
+
async detectCmp() {
|
|
1391
|
+
this.apiAvailable = await this.mainWorldEval("EVAL_CONSENTMANAGER_1");
|
|
1392
|
+
if (!this.apiAvailable) {
|
|
1393
|
+
return elementExists("#cmpbox");
|
|
1463
1394
|
} else {
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1395
|
+
return true;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
async detectPopup() {
|
|
1399
|
+
if (this.apiAvailable) {
|
|
1400
|
+
await wait(500);
|
|
1401
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_2");
|
|
1402
|
+
}
|
|
1403
|
+
return elementVisible("#cmpbox .cmpmore", "any");
|
|
1404
|
+
}
|
|
1405
|
+
async optOut() {
|
|
1406
|
+
await wait(500);
|
|
1407
|
+
if (this.apiAvailable) {
|
|
1408
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_3");
|
|
1409
|
+
}
|
|
1410
|
+
if (click(".cmpboxbtnno")) {
|
|
1411
|
+
return true;
|
|
1412
|
+
}
|
|
1413
|
+
if (elementExists(".cmpwelcomeprpsbtn")) {
|
|
1414
|
+
click(".cmpwelcomeprpsbtn > a[aria-checked=true]", true);
|
|
1415
|
+
click(".cmpboxbtnsave");
|
|
1416
|
+
return true;
|
|
1417
|
+
}
|
|
1418
|
+
click(".cmpboxbtncustom");
|
|
1419
|
+
await waitForElement(".cmptblbox", 2e3);
|
|
1420
|
+
click(".cmptdchoice > a[aria-checked=true]", true);
|
|
1421
|
+
click(".cmpboxbtnyescustomchoices");
|
|
1422
|
+
return true;
|
|
1423
|
+
}
|
|
1424
|
+
async optIn() {
|
|
1425
|
+
if (this.apiAvailable) {
|
|
1426
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_4");
|
|
1469
1427
|
}
|
|
1428
|
+
return click(".cmpboxbtnyes");
|
|
1470
1429
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
if (!result.target) {
|
|
1475
|
-
if (config.trueAction) {
|
|
1476
|
-
await executeAction(config.trueAction, param);
|
|
1430
|
+
async test() {
|
|
1431
|
+
if (this.apiAvailable) {
|
|
1432
|
+
return await this.mainWorldEval("EVAL_CONSENTMANAGER_5");
|
|
1477
1433
|
}
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
// lib/cmps/evidon.ts
|
|
1438
|
+
var Evidon = class extends AutoConsentCMPBase {
|
|
1439
|
+
constructor() {
|
|
1440
|
+
super(...arguments);
|
|
1441
|
+
this.name = "Evidon";
|
|
1442
|
+
}
|
|
1443
|
+
get hasSelfTest() {
|
|
1444
|
+
return false;
|
|
1445
|
+
}
|
|
1446
|
+
get isIntermediate() {
|
|
1447
|
+
return false;
|
|
1448
|
+
}
|
|
1449
|
+
get isCosmetic() {
|
|
1450
|
+
return false;
|
|
1451
|
+
}
|
|
1452
|
+
async detectCmp() {
|
|
1453
|
+
return elementExists("#_evidon_banner");
|
|
1454
|
+
}
|
|
1455
|
+
async detectPopup() {
|
|
1456
|
+
return elementVisible("#_evidon_banner", "any");
|
|
1457
|
+
}
|
|
1458
|
+
async optOut() {
|
|
1459
|
+
if (click("#_evidon-decline-button")) {
|
|
1460
|
+
return true;
|
|
1481
1461
|
}
|
|
1462
|
+
hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
|
|
1463
|
+
click("#_evidon-option-button");
|
|
1464
|
+
await waitForElement("#evidon-prefdiag-overlay", 5e3);
|
|
1465
|
+
click("#evidon-prefdiag-decline");
|
|
1466
|
+
return true;
|
|
1482
1467
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
}
|
|
1497
|
-
} else {
|
|
1498
|
-
resolve();
|
|
1499
|
-
}
|
|
1468
|
+
async optIn() {
|
|
1469
|
+
return click("#_evidon-accept-button");
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
// lib/cmps/onetrust.ts
|
|
1474
|
+
var Onetrust = class extends AutoConsentCMPBase {
|
|
1475
|
+
constructor() {
|
|
1476
|
+
super(...arguments);
|
|
1477
|
+
this.name = "Onetrust";
|
|
1478
|
+
this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
|
|
1479
|
+
this.runContext = {
|
|
1480
|
+
urlPattern: "^(?!.*https://www\\.nba\\.com/)"
|
|
1500
1481
|
};
|
|
1501
|
-
checkCss();
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
async function forEachAction(config, param) {
|
|
1505
|
-
const results = Tools.find(config, true);
|
|
1506
|
-
const oldBase = Tools.base;
|
|
1507
|
-
for (const result of results) {
|
|
1508
|
-
if (result.target) {
|
|
1509
|
-
Tools.setBase(result.target);
|
|
1510
|
-
await executeAction(config.action, param);
|
|
1511
|
-
}
|
|
1512
1482
|
}
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
async function hideAction(config) {
|
|
1516
|
-
const result = Tools.find(config);
|
|
1517
|
-
if (result.target) {
|
|
1518
|
-
result.target.classList.add("Autoconsent-Hidden");
|
|
1483
|
+
get hasSelfTest() {
|
|
1484
|
+
return true;
|
|
1519
1485
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1486
|
+
get isIntermediate() {
|
|
1487
|
+
return false;
|
|
1488
|
+
}
|
|
1489
|
+
get isCosmetic() {
|
|
1490
|
+
return false;
|
|
1491
|
+
}
|
|
1492
|
+
async detectCmp() {
|
|
1493
|
+
return elementExists("#onetrust-banner-sdk");
|
|
1494
|
+
}
|
|
1495
|
+
async detectPopup() {
|
|
1496
|
+
return elementVisible("#onetrust-banner-sdk", "all");
|
|
1497
|
+
}
|
|
1498
|
+
async optOut() {
|
|
1499
|
+
if (elementExists("#onetrust-pc-btn-handler")) {
|
|
1500
|
+
click("#onetrust-pc-btn-handler");
|
|
1501
|
+
} else {
|
|
1502
|
+
click(".ot-sdk-show-settings,button.js-cookie-settings");
|
|
1534
1503
|
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
0,
|
|
1546
|
-
screenX,
|
|
1547
|
-
screenY,
|
|
1548
|
-
clientX,
|
|
1549
|
-
clientY,
|
|
1550
|
-
false,
|
|
1551
|
-
false,
|
|
1552
|
-
false,
|
|
1553
|
-
false,
|
|
1554
|
-
0,
|
|
1555
|
-
result.target
|
|
1556
|
-
);
|
|
1557
|
-
const mouseMove = document.createEvent("MouseEvents");
|
|
1558
|
-
mouseMove.initMouseEvent(
|
|
1559
|
-
"mousemove",
|
|
1560
|
-
true,
|
|
1561
|
-
true,
|
|
1562
|
-
window,
|
|
1563
|
-
0,
|
|
1564
|
-
screenX + xDiff,
|
|
1565
|
-
screenY + yDiff,
|
|
1566
|
-
clientX + xDiff,
|
|
1567
|
-
clientY + yDiff,
|
|
1568
|
-
false,
|
|
1569
|
-
false,
|
|
1570
|
-
false,
|
|
1571
|
-
false,
|
|
1572
|
-
0,
|
|
1573
|
-
result.target
|
|
1574
|
-
);
|
|
1575
|
-
const mouseUp = document.createEvent("MouseEvents");
|
|
1576
|
-
mouseUp.initMouseEvent(
|
|
1577
|
-
"mouseup",
|
|
1578
|
-
true,
|
|
1579
|
-
true,
|
|
1580
|
-
window,
|
|
1581
|
-
0,
|
|
1582
|
-
screenX + xDiff,
|
|
1583
|
-
screenY + yDiff,
|
|
1584
|
-
clientX + xDiff,
|
|
1585
|
-
clientY + yDiff,
|
|
1586
|
-
false,
|
|
1587
|
-
false,
|
|
1588
|
-
false,
|
|
1589
|
-
false,
|
|
1590
|
-
0,
|
|
1591
|
-
result.target
|
|
1504
|
+
await waitForElement("#onetrust-consent-sdk", 2e3);
|
|
1505
|
+
await wait(1e3);
|
|
1506
|
+
click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
|
|
1507
|
+
await wait(1e3);
|
|
1508
|
+
await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
|
|
1509
|
+
click(".save-preference-btn-handler,.js-consent-save");
|
|
1510
|
+
await waitFor(
|
|
1511
|
+
() => elementVisible("#onetrust-banner-sdk", "none"),
|
|
1512
|
+
10,
|
|
1513
|
+
500
|
|
1592
1514
|
);
|
|
1593
|
-
|
|
1594
|
-
await this.waitTimeout(10);
|
|
1595
|
-
result.target.dispatchEvent(mouseMove);
|
|
1596
|
-
await this.waitTimeout(10);
|
|
1597
|
-
result.target.dispatchEvent(mouseUp);
|
|
1515
|
+
return true;
|
|
1598
1516
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1517
|
+
async optIn() {
|
|
1518
|
+
return click("#onetrust-accept-btn-handler,.js-accept-cookies");
|
|
1519
|
+
}
|
|
1520
|
+
async test() {
|
|
1521
|
+
return await this.mainWorldEval("EVAL_ONETRUST_1");
|
|
1522
|
+
}
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
// lib/cmps/klaro.ts
|
|
1526
|
+
var Klaro = class extends AutoConsentCMPBase {
|
|
1527
|
+
constructor() {
|
|
1528
|
+
super(...arguments);
|
|
1529
|
+
this.name = "Klaro";
|
|
1530
|
+
this.prehideSelectors = [".klaro"];
|
|
1531
|
+
this.settingsOpen = false;
|
|
1532
|
+
}
|
|
1533
|
+
get hasSelfTest() {
|
|
1534
|
+
return true;
|
|
1535
|
+
}
|
|
1536
|
+
get isIntermediate() {
|
|
1537
|
+
return false;
|
|
1538
|
+
}
|
|
1539
|
+
get isCosmetic() {
|
|
1540
|
+
return false;
|
|
1541
|
+
}
|
|
1542
|
+
async detectCmp() {
|
|
1543
|
+
if (elementExists(".klaro > .cookie-modal")) {
|
|
1544
|
+
this.settingsOpen = true;
|
|
1545
|
+
return true;
|
|
1546
|
+
}
|
|
1547
|
+
return elementExists(".klaro > .cookie-notice");
|
|
1548
|
+
}
|
|
1549
|
+
async detectPopup() {
|
|
1550
|
+
return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
|
|
1551
|
+
}
|
|
1552
|
+
async optOut() {
|
|
1553
|
+
if (click(".klaro .cn-decline")) {
|
|
1554
|
+
return true;
|
|
1555
|
+
}
|
|
1556
|
+
if (!this.settingsOpen) {
|
|
1557
|
+
click(".klaro .cn-learn-more");
|
|
1558
|
+
await waitForElement(".klaro > .cookie-modal", 2e3);
|
|
1559
|
+
this.settingsOpen = true;
|
|
1621
1560
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1561
|
+
if (click(".klaro .cn-decline")) {
|
|
1562
|
+
return true;
|
|
1563
|
+
}
|
|
1564
|
+
click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
|
|
1565
|
+
return click(".cm-btn-accept");
|
|
1566
|
+
}
|
|
1567
|
+
async optIn() {
|
|
1568
|
+
if (click(".klaro .cm-btn-accept-all")) {
|
|
1569
|
+
return true;
|
|
1570
|
+
}
|
|
1571
|
+
if (this.settingsOpen) {
|
|
1572
|
+
click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
|
|
1573
|
+
return click(".cm-btn-accept");
|
|
1574
|
+
}
|
|
1575
|
+
return click(".klaro .cookie-notice .cm-btn-success");
|
|
1576
|
+
}
|
|
1577
|
+
async test() {
|
|
1578
|
+
return await this.mainWorldEval("EVAL_KLARO_1");
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1624
1581
|
|
|
1625
|
-
// lib/cmps/
|
|
1626
|
-
var
|
|
1627
|
-
constructor(
|
|
1628
|
-
|
|
1629
|
-
this.
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
this.hasSelfTest = false;
|
|
1582
|
+
// lib/cmps/uniconsent.ts
|
|
1583
|
+
var Uniconsent = class extends AutoConsentCMPBase {
|
|
1584
|
+
constructor() {
|
|
1585
|
+
super(...arguments);
|
|
1586
|
+
this.name = "Uniconsent";
|
|
1587
|
+
}
|
|
1588
|
+
get prehideSelectors() {
|
|
1589
|
+
return [".unic", ".modal:has(.unic)"];
|
|
1590
|
+
}
|
|
1591
|
+
get hasSelfTest() {
|
|
1592
|
+
return true;
|
|
1639
1593
|
}
|
|
1640
1594
|
get isIntermediate() {
|
|
1641
1595
|
return false;
|
|
1642
1596
|
}
|
|
1643
|
-
|
|
1644
|
-
return
|
|
1597
|
+
get isCosmetic() {
|
|
1598
|
+
return false;
|
|
1645
1599
|
}
|
|
1646
1600
|
async detectCmp() {
|
|
1647
|
-
|
|
1648
|
-
(detectorConfig) => matches(detectorConfig.presentMatcher)
|
|
1649
|
-
);
|
|
1650
|
-
return matchResults.some((r) => !!r);
|
|
1601
|
+
return elementExists(".unic .unic-box,.unic .unic-bar");
|
|
1651
1602
|
}
|
|
1652
1603
|
async detectPopup() {
|
|
1653
|
-
|
|
1654
|
-
(detectorConfig) => matches(detectorConfig.showingMatcher)
|
|
1655
|
-
);
|
|
1656
|
-
return matchResults.some((r) => !!r);
|
|
1604
|
+
return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
|
|
1657
1605
|
}
|
|
1658
|
-
async
|
|
1659
|
-
|
|
1660
|
-
|
|
1606
|
+
async optOut() {
|
|
1607
|
+
await waitForElement(".unic button", 1e3);
|
|
1608
|
+
document.querySelectorAll(".unic button").forEach((button) => {
|
|
1609
|
+
const text = button.textContent;
|
|
1610
|
+
if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
|
|
1611
|
+
button.click();
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
|
|
1615
|
+
await waitForElement(".unic button", 1e3);
|
|
1616
|
+
document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
|
|
1617
|
+
if (c.checked) {
|
|
1618
|
+
c.click();
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
for (const b of document.querySelectorAll(".unic button")) {
|
|
1622
|
+
const text = b.textContent;
|
|
1623
|
+
for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
|
|
1624
|
+
if (text.includes(pattern)) {
|
|
1625
|
+
b.click();
|
|
1626
|
+
await wait(500);
|
|
1627
|
+
return true;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1661
1631
|
}
|
|
1632
|
+
return false;
|
|
1633
|
+
}
|
|
1634
|
+
async optIn() {
|
|
1635
|
+
return waitForThenClick2(".unic #unic-agree");
|
|
1636
|
+
}
|
|
1637
|
+
async test() {
|
|
1638
|
+
await wait(1e3);
|
|
1639
|
+
const res = elementExists(".unic .unic-box,.unic .unic-bar");
|
|
1640
|
+
return !res;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
// lib/cmps/conversant.ts
|
|
1645
|
+
var Conversant = class extends AutoConsentCMPBase {
|
|
1646
|
+
constructor() {
|
|
1647
|
+
super(...arguments);
|
|
1648
|
+
this.prehideSelectors = [".cmp-root"];
|
|
1649
|
+
this.name = "Conversant";
|
|
1650
|
+
}
|
|
1651
|
+
get hasSelfTest() {
|
|
1662
1652
|
return true;
|
|
1663
1653
|
}
|
|
1654
|
+
get isIntermediate() {
|
|
1655
|
+
return false;
|
|
1656
|
+
}
|
|
1657
|
+
get isCosmetic() {
|
|
1658
|
+
return false;
|
|
1659
|
+
}
|
|
1660
|
+
async detectCmp() {
|
|
1661
|
+
return elementExists(".cmp-root .cmp-receptacle");
|
|
1662
|
+
}
|
|
1663
|
+
async detectPopup() {
|
|
1664
|
+
return elementVisible(".cmp-root .cmp-receptacle", "any");
|
|
1665
|
+
}
|
|
1664
1666
|
async optOut() {
|
|
1665
|
-
await
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
await
|
|
1669
|
-
|
|
1667
|
+
if (!await waitForThenClick2(".cmp-main-button:not(.cmp-main-button--primary)")) {
|
|
1668
|
+
return false;
|
|
1669
|
+
}
|
|
1670
|
+
if (!await waitForElement(".cmp-view-tab-tabs")) {
|
|
1671
|
+
return false;
|
|
1672
|
+
}
|
|
1673
|
+
await waitForThenClick2(".cmp-view-tab-tabs > :first-child");
|
|
1674
|
+
await waitForThenClick2(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
|
|
1675
|
+
for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
|
|
1676
|
+
item.querySelector(".cmp-accordion-item-title").click();
|
|
1677
|
+
await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
|
|
1678
|
+
const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
|
|
1679
|
+
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
|
|
1680
|
+
content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
|
|
1681
|
+
}
|
|
1682
|
+
await click(".cmp-main-button:not(.cmp-main-button--primary)");
|
|
1670
1683
|
return true;
|
|
1671
1684
|
}
|
|
1672
1685
|
async optIn() {
|
|
1673
|
-
|
|
1674
|
-
await this.executeAction("OPEN_OPTIONS");
|
|
1675
|
-
await this.executeAction("HIDE_CMP");
|
|
1676
|
-
await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
|
|
1677
|
-
await this.executeAction("SAVE_CONSENT");
|
|
1678
|
-
return true;
|
|
1686
|
+
return waitForThenClick2(".cmp-main-button.cmp-main-button--primary");
|
|
1679
1687
|
}
|
|
1680
|
-
async
|
|
1681
|
-
|
|
1682
|
-
|
|
1688
|
+
async test() {
|
|
1689
|
+
return document.cookie.includes("cmp-data=0");
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
// lib/cmps/tiktok.ts
|
|
1694
|
+
var Tiktok = class extends AutoConsentCMPBase {
|
|
1695
|
+
constructor() {
|
|
1696
|
+
super(...arguments);
|
|
1697
|
+
this.name = "tiktok.com";
|
|
1698
|
+
this.runContext = {
|
|
1699
|
+
urlPattern: "tiktok"
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
get hasSelfTest() {
|
|
1683
1703
|
return true;
|
|
1684
1704
|
}
|
|
1705
|
+
get isIntermediate() {
|
|
1706
|
+
return false;
|
|
1707
|
+
}
|
|
1708
|
+
get isCosmetic() {
|
|
1709
|
+
return false;
|
|
1710
|
+
}
|
|
1711
|
+
getShadowRoot() {
|
|
1712
|
+
const container = document.querySelector("tiktok-cookie-banner");
|
|
1713
|
+
if (!container) {
|
|
1714
|
+
return null;
|
|
1715
|
+
}
|
|
1716
|
+
return container.shadowRoot;
|
|
1717
|
+
}
|
|
1718
|
+
async detectCmp() {
|
|
1719
|
+
return elementExists("tiktok-cookie-banner");
|
|
1720
|
+
}
|
|
1721
|
+
async detectPopup() {
|
|
1722
|
+
const banner = this.getShadowRoot().querySelector(".tiktok-cookie-banner");
|
|
1723
|
+
return isElementVisible(banner);
|
|
1724
|
+
}
|
|
1725
|
+
async optOut() {
|
|
1726
|
+
const declineButton = this.getShadowRoot().querySelector(".button-wrapper button:first-child");
|
|
1727
|
+
if (declineButton) {
|
|
1728
|
+
enableLogs && console.log("[clicking]", declineButton);
|
|
1729
|
+
declineButton.click();
|
|
1730
|
+
return true;
|
|
1731
|
+
} else {
|
|
1732
|
+
enableLogs && console.log("no decline button found");
|
|
1733
|
+
return false;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
async optIn() {
|
|
1737
|
+
const acceptButton = this.getShadowRoot().querySelector(".button-wrapper button:last-child");
|
|
1738
|
+
if (acceptButton) {
|
|
1739
|
+
enableLogs && console.log("[clicking]", acceptButton);
|
|
1740
|
+
acceptButton.click();
|
|
1741
|
+
return true;
|
|
1742
|
+
} else {
|
|
1743
|
+
enableLogs && console.log("no accept button found");
|
|
1744
|
+
return false;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1685
1747
|
async test() {
|
|
1748
|
+
const match = document.cookie.match(/cookie-consent=([^;]+)/);
|
|
1749
|
+
if (!match) {
|
|
1750
|
+
return false;
|
|
1751
|
+
}
|
|
1752
|
+
const value = JSON.parse(decodeURIComponent(match[1]));
|
|
1753
|
+
return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
|
|
1757
|
+
// lib/cmps/airbnb.ts
|
|
1758
|
+
var Airbnb = class extends AutoConsentCMPBase {
|
|
1759
|
+
constructor() {
|
|
1760
|
+
super(...arguments);
|
|
1761
|
+
this.runContext = {
|
|
1762
|
+
urlPattern: "^https://(www\\.)?airbnb\\.[^/]+/"
|
|
1763
|
+
};
|
|
1764
|
+
this.prehideSelectors = [
|
|
1765
|
+
"div[data-testid=main-cookies-banner-container]",
|
|
1766
|
+
'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
|
|
1767
|
+
];
|
|
1768
|
+
}
|
|
1769
|
+
get hasSelfTest() {
|
|
1686
1770
|
return true;
|
|
1687
1771
|
}
|
|
1772
|
+
get isIntermediate() {
|
|
1773
|
+
return false;
|
|
1774
|
+
}
|
|
1775
|
+
get isCosmetic() {
|
|
1776
|
+
return false;
|
|
1777
|
+
}
|
|
1778
|
+
async detectCmp() {
|
|
1779
|
+
return elementExists("div[data-testid=main-cookies-banner-container]");
|
|
1780
|
+
}
|
|
1781
|
+
async detectPopup() {
|
|
1782
|
+
return elementVisible("div[data-testid=main-cookies-banner-container", "any");
|
|
1783
|
+
}
|
|
1784
|
+
async optOut() {
|
|
1785
|
+
await waitForThenClick2("div[data-testid=main-cookies-banner-container] button._snbhip0");
|
|
1786
|
+
let check;
|
|
1787
|
+
while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
|
|
1788
|
+
check.click();
|
|
1789
|
+
}
|
|
1790
|
+
return waitForThenClick2("button[data-testid=save-btn]");
|
|
1791
|
+
}
|
|
1792
|
+
async optIn() {
|
|
1793
|
+
return waitForThenClick2("div[data-testid=main-cookies-banner-container] button._148dgdpk");
|
|
1794
|
+
}
|
|
1795
|
+
async test() {
|
|
1796
|
+
return await waitFor(
|
|
1797
|
+
() => !!document.cookie.match("OptanonAlertBoxClosed"),
|
|
1798
|
+
20,
|
|
1799
|
+
200
|
|
1800
|
+
);
|
|
1801
|
+
}
|
|
1688
1802
|
};
|
|
1689
1803
|
|
|
1804
|
+
// lib/cmps/all.ts
|
|
1805
|
+
var dynamicCMPs = [
|
|
1806
|
+
TrustArcTop,
|
|
1807
|
+
TrustArcFrame,
|
|
1808
|
+
Cookiebot,
|
|
1809
|
+
SourcePoint,
|
|
1810
|
+
ConsentManager,
|
|
1811
|
+
Evidon,
|
|
1812
|
+
Onetrust,
|
|
1813
|
+
Klaro,
|
|
1814
|
+
Uniconsent,
|
|
1815
|
+
Conversant,
|
|
1816
|
+
Tiktok,
|
|
1817
|
+
Airbnb
|
|
1818
|
+
];
|
|
1819
|
+
|
|
1690
1820
|
// lib/web.ts
|
|
1691
|
-
function filterCMPs(
|
|
1692
|
-
return
|
|
1821
|
+
function filterCMPs(rules, config) {
|
|
1822
|
+
return rules.filter((cmp) => {
|
|
1693
1823
|
return (!config.disabledCmps || !config.disabledCmps.includes(cmp.name)) && (config.enableCosmeticRules || !cmp.isCosmetic);
|
|
1694
1824
|
});
|
|
1695
1825
|
}
|
|
@@ -1708,14 +1838,15 @@ var AutoConsent = class {
|
|
|
1708
1838
|
};
|
|
1709
1839
|
evalState.sendContentMessage = sendContentMessage;
|
|
1710
1840
|
this.sendContentMessage = sendContentMessage;
|
|
1711
|
-
this.rules = [
|
|
1841
|
+
this.rules = [];
|
|
1712
1842
|
enableLogs && console.log("autoconsent init", window.location.href);
|
|
1713
1843
|
this.updateState({ lifecycle: "loading" });
|
|
1844
|
+
this.addDynamicRules();
|
|
1714
1845
|
if (config) {
|
|
1715
1846
|
this.initialize(config, declarativeRules);
|
|
1716
1847
|
} else {
|
|
1717
1848
|
if (declarativeRules) {
|
|
1718
|
-
this.
|
|
1849
|
+
this.parseDeclarativeRules(declarativeRules);
|
|
1719
1850
|
}
|
|
1720
1851
|
const initMsg = {
|
|
1721
1852
|
type: "init",
|
|
@@ -1732,7 +1863,7 @@ var AutoConsent = class {
|
|
|
1732
1863
|
return;
|
|
1733
1864
|
}
|
|
1734
1865
|
if (declarativeRules) {
|
|
1735
|
-
this.
|
|
1866
|
+
this.parseDeclarativeRules(declarativeRules);
|
|
1736
1867
|
}
|
|
1737
1868
|
this.rules = filterCMPs(this.rules, config);
|
|
1738
1869
|
if (config.enablePrehide) {
|
|
@@ -1757,17 +1888,22 @@ var AutoConsent = class {
|
|
|
1757
1888
|
}
|
|
1758
1889
|
this.updateState({ lifecycle: "initialized" });
|
|
1759
1890
|
}
|
|
1760
|
-
|
|
1891
|
+
addDynamicRules() {
|
|
1892
|
+
dynamicCMPs.forEach((cmp) => {
|
|
1893
|
+
this.rules.push(new cmp(this));
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
parseDeclarativeRules(declarativeRules) {
|
|
1761
1897
|
Object.keys(declarativeRules.consentomatic).forEach((name) => {
|
|
1762
1898
|
this.addConsentomaticCMP(name, declarativeRules.consentomatic[name]);
|
|
1763
1899
|
});
|
|
1764
|
-
declarativeRules.autoconsent.forEach((
|
|
1765
|
-
this.
|
|
1900
|
+
declarativeRules.autoconsent.forEach((ruleset) => {
|
|
1901
|
+
this.addDeclarativeCMP(ruleset);
|
|
1766
1902
|
});
|
|
1767
1903
|
enableLogs && console.log("added rules", this.rules);
|
|
1768
1904
|
}
|
|
1769
|
-
|
|
1770
|
-
this.rules.push(
|
|
1905
|
+
addDeclarativeCMP(ruleset) {
|
|
1906
|
+
this.rules.push(new AutoConsentCMP(ruleset, this));
|
|
1771
1907
|
}
|
|
1772
1908
|
addConsentomaticCMP(name, config) {
|
|
1773
1909
|
this.rules.push(new ConsentOMaticCMP(`com_${name}`, config));
|
|
@@ -1867,7 +2003,10 @@ var AutoConsent = class {
|
|
|
1867
2003
|
});
|
|
1868
2004
|
result.push(cmp);
|
|
1869
2005
|
}
|
|
1870
|
-
}).catch(() =>
|
|
2006
|
+
}).catch((e) => {
|
|
2007
|
+
enableLogs && console.warn(`error waiting for a popup for ${cmp.name}`, e);
|
|
2008
|
+
return null;
|
|
2009
|
+
}));
|
|
1871
2010
|
await Promise.all(popupLookups);
|
|
1872
2011
|
return result;
|
|
1873
2012
|
}
|
|
@@ -1960,7 +2099,10 @@ var AutoConsent = class {
|
|
|
1960
2099
|
}
|
|
1961
2100
|
async waitForPopup(cmp, retries = 5, interval = 500) {
|
|
1962
2101
|
enableLogs && console.log("checking if popup is open...", cmp.name);
|
|
1963
|
-
const isOpen = await cmp.detectPopup()
|
|
2102
|
+
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
2103
|
+
enableLogs && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
2104
|
+
return false;
|
|
2105
|
+
});
|
|
1964
2106
|
if (!isOpen && retries > 0) {
|
|
1965
2107
|
await wait(interval);
|
|
1966
2108
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
@@ -2024,8 +2166,3 @@ var AutoConsent = class {
|
|
|
2024
2166
|
}
|
|
2025
2167
|
}
|
|
2026
2168
|
};
|
|
2027
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2028
|
-
0 && (module.exports = {
|
|
2029
|
-
createAutoCMP,
|
|
2030
|
-
rules
|
|
2031
|
-
});
|