mirror of
https://github.com/fireinrain/JHS-enhance.git
synced 2026-10-14 05:16:37 +08:00
修复瀑布流加载出现错误
This commit is contained in:
Vendored
+7
-6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user