Disable buttons until autosave completes. Props mdawaffe. fixes #6707 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@7788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-23 01:55:58 +00:00
parent 4a31dc117f
commit b82f47cc97
2 changed files with 7 additions and 4 deletions

View File

@ -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 ) {

View File

@ -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(