diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 6a01ca3e06..c814a591cf 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -88,7 +88,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp sprintf(__('Awaiting Moderation (%s)'), $num_comments->moderated), 'approved' => __('Approved')); +$stati = array('moderated' => sprintf(__('Awaiting Moderation (%s)'), "$num_comments->moderated"), 'approved' => __('Approved')); foreach ( $stati as $status => $label ) { $class = ''; @@ -178,9 +178,9 @@ if ($comments) { foreach ($comments as $comment) { $post = get_post($comment->comment_post_ID); $authordata = get_userdata($post->post_author); - $comment_status = wp_get_comment_status($comment->comment_ID); + $the_comment_status = wp_get_comment_status($comment->comment_ID); $class = ('alternate' == $class) ? '' : ''; - $class .= ('unapproved' == $comment_status) ? ' unapproved' : ''; + $class .= ('unapproved' == $the_comment_status) ? ' unapproved' : ''; $post_link = '' . get_the_title($comment->comment_post_ID) . ''; $author_url = get_comment_author_url(); if ( 'http://' == $author_url ) @@ -217,8 +217,12 @@ if ($comments) { comment_post_ID) ) { - if ( 'approved' != $comment_status ) - echo "" . __( 'Approve' ) . ' | '; + if ( 'approved' != $the_comment_status ) { + if ( $comment_status ) // we're looking at list of only approved or only unapproved comments + echo "" . __( 'Approve' ) . ' | '; + else // we're looking at all comments + echo "" . __( 'Approve' ) . ' | '; + } echo "" . __( 'Spam' ) . ' | '; echo "" . __('Delete') . ''; } diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php index 47f407b3b2..46a14752b5 100644 --- a/wp-admin/edit-post-rows.php +++ b/wp-admin/edit-post-rows.php @@ -113,7 +113,7 @@ foreach($posts_columns as $column_name=>$column_display_name) { $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); if ( $left ) echo ''; - comments_number("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); + comments_number("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); if ( $left ) echo ''; ?> diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index e7d6332b57..d2cb49e64a 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -416,7 +416,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) { $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); if ( $left ) echo ''; - comments_number("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); + comments_number("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); if ( $left ) echo ''; ?> diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js index 15d4676062..d3f5bac7dd 100644 --- a/wp-admin/js/common.js +++ b/wp-admin/js/common.js @@ -2,5 +2,6 @@ addLoadEvent( function() { // pulse jQuery('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300); + // Reveal jQuery('.wp-no-js-hidden').removeClass( 'wp-no-js-hidden' ); }); diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index f796c24e43..11e0c49009 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -2,7 +2,7 @@ var list; var extra; jQuery(function($) { var dimAfter = function( r, settings ) { - $('.comment-count span').each( function() { + $('span.comment-count').each( function() { var a = $(this); var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); a.html( n.toString() ); @@ -16,7 +16,7 @@ var dimAfter = function( r, settings ) { } var delAfter = function( r, settings ) { - $('.comment-count span').each( function() { + $('span.comment-count').each( function() { var a = $(this); if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { var n = parseInt(a.html(),10) - 1; diff --git a/wp-admin/menu.php b/wp-admin/menu.php index be02108b3b..e679c93513 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -17,7 +17,7 @@ else $awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'"); $menu[15] = array(__('Design'), 'switch_themes', 'themes.php'); -$menu[20] = array( sprintf( __('Comments %s'), "$awaiting_mod" ), 'edit_posts', 'edit-comments.php'); +$menu[20] = array( sprintf( __('Comments %s'), "$awaiting_mod" ), 'edit_posts', 'edit-comments.php'); $menu[30] = array(__('Settings'), 'manage_options', 'options-general.php'); $menu[35] = array(__('Plugins'), 'activate_plugins', 'plugins.php'); if ( current_user_can('edit_users') ) diff --git a/wp-includes/js/jquery/jquery.color.js b/wp-includes/js/jquery/jquery.color.js index f16a6d0436..1dffbd5c7b 100644 --- a/wp-includes/js/jquery/jquery.color.js +++ b/wp-includes/js/jquery/jquery.color.js @@ -1,9 +1,128 @@ -(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); \ No newline at end of file +/* + * jQuery Color Animations + * Copyright 2007 John Resig + * Released under the MIT and GPL licenses. + */ + +(function(jQuery){ + + // We override the animation for all of these color styles + 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(",") + ")"; + } + }); + + // Color Conversion functions from highlightFade + // By Blair Mitchelmore + // http://jquery.offput.ca/highlightFade/ + + // Parse strings looking for color tuples [255,255,255] + function getRGB(color) { + var result; + + // Check if we're already dealing with an array of colors + if ( color && color.constructor == Array && color.length == 3 ) + return color; + + // Look for rgb(num,num,num) + 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])]; + + // Look for rgb(num%,num%,num%) + 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]; + + // Look for #a0b1c2 + 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)]; + + // Look for #fff + 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)]; + + // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) + return colors['transparent'] + + // Otherwise, we're most likely dealing with a named color + return colors[jQuery.trim(color).toLowerCase()]; + } + + function getColor(elem, attr) { + var color; + + do { + color = jQuery.curCSS(elem, attr); + + // Keep going until we find an element that has color, or we hit the body + if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) + break; + + attr = "backgroundColor"; + } while ( elem = elem.parentNode ); + + return getRGB(color); + }; + + // Some named colors to work with + // From Interface by Stefan Petre + // http://interface.eyecon.ro/ + + 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], + transparent: [255,255,255] + }; + +})(jQuery); diff --git a/wp-includes/js/wp-lists.js b/wp-includes/js/wp-lists.js index de309bc534..5438b4668c 100644 --- a/wp-includes/js/wp-lists.js +++ b/wp-includes/js/wp-lists.js @@ -21,9 +21,9 @@ wpAjax = { var err = ''; errs.each( function() { var code = $(this).attr('code'); - if ( formField = $('wp_error_data[@code="' + code + '"] form-field', x).text() ) + if ( formField = $('wp_error_data[code="' + code + '"] form-field', x).text() ) code = formField; - wpAjax.invalidateForm( $('#' + e + ' :input[@name="' + code + '"]' ).parents('.form-field:first') ); + wpAjax.invalidateForm( $('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); err += '

' + this.firstChild.nodeValue + '

'; } ); return !re.html( '
' + err + '
' ); @@ -58,7 +58,7 @@ var wpList = { nonce: function(e,s) { var url = wpAjax.unserialize(e.attr('href')); - return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[@name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[@name=_wpnonce]').val() || 0; + return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0; }, parseClass: function(e,t) { @@ -74,11 +74,11 @@ var wpList = { }, s || {} ); if ( $.isFunction( s.confirm ) ) { if ( 'add' != a ) { - bg = $('#' + s.element).css('background-color'); - $('#' + s.element).css('background-color', '#FF9966'); + bg = $('#' + s.element).css('backgroundColor'); + $('#' + s.element).css('backgroundColor', '#FF9966'); } r = s.confirm.call(this,e,s,a,bg); - if ( 'add' != a ) { $('#' + s.element).css('background-color', bg ); } + if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); } if ( !r ) { return false; } } return s; @@ -94,7 +94,7 @@ var wpList = { s = wpList.pre.call( list, e, s, 'add' ); if ( !s ) { return false; } - if ( !e.is("[@class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); } + if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); } if ( !s.element ) { return true; } @@ -102,8 +102,8 @@ var wpList = { s.nonce = wpList.nonce(e,s); - var es = $('#' + s.element + ' :input').not('[@name=_ajax_nonce], [@name=_wpnonce], [@name=action]'); - var required = $('#' + s.element + ' .form-required:has(:input[@value=""]), #' + s.element + ' .form-required:input[@value=""]'); + var es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]'); + var required = $('#' + s.element + ' .form-required:has(:input[value=""]), #' + s.element + ' .form-required:input[value=""]'); if ( required.size() ) { wpAjax.invalidateForm( required ); return false; @@ -172,28 +172,32 @@ var wpList = { } if ( !s.data._ajax_nonce ) { return true; } - var func = function() { list.wpList.recolor(); }; - var hideTO = -1; + var element = $('#' + s.element); + if ( 'none' != s.delColor ) { - $('#' + s.element).animate( { backgroundColor: s.delColor }, 100 ).slideUp(); - hideTO = setTimeout(func, 500); + var anim = 'slideUp'; + if ( element.css( 'display' ).match(/table/) ) + anim = 'fadeOut'; // Can't slideup table rows and other table elements. Known jQuery bug + element + .animate( { backgroundColor: s.delColor }, 'fast' )[anim]( 'fast' ) + .queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); } else { - func(); + list.wpList.recolor(); } s.success = function(r) { if ( !wpAjax.parseAjaxResponse(r, s.response, s.element) ) { - clearTimeout(hideTO); - func = function() { $('#' + s.element).css( 'background-color', '#FF3333' ).show(); list.wpList.recolor(); }; - func(); setTimeout(func, 705); // In case it's still fading + element.stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); return false; } if ( $.isFunction(s.delAfter) ) { var o = this.complete; this.complete = function(x,st) { - var _s = $.extend( { xml: x, status: st }, s ); - s.delAfter( r, _s ); - if ( $.isFunction(o) ) { o(x,st); } + element.queue( function() { + var _s = $.extend( { xml: x, status: st }, s ); + s.delAfter( r, _s ); + if ( $.isFunction(o) ) { o(x,st); } + } ).dequeue(); }; } }; @@ -227,34 +231,33 @@ var wpList = { if ( !s ) { 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 ) { - $('#' + 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 element = $('#' + s.element); + var isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass); + var color = wpList.getColor( element ); + element.toggleClass( s.dimClass ) + var dimColor = isClass ? s.dimAddColor : s.dimDelColor; + if ( 'none' != dimColor ) { + element + .animate( { backgroundColor: dimColor }, 'fast' ) + .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } ) + .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } ); } if ( !s.data._ajax_nonce ) { return true; } s.success = function(r) { if ( !wpAjax.parseAjaxResponse(r, s.response, s.element) ) { - clearTimeout(dimTO); - func = function() { $('#' + s.element).css( 'background-color', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass); }; - func(); setTimeout(func, 705); + element.stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); return false; } if ( $.isFunction(s.dimAfter) ) { var o = this.complete; this.complete = function(x,st) { - var _s = $.extend( { xml: x, status: st }, s ); - s.dimAfter( r, _s ); - if ( $.isFunction(o) ) { o(x,st); } + element.queue( function() { + var _s = $.extend( { xml: x, status: st }, s ); + s.dimAfter( r, _s ); + if ( $.isFunction(o) ) { o(x,st); } + } ).dequeue(); }; } }; @@ -263,6 +266,19 @@ var wpList = { return false; }, + // From jquery.color.js: jQuery Color Animation by John Resig + getColor: function( el ) { + if ( el.constructor == Object ) + el = el.get(0); + var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" ); + do { + color = jQuery.curCSS(elem, 'backgroundColor'); + if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") ) + break; + } while ( elem = elem.parentNode ); + return color || '#ffffff'; + }, + add: function( e, s ) { list = $(this); e = $(e); @@ -271,7 +287,6 @@ var wpList = { var _s = { pos: 0, id: 0, oldId: null }; if ( 'string' == typeof s ) { s = { what: s }; } s = $.extend(_s, this.wpList.settings, s); - if ( !e.size() || !s.what ) { return false; } if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); } if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); } @@ -299,9 +314,8 @@ var wpList = { } if ( 'none' != s.addColor ) { - var b = e.css( 'background-color' ); - if ( b == 'transparent' ) { b = ''; } - e.css('background-color', s.addColor).animate( { backgroundColor: '#fff' }, 300 ); + var color = wpList.getColor( e ); + e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } ); } list.each( function() { this.wpList.process( e ); } ); return e; @@ -323,7 +337,7 @@ var wpList = { process: function(el) { var list = this; - var a = $("[@class^=add:" + list.id + ":]", el || null) + $("[class^=add:" + list.id + ":]", el || null) .filter('form').submit( function() { return list.wpList.add(this); } ).end() .not('form').click( function() { return list.wpList.add(this); } ).each( function() { var addEl = this; @@ -343,8 +357,8 @@ var wpList = { } } ); } ); - var d = $("[@class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } ); - var c = $("[@class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } ); + $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } ); + $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } ); }, recolor: function() { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index b15c0397d3..29c065addc 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -67,7 +67,7 @@ class WP_Scripts { 'delText' => __('Are you sure you want to delete this %thing%?') ) ); - $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080110' ); + $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080226' ); $this->localize( 'wp-lists', 'wpListL10n', array( 'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php' ) );