1(function ($) { 2 /*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false */ 3 /*global jQuery,setTimeout */ 4 5 $.pixelentity = $.pixelentity || {version: '1.0.0'}; 6 7 if ($.pixelentity.preloader) { 8 return; 9 } 10 11 function loaded(e) { 12 var image = $(e.currentTarget); 13 //var loaderInfo = image.data("peUtilsLoader"); 14 var loaderInfo; 15 16 while (image.data("peUtilsLoader") && (loaderInfo = image.data("peUtilsLoader").shift())) { 17 if (--loaderInfo.total <= 0) { 18 var cb = loaderInfo.callback; 19 var target = loaderInfo.target; 20 image.unbind("load error",loaded); 21 if (typeof cb === "function") { 22 cb(target); 23 } 24 } 25 } 26 } 27 28 var preloader = $.pixelentity.preloader = { 29 load: function (el,callback,noreplace) { 30 el = (el instanceof jQuery) ? el : $(el); 31 var images = (el[0].tagName.toLowerCase() == "img") ? [el[0]] : el.find("img").get(); 32 33 var image; 34 var list = []; 35 var complete; 36 37 while ((image = images.shift())) { 38 complete = image.complete; 39 if (!(image.src && complete && !(image.src.match(/blank.png$/i) !== null && image.getAttribute("data-src")))) { 40 list.push(image); 41 } 42 } 43 44 if (list.length > 0) { 45 var loaderInfo = { 46 target: el, 47 callback: callback, 48 total: list.length 49 }; 50 51 while ((image = list.shift())) { 52 53 image = $(image); 54 55 if (!noreplace && $.browser.msie && image[0].src.match(/blank.png$/i) !== null) { 56 image.removeAttr("src"); 57 image.replaceWith(image.clone()); 58 if (!image.attr("data-src")) { 59 // nothing to be loaded here 60 loaderInfo.total--; 61 //continue; 62 } 63 } 64 65 if (image.data("peUtilsLoader")) { 66 image.data("peUtilsLoader").push(loaderInfo); 67 } else { 68 image.data("peUtilsLoader",[loaderInfo]); 69 } 70 71 image 72 .one("load error",loaded); 73 74 if (image.attr("data-src")) { 75 image.attr("src",image.attr("data-src")); 76 image.removeAttr("data-src"); 77 } else if ($.browser.msie) { 78 image.attr("src",image.attr("src")); 79 } 80 81 image = undefined; 82 83 } 84 } else { 85 callback(el); 86 } 87 }, 88 clear: function(el,callback) { 89 el = (el instanceof jQuery) ? el : $(el); 90 var images = (el[0].tagName.toLowerCase() == "img") ? [el[0]] : el.find("img").get(); 91 var image,loaderInfo,cb; 92 while ((image = images.shift())) { 93 image = $(image); 94 while (image.data("peUtilsLoader") && (loaderInfo = image.data("peUtilsLoader").shift())) { 95 cb = loaderInfo.callback; 96 if (cb === callback) { 97 loaderInfo.callback = false; 98 break; 99 } 100 } 101 } 102 103 } 104 }; 105 106}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.