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);
|
const nextLink = document.querySelector(selector.nextPageSelector);
|
||||||
this.nextUrl = null == nextLink ? void 0 : nextLink.href;
|
this.nextUrl = null == nextLink ? void 0 : nextLink.href;
|
||||||
this.hasMore = !!this.nextUrl;
|
this.hasMore = !!this.nextUrl;
|
||||||
setTimeout((() => {
|
|
||||||
this.checkLoad();
|
|
||||||
}), 1e3);
|
|
||||||
this.hasMore || this.setState("waterfall-no-more", "已经到底了");
|
this.hasMore || this.setState("waterfall-no-more", "已经到底了");
|
||||||
}
|
}
|
||||||
async loadNextPage() {
|
async loadNextPage() {
|
||||||
@@ -3403,7 +3400,9 @@ ${value}\r
|
|||||||
clog.error("加载失败:", e);
|
clog.error("加载失败:", e);
|
||||||
this.setState("waterfall-error", "加载失败,点击重试");
|
this.setState("waterfall-error", "加载失败,点击重试");
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false;
|
setTimeout((() => {
|
||||||
|
this.isLoading = false;
|
||||||
|
}), 600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkScrollPosition() {
|
checkScrollPosition() {
|
||||||
@@ -3420,8 +3419,10 @@ ${value}\r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkLoad() {
|
checkLoad() {
|
||||||
if (!this.loader) return;
|
if (!this.loader || this.isLoading || !this.hasMore) return;
|
||||||
this.loader.getBoundingClientRect().top < window.innerHeight + this.preloadDistance && this.loadNextPage().then();
|
if (window.scrollY < 100) return;
|
||||||
|
const triggerDistance = 200;
|
||||||
|
this.loader.getBoundingClientRect().top < window.innerHeight + triggerDistance && this.loadNextPage().then();
|
||||||
}
|
}
|
||||||
async shouldDisablePaging() {
|
async shouldDisablePaging() {
|
||||||
if (!window.isListPage) return true;
|
if (!window.isListPage) return true;
|
||||||
|
|||||||
@@ -55,9 +55,6 @@ class AutoPagePlugin extends BasePlugin {
|
|||||||
const nextLink = document.querySelector(selector.nextPageSelector);
|
const nextLink = document.querySelector(selector.nextPageSelector);
|
||||||
this.nextUrl = null == nextLink ? void 0 : nextLink.href;
|
this.nextUrl = null == nextLink ? void 0 : nextLink.href;
|
||||||
this.hasMore = !!this.nextUrl;
|
this.hasMore = !!this.nextUrl;
|
||||||
setTimeout((() => {
|
|
||||||
this.checkLoad();
|
|
||||||
}), 1e3);
|
|
||||||
this.hasMore || this.setState("waterfall-no-more", "已经到底了");
|
this.hasMore || this.setState("waterfall-no-more", "已经到底了");
|
||||||
}
|
}
|
||||||
async loadNextPage() {
|
async loadNextPage() {
|
||||||
@@ -128,7 +125,9 @@ class AutoPagePlugin extends BasePlugin {
|
|||||||
clog.error("加载失败:", e);
|
clog.error("加载失败:", e);
|
||||||
this.setState("waterfall-error", "加载失败,点击重试");
|
this.setState("waterfall-error", "加载失败,点击重试");
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = !1;
|
setTimeout((() => {
|
||||||
|
this.isLoading = !1;
|
||||||
|
}), 600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkScrollPosition() {
|
checkScrollPosition() {
|
||||||
@@ -145,8 +144,10 @@ class AutoPagePlugin extends BasePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkLoad() {
|
checkLoad() {
|
||||||
if (!this.loader) return;
|
if (!this.loader || this.isLoading || !this.hasMore) return;
|
||||||
this.loader.getBoundingClientRect().top < window.innerHeight + this.preloadDistance && this.loadNextPage().then();
|
if (window.scrollY < 100) return;
|
||||||
|
const triggerDistance = 200;
|
||||||
|
this.loader.getBoundingClientRect().top < window.innerHeight + triggerDistance && this.loadNextPage().then();
|
||||||
}
|
}
|
||||||
async shouldDisablePaging() {
|
async shouldDisablePaging() {
|
||||||
if (!window.isListPage) return !0;
|
if (!window.isListPage) return !0;
|
||||||
|
|||||||
Reference in New Issue
Block a user