MCPcopy Index your code
hub / github.com/hoothin/UserScripts / checkPage

Function checkPage

Pagetual/pagetual.user.js:12838–13035  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12836 }
12837 }
12838 async function checkPage() {
12839 if (isPause) return loadPageOver();
12840 try {
12841 iframeDoc = emuIframe.contentDocument || emuIframe.contentWindow.document;
12842 } catch(e) {
12843 returnFalse(corsTips);
12844 return;
12845 }
12846 getBody(iframeDoc).scrollTop = 9999999;
12847 if (iframeDoc.documentElement) {
12848 iframeDoc.documentElement.scrollTop = 9999999;
12849 }
12850
12851 let waitTime = 200, checkEval;
12852 ruleParser.runWait((_checkEval, _waitTime) => {
12853 if (_checkEval) {
12854 checkEval = _checkEval;
12855 }
12856 if (_waitTime) {
12857 waitTime = _waitTime;
12858 }
12859 });
12860
12861 if (!orgPage) {
12862 if (!loadmoreEnd) {
12863 loadmoreBtn = getLoadMore(iframeDoc);
12864 if (loadmoreBtn && isVisible(loadmoreBtn, emuIframe.contentWindow)) {
12865 emuClick(loadmoreBtn, iframeDoc);
12866 let intv = setInterval(() => {
12867 loadmoreBtn = getLoadMore(iframeDoc);
12868 if (!loadmoreBtn || !getBody(document).contains(loadmoreBtn) || !isVisible(loadmoreBtn, emuIframe.contentWindow)) {
12869 clearInterval(intv);
12870 loadmoreEnd = true;
12871 setTimeout(() => {
12872 checkPage();
12873 }, 500);
12874 } else if (isInViewPort(loadmoreBtn)) {
12875 emuClick(loadmoreBtn, iframeDoc);
12876 }
12877 }, 200);
12878 return;
12879 } else {
12880 loadmoreEnd = true;
12881 }
12882 }
12883 if (checkEval && !await checkEval(iframeDoc)) {
12884 waitTimes = 50;
12885 setTimeout(() => {
12886 checkPage();
12887 }, waitTime);
12888 return;
12889 } else {
12890 if (!nextLink || !nextLink.offsetParent) nextLink = await ruleParser.getNextLink(iframeDoc, true);
12891 if (nextLink) pageEle = ruleParser.getPageElement(iframeDoc, emuIframe.contentWindow, true);
12892 if (!pageEle || pageEle.length == 0 || !nextLink) {
12893 getBody(iframeDoc).scrollTop = 9999999;
12894 if (iframeDoc.documentElement) {
12895 iframeDoc.documentElement.scrollTop = 9999999;

Callers 1

emuPageFunction · 0.85

Calls 14

loadPageOverFunction · 0.85
returnFalseFunction · 0.85
getLoadMoreFunction · 0.85
isVisibleFunction · 0.85
isInViewPortFunction · 0.85
compareNodeNameFunction · 0.85
runWaitMethod · 0.80
containsMethod · 0.80
getNextLinkMethod · 0.80
getPageElementMethod · 0.80
checkStopSignMethod · 0.80
hookUrlMethod · 0.80

Tested by

no test coverage detected