MCPcopy
hub / github.com/hoothin/UserScripts / pretreatment

Function pretreatment

Picviewer CE+/dist.user.js:25663–25681  ·  view source on GitHub ↗
(img, fetchImg)

Source from the content-addressed store, hash-verified

25661 // ------------------- run -------------------------
25662
25663 function pretreatment(img, fetchImg) {
25664 if (img.removeAttribute) img.removeAttribute("loading");
25665 if (img.nodeName.toUpperCase() != "IMG" || (!fetchImg && img.src && !img.srcset && !/^data/.test(img.src))) return;
25666 if (img.src && !/(^data|loading|lazy)/.test(img.src)) return;
25667 let src;
25668 tprules.find(function(rule, index, array) {
25669 try {
25670 src = rule.call(img);
25671 if (src) {
25672 return true;
25673 }
25674 } catch(err) {
25675 debug(err);
25676 }
25677 });
25678 if (src) {
25679 img.src = src;
25680 }
25681 }
25682
25683 function findPic(img){
25684 var imgPN=img;

Callers 3

initFunction · 0.70
findFileFunction · 0.70
checkFloatBarFunction · 0.70

Calls 1

debugFunction · 0.85

Tested by

no test coverage detected