Aggiunto rilevamento sicuro

This commit is contained in:
loviuz 2023-06-18 17:40:43 +02:00
parent 2904c80773
commit 2717be8574

View File

@ -2,8 +2,7 @@
// @author loviuz
// @name No Cookiewall Italia
// @namespace https://este.linux.it
// @version 1.5.1
// @include *://*
// @version 1.6.0
// @license AGPL v3
// @description Permette di navigare siti web italiani di notizie evitando il cookiewall, il quale permette di accedere ai contenuti, già arrivati al browser, previa accettazione cookie o il pagamento di un abbonamento. Alcuni stabiliscono che questo comportamento dei siti non è lecito secondo il GDPR: in attesa di una pronuncia del garante della privacy propongo questo metodo per saltare questo blocco.
// @lang it
@ -14,64 +13,65 @@ var cookiewall_found = false;
var ci = setInterval( function(){
// Identifica il tipo di cookiewall
var is_iubenda = document.querySelector('#iubenda-cs-banner') || document.querySelector('#iubenda-cs-banner');
var is_privacycpwall = document.querySelector('.wall-modal') || document.querySelector('.privacy-cp-wall');
var is_onetrust_banner_sdk = document.querySelector('#onetrust-banner-sdk');
var is_iubenda = secureQuerySelector('#iubenda-cs-banner') || secureQuerySelector('#iubenda-cs-banner');
var is_privacycpwall = secureQuerySelector('.wall-modal') || secureQuerySelector('.privacy-cp-wall');
var is_onetrust_banner_sdk = secureQuerySelector('#onetrust-banner-sdk');
if (is_iubenda) {
var cookiewall_desktop = document.querySelector('.prompt-to-accept');
var cookiewall_mobile = document.querySelector('#iubenda-cs-banner');
var cookiewall_desktop = secureQuerySelector('.prompt-to-accept');
var cookiewall_mobile = secureQuerySelector('#iubenda-cs-banner');
// Cookiewall desktop
if (cookiewall_desktop) {
cookiewall_desktop.style.display = 'none';
document.querySelector('html').classList.remove('show-prompt-to-accept');
document.querySelector('html').style.overflow = 'auto';
secureQuerySelector('html').classList.remove('show-prompt-to-accept');
secureQuerySelector('.o-wrapper.iub--active').style.filter = 'none';
cookiewall_found = true;
}
// Cookiewall mobile
if (cookiewall_mobile) {
document.querySelector('#iubenda-cs-banner.iubenda-cs-visible').classList.remove('iubenda-cs-visible');
secureQuerySelector('#iubenda-cs-banner.iubenda-cs-visible').classList.remove('iubenda-cs-visible');
cookiewall_mobile.setAttribute('style', 'display:none !important');
document.querySelector('html').setAttribute('style', '');
document.querySelector('.adv-slot').style.display = 'none';
secureQuerySelector('html').setAttribute('style', '');
secureQuerySelector('.o-wrapper.iub--active').style.blur = 'none';
secureQuerySelector('.adv-slot').style.display = 'none';
cookiewall_found = true;
}
}
else if(is_privacycpwall){
var cookiewall_desktop = document.querySelector('.wall-modal');
var cookiewall_mobile = document.querySelector('.privacy-cp-wall');
var cookiewall_desktop = secureQuerySelector('.wall-modal');
var cookiewall_mobile = secureQuerySelector('.privacy-cp-wall');
// Cookiewall desktop
if (cookiewall_desktop) {
cookiewall_desktop.style.display = 'none';
document.querySelector('.tp-backdrop').style.display = 'none';
document.querySelector('body').classList.remove('tp-modal-open');
secureQuerySelector('.tp-backdrop').style.display = 'none';
secureQuerySelector('body').classList.remove('tp-modal-open');
cookiewall_found = true;
}
// Cookiewall mobile
if (cookiewall_mobile) {
cookiewall_mobile.style.display = 'none';
document.querySelector('body').classList.remove('noScroll');
secureQuerySelector('body').classList.remove('noScroll');
cookiewall_found = true;
}
}
else if(is_onetrust_banner_sdk){
var cookiewall = document.querySelector('#onetrust-banner-sdk');
var cookiewall = secureQuerySelector('#onetrust-banner-sdk');
// Cookiewall
if (cookiewall) {
cookiewall.style.position = 'absolute';
cookiewall.style.left = '-10000px';
document.querySelector('.onetrust-pc-dark-filter').style.position = 'absolute';
document.querySelector('.onetrust-pc-dark-filter').style.left = '-10000px';
secureQuerySelector('.onetrust-pc-dark-filter').style.position = 'absolute';
secureQuerySelector('.onetrust-pc-dark-filter').style.left = '-10000px';
document.querySelector('body').setAttribute('style', '');
secureQuerySelector('body').setAttribute('style', '');
cookiewall_found = true;
}
}
@ -80,3 +80,18 @@ var ci = setInterval( function(){
clearInterval(ci);
}
}, 1000 );
function secureQuerySelector(element){
if (document.querySelector(element)) {
return document.querySelector(element);
}else{
return generateElements('<div></div>');
}
}
function generateElements(html) {
const template = document.createElement('template');
template.innerHTML = html.trim();
return template.content.children[0];
}