Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name auto accept alert
- // @namespace Violentmonkey Scripts
- // @match https://10.100.20.2/*
- // @match https://10.100.20.6/*
- // @match https://10.100.20.10/*
- // @match https://10.100.20.14/*
- // @match https://10.100.20.18/*
- // @match https://10.100.20.22/*
- // @match https://10.100.20.74/*
- // @match https://10.100.20.78/*
- // @match https://10.100.20.82/*
- // @match https://10.100.20.86/*
- // @grant none
- // @version 1.5
- // @author C.i.a
- // @description 31/12/2023 14:33:43
- // ==/UserScript==
- // Función que maneja la alerta de "Legal Notice"
- function handleLegalNoticeAlert() {
- var confirmButtonLegalNotice = document.querySelector('.ui-modal .modal-dialog .modal-footer .btn-defaultBlue');
- if (confirmButtonLegalNotice) {
- confirmButtonLegalNotice.click();
- }
- }
- // Función que maneja la alerta de "Downgraded privileges"
- function handleDowngradedPrivilegesAlert() {
- var closeButtonDowngradedPrivileges = document.querySelector('.ui-modal .modal-dialog .modal-footer .btn-small');
- if (closeButtonDowngradedPrivileges) {
- setTimeout(function() {
- closeButtonDowngradedPrivileges.click();
- }, 500);
- }
- }
- // Función que hace clic en el botón "Detailed Site View"
- function clickDetailedSiteViewButton() {
- var detailedSiteViewButton = document.querySelector('li[heading="Detailed Site View"] a.nav-link');
- if (detailedSiteViewButton) {
- detailedSiteViewButton.click();
- }
- }
- // Crear un observador de mutaciones para detectar la aparición de nuevas alertas
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- // Verificar si se agregó un nodo al DOM
- if (mutation.addedNodes.length > 0) {
- // Manejar la alerta de "Legal Notice"
- handleLegalNoticeAlert();
- // Manejar la alerta de "Downgraded privileges"
- handleDowngradedPrivilegesAlert();
- // Intentar hacer clic en el botón "Detailed Site View" después de manejar las alertas
- setTimeout(clickDetailedSiteViewButton, 1000);
- }
- });
- });
- // Configurar el observador para monitorear cambios en el cuerpo del documento
- observer.observe(document.body, { childList: true, subtree: true });
Advertisement
Add Comment
Please, Sign In to add comment