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

Function cbFunc

DownloadAllContent/DownloadAllContent.user.js:1432–1456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1430 var waitForComplete;
1431 function processDoc(i, aTag, doc, cause, check){
1432 let cbFunc=content=>{
1433 packLink(doc, aTag);
1434 let isHref = "";
1435 let saveUrl = GM_getValue("saveUrl");
1436 if (saveUrl){
1437 isHref = aTag.href + '\r\n';
1438 }
1439 rCats[i]=(aTag.innerText.replace(/[\r\n\t]/g, "") + "\r\n" + isHref + (cause || '') + content.replace(/\s*$/, ""));
1440 curRequests = curRequests.filter(function(e){return e[0]!=i});
1441 txtDownContent.style.display="block";
1442 txtDownWords.innerHTML=getI18n("downloading",[downNum,(aEles.length-downNum),aTag.innerText]);
1443 if(downNum==aEles.length){
1444 if(waitForComplete) clearTimeout(waitForComplete);
1445 waitForComplete=setTimeout(()=>{
1446 if(downNum==aEles.length){
1447 txtDownWords.innerHTML=getI18n("complete",[downNum]);
1448 sortInnerPage();
1449 var disableAutoStartSave = GM_getValue("disableAutoStartSave");
1450 if(!disableAutoStartSave){
1451 saveContent();
1452 }
1453 }
1454 },3000);
1455 }
1456 };
1457 let contentResult=getPageContent(doc, content=>{
1458 cbFunc(content);
1459 }, aTag.href);

Callers 1

processDocFunction · 0.85

Calls 4

packLinkFunction · 0.85
getI18nFunction · 0.85
sortInnerPageFunction · 0.85
saveContentFunction · 0.85

Tested by

no test coverage detected