Blog/js/jquery.imagesloaded.min.js
2024-11-19 03:05:20 +00:00

1 line
No EOL
1 KiB
JavaScript

(function(d,b){var a="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";d.fn.imagesLoaded=function(t){function l(){var e=d(q),f=d(r);v&&(r.length?v.reject(u,e,f):v.resolve(u));d.isFunction(t)&&t.call(s,u,e,f)}function p(e,f){e.src===a||-1!==d.inArray(e,n)||(n.push(e),f?r.push(e):q.push(e),d.data(e,"imagesLoaded",{isBroken:f,src:e.src}),c&&v.notifyWith(d(e),[f,u,d(q),d(r)]),u.length===n.length&&(setTimeout(l),u.unbind(".imagesLoaded")))}var s=this,v=d.isFunction(d.Deferred)?d.Deferred():0,c=d.isFunction(v.notify),u=s.find("img").add(s.filter("img")),n=[],q=[],r=[];d.isPlainObject(t)&&d.each(t,function(e,f){if("callback"===e){t=f}else{if(v){v[e](f)}}});u.length?u.bind("load.imagesLoaded error.imagesLoaded",function(e){p(e.target,"error"===e.type)}).each(function(f,g){var i=g.src,h=d.data(g,"imagesLoaded");if(h&&h.src===i){p(g,h.isBroken)}else{if(g.complete&&g.naturalWidth!==b){p(g,0===g.naturalWidth||0===g.naturalHeight)}else{if(g.readyState||g.complete){g.src=a,g.src=i}}}}):l();return v?v.promise(s):s}})(jQuery);