Spaces:
Running
Running
File size: 2,293 Bytes
2c04734 eb59a49 2c04734 eb59a49 2c04734 eb59a49 2c04734 eb59a49 2c04734 eb59a49 2c04734 e8b30a8 eb59a49 e8b30a8 eb59a49 2c04734 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
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);
});
});
|