From e3e60564cc2329278a976837f85fc16fbaa6a728 Mon Sep 17 00:00:00 2001 From: Afonso Reis Date: Sat, 23 Jan 2021 19:42:01 +0000 Subject: [PATCH] Fix transition on page reload Fixes #863 --- src/js/script.js | 14 ++++++++++++++ static/index.html | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index 17afbc2a4..b7123986b 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -5634,7 +5634,21 @@ $("#wpmChart").on("mouseleave", (e) => { $(".wordInputAfter").remove(); }); +let mappedRoutes = { + '/': 'pageTest', + '/login' : 'pageLogin', + '/settings' : 'pageSettings', + '/about' : 'pageAbout', + '/account': 'pageAccount', +} + +function handleInitialPageClasses(el) { + $(el).removeClass("hidden"); + $(el).addClass("active"); +} + $(document).ready(() => { + handleInitialPageClasses($(".page." + mappedRoutes[window.location.pathname])); updateFavicon(32, 14); $("body").css("transition", ".25s"); if (config.quickTab) { diff --git a/static/index.html b/static/index.html index c47c4f35d..4020c6c46 100644 --- a/static/index.html +++ b/static/index.html @@ -920,7 +920,7 @@ -
+