1 2var imgSizer = { 3 Config : { 4 imgCache : [] 5 ,spacer : "graphic/loader.gif" 6 } 7 8 ,collate : function(aScope) { 9 var isOldIE = (document.all && !window.opera && !window.XDomainRequest) ? 1 : 0; 10 if (isOldIE && document.getElementsByTagName) { 11 var c = imgSizer; 12 var imgCache = c.Config.imgCache; 13 14 var images = (aScope && aScope.length) ? aScope : document.getElementsByTagName("img"); 15 for (var i = 0; i < images.length; i++) { 16 images[i].origWidth = images[i].offsetWidth; 17 images[i].origHeight = images[i].offsetHeight; 18 19 imgCache.push(images[i]); 20 c.ieAlpha(images[i]); 21 images[i].style.width = "100%"; 22 } 23 24 if (imgCache.length) { 25 c.resize(function() { 26 for (var i = 0; i < imgCache.length; i++) { 27 var ratio = (imgCache[i].offsetWidth / imgCache[i].origWidth); 28 imgCache[i].style.height = (imgCache[i].origHeight * ratio) + "px"; 29 } 30 }); 31 } 32 } 33 } 34 35 ,ieAlpha : function(img) { 36 var c = imgSizer; 37 if (img.oldSrc) { 38 img.src = img.oldSrc; 39 } 40 var src = img.src; 41 img.style.width = img.offsetWidth + "px"; 42 img.style.height = img.offsetHeight + "px"; 43 img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')" 44 img.oldSrc = src; 45 img.src = c.Config.spacer; 46 } 47 48 // Ghettomodified version of Simon Willison's addLoadEvent() -- http://simonwillison.net/2004/May/26/addLoadEvent/ 49 ,resize : function(func) { 50 var oldonresize = window.onresize; 51 if (typeof window.onresize != 'function') { 52 window.onresize = func; 53 } else { 54 window.onresize = function() { 55 if (oldonresize) { 56 oldonresize(); 57 } 58 func(); 59 } 60 } 61 } 62} 63 64addLoadEvent(function() { 65 imgSizer.collate(); 66}); 67 68function addLoadEvent(func) { 69 var oldonload = window.onload; 70 if (typeof window.onload != 'function') { 71 window.onload = func; 72 } else { 73 window.onload = function() { 74 if (oldonload) { 75 oldonload(); 76 } 77 func(); 78 } 79 } 80}
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.