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

Function checkNextPage

DownloadAllContent/DownloadAllContent.user.js:1509–1529  ·  view source on GitHub ↗
(doc, baseUrl)

Source from the content-addressed store, hash-verified

1507 }
1508
1509 async function checkNextPage(doc, baseUrl) {
1510 let nextPage = null;
1511 if (nextPageFunc) {
1512 nextPage = await nextPageFunc(doc, baseUrl);
1513 if (nextPage && nextPage.length === 0) nextPage = null;
1514 } else {
1515 let aTags = doc.querySelectorAll("a");
1516 for (var i = 0; i < aTags.length; i++) {
1517 let aTag = aTags[i];
1518 if (innerNextPage.test(aTag.innerText) && aTag.href && !/javascript:|#/.test(aTag.href)) {
1519 let nextPageHref = canonicalUri(aTag.getAttribute("href"), baseUrl || location.href);
1520 if (nextPageHref != location.href) {
1521 nextPage = aTag;
1522 nextPage.href = nextPageHref;
1523 break;
1524 }
1525 }
1526 }
1527 }
1528 return nextPage;
1529 }
1530
1531 function textNodesUnder(el){
1532 var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);

Callers 2

requestDocFunction · 0.85
checkIframeFunction · 0.85

Calls 1

canonicalUriFunction · 0.70

Tested by

no test coverage detected