From d1d6825fa27c2689c3c2900af296c0bb23fea018 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 23 Apr 2008 01:55:58 +0000 Subject: [PATCH] Disable buttons until autosave completes. Props mdawaffe. fixes #6707 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@7788 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/autosave.js | 9 ++++++--- wp-includes/script-loader.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js index fc461fd9a5..bc05165399 100644 --- a/wp-includes/js/autosave.js +++ b/wp-includes/js/autosave.js @@ -11,7 +11,7 @@ jQuery(function($) { }); // called when autosaving pre-existing post -function autosave_saved(response) { +function autosave_saved(response, keepDisabled) { var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response var message = ''; @@ -41,13 +41,15 @@ function autosave_saved(response) { } if ( message ) { jQuery('#autosave').html(message); } // update autosave message else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); } - autosave_enable_buttons(); // re-enable disabled form buttons + if ( !keepDisabled ) { + autosave_enable_buttons(); // re-enable disabled form buttons + } return res; } // called when autosaving new post function autosave_saved_new(response) { - var res = autosave_saved(response); // parse the ajax response do the above + var res = autosave_saved(response, true); // parse the ajax response do the above // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID if ( res && res.responses.length && !res.errors ) { var tempID = jQuery('#post_ID').val(); @@ -58,6 +60,7 @@ function autosave_saved_new(response) { this.href = this.href.replace(tempID, postID); }); } + autosave_enable_buttons(); // re-enable disabled form buttons } function autosave_update_post_ID( postID ) { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 60a994f04b..a8b3a7b9d9 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -47,7 +47,7 @@ class WP_Scripts { 'broken' => __('An unidentified error has occurred.') ) ); - $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080416' ); + $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080422' ); $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); $this->localize( 'wp-ajax', 'WPAjaxL10n', array(