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>
|
<body>
|
||||||
<script src="languages.js"></script>
|
<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>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--Costum document section-->
|
||||||
<div class="container" style="display:none;">
|
<div class="container" style="display:none;">
|
||||||
<h1>Manage document types</h1>
|
<h1>Manage document types</h1>
|
||||||
|
|
||||||
|
|||||||
+169
-69
@@ -7,10 +7,10 @@ Listeners for the program setup and changes
|
|||||||
//Listener for when the gui has been loaded so it can fill the dop down menus in step 2 and the language options
|
//Listener for when the gui has been loaded so it can fill the dop down menus in step 2 and the language options
|
||||||
window.addEventListener('load', async (e) => {
|
window.addEventListener('load', async (e) => {
|
||||||
try {
|
try {
|
||||||
loadLanguageOptions();
|
loadLanguageOptions();
|
||||||
const value = await window.onStartup.getModuleNames();
|
const value = await window.onStartup.getModuleNames();
|
||||||
loadAiOptions(value.ai_modules);
|
loadAiOptions(value.ai_modules);
|
||||||
loadTranscriptionOptions(value.transcription_modules);
|
loadTranscriptionOptions(value.transcription_modules);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in the window listener load in the renderer.js \n");
|
console.log("Error in the window listener load in the renderer.js \n");
|
||||||
@@ -19,14 +19,14 @@ window.addEventListener('load', async (e) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Listener if the language of the displayed text's in the gui should be changed
|
//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 {
|
try {
|
||||||
const select = document.getElementById('language_option');
|
const select = document.getElementById('language_option');
|
||||||
changeLanguage(select.value);
|
changeLanguage(select.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in the language_option change listener in the renderer.js");
|
console.log("Error in the language_option change listener in the renderer.js");
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ prevBtn.addEventListener("click", () => {
|
|||||||
//Listener if the button to change the current step to the next one is pressed
|
//Listener if the button to change the current step to the next one is pressed
|
||||||
nextBtn.addEventListener("click", () => {
|
nextBtn.addEventListener("click", () => {
|
||||||
try {
|
try {
|
||||||
if(currentStep < totalSteps) showStep(currentStep + 1);
|
if (currentStep < totalSteps) showStep(currentStep + 1);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -66,36 +66,36 @@ Listeners for Step 1
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Listener if a file has been draged over the drop down field
|
//Listener if a file has been draged over the drop down field
|
||||||
uploadContainer.addEventListener("dragover", (e) =>{
|
uploadContainer.addEventListener("dragover", (e) => {
|
||||||
try {
|
try {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in renderer.js dragover listener function")
|
console.log("Error in renderer.js dragover listener function")
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//listener for when a file get dropped on the drag&drop field
|
//listener for when a file get dropped on the drag&drop field
|
||||||
uploadContainer.addEventListener("drop", (e) => {
|
uploadContainer.addEventListener("drop", (e) => {
|
||||||
try {
|
try {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const files = e.dataTransfer.files
|
const files = e.dataTransfer.files
|
||||||
const filePath = window.explorer.onFileDrop(files[0])
|
const filePath = window.explorer.onFileDrop(files[0])
|
||||||
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
||||||
var pathToLower = filePath.toLowerCase();
|
var pathToLower = filePath.toLowerCase();
|
||||||
if(testEndings.some(e => pathToLower.endsWith(e))){
|
if (testEndings.some(e => pathToLower.endsWith(e))) {
|
||||||
const files1 = e.dataTransfer.files;
|
const files1 = e.dataTransfer.files;
|
||||||
handleFiles(files1);
|
handleFiles(files1);
|
||||||
}else{
|
} else {
|
||||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.log("Error in renderer.js with the listerner for the drop function");
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error in renderer.js with the listerner for the drop function");
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//listener for the file explorer search when something got selected
|
//listener for the file explorer search when something got selected
|
||||||
@@ -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
|
//Checkboxlistener so that only one can be selected at a time
|
||||||
docFormat.addEventListener("change", (e) =>{
|
docFormat.addEventListener("change", (e) => {
|
||||||
try {
|
try {
|
||||||
if(docFormat.checked){
|
if (docFormat.checked) {
|
||||||
docFormatSummary1.checked = false;
|
docFormatSummary1.checked = false;
|
||||||
docFormatSummary2.checked = false;
|
docFormatSummary2.checked = false;
|
||||||
docFormatSummary3.checked = false;
|
docFormatSummary3.checked = false;
|
||||||
@@ -146,9 +163,9 @@ docFormat.addEventListener("change", (e) =>{
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
docFormatSummary1.addEventListener("change", (e) =>{
|
docFormatSummary1.addEventListener("change", (e) => {
|
||||||
try {
|
try {
|
||||||
if(docFormatSummary1.checked){
|
if (docFormatSummary1.checked) {
|
||||||
docFormat.checked = false;
|
docFormat.checked = false;
|
||||||
docFormatSummary2.checked = false;
|
docFormatSummary2.checked = false;
|
||||||
docFormatSummary3.checked = false;
|
docFormatSummary3.checked = false;
|
||||||
@@ -158,9 +175,9 @@ docFormatSummary1.addEventListener("change", (e) =>{
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
docFormatSummary2.addEventListener("change", (e) =>{
|
docFormatSummary2.addEventListener("change", (e) => {
|
||||||
try {
|
try {
|
||||||
if(docFormatSummary2.checked){
|
if (docFormatSummary2.checked) {
|
||||||
docFormatSummary1.checked = false;
|
docFormatSummary1.checked = false;
|
||||||
docFormat.checked = false;
|
docFormat.checked = false;
|
||||||
docFormatSummary3.checked = false;
|
docFormatSummary3.checked = false;
|
||||||
@@ -170,9 +187,9 @@ docFormatSummary2.addEventListener("change", (e) =>{
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
docFormatSummary3.addEventListener("change", (e) =>{
|
docFormatSummary3.addEventListener("change", (e) => {
|
||||||
try {
|
try {
|
||||||
if(docFormatSummary3.checked){
|
if (docFormatSummary3.checked) {
|
||||||
docFormatSummary1.checked = false;
|
docFormatSummary1.checked = false;
|
||||||
docFormatSummary2.checked = false;
|
docFormatSummary2.checked = false;
|
||||||
docFormat.checked = false;
|
docFormat.checked = false;
|
||||||
@@ -182,9 +199,9 @@ docFormatSummary3.addEventListener("change", (e) =>{
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
docFormatCustom.addEventListener("change", (e) =>{
|
docFormatCustom.addEventListener("change", (e) => {
|
||||||
try {
|
try {
|
||||||
if(docFormatCustom.checked){
|
if (docFormatCustom.checked) {
|
||||||
docFormatSummary1.checked = false;
|
docFormatSummary1.checked = false;
|
||||||
docFormatSummary2.checked = false;
|
docFormatSummary2.checked = false;
|
||||||
docFormatSummary3.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
|
//Functions the the displayed progress in the progressbar can be changed out of the main process
|
||||||
window.electron.progress((event, arg) => {
|
window.electron.progress((event, arg) => {
|
||||||
if(arg.curstep == 1){
|
if (arg.curstep == 1) {
|
||||||
setCircleOne();
|
setCircleOne();
|
||||||
}else if(arg.curstep == 2){
|
} else if (arg.curstep == 2) {
|
||||||
setCircleZwo();
|
setCircleZwo();
|
||||||
} else if(arg.curstep == 3){
|
} else if (arg.curstep == 3) {
|
||||||
setCircleThree();
|
setCircleThree();
|
||||||
}else if(arg.curstep == 4){
|
} else if (arg.curstep == 4) {
|
||||||
setCircleFour();
|
setCircleFour();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function setCircleOne(){
|
function setCircleOne() {
|
||||||
try {
|
try {
|
||||||
if(document.getElementById("box1").style.backgroundColor == "green"){
|
if (document.getElementById("box1").style.backgroundColor == "green") {
|
||||||
document.getElementById("box1").style.backgroundColor = "red";
|
document.getElementById("box1").style.backgroundColor = "red";
|
||||||
}else{
|
} else {
|
||||||
document.getElementById("box1").style.backgroundColor = "green";
|
document.getElementById("box1").style.backgroundColor = "green";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
function setCircleZwo(){
|
function setCircleZwo() {
|
||||||
try {
|
try {
|
||||||
if(document.getElementById("box2").style.backgroundColor == "green"){
|
if (document.getElementById("box2").style.backgroundColor == "green") {
|
||||||
document.getElementById("box2").style.backgroundColor = "red";
|
document.getElementById("box2").style.backgroundColor = "red";
|
||||||
}else{
|
} else {
|
||||||
document.getElementById("box2").style.backgroundColor = "green";
|
document.getElementById("box2").style.backgroundColor = "green";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -236,11 +253,11 @@ function setCircleZwo(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
function setCircleThree(){
|
function setCircleThree() {
|
||||||
try {
|
try {
|
||||||
if(document.getElementById("box3").style.backgroundColor == "green"){
|
if (document.getElementById("box3").style.backgroundColor == "green") {
|
||||||
document.getElementById("box3").style.backgroundColor = "red";
|
document.getElementById("box3").style.backgroundColor = "red";
|
||||||
}else{
|
} else {
|
||||||
document.getElementById("box3").style.backgroundColor = "green";
|
document.getElementById("box3").style.backgroundColor = "green";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -248,11 +265,11 @@ function setCircleThree(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
function setCircleFour(){
|
function setCircleFour() {
|
||||||
try {
|
try {
|
||||||
if(document.getElementById("box4").style.backgroundColor == "green"){
|
if (document.getElementById("box4").style.backgroundColor == "green") {
|
||||||
document.getElementById("box4").style.backgroundColor = "red";
|
document.getElementById("box4").style.backgroundColor = "red";
|
||||||
}else{
|
} else {
|
||||||
document.getElementById("box4").style.backgroundColor = "green";
|
document.getElementById("box4").style.backgroundColor = "green";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -267,7 +284,7 @@ Listeners for Step 5
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Speaker change listener
|
//Speaker change listener
|
||||||
cur_speaker.addEventListener("change", (e) =>{
|
cur_speaker.addEventListener("change", (e) => {
|
||||||
try {
|
try {
|
||||||
document.getElementById("speakerAudioViewer").src = speakerAudios[document.getElementById("cur_speaker").value].src;
|
document.getElementById("speakerAudioViewer").src = speakerAudios[document.getElementById("cur_speaker").value].src;
|
||||||
} catch (error) {
|
} 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", "");
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
+64
-49
@@ -59,7 +59,7 @@ let currentStep = 1;
|
|||||||
const totalSteps = steps.length;
|
const totalSteps = steps.length;
|
||||||
|
|
||||||
function showStep(stepNumber) {
|
function showStep(stepNumber) {
|
||||||
if (stepNumber < 1 || stepNumber > totalSteps){
|
if (stepNumber < 1 || stepNumber > totalSteps) {
|
||||||
console.error("StepNumber out of Bounds", stepNumber);
|
console.error("StepNumber out of Bounds", stepNumber);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ function showStep(stepNumber) {
|
|||||||
document.querySelector(`.step-item[data-step="${stepNumber}"]`).classList.add("active");
|
document.querySelector(`.step-item[data-step="${stepNumber}"]`).classList.add("active");
|
||||||
const activeBtn = document.querySelector(`.step-item[data-step="${stepNumber}"]`);
|
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;
|
prevBtn.disabled = stepNumber == 1;
|
||||||
nextBtn.disabled = stepNumber === totalSteps;
|
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
|
//Video thumbnail generation. Shows a scene from the selected video file as a preview
|
||||||
function generateThumbnail(path){
|
function generateThumbnail(path) {
|
||||||
try {
|
try {
|
||||||
const videoElement = document.getElementById("previewThumbnail");
|
const videoElement = document.getElementById("previewThumbnail");
|
||||||
while (videoElement.firstChild) videoElement.removeChild(videoElement.firstChild);
|
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 to load ai options to the drop down list
|
||||||
function loadAiOptions(options){
|
function loadAiOptions(options) {
|
||||||
try {
|
try {
|
||||||
var menu = document.getElementById('ai_type');
|
var menu = document.getElementById('ai_type');
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice ;
|
var choice;
|
||||||
object_holdy = options
|
object_holdy = options
|
||||||
for(i = 0; i < options.length; i++){
|
for (i = 0; i < options.length; i++) {
|
||||||
choice = document.createElement('option');
|
choice = document.createElement('option');
|
||||||
choice.textContent = object_holdy[i].displayname;
|
choice.textContent = object_holdy[i].displayname;
|
||||||
choice.value = object_holdy[i].name;
|
choice.value = object_holdy[i].name;
|
||||||
@@ -150,13 +150,13 @@ function loadAiOptions(options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function to load transcription options to the drop down list
|
//function to load transcription options to the drop down list
|
||||||
function loadTranscriptionOptions(options){
|
function loadTranscriptionOptions(options) {
|
||||||
try {
|
try {
|
||||||
var menu = document.getElementById('transkript_type');
|
var menu = document.getElementById('transkript_type');
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice ;
|
var choice;
|
||||||
object_holdy = options
|
object_holdy = options
|
||||||
for(i = 0; i < options.length; i++){
|
for (i = 0; i < options.length; i++) {
|
||||||
choice = document.createElement('option');
|
choice = document.createElement('option');
|
||||||
choice.textContent = object_holdy[i].displayname;
|
choice.textContent = object_holdy[i].displayname;
|
||||||
choice.value = object_holdy[i].name;
|
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 to load data type options to the drop down list
|
||||||
function loadDataTypeOptions(options){
|
function loadDataTypeOptions(options) {
|
||||||
try {
|
try {
|
||||||
var menu = document.getElementById('output_type');
|
var menu = document.getElementById('output_type');
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice ;
|
var choice;
|
||||||
object_holdy = options
|
object_holdy = options
|
||||||
for(i = 0; i < options.length; i++){
|
for (i = 0; i < options.length; i++) {
|
||||||
choice = document.createElement('option');
|
choice = document.createElement('option');
|
||||||
choice.textContent = object_holdy[i].displayname;
|
choice.textContent = object_holdy[i].displayname;
|
||||||
choice.value = object_holdy[i].name;
|
choice.value = object_holdy[i].name;
|
||||||
@@ -188,14 +188,14 @@ function loadDataTypeOptions(options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function to load language options to the drop down list
|
//function to load language options to the drop down list
|
||||||
function loadLanguageOptions(){
|
function loadLanguageOptions() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var menu = document.getElementById('language_option');
|
var menu = document.getElementById('language_option');
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice ;
|
var choice;
|
||||||
object_holdy = Object.keys(languageOptions);
|
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 = document.createElement('option');
|
||||||
choice.textContent = object_holdy[i];
|
choice.textContent = object_holdy[i];
|
||||||
choice.value = object_holdy[i];
|
choice.value = object_holdy[i];
|
||||||
@@ -231,8 +231,8 @@ function checkBoxes() {
|
|||||||
const checkboxes = document.querySelectorAll('input[name="docFormat"]');
|
const checkboxes = document.querySelectorAll('input[name="docFormat"]');
|
||||||
let isChecked = false;
|
let isChecked = false;
|
||||||
var checkedCounter = 0;
|
var checkedCounter = 0;
|
||||||
checkboxes.forEach(function(checkbox){
|
checkboxes.forEach(function (checkbox) {
|
||||||
if(checkbox.checked){
|
if (checkbox.checked) {
|
||||||
isChecked = true;
|
isChecked = true;
|
||||||
checkedCounter++;
|
checkedCounter++;
|
||||||
}
|
}
|
||||||
@@ -241,8 +241,8 @@ function checkBoxes() {
|
|||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
//Code to submit the video
|
//Code to submit the video
|
||||||
var selectedCheckboxes = {};
|
var selectedCheckboxes = {};
|
||||||
checkboxes.forEach(function(checkbox){
|
checkboxes.forEach(function (checkbox) {
|
||||||
if(checkbox.checked){
|
if (checkbox.checked) {
|
||||||
selectedCheckboxes[checkbox.nextElementSibling.textContent] = "";
|
selectedCheckboxes[checkbox.nextElementSibling.textContent] = "";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -250,15 +250,15 @@ function checkBoxes() {
|
|||||||
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
||||||
var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]);
|
var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]);
|
||||||
var pathToLower = pathTest.toLowerCase();
|
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
|
//assembly of the json for the main
|
||||||
|
|
||||||
var typeCheckbox;
|
var typeCheckbox;
|
||||||
if(document.getElementById("docFormat").checked) typeCheckbox = document.getElementById("docFormat").value;
|
if (document.getElementById("docFormat").checked) typeCheckbox = document.getElementById("docFormat").value;
|
||||||
if(document.getElementById("docFormatSummary1").checked) typeCheckbox = document.getElementById("docFormatSummary1").value;
|
if (document.getElementById("docFormatSummary1").checked) typeCheckbox = document.getElementById("docFormatSummary1").value;
|
||||||
if(document.getElementById("docFormatSummary2").checked) typeCheckbox = document.getElementById("docFormatSummary2").value;
|
if (document.getElementById("docFormatSummary2").checked) typeCheckbox = document.getElementById("docFormatSummary2").value;
|
||||||
if(document.getElementById("docFormatSummary3").checked) typeCheckbox = document.getElementById("docFormatSummary3").value;
|
if (document.getElementById("docFormatSummary3").checked) typeCheckbox = document.getElementById("docFormatSummary3").value;
|
||||||
if(document.getElementById("docFormatCustom").checked) typeCheckbox = document.getElementById("docFormatCustom").value;
|
if (document.getElementById("docFormatCustom").checked) typeCheckbox = document.getElementById("docFormatCustom").value;
|
||||||
|
|
||||||
document.getElementById("testy").style.visibility = "visible"
|
document.getElementById("testy").style.visibility = "visible"
|
||||||
document.getElementById("box1").style.backgroundColor = "red";
|
document.getElementById("box1").style.backgroundColor = "red";
|
||||||
@@ -271,20 +271,20 @@ function checkBoxes() {
|
|||||||
const aiType = document.getElementById("ai_type");
|
const aiType = document.getElementById("ai_type");
|
||||||
const sendingPackage = {
|
const sendingPackage = {
|
||||||
"video": {
|
"video": {
|
||||||
"module":"extraction-video-to-audio",
|
"module": "extraction-video-to-audio",
|
||||||
"inputVideoPath": pathTest
|
"inputVideoPath": pathTest
|
||||||
},
|
},
|
||||||
"transcription": {
|
"transcription": {
|
||||||
"module": transcriptionType.value
|
"module": transcriptionType.value
|
||||||
},
|
},
|
||||||
"document": {
|
"document": {
|
||||||
"module":aiType.value,
|
"module": aiType.value,
|
||||||
"type": typeCheckbox,
|
"type": typeCheckbox,
|
||||||
"outputType": outputType.value
|
"outputType": outputType.value
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.submit.submit(sendingPackage)
|
window.submit.submit(sendingPackage)
|
||||||
}else{
|
} else {
|
||||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
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 the the submit button on step 4 can be pressed
|
||||||
function activateSubmitBtn(hasFile){
|
function activateSubmitBtn(hasFile) {
|
||||||
try {
|
try {
|
||||||
document.getElementById("submitButton").disabled = !hasFile;
|
document.getElementById("submitButton").disabled = !hasFile;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -323,7 +323,7 @@ function updateProgressBar(bar, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function to hide the progressbar
|
//function to hide the progressbar
|
||||||
function deaktivateProgressbar(){
|
function deaktivateProgressbar() {
|
||||||
try {
|
try {
|
||||||
document.getElementById("progressbar").style.visibility = "hidden";
|
document.getElementById("progressbar").style.visibility = "hidden";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -339,17 +339,17 @@ Functions used in Step 5
|
|||||||
|
|
||||||
|
|
||||||
//function to load speaker options to the drop down list
|
//function to load speaker options to the drop down list
|
||||||
function loadSpeakerOptions(options){
|
function loadSpeakerOptions(options) {
|
||||||
try {
|
try {
|
||||||
var menu = document.getElementById('cur_speaker');
|
var menu = document.getElementById('cur_speaker');
|
||||||
var l = document.getElementById('cur_speaker').options.length -1;
|
var l = document.getElementById('cur_speaker').options.length - 1;
|
||||||
for(i = l; i >= 0; i--){
|
for (i = l; i >= 0; i--) {
|
||||||
menu.remove(i);
|
menu.remove(i);
|
||||||
}
|
}
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice;
|
var choice;
|
||||||
object_holdy = Object.keys(options);
|
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 = document.createElement('option');
|
||||||
choice.textContent = options[object_holdy[i]].name;
|
choice.textContent = options[object_holdy[i]].name;
|
||||||
choice.value = object_holdy[i];
|
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 to load speaker audio file options to the drop down list
|
||||||
function loadSpeakerAudio(option){
|
function loadSpeakerAudio(option) {
|
||||||
try {
|
try {
|
||||||
var menu = document.getElementById('speakerAudioViewer');
|
var menu = document.getElementById('speakerAudioViewer');
|
||||||
var aud = document.createElement("source");
|
var aud = document.createElement("source");
|
||||||
@@ -378,7 +378,7 @@ function loadSpeakerAudio(option){
|
|||||||
//Audio value setter
|
//Audio value setter
|
||||||
var speakerAudios = {};
|
var speakerAudios = {};
|
||||||
var speakerEndValues = {};
|
var speakerEndValues = {};
|
||||||
function setSpeakerAudiosValue(valy){
|
function setSpeakerAudiosValue(valy) {
|
||||||
try {
|
try {
|
||||||
speakerAudios = valy;
|
speakerAudios = valy;
|
||||||
speakerRewriten = valy;
|
speakerRewriten = valy;
|
||||||
@@ -388,7 +388,7 @@ function setSpeakerAudiosValue(valy){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Function to rewrite the speaker name in the json
|
//Function to rewrite the speaker name in the json
|
||||||
function rewriteSpeakerName(){
|
function rewriteSpeakerName() {
|
||||||
try {
|
try {
|
||||||
var tempy = document.getElementById("cur_speaker").value;
|
var tempy = document.getElementById("cur_speaker").value;
|
||||||
speakerAudios[tempy].name = document.getElementById("newSpeaker").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 to send the json with the given names back to the program to rewrite the document file
|
||||||
function sendSpeakerPackages(){
|
function sendSpeakerPackages() {
|
||||||
try {
|
try {
|
||||||
window.submitSpeaker.speaker_submit(speakerAudios);
|
window.submitSpeaker.speaker_submit(speakerAudios);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -421,14 +421,29 @@ function fileDownload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.api.getTxtFiles().then(files => {
|
|
||||||
files.forEach(file => {
|
|
||||||
const option = document.createElement('option');
|
|
||||||
option.value = file;
|
/*
|
||||||
option.textContent = file
|
|
||||||
.replace('.txt', '') // Endung entfernen
|
Functions for the custom document section
|
||||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
|
||||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
*/
|
||||||
costumDocumentType.appendChild(option);
|
|
||||||
});
|
//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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user