From d095e80687ae52c164c3fb1d5e0bd7c428a0169e Mon Sep 17 00:00:00 2001 From: Arek Date: Sun, 19 Jun 2022 10:11:28 +0200 Subject: [PATCH] fix: :construction: Logout in other pages --- .../_main page/pojedynczy_turniej/app.js | 18 ++++++ .../drabinka/collapsible.js | 31 +++++++++- .../pojedynczy_turniej/drabinka/index.html | 9 +-- .../_main page/pojedynczy_turniej/index.html | 7 ++- .../pojedynczy_turniej/zapisy/collapsible.js | 30 ++++++++- .../pojedynczy_turniej/zapisy/index.html | 9 +-- frontend/normal_user/kontakt/index.html | 62 ++++++++++++++----- frontend/normal_user/kontakt/style.css | 4 +- frontend/normal_user/ranking/index.html | 61 +++++++++++++----- frontend/normal_user/ranking/style.css | 3 +- 10 files changed, 184 insertions(+), 50 deletions(-) diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/app.js b/frontend/normal_user/_main page/pojedynczy_turniej/app.js index 93e53a4..e0c178d 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/app.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/app.js @@ -10,6 +10,23 @@ async function showTournaments() { } } +function logout() { + localStorage.clear(); + location.reload(); +} + +function logoutVisibility() { + if (localStorage.getItem("token") !== null) { + document.getElementById("logout").style.display = ""; + } + else { + document.getElementById("logout").style.display = "none"; + + } + +} + + function loginVisibility() { if (localStorage.getItem("token") !== null) { document.getElementById("login").style.display = "none"; @@ -20,6 +37,7 @@ function loginVisibility() { } } + async function renderTournaments() { let tournaments = await showTournaments(); let html = ''; diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js index ca79021..6f45ad8 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js @@ -2,13 +2,40 @@ var coll = document.getElementsByClassName("collapsible"); var i; for (i = 0; i < coll.length; i++) { - coll[i].addEventListener("click", function() { + coll[i].addEventListener("click", function () { this.classList.toggle("active"); var content = this.nextElementSibling; - if (content.style.maxHeight){ + if (content.style.maxHeight) { content.style.maxHeight = null; } else { content.style.maxHeight = content.scrollHeight + "px"; } }); +} + +function logout() { + localStorage.clear(); + location.reload(); +} + +function logoutVisibility() { + if (localStorage.getItem("token") !== null) { + document.getElementById("logout").style.display = ""; + } + else { + document.getElementById("logout").style.display = "none"; + + } + +} + + +function loginVisibility() { + if (localStorage.getItem("token") !== null) { + document.getElementById("login").style.display = "none"; + } + else { + document.getElementById("login").style.display = ""; + + } } \ No newline at end of file diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html index 7b7a021..6051f2f 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html @@ -11,17 +11,18 @@ - +
-
+