(i, aTag, doc, cause, check)
| 1429 | } |
| 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); |
| 1460 | if(contentResult!==false){ |
| 1461 | if(check && contentResult && contentResult.replace(/\s/g, "").length<minTxtLength){ |
| 1462 | return false; |
| 1463 | } |
| 1464 | cbFunc(contentResult); |
| 1465 | } |
| 1466 | return true; |
| 1467 | } |
| 1468 | var downThreadNum = parseInt(GM_getValue("downThreadNum")); |
| 1469 | downThreadNum = downThreadNum || 20; |
| 1470 | if (useIframe && downThreadNum > 5) { |
no test coverage detected