aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-03-08 14:01:03 -0500
committertdro <tdro@noreply.example.com>2024-03-08 14:01:03 -0500
commitb45fff68d24f8bfc12d2ed3ae995c4e0e9a8d9e0 (patch)
tree4bd30dcb65dff57705ba584c9876cfc4aae58803 /static
parentaf9456193c6241345172128b8b947a613681b04f (diff)
downloadcanory-b45fff68d24f8bfc12d2ed3ae995c4e0e9a8d9e0.tar.gz
canory-b45fff68d24f8bfc12d2ed3ae995c4e0e9a8d9e0.tar.bz2
canory-b45fff68d24f8bfc12d2ed3ae995c4e0e9a8d9e0.zip
static/js/pager: Add default state
Diffstat (limited to 'static')
-rw-r--r--static/js/pager.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/static/js/pager.ts b/static/js/pager.ts
index 3f7279c..ebaf67a 100644
--- a/static/js/pager.ts
+++ b/static/js/pager.ts
@@ -7,15 +7,15 @@
return console.warn("WARNING: Pager disabled due to cookie restrictions");
}
- let url;
let seek;
let pager = {};
+ const state = "on";
const key = "config.scroll.pager.urls";
if (!localStorage[key]) localStorage[key] = JSON.stringify(pager);
- const link = function () { url = self.location.href.split("#")[0].split("?")[0]; };
+ let url = function () { return self.location.href.split("#")[0].split("?")[0]; };
const scrollHash = function (url) {
const hash = self.location.hash;
@@ -73,7 +73,7 @@
function (event) {
self.addEventListener(event, function (event) {
if (event.type === "pageshow") {
- return event.persisted && self.scrollTo(0, pager[url]);
+ return event.persisted && self.scrollTo(0, pager[url()]);
}
if (event.type === "DOMContentLoaded") {
self.addEventListener("click", function (event) {
@@ -82,14 +82,14 @@
scrollReverse(back, up, event);
});
}
- link(); scrollRestore(url);
+ scrollRestore(url());
});
},
);
["click", "touchstart", "scroll"].forEach(function (event) {
self.addEventListener(event, function () {
- link(); scrollTrack(url);
+ scrollTrack(url());
});
});
})();