-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reject.js
46 lines (38 loc) · 1.08 KB
/
Reject.js
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
const MODALS_COOKIES = [
'#pmConsentWall',
'.popup-disagreed-cookies',
'#didomi-host',
'.didomi-popup',
'#onetrust-consent-sdk',
'#sp_message_container_1005436',
'#_an_cmp'
];
function hideCookieModal(selector) {
const modalCookies = document.querySelector(selector);
if (modalCookies) {
setTimeout(() => {
const body = document.querySelector('body');
const html = document.querySelector('html');
body.classList.remove(...body.classList);
html.classList.remove(...html.classList);
modalCookies.style.display = 'none';
body.style.overflow = 'auto';
}, 1000);
modalCookies.style.display = 'none';
}
};
function checkofExist(selector) {
if (document.querySelector(selector)) {
hideCookieModal(selector);
} else {
setTimeout(() => {
hideCookieModal(selector);
}, 800);
}
}
if (window.location.href.includes('elpais')) {
checkofExist("#pmConsentWall")
}
MODALS_COOKIES.forEach((modal) => {
checkofExist(modal);
});