This commit is contained in:
parent
2e7595d639
commit
37221989f6
27
index.js
27
index.js
@ -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()
|
||||||
@ -75,22 +74,31 @@ function SetupJSTheme() {
|
|||||||
th.onclick = ToggleTheme
|
th.onclick = ToggleTheme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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) {
|
|
||||||
window.history.replaceState(objectData, "", url);
|
|
||||||
ReplaceNeeded = false
|
|
||||||
}
|
|
||||||
window.history.pushState(objectData, "", url);
|
|
||||||
console.log("PUSH")
|
console.log("PUSH")
|
||||||
console.log(objectData)
|
|
||||||
s = false
|
s = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,6 +142,7 @@ function ToggleTheme() {
|
|||||||
function SetupJSHPL(){
|
function SetupJSHPL(){
|
||||||
if (window.history) {
|
if (window.history) {
|
||||||
if (window.history.pushState) {
|
if (window.history.pushState) {
|
||||||
|
window.addEventListener("load", cReplaceHistory)
|
||||||
window.addEventListener("popstate", HandleHistoryPop)
|
window.addEventListener("popstate", HandleHistoryPop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user