wip
This commit is contained in:
parent
16e8490b30
commit
34afc48816
1 changed files with 14 additions and 11 deletions
|
@ -472,7 +472,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
}
|
||||
|
||||
// File upload functionality
|
||||
const uploadButton = document.getElementById('upload-button');
|
||||
const uploadButton = document.getElementById('select-files-btn');
|
||||
const uploadModal = document.querySelector('.upload-modal');
|
||||
|
||||
// Hide upload modal by default if it exists
|
||||
|
@ -482,29 +482,32 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
uploadModal.style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
// Setup upload button
|
||||
// Setup upload button with proper existence checks
|
||||
if (uploadButton && fileInput) {
|
||||
uploadButton.addEventListener('click', function () {
|
||||
uploadButton.addEventListener('click', function (e) {
|
||||
e.preventDefault(); // Prevent default button behavior
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
fileInput.addEventListener('change', function () {
|
||||
if (this.files.length > 0) {
|
||||
if (this.files && this.files.length > 0) {
|
||||
// Handle file upload
|
||||
handleFileUpload(this.files);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Close upload modal when close button is clicked
|
||||
// Close upload modal when close button is clicked - with existence check
|
||||
const closeButtons = document.querySelectorAll('.upload-modal .close-btn, .upload-modal .modal-close');
|
||||
closeButtons.forEach(btn => {
|
||||
btn.addEventListener('click', function () {
|
||||
if (uploadModal) {
|
||||
uploadModal.classList.remove('active');
|
||||
}
|
||||
if (closeButtons.length > 0) {
|
||||
closeButtons.forEach(btn => {
|
||||
btn.addEventListener('click', function () {
|
||||
if (uploadModal) {
|
||||
uploadModal.classList.remove('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Handle file upload process
|
||||
function handleFileUpload(files) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue