Spaces:
Running
Running
document.addEventListener('DOMContentLoaded', () => { | |
var GotitB = document.querySelector(".explainChoix button") | |
var explain = document.querySelector(".explainChoix") | |
var SummarizeInput = document.querySelector(".SummarizeInput") | |
var CaptionInput = document.querySelector(".CaptionInput") | |
GotitB.addEventListener("click",()=>{ | |
explain.style.opacity="0" | |
}) | |
document.querySelectorAll('.select-options input[type="radio"]').forEach(radio => { | |
radio.addEventListener('change', (e) => { | |
if (e.target.checked) { | |
const selectedValue = e.target.value; | |
if(selectedValue=="Summarize"){ | |
SummarizeInput.classList.add("active") | |
SummarizeInput.classList.remove("innactive") | |
CaptionInput.classList.remove("active") | |
CaptionInput.classList.add("innactive") | |
} | |
else{ | |
SummarizeInput.classList.add("innactive") | |
SummarizeInput.classList.remove("active") | |
CaptionInput.classList.remove("innactive") | |
CaptionInput.classList.add("active") | |
} | |
} | |
}); | |
}); | |
const fileUpload = document.getElementById('file-upload'); | |
const imageUpload = document.getElementById('image-upload'); | |
// Get the icon buttons | |
const fileBtn = document.getElementById('file-btn'); | |
const imageBtn = document.getElementById('image-btn'); | |
// Set up file input for documents (PDF, DOCX, PPTX, XLSX) | |
fileBtn.addEventListener('click', () => { | |
fileUpload.click(); | |
}); | |
fileUpload.addEventListener('change', (e) => { | |
if (e.target.files.length > 0) { | |
const file = e.target.files[0]; | |
const validDocTypes = [ | |
'application/pdf', | |
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', | |
'application/vnd.openxmlformats-officedocument.presentationml.presentation', | |
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | |
]; | |
if (validDocTypes.includes(file.type)) { | |
console.log('Valid document selected:', file.name); | |
// Handle the document file here | |
} else { | |
alert('Please select a valid document (PDF, DOCX, PPTX, or XLSX)'); | |
fileUpload.value = ''; // Reset the input | |
} | |
} | |
}); | |
// Set up file input for images | |
imageBtn.addEventListener('click', () => { | |
imageUpload.click(); | |
}); | |
imageUpload.addEventListener('change', (e) => { | |
if (e.target.files.length > 0) { | |
const file = e.target.files[0]; | |
const validImageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']; | |
if (validImageTypes.includes(file.type)) { | |
console.log('Valid image selected:', file.name); | |
// Handle the image file here | |
} else { | |
alert('Please select a valid image (JPEG, PNG, GIF, or WEBP)'); | |
imageUpload.value = ''; // Reset the input | |
} | |
} | |
}); | |
}); |