Bring the bubble back when we have moderated a comment. Fixes #6010 props mdawaffe.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-03-11 08:55:57 +00:00
parent 7733c94c8c
commit f14702fb65
2 changed files with 12 additions and 10 deletions

View File

@ -4,8 +4,11 @@ jQuery(function($) {
var dimAfter = function( r, settings ) {
$('li span.comment-count').each( function() {
var a = $(this);
var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
var n = parseInt(a.html(),10);
n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
if ( n < 0 ) { n = 0; }
a.html( n.toString() );
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
});
$('.post-com-count span.comment-count').each( function() {
var a = $(this);
@ -18,6 +21,8 @@ var dimAfter = function( r, settings ) {
n = n + 1;
t = t - 1;
}
if ( n < 0 ) { n = 0; }
if ( t < 0 ) { t = 0; }
if ( t >= 0 ) { a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) ); }
if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
a.html( n.toString() );
@ -27,14 +32,11 @@ var dimAfter = function( r, settings ) {
var delAfter = function( r, settings ) {
$('li span.comment-count').each( function() {
var a = $(this);
if ( parseInt(a.html(),10) < 1 ) { return; }
// on ?edit-comments.php?comment_status=moderated tab
// or the comment is unapproved
if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') ) {
var n = parseInt(a.html(),10) - 1;
a.html( n.toString() );
( 0 < n ) ? $('#awaiting-mod').each(function() { $(this).show(); $(this).removeClass('count-0') }) : $('#awaiting-mod').hide();
}
var n = parseInt(a.html(),10);
n = n + ( $('#' + settings.element).is('.unapproved') ? -1 : 1 );
if ( n < 0 ) { n = 0; }
a.html( n.toString() );
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
});
$('.post-com-count span.comment-count').each( function() {
var a = $(this);

View File

@ -122,7 +122,7 @@ class WP_Scripts {
'good' => __('Good'),
'strong' => __('Strong')
) );
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080304' );
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
$this->localize( 'admin-comments', 'adminCommentsL10n', array(
'pending' => __('%i% pending') // must look like: "# blah blah"
) );