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

Function forceRefresh

Pagetual/pagetual.user.js:13373–13402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13371 });
13372 let checkTimes = 0, findPageEle = false;
13373 let forceRefresh = e => {
13374 if (inAction || !iframeDoc) return;
13375 inAction = true;
13376 let foundNext = () => {
13377 document.removeEventListener("scroll", forceRefresh);
13378 }
13379 setTimeout(async () => {
13380 inAction = false;
13381 if (!ruleParser.nextLinkHref && !isPause) {
13382 checkTimes++;
13383 await ruleParser.getNextLink(iframeDoc, true);
13384 if (ruleParser.nextLinkHref) {
13385 foundNext();
13386 if (isLoading) isLoading = false;
13387 } else if (checkTimes >= 10) {
13388 foundNext();
13389 } else if (checkTimes >= 3 && !findPageEle) {
13390 if (!pageElement) pageElement = ruleParser.getPageElement(iframeDoc, curIframe.contentWindow);
13391 if (!pageElement) {
13392 inAction = true;
13393 curIframe.contentWindow.location.reload();
13394 } else {
13395 findPageEle = true;
13396 }
13397 }
13398 } else {
13399 foundNext();
13400 }
13401 }, 100);
13402 };
13403 document.addEventListener("scroll", forceRefresh);
13404 curIframe.src = url;
13405 curForceIframe = curIframe;

Callers

nothing calls this directly

Calls 3

foundNextFunction · 0.85
getNextLinkMethod · 0.80
getPageElementMethod · 0.80

Tested by

no test coverage detected