Disable buttons until autosave completes. Props mdawaffe. fixes #6707 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@7790 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d1d6825fa2
commit
563f49278e
|
@ -10,8 +10,7 @@ jQuery(function($) {
|
||||||
$("#post").submit(function() { $.cancel(autosavePeriodical); });
|
$("#post").submit(function() { $.cancel(autosavePeriodical); });
|
||||||
});
|
});
|
||||||
|
|
||||||
// called when autosaving pre-existing post
|
function autosave_parse_response(response) {
|
||||||
function autosave_saved(response, keepDisabled) {
|
|
||||||
var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
|
var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
|
||||||
var message = '';
|
var message = '';
|
||||||
|
|
||||||
|
@ -41,15 +40,18 @@ function autosave_saved(response, keepDisabled) {
|
||||||
}
|
}
|
||||||
if ( message ) { jQuery('#autosave').html(message); } // update autosave message
|
if ( message ) { jQuery('#autosave').html(message); } // update autosave message
|
||||||
else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); }
|
else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); }
|
||||||
if ( !keepDisabled ) {
|
|
||||||
autosave_enable_buttons(); // re-enable disabled form buttons
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// called when autosaving pre-existing post
|
||||||
|
function autosave_saved(response) {
|
||||||
|
autosave_parse_response(response); // parse the ajax response
|
||||||
|
autosave_enable_buttons(); // re-enable disabled form buttons
|
||||||
|
}
|
||||||
|
|
||||||
// called when autosaving new post
|
// called when autosaving new post
|
||||||
function autosave_saved_new(response) {
|
function autosave_saved_new(response) {
|
||||||
var res = autosave_saved(response, true); // parse the ajax response do the above
|
var res = autosave_parse_response(response); // parse the ajax response
|
||||||
// if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
|
// 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 ) {
|
if ( res && res.responses.length && !res.errors ) {
|
||||||
var tempID = jQuery('#post_ID').val();
|
var tempID = jQuery('#post_ID').val();
|
||||||
|
|
Loading…
Reference in New Issue