1(function ($) { 2 $.widget("compo.imagesReplace", { 3 _create: function () { 4 var self = this; 5 6 $(window).on('load', function() { 7 for (var i = 0; i < document.images.length; i++) { 8 if (window.images_base_path != '' && !self.isImageOk(document.images[i]) ) { 9 var img = $(document.images[i]); 10 11 $(img).attr('src', window.images_base_path + '/' + $(img).attr('src')); 12 } 13 } 14 }); 15 }, 16 17 isImageOk: function (img) { 18 // During the onload event, IE correctly identifies any images that 19 // weren't downloaded as not complete. Others should too. Gecko-based 20 // browsers act like NS4 in that they report this incorrectly. 21 if (!img.complete) { 22 return false; 23 } 24 25 // However, they do have two very useful properties: naturalWidth and 26 // naturalHeight. These give the true size of the image. If it failed 27 // to load, either of these should be zero. 28 if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) { 29 return false; 30 } 31 32 // No other way of checking: assume it's ok. 33 return true; 34 } 35 36 }); 37})(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.