Created
December 19, 2024 18:42
-
-
Save robot00f/ae0b8aa78458bff297934f31b4c4a66c to your computer and use it in GitHub Desktop.
Deshabilitar Popup en Palermonline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Deshabilitar Popup en Palermonline | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Elimina el popup y habilita el scroll en palermonline.com.ar | |
// @author palermonline | |
// @match https://www.palermonline.com.ar/* | |
// @match https://palermonline.com.ar/wordpress/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=palermonline.com.ar | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Función para eliminar elementos específicos | |
function removePopupElements() { | |
const popupSelectors = [ | |
'iframe.swg-dialog', | |
'swg-popup-background' | |
]; | |
popupSelectors.forEach(selector => { | |
const elements = document.querySelectorAll(selector); | |
elements.forEach(el => { | |
el.remove(); | |
console.log(`Elemento eliminado: ${selector}`); | |
}); | |
}); | |
// Habilitar el scroll | |
const body = document.querySelector('body'); | |
if (body) { | |
body.classList.remove('swg-disable-scroll'); | |
body.style.overflow = ''; | |
} | |
const html = document.querySelector('html'); | |
if (html) { | |
html.style.overflow = ''; | |
} | |
console.log('Scroll habilitado y popups eliminados.'); | |
} | |
// Observar cambios en el DOM | |
const observer = new MutationObserver(() => { | |
removePopupElements(); | |
}); | |
// Configuración del observador | |
observer.observe(document.body, { childList: true, subtree: true }); | |
// Ejecutar la función inicialmente | |
document.addEventListener('DOMContentLoaded', () => { | |
removePopupElements(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment