Repository navigation
Expand file tree
/
Copy pathnocookie.js
More file actions
164 lines (156 loc) · 5.79 KB
/
Copy pathnocookie.js
File metadata and controls
164 lines (156 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// ═══════════════════════════════════
// superlevels: Cookie Consent Auto-Dismisser
// Based on I-Still-Dont-Care-About-Cookies
// ═══════════════════════════════════
(() => {
const STYLE_ID = "sl-nocookie";
const HIDE_CSS = `
#cookie-banner, #cookie-notice, #cookie-consent, #cookie-popup,
#cookiebanner, #cookienotice, #cookieconsent, #cookiepopup,
#cookie_banner, #cookie_notice, #cookie_consent, #cookie_popup,
.cookie-banner, .cookie-notice, .cookie-consent, .cookie-popup,
.cookiebanner, .cookienotice, .cookieconsent, .cookiepopup,
.cookie_banner, .cookie_notice, .cookie_consent, .cookie_popup,
#gdpr-banner, #gdpr-consent, .gdpr-banner, .gdpr-consent,
#cc-window, .cc-window, .cc-banner, .cc-overlay, .cc-revoke,
#onetrust-banner-sdk, #onetrust-consent-sdk, .onetrust-pc-dark-filter,
.ot-sdk-row, #ot-sdk-btn-floating,
.cky-consent-container, #cky-consent,
.didomi-popup, #didomi-host, #didomi-notice,
.sp-message-open, #sp_message_container_0,
[class*="cookie-banner"], [class*="cookie-consent"],
[id*="cookie-banner"], [id*="cookie-consent"],
[class*="CookieBanner"], [class*="CookieConsent"],
.fc-consent-root, .fc-dialog-overlay, .fc-dialog,
.qc-cmp-showing, #qcCmpUi, .qc-cmp2-container,
.truste_box_overlay, #truste-consent-track,
.osano-cm-dialog, .osano-cm-window,
[aria-label="Cookie banner"], [aria-label="cookie consent"],
.evidon-banner, #_evidon_banner,
.iubenda-cs-container, #iubenda-cs-banner,
.klaro, .cookie-modal-wrapper,
#usercentrics-root, [id^="usercentrics"],
.cmpboxBG, .cmpbox, #cmpbox, #cmpbox2,
.js-cookie-consent, .cookie-law-info-bar,
#cookie-law-info-bar, .cli-modal,
.eupopup, #eu-cookie-bar, .eu-cookie-compliance-banner,
#catapult-cookie-bar, .ct-ultimate-gdpr-cookie-popup,
.cookiealert, #cookiealert, .cookie-alert,
.consent-banner, #consent-banner, .consent-popup,
.privacy-notice, #privacy-notice, .privacy-banner,
.cc-floating, .cc-bottom, .cc-top,
[data-testid="cookie-banner"], [data-testid="cookie-consent"],
.snigel-cmp-framework, #snigel-cmp-framework,
.adroll_consent_banner, #adroll_consent_container,
.termly-consent-banner, #termly-code-snippet-support,
.CybotCookiebotDialog, #CybotCookiebotDialog,
#CybotCookiebotDialogBodyUnderlay,
.cmplz-cookiebanner, #cmplz-cookiebanner-container {
display: none !important;
visibility: hidden !important;
height: 0 !important;
max-height: 0 !important;
overflow: hidden !important;
opacity: 0 !important;
pointer-events: none !important;
z-index: -99999 !important;
}
body.cookie-consent-open,
body.modal-open-cookie,
body.no-scroll,
body.sp-message-open,
body.cmplz-blocked-content-container,
html.sp-message-open,
html.cookie-consent-open,
body.ot-overflow-hidden,
html.ot-overflow-hidden {
overflow: auto !important;
position: static !important;
}
.cc-grower { max-height: 0 !important; }
`;
const CLICK_SELECTORS = [
"#onetrust-accept-btn-handler",
"#accept-recommended-btn-handler",
".onetrust-close-btn-handler",
"#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowAll",
"#CybotCookiebotDialogBodyButtonAccept",
"#CybotCookiebotDialogBodyLevelButtonAccept",
".cky-btn-accept",
"#didomi-notice-agree-button",
".didomi-continue-without-agreeing",
".qc-cmp2-summary-buttons button[mode='primary']",
".qc-cmp-button[mode='primary']",
".fc-cta-consent .fc-primary-button",
".cc-accept", ".cc-btn.cc-dismiss", ".cc-allow",
"[data-cookiefirst-action='accept']",
".cookie-accept", ".js-cookie-accept",
".agree-button", "#agree-button",
".cli-plugin-accept-btn",
"#cookie_action_close_header",
".eupopup-button_1",
"#eu-cookie-compliance-accept",
".iubenda-cs-accept-btn",
"[data-action='accept']",
".osano-cm-accept-all",
".accept-cookies-button",
"button[data-gdpr='accept']",
".js-accept-cookies",
".cmplz-btn.cmplz-accept",
".snigel-cmp-accept-all",
'button[title="Accept" i]',
'button[title="Accept all" i]',
'button[title="Accept All" i]',
'button[title="Allow all" i]',
'button[title="Allow All" i]',
'button[title="Agree" i]',
'[aria-label="Accept" i]',
'[aria-label="Accept all" i]',
'[aria-label="Accept cookies" i]',
'[aria-label="Allow all" i]',
'[aria-label="Agree" i]',
'[aria-label="Close" i][class*="cookie" i]',
'[aria-label="Close" i][class*="consent" i]',
];
function injectCSS() {
if (document.getElementById(STYLE_ID)) return;
const style = document.createElement("style");
style.id = STYLE_ID;
style.textContent = HIDE_CSS;
(document.head || document.documentElement).appendChild(style);
}
function tryClick() {
for (const sel of CLICK_SELECTORS) {
try {
const el = document.querySelector(sel);
if (el && el.offsetParent !== null) {
el.click();
return true;
}
} catch {}
}
return false;
}
function removeCSS() {
const el = document.getElementById(STYLE_ID);
if (el) el.remove();
}
function activate() {
injectCSS();
setTimeout(tryClick, 500);
setTimeout(tryClick, 1500);
setTimeout(tryClick, 3000);
setTimeout(tryClick, 5000);
}
// Check storage and apply
chrome.storage.local.get(["nocookie_enabled"], (data) => {
if (data.nocookie_enabled !== false) activate();
});
// Listen for toggle from popup
chrome.runtime.onMessage.addListener((msg) => {
if (msg.type === "nocookie_toggle") {
if (msg.enabled) activate();
else removeCSS();
}
});
})();