mirror of
https://github.com/WordPress/WordPress.git
synced 2024-08-25 15:22:53 +02:00
Updates package dependencies to more modern versions, also adds .nvmrc and package-lock.json as followups to [43683] and [43571]. See #44600. Fixes #45064. Built from https://develop.svn.wordpress.org/branches/5.0@43684 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
5.3 KiB
JavaScript
1 line
5.3 KiB
JavaScript
window.autosave=function(){return!0},function(h,_){_.wp=_.wp||{},_.wp.autosave=function(){var f,r=0,d=h(document);function g(t){var e,n,o,a=(new Date).getTime(),s=[],i=m();return i&&i.isDirty()&&!i.isHidden()&&r<a-3e3&&(i.save(),r=a),o={post_id:h("#post_ID").val()||0,post_type:h("#post_type").val()||"",post_author:h("#post_author").val()||"",post_title:h("#title").val()||"",content:h("#content").val()||"",excerpt:h("#excerpt").val()||""},"local"===t||(h('input[id^="in-category-"]:checked').each(function(){s.push(this.value)}),o.catslist=s.join(","),(e=h("#post_name").val())&&(o.post_name=e),(n=h("#parent_id").val())&&(o.parent_id=n),h("#comment_status").prop("checked")&&(o.comment_status="open"),h("#ping_status").prop("checked")&&(o.ping_status="open"),"1"===h("#auto_draft").val()&&(o.auto_draft="1")),o}function w(t){return"object"==typeof t?(t.post_title||"")+"::"+(t.content||"")+"::"+(t.excerpt||""):(h("#title").val()||"")+"::"+(h("#content").val()||"")+"::"+(h("#excerpt").val()||"")}function l(){d.trigger("autosave-disable-buttons"),setTimeout(a,5e3)}function a(){d.trigger("autosave-enable-buttons")}function m(){return"undefined"!=typeof tinymce&&tinymce.get("content")}return d.on("tinymce-editor-init.autosave",function(t,e){"content"===e.id&&_.setTimeout(function(){e.save(),f=w()},1e3)}).ready(function(){f=w()}),{getPostData:g,getCompareString:w,disableButtons:l,enableButtons:a,local:function(){var a,c,s,u,i=!1;function r(){var t=!1;return s&&a&&(t=(t=sessionStorage.getItem("wp-autosave-"+a))?JSON.parse(t):{}),t}function p(){var t=r();return t&&c&&t["post_"+c]||!1}function l(t){var e,n,o=r();if(!o||!c)return!1;if(t)o["post_"+c]=t;else{if(!o.hasOwnProperty("post_"+c))return!1;delete o["post_"+c]}return e=o,!(!s||!a)&&(n="wp-autosave-"+a,sessionStorage.setItem(n,JSON.stringify(e)),null!==sessionStorage.getItem(n))}function o(t){var e,n,o;return!(i||!s)&&(t?(e=p()||{},h.extend(e,t)):e=g("local"),n=w(e),void 0===u&&(u=f),n!==u&&(e.save_time=(new Date).getTime(),e.status=h("#post_status").val()||"",(o=l(e))&&(u=n),o))}function v(t,e){function n(t){return t.toString().replace(/[\x20\t\r\n\f]+/g,"")}return n(t||"")===n(e||"")}function t(){var t,e,n,o,a=p(),s=wpCookies.get("wp-saving-post"),i=h("#has-newer-autosave").parent(".notice"),r=h(".wp-header-end");if(s===c+"-saved")return wpCookies.remove("wp-saving-post"),void l(!1);a&&(t=h("#content").val()||"",e=h("#title").val()||"",n=h("#excerpt").val()||"",v(t,a.content)&&v(e,a.post_title)&&v(n,a.excerpt)||(r.length||(r=h(".wrap h1, .wrap h2").first()),o=h("#local-storage-notice").insertAfter(r).addClass("notice-warning"),i.length?i.slideUp(150,function(){o.slideDown(150)}):o.slideDown(200),o.find(".restore-backup").on("click.autosave-local",function(){var t,e;(t=a)&&(u=w(t),h("#title").val()!==t.post_title&&h("#title").focus().val(t.post_title||""),h("#excerpt").val(t.excerpt||""),(e=m())&&!e.isHidden()&&"undefined"!=typeof switchEditors?(e.settings.wpautop&&t.content&&(t.content=switchEditors.wpautop(t.content)),e.undoManager.transact(function(){e.setContent(t.content||""),e.nodeChanged()})):(h("#content-html").click(),h("#content").focus(),document.execCommand("selectAll"),document.execCommand("insertText",!1,t.content||""))),o.fadeTo(250,0,function(){o.slideUp(150)})})))}return a=void 0!==_.autosaveL10n&&_.autosaveL10n.blog_id,function(){var t=Math.random().toString(),e=!1;try{_.sessionStorage.setItem("wp-test",t),e=_.sessionStorage.getItem("wp-test")===t,_.sessionStorage.removeItem("wp-test")}catch(t){}return s=e}()&&a&&(h("#content").length||h("#excerpt").length)&&d.ready(function(){c=h("#post_ID").val()||0,h("#wp-content-wrap").hasClass("tmce-active")?d.on("tinymce-editor-init.autosave",function(){_.setTimeout(function(){t()},1500)}):t(),_.setInterval(o,15e3),h("form#post").on("submit.autosave-local",function(){var t=m(),e=h("#post_ID").val()||0;t&&!t.isHidden()?t.on("submit",function(){o({post_title:h("#title").val()||"",content:h("#content").val()||"",excerpt:h("#excerpt").val()||""})}):o({post_title:h("#title").val()||"",content:h("#content").val()||"",excerpt:h("#excerpt").val()||""});var n="https:"===_.location.protocol;wpCookies.set("wp-saving-post",e+"-check",86400,!1,!1,n)})}),{hasStorage:s,getSavedPostData:p,save:o,suspend:function(){i=!0},resume:function(){i=!1}}}(),server:function(){var s,t,i,r,c=0,u=!1;function p(){s=!0,_.clearTimeout(t),t=_.setTimeout(function(){s=!1},1e4)}function o(){c=(new Date).getTime()+1e3*autosaveL10n.autosaveInterval||6e4}return d.on("heartbeat-send.autosave",function(t,e){var n,o,a=!(u||s||!_.autosave())&&!((new Date).getTime()<c)&&(o=w(n=g()),void 0===r&&(r=f),o!==r&&(i=o,p(),l(),d.trigger("wpcountwords",[n.content]).trigger("before-autosave",[n]),n._wpnonce=h("#_wpnonce").val()||"",n));a&&(e.wp_autosave=a)}).on("heartbeat-tick.autosave",function(t,e){var n;e.wp_autosave&&(n=e.wp_autosave,o(),s=!1,r=i,i="",d.trigger("after-autosave",[n]),a(),n.success&&h("#auto_draft").val(""))}).on("heartbeat-connection-lost.autosave",function(t,e,n){if("timeout"===e||603===n){var o=h("#lost-connection-notice");wp.autosave.local.hasStorage||o.find(".hide-if-no-sessionstorage").hide(),o.show(),l()}}).on("heartbeat-connection-restored.autosave",function(){h("#lost-connection-notice").hide(),a()}).ready(function(){o()}),{tempBlockSave:p,triggerSave:function(){c=0,wp.heartbeat.connectNow()},postChanged:function(){return w()!==f},suspend:function(){u=!0},resume:function(){u=!1}}}()}}()}(jQuery,window); |