1jQuery(function($){ 2 3 4 $.fn.foxlazy = function(threshold, callback) { 5 6 var $w = $(window), 7 th = threshold || 0, 8 retina = window.devicePixelRatio > 1, 9 attrib = retina ? "data-lazy-src-retina" : "data-lazy-src", 10 images = this, 11 loaded; 12 13 this.one("foxlazy", function() { 14 var source = this.getAttribute(attrib); 15 source = source || this.getAttribute("data-lazy-src"); 16 if (source) { 17 this.setAttribute("src", source); 18 if ($(this).hasClass('hidden-img')) { 19 $(this).parent().css( 'background-image' , 'url(' + source + ')' ); 20 $(this).hide(); 21 } 22 } 23 if (typeof callback === "function") callback.call(this); 24 }); 25 26 function foxlazy() { 27 var inview = images.filter(function() { 28 var $e = $(this); 29 30 var scrollTop = $w.scrollTop(),// scrollTop 31 scrollTopHeight = scrollTop + $w.height(), // scrollTopHeight 32 offsetTop = $e.offset().top, // offsetTop 33 offsetTopHeight = offsetTop + $e.height(); // offsetTopHeight 34 35 return offsetTopHeight >= scrollTop - th && offsetTop <= scrollTopHeight + th; 36 }); 37 38 loaded = inview.trigger("foxlazy"); 39 images = images.not(loaded); 40 } 41 42 $w.on("load.foxlazy scroll.foxlazy resize.foxlazy lookup.foxlazy", foxlazy); 43 44 foxlazy(); 45 46 return this; 47 48 }; 49 50 $("img[data-lazy-src]").foxlazy(); 51 52});
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.