Fixed the Pop issue and a naming issue.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Captain ALM 2022-07-30 21:45:57 +01:00
parent 90d43f46b8
commit 814b43e43d
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
1 changed files with 10 additions and 8 deletions

View File

@ -9,10 +9,10 @@ var SortOrderBStateI = true
var SortOrderEnabled = false var SortOrderEnabled = false
var SortValue = "" var SortValue = ""
var OrderValue = "" var OrderValue = ""
SetupJSHPL()
function SetupJS() { function SetupJS() {
SetupIndexArray() SetupIndexArray()
SetupJSTheme() SetupJSTheme()
SetupJSHPL()
SetupJSHSO() SetupJSHSO()
SetupJSSOI() SetupJSSOI()
} }
@ -68,10 +68,10 @@ function SetupJSTheme() {
var th = document.getElementById("theme") var th = document.getElementById("theme")
th.href = "#" th.href = "#"
if (document.addEventListener) { if (document.addEventListener) {
th.addEventListener("click", Toggvarheme) th.addEventListener("click", ToggleTheme)
} else { } else {
th.setAttribute("onclick", "Toggvarheme();") th.setAttribute("onclick", "ToggleTheme();")
th.onclick = Toggvarheme th.onclick = ToggleTheme
} }
} }
function PushHistory(url) { function PushHistory(url) {
@ -90,7 +90,7 @@ function PushHistory(url) {
document.location.href = url document.location.href = url
} }
} }
function Toggvarheme() { function ToggleTheme() {
var th = document.getElementById("theme") var th = document.getElementById("theme")
var thimg = document.getElementById("theme-img") var thimg = document.getElementById("theme-img")
var thsty = document.getElementById("style-theme") var thsty = document.getElementById("style-theme")
@ -124,15 +124,17 @@ function Toggvarheme() {
} }
} }
function SetupJSHPL(){ function SetupJSHPL(){
if (window.onpopstate) { if (window.history) {
window.addEventListener("popstate", HandleHistoryPop) if (window.history.pushState) {
window.addEventListener("popstate", HandleHistoryPop)
}
} }
} }
function HandleHistoryPop(event) { function HandleHistoryPop(event) {
if (event.state) { if (event.state) {
SortOrderEnabled = false SortOrderEnabled = false
var isnl = !document.getElementById("so-theme") var isnl = !document.getElementById("so-theme")
if ((event.state.light && isnl) || (!event.state.light && !isnl)) {Toggvarheme();} if ((event.state.light && isnl) || (!event.state.light && !isnl)) {ToggleTheme();}
document.getElementById("so-order").value = event.state.order document.getElementById("so-order").value = event.state.order
document.getElementById("so-sort").value = event.state.sort document.getElementById("so-sort").value = event.state.sort
EntrySort(event.state.order, event.state.sort) EntrySort(event.state.order, event.state.sort)