mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Implemented the script part from the custom_document.html file into the base script.js and renderer.js
This commit is contained in:
@@ -11,115 +11,6 @@
|
||||
|
||||
<body>
|
||||
<script src="languages.js"></script>
|
||||
<script>
|
||||
const goBackBtn = document.getElementById("goBackBtn");
|
||||
const generateBtn = document.getElementById("generateBtn");
|
||||
const deleteBtn = document.getElementById("deleteBtn");
|
||||
const existingDocs = document.getElementById("existingDocs");
|
||||
const docNameInput = document.getElementById("docName");
|
||||
const promptInput = document.getElementById("prompt");
|
||||
const resultDiv = document.getElementById("result");
|
||||
const exampleText = "";
|
||||
|
||||
// dokumente speichern
|
||||
generateBtn.addEventListener("click", () => {
|
||||
const name = docNameInput.value.trim();
|
||||
const content = promptInput.value.trim();
|
||||
if (!name || !content) {
|
||||
resultDiv.textContent = "Bitte Dokumentname und Prompt ausfüllen.";
|
||||
setTimeout(() => {
|
||||
resultDiv.textContent = "";
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
window.api.saveTxtFile(name, content).then();
|
||||
resultDiv.textContent = "Dokument erfolgreich gespeichert!";
|
||||
setTimeout(() => {
|
||||
resultDiv.textContent = "";
|
||||
}, 3000);
|
||||
reloadDocuments();
|
||||
|
||||
});
|
||||
|
||||
// dokumente löschen
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
const name = docNameInput.value.trim();
|
||||
|
||||
if (!name) {
|
||||
resultDiv.textContent = "Bitte Dokumentname angeben.";
|
||||
setTimeout(() => {
|
||||
resultDiv.textContent = "";
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmDelete = confirm(
|
||||
`Möchtest du das Dokument "${name}" wirklich löschen?`
|
||||
);
|
||||
|
||||
if (!confirmDelete) return;
|
||||
|
||||
window.api.deleteTxtFile(name).then((success) => {
|
||||
if (success) {
|
||||
resultDiv.textContent = "Dokument erfolgreich gelöscht!";
|
||||
reloadDocuments();
|
||||
existingDocs.value = "newDoc";
|
||||
existingDocs.dispatchEvent(new Event("change"));
|
||||
} else {
|
||||
resultDiv.textContent = "Dokument konnte nicht gelöscht werden.";
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
resultDiv.textContent = "";
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//function to load existingDoc options to the drop down list
|
||||
const select = document.getElementById('existingDocs');
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
reloadDocuments();
|
||||
});
|
||||
|
||||
//content anzeigen
|
||||
const docNameWrapper = document.getElementById("docNameWrapper");
|
||||
|
||||
existingDocs.addEventListener("change", async () => {
|
||||
const selected = existingDocs.value;
|
||||
|
||||
if (selected === "newDoc") {
|
||||
docNameWrapper.classList.remove("hidden");
|
||||
docNameInput.value = "";
|
||||
promptInput.value = exampleText;
|
||||
return;
|
||||
}
|
||||
docNameWrapper.classList.add("hidden");
|
||||
|
||||
const content = await window.api.readTxtFile(selected);
|
||||
promptInput.value = content;
|
||||
docNameInput.value = selected.replace(".txt", "");
|
||||
});
|
||||
|
||||
//reload drop down
|
||||
function reloadDocuments() {
|
||||
[...existingDocs.querySelectorAll('option:not([value="newDoc"])')]
|
||||
.forEach(o => o.remove());
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
files.forEach(file => {
|
||||
const option = document.createElement('option');
|
||||
option.value = file;
|
||||
option.textContent = file
|
||||
.replace('.txt', '') // Endung entfernen
|
||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||
existingDocs.appendChild(option);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Costum document section-->
|
||||
<div class="container" style="display:none;">
|
||||
<h1>Manage document types</h1>
|
||||
|
||||
|
||||
+132
-32
@@ -19,7 +19,7 @@ window.addEventListener('load', async (e) => {
|
||||
});
|
||||
|
||||
//Listener if the language of the displayed text's in the gui should be changed
|
||||
language_option.addEventListener('change', (e)=>{
|
||||
language_option.addEventListener('change', (e) => {
|
||||
try {
|
||||
const select = document.getElementById('language_option');
|
||||
changeLanguage(select.value);
|
||||
@@ -53,7 +53,7 @@ prevBtn.addEventListener("click", () => {
|
||||
//Listener if the button to change the current step to the next one is pressed
|
||||
nextBtn.addEventListener("click", () => {
|
||||
try {
|
||||
if(currentStep < totalSteps) showStep(currentStep + 1);
|
||||
if (currentStep < totalSteps) showStep(currentStep + 1);
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
@@ -66,7 +66,7 @@ Listeners for Step 1
|
||||
*/
|
||||
|
||||
//Listener if a file has been draged over the drop down field
|
||||
uploadContainer.addEventListener("dragover", (e) =>{
|
||||
uploadContainer.addEventListener("dragover", (e) => {
|
||||
try {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
@@ -85,10 +85,10 @@ uploadContainer.addEventListener("drop", (e) => {
|
||||
const filePath = window.explorer.onFileDrop(files[0])
|
||||
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
||||
var pathToLower = filePath.toLowerCase();
|
||||
if(testEndings.some(e => pathToLower.endsWith(e))){
|
||||
if (testEndings.some(e => pathToLower.endsWith(e))) {
|
||||
const files1 = e.dataTransfer.files;
|
||||
handleFiles(files1);
|
||||
}else{
|
||||
} else {
|
||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
||||
}
|
||||
|
||||
@@ -133,10 +133,27 @@ Listeners for Step 3
|
||||
|
||||
*/
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
var menu = document.getElementById('customDocumentTypes');
|
||||
var l = document.getElementById('customDocumentTypes').options.length - 1;
|
||||
for (i = l; i >= 0; i--) {
|
||||
menu.remove(i);
|
||||
}
|
||||
files.forEach(file => {
|
||||
const option = document.createElement('option');
|
||||
option.value = file;
|
||||
option.textContent = file
|
||||
.replace('.txt', '') // Endung entfernen
|
||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||
menu.appendChild(option);
|
||||
});
|
||||
});
|
||||
|
||||
//Checkboxlistener so that only one can be selected at a time
|
||||
docFormat.addEventListener("change", (e) =>{
|
||||
docFormat.addEventListener("change", (e) => {
|
||||
try {
|
||||
if(docFormat.checked){
|
||||
if (docFormat.checked) {
|
||||
docFormatSummary1.checked = false;
|
||||
docFormatSummary2.checked = false;
|
||||
docFormatSummary3.checked = false;
|
||||
@@ -146,9 +163,9 @@ docFormat.addEventListener("change", (e) =>{
|
||||
|
||||
}
|
||||
});
|
||||
docFormatSummary1.addEventListener("change", (e) =>{
|
||||
docFormatSummary1.addEventListener("change", (e) => {
|
||||
try {
|
||||
if(docFormatSummary1.checked){
|
||||
if (docFormatSummary1.checked) {
|
||||
docFormat.checked = false;
|
||||
docFormatSummary2.checked = false;
|
||||
docFormatSummary3.checked = false;
|
||||
@@ -158,9 +175,9 @@ docFormatSummary1.addEventListener("change", (e) =>{
|
||||
|
||||
}
|
||||
});
|
||||
docFormatSummary2.addEventListener("change", (e) =>{
|
||||
docFormatSummary2.addEventListener("change", (e) => {
|
||||
try {
|
||||
if(docFormatSummary2.checked){
|
||||
if (docFormatSummary2.checked) {
|
||||
docFormatSummary1.checked = false;
|
||||
docFormat.checked = false;
|
||||
docFormatSummary3.checked = false;
|
||||
@@ -170,9 +187,9 @@ docFormatSummary2.addEventListener("change", (e) =>{
|
||||
|
||||
}
|
||||
});
|
||||
docFormatSummary3.addEventListener("change", (e) =>{
|
||||
docFormatSummary3.addEventListener("change", (e) => {
|
||||
try {
|
||||
if(docFormatSummary3.checked){
|
||||
if (docFormatSummary3.checked) {
|
||||
docFormatSummary1.checked = false;
|
||||
docFormatSummary2.checked = false;
|
||||
docFormat.checked = false;
|
||||
@@ -182,9 +199,9 @@ docFormatSummary3.addEventListener("change", (e) =>{
|
||||
|
||||
}
|
||||
});
|
||||
docFormatCustom.addEventListener("change", (e) =>{
|
||||
docFormatCustom.addEventListener("change", (e) => {
|
||||
try {
|
||||
if(docFormatCustom.checked){
|
||||
if (docFormatCustom.checked) {
|
||||
docFormatSummary1.checked = false;
|
||||
docFormatSummary2.checked = false;
|
||||
docFormatSummary3.checked = false;
|
||||
@@ -202,33 +219,33 @@ Listeners for Step 4
|
||||
*/
|
||||
//Functions the the displayed progress in the progressbar can be changed out of the main process
|
||||
window.electron.progress((event, arg) => {
|
||||
if(arg.curstep == 1){
|
||||
if (arg.curstep == 1) {
|
||||
setCircleOne();
|
||||
}else if(arg.curstep == 2){
|
||||
} else if (arg.curstep == 2) {
|
||||
setCircleZwo();
|
||||
} else if(arg.curstep == 3){
|
||||
} else if (arg.curstep == 3) {
|
||||
setCircleThree();
|
||||
}else if(arg.curstep == 4){
|
||||
} else if (arg.curstep == 4) {
|
||||
setCircleFour();
|
||||
}
|
||||
});
|
||||
|
||||
function setCircleOne(){
|
||||
function setCircleOne() {
|
||||
try {
|
||||
if(document.getElementById("box1").style.backgroundColor == "green"){
|
||||
if (document.getElementById("box1").style.backgroundColor == "green") {
|
||||
document.getElementById("box1").style.backgroundColor = "red";
|
||||
}else{
|
||||
} else {
|
||||
document.getElementById("box1").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
}
|
||||
|
||||
};
|
||||
function setCircleZwo(){
|
||||
function setCircleZwo() {
|
||||
try {
|
||||
if(document.getElementById("box2").style.backgroundColor == "green"){
|
||||
if (document.getElementById("box2").style.backgroundColor == "green") {
|
||||
document.getElementById("box2").style.backgroundColor = "red";
|
||||
}else{
|
||||
} else {
|
||||
document.getElementById("box2").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -236,11 +253,11 @@ function setCircleZwo(){
|
||||
}
|
||||
|
||||
};
|
||||
function setCircleThree(){
|
||||
function setCircleThree() {
|
||||
try {
|
||||
if(document.getElementById("box3").style.backgroundColor == "green"){
|
||||
if (document.getElementById("box3").style.backgroundColor == "green") {
|
||||
document.getElementById("box3").style.backgroundColor = "red";
|
||||
}else{
|
||||
} else {
|
||||
document.getElementById("box3").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -248,11 +265,11 @@ function setCircleThree(){
|
||||
}
|
||||
|
||||
};
|
||||
function setCircleFour(){
|
||||
function setCircleFour() {
|
||||
try {
|
||||
if(document.getElementById("box4").style.backgroundColor == "green"){
|
||||
if (document.getElementById("box4").style.backgroundColor == "green") {
|
||||
document.getElementById("box4").style.backgroundColor = "red";
|
||||
}else{
|
||||
} else {
|
||||
document.getElementById("box4").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -267,7 +284,7 @@ Listeners for Step 5
|
||||
*/
|
||||
|
||||
//Speaker change listener
|
||||
cur_speaker.addEventListener("change", (e) =>{
|
||||
cur_speaker.addEventListener("change", (e) => {
|
||||
try {
|
||||
document.getElementById("speakerAudioViewer").src = speakerAudios[document.getElementById("cur_speaker").value].src;
|
||||
} catch (error) {
|
||||
@@ -282,5 +299,88 @@ window.audios.speakerAudios((event, arg) => {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Listeners for the costum documents section
|
||||
|
||||
*/
|
||||
|
||||
// dokumente speichern
|
||||
generateBtn.addEventListener("click", () => {
|
||||
const name = docName.value.trim();
|
||||
const content = prompt.value.trim();
|
||||
if (!name || !content) {
|
||||
result.textContent = "Bitte Dokumentname und Prompt ausfüllen.";
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
window.api.saveTxtFile(name, content).then();
|
||||
result.textContent = "Dokument erfolgreich gespeichert!";
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
reloadDocuments();
|
||||
|
||||
});
|
||||
|
||||
// dokumente löschen
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
const name = docName.value.trim();
|
||||
|
||||
if (!name) {
|
||||
result.textContent = "Bitte Dokumentname angeben.";
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmDelete = confirm(
|
||||
`Möchtest du das Dokument "${name}" wirklich löschen?`
|
||||
);
|
||||
|
||||
if (!confirmDelete) return;
|
||||
|
||||
window.api.deleteTxtFile(name).then((success) => {
|
||||
if (success) {
|
||||
result.textContent = "Dokument erfolgreich gelöscht!";
|
||||
reloadDocuments();
|
||||
existingDocs.value = "newDoc";
|
||||
existingDocs.dispatchEvent(new Event("change"));
|
||||
} else {
|
||||
result.textContent = "Dokument konnte nicht gelöscht werden.";
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//function to load existingDoc options to the drop down list
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
reloadDocuments();
|
||||
});
|
||||
|
||||
//content anzeigen
|
||||
existingDocs.addEventListener("change", async () => {
|
||||
const existingDocsed = existingDocs.value;
|
||||
const exampleText = "";
|
||||
|
||||
if (existingDocsed === "newDoc") {
|
||||
docNameWrapper.classList.remove("hidden");
|
||||
docName.value = "";
|
||||
prompt.value = exampleText;
|
||||
return;
|
||||
}
|
||||
docNameWrapper.classList.add("hidden");
|
||||
|
||||
const content = await window.api.readTxtFile(existingDocsed);
|
||||
prompt.value = content;
|
||||
docName.value = existingDocsed.replace(".txt", "");
|
||||
});
|
||||
|
||||
|
||||
+55
-40
@@ -59,7 +59,7 @@ let currentStep = 1;
|
||||
const totalSteps = steps.length;
|
||||
|
||||
function showStep(stepNumber) {
|
||||
if (stepNumber < 1 || stepNumber > totalSteps){
|
||||
if (stepNumber < 1 || stepNumber > totalSteps) {
|
||||
console.error("StepNumber out of Bounds", stepNumber);
|
||||
return;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ function showStep(stepNumber) {
|
||||
document.querySelector(`.step-item[data-step="${stepNumber}"]`).classList.add("active");
|
||||
const activeBtn = document.querySelector(`.step-item[data-step="${stepNumber}"]`);
|
||||
|
||||
if(activeBtn) activeBtn.classList.add("active");
|
||||
if (activeBtn) activeBtn.classList.add("active");
|
||||
|
||||
prevBtn.disabled = stepNumber == 1;
|
||||
nextBtn.disabled = stepNumber === totalSteps;
|
||||
@@ -105,7 +105,7 @@ function handleFiles(files) {
|
||||
}
|
||||
|
||||
//Video thumbnail generation. Shows a scene from the selected video file as a preview
|
||||
function generateThumbnail(path){
|
||||
function generateThumbnail(path) {
|
||||
try {
|
||||
const videoElement = document.getElementById("previewThumbnail");
|
||||
while (videoElement.firstChild) videoElement.removeChild(videoElement.firstChild);
|
||||
@@ -131,13 +131,13 @@ Functions used in Step 2
|
||||
*/
|
||||
|
||||
//function to load ai options to the drop down list
|
||||
function loadAiOptions(options){
|
||||
function loadAiOptions(options) {
|
||||
try {
|
||||
var menu = document.getElementById('ai_type');
|
||||
var object_holdy;
|
||||
var choice ;
|
||||
var choice;
|
||||
object_holdy = options
|
||||
for(i = 0; i < options.length; i++){
|
||||
for (i = 0; i < options.length; i++) {
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = object_holdy[i].displayname;
|
||||
choice.value = object_holdy[i].name;
|
||||
@@ -150,13 +150,13 @@ function loadAiOptions(options){
|
||||
}
|
||||
|
||||
//function to load transcription options to the drop down list
|
||||
function loadTranscriptionOptions(options){
|
||||
function loadTranscriptionOptions(options) {
|
||||
try {
|
||||
var menu = document.getElementById('transkript_type');
|
||||
var object_holdy;
|
||||
var choice ;
|
||||
var choice;
|
||||
object_holdy = options
|
||||
for(i = 0; i < options.length; i++){
|
||||
for (i = 0; i < options.length; i++) {
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = object_holdy[i].displayname;
|
||||
choice.value = object_holdy[i].name;
|
||||
@@ -169,13 +169,13 @@ function loadTranscriptionOptions(options){
|
||||
}
|
||||
|
||||
//function to load data type options to the drop down list
|
||||
function loadDataTypeOptions(options){
|
||||
function loadDataTypeOptions(options) {
|
||||
try {
|
||||
var menu = document.getElementById('output_type');
|
||||
var object_holdy;
|
||||
var choice ;
|
||||
var choice;
|
||||
object_holdy = options
|
||||
for(i = 0; i < options.length; i++){
|
||||
for (i = 0; i < options.length; i++) {
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = object_holdy[i].displayname;
|
||||
choice.value = object_holdy[i].name;
|
||||
@@ -188,14 +188,14 @@ function loadDataTypeOptions(options){
|
||||
}
|
||||
|
||||
//function to load language options to the drop down list
|
||||
function loadLanguageOptions(){
|
||||
function loadLanguageOptions() {
|
||||
try {
|
||||
|
||||
var menu = document.getElementById('language_option');
|
||||
var object_holdy;
|
||||
var choice ;
|
||||
var choice;
|
||||
object_holdy = Object.keys(languageOptions);
|
||||
for(i = 0; i < object_holdy.length; i++){
|
||||
for (i = 0; i < object_holdy.length; i++) {
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = object_holdy[i];
|
||||
choice.value = object_holdy[i];
|
||||
@@ -231,8 +231,8 @@ function checkBoxes() {
|
||||
const checkboxes = document.querySelectorAll('input[name="docFormat"]');
|
||||
let isChecked = false;
|
||||
var checkedCounter = 0;
|
||||
checkboxes.forEach(function(checkbox){
|
||||
if(checkbox.checked){
|
||||
checkboxes.forEach(function (checkbox) {
|
||||
if (checkbox.checked) {
|
||||
isChecked = true;
|
||||
checkedCounter++;
|
||||
}
|
||||
@@ -241,8 +241,8 @@ function checkBoxes() {
|
||||
if (isChecked) {
|
||||
//Code to submit the video
|
||||
var selectedCheckboxes = {};
|
||||
checkboxes.forEach(function(checkbox){
|
||||
if(checkbox.checked){
|
||||
checkboxes.forEach(function (checkbox) {
|
||||
if (checkbox.checked) {
|
||||
selectedCheckboxes[checkbox.nextElementSibling.textContent] = "";
|
||||
}
|
||||
});
|
||||
@@ -250,15 +250,15 @@ function checkBoxes() {
|
||||
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
||||
var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]);
|
||||
var pathToLower = pathTest.toLowerCase();
|
||||
if(testEndings.some(e => pathToLower.endsWith(e))){
|
||||
if (testEndings.some(e => pathToLower.endsWith(e))) {
|
||||
//assembly of the json for the main
|
||||
|
||||
var typeCheckbox;
|
||||
if(document.getElementById("docFormat").checked) typeCheckbox = document.getElementById("docFormat").value;
|
||||
if(document.getElementById("docFormatSummary1").checked) typeCheckbox = document.getElementById("docFormatSummary1").value;
|
||||
if(document.getElementById("docFormatSummary2").checked) typeCheckbox = document.getElementById("docFormatSummary2").value;
|
||||
if(document.getElementById("docFormatSummary3").checked) typeCheckbox = document.getElementById("docFormatSummary3").value;
|
||||
if(document.getElementById("docFormatCustom").checked) typeCheckbox = document.getElementById("docFormatCustom").value;
|
||||
if (document.getElementById("docFormat").checked) typeCheckbox = document.getElementById("docFormat").value;
|
||||
if (document.getElementById("docFormatSummary1").checked) typeCheckbox = document.getElementById("docFormatSummary1").value;
|
||||
if (document.getElementById("docFormatSummary2").checked) typeCheckbox = document.getElementById("docFormatSummary2").value;
|
||||
if (document.getElementById("docFormatSummary3").checked) typeCheckbox = document.getElementById("docFormatSummary3").value;
|
||||
if (document.getElementById("docFormatCustom").checked) typeCheckbox = document.getElementById("docFormatCustom").value;
|
||||
|
||||
document.getElementById("testy").style.visibility = "visible"
|
||||
document.getElementById("box1").style.backgroundColor = "red";
|
||||
@@ -271,20 +271,20 @@ function checkBoxes() {
|
||||
const aiType = document.getElementById("ai_type");
|
||||
const sendingPackage = {
|
||||
"video": {
|
||||
"module":"extraction-video-to-audio",
|
||||
"module": "extraction-video-to-audio",
|
||||
"inputVideoPath": pathTest
|
||||
},
|
||||
"transcription": {
|
||||
"module": transcriptionType.value
|
||||
},
|
||||
"document": {
|
||||
"module":aiType.value,
|
||||
"module": aiType.value,
|
||||
"type": typeCheckbox,
|
||||
"outputType": outputType.value
|
||||
}
|
||||
};
|
||||
window.submit.submit(sendingPackage)
|
||||
}else{
|
||||
} else {
|
||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ function checkBoxes() {
|
||||
}
|
||||
|
||||
//function the the submit button on step 4 can be pressed
|
||||
function activateSubmitBtn(hasFile){
|
||||
function activateSubmitBtn(hasFile) {
|
||||
try {
|
||||
document.getElementById("submitButton").disabled = !hasFile;
|
||||
} catch (error) {
|
||||
@@ -323,7 +323,7 @@ function updateProgressBar(bar, value) {
|
||||
}
|
||||
|
||||
//function to hide the progressbar
|
||||
function deaktivateProgressbar(){
|
||||
function deaktivateProgressbar() {
|
||||
try {
|
||||
document.getElementById("progressbar").style.visibility = "hidden";
|
||||
} catch (error) {
|
||||
@@ -339,17 +339,17 @@ Functions used in Step 5
|
||||
|
||||
|
||||
//function to load speaker options to the drop down list
|
||||
function loadSpeakerOptions(options){
|
||||
function loadSpeakerOptions(options) {
|
||||
try {
|
||||
var menu = document.getElementById('cur_speaker');
|
||||
var l = document.getElementById('cur_speaker').options.length -1;
|
||||
for(i = l; i >= 0; i--){
|
||||
var l = document.getElementById('cur_speaker').options.length - 1;
|
||||
for (i = l; i >= 0; i--) {
|
||||
menu.remove(i);
|
||||
}
|
||||
var object_holdy;
|
||||
var choice;
|
||||
object_holdy = Object.keys(options);
|
||||
for(i = 0; i < object_holdy.length; i++){
|
||||
for (i = 0; i < object_holdy.length; i++) {
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = options[object_holdy[i]].name;
|
||||
choice.value = object_holdy[i];
|
||||
@@ -363,7 +363,7 @@ function loadSpeakerOptions(options){
|
||||
}
|
||||
|
||||
//function to load speaker audio file options to the drop down list
|
||||
function loadSpeakerAudio(option){
|
||||
function loadSpeakerAudio(option) {
|
||||
try {
|
||||
var menu = document.getElementById('speakerAudioViewer');
|
||||
var aud = document.createElement("source");
|
||||
@@ -378,7 +378,7 @@ function loadSpeakerAudio(option){
|
||||
//Audio value setter
|
||||
var speakerAudios = {};
|
||||
var speakerEndValues = {};
|
||||
function setSpeakerAudiosValue(valy){
|
||||
function setSpeakerAudiosValue(valy) {
|
||||
try {
|
||||
speakerAudios = valy;
|
||||
speakerRewriten = valy;
|
||||
@@ -388,7 +388,7 @@ function setSpeakerAudiosValue(valy){
|
||||
}
|
||||
}
|
||||
//Function to rewrite the speaker name in the json
|
||||
function rewriteSpeakerName(){
|
||||
function rewriteSpeakerName() {
|
||||
try {
|
||||
var tempy = document.getElementById("cur_speaker").value;
|
||||
speakerAudios[tempy].name = document.getElementById("newSpeaker").value;
|
||||
@@ -398,7 +398,7 @@ function rewriteSpeakerName(){
|
||||
}
|
||||
}
|
||||
//Function to send the json with the given names back to the program to rewrite the document file
|
||||
function sendSpeakerPackages(){
|
||||
function sendSpeakerPackages() {
|
||||
try {
|
||||
window.submitSpeaker.speaker_submit(speakerAudios);
|
||||
} catch (error) {
|
||||
@@ -421,7 +421,21 @@ function fileDownload() {
|
||||
}
|
||||
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Functions for the custom document section
|
||||
|
||||
*/
|
||||
|
||||
//reload drop down
|
||||
function reloadDocuments() {
|
||||
[...existingDocs.querySelectorAll('option:not([value="newDoc"])')]
|
||||
.forEach(o => o.remove());
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
files.forEach(file => {
|
||||
const option = document.createElement('option');
|
||||
option.value = file;
|
||||
@@ -429,6 +443,7 @@ window.api.getTxtFiles().then(files => {
|
||||
.replace('.txt', '') // Endung entfernen
|
||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||
costumDocumentType.appendChild(option);
|
||||
existingDocs.appendChild(option);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user