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
|
// File upload functionality
|
||||||
const uploadButton = document.getElementById('upload-button');
|
const uploadButton = document.getElementById('select-files-btn');
|
||||||
const uploadModal = document.querySelector('.upload-modal');
|
const uploadModal = document.querySelector('.upload-modal');
|
||||||
|
|
||||||
// Hide upload modal by default if it exists
|
// Hide upload modal by default if it exists
|
||||||
|
@ -482,29 +482,32 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
uploadModal.style.visibility = 'hidden';
|
uploadModal.style.visibility = 'hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup upload button
|
// Setup upload button with proper existence checks
|
||||||
if (uploadButton && fileInput) {
|
if (uploadButton && fileInput) {
|
||||||
uploadButton.addEventListener('click', function () {
|
uploadButton.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault(); // Prevent default button behavior
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
fileInput.addEventListener('change', function () {
|
fileInput.addEventListener('change', function () {
|
||||||
if (this.files.length > 0) {
|
if (this.files && this.files.length > 0) {
|
||||||
// Handle file upload
|
// Handle file upload
|
||||||
handleFileUpload(this.files);
|
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');
|
const closeButtons = document.querySelectorAll('.upload-modal .close-btn, .upload-modal .modal-close');
|
||||||
closeButtons.forEach(btn => {
|
if (closeButtons.length > 0) {
|
||||||
btn.addEventListener('click', function () {
|
closeButtons.forEach(btn => {
|
||||||
if (uploadModal) {
|
btn.addEventListener('click', function () {
|
||||||
uploadModal.classList.remove('active');
|
if (uploadModal) {
|
||||||
}
|
uploadModal.classList.remove('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
// Handle file upload process
|
// Handle file upload process
|
||||||
function handleFileUpload(files) {
|
function handleFileUpload(files) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue