Last active
August 30, 2021 22:49
-
-
Save CAFxX/7b2eed0a53e5e8238528e38be1d837aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name La Stampa/Repubblica Adblock Modal Remover | |
// @name:it La Stampa/Repubblica Elimina Messaggio Adblock | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Remove the adblock modal on lastampa.it and repubblica.it | |
// @description:it Elimina il messaggio modale che impedisce l'uso dei siti di La Stampa (lastampa.it) e Repubblica (repubblica.it) in caso di presenza di adblocker | |
// @author CAFxX | |
// @match https://*.lastampa.it/* | |
// @match https://*.repubblica.it/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const log = (...args) => console.log("gedi-adblock-modal-remover:", ...args); | |
log("starting"); | |
let attempts = 0; | |
const mangle = () => { | |
document.querySelector("body").style.overflow = ""; | |
const overlay = document.querySelector("div.fc-ab-root"); | |
if (overlay != null) { | |
overlay.style.setProperty("display", "none", "important"); | |
log("overlay hidden"); | |
} else if (attempts < 200) { | |
attempts++; | |
setTimeout(mangle, 250); | |
log("overlay not found: retrying"); | |
} else { | |
log("overlay not found"); | |
} | |
}; | |
mangle(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment