Compare commits

...

13 Commits

Author SHA1 Message Date
122faaae85
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 23:51:30 +01:00
0263964326
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 23:45:38 +01:00
121cc23cdf
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 23:41:13 +01:00
55c3793c0e
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 23:33:35 +01:00
66e603324d
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 23:29:12 +01:00
6c49ca08bf
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:57:41 +01:00
9ba879666c
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:55:29 +01:00
e793bb288d
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:51:16 +01:00
42cc8e43e1
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:44:54 +01:00
f7f8ba936c
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:43:03 +01:00
a9c8cb7dbd
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:40:23 +01:00
37221989f6
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:29:49 +01:00
2e7595d639
.
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-30 22:22:40 +01:00

View File

@ -9,7 +9,6 @@ var SortOrderBStateI = true
var SortOrderEnabled = false var SortOrderEnabled = false
var SortValue = "" var SortValue = ""
var OrderValue = "" var OrderValue = ""
var ReplaceNeeded = true
function SetupJS() { function SetupJS() {
SetupIndexArray() SetupIndexArray()
SetupJSTheme() SetupJSTheme()
@ -69,26 +68,37 @@ 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", ToggleTheme) th.addEventListener("click", CToggleTheme)
} else { } else {
th.setAttribute("onclick", "ToggleTheme();") th.setAttribute("onclick", "CToggleTheme();")
th.onclick = ToggleTheme th.onclick = CToggleTheme
}
}
function cReplaceHistory() {
ReplaceHistory(window.location.href)
}
function ReplaceHistory(url) {
if (window.history) {
if (window.history.replaceState) {
window.history.replaceState({
light: !!document.getElementById("so-theme"),
order: document.getElementById("so-order").value,
sort: document.getElementById("so-sort").value
}, "", url);
console.log("REPLACE")
}
} }
} }
function PushHistory(url) { function PushHistory(url) {
var s = true var s = true
if (window.history) { if (window.history) {
if (window.history.pushState) { if (window.history.pushState) {
var objectData = { 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
}; }, "", url);
if (ReplaceNeeded) { console.log("PUSH")
window.history.replaceState(objectData, "", url);
ReplaceNeeded = false
}
window.history.pushState( objectData, "", url);
s = false s = false
} }
} }
@ -96,7 +106,11 @@ function PushHistory(url) {
document.location.href = url document.location.href = url
} }
} }
function ToggleTheme() { function CToggleTheme() {
ToggleTheme(true)
}
function ToggleTheme(p) {
if (p) {cReplaceHistory();}
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")
@ -109,7 +123,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+"#") if (p) {PushHistory(url+"?"+TheParameters+"#");}
thsty.href = CssDarkURL thsty.href = CssDarkURL
} else { } else {
thimg.src = MoonImageURL thimg.src = MoonImageURL
@ -121,29 +135,34 @@ function ToggleTheme() {
thi.id = "so-theme" thi.id = "so-theme"
document.getElementById("so-form").appendChild(thi) document.getElementById("so-form").appendChild(thi)
logo.href = "?light" logo.href = "?light"
if (p) {
if (TheParameters === "") { if (TheParameters === "") {
PushHistory(url + "?light#") PushHistory(url + "?light#")
} else { } else {
PushHistory(url + "?light&" + TheParameters + "#") PushHistory(url + "?light&" + TheParameters + "#")
} }
}
thsty.href = CssLightURL thsty.href = CssLightURL
} }
} }
function SetupJSHPL(){ function SetupJSHPL(){
if (window.history) { if (window.history) {
if (window.history.pushState) { if (window.history.pushState && window.history.replaceState) {
//document.addEventListener("DOMContentLoaded", cReplaceHistory)
window.addEventListener("popstate", HandleHistoryPop) window.addEventListener("popstate", HandleHistoryPop)
} }
} }
} }
function HandleHistoryPop(event) { function HandleHistoryPop(event) {
console.log("POP")
console.log(event.state)
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)) {ToggleTheme();} if ((event.state.light && isnl) || (!event.state.light && !isnl)) {ToggleTheme(false);}
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, false)
SortOrderEnabled = true SortOrderEnabled = true
} }
} }
@ -203,9 +222,9 @@ function SetupJSSOI() {
SortOrderEnabled = true SortOrderEnabled = true
} }
function HandleSortOrderChange() { function HandleSortOrderChange() {
if (SortOrderEnabled) {EntrySort(document.getElementById("so-order").value, document.getElementById("so-sort").value);} if (SortOrderEnabled) {EntrySort(document.getElementById("so-order").value, document.getElementById("so-sort").value, true);}
} }
function EntrySort(o, s) { function EntrySort(o, s, p) {
var ts = s.toString().toLowerCase() var ts = s.toString().toLowerCase()
var chg = false var chg = false
if (SortValue !== s) { if (SortValue !== s) {
@ -251,11 +270,13 @@ function EntrySort(o, s) {
TheParameters = "order="+OrderValue+"&sort="+SortValue TheParameters = "order="+OrderValue+"&sort="+SortValue
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 (p) {
if (document.getElementById("so-theme")) { if (document.getElementById("so-theme")) {
PushHistory(url + "?light&" + TheParameters) PushHistory(url + "?light&" + TheParameters)
} else { } else {
PushHistory(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])
var pNode = tNode.parentNode var pNode = tNode.parentNode