MCPcopy Create free account
hub / github.com/XIU2/UserScript / pageLoading

Function pageLoading

52pojie-Enhanced.user.js:229–249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227
228 // 自动翻页
229 function pageLoading() {
230 if (!menu_value('menu_pageLoading')) return
231 if (curSite.SiteTypeID > 0) {
232 windowScroll(function (direction, e) {
233 if (direction === "down") { // 下滑才准备翻页
234 let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
235 let scrollDelta = curSite.pager.scrollDelta;
236 if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) {
237 if (curSite.pager.type === 1) {
238 ShowPager.loadMorePage();
239 } else {
240 let autopbn = document.querySelector(curSite.pager.nextLink);
241 if (autopbn && autopbn.textContent == curSite.pager.nextText) { // 如果正在加载,就不再点击
242 autopbn.click();
243 }
244 }
245 }
246 }
247 });
248 }
249 }
250
251
252 // 滚动条事件

Callers 1

Calls 2

menu_valueFunction · 0.70
windowScrollFunction · 0.70

Tested by

no test coverage detected