1/* 2 * jQuery Color Animations 3 * Copyright 2007 John Resig 4 * Released under the MIT and GPL licenses. 5 */ 6(function(jQuery){ 7 8 // We override the animation for all of these color styles 9 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 10 jQuery.fx.step[attr] = function(fx){ 11 if ( fx.state == 0 ) { 12 fx.start = getColor( fx.elem, attr ); 13 fx.end = getRGB( fx.end ); 14 } 15 16 fx.elem.style[attr] = "rgb(" + [ 17 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), 18 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 19 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 20 ].join(",") + ")"; 21 } 22 }); 23 24 // Color Conversion functions from highlightFade 25 // By Blair Mitchelmore 26 // http://jquery.offput.ca/highlightFade/ 27 28 // Parse strings looking for color tuples [255,255,255] 29 function getRGB(color) { 30 var result; 31 32 // Check if we're already dealing with an array of colors 33 if ( color && color.constructor == Array && color.length == 3 ) 34 return color; 35 36 // Look for rgb(num,num,num) 37 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 38 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 39 40 // Look for rgb(num%,num%,num%) 41 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 42 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 43 44 // Look for #a0b1c2 45 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 46 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 47 48 // Look for #fff 49 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 50 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 51 52 // Otherwise, we're most likely dealing with a named color 53 return colors[jQuery.trim(color).toLowerCase()]; 54 } 55 56 function getColor(elem, attr) { 57 var color; 58 59 do { 60 color = jQuery.curCSS(elem, attr); 61 62 // Keep going until we find an element that has color, or we hit the body 63 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 64 break; 65 66 attr = "backgroundColor"; 67 } while ( elem = elem.parentNode ); 68 69 return getRGB(color); 70 }; 71 72 // Some named colors to work with 73 // From Interface by Stefan Petre 74 // http://interface.eyecon.ro/ 75 76 var colors = { 77 aqua:[0,255,255], 78 azure:[240,255,255], 79 beige:[245,245,220], 80 black:[0,0,0], 81 blue:[0,0,255], 82 brown:[165,42,42], 83 cyan:[0,255,255], 84 darkblue:[0,0,139], 85 darkcyan:[0,139,139], 86 darkgrey:[169,169,169], 87 darkgreen:[0,100,0], 88 darkkhaki:[189,183,107], 89 darkmagenta:[139,0,139], 90 darkolivegreen:[85,107,47], 91 darkorange:[255,140,0], 92 darkorchid:[153,50,204], 93 darkred:[139,0,0], 94 darksalmon:[233,150,122], 95 darkviolet:[148,0,211], 96 fuchsia:[255,0,255], 97 gold:[255,215,0], 98 green:[0,128,0], 99 indigo:[75,0,130], 100 khaki:[240,230,140], 101 lightblue:[173,216,230], 102 lightcyan:[224,255,255], 103 lightgreen:[144,238,144], 104 lightgrey:[211,211,211], 105 lightpink:[255,182,193], 106 lightyellow:[255,255,224], 107 lime:[0,255,0], 108 magenta:[255,0,255], 109 maroon:[128,0,0], 110 navy:[0,0,128], 111 olive:[128,128,0], 112 orange:[255,165,0], 113 pink:[255,192,203], 114 purple:[128,0,128], 115 violet:[128,0,128], 116 red:[255,0,0], 117 silver:[192,192,192], 118 white:[255,255,255], 119 yellow:[255,255,0] 120 }; 121 122})(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.