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

Function getAllEnableUrl

Easy offline/Easy offline.user.js:977–1091  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

975 }
976
977 function getAllEnableUrl(target) {
978 storage.getItem('eoDisable_'+document.domain,v=>{
979 if(!v){
980 var rawnodes=(target?$(target).find(enableUrl):$(enableUrl)).get(),customnodes=[];
981 var nodes = [];
982 var i;
983 var curNode;
984 if(regs){
985 let aTags = (target?$(target).find("a"):$("a")).get();
986 for(let aTag of aTags){
987 for(let reg of regs){
988 reg=reg.trim();
989 if(reg==="")continue;
990 let patt=new RegExp(reg,"i");
991 if(patt.test(aTag.href) && $.inArray(aTag, rawnodes)==-1){
992 customnodes.push(aTag);
993 break;
994 }
995 }
996 }
997 }
998
999 if(rawnodes.length > 0){
1000 for (i = 0; i < rawnodes.length; i++) {
1001 var disable = false;
1002 curNode = rawnodes[i];
1003 if(curNode.className=="whx-a-node")continue;
1004 if(curNode.nextElementSibling && curNode.nextElementSibling.className=="whx-a-node" && curNode.nextElementSibling.parentNode){
1005 continue;
1006 }
1007 if(!/^magnet|^ed2k:\/\//.test(curNode.href)){
1008 if(/[#\?]|\/\.[^\.]+$/.test(curNode.href))continue;
1009 for(var j = 0; j < disableUrl.length; j++){
1010 var temp = disableUrl[j];
1011 if(curNode.href.indexOf(temp)!=-1){
1012 disable = true;
1013 break;
1014 }
1015 }
1016 if(disable)continue;
1017 }
1018 if(!include(nodes,curNode)){
1019 nodes.push(curNode);
1020 }
1021 }
1022 }
1023 if(customnodes.length > 0){
1024 for (i = 0; i < customnodes.length; i++) {
1025 curNode = customnodes[i];
1026 if(!include(nodes,curNode)){
1027 nodes.push(curNode);
1028 }
1029 }
1030 }
1031
1032 let overArr=[];
1033 if(overRegs){
1034 let aTags = (target?$(target).find("a"):$("a")).get();

Callers 2

pageRunFunction · 0.85
toggleIconFunction · 0.85

Calls 6

includeFunction · 0.85
showDiskIconsFunction · 0.85
containsMethod · 0.80
initFunction · 0.70
checkKeyFunction · 0.70
$Function · 0.50

Tested by

no test coverage detected