wp/wp-includes/js/autosave.min.js
changeset 16 a86126ab1dd4
parent 7 cf61fcea0001
child 18 be944660c56a
--- a/wp/wp-includes/js/autosave.min.js	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/js/autosave.min.js	Tue Dec 15 13:49:49 2020 +0100
@@ -1,1 +1,2 @@
-window.autosave=function(){return!0},function(a,b){function c(){function c(b){var c,d,e,f=(new Date).getTime(),h=[],i=g();return i&&i.isDirty()&&!i.isHidden()&&f-3e3>k&&(i.save(),k=f),e={post_id:a("#post_ID").val()||0,post_type:a("#post_type").val()||"",post_author:a("#post_author").val()||"",post_title:a("#title").val()||"",content:a("#content").val()||"",excerpt:a("#excerpt").val()||""},"local"===b?e:(a('input[id^="in-category-"]:checked').each(function(){h.push(this.value)}),e.catslist=h.join(","),(c=a("#post_name").val())&&(e.post_name=c),(d=a("#parent_id").val())&&(e.parent_id=d),a("#comment_status").prop("checked")&&(e.comment_status="open"),a("#ping_status").prop("checked")&&(e.ping_status="open"),"1"===a("#auto_draft").val()&&(e.auto_draft="1"),e)}function d(b){return"object"==typeof b?(b.post_title||"")+"::"+(b.content||"")+"::"+(b.excerpt||""):(a("#title").val()||"")+"::"+(a("#content").val()||"")+"::"+(a("#excerpt").val()||"")}function e(){l.trigger("autosave-disable-buttons"),setTimeout(f,5e3)}function f(){l.trigger("autosave-enable-buttons")}function g(){return"undefined"!=typeof tinymce&&tinymce.get("content")}function h(){function e(){var a=Math.random().toString(),c=!1;try{b.sessionStorage.setItem("wp-test",a),c=b.sessionStorage.getItem("wp-test")===a,b.sessionStorage.removeItem("wp-test")}catch(d){}return v=c,c}function f(){var a=!1;return v&&t&&(a=sessionStorage.getItem("wp-autosave-"+t),a=a?JSON.parse(a):{}),a}function h(a){var b;return!(!v||!t)&&(b="wp-autosave-"+t,sessionStorage.setItem(b,JSON.stringify(a)),null!==sessionStorage.getItem(b))}function i(){var a=f();return!(!a||!u)&&(a["post_"+u]||!1)}function k(a){var b=f();if(!b||!u)return!1;if(a)b["post_"+u]=a;else{if(!b.hasOwnProperty("post_"+u))return!1;delete b["post_"+u]}return h(b)}function m(){y=!0}function n(){y=!1}function o(b){var e,f,g=!1;return!(y||!v)&&(b?(e=i()||{},a.extend(e,b)):e=c("local"),f=d(e),"undefined"==typeof x&&(x=j),f!==x&&(e.save_time=(new Date).getTime(),e.status=a("#post_status").val()||"",g=k(e),g&&(x=f),g))}function p(){u=a("#post_ID").val()||0,a("#wp-content-wrap").hasClass("tmce-active")?l.on("tinymce-editor-init.autosave",function(){b.setTimeout(function(){r()},1500)}):r(),w=b.setInterval(o,15e3),a("form#post").on("submit.autosave-local",function(){var c=g(),d=a("#post_ID").val()||0;c&&!c.isHidden()?c.on("submit",function(){o({post_title:a("#title").val()||"",content:a("#content").val()||"",excerpt:a("#excerpt").val()||""})}):o({post_title:a("#title").val()||"",content:a("#content").val()||"",excerpt:a("#excerpt").val()||""});var e="https:"===b.location.protocol;wpCookies.set("wp-saving-post",d+"-check",86400,!1,!1,e)})}function q(a,b){function c(a){return a.toString().replace(/[\x20\t\r\n\f]+/g,"")}return c(a||"")===c(b||"")}function r(){var b,c,d,e,f=i(),g=wpCookies.get("wp-saving-post"),h=a("#has-newer-autosave").parent(".notice"),j=a(".wp-header-end");return g===u+"-saved"?(wpCookies.remove("wp-saving-post"),void k(!1)):void(f&&(b=a("#content").val()||"",c=a("#title").val()||"",d=a("#excerpt").val()||"",q(b,f.content)&&q(c,f.post_title)&&q(d,f.excerpt)||(j.length||(j=a(".wrap h1, .wrap h2").first()),e=a("#local-storage-notice").insertAfter(j).addClass("notice-warning"),h.length?h.slideUp(150,function(){e.slideDown(150)}):e.slideDown(200),e.find(".restore-backup").on("click.autosave-local",function(){s(f),e.fadeTo(250,0,function(){e.slideUp(150)})}))))}function s(b){var c;return!!b&&(x=d(b),a("#title").val()!==b.post_title&&a("#title").focus().val(b.post_title||""),a("#excerpt").val(b.excerpt||""),c=g(),c&&!c.isHidden()&&"undefined"!=typeof switchEditors?(c.settings.wpautop&&b.content&&(b.content=switchEditors.wpautop(b.content)),c.undoManager.transact(function(){c.setContent(b.content||""),c.nodeChanged()})):(a("#content-html").click(),a("#content").focus(),document.execCommand("selectAll"),document.execCommand("insertText",!1,b.content||"")),!0)}var t,u,v,w,x,y=!1;return t="undefined"!=typeof b.autosaveL10n&&b.autosaveL10n.blog_id,e()&&t&&(a("#content").length||a("#excerpt").length)&&l.ready(p),{hasStorage:v,getSavedPostData:i,save:o,suspend:m,resume:n}}function i(){function g(){q=!0,b.clearTimeout(r),r=b.setTimeout(function(){q=!1},1e4)}function h(){v=!0}function i(){v=!1}function k(b){p(),q=!1,t=s,s="",l.trigger("after-autosave",[b]),f(),b.success&&a("#auto_draft").val("")}function m(){u=0,wp.heartbeat.connectNow()}function n(){return d()!==j}function o(){var f,h;return!(v||q||!b.autosave())&&(!((new Date).getTime()<u)&&(f=c(),h=d(f),"undefined"==typeof t&&(t=j),h!==t&&(s=h,g(),e(),l.trigger("wpcountwords",[f.content]).trigger("before-autosave",[f]),f._wpnonce=a("#_wpnonce").val()||"",f)))}function p(){u=(new Date).getTime()+1e3*autosaveL10n.autosaveInterval||6e4}var q,r,s,t,u=0,v=!1;return l.on("heartbeat-send.autosave",function(a,b){var c=o();c&&(b.wp_autosave=c)}).on("heartbeat-tick.autosave",function(a,b){b.wp_autosave&&k(b.wp_autosave)}).on("heartbeat-connection-lost.autosave",function(b,c,d){if("timeout"===c||603===d){var f=a("#lost-connection-notice");wp.autosave.local.hasStorage||f.find(".hide-if-no-sessionstorage").hide(),f.show(),e()}}).on("heartbeat-connection-restored.autosave",function(){a("#lost-connection-notice").hide(),f()}).ready(function(){p()}),{tempBlockSave:g,triggerSave:m,postChanged:n,suspend:h,resume:i}}var j,k=0,l=a(document);return l.on("tinymce-editor-init.autosave",function(a,c){"content"===c.id&&b.setTimeout(function(){c.save(),j=d()},1e3)}).ready(function(){j=d()}),{getPostData:c,getCompareString:d,disableButtons:e,enableButtons:f,local:h(),server:i()}}b.wp=b.wp||{},b.wp.autosave=c()}(jQuery,window);
\ No newline at end of file
+/*! This file is auto-generated */
+window.autosave=function(){return!0},function(c,o){function a(t){var e,n,o,a=(new Date).getTime(),i=[],s=p();return s&&s.isDirty()&&!s.isHidden()&&I<a-3e3&&(s.save(),I=a),o={post_id:c("#post_ID").val()||0,post_type:c("#post_type").val()||"",post_author:c("#post_author").val()||"",post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""},"local"===t||(c('input[id^="in-category-"]:checked').each(function(){i.push(this.value)}),o.catslist=i.join(","),(e=c("#post_name").val())&&(o.post_name=e),(n=c("#parent_id").val())&&(o.parent_id=n),c("#comment_status").prop("checked")&&(o.comment_status="open"),c("#ping_status").prop("checked")&&(o.ping_status="open"),"1"===c("#auto_draft").val()&&(o.auto_draft="1")),o}function u(t){return"object"==typeof t?(t.post_title||"")+"::"+(t.content||"")+"::"+(t.excerpt||""):(c("#title").val()||"")+"::"+(c("#content").val()||"")+"::"+(c("#excerpt").val()||"")}function i(){T.trigger("autosave-disable-buttons"),setTimeout(n,5e3)}function n(){T.trigger("autosave-enable-buttons")}function p(){return"undefined"!=typeof tinymce&&tinymce.get("content")}function s(){m=!0,o.clearTimeout(e),e=o.setTimeout(function(){m=!1},1e4)}function r(){x=(new Date).getTime()+1e3*autosaveL10n.autosaveInterval||6e4}function l(){var t=!1;return k&&b&&(t=(t=sessionStorage.getItem("wp-autosave-"+b))?JSON.parse(t):{}),t}function v(){var t=l();return t&&S&&t["post_"+S]||!1}function f(t){var e=l();if(!e||!S)return!1;if(t)e["post_"+S]=t;else{if(!e.hasOwnProperty("post_"+S))return!1;delete e["post_"+S]}return function(t){var e;return!(!k||!b)&&(e="wp-autosave-"+b,sessionStorage.setItem(e,JSON.stringify(t)),null!==sessionStorage.getItem(e))}(e)}function d(t){var e,n,o;return!(C||!k)&&(t?(e=v()||{},c.extend(e,t)):e=a("local"),n=u(e),void 0===D&&(D=w),n!==D&&(e.save_time=(new Date).getTime(),e.status=c("#post_status").val()||"",(o=f(e))&&(D=n),o))}function g(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=v(),i=wpCookies.get("wp-saving-post"),s=c("#has-newer-autosave").parent(".notice"),r=c(".wp-header-end");if(i===S+"-saved")return wpCookies.remove("wp-saving-post"),void f(!1);a&&(t=c("#content").val()||"",e=c("#title").val()||"",n=c("#excerpt").val()||"",g(t,a.content)&&g(e,a.post_title)&&g(n,a.excerpt)||(r.length||(r=c(".wrap h1, .wrap h2").first()),o=c("#local-storage-notice").insertAfter(r).addClass("notice-warning"),s.length?s.slideUp(150,function(){o.slideDown(150)}):o.slideDown(200),o.find(".restore-backup").on("click.autosave-local",function(){!function(t){var e;if(t)return D=u(t),c("#title").val()!==t.post_title&&c("#title").focus().val(t.post_title||""),c("#excerpt").val(t.excerpt||""),(e=p())&&!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()})):(c("#content-html").click(),c("#content").focus(),document.execCommand("selectAll"),document.execCommand("insertText",!1,t.content||""))}(a),o.fadeTo(250,0,function(){o.slideUp(150)})})))}var w,m,e,h,_,x,y,b,S,k,D,C,I,T;o.wp=o.wp||{},o.wp.autosave=(I=0,(T=c(document)).on("tinymce-editor-init.autosave",function(t,e){"content"===e.id&&o.setTimeout(function(){e.save(),w=u()},1e3)}).ready(function(){w=u()}),{getPostData:a,getCompareString:u,disableButtons:i,enableButtons:n,local:(C=!1,b=void 0!==o.autosaveL10n&&o.autosaveL10n.blog_id,function(){var t=Math.random().toString(),e=!1;try{o.sessionStorage.setItem("wp-test",t),e=o.sessionStorage.getItem("wp-test")===t,o.sessionStorage.removeItem("wp-test")}catch(t){}return k=e}()&&b&&(c("#content").length||c("#excerpt").length)&&T.ready(function(){S=c("#post_ID").val()||0,c("#wp-content-wrap").hasClass("tmce-active")?T.on("tinymce-editor-init.autosave",function(){o.setTimeout(function(){t()},1500)}):t(),o.setInterval(d,15e3),c("form#post").on("submit.autosave-local",function(){var t=p(),e=c("#post_ID").val()||0;t&&!t.isHidden()?t.on("submit",function(){d({post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""})}):d({post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""});var n="https:"===o.location.protocol;wpCookies.set("wp-saving-post",e+"-check",86400,!1,!1,n)})}),{hasStorage:k,getSavedPostData:v,save:d,suspend:function(){C=!0},resume:function(){C=!1}}),server:(x=0,y=!1,T.on("heartbeat-send.autosave",function(t,e){var n=function(){var t,e;return!(y||m||!o.autosave())&&!((new Date).getTime()<x)&&(e=u(t=a()),void 0===_&&(_=w),e!==_&&(h=e,s(),i(),T.trigger("wpcountwords",[t.content]).trigger("before-autosave",[t]),t._wpnonce=c("#_wpnonce").val()||"",t))}();n&&(e.wp_autosave=n)}).on("heartbeat-tick.autosave",function(t,e){e.wp_autosave&&function(t){r(),m=!1,_=h,h="",T.trigger("after-autosave",[t]),n(),t.success&&c("#auto_draft").val("")}(e.wp_autosave)}).on("heartbeat-connection-lost.autosave",function(t,e,n){if("timeout"===e||603===n){var o=c("#lost-connection-notice");wp.autosave.local.hasStorage||o.find(".hide-if-no-sessionstorage").hide(),o.show(),i()}}).on("heartbeat-connection-restored.autosave",function(){c("#lost-connection-notice").hide(),n()}).ready(function(){r()}),{tempBlockSave:s,triggerSave:function(){x=0,wp.heartbeat.connectNow()},postChanged:function(){return u()!==w},suspend:function(){y=!0},resume:function(){y=!1}})})}(jQuery,window);
\ No newline at end of file