您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This script hides the "ExitIntent" overlay that sometimes is shown when you want to exit from the current page of the site.
当前为
// ==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/* // @grant none //// @run-at document-start // @version 1.0.6 // @author Cyrano68 // @license MIT // @namespace https://greasyfork.org/users/788550 // ==/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) { //console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - mutationList.length=${mutationList.length}`); mutationList.forEach((mutation, i) => { //console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - i=${i}: mutation.type=${mutation.type}`); if (mutation.type === "childList") { let addedNodes = mutation.addedNodes; if (addedNodes.length > 0) { //console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - i=${i}: addedNodes.length=${addedNodes.length}`); addedNodes.forEach((addedNode, j) => { //console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - i=${i}: onAddedNode - j=${j}: addedNode.tagName='${addedNode.tagName}'`); if (addedNode.tagName === "DIV") { //console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - i=${i}: onAddedNode - j=${j}: addedNode.tagName='${addedNode.tagName}', addedNode.className='${addedNode.className}', addedNode.outerHTML='${addedNode.outerHTML}'`); if (addedNode.id === "adagio-overlay-try-buy") { addedNode.style.display = "none"; // Hide node. document.body.style.overflowY = "scroll"; // Show vertical scrollbar. console_log(`==> Repubblica_HideExitIntentOverlay: onMutationList - 'adagio-overlay-try-buy' - i=${i}: onAddedNode - j=${j}: addedNode.tagName='${addedNode.tagName}', addedNode.id='${addedNode.id}' ---> HIDDEN`); } } }); } } }); } function createMutationObserver() { console_log("==> Repubblica_HideExitIntentOverlay: createMutationObserver"); // SEE: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver const MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; // Create an observer instance linked to the callback function. const observer = new MutationObserver(onMutationList); // Options for the observer (which mutations to observe). const config = {subtree: true, childList: true}; // Start observing the target node for configured mutations. observer.observe(document, config); } console_log("==> Repubblica_HideExitIntentOverlay: Script loaded"); })();