aboutsummaryrefslogtreecommitdiff
path: root/profile/public/users.js
diff options
context:
space:
mode:
authorMarvin Borner2021-01-29 17:30:07 +0100
committerMarvin Borner2021-01-29 17:30:07 +0100
commit07aff0fad3eb67d826d17f9ecc0d236ad4f3829e (patch)
tree90d1f50a916cb04e5cf2ce94e296ebcfa5e866c3 /profile/public/users.js
parentc5331b3eb3d30c089b7a457e88e576d511ea81be (diff)
Minor improvements
Diffstat (limited to 'profile/public/users.js')
-rw-r--r--profile/public/users.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/profile/public/users.js b/profile/public/users.js
index 73f0e4a..5ea58f7 100644
--- a/profile/public/users.js
+++ b/profile/public/users.js
@@ -1,10 +1,20 @@
function addUser(user) {
- const li = document.createElement("li");
+ const li = document.createElement("a");
+ li.classList.add("pure-menu-link");
li.textContent = `${user.name} ${user.middlename || ""} ${user.surname}`;
- li.addEventListener("click", () => window.location.assign(`./user.html?uid=${user.id}`));
+ li.href = "./user.html?uid=" + user.id;
if (user.class_id < 6) document.getElementById("class_" + user.class_id).appendChild(li);
}
fetch("/auth/api/list?class=all")
.then((response) => response.json())
.then((response) => response.forEach(addUser));
+
+document.querySelectorAll("b").forEach((elem) => {
+ const next = elem.nextElementSibling;
+ next.style.display = "none";
+ elem.addEventListener("click", () => {
+ console.log(elem);
+ next.style.display = next.style.display == "none" ? "block" : "none";
+ });
+});