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() } }) })