Switch to ReplaceHistory.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Captain ALM 2022-07-30 16:57:18 +01:00
parent 5d7b39ac15
commit d9e37e4e2e
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -59,11 +59,11 @@ function SetupJSTheme() {
th.onclick = ToggleTheme th.onclick = ToggleTheme
} }
} }
function PushHistory(url) { function ReplaceHistory(url) {
let s = true let s = true
if (window.history) { if (window.history) {
if (window.history.pushState) { if (window.history.replaceState) {
window.history.pushState({}, "", url) window.history.replaceState({}, "", url)
s = false s = false
} }
} }
@ -84,7 +84,7 @@ function ToggleTheme() {
th.title = "Switch to Light Mode" th.title = "Switch to Light Mode"
document.getElementById("so-form").removeChild(document.getElementById("so-theme")) document.getElementById("so-form").removeChild(document.getElementById("so-theme"))
logo.href = "?" logo.href = "?"
PushHistory(url+"?"+TheParameters) ReplaceHistory(url+"?"+TheParameters)
thsty.href = CssDarkURL thsty.href = CssDarkURL
} else { } else {
thimg.src = MoonImageURL thimg.src = MoonImageURL
@ -97,9 +97,9 @@ function ToggleTheme() {
document.getElementById("so-form").appendChild(thi) document.getElementById("so-form").appendChild(thi)
logo.href = "?light" logo.href = "?light"
if (TheParameters === "") { if (TheParameters === "") {
PushHistory(url+"?light") ReplaceHistory(url+"?light")
} else { } else {
PushHistory(url+"?light&"+TheParameters) ReplaceHistory(url+"?light&"+TheParameters)
} }
thsty.href = CssLightURL thsty.href = CssLightURL
} }