This script hides the annoying popups (the warning-disconnection popu) that are shown in the web page.
当前为
// ==UserScript==
// @name FinecoBank.com: Hide Annoying popups (the warning-disconnection popup)
// @name:it FinecoBank.com: Nasconde i popup fastidiosi (il popup di avviso disconnessione)
// @description This script hides the annoying popups (the warning-disconnection popu) that are shown in the web page.
// @description:it Questo script nasconde i popup fastidiosi (il popup di avviso disconnessione) che vengono visualizzati nella pagina web.
// @match https://finecobank.com/*
// @grant none
// @require https://update.greasyfork.org/scripts/535551/1651362/HideAnnoyingPopupsLib.js
// @version 1.0.5
// @author Cyrano68
// @license MIT
// @namespace https://greasyfork.org/users/788550
// ==/UserScript==
(function()
{
"use strict";
const haplib = window.HideAnnoyingPopupsLib;
const myVersion = GM_info.script.version;
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: HELLO! Loading script (version: ${myVersion})...`);
const currUrl = window.location.href;
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: currUrl='${currUrl}'`);
//document.addEventListener("DOMContentLoaded", onDOMContentLoaded);
//window.addEventListener("load", onWindowLoaded);
const buttonText = "RIMANI CONNESSO";
//const minClickDelay_s = 0;
const minClickDelay_s = 2;
const maxRandomClickDelay_s = 3;
function getMathRandomInteger(val1, val2)
{
let min = 0;
let max = 100;
const val1IsValid = ((val1 !== undefined) && (val1 !== undefined));
const val2IsValid = ((val2 !== undefined) && (val2 !== undefined));
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: getMathRandomInteger - val1IsValid=${val1IsValid}, val2IsValid=${val2IsValid}`);
if (val1IsValid || val2IsValid)
{
if (val1IsValid && val2IsValid)
{
min = val1;
max = val2;
}
else
{
min = 0;
max = (val1IsValid ? val1 : val2);
}
}
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: getMathRandomInteger - min=${min}, max=${max}`);
return Math.floor(Math.random() * (max - min)) + min;
}
function generateMyID()
{
return Date.now().toString(36) + "_" + Math.random().toString(36).substring(2);
}
const myID = generateMyID();
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: myID='${myID}'`);
function onMutatedNode(mutation, foundNode)
{
// This function must return a boolean value: stopMutationProcessing. When it is TRUE the current mutation will not be further processed.
// IMPORTANT: In this case we will always return TRUE (otherwise the "haplib" will hide every matching button).
//
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: onMutatedNode - BEGIN - myID='${myID}' - foundNode.textContent=${foundNode.textContent}`);
let stopMutationProcessing = false;
if (foundNode.textContent === buttonText)
{
// The popup will appear for "clickDelay_ms" milliseconds. Then the script will click "programmatically" on the button.
if (minClickDelay_s > 0)
{
const maxRandomClickDelay_ms = maxRandomClickDelay_s * 1e3;
const randomClickDelay_ms = getMathRandomInteger(0, maxRandomClickDelay_ms);
const minClickDelay_ms = minClickDelay_s * 1e3;
const clickDelay_ms = minClickDelay_ms + randomClickDelay_ms;
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: onMutatedNode - myID='${myID}' - clickDelay_ms=${clickDelay_ms}`);
setTimeout(() =>
{
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: onMutatedNode - delayed - myID='${myID}' - clicking on button programmatically`);
foundNode.click();
}, clickDelay_ms);
}
else
{
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: onMutatedNode - myID='${myID}' - clicking on button programmatically`);
foundNode.click();
}
}
else
{
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: onMutatedNode - myID='${myID}' - Button IGNORED`);
}
stopMutationProcessing = true;
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: onMutatedNode - END - myID='${myID}' - stopMutationProcessing=${stopMutationProcessing}`);
return stopMutationProcessing;
}
haplib.consoleLog(`==> FinecoBank_com_HideAnnoyingPopups: Using library 'HideAnnoyingPopupsLib' (version: ${haplib.getVersion()})`);
const mutationObserverConfig = {subtree: true, childList: true};
const mutatedNodesConfig = {selectors: ["button.btn.btn-primary"], onMutatedNode: onMutatedNode};
haplib.configure(mutationObserverConfig, mutatedNodesConfig);
haplib.consoleLog("==> FinecoBank_com_HideAnnoyingPopups: Script loaded");
})();