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

Function crosHandler

Picviewer CE+/dist.user.js:16330–16350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16328 var len = saveParams.length;
16329 function downloadOne(imgSrc, imgName, over){
16330 let crosHandler = imgSrc => {
16331 urlToBlob(imgSrc, (blob, ext)=>{
16332 if (blob && blob.size>58) {
16333 let fileName = imgName.replace(/\//g, "");
16334 if (ext) fileName = fileName.replace(/\.\w+$/, "") + "." + ext;
16335 zip.file(fileName, blob);
16336 } else console.debug("error: "+imgSrc);
16337 downloaded++;
16338 over && over();
16339 self.showTips("Downloading "+downloaded+"/"+len, 1000000);
16340 if(downloaded == len){
16341 self.showTips(`Begin compress to ${packName}...`, 100000);
16342 zip.generateAsync({type:"blob"}, meta=>{self.showCompressProgress(meta)}).then(function(content){
16343 if (content) {
16344 saveAs(content, packName);
16345 }
16346 callback();
16347 })
16348 }
16349 });
16350 }
16351 if(canvas && (/^data:/.test(imgSrc) || imgSrc.split("/")[2] == document.domain)){
16352 urlToBlobWithFetch(imgSrc, (blob, ext)=>{
16353 if(!blob){

Callers 1

downloadOneFunction · 0.70

Calls 2

overFunction · 0.85
urlToBlobFunction · 0.70

Tested by

no test coverage detected