From 4e7f72021443174cf1803f01d15a55fc3c6c834c Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Wed, 21 Jun 2023 17:02:57 +0100 Subject: [PATCH] userpage: hide bg on login, dont refresh page ever --- html/user.html | 2 +- ts/user.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/html/user.html b/html/user.html index 0c28641..c24eb83 100644 --- a/html/user.html +++ b/html/user.html @@ -69,7 +69,7 @@ {{ .strings.logout }} -
+
diff --git a/ts/user.ts b/ts/user.ts index 609d1f9..84e0867 100644 --- a/ts/user.ts +++ b/ts/user.ts @@ -175,7 +175,7 @@ class ContactMethods { const deleteButton = row.querySelector(".user-contact-delete") as HTMLButtonElement; deleteButton.onclick = () => _delete("/my/" + name, null, (req: XMLHttpRequest) => { if (req.readyState != 4) return; - window.location.reload(); + document.dispatchEvent(new CustomEvent("details-reload")); }); } @@ -289,7 +289,7 @@ const addEditEmail = (add: boolean): void => { toggleLoader(submit); _post("/my/email", {"email": input.value}, (req: XMLHttpRequest) => { if (req.readyState == 4 && (req.status == 303 || req.status == 200)) { - window.location.reload(); + document.dispatchEvent(new CustomEvent("details-reload")); } }, true, (req: XMLHttpRequest) => { if (req.readyState == 4 && req.status == 401) { @@ -312,7 +312,7 @@ const discordConf: ServiceConfiguration = { accountLinkedError: window.lang.notif("errorAccountLinked"), successError: window.lang.notif("verified"), successFunc: (modalClosed: boolean) => { - if (modalClosed) window.location.reload(); + if (modalClosed) document.dispatchEvent(new CustomEvent("details-reload")); } }; @@ -327,7 +327,7 @@ const telegramConf: ServiceConfiguration = { accountLinkedError: window.lang.notif("errorAccountLinked"), successError: window.lang.notif("verified"), successFunc: (modalClosed: boolean) => { - if (modalClosed) window.location.reload(); + if (modalClosed) document.dispatchEvent(new CustomEvent("details-reload")); } }; @@ -342,7 +342,7 @@ const matrixConf: MatrixConfiguration = { unknownError: window.lang.notif("errorUnknown"), successError: window.lang.notif("verified"), successFunc: () => { - setTimeout(() => window.location.reload(), 1200); + setTimeout(() => document.dispatchEvent(new CustomEvent("details-reload")), 1200); } }; @@ -431,6 +431,7 @@ document.addEventListener("details-reload", () => { const login = new Login(window.modals.login as Modal, "/my/"); login.onLogin = () => { console.log("Logged in."); + document.querySelector(".page-container").classList.remove("unfocused"); document.dispatchEvent(new CustomEvent("details-reload")); };