From 4f8091a01a3fe0f02810c35f95a39034ea5a488a Mon Sep 17 00:00:00 2001 From: WasiqB Date: Fri, 21 Feb 2025 22:16:36 +0300 Subject: [PATCH] fix: :bug: fixed issue with dark mode when refreshing the page --- templates/assets/js/darkmode.js | 5 ++++- templates/feature-overview.index.tmpl | 22 ++++++---------------- templates/features-overview.index.tmpl | 16 ++++++---------- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/templates/assets/js/darkmode.js b/templates/assets/js/darkmode.js index fe03025..bdfeec6 100644 --- a/templates/assets/js/darkmode.js +++ b/templates/assets/js/darkmode.js @@ -1,11 +1,11 @@ var darkMode = "darkmode"; function applyDarkMode() { - document.getElementById("features-table").classList.toggle("table-striped"); applyFontStyle(); document .querySelector("html") .setAttribute("data-bs-theme", isDarkModeOn() ? "dark" : "light"); + document.getElementById("features-table").classList.toggle("table-striped"); } function saveState() { @@ -29,5 +29,8 @@ window.onload = function () { if (window.localStorage["darkmode"] === "on") { applyDarkMode(); document.getElementById("darkCheck").checked = true; + document + .querySelector("html") + .setAttribute("data-bs-theme", isDarkModeOn() ? "dark" : "light"); } }; diff --git a/templates/feature-overview.index.tmpl b/templates/feature-overview.index.tmpl index 6ae67e4..3a8a2b3 100644 --- a/templates/feature-overview.index.tmpl +++ b/templates/feature-overview.index.tmpl @@ -1,6 +1,7 @@ + @@ -40,10 +41,6 @@ <% } %> - - -