From 89ab8bcff8c90d482e0e974294693833d77a2d2c Mon Sep 17 00:00:00 2001 From: "lzyme.dev@gmail.com" Date: Sun, 11 Oct 2026 23:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=80=91=E5=B8=83=E6=B5=81?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=87=BA=E7=8E=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/jhs-enhance.user.js | 13 +++++++------ src/plugins/auto-page.js | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dist/jhs-enhance.user.js b/dist/jhs-enhance.user.js index e88a9a3..1408392 100644 --- a/dist/jhs-enhance.user.js +++ b/dist/jhs-enhance.user.js @@ -3329,9 +3329,6 @@ ${value}\r const nextLink = document.querySelector(selector.nextPageSelector); this.nextUrl = null == nextLink ? void 0 : nextLink.href; this.hasMore = !!this.nextUrl; - setTimeout((() => { - this.checkLoad(); - }), 1e3); this.hasMore || this.setState("waterfall-no-more", "已经到底了"); } async loadNextPage() { @@ -3403,7 +3400,9 @@ ${value}\r clog.error("加载失败:", e); this.setState("waterfall-error", "加载失败,点击重试"); } finally { - this.isLoading = false; + setTimeout((() => { + this.isLoading = false; + }), 600); } } checkScrollPosition() { @@ -3420,8 +3419,10 @@ ${value}\r } } checkLoad() { - if (!this.loader) return; - this.loader.getBoundingClientRect().top < window.innerHeight + this.preloadDistance && this.loadNextPage().then(); + if (!this.loader || this.isLoading || !this.hasMore) return; + if (window.scrollY < 100) return; + const triggerDistance = 200; + this.loader.getBoundingClientRect().top < window.innerHeight + triggerDistance && this.loadNextPage().then(); } async shouldDisablePaging() { if (!window.isListPage) return true; diff --git a/src/plugins/auto-page.js b/src/plugins/auto-page.js index c7c75e3..cc0db62 100644 --- a/src/plugins/auto-page.js +++ b/src/plugins/auto-page.js @@ -55,9 +55,6 @@ class AutoPagePlugin extends BasePlugin { const nextLink = document.querySelector(selector.nextPageSelector); this.nextUrl = null == nextLink ? void 0 : nextLink.href; this.hasMore = !!this.nextUrl; - setTimeout((() => { - this.checkLoad(); - }), 1e3); this.hasMore || this.setState("waterfall-no-more", "已经到底了"); } async loadNextPage() { @@ -128,7 +125,9 @@ class AutoPagePlugin extends BasePlugin { clog.error("加载失败:", e); this.setState("waterfall-error", "加载失败,点击重试"); } finally { - this.isLoading = !1; + setTimeout((() => { + this.isLoading = !1; + }), 600); } } checkScrollPosition() { @@ -145,8 +144,10 @@ class AutoPagePlugin extends BasePlugin { } } checkLoad() { - if (!this.loader) return; - this.loader.getBoundingClientRect().top < window.innerHeight + this.preloadDistance && this.loadNextPage().then(); + if (!this.loader || this.isLoading || !this.hasMore) return; + if (window.scrollY < 100) return; + const triggerDistance = 200; + this.loader.getBoundingClientRect().top < window.innerHeight + triggerDistance && this.loadNextPage().then(); } async shouldDisablePaging() { if (!window.isListPage) return !0;