Greasy Fork is available in English.

Image Downloader

Images can be extracted and batch downloaded from most websites. Especially for websites the right click fails or image can not save. Extra features: zip download / auto-enlarge image. See the script description at info page (suitable for chrome/firefox+tampermonkey)

< Feedback on Image Downloader

Câu hỏi/Bình luận

§
Posted: 02-06-2024
Edited: 02-06-2024

函数 function replaceByReg(urlStr,urlIndex) 的实现建议优化成下面这样,原来的实现会造成相同元素重复多次(不匹配的规则都会放一次,规则越多重复越多)放进一个数组里。

function replaceByReg(urlStr,urlIndex){
//if(!urlStr)return;
if(urlStr.includes("data:image/")){
that.bigImageArray.push(urlStr);
return;
}

let matchFlag=0;

that.defaultRules.forEach((rule,ruleIndex)=>{
if(that.defaultRulesChecked[ruleIndex]==="checked"){

let bigImage=urlStr.replace(rule.originReg,rule.replacement);
if(bigImage!==urlStr){
that.bigImageArray.push(urlStr);//注释掉此行就是不要小图
that.bigImageArray.push(bigImage);
matchFlag=1;//指示已经匹配上规则了
}
}
})

that.userRules.forEach((rule,ruleIndex)=>{
if(that.userRulesChecked[ruleIndex]==="checked"){

let bigImage=urlStr.replace(rule.originReg,rule.replacement);
if(bigImage!==urlStr){
that.bigImageArray.push(urlStr);//注释掉此行就是不要小图
that.bigImageArray.push(bigImage);
matchFlag=1;//指示已经匹配上规则了
}
}
})

if(matchFlag===0){
that.bigImageArray.push(urlStr);//匹配不上任何规则的时候才执行
}
}

Post reply

Đăng nhập để bình luận