From c252e76dd665ddd0cfa84ffdaa26fb52f0796600 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 2 Oct 2020 13:58:22 +0200 Subject: Added oisjgoiesjgoseijgf --- quotes/public/script.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'quotes/public/script.js') 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", ''); @@ -16,12 +15,14 @@ function appendOption(response) { function appendQuote(response) { response.forEach((elem) => { - quotes.insertAdjacentHTML( - "beforeend", - `
  • ${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${ - elem["quote"] - }
  • ` - ); + document + .getElementById(elem["class"]) + .insertAdjacentHTML( + "beforeend", + `
  • ${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${ + elem["quote"] + }
  • ` + ); }); } @@ -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"; + }); +}); -- cgit v1.2.3