2008-02-28 07:50:25 +01:00
|
|
|
var theList; var theExtraList;
|
2007-10-10 00:49:42 +02:00
|
|
|
jQuery(function($) {
|
2007-03-27 23:20:16 +02:00
|
|
|
|
2007-10-10 00:49:42 +02:00
|
|
|
var dimAfter = function( r, settings ) {
|
2008-02-28 00:36:24 +01:00
|
|
|
$('li span.comment-count').each( function() {
|
2008-01-04 12:53:15 +01:00
|
|
|
var a = $(this);
|
2008-01-03 23:24:58 +01:00
|
|
|
var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
|
|
|
|
a.html( n.toString() );
|
|
|
|
});
|
2008-02-28 00:36:24 +01:00
|
|
|
$('.post-com-count span.comment-count').each( function() {
|
2008-01-04 12:53:15 +01:00
|
|
|
var a = $(this);
|
2008-03-04 18:07:47 +01:00
|
|
|
var n = parseInt(a.html(),10);
|
|
|
|
var t = parseInt(a.parent().attr('title'), 10);
|
|
|
|
if ( $('#' + settings.element).is('.unapproved') ) { // we unapproved a formerly approved comment
|
|
|
|
n = n - 1;
|
|
|
|
t = t + 1;
|
|
|
|
} else { // we approved a formerly unapproved comment
|
|
|
|
n = n + 1;
|
|
|
|
t = t - 1;
|
|
|
|
}
|
|
|
|
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() ); }
|
2008-01-04 12:53:15 +01:00
|
|
|
a.html( n.toString() );
|
|
|
|
});
|
2007-10-10 00:49:42 +02:00
|
|
|
}
|
2007-03-27 23:20:16 +02:00
|
|
|
|
2007-10-10 00:49:42 +02:00
|
|
|
var delAfter = function( r, settings ) {
|
2008-03-04 18:07:47 +01:00
|
|
|
$('li span.comment-count').each( function() {
|
2008-01-04 12:53:15 +01:00
|
|
|
var a = $(this);
|
2008-03-04 18:07:47 +01:00
|
|
|
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') ) {
|
2008-01-03 23:24:58 +01:00
|
|
|
var n = parseInt(a.html(),10) - 1;
|
|
|
|
a.html( n.toString() );
|
2008-03-10 06:54:46 +01:00
|
|
|
( 0 < n ) ? $('#awaiting-mod').each(function() { $(this).show(); $(this).removeClass('count-0') }) : $('#awaiting-mod').hide();
|
2008-01-03 23:24:58 +01:00
|
|
|
}
|
|
|
|
});
|
2008-03-04 18:07:47 +01:00
|
|
|
$('.post-com-count span.comment-count').each( function() {
|
|
|
|
var a = $(this);
|
|
|
|
if ( $('#' + settings.element).is('.unapproved') ) { // we deleted an unapproved comment, decrement pending title
|
|
|
|
var t = parseInt(a.parent().attr('title'), 10);
|
|
|
|
if ( t < 1 ) { return; }
|
|
|
|
t = t - 1;
|
|
|
|
a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) );
|
|
|
|
if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var n = parseInt(a.html(),10) - 1;
|
|
|
|
a.html( n.toString() );
|
|
|
|
});
|
2007-03-27 23:20:16 +02:00
|
|
|
|
2008-02-28 07:50:25 +01:00
|
|
|
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
|
2007-10-10 00:49:42 +02:00
|
|
|
return;
|
2006-06-06 06:14:04 +02:00
|
|
|
}
|
2007-03-27 23:20:16 +02:00
|
|
|
|
2008-02-28 07:50:25 +01:00
|
|
|
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
2007-10-10 00:49:42 +02:00
|
|
|
$('#get-extra-comments').submit();
|
|
|
|
}
|
|
|
|
|
2008-02-28 07:50:25 +01:00
|
|
|
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
|
|
|
theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
|
2006-06-06 06:14:04 +02:00
|
|
|
|
2007-10-10 00:49:42 +02:00
|
|
|
} );
|