Better 'Connection lost' notice that includes an indication of activity. fixes #24695.

git-svn-id: http://core.svn.wordpress.org/trunk@24743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-07-18 21:33:59 +00:00
parent e5df929fbf
commit 5bb2f20164
3 changed files with 19 additions and 2 deletions

View File

@ -2993,6 +2993,17 @@ ul.cat-checklist {
float: left;
}
#lost-connection-notice .spinner {
display: block;
float: left;
margin: 0 5px 0 0;
}
.rtl #lost-connection-notice .spinner {
float: right;
margin: 0 0 0 5px;
}
#titlediv {
position: relative;
margin-bottom: 5px;

View File

@ -313,7 +313,9 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
<div id="message" class="updated"><p><?php echo $message; ?></p></div>
<?php endif; ?>
<div id="lost-connection-notice" class="error hidden">
<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>
<p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.' ); ?>
<span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span>
</p>
</div>
<form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag', $post); ?>>

View File

@ -144,7 +144,11 @@ jQuery(document).ready( function($) {
// When connection is lost, keep user from submitting changes.
$(document).on('heartbeat-connection-lost.autosave', function( e, error ) {
if ( 'timeout' === error ) {
$('#lost-connection-notice').show();
var notice = $('#lost-connection-notice');
if ( ! wp.autosave.local.hasStorage ) {
notice.find('.hide-if-no-sessionstorage').hide();
}
notice.show();
autosave_disable_buttons();
}
}).on('heartbeat-connection-restored.autosave', function() {