<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27038] trunk/src: Autosave:</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27038">27038</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-01-27 00:27:42 +0000 (Mon, 27 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Autosave:
- Move the 'Saving post' and 'Draft saved at...' strings from autosaveL10n to postL10n as they are used only there.
- Use the custom jQuery events 'before-autosave' and 'after-autosave' to show these messages.
- Separate autosave.suspend() for local and server so local autosaves can continue while server autosaves are suspended.
- Remove the recently added autosave.server.disable() and use autosave.server.suspend() instead.
- Bring back .button.disabled, button-primary.disabled and use .disabled to prevent multiple form submissions.
See <a href="http://core.trac.wordpress.org/ticket/25272">#25272</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjspostjs">trunk/src/wp-admin/js/post.js</a></li>
<li><a href="#trunksrcwpincludescssbuttonscss">trunk/src/wp-includes/css/buttons.css</a></li>
<li><a href="#trunksrcwpincludesjsautosavejs">trunk/src/wp-includes/js/autosave.js</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjspostjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/post.js (27037 => 27038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/post.js    2014-01-26 20:37:33 UTC (rev 27037)
+++ trunk/src/wp-admin/js/post.js       2014-01-27 00:27:42 UTC (rev 27038)
</span><span class="lines">@@ -1,10 +1,12 @@
</span><del>-/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, getUserSetting, setUserSetting */
-/* global theList:true, theExtraList:true, autosave:true */
</del><ins>+/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting */
+/* global theList:true, theExtraList:true, getUserSetting, setUserSetting */
</ins><span class="cx"> 
</span><del>-var tagBox, commentsBox, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
</del><ins>+var tagBox, commentsBox, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint, makeSlugeditClickable, editPermalink;
</ins><span class="cx"> // Back-compat: prevent fatal errors
</span><span class="cx"> makeSlugeditClickable = editPermalink = function(){};
</span><span class="cx"> 
</span><ins>+window.wp = window.wp || {};
+
</ins><span class="cx"> // return an array with any duplicate, whitespace or values removed
</span><span class="cx"> function array_unique_noempty(a) {
</span><span class="cx">  var out = [];
</span><span class="lines">@@ -283,10 +285,10 @@
</span><span class="cx">                  wrap = $('#post-lock-dialog');
</span><span class="cx"> 
</span><span class="cx">                  if ( wrap.length && ! wrap.is(':visible') ) {
</span><del>-                               if ( typeof wp != 'undefined' && wp.autosave ) {
</del><ins>+                                if ( wp.autosave ) {
</ins><span class="cx">                                   // Save the latest changes and disable
</span><span class="cx">                                  $(document).one( 'heartbeat-tick', function() {
</span><del>-                                               wp.autosave.server.disable();
</del><ins>+                                                wp.autosave.server.suspend();
</ins><span class="cx">                                           wrap.removeClass('saving').addClass('saved');
</span><span class="cx">                                          $(window).off( 'beforeunload.edit-post' );
</span><span class="cx">                                  });
</span><span class="lines">@@ -313,7 +315,7 @@
</span><span class="cx">          $.post( ajaxurl, {
</span><span class="cx">                          action: 'sample-permalink',
</span><span class="cx">                          post_id: $('#post_ID').val(),
</span><del>-                               new_title: typeof fullscreen != 'undefined' && fullscreen.settings.visible ? $('#wp-fullscreen-title').val() : $('#title').val(),
</del><ins>+                                new_title: $('#title').val(),
</ins><span class="cx">                           samplepermalinknonce: $('#samplepermalinknonce').val()
</span><span class="cx">                  },
</span><span class="cx">                  function( data ) {
</span><span class="lines">@@ -368,7 +370,7 @@
</span><span class="cx"> }(jQuery));
</span><span class="cx"> 
</span><span class="cx"> jQuery(document).ready( function($) {
</span><del>-       var stamp, visibility, $submitButtons,
</del><ins>+        var stamp, visibility, $submitButtons, updateVisibility, updateText,
</ins><span class="cx">           sticky = '',
</span><span class="cx">          last = 0,
</span><span class="cx">          co = $('#content'),
</span><span class="lines">@@ -399,7 +401,7 @@
</span><span class="cx">  }).filter(':visible').find('.wp-tab-first').focus();
</span><span class="cx"> 
</span><span class="cx">  // Set the heartbeat interval to 15 sec. if post lock dialogs are enabled
</span><del>-       if ( typeof wp !== 'undefined' && wp.heartbeat && $('#post-lock-dialog').length ) {
</del><ins>+        if ( wp.heartbeat && $('#post-lock-dialog').length ) {
</ins><span class="cx">           wp.heartbeat.interval( 15 );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -407,7 +409,7 @@
</span><span class="cx">  $submitButtons = $submitpost.find( ':button, :submit, a.submitdelete, #post-preview' ).on( 'click.edit-post', function( event ) {
</span><span class="cx">          var $button = $(this);
</span><span class="cx"> 
</span><del>-               if ( $button.hasClass('button-disabled') ) {
</del><ins>+                if ( $button.hasClass('disabled') ) {
</ins><span class="cx">                   event.preventDefault();
</span><span class="cx">                  return;
</span><span class="cx">          }
</span><span class="lines">@@ -423,14 +425,15 @@
</span><span class="cx">                          return;
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       if ( typeof wp != 'undefined' && wp.autosave ) {
-                               wp.autosave.server.disable();
</del><ins>+                        // Stop autosave
+                       if ( wp.autosave ) {
+                               wp.autosave.server.suspend();
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  releaseLock = false;
</span><span class="cx">                  $(window).off( 'beforeunload.edit-post' );
</span><span class="cx"> 
</span><del>-                       $submitButtons.addClass( 'button-disabled' );
</del><ins>+                        $submitButtons.addClass( 'disabled' );
</ins><span class="cx"> 
</span><span class="cx">                  if ( $button.attr('id') === 'publish' ) {
</span><span class="cx">                          $submitpost.find('#major-publishing-actions .spinner').show();
</span><span class="lines">@@ -447,14 +450,14 @@
</span><span class="cx">                  $previewField = $('input#wp-preview'),
</span><span class="cx">                  target = $this.attr('target') || 'wp-preview',
</span><span class="cx">                  ua = navigator.userAgent.toLowerCase();
</span><del>-               
</del><ins>+
</ins><span class="cx">           event.preventDefault();
</span><span class="cx"> 
</span><del>-               if ( $this.prop('disabled') ) {
</del><ins>+                if ( $this.hasClass('disabled') ) {
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               if ( typeof wp != 'undefined' && wp.autosave ) {
</del><ins>+                if ( wp.autosave ) {
</ins><span class="cx">                   wp.autosave.server.tempBlockSave();
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -496,27 +499,31 @@
</span><span class="cx">                          return;
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       if ( typeof wp != 'undefined' && wp.autosave ) {
</del><ins>+                        if ( wp.autosave ) {
</ins><span class="cx">                           wp.autosave.server.triggerSave();
</span><span class="cx">                  }
</span><span class="cx">          });
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  $(document).on( 'autosave-disable-buttons.edit-post', function() {
</span><del>-               $submitButtons.addClass( 'button-disabled' );
</del><ins>+                $submitButtons.addClass( 'disabled' );
</ins><span class="cx">   }).on( 'autosave-enable-buttons.edit-post', function() {
</span><del>-               if ( ! window.wp || ! window.wp.heartbeat || ! window.wp.heartbeat.hasConnectionError() ) {
-                       $submitButtons.removeClass( 'button-disabled' );
</del><ins>+                if ( ! wp.heartbeat || ! wp.heartbeat.hasConnectionError() ) {
+                       $submitButtons.removeClass( 'disabled' );
</ins><span class="cx">           }
</span><ins>+       }).on( 'before-autosave.edit-post', function() {
+               $( '.autosave-message' ).text( postL10n.savingText );
+       }).on( 'after-autosave.edit-post', function( event, data ) {
+               $( '.autosave-message' ).text( data.message );
</ins><span class="cx">   });
</span><span class="cx"> 
</span><span class="cx">  $(window).on( 'beforeunload.edit-post', function() {
</span><span class="cx">          var editor = typeof tinymce !== 'undefined' && tinymce.get('content');
</span><span class="cx"> 
</span><del>-               if ( ( editor && ! editor.isHidden() && editor.isDirty() ) || 
-                       ( typeof wp !== 'undefined' && wp.autosave && wp.autosave.server.postChanged() ) ) {
</del><ins>+                if ( ( editor && ! editor.isHidden() && editor.isDirty() ) ||
+                       ( wp.autosave && wp.autosave.server.postChanged() ) ) {
</ins><span class="cx"> 
</span><del>-                       return autosaveL10n.saveAlert;
</del><ins>+                        return postL10n.saveAlert;
</ins><span class="cx">           }
</span><span class="cx">  }).on( 'unload.edit-post', function( event ) {
</span><span class="cx">          if ( ! releaseLock ) {
</span><span class="lines">@@ -817,7 +824,7 @@
</span><span class="cx">                          event.preventDefault();
</span><span class="cx">                          $timestampdiv.show();
</span><span class="cx"> 
</span><del>-                               if ( typeof wp !== 'undefined' && wp.autosave ) {
</del><ins>+                                if ( wp.autosave ) {
</ins><span class="cx">                                   wp.autosave.enableButtons();
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="lines">@@ -848,70 +855,76 @@
</span><span class="cx">  } // end submitdiv
</span><span class="cx"> 
</span><span class="cx">  // permalink
</span><del>-       if ( $editSlugWrap.length ) {
-               function editPermalink() {
-                       var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'),
-                               revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(),
-                               full = $('#editable-post-name-full').html();
</del><ins>+        function editPermalink() {
+               var i, slug_value,
+                       c = 0,
+                       e = $('#editable-post-name'),
+                       revert_e = e.html(),
+                       real_slug = $('#post_name'),
+                       revert_slug = real_slug.val(),
+                       b = $('#edit-slug-buttons'),
+                       revert_b = b.html(),
+                       full = $('#editable-post-name-full').html();
</ins><span class="cx"> 
</span><del>-                       $('#view-post-btn').hide();
-                       b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
-                       b.children('.save').click(function() {
-                               var new_slug = e.children('input').val();
-                               if ( new_slug == $('#editable-post-name-full').text() ) {
-                                       return $('#edit-slug-buttons .cancel').click();
</del><ins>+                $('#view-post-btn').hide();
+               b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
+               b.children('.save').click(function() {
+                       var new_slug = e.children('input').val();
+                       if ( new_slug == $('#editable-post-name-full').text() ) {
+                               return $('#edit-slug-buttons .cancel').click();
+                       }
+                       $.post(ajaxurl, {
+                               action: 'sample-permalink',
+                               post_id: postId,
+                               new_slug: new_slug,
+                               new_title: $('#title').val(),
+                               samplepermalinknonce: $('#samplepermalinknonce').val()
+                       }, function(data) {
+                               var box = $('#edit-slug-box');
+                               box.html(data);
+                               if (box.hasClass('hidden')) {
+                                       box.fadeIn('fast', function () {
+                                               box.removeClass('hidden');
+                                       });
</ins><span class="cx">                           }
</span><del>-                               $.post(ajaxurl, {
-                                       action: 'sample-permalink',
-                                       post_id: postId,
-                                       new_slug: new_slug,
-                                       new_title: $('#title').val(),
-                                       samplepermalinknonce: $('#samplepermalinknonce').val()
-                               }, function(data) {
-                                       var box = $('#edit-slug-box');
-                                       box.html(data);
-                                       if (box.hasClass('hidden')) {
-                                               box.fadeIn('fast', function () {
-                                                       box.removeClass('hidden');
-                                               });
-                                       }
-                                       b.html(revert_b);
-                                       real_slug.val(new_slug);
-                                       $('#view-post-btn').show();
-                               });
-                               return false;
</del><ins>+                                b.html(revert_b);
+                               real_slug.val(new_slug);
+                               $('#view-post-btn').show();
</ins><span class="cx">                   });
</span><ins>+                       return false;
+               });
</ins><span class="cx"> 
</span><del>-                       $('#edit-slug-buttons .cancel').click(function() {
-                               $('#view-post-btn').show();
-                               e.html(revert_e);
-                               b.html(revert_b);
-                               real_slug.val(revert_slug);
</del><ins>+                $('#edit-slug-buttons .cancel').click(function() {
+                       $('#view-post-btn').show();
+                       e.html(revert_e);
+                       b.html(revert_b);
+                       real_slug.val(revert_slug);
+                       return false;
+               });
+
+               for ( i = 0; i < full.length; ++i ) {
+                       if ( '%' == full.charAt(i) )
+                               c++;
+               }
+
+               slug_value = ( c > full.length / 4 ) ? '' : full;
+               e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e) {
+                       var key = e.keyCode || 0;
+                       // on enter, just save the new slug, don't save the post
+                       if ( 13 == key ) {
+                               b.children('.save').click();
</ins><span class="cx">                           return false;
</span><del>-                       });
-
-                       for ( i = 0; i < full.length; ++i ) {
-                               if ( '%' == full.charAt(i) )
-                                       c++;
</del><span class="cx">                   }
</span><ins>+                       if ( 27 == key ) {
+                               b.children('.cancel').click();
+                               return false;
+                       }
+               } ).keyup( function() {
+                       real_slug.val(this.value);
+               }).focus();
+       }
</ins><span class="cx"> 
</span><del>-                       slug_value = ( c > full.length / 4 ) ? '' : full;
-                       e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e) {
-                               var key = e.keyCode || 0;
-                               // on enter, just save the new slug, don't save the post
-                               if ( 13 == key ) {
-                                       b.children('.save').click();
-                                       return false;
-                               }
-                               if ( 27 == key ) {
-                                       b.children('.cancel').click();
-                                       return false;
-                               }
-                       } ).keyup( function() {
-                               real_slug.val(this.value);
-                       }).focus();
-               };
-
</del><ins>+        if ( $editSlugWrap.length ) {
</ins><span class="cx">           $editSlugWrap.on( 'click', function( event ) {
</span><span class="cx">                  var $target = $( event.target );
</span><span class="cx"> 
</span><span class="lines">@@ -971,7 +984,7 @@
</span><span class="cx">                  $document = $( document ),
</span><span class="cx">                  $textarea = $('textarea#content'),
</span><span class="cx">                  $handle = $('#post-status-info');
</span><del>-               
</del><ins>+
</ins><span class="cx">           // No point for touch devices
</span><span class="cx">          if ( ! $textarea.length || 'ontouchstart' in window ) {
</span><span class="cx">                  return;
</span></span></pre></div>
<a id="trunksrcwpincludescssbuttonscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/css/buttons.css (27037 => 27038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/css/buttons.css    2014-01-26 20:37:33 UTC (rev 27037)
+++ trunk/src/wp-includes/css/buttons.css       2014-01-27 00:27:42 UTC (rev 27038)
</span><span class="lines">@@ -165,8 +165,10 @@
</span><span class="cx"> 
</span><span class="cx"> .wp-core-ui .button[disabled],
</span><span class="cx"> .wp-core-ui .button:disabled,
</span><ins>+.wp-core-ui .button.disabled,
</ins><span class="cx"> .wp-core-ui .button-secondary[disabled],
</span><span class="cx"> .wp-core-ui .button-secondary:disabled,
</span><ins>+.wp-core-ui .button-secondary.disabled,
</ins><span class="cx"> .wp-core-ui .button-disabled {
</span><span class="cx">  color: #aaa !important;
</span><span class="cx">  border-color: #ddd !important;
</span><span class="lines">@@ -221,7 +223,8 @@
</span><span class="cx"> 
</span><span class="cx"> .wp-core-ui .button-primary[disabled],
</span><span class="cx"> .wp-core-ui .button-primary:disabled,
</span><del>-.wp-core-ui .button-primary-disabled {
</del><ins>+.wp-core-ui .button-primary-disabled,
+.wp-core-ui .button-primary.disabled {
</ins><span class="cx">   color: #94cde7 !important;
</span><span class="cx">  background: #298cba !important;
</span><span class="cx">  border-color: #1b607f !important;
</span></span></pre></div>
<a id="trunksrcwpincludesjsautosavejs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/autosave.js (27037 => 27038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/autosave.js     2014-01-26 20:37:33 UTC (rev 27037)
+++ trunk/src/wp-includes/js/autosave.js        2014-01-27 00:27:42 UTC (rev 27038)
</span><span class="lines">@@ -6,7 +6,6 @@
</span><span class="cx">  function autosave() {
</span><span class="cx">          var initialCompareString,
</span><span class="cx">          lastTriggerSave = 0,
</span><del>-               isSuspended = false,
</del><span class="cx">           $document = $(document);
</span><span class="cx"> 
</span><span class="cx">          /**
</span><span class="lines">@@ -87,18 +86,11 @@
</span><span class="cx">                  $document.trigger( 'autosave-enable-buttons' );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               function suspend() {
-                       isSuspended = true;
-               }
-
-               function resume() {
-                       isSuspended = false;
-               }
-
</del><span class="cx">           // Autosave in localStorage
</span><span class="cx">          function autosaveLocal() {
</span><span class="cx">                  var restorePostData, undoPostData, blog_id, post_id, hasStorage, intervalTimer,
</span><del>-                               lastCompareString;
</del><ins>+                                lastCompareString,
+                               isSuspended = false;
</ins><span class="cx"> 
</span><span class="cx">                  // Check if the browser supports sessionStorage and it's not disabled
</span><span class="cx">                  function checkStorage() {
</span><span class="lines">@@ -196,6 +188,14 @@
</span><span class="cx">                          return setStorage( stored );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><ins>+                       function suspend() {
+                               isSuspended = true;
+                       }
+
+                       function resume() {
+                               isSuspended = false;
+                       }
+
</ins><span class="cx">                   /**
</span><span class="cx">                   * Save post data for the current post
</span><span class="cx">                   *
</span><span class="lines">@@ -415,14 +415,17 @@
</span><span class="cx">                  return {
</span><span class="cx">                          hasStorage: hasStorage,
</span><span class="cx">                          getSavedPostData: getSavedPostData,
</span><del>-                               save: save
</del><ins>+                                save: save,
+                               suspend: suspend,
+                               resume: resume
</ins><span class="cx">                   };
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // Autosave on the server
</span><span class="cx">          function autosaveServer() {
</span><del>-                       var _disabled, _blockSave, _blockSaveTimer, previousCompareString, lastCompareString,
-                               nextRun = 0;
</del><ins>+                        var _blockSave, _blockSaveTimer, previousCompareString, lastCompareString,
+                               nextRun = 0,
+                               isSuspended = false;
</ins><span class="cx"> 
</span><span class="cx">                  // Block saving for the next 10 sec.
</span><span class="cx">                  function tempBlockSave() {
</span><span class="lines">@@ -434,6 +437,14 @@
</span><span class="cx">                          }, 10000 );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><ins>+                       function suspend() {
+                               isSuspended = true;
+                       }
+
+                       function resume() {
+                               isSuspended = false;
+                       }
+
</ins><span class="cx">                   // Runs on heartbeat-response
</span><span class="cx">                  function response( data ) {
</span><span class="cx">                          _schedule();
</span><span class="lines">@@ -442,7 +453,6 @@
</span><span class="cx">                          previousCompareString = '';
</span><span class="cx"> 
</span><span class="cx">                          $document.trigger( 'after-autosave', [data] );
</span><del>-                               $( '.autosave-message' ).text( data.message );
</del><span class="cx">                           enableButtons();
</span><span class="cx"> 
</span><span class="cx">                          if ( data.success ) {
</span><span class="lines">@@ -452,15 +462,6 @@
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="cx">                  /**
</span><del>-                        * Disable autosave
-                        *
-                        * Intended to run on form.submit
-                        */
-                       function disable() {
-                               _disabled = true;
-                       }
-
-                       /**
</del><span class="cx">                    * Save immediately
</span><span class="cx">                   *
</span><span class="cx">                   * Resets the timing and tells heartbeat to connect now
</span><span class="lines">@@ -488,7 +489,7 @@
</span><span class="cx">                  function save() {
</span><span class="cx">                          var postData, compareString;
</span><span class="cx"> 
</span><del>-                               if ( isSuspended || _disabled || _blockSave ) {
</del><ins>+                                if ( isSuspended || _blockSave ) {
</ins><span class="cx">                                   return false;
</span><span class="cx">                          }
</span><span class="cx"> 
</span><span class="lines">@@ -516,7 +517,6 @@
</span><span class="cx">                          $document.trigger( 'wpcountwords', [ postData.content ] )
</span><span class="cx">                                  .trigger( 'before-autosave', [ postData ] );
</span><span class="cx"> 
</span><del>-                               $( '.autosave-message' ).text( autosaveL10n.savingText );
</del><span class="cx">                           postData._wpnonce = $( '#_wpnonce' ).val() || '';
</span><span class="cx"> 
</span><span class="cx">                          return postData;
</span><span class="lines">@@ -556,10 +556,11 @@
</span><span class="cx">                  });
</span><span class="cx"> 
</span><span class="cx">                  return {
</span><del>-                               disable: disable,
</del><span class="cx">                           tempBlockSave: tempBlockSave,
</span><span class="cx">                          triggerSave: triggerSave,
</span><del>-                               postChanged: postChanged
</del><ins>+                                postChanged: postChanged,
+                               suspend: suspend,
+                               resume: resume
</ins><span class="cx">                   };
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -584,8 +585,6 @@
</span><span class="cx">                  getCompareString: getCompareString,
</span><span class="cx">                  disableButtons: disableButtons,
</span><span class="cx">                  enableButtons: enableButtons,
</span><del>-                       suspend: suspend,
-                       resume: resume,
</del><span class="cx">                   local: autosaveLocal(),
</span><span class="cx">                  server: autosaveServer()
</span><span class="cx">          };
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/script-loader.php (27037 => 27038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/script-loader.php  2014-01-26 20:37:33 UTC (rev 27037)
+++ trunk/src/wp-includes/script-loader.php     2014-01-27 00:27:42 UTC (rev 27038)
</span><span class="lines">@@ -430,6 +430,8 @@
</span><span class="cx">                  'privatelyPublished' => __('Privately Published'),
</span><span class="cx">                  'published' => __('Published'),
</span><span class="cx">                  'comma' => _x( ',', 'tag delimiter' ),
</span><ins>+                       'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
+                       'savingText' => __('Saving Draft&#8230;'),
</ins><span class="cx">           ) );
</span><span class="cx"> 
</span><span class="cx">          $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
</span><span class="lines">@@ -653,8 +655,6 @@
</span><span class="cx"> 
</span><span class="cx">  wp_localize_script( 'autosave', 'autosaveL10n', array(
</span><span class="cx">          'autosaveInterval' => AUTOSAVE_INTERVAL,
</span><del>-               'savingText' => __('Saving Draft&#8230;'),
-               'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
</del><span class="cx">           'blog_id' => get_current_blog_id(),
</span><span class="cx">  ) );
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>