1 var theList; var theExtraList;
4 var dimAfter = function( r, settings ) {
5 $('li span.comment-count').each( function() {
7 var n = parseInt(a.html(),10);
8 n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
9 if ( n < 0 ) { n = 0; }
10 a.html( n.toString() );
11 $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
13 $('.post-com-count span.comment-count').each( function() {
15 var n = parseInt(a.html(),10);
16 var t = parseInt(a.parent().attr('title'), 10);
17 if ( $('#' + settings.element).is('.unapproved') ) { // we unapproved a formerly approved comment
20 } else { // we approved a formerly unapproved comment
24 if ( n < 0 ) { n = 0; }
25 if ( t < 0 ) { t = 0; }
26 if ( t >= 0 ) { a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) ); }
27 if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
28 a.html( n.toString() );
32 var delAfter = function( r, settings ) {
33 $('li span.comment-count').each( function() {
35 var n = parseInt(a.html(),10);
36 if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
38 } else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
41 if ( n < 0 ) { n = 0; }
42 a.html( n.toString() );
43 $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
45 $('.post-com-count span.comment-count').each( function() {
47 if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
48 var t = parseInt(a.parent().attr('title'), 10);
49 if ( t < 1 ) { return; }
51 a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) );
52 if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
55 var n = parseInt(a.html(),10) - 1;
56 a.html( n.toString() );
59 if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
63 theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
64 $('#get-extra-comments').submit();
67 theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
68 theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );