Fixed submit button bug and progessbar not showing when uploading video with button

This commit is contained in:
Verena Schulz
2025-11-25 15:11:18 +01:00
parent 718664523c
commit 0bbbb2f9b7
2 changed files with 9 additions and 2 deletions
+5 -1
View File
@@ -57,7 +57,11 @@ language_option.addEventListener('change', (e)=>{
videoUpload.addEventListener("change", () => {
try {
activateSubmitBtn(videoUpload.files.length > 0);
if (videoUpload.files.length > 0) {
const file = videoUpload.files[0];
handleFiles([file]);
}
activateSubmitBtn(currentVideoPath !== null);
} catch (error) {
console.log(error);
}
+4 -1
View File
@@ -1,4 +1,4 @@
let currentVideoPath = null;
//function to check if one checkbox is at least klicked
function checkBoxes() {
try {
@@ -98,11 +98,13 @@ function changeLanguage(language) {
function handleFiles(files) {
try {
if (files.length > 0) {
document.getElementById("progressbar").style.visibility = "visible";
const file = files[0];
if (file.type.startsWith('video/')) {
const filePath = window.explorer.onFileDrop(files[0])
videoUpload.files = files;
fileName.textContent = `Chosen video: ${file.name}`;
currentVideoPath = filePath;
generateThumbnail(filePath);
activateSubmitBtn(true);
}
@@ -185,6 +187,7 @@ function loadLanguageOptions(){
}
}
function activateSubmitBtn(hasFile){
try {
submitButton.disabled = !hasFile;