Ticket #5369: jquery-alerts.2.diff
File jquery-alerts.2.diff, 8.3 KB (added by , 17 years ago) |
---|
-
wp-includes/js/jquery/jquery.color.js
1 /* 2 * jQuery Color Animations 3 * Copyright 2007 John Resig 4 * Released under the MIT and GPL licenses. 5 */ 6 7 (function(jQuery){ 8 9 // We override the animation for all of these color styles 10 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 11 jQuery.fx.step[attr] = function(fx){ 12 if ( fx.state == 0 ) { 13 fx.start = getColor( fx.elem, attr ); 14 fx.end = getRGB( fx.end ); 15 } 16 17 fx.elem.style[attr] = "rgb(" + [ 18 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), 19 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 20 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 21 ].join(",") + ")"; 22 } 23 }); 24 25 // Color Conversion functions from highlightFade 26 // By Blair Mitchelmore 27 // http://jquery.offput.ca/highlightFade/ 28 29 // Parse strings looking for color tuples [255,255,255] 30 function getRGB(color) { 31 var result; 32 33 // Check if we're already dealing with an array of colors 34 if ( color && color.constructor == Array && color.length == 3 ) 35 return color; 36 37 // Look for rgb(num,num,num) 38 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 39 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 40 41 // Look for rgb(num%,num%,num%) 42 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 43 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 44 45 // Look for #a0b1c2 46 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 47 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 48 49 // Look for #fff 50 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 51 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 52 53 // Otherwise, we're most likely dealing with a named color 54 return colors[jQuery.trim(color).toLowerCase()]; 55 } 56 57 function getColor(elem, attr) { 58 var color; 59 60 do { 61 color = jQuery.curCSS(elem, attr); 62 63 // Keep going until we find an element that has color, or we hit the body 64 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 65 break; 66 67 attr = "backgroundColor"; 68 } while ( elem = elem.parentNode ); 69 70 return getRGB(color); 71 }; 72 73 // Some named colors to work with 74 // From Interface by Stefan Petre 75 // http://interface.eyecon.ro/ 76 77 var colors = { 78 aqua:[0,255,255], 79 azure:[240,255,255], 80 beige:[245,245,220], 81 black:[0,0,0], 82 blue:[0,0,255], 83 brown:[165,42,42], 84 cyan:[0,255,255], 85 darkblue:[0,0,139], 86 darkcyan:[0,139,139], 87 darkgrey:[169,169,169], 88 darkgreen:[0,100,0], 89 darkkhaki:[189,183,107], 90 darkmagenta:[139,0,139], 91 darkolivegreen:[85,107,47], 92 darkorange:[255,140,0], 93 darkorchid:[153,50,204], 94 darkred:[139,0,0], 95 darksalmon:[233,150,122], 96 darkviolet:[148,0,211], 97 fuchsia:[255,0,255], 98 gold:[255,215,0], 99 green:[0,128,0], 100 indigo:[75,0,130], 101 khaki:[240,230,140], 102 lightblue:[173,216,230], 103 lightcyan:[224,255,255], 104 lightgreen:[144,238,144], 105 lightgrey:[211,211,211], 106 lightpink:[255,182,193], 107 lightyellow:[255,255,224], 108 lime:[0,255,0], 109 magenta:[255,0,255], 110 maroon:[128,0,0], 111 navy:[0,0,128], 112 olive:[128,128,0], 113 orange:[255,165,0], 114 pink:[255,192,203], 115 purple:[128,0,128], 116 violet:[128,0,128], 117 red:[255,0,0], 118 silver:[192,192,192], 119 white:[255,255,255], 120 yellow:[255,255,0] 121 }; 122 123 })(jQuery); 124 125 jQuery(document).ready(function(){ 126 127 jQuery(".updated") 128 .css( 129 { backgroundColor: '#FFFF33' } 130 ) 131 .animate( 132 { backgroundColor: '#CFEBF7' }, 3000 133 ) 134 135 }); -
wp-includes/js/fat.js
1 // @name The Fade Anything Technique2 // @namespace http://www.axentric.com/aside/fat/3 // @version 1.0-RC14 // @author Adam Michela5 6 var Fat = {7 make_hex : function (r,g,b)8 {9 r = r.toString(16); if (r.length == 1) r = '0' + r;10 g = g.toString(16); if (g.length == 1) g = '0' + g;11 b = b.toString(16); if (b.length == 1) b = '0' + b;12 return "#" + r + g + b;13 },14 fade_all : function (dur)15 {16 var a = document.getElementsByTagName("*");17 for (var i = 0; i < a.length; i++)18 {19 var o = a[i];20 var r = /fade-?(\w{3,6})?/.exec(o.className);21 if (r)22 {23 if (!r[1]) r[1] = "";24 if (o.id) Fat.fade_element(o.id,null,dur,"#"+r[1]);25 }26 }27 },28 fade_element : function (id, fps, duration, from, to)29 {30 if (!fps) fps = 30;31 if (!duration) duration = 3000;32 if (!from || from=="#") from = "#FFFF33";33 if (!to) to = this.get_bgcolor(id);34 35 var frames = Math.round(fps * (duration / 1000));36 var interval = duration / frames;37 var delay = interval;38 var frame = 0;39 40 if (from.length < 7) from += from.substr(1,3);41 if (to.length < 7) to += to.substr(1,3);42 43 var rf = parseInt(from.substr(1,2),16);44 var gf = parseInt(from.substr(3,2),16);45 var bf = parseInt(from.substr(5,2),16);46 var rt = parseInt(to.substr(1,2),16);47 var gt = parseInt(to.substr(3,2),16);48 var bt = parseInt(to.substr(5,2),16);49 50 var r,g,b,h;51 while (frame < frames)52 {53 r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));54 g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));55 b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));56 h = this.make_hex(r,g,b);57 58 setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);59 60 frame++;61 delay = interval * frame;62 }63 setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);64 },65 set_bgcolor : function (id, c)66 {67 var o = document.getElementById(id);68 o.style.backgroundColor = c;69 },70 get_bgcolor : function (id)71 {72 var o = document.getElementById(id);73 while(o)74 {75 var c;76 if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");77 if (o.currentStyle) c = o.currentStyle.backgroundColor;78 if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }79 o = o.parentNode;80 }81 if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";82 var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);83 if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));84 return c;85 }86 }87 88 addLoadEvent(function () {89 Fat.fade_all();90 }); -
wp-includes/script-loader.php
13 13 function default_scripts() { 14 14 $this->add( 'dbx', '/wp-includes/js/dbx.js', false, '2.05' ); 15 15 16 $this->add( 'fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660' );17 18 16 $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); 19 17 20 18 $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' ); … … 78 76 $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); 79 77 80 78 $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.4'); 79 $this->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '1.0'); 81 80 $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '1.0.3'); 82 81 $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2'); 83 82 -
wp-admin/admin.php
26 26 27 27 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback')); 28 28 29 wp_enqueue_script( ' fat' );29 wp_enqueue_script( 'jquery-color' ); 30 30 31 31 $editing = false; 32 32