// ==UserScript== // @name Repubblica: Hide the "ExitIntent" overlay // @name:it Repubblica: Nasconde l'overlay "ExitIntent" // @description This script hides the "ExitIntent" overlay that sometimes is shown when you want to exit from the current page of the site. // @description:it Questo script nasconde l'overlay "ExitIntent" che a volte viene visualizzato quando si vuole uscire dalla pagina corrente del sito. // @match https://*.repubblica.it/* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js // @grant none //// @run-at document-start // @version 1.0.5 // @author Cyrano68 // @license MIT // @namespace https://greasyfork.org/users/788550 // @downloadURL none // ==/UserScript== (function() { "use strict"; function console_log(text) { //let now = new Date().toISOString(); let now = new Date().toLocaleString(); console.log(`${now} ${text}`); } console_log("==> Repubblica_HideExitIntentOverlay: HELLO! Loading script..."); document.addEventListener("DOMContentLoaded", onDOMContentLoaded); window.addEventListener("load", onWindowLoaded); createMutationObserver(); function onDOMContentLoaded() { console_log(`==> Repubblica_HideExitIntentOverlay: onDOMContentLoaded - document.readyState=${document.readyState}`); // DO NOTHING! } function onWindowLoaded() { console_log(`==> Repubblica_HideExitIntentOverlay: onWindowLoaded - document.readyState=${document.readyState}`); // DO NOTHING! } function onMutationList(mutationList, observer) { // We can simply check the presence of the popup in the DOM tree. var divOverlay = $("div#adagio-overlay-try-buy:visible"); //console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - divOverlay.length=${divOverlay.length}`); if (divOverlay.length > 0) { divOverlay.hide(); divOverlay.remove(); console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - divOverlay.length=${divOverlay.length} ---> HIDDEN/REMOVED`); } } function createMutationObserver() { console_log("==> Repubblica_HideExitIntentOverlay: createMutationObserver"); // Options for the observer (which mutations to observe). const config = {attributes: true, childList: true, subtree: true, characterData: true}; var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; // Create an observer instance linked to the callback function. const observer = new MutationObserver(onMutationList); // Start observing the target node for configured mutations. observer.observe(document, config); } console_log("==> Repubblica_HideExitIntentOverlay: Script loaded"); })();