1/*! 2 * jQuery imagesLoaded plugin v2.1.1 3 * http://github.com/desandro/imagesloaded 4 * 5 * MIT License. by Paul Irish et al. 6 */ 7 8(function( window, $, undefined ){ 9//'use strict'; 10 11// blank image data-uri bypasses webkit log warning (thx doug jones) 12var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; 13 14$(document).ready(function(){ 15$.fn.imagesLoaded = function( callback ) { 16 var $this = this, 17 deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, 18 hasNotify = $.isFunction(deferred.notify), 19 $images = $this.find('img').add( $this.filter('img') ), 20 loaded = [], 21 proper = [], 22 broken = []; 23 24 // Register deferred callbacks 25 if ($.isPlainObject(callback)) { 26 $.each(callback, function (key, value) { 27 if (key === 'callback') { 28 callback = value; 29 } else if (deferred) { 30 deferred[key](value); 31 } 32 }); 33 } 34 35 function doneLoading() { 36 var $proper = $(proper), 37 $broken = $(broken); 38 39 if ( deferred ) { 40 if ( broken.length ) { 41 deferred.reject( $images, $proper, $broken ); 42 } else { 43 deferred.resolve( $images ); 44 } 45 } 46 47 if ( $.isFunction( callback ) ) { 48 callback.call( $this, $images, $proper, $broken ); 49 } 50 } 51 52 function imgLoadedHandler( event ) { 53 imgLoaded( event.target, event.type === 'error' ); 54 } 55 56 function imgLoaded( img, isBroken ) { 57 // don't proceed if BLANK image, or image is already loaded 58 if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { 59 return; 60 } 61 62 // store element in loaded images array 63 loaded.push( img ); 64 65 // keep track of broken and properly loaded images 66 if ( isBroken ) { 67 broken.push( img ); 68 } else { 69 proper.push( img ); 70 } 71 72 // cache image and its state for future calls 73 $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } ); 74 75 // trigger deferred progress method if present 76 if ( hasNotify ) { 77 deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); 78 } 79 80 // call doneLoading and clean listeners if all images are loaded 81 if ( $images.length === loaded.length ) { 82 setTimeout( doneLoading ); 83 $images.unbind( '.imagesLoaded', imgLoadedHandler ); 84 } 85 } 86 87 // if no images, trigger immediately 88 if ( !$images.length ) { 89 doneLoading(); 90 } else { 91 $images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoadedHandler ) 92 .each( function( i, el ) { 93 var src = el.src; 94 95 // find out if this image has been already checked for status 96 // if it was, and src has not changed, call imgLoaded on it 97 var cached = $.data( el, 'imagesLoaded' ); 98 if ( cached && cached.src === src ) { 99 imgLoaded( el, cached.isBroken ); 100 return; 101 } 102 103 // if complete is true and browser supports natural sizes, try 104 // to check for image status manually 105 if ( el.complete && el.naturalWidth !== undefined ) { 106 imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); 107 return; 108 } 109 110 // cached images don't fire load sometimes, so we reset src, but only when 111 // dealing with IE, or image is complete (loaded) and failed manual check 112 // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f 113 if ( el.readyState || el.complete ) { 114 el.src = BLANK; 115 el.src = src; 116 } 117 }); 118 } 119 120 return deferred ? deferred.promise( $this ) : $this; 121}; 122 123})})( window, jQuery ); 124//});
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.