Switch ReplaceHistory with PushHistory
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Captain ALM 2022-07-30 21:21:17 +01:00
parent a314ffa2b1
commit aa82a91a29
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -74,11 +74,11 @@ function SetupJSTheme() {
th.onclick = Toggvarheme th.onclick = Toggvarheme
} }
} }
function ReplaceHistory(url) { function PushHistory(url) {
var s = true var s = true
if (window.history) { if (window.history) {
if (window.history.replaceState) { if (window.history.pushState) {
window.history.replaceState({ window.history.pushState({
light: !!document.getElementById("so-theme"), light: !!document.getElementById("so-theme"),
order: document.getElementById("so-order").value, order: document.getElementById("so-order").value,
sort: document.getElementById("so-sort").value sort: document.getElementById("so-sort").value
@ -103,7 +103,7 @@ function Toggvarheme() {
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 = "?"
ReplaceHistory(url+"?"+TheParameters+"#") PushHistory(url+"?"+TheParameters+"#")
thsty.href = CssDarkURL thsty.href = CssDarkURL
} else { } else {
thimg.src = MoonImageURL thimg.src = MoonImageURL
@ -116,9 +116,9 @@ function Toggvarheme() {
document.getElementById("so-form").appendChild(thi) document.getElementById("so-form").appendChild(thi)
logo.href = "?light" logo.href = "?light"
if (TheParameters === "") { if (TheParameters === "") {
ReplaceHistory(url+"?light#") PushHistory(url+"?light#")
} else { } else {
ReplaceHistory(url+"?light&"+TheParameters+"#") PushHistory(url+"?light&"+TheParameters+"#")
} }
thsty.href = CssLightURL thsty.href = CssLightURL
} }
@ -244,9 +244,9 @@ function EntrySort(o, s) {
var url = document.location.href var url = document.location.href
url = url.split("#", 1)[0].split('?', 1)[0] url = url.split("#", 1)[0].split('?', 1)[0]
if (document.getElementById("so-theme")) { if (document.getElementById("so-theme")) {
ReplaceHistory(url+"?light&"+TheParameters) PushHistory(url+"?light&"+TheParameters)
} else { } else {
ReplaceHistory(url+"?"+TheParameters) PushHistory(url+"?"+TheParameters)
} }
for (var i = 0; i < EntryIndices.length; i++) { for (var i = 0; i < EntryIndices.length; i++) {
var tNode = document.getElementById("entry-"+EntryIndices[i]) var tNode = document.getElementById("entry-"+EntryIndices[i])