From 647180ee18595eca21cf3065a9da5c831d593bae Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 15 Nov 2008 21:58:51 +0000 Subject: [PATCH] Show a space as thousands separator for comments count when setting from js, hide ajax throbber when QE returns an error, see#8227 fixes #8225 git-svn-id: https://develop.svn.wordpress.org/trunk@9726 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/edit-comments.js | 15 ++++++++++++--- wp-admin/js/inline-edit-post.js | 21 +++++---------------- wp-admin/js/inline-edit-tax.js | 1 + wp-includes/script-loader.php | 15 +++++++-------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index 405758c674..470d4edc6e 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -17,8 +17,11 @@ setCommentsList = function() { if ( isNaN(n) ) return; 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'); + n = n.toString(); + if ( n.length > 3 ) + n = n.substr(0, n.length-3)+' '+n.substr(-3); + a.html(n); }); }; @@ -34,8 +37,11 @@ setCommentsList = function() { n = n + 1; } if ( n < 0 ) { n = 0; } - a.html( n.toString() ); $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); + n = n.toString(); + if ( n.length > 3 ) + n = n.substr(0, n.length-3)+' '+n.substr(-3); + a.html(n); }); $('span.spam-count' ).each( function() { @@ -49,7 +55,10 @@ setCommentsList = function() { n = n - 1; } if ( n < 0 ) { n = 0; } - a.html( n.toString() ); + n = n.toString(); + if ( n.length > 3 ) + n = n.substr(0, n.length-3)+' '+n.substr(-3); + a.html(n); }); if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js index dd1a8fd525..5f6cd77cfb 100644 --- a/wp-admin/js/inline-edit-post.js +++ b/wp-admin/js/inline-edit-post.js @@ -11,11 +11,8 @@ inlineEditPost = { // get all editable rows t.rows = $('tr.iedit'); - // prepare the edit row -// .dblclick(function() { inlineEditPost.toggle(this); }) + // prepare the edit rows qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); }); - -// .dblclick(function() { inlineEditPost.revert(); }) bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); }); $('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); }); @@ -25,7 +22,6 @@ inlineEditPost = { $('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); }); // add events -// t.rows.dblclick(function() { inlineEditPost.toggle(this); }); t.addEvents(t.rows); $('#bulk-title-div').parents('fieldset').after( @@ -51,17 +47,9 @@ inlineEditPost = { $('select[name="_status"] option[value="future"]', bulkRow).remove(); - $('#doaction').click(function(e){ - if ( $('select[name="action"]').val() == 'edit' ) { - e.preventDefault(); - t.setBulk(); - } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { - t.revert(); - } - }); - - $('#doaction2').click(function(e){ - if ( $('select[name="action2"]').val() == 'edit' ) { + $('#doaction, #doaction2').click(function(e){ + var n = $(this).attr('id').substr(2); + if ( $('select[name="'+n+'"]').val() == 'edit' ) { e.preventDefault(); t.setBulk(); } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { @@ -205,6 +193,7 @@ inlineEditPost = { $.post('admin-ajax.php', params, function(r) { var row = $(inlineEditPost.what+id); + $('table.widefat .inline-edit-save .waiting').hide(); if (r) { if ( -1 != r.indexOf(' __('Upload stopped.'), 'dismiss' => __('Dismiss'), 'crunching' => __('Crunching…'), - 'deleted' => __('Deleted'), + 'deleted' => __('Deleted') ) ); $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' ); @@ -156,23 +156,22 @@ function wp_default_scripts( &$scripts ) { 'good' => __('Medium'), 'strong' => __('Strong') ) ); - $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081115' ); + $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081115b' ); $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( - 'pending' => __('%i% pending'), // must look like: "# blah blah" 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), - 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']), + 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) ) ); $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20080925' ); $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081109' ); $scripts->localize( 'postbox', 'postboxL10n', array( - 'requestFile' => admin_url('admin-ajax.php'), + 'requestFile' => admin_url('admin-ajax.php') ) ); $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' ); $scripts->localize( 'slug', 'slugL10n', array( 'requestFile' => admin_url('admin-ajax.php'), 'save' => __('Save'), - 'cancel' => __('Cancel'), + 'cancel' => __('Cancel') ) ); $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081112b' ); $scripts->localize( 'post', 'postL10n', array( @@ -251,12 +250,12 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' ); - $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081115' ); + $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081115b' ); $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 'error' => __('Error while saving the changes.') ) ); - $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081110' ); + $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081115' ); $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 'error' => __('Error while saving the changes.') ) );