Changeset 23886
- Timestamp:
- 04/02/2013 10:51:09 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r23868 r23886 366 366 <div id="message" class="updated"><p><?php echo $message; ?></p></div> 367 367 <?php endif; ?> 368 <div id="lost-connection-notice" class="error hidden"> 369 <p><?php _e("You have lost your connection with the server, and saving has been disabled. This message will vanish once you've reconnected."); ?></p> 370 </div> 368 371 <form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag'); ?>> 369 372 <?php wp_nonce_field($nonce_action); ?> -
trunk/wp-includes/js/autosave.js
r23843 r23886 129 129 }); 130 130 } 131 132 // When connection is lost, keep user from submitting changes. 133 $(document).on('heartbeat-connection-lost.autosave', function() { 134 autosave_disable_buttons(); 135 $('#lost-connection-notice').show(); 136 }).on('heartbeat-connection-restored.autosave', function() { 137 autosave_enable_buttons(); 138 $('#lost-connection-notice').hide(); 139 }); 131 140 }); 132 141 … … 219 228 220 229 function autosave_enable_buttons() { 221 // delay that a bit to avoid some rare collisions while the DOM is being updated. 222 setTimeout(function(){ 223 jQuery(':button, :submit', '#submitpost').removeAttr('disabled'); 224 jQuery('.spinner', '#submitpost').hide(); 225 }, 500); 230 if ( ! wp.heartbeat.connectionLost ) { 231 // delay that a bit to avoid some rare collisions while the DOM is being updated. 232 setTimeout(function(){ 233 var parent = jQuery('#submitpost'); 234 parent.find(':button, :submit').removeAttr('disabled'); 235 parent.find('.spinner').hide(); 236 }, 500); 237 } 226 238 } 227 239 228 240 function autosave_disable_buttons() { 229 jQuery(' :button, :submit', '#submitpost').prop('disabled', true);241 jQuery('#submitpost').find(':button, :submit').prop('disabled', true); 230 242 // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions. 231 setTimeout( autosave_enable_buttons, 5000);243 setTimeout( autosave_enable_buttons, 5000 ); 232 244 } 233 245 … … 246 258 post_data, doAutoSave, ed, origStatus, successCallback; 247 259 260 // Disable buttons until we know the save completed. 248 261 autosave_disable_buttons(); 249 262 -
trunk/wp-includes/js/heartbeat.js
r23882 r23886 384 384 self.xhr.abort(); 385 385 386 // Reset the error state 387 errorstate(); 386 388 running = false; 387 389 return true;
Note: See TracChangeset
for help on using the changeset viewer.