CoolFace
Apppublic

juancmamacias/yolo-multi-class-annotator

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
application.js41 linesDownload Raw Back to static
1// ===== MODAL DE INSTRUCCIONES =====2 3function initializeModal() {4    const modal = document.getElementById('instructionsModal');5    const helpBtn = document.getElementById('helpBtn');6    const closeBtn = document.querySelector('.close');7    8    if (!modal || !helpBtn || !closeBtn) return;9    10    // Abrir modal11    helpBtn.addEventListener('click', function() {12        modal.style.display = 'block';13        document.body.style.overflow = 'hidden';14    });15    16    // Cerrar modal con X17    closeBtn.addEventListener('click', function() {18        modal.style.display = 'none';19        document.body.style.overflow = 'auto';20    });21    22    // Cerrar modal clickeando fuera23    window.addEventListener('click', function(event) {24        if (event.target === modal) {25            modal.style.display = 'none';26            document.body.style.overflow = 'auto';27        }28    });29    30    // Cerrar con tecla ESC31    document.addEventListener('keydown', function(event) {32        if (event.key === 'Escape' && modal.style.display === 'block') {33            modal.style.display = 'none';34            document.body.style.overflow = 'auto';35        }36    });37}38 39// Hacer función global para que pueda ser llamada desde otros JS40window.initializeModal = initializeModal;41