aboutsummaryrefslogtreecommitdiff
path: root/quotes/public/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'quotes/public/script.js')
-rw-r--r--quotes/public/script.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/quotes/public/script.js b/quotes/public/script.js
index 74f74df..2c112e4 100644
--- a/quotes/public/script.js
+++ b/quotes/public/script.js
@@ -1,5 +1,4 @@
const dropdown = document.getElementById("author");
-const quotes = document.getElementById("quotes");
dropdown.insertAdjacentHTML("beforeend", '<option selected="true" disabled>Author auswählen...</option>');
@@ -16,12 +15,14 @@ function appendOption(response) {
function appendQuote(response) {
response.forEach((elem) => {
- quotes.insertAdjacentHTML(
- "beforeend",
- `<li>${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${
- elem["quote"]
- }</li>`
- );
+ document
+ .getElementById(elem["class"])
+ .insertAdjacentHTML(
+ "beforeend",
+ `<li>${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${
+ elem["quote"]
+ }</li>`
+ );
});
}
@@ -32,3 +33,12 @@ fetch("/auth/api/list")
fetch("/quotes/api/list")
.then((response) => response.json())
.then((response) => appendQuote(response));
+
+const classes = ["TGI13.1", "TGI13.2", "TGM13.1", "TGM13.2", "TGTM13.1"];
+classes.forEach((clazz) => {
+ document.getElementById("open_" + clazz).addEventListener("click", () => {
+ const ul = document.getElementById(clazz);
+ if (ul.style.display === "none") ul.style.display = "block";
+ else ul.style.display = "none";
+ });
+});