WordPress/wp-admin/js/post.min.js

1 line
17 KiB
JavaScript
Raw Normal View History

var commentsBox,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail,wptitlehint,editPermalink,makeSlugeditClickable=editPermalink=function(){};window.wp=window.wp||{},function(a){var t=!1;commentsBox={st:0,get:function(t,e){var i=this.st;return e=e||20,this.st+=e,this.total=t,a("#commentsdiv .spinner").addClass("is-active"),e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),p:a("#post_ID").val(),start:i,number:e},a.post(ajaxurl,e,function(t){return t=wpAjax.parseAjaxResponse(t),a("#commentsdiv .widefat").show(),a("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof t&&t.responses[0]?(a("#the-comment-list").append(t.responses[0].data),theList=theExtraList=null,a("a[className*=':']").unbind(),void(commentsBox.st>commentsBox.total?a("#show-comments").hide():a("#show-comments").show().children("a").html(postL10n.showcomm))):void(1!=t?a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>"):a("#show-comments").html(postL10n.endcomm))}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},WPSetThumbnailHTML=function(t){a(".inside","#postimagediv").html(t)},WPSetThumbnailID=function(t){var e=a('input[value="_thumbnail_id"]',"#list-table");0<e.length&&a("#meta\\["+e.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(t)},WPRemoveThumbnail=function(t){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:t,cookie:encodeURIComponent(document.cookie)},function(t){"0"==t?alert(setPostThumbnailL10n.error):WPSetThumbnailHTML(t)})},a(document).on("heartbeat-send.refresh-lock",function(t,e){var i=a("#active_post_lock").val(),s=a("#post_ID").val(),n={};s&&a("#post-lock-dialog").length&&(n.post_id=s,i&&(n.lock=i),e["wp-refresh-post-lock"]=n)}).on("heartbeat-tick.refresh-lock",function(t,e){var i,s;e["wp-refresh-post-lock"]&&((i=e["wp-refresh-post-lock"]).lock_error?(s=a("#post-lock-dialog")).length&&!s.is(":visible")&&(wp.autosave&&(a(document).one("heartbeat-tick",function(){wp.autosave.server.suspend(),s.removeClass("saving").addClass("saved"),a(window).off("beforeunload.edit-post")}),s.addClass("saving"),wp.autosave.server.triggerSave()),i.lock_error.avatar_src&&(e=a('<img class="avatar avatar-64 photo" width="64" height="64" alt="" />').attr("src",i.lock_error.avatar_src.replace(/&amp;/g,"&")),s.find("div.post-locked-avatar").empty().append(e)),s.show().find(".currently-editing").text(i.lock_error.text),s.find(".wp-tab-first").focus()):i.new_lock&&a("#active_post_lock").val(i.new_lock))}).on("before-autosave.update-post-slug",function(){t=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){a("#edit-slug-box > *").length||t||a.post(ajaxurl,{action:"sample-permalink",post_id:a("#post_ID").val(),new_title:a("#title").val(),samplepermalinknonce:a("#samplepermalinknonce").val()},function(t){"-1"!=t&&a("#edit-slug-box").html(t)})})}(jQuery),function(n){var a,t;function i(){a=!1,window.clearTimeout(t),t=window.setTimeout(function(){a=!0},3e5)}n(document).on("heartbeat-send.wp-refresh-nonces",function(t,e){var i,s=n("#wp-auth-check-wrap");(a||s.length&&!s.hasClass("hidden"))&&(i=n("#post_ID").val())&&n("#_wpnonce").val()&&(e["wp-refresh-post-nonces"]={post_id:i})}).on("heartbeat-tick.wp-refresh-nonces",function(t,e){e=e["wp-refresh-post-nonces"];e&&(i(),e.replace&&n.each(e.replace,function(t,e){n("#"+t).val(e)}),e.heartbeatNonce&&(window.heartbeatSettings.nonce=e.heartbeatNonce))}).ready(function(){i()})}(jQuery),jQuery(document).ready(function(u){var d,e,i,s,n,a,o,l,t,c,p,r="",h=u("#content"),f=u(document),v=u("#post_ID").val()||0,m=u("#submitpost"),w=!0,b=u("#post-visibility-select"),g=u("#timestampdiv"),k=u("#post-status-select"),y=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac");function _(t){c.hasClass("wp-editor-expand")||(l?a.theme.resizeTo(null,o+t.pageY):h.height(Math.max(50,o+t.pageY)),t.preventDefault())}function x(){var t;c.hasClass("wp-editor-expand")||(t=l?(a.focus(),((t=parseInt(u("#wp-con