Skip to content

Commit eae779d

Browse files
committed
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 WordPress#6707 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@7813 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0f25d90 commit eae779d

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

wp-admin/css/colors-classic.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ ul.widget-control-list .sorthelper {
192192
border-color: #a3a3a3;
193193
}
194194

195+
.button[disabled], .button:disabled {
196+
background-color: #999;
197+
}
198+
195199
.tablenav .button-secondary {
196200
border-color: #5396c5;
197201
}

wp-admin/css/colors-fresh.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ ul.widget-control-list .sorthelper {
188188
border-color: #80b5d0;
189189
}
190190

191+
.button[disabled], .button:disabled {
192+
background-color: #999;
193+
}
194+
191195
.submit input:hover, .button:hover, #edit-slug-buttons a.save:hover {
192196
border-color: #535353;
193197
}

wp-includes/js/autosave.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ function autosave_saved_new(response) {
5656
if ( res && res.responses.length && !res.errors ) {
5757
var tempID = jQuery('#post_ID').val();
5858
var postID = parseInt( res.responses[0].id );
59-
autosave_update_post_ID( postID );
59+
autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
6060
if ( tempID < 0 && postID > 0) // update media buttons
6161
jQuery('#media-buttons a').each(function(){
6262
this.href = this.href.replace(tempID, postID);
6363
});
64+
} else {
65+
autosave_enable_buttons(); // re-enable disabled form buttons
6466
}
65-
autosave_enable_buttons(); // re-enable disabled form buttons
6667
}
6768

6869
function autosave_update_post_ID( postID ) {
@@ -78,6 +79,7 @@ function autosave_update_post_ID( postID ) {
7879
post_type: jQuery('#post_type').val()
7980
}, function(html) {
8081
jQuery('#_wpnonce').val(html);
82+
autosave_enable_buttons(); // re-enable disabled form buttons
8183
});
8284
jQuery('#hiddenaction').val('editpost');
8385
}
@@ -127,7 +129,7 @@ function autosave_enable_buttons() {
127129

128130
function autosave_disable_buttons() {
129131
jQuery("#submitpost :button:enabled, #submitpost :submit:enabled").attr('disabled', 'disabled');
130-
setTimeout(autosave_enable_buttons, 1000); // Re-enable 1 sec later. Just gives autosave a head start to avoid collisions.
132+
setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
131133
}
132134

133135
var autosave = function() {

wp-includes/script-loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function default_scripts() {
4747
'broken' => __('An unidentified error has occurred.')
4848
) );
4949

50-
$this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080422' );
50+
$this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080424' );
5151

5252
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
5353
$this->localize( 'wp-ajax', 'WPAjaxL10n', array(

0 commit comments

Comments
 (0)