This repository has been archived on 2023-07-23. You can view files and clone it, but cannot push or open issues or pull requests.
greasemonkey-scripts/no-cookiewall-italia.js

83 lines
3.3 KiB
JavaScript
Raw Normal View History

2023-04-02 14:09:39 +02:00
// ==UserScript==
2023-04-02 14:22:25 +02:00
// @author loviuz
2023-04-02 14:09:39 +02:00
// @name No Cookiewall Italia
// @namespace https://este.linux.it
2023-06-06 22:02:33 +02:00
// @version 1.5.1
2023-05-09 20:55:47 +02:00
// @include *://*
2023-04-02 14:09:39 +02:00
// @license AGPL v3
2023-05-09 20:55:47 +02:00
// @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.
2023-04-02 14:09:39 +02:00
// @lang it
// ==/UserScript==
2023-05-09 20:55:47 +02:00
var cookiewall_found = false;
2023-04-02 14:09:39 +02:00
2023-05-09 20:55:47 +02:00
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');
2023-04-02 15:26:41 +02:00
2023-05-09 20:55:47 +02:00
if (is_iubenda) {
var cookiewall_desktop = document.querySelector('.prompt-to-accept');
var cookiewall_mobile = document.querySelector('#iubenda-cs-banner');
2023-04-02 15:34:40 +02:00
2023-05-09 20:55:47 +02:00
// Cookiewall desktop
if (cookiewall_desktop) {
cookiewall_desktop.style.display = 'none';
document.querySelector('html').classList.remove('show-prompt-to-accept');
2023-06-06 22:01:38 +02:00
document.querySelector('html').style.overflow = 'auto';
2023-05-09 20:55:47 +02:00
cookiewall_found = true;
}
// Cookiewall mobile
if (cookiewall_mobile) {
document.querySelector('#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';
cookiewall_found = true;
}
}
2023-04-02 15:26:41 +02:00
2023-05-09 20:55:47 +02:00
else if(is_privacycpwall){
var cookiewall_desktop = document.querySelector('.wall-modal');
var cookiewall_mobile = document.querySelector('.privacy-cp-wall');
2023-04-02 15:26:41 +02:00
2023-05-09 20:55:47 +02:00
// 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');
cookiewall_found = true;
}
2023-04-02 16:21:23 +02:00
2023-05-09 20:55:47 +02:00
// Cookiewall mobile
if (cookiewall_mobile) {
cookiewall_mobile.style.display = 'none';
document.querySelector('body').classList.remove('noScroll');
cookiewall_found = true;
}
}
2023-04-02 16:21:23 +02:00
2023-05-09 20:55:47 +02:00
else if(is_onetrust_banner_sdk){
var cookiewall = document.querySelector('#onetrust-banner-sdk');
2023-04-02 16:21:23 +02:00
2023-05-09 20:55:47 +02:00
// Cookiewall
if (cookiewall) {
cookiewall.style.position = 'absolute';
cookiewall.style.left = '-10000px';
2023-04-02 16:21:23 +02:00
2023-05-09 20:55:47 +02:00
document.querySelector('.onetrust-pc-dark-filter').style.position = 'absolute';
document.querySelector('.onetrust-pc-dark-filter').style.left = '-10000px';
document.querySelector('body').setAttribute('style', '');
cookiewall_found = true;
}
}
if (cookiewall_found) {
clearInterval(ci);
}
}, 1000 );