2008-02-28 01:50:25 -05:00
|
|
|
var theList; var theExtraList;
|
2007-10-09 18:49:42 -04:00
|
|
|
jQuery(function($) {
|
2007-03-27 17:20:16 -04:00
|
|
|
|
2007-10-09 18:49:42 -04:00
|
|
|
var dimAfter = function( r, settings ) {
|
2008-02-27 18:36:24 -05:00
|
|
|
$('li span.comment-count').each( function() {
|
2008-01-04 06:53:15 -05:00
|
|
|
var a = $(this);
|
2008-03-11 04:55:57 -04:00
|
|
|
var n = parseInt(a.html(),10);
|
|
|
|
n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
|
|
|
|
if ( n < 0 ) { n = 0; }
|
2008-01-03 17:24:58 -05:00
|
|
|
a.html( n.toString() );
|
2008-03-11 04:55:57 -04:00
|
|
|
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
2008-01-03 17:24:58 -05:00
|
|
|
});
|
2008-02-27 18:36:24 -05:00
|
|
|
$('.post-com-count span.comment-count').each( function() {
|
2008-01-04 06:53:15 -05:00
|
|
|
var a = $(this);
|
2008-03-04 12:07:47 -05: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;
|
|
|
|
}
|
2008-03-11 04:55:57 -04:00
|
|
|
if ( n < 0 ) { n = 0; }
|
|
|
|
if ( t < 0 ) { t = 0; }
|
2008-03-04 12:07:47 -05:00
|
|
|
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 06:53:15 -05:00
|
|
|
a.html( n.toString() );
|
|
|
|
});
|
2007-10-09 18:49:42 -04:00
|
|
|
}
|
2007-03-27 17:20:16 -04:00
|
|
|
|
2007-10-09 18:49:42 -04:00
|
|
|
var delAfter = function( r, settings ) {
|
2008-03-04 12:07:47 -05:00
|
|
|
$('li span.comment-count').each( function() {
|
2008-01-04 06:53:15 -05:00
|
|
|
var a = $(this);
|
2008-03-11 04:55:57 -04:00
|
|
|
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');
|
2008-01-03 17:24:58 -05:00
|
|
|
});
|
2008-03-04 12:07:47 -05: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 17:20:16 -04:00
|
|
|
|
2008-02-28 01:50:25 -05:00
|
|
|
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
|
2007-10-09 18:49:42 -04:00
|
|
|
return;
|
2006-06-06 00:14:04 -04:00
|
|
|
}
|
2007-03-27 17:20:16 -04:00
|
|
|
|
2008-02-28 01:50:25 -05:00
|
|
|
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
2007-10-09 18:49:42 -04:00
|
|
|
$('#get-extra-comments').submit();
|
|
|
|
}
|
|
|
|
|
2008-02-28 01:50:25 -05: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 00:14:04 -04:00
|
|
|
|
2007-10-09 18:49:42 -04:00
|
|
|
} );
|