aboutsummaryrefslogtreecommitdiff
path: root/ui/client-scripts/src/pagination.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ui/client-scripts/src/pagination.ts')
-rw-r--r--ui/client-scripts/src/pagination.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/client-scripts/src/pagination.ts b/ui/client-scripts/src/pagination.ts
new file mode 100644
index 0000000..380b20e
--- /dev/null
+++ b/ui/client-scripts/src/pagination.ts
@@ -0,0 +1,18 @@
+
+globalThis.addEventListener("DOMContentLoaded", () => {
+ const el = document.querySelector(".next_page") as HTMLElement
+ if (!el) return
+ const cont = document.body.parentElement!
+ console.log(cont);
+
+ cont.addEventListener("scroll", () => {
+ const end = cont.scrollTop + cont.clientHeight
+ console.log(end, cont.scrollHeight);
+
+ if (end + 1000 > el.scrollHeight) {
+ el.textContent = "Loading more..."
+ el.click()
+ }
+
+ })
+})