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

Function indexDownload

DownloadAllContent/DownloadAllContent.user.js:1032–1482  ·  view source on GitHub ↗
(aEles, noSort)

Source from the content-addressed store, hash-verified

1030 } else charsetValid = false;
1031 var iframePool = [];
1032 function indexDownload(aEles, noSort){
1033 if(aEles.length<1)return;
1034 initTxtDownDiv();
1035 if(!noSort) {
1036 if(GM_getValue("contentSort")){
1037 aEles.sort((a, b) => {
1038 return str2Num(a.innerText) - str2Num(b.innerText);
1039 });
1040 }
1041 if(GM_getValue("contentSortUrl")){
1042 aEles.sort((a, b) => {
1043 const nameA = a.href.toUpperCase();
1044 const nameB = b.href.toUpperCase();
1045 if (nameA < nameB) {
1046 return -1;
1047 }
1048 if (nameA > nameB) {
1049 return 1;
1050 }
1051 return 0;
1052 });
1053 }
1054 if(GM_getValue("reverse")){
1055 aEles=aEles.reverse();
1056 }
1057 }
1058 rCats=[];
1059 const minute=60000;
1060 var minTxtLength=GM_getValue("minTxtLength") || 100;
1061 var customTitle=GM_getValue("customTitle");
1062 var prefix=GM_getValue("prefix");
1063 var disableNextPage=!!GM_getValue("disableNextPage");
1064 var customNextPageReg=GM_getValue("nextPageReg");
1065 var maxDlPerMin=GM_getValue("maxDlPerMin") || 0;
1066 var dlCount=0;
1067 if (customNextPageReg) {
1068 try {
1069 innerNextPage = new RegExp(customNextPageReg);
1070 } catch(e) {
1071 console.warn(e);
1072 }
1073 }
1074 function packLink(doc, item) {
1075 if (customTitle) {
1076 try {
1077 let title = doc.querySelector(customTitle);
1078 if (title && title.innerText) {
1079 item.innerText = title.innerText;
1080 }
1081 } catch(e) {
1082 console.warn(e);
1083 }
1084 }
1085 }
1086 function getIframe() {
1087 if (iframePool && iframePool.length) return iframePool.shift();
1088 let iframe = document.createElement('iframe');
1089 iframe.name = 'pagetual-iframe';

Callers 1

filterListFunction · 0.85

Calls 3

initTxtDownDivFunction · 0.85
str2NumFunction · 0.85
downOnceFunction · 0.85

Tested by

no test coverage detected