Spaces:
Running
Running
| // Shared JavaScript across all pages | |
| console.log('Android Test Pilot loaded'); | |
| // Funções globais para manipulação de modais | |
| window.openTestModal = function() { | |
| document.getElementById('testModal').classList.remove('hidden'); | |
| document.getElementById('testModal').classList.add('flex'); | |
| } | |
| window.closeTestModal = function() { | |
| document.getElementById('testModal').classList.add('hidden'); | |
| document.getElementById('testModal').classList.remove('flex'); | |
| } | |
| // Drag and drop para upload de arquivo | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const dropZone = document.querySelector('[class*="border-dashed"]'); | |
| const fileInput = document.getElementById('appUpload'); | |
| if (dropZone && fileInput) { | |
| ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | |
| dropZone.addEventListener(eventName, preventDefaults, false); | |
| }); | |
| function preventDefaults(e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| } | |
| ['dragenter', 'dragover'].forEach(eventName => { | |
| dropZone.addEventListener(eventName, highlight, false); | |
| }); | |
| ['dragleave', 'drop'].forEach(eventName => { | |
| dropZone.addEventListener(eventName, unhighlight, false); | |
| }); | |
| function highlight() { | |
| dropZone.classList.add('border-secondary'); | |
| } | |
| function unhighlight() { | |
| dropZone.classList.remove('border-secondary'); | |
| } | |
| dropZone.addEventListener('drop', handleDrop, false); | |
| function handleDrop(e) { | |
| const dt = e.dataTransfer; | |
| const files = dt.files; | |
| fileInput.files = files; | |
| } | |
| } | |
| }); |