|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => { |
|
|
|
|
|
document.querySelectorAll('[data-feather]').forEach(icon => { |
|
|
const tooltipText = icon.parentElement.getAttribute('data-tooltip'); |
|
|
if (tooltipText) { |
|
|
icon.setAttribute('title', tooltipText); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
function handleFileUpload(event) { |
|
|
const files = event.target.files; |
|
|
if (files.length > 0) { |
|
|
console.log('Files selected:', files); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function setupDragAndDrop() { |
|
|
const dropArea = document.getElementById('drop-area'); |
|
|
|
|
|
if (dropArea) { |
|
|
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { |
|
|
dropArea.addEventListener(eventName, preventDefaults, false); |
|
|
}); |
|
|
|
|
|
function preventDefaults(e) { |
|
|
e.preventDefault(); |
|
|
e.stopPropagation(); |
|
|
} |
|
|
|
|
|
['dragenter', 'dragover'].forEach(eventName => { |
|
|
dropArea.addEventListener(eventName, highlight, false); |
|
|
}); |
|
|
|
|
|
['dragleave', 'drop'].forEach(eventName => { |
|
|
dropArea.addEventListener(eventName, unhighlight, false); |
|
|
}); |
|
|
|
|
|
function highlight() { |
|
|
dropArea.classList.add('border-indigo-400', 'bg-indigo-900', 'bg-opacity-20'); |
|
|
} |
|
|
|
|
|
function unhighlight() { |
|
|
dropArea.classList.remove('border-indigo-400', 'bg-indigo-900', 'bg-opacity-20'); |
|
|
} |
|
|
|
|
|
dropArea.addEventListener('drop', handleDrop, false); |
|
|
|
|
|
function handleDrop(e) { |
|
|
const dt = e.dataTransfer; |
|
|
const files = dt.files; |
|
|
console.log('Files dropped:', files); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', setupDragAndDrop); |