Comment bubble count fixes from mdawaffe. fixes #6090

git-svn-id: http://svn.automattic.com/wordpress/trunk@7153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-04 17:07:47 +00:00
parent 92745e8531
commit af95d56dc9
3 changed files with 34 additions and 5 deletions

View File

@ -250,6 +250,7 @@ function populate_options() {
add_option('medium_size_w', 300); add_option('medium_size_w', 300);
add_option('medium_size_h', 300); add_option('medium_size_h', 300);
add_option('autosave_interval', 60); add_option('autosave_interval', 60);
add_option('autosave_interval', 60);
// Delete unused options // Delete unused options
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing'); $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing');

View File

@ -7,22 +7,47 @@ var dimAfter = function( r, settings ) {
var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
a.html( n.toString() ); a.html( n.toString() );
}); });
// we need to do the opposite for this guy, TODO: update title
$('.post-com-count span.comment-count').each( function() { $('.post-com-count span.comment-count').each( function() {
var a = $(this); var a = $(this);
var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? -1 : 1 ); 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() ); }
a.html( n.toString() ); a.html( n.toString() );
}); });
} }
var delAfter = function( r, settings ) { var delAfter = function( r, settings ) {
$('span.comment-count').each( function() { $('li span.comment-count').each( function() {
var a = $(this); var a = $(this);
if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { 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; var n = parseInt(a.html(),10) - 1;
a.html( n.toString() ); a.html( n.toString() );
} }
}); });
$('.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() );
});
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
return; return;

View File

@ -130,7 +130,10 @@ class WP_Scripts {
'good' => __('Good'), 'good' => __('Good'),
'strong' => __('Strong') 'strong' => __('Strong')
) ); ) );
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080228' ); $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080304' );
$this->localize( 'admin-comments', 'adminCommentsL10n', array(
'pending' => __('%i% pending') // must look like: "# blah blah"
) );
$this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' ); $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
$this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080108' ); $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080108' );
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );