From d9e37e4e2e89c7e626b11ffc1ac2943506b7c067 Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Sat, 30 Jul 2022 16:57:18 +0100 Subject: [PATCH] Switch to ReplaceHistory. --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 61b120f..7c73647 100644 --- a/index.js +++ b/index.js @@ -59,11 +59,11 @@ function SetupJSTheme() { th.onclick = ToggleTheme } } -function PushHistory(url) { +function ReplaceHistory(url) { let s = true if (window.history) { - if (window.history.pushState) { - window.history.pushState({}, "", url) + if (window.history.replaceState) { + window.history.replaceState({}, "", url) s = false } } @@ -84,7 +84,7 @@ function ToggleTheme() { th.title = "Switch to Light Mode" document.getElementById("so-form").removeChild(document.getElementById("so-theme")) logo.href = "?" - PushHistory(url+"?"+TheParameters) + ReplaceHistory(url+"?"+TheParameters) thsty.href = CssDarkURL } else { thimg.src = MoonImageURL @@ -97,9 +97,9 @@ function ToggleTheme() { document.getElementById("so-form").appendChild(thi) logo.href = "?light" if (TheParameters === "") { - PushHistory(url+"?light") + ReplaceHistory(url+"?light") } else { - PushHistory(url+"?light&"+TheParameters) + ReplaceHistory(url+"?light&"+TheParameters) } thsty.href = CssLightURL }