//listener for the file explorer search manualUploadBtn.addEventListener('click', () => { try { videoUpload.click(); } catch (error) { console.log("Error in manualBtn EventListener click"); console.log(error); } }); //function to check if one checkbox is at least klicked function checkBoxes() { try { const checkboxes = document.querySelectorAll('input[name="docFormat"]'); let isChecked = false; checkboxes.forEach(function(checkbox){ if(checkbox.checked){ isChecked = true; } }); if(isChecked){ //Code to submit the video var selectedCheckboxes = {}; checkboxes.forEach(function(checkbox){ if(checkbox.checked){ selectedCheckboxes[checkbox.nextElementSibling.textContent] = ""; } }); console.log(selectedCheckboxes); var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]); if(pathTest.endsWith(".mp4") || pathTest.endsWith(".mov") || pathTest.endsWith(".avi") || pathTest.endsWith( ".mkv")){ document.getElementById("progressbar").style.visibility = "visible"; //window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"}); } } else { //language only english at the moment alert('Please select at least one document type.'); } } catch (error) { console.log("Error in script.js checkBoxes function"); console.log(error); } } //language changing feature function changeLanguage(language) { try { document.getElementById('title').textContent = languageOptions[language].title; document.getElementById('h1').textContent = languageOptions[language].h1; document.getElementById('p1').textContent = languageOptions[language].p1; document.getElementById('fileName').textContent = languageOptions[language].fileName; document.getElementById('manualUploadBtn').textContent = languageOptions[language].manualUploadBtn; document.getElementById('checkbox_group').textContent = languageOptions[language].checkbox_group; document.getElementById('label_format').textContent = languageOptions[language].label_format; document.getElementById('label_summary').textContent = languageOptions[language].label_summary; document.getElementById('submitButton').textContent = languageOptions[language].submitButton; } catch (error) { console.log("Error in script.js changeLanguage function"); console.log(error); } } //listener for the file explorer search when something got selected videoUpload.addEventListener('change', () => { try { handleFiles(videoUpload.files); } catch (error) { console.log("Error in manualBtn EventListener change"); console.log(error); } }); //function to display the file path in the drop down box function handleFiles(files) { try { if (files.length > 0) { const file = files[0]; if (file.type.startsWith('video/')) { videoUpload.files = files; fileName.textContent = `Chosen video: ${file.name}`; } } } catch (error) { console.log("Error in script.js handleFiles function"); console.log(error); } } //function to regulate the progress on the progressbar function updateProgressBar(bar, value){ try { value = Math.round(value); bar.querySelector(".progress_fill").style.width = `${value}%`; bar.querySelector(".progress_text").textContent = `${value}%`; } catch (error) { console.log("Error in scripts.js updateProgressBar function"); console.log(error); } } //function to load ai options to the drop down list function loadAiOptions(options){ try { var menu = document.getElementById('ai_type'); var object_holdy; var choice ; object_holdy = Object.keys(languageOptions); for(i = 0; i < options.length; i++){ choice = document.createElement('option'); choice.textContent = object_holdy[i]; choice.value = object_holdy[i]; menu.appendChild(choice); } } catch (error) { console.log("Error in script.js loadAiOptions function"); console.log(error); } } //function to load language options to the drop down list function loadLanguageOptions(){ try { var menu = document.getElementById('language_option'); var object_holdy; var choice ; object_holdy = Object.keys(languageOptions); for(i = 0; i < object_holdy.length; i++){ choice = document.createElement('option'); choice.textContent = object_holdy[i]; choice.value = object_holdy[i]; menu.appendChild(choice); } } catch (error) { console.log("Error in script.js loadLanguageOptions function"); console.log(error); } } function activateSubmitBtn(hasFile){ try { submitButton.disabled = !hasFile; } catch (error) { console.log(error); } } function deaktivateProgressbar(){ try { document.getElementById("progressbar").style.visibility = "hidden"; } catch (error) { console.log(error); } } videoUpload.addEventListener("change", () => { try { activateSubmitBtn(videoUpload.files.length > 0); } catch (error) { console.log(error); } }); uploadContainer.addEventListener("drop", (e) => { try { e.preventDefault(); const file = e.dataTransfer.files[0]; if(file){ activateSubmitBtn(true); } } catch (error) { console.log(error); } });