Skip to content

Instantly share code, notes, and snippets.

@CAFxX
Last active August 30, 2021 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CAFxX/7b2eed0a53e5e8238528e38be1d837aa to your computer and use it in GitHub Desktop.
Save CAFxX/7b2eed0a53e5e8238528e38be1d837aa to your computer and use it in GitHub Desktop.
// ==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