-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
51 lines (43 loc) · 1.79 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Öffnen des Upload-Modals
function openUploadModal() {
document.getElementById("uploadModal").style.display = "flex";
}
// Schließen des Upload-Modals
function closeUploadModal() {
document.getElementById("uploadModal").style.display = "none";
}
// Variable zur Speicherung der Kommentar-Erlaubnis
let allowComments = null;
// Setzen der Kommentar-Erlaubnis (Ja/Nein)
function setCommentPermission(value) {
allowComments = value;
// Visuelle Rückmeldung durch Hintergrundfarbe der Buttons
if (value) {
document.getElementById("commentYes").style.backgroundColor = "#007BFF";
document.getElementById("commentYes").style.color = "white";
document.getElementById("commentNo").style.backgroundColor = "#f0f0f0";
document.getElementById("commentNo").style.color = "black";
} else {
document.getElementById("commentNo").style.backgroundColor = "#007BFF";
document.getElementById("commentNo").style.color = "white";
document.getElementById("commentYes").style.backgroundColor = "#f0f0f0";
document.getElementById("commentYes").style.color = "black";
}
}
// Beispiel: Formular-Submit für den Upload
document.getElementById("uploadForm").addEventListener("submit", function(event) {
event.preventDefault();
const title = document.getElementById("title").value;
const images = document.getElementById("image").files;
const file = document.getElementById("file").files[0];
if (!file || images.length === 0) {
alert("Bitte sowohl das Bild als auch die Datei hochladen.");
return;
}
// Hier könntest du den Upload-Prozess implementieren
console.log("Modell hochgeladen: " + title);
alert("Modell erfolgreich hochgeladen!");
// Schließe das Modal und setze das Formular zurück
closeUploadModal();
document.getElementById("uploadForm").reset();
});