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

Function pageLoading

V2ex-Enhanced.user.js:403–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

401
402 // 自动无缝翻页
403 function pageLoading() {
404 if (curSite.SiteTypeID > 0){
405 windowScroll(function (direction, e) {
406 // 下滑 且 未暂停翻页 且 SiteTypeID > 0 时,才准备翻页
407 if (direction != 'down' || !pausePage) return
408 let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
409 scrollHeight = window.innerHeight || document.documentElement.clientHeight,
410 scrollDelta = curSite.pager.scrollDelta;
411 if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollDelta) {
412 if (curSite.pager.type === 1) {
413 ShowPager.loadMorePage();
414 }else{
415 let autopbn = document.querySelector(curSite.pager.nextLink);
416 if (autopbn){
417 autopbn.click();
418 pausePage = false
419 setTimeout(function(){pausePage = true;}, 500)
420 }
421 }
422 }
423 });
424 }
425 }
426
427
428 // 滚动条事件

Callers 1

Calls 1

windowScrollFunction · 0.70

Tested by

no test coverage detected