Spaces:
Running
Running
Download script.js from mikheev17/docubank-pro: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/spaces/mikheev17/docubank-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/mikheev17/docubank-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/mikheev17/docubank-pro/resolve/main/script.js
2.29 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // File input handler | |
| const fileInput = document.getElementById('file'); | |
| const fileNameDisplay = document.getElementById('file-name'); | |
| if (fileInput && fileNameDisplay) { | |
| fileInput.addEventListener('change', function() { | |
| if (this.files && this.files.length > 0) { | |
| fileNameDisplay.textContent = this.files[0].name; | |
| } else { | |
| fileNameDisplay.textContent = 'Перетащите файл или нажмите для выбора'; | |
| } | |
| }); | |
| // Drag and drop functionality | |
| const uploadArea = document.querySelector('.upload-area'); | |
| if (uploadArea) { | |
| uploadArea.addEventListener('dragover', (e) => { | |
| e.preventDefault(); | |
| uploadArea.classList.add('dragover'); | |
| }); | |
| uploadArea.addEventListener('dragleave', () => { | |
| uploadArea.classList.remove('dragover'); | |
| }); | |
| uploadArea.addEventListener('drop', (e) => { | |
| e.preventDefault(); | |
| uploadArea.classList.remove('dragover'); | |
| if (e.dataTransfer.files.length) { | |
| fileInput.files = e.dataTransfer.files; | |
| fileNameDisplay.textContent = e.dataTransfer.files[0].name; | |
| } | |
| }); | |
| } | |
| } | |
| // Loading state for buttons | |
| const uploadButton = document.querySelector('.upload-button'); | |
| if (uploadButton) { | |
| uploadButton.addEventListener('click', function(e) { | |
| if (fileInput && !fileInput.files.length) { | |
| e.preventDefault(); | |
| alert('Пожалуйста, выберите файл для загрузки'); | |
| } | |
| }); | |
| } | |
| // Document items animation | |
| const documentItems = document.querySelectorAll('.document-item'); | |
| documentItems.forEach((item, index) => { | |
| item.style.opacity = '0'; | |
| item.style.transform = 'translateY(10px)'; | |
| item.style.transition = 'opacity 0.3s, transform 0.3s'; | |
| setTimeout(() => { | |
| item.style.opacity = '1'; | |
| item.style.transform = 'translateY(0)'; | |
| }, 50 * index); | |
| }); | |
| }); | |