aboutsummaryrefslogtreecommitdiff
path: root/static/js/pager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/pager.ts')
-rw-r--r--static/js/pager.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/static/js/pager.ts b/static/js/pager.ts
index 68708cc..7231161 100644
--- a/static/js/pager.ts
+++ b/static/js/pager.ts
@@ -56,7 +56,7 @@
const fragmentClear = (entries) => {
for (let entry = 0; entry < entries.length; entry++) {
if (self.location.hash) {
- self.history.pushState(null, "", url);
+ self.history.replaceState(null, "", url);
}
}
};
@@ -78,7 +78,6 @@
self.addEventListener("DOMContentLoaded", function () {
scrollRestore(settings, url);
- fragmentRelease(fragmentClear);
self.addEventListener("click", function (event) {
const up = document.getElementById("top");
const back = document.getElementById("back");
@@ -86,7 +85,20 @@
});
});
+ let scrolls = 0;
+
+ let once = (action) => {
+ once = function () {};
+ action();
+ };
+
self.addEventListener("scroll", function () {
scrollTrack(settings, url);
+ if (scrolls > 3) {
+ once(function () {
+ fragmentRelease(fragmentClear);
+ });
+ }
+ scrolls++;
});
})();