Cia_oficial

auto acept alert web manager

Jul 28th, 2025
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        auto accept alert
  3. // @namespace   Violentmonkey Scripts
  4. // @match       https://10.100.20.2/*
  5. // @match       https://10.100.20.6/*
  6. // @match       https://10.100.20.10/*
  7. // @match       https://10.100.20.14/*
  8. // @match       https://10.100.20.18/*
  9. // @match       https://10.100.20.22/*
  10. // @match       https://10.100.20.74/*
  11. // @match       https://10.100.20.78/*
  12. // @match       https://10.100.20.82/*
  13. // @match       https://10.100.20.86/*
  14. // @grant       none
  15. // @version     1.5
  16. // @author      C.i.a
  17. // @description 31/12/2023 14:33:43
  18. // ==/UserScript==
  19.  
  20. // Función que maneja la alerta de "Legal Notice"
  21. function handleLegalNoticeAlert() {
  22.     var confirmButtonLegalNotice = document.querySelector('.ui-modal .modal-dialog .modal-footer .btn-defaultBlue');
  23.     if (confirmButtonLegalNotice) {
  24.         confirmButtonLegalNotice.click();
  25.     }
  26. }
  27.  
  28. // Función que maneja la alerta de "Downgraded privileges"
  29. function handleDowngradedPrivilegesAlert() {
  30.     var closeButtonDowngradedPrivileges = document.querySelector('.ui-modal .modal-dialog .modal-footer .btn-small');
  31.     if (closeButtonDowngradedPrivileges) {
  32.         setTimeout(function() {
  33.             closeButtonDowngradedPrivileges.click();
  34.         }, 500);
  35.     }
  36. }
  37.  
  38. // Función que hace clic en el botón "Detailed Site View"
  39. function clickDetailedSiteViewButton() {
  40.     var detailedSiteViewButton = document.querySelector('li[heading="Detailed Site View"] a.nav-link');
  41.     if (detailedSiteViewButton) {
  42.         detailedSiteViewButton.click();
  43.     }
  44. }
  45.  
  46. // Crear un observador de mutaciones para detectar la aparición de nuevas alertas
  47. var observer = new MutationObserver(function(mutations) {
  48.     mutations.forEach(function(mutation) {
  49.         // Verificar si se agregó un nodo al DOM
  50.         if (mutation.addedNodes.length > 0) {
  51.             // Manejar la alerta de "Legal Notice"
  52.             handleLegalNoticeAlert();
  53.  
  54.             // Manejar la alerta de "Downgraded privileges"
  55.             handleDowngradedPrivilegesAlert();
  56.  
  57.             // Intentar hacer clic en el botón "Detailed Site View" después de manejar las alertas
  58.             setTimeout(clickDetailedSiteViewButton, 1000);
  59.         }
  60.     });
  61. });
  62.  
  63. // Configurar el observador para monitorear cambios en el cuerpo del documento
  64. observer.observe(document.body, { childList: true, subtree: true });
Advertisement
Add Comment
Please, Sign In to add comment