From 9e22454750eaaa6380092a49e37b24f10b5fdc9e Mon Sep 17 00:00:00 2001 From: dasemu Date: Wed, 28 May 2025 00:19:50 +0200 Subject: [PATCH] =?UTF-8?q?Versi=C3=B3n=20final.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlayerHidder.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/PlayerHidder.js b/PlayerHidder.js index 9337e90..994138a 100644 --- a/PlayerHidder.js +++ b/PlayerHidder.js @@ -1,28 +1,27 @@ // PlayerHidder.js -document.addEventListener('DOMContentLoaded', function() { - console.log('PlayerHidder.js loaded'); - const selector = '#map-container > div > div:nth-child(2)'; - function hideDiv() { - const targetDiv = document.querySelector(selector); - console.log('hideDiv:', targetDiv); - if (targetDiv) { - targetDiv.style.display = 'none'; - } +// Localizaión del div que contiene los iconos de los jugadores +const selector = '#map-container > div > div:nth-child(2)'; + +// Oculta el div que contiene los iconos de los jugadores +function hideDiv() { + const targetDiv = document.querySelector(selector); // Selecciona el div usando el selector CSS + if (targetDiv) { // Verifica si el div existe + targetDiv.style.display = 'none'; // Cambia el estilo de display a 'none' para ocultarlo } +} - function showDiv() { - const targetDiv = document.querySelector(selector); - console.log('showDiv:', targetDiv); - if (targetDiv) { - targetDiv.style.display = ''; - } +// Muestra el div que contiene los iconos de los jugadores +function showDiv() { + const targetDiv = document.querySelector(selector); // Selecciona el div usando el selector CSS + if (targetDiv) { // Verifica si el div existe + targetDiv.style.display = ''; // Cambia el estilo de display a '' para mostrarlo } +} - // Oculta el div al cargar - hideDiv(); +// Inicializa el script ocultando el div +hideDiv(); - // Expone funciones globales para mostrar/ocultar - window['abrete_sesamo'] = showDiv; - window['cierrate_sesamo'] = hideDiv; -}); \ No newline at end of file +// Exponer las funciones para que puedan ser llamadas desde el contexto global +window['abrete_sesamo'] = showDiv; +window['cierrate_sesamo'] = hideDiv; \ No newline at end of file