MCPcopy Create free account
hub / github.com/hoothin/UserScripts / checkFunc

Function checkFunc

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

Source from the content-addressed store, hash-verified

11619 var checkClickedEle = null;
11620 var clickedSth = false;
11621 var checkFunc = () => {
11622 if (forceState == 1) return;
11623 if (checkClickedEle) {
11624 if (typeof ruleParser.curSiteRule.refreshByClick !== "undefined") {
11625 } else if (!clickedSth && checkClickedEle && checkClickedEle.nodeName) {
11626 if (compareNodeName(checkClickedEle, ["a", "button"]) && checkClickedEle.target !== "_blank" && ruleParser.needCheckClick(checkClickedEle)) {
11627 clickedSth = true;
11628 }
11629 }
11630 checkClickedEle = null;
11631 }
11632 if (checkUrlTime < 5000) {
11633 checkUrlTime += checkUrlTime>>1;
11634 }
11635 clearTimeout(checkUrlTimer);
11636 checkUrlTimer = setTimeout(checkFunc, checkUrlTime);
11637 if (document.hidden) return;
11638 if (clickedSth) {
11639 ruleParser.checkClickHref();
11640 clickedSth = false;
11641 } else if (!ruleParser.canListenUrlChange()) {
11642 return;
11643 }
11644 if ((prevPathname !== window.location.pathname || prevSearch !== window.location.search || window.location.hash.indexOf("#!") === 0) && window.location.href != ruleParser.historyUrl) {
11645 checkUrlTime = 2000;
11646 urlWillChange = true;
11647 var e = new Event('pagetual_pushState');
11648 e.arguments = arguments;
11649 window.dispatchEvent(e);
11650 clickedSth = false;
11651 }
11652 prevPathname = window.location.pathname;
11653 prevSearch = window.location.search;
11654 };
11655 checkUrlTimer = setTimeout(checkFunc, checkUrlTime);
11656
11657 document.addEventListener("click", e => {

Callers

nothing calls this directly

Calls 4

compareNodeNameFunction · 0.85
needCheckClickMethod · 0.80
checkClickHrefMethod · 0.80
canListenUrlChangeMethod · 0.80

Tested by

no test coverage detected