Replacing FAT with jQuery effects, new styling for alerts. See #5369.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-01-09 12:12:35 +00:00
parent cc18743397
commit d66013fdd9
7 changed files with 45 additions and 114 deletions

View File

@ -28,7 +28,8 @@ $time_format = get_option('time_format');
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
wp_enqueue_script( 'fat' );
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
$editing = false;

4
wp-admin/js/common.js Normal file
View File

@ -0,0 +1,4 @@
addLoadEvent( function() {
// pulse
jQuery('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
});

View File

@ -317,13 +317,15 @@ form#upload #post_content {
}
.updated {
background: #ddedfa;
border: 1px solid #c6d9e9;
background: #ffffe0;
border: 1px solid #e6db55;
}
.updated a {
color: #448abd;
font-weight: bold;
color: #2583ad;
text-decoration: none;
padding-bottom: 2px;
border-bottom: 1px solid #2583ad;
}
.error {
@ -1177,6 +1179,7 @@ a.view-comment-post-link {
}
#poststuff h2 {
margin-top: 20px;
margin-bottom: 20px;
}
@ -1274,5 +1277,5 @@ a.view-comment-post-link {
#poststuff .closed .togbox {
background-color:#2583ad;
background-image:url(images/toggle-arrow.gif);
background-position: 5px 18px;
}
background-position: 4px 18px;
}

View File

@ -1,90 +0,0 @@
// @name The Fade Anything Technique
// @namespace http://www.axentric.com/aside/fat/
// @version 1.0-RC1
// @author Adam Michela
var Fat = {
make_hex : function (r,g,b)
{
r = r.toString(16); if (r.length == 1) r = '0' + r;
g = g.toString(16); if (g.length == 1) g = '0' + g;
b = b.toString(16); if (b.length == 1) b = '0' + b;
return "#" + r + g + b;
},
fade_all : function (dur)
{
var a = document.getElementsByTagName("*");
for (var i = 0; i < a.length; i++)
{
var o = a[i];
var r = /fade-?(\w{3,6})?/.exec(o.className);
if (r)
{
if (!r[1]) r[1] = "";
if (o.id) Fat.fade_element(o.id,null,dur,"#"+r[1]);
}
}
},
fade_element : function (id, fps, duration, from, to)
{
if (!fps) fps = 30;
if (!duration) duration = 3000;
if (!from || from=="#") from = "#FFFF33";
if (!to) to = this.get_bgcolor(id);
var frames = Math.round(fps * (duration / 1000));
var interval = duration / frames;
var delay = interval;
var frame = 0;
if (from.length < 7) from += from.substr(1,3);
if (to.length < 7) to += to.substr(1,3);
var rf = parseInt(from.substr(1,2),16);
var gf = parseInt(from.substr(3,2),16);
var bf = parseInt(from.substr(5,2),16);
var rt = parseInt(to.substr(1,2),16);
var gt = parseInt(to.substr(3,2),16);
var bt = parseInt(to.substr(5,2),16);
var r,g,b,h;
while (frame < frames)
{
r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
h = this.make_hex(r,g,b);
setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);
frame++;
delay = interval * frame;
}
setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
},
set_bgcolor : function (id, c)
{
var o = document.getElementById(id);
o.style.backgroundColor = c;
},
get_bgcolor : function (id)
{
var o = document.getElementById(id);
while(o)
{
var c;
if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
if (o.currentStyle) c = o.currentStyle.backgroundColor;
if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
o = o.parentNode;
}
if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
return c;
}
}
addLoadEvent(function () {
Fat.fade_all();
});

View File

@ -0,0 +1,9 @@
(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}
fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)
return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];return colors[jQuery.trim(color).toLowerCase()];}
function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))
break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};})(jQuery);

View File

@ -172,11 +172,11 @@ var wpList = {
}
if ( !s.data._ajax_nonce ) { return true; }
var func = function() { $('#' + s.element).css( 'background-color', '' ).hide(); list.wpList.recolor(); };
var func = function() { list.wpList.recolor(); };
var hideTO = -1;
if ( 'none' != s.delColor ) {
Fat.fade_element(s.element,null,700,s.delColor);
hideTO = setTimeout(func, 705);
$('#' + s.element).animate( { backgroundColor: s.delColor }, 100 ).slideUp();
hideTO = setTimeout(func, 500);
} else {
func();
}
@ -227,13 +227,20 @@ var wpList = {
if ( !s ) { return true; }
}
if ( !s.data._ajax_nonce ) { return true; }
var thisclass = $('#' + s.element).attr('class');
if ( thisclass && thisclass.match(/alternate/) )
var color = '#f1f1f1';
else
var color = '#fff';
var isClass = $('#' + s.element).toggleClass(s.dimClass).is('.' + s.dimClass);
if ( isClass && 'none' != s.dimAddColor ) { Fat.fade_element(s.element,null,700,s.dimAddColor); }
else if ( !isClass && 'none' != s.dimDelColor ) { Fat.fade_element(s.element,null,700,s.dimDelColor); }
if ( isClass && 'none' != s.dimAddColor ) {
$('#' + s.element).animate( { backgroundColor: s.dimAddColor }, 50 ).animate( { backgroundColor: color }, 400 );
}
else if ( !isClass && 'none' != s.dimDelColor ) {
$('#' + s.element).animate( { backgroundColor: s.dimDelColor }, 50 ).animate( { backgroundColor: color }, 400 );
}
var dimTO = setTimeout( function() { $('#' + s.element).css( 'background-color', '' ); }, 705 );
if ( !s.data._ajax_nonce ) { return true; }
s.success = function(r) {
if ( !wpAjax.parseAjaxResponse(r, s.response, s.element) ) {
@ -302,11 +309,8 @@ var wpList = {
if ( 'none' != s.addColor ) {
var b = e.css( 'background-color' );
if ( b == 'transparent' ) { b = ''; }
Fat.fade_element(e.attr('id'),null,700,s.addColor);
setTimeout( function() {
var g = e.css( 'background-color', '' ).css( 'background-color' );
if ( b != g ) { e.css( 'background-color', b ); }
}, 705 );
$('#' + s.element).css('background-color', s.addColor).animate( { backgroundColor: '#fff' }, 300 );
}
list.each( function() { this.wpList.process( e ); } );
return e;

View File

@ -11,8 +11,7 @@ class WP_Scripts {
}
function default_scripts() {
$this->add( 'fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660' );
$this->add( 'common', '/wp-admin/js/common.js', false, '1.0' );
$this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
$this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
@ -56,7 +55,7 @@ class WP_Scripts {
'whoaText' => __("Slow down, I'm still sending your data!")
) );
$this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306' );
$this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'jquery-color'), '20070306' );
$this->localize( 'listman', 'listManL10n', array(
'jumpText' => __('Jump to new item'),
'delText' => __('Are you sure you want to delete this %thing%?')
@ -78,8 +77,9 @@ class WP_Scripts {
$this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
$this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.2b2');
$this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.2b2-color');
$this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
$this->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0');
$this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
$this->add( 'dimensions', '/wp-includes/js/jquery/jquery.dimensions.min.js', array('jquery'), '1.1.2');
$this->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('dimensions'), '1.1');