From aa82a91a29f6a22b4f97fc0cf761bd04524c380f Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Sat, 30 Jul 2022 21:21:17 +0100 Subject: [PATCH] Switch ReplaceHistory with PushHistory --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 68d723b..bea5209 100644 --- a/index.js +++ b/index.js @@ -74,11 +74,11 @@ function SetupJSTheme() { th.onclick = Toggvarheme } } -function ReplaceHistory(url) { +function PushHistory(url) { var s = true if (window.history) { - if (window.history.replaceState) { - window.history.replaceState({ + if (window.history.pushState) { + window.history.pushState({ light: !!document.getElementById("so-theme"), order: document.getElementById("so-order").value, sort: document.getElementById("so-sort").value @@ -103,7 +103,7 @@ function Toggvarheme() { th.title = "Switch to Light Mode" document.getElementById("so-form").removeChild(document.getElementById("so-theme")) logo.href = "?" - ReplaceHistory(url+"?"+TheParameters+"#") + PushHistory(url+"?"+TheParameters+"#") thsty.href = CssDarkURL } else { thimg.src = MoonImageURL @@ -116,9 +116,9 @@ function Toggvarheme() { document.getElementById("so-form").appendChild(thi) logo.href = "?light" if (TheParameters === "") { - ReplaceHistory(url+"?light#") + PushHistory(url+"?light#") } else { - ReplaceHistory(url+"?light&"+TheParameters+"#") + PushHistory(url+"?light&"+TheParameters+"#") } thsty.href = CssLightURL } @@ -244,9 +244,9 @@ function EntrySort(o, s) { var url = document.location.href url = url.split("#", 1)[0].split('?', 1)[0] if (document.getElementById("so-theme")) { - ReplaceHistory(url+"?light&"+TheParameters) + PushHistory(url+"?light&"+TheParameters) } else { - ReplaceHistory(url+"?"+TheParameters) + PushHistory(url+"?"+TheParameters) } for (var i = 0; i < EntryIndices.length; i++) { var tNode = document.getElementById("entry-"+EntryIndices[i])