mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
try {
|
|
const uploadContainer = document.getElementById('uploadContainer');
|
|
const fileInput = document.getElementById('videoUpload');
|
|
const fileName = document.getElementById('fileName');
|
|
const manualBtn = document.getElementById('manualUploadBtn');
|
|
const videoPreview = document.getElementById('videoPreview');
|
|
|
|
} catch (error) {
|
|
console.log("Error in skript value setting section");
|
|
}
|
|
|
|
//listener for the file explorer search
|
|
manualBtn.addEventListener('click', () => {
|
|
try {
|
|
fileInput.click();
|
|
} catch (error) {
|
|
console.log("Error in manualBtn EventListener click");
|
|
}
|
|
|
|
});
|
|
|
|
//listener for the file explorer search when something got selected
|
|
fileInput.addEventListener('change', () => {
|
|
try {
|
|
handleFiles(fileInput.files);
|
|
} catch (error) {
|
|
console.log("Error in manualBtn EventListener change");
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//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/')) {
|
|
fileInput.files = files;
|
|
fileName.textContent = `Chosen video: ${file.name}`;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.log("Error in script.js handleFiles function");
|
|
}
|
|
|
|
}
|
|
|
|
//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");
|
|
}
|
|
|
|
} |