Bump the autosave re-enable delay to 5 seconds, makes sure we manually re-enable the buttons on ajax success, and visually dim the disabled buttons for some UI feedback. Props mdawaffe. fixes #6707 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@7813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-25 00:32:29 +00:00
parent 31f09d0b85
commit f3d3b700f5
4 changed files with 14 additions and 4 deletions

View File

@ -192,6 +192,10 @@ ul.widget-control-list .sorthelper {
border-color: #a3a3a3;
}
.button[disabled], .button:disabled {
background-color: #999;
}
.tablenav .button-secondary {
border-color: #5396c5;
}

View File

@ -188,6 +188,10 @@ ul.widget-control-list .sorthelper {
border-color: #80b5d0;
}
.button[disabled], .button:disabled {
background-color: #999;
}
.submit input:hover, .button:hover, #edit-slug-buttons a.save:hover {
border-color: #535353;
}

View File

@ -56,13 +56,14 @@ function autosave_saved_new(response) {
if ( res && res.responses.length && !res.errors ) {
var tempID = jQuery('#post_ID').val();
var postID = parseInt( res.responses[0].id );
autosave_update_post_ID( postID );
autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
if ( tempID < 0 && postID > 0) // update media buttons
jQuery('#media-buttons a').each(function(){
this.href = this.href.replace(tempID, postID);
});
} else {
autosave_enable_buttons(); // re-enable disabled form buttons
}
autosave_enable_buttons(); // re-enable disabled form buttons
}
function autosave_update_post_ID( postID ) {
@ -78,6 +79,7 @@ function autosave_update_post_ID( postID ) {
post_type: jQuery('#post_type').val()
}, function(html) {
jQuery('#_wpnonce').val(html);
autosave_enable_buttons(); // re-enable disabled form buttons
});
jQuery('#hiddenaction').val('editpost');
}
@ -127,7 +129,7 @@ function autosave_enable_buttons() {
function autosave_disable_buttons() {
jQuery("#submitpost :button:enabled, #submitpost :submit:enabled").attr('disabled', 'disabled');
setTimeout(autosave_enable_buttons, 1000); // Re-enable 1 sec later. Just gives autosave a head start to avoid collisions.
setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
}
var autosave = function() {

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'), '20080422' );
$this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080424' );
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
$this->localize( 'wp-ajax', 'WPAjaxL10n', array(