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

1 line
7.2 KiB
JavaScript
Raw Normal View History

var inlineEditPost;window.wp=window.wp||{},function(u,n){inlineEditPost={init:function(){var i=this,t=u("#inline-edit"),e=u("#bulk-edit");i.type=u("table.widefat").hasClass("pages")?"page":"post",i.what="#post-",t.keyup(function(t){if(27===t.which)return inlineEditPost.revert()}),e.keyup(function(t){if(27===t.which)return inlineEditPost.revert()}),u(".cancel",t).click(function(){return inlineEditPost.revert()}),u(".save",t).click(function(){return inlineEditPost.save(this)}),u("td",t).keydown(function(t){if(13===t.which&&!u(t.target).hasClass("cancel"))return inlineEditPost.save(this)}),u(".cancel",e).click(function(){return inlineEditPost.revert()}),u('#inline-edit .inline-edit-private input[value="private"]').click(function(){var t=u("input.inline-edit-password-input");u(this).prop("checked")?t.val("").prop("disabled",!0):t.prop("disabled",!1)}),u("#the-list").on("click","a.editinline",function(t){t.preventDefault(),inlineEditPost.edit(this)}),u("#bulk-edit").find("fieldset:first").after(u("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(u("#inline-edit label.inline-edit-tags").clone()),u('select[name="_status"] option[value="future"]',e).remove(),u("#doaction, #doaction2").click(function(t){var e;i.whichBulkButtonId=u(this).attr("id"),e=i.whichBulkButtonId.substr(2),"edit"===u('select[name="'+e+'"]').val()?(t.preventDefault(),i.setBulk()):0<u("form#posts-filter tr.inline-editor").length&&i.revert()})},toggle:function(t){var e=this;"none"===u(e.what+e.getId(t)).css("display")?e.revert():e.edit(t)},setBulk:function(){var i="",t=this.type,n=!0;if(this.revert(),u("#bulk-edit td").attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("table.widefat tbody").prepend(u("#bulk-edit")).prepend('<tr class="hidden"></tr>'),u("#bulk-edit").addClass("inline-editor").show(),u('tbody th.check-column input[type="checkbox"]').each(function(){var t,e;u(this).prop("checked")&&(n=!1,t=u(this).val(),e=u("#inline_"+t+" .post_title").html()||inlineEditL10n.notitle,i+='<div id="ttle'+t+'"><a id="_'+t+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+e+"</div>")}),n)return this.revert();u("#bulk-titles").html(i),u("#bulk-titles a").click(function(){var t=u(this).attr("id").substr(1);u('table.widefat input[value="'+t+'"]').prop("checked",!1),u("#ttle"+t).remove()}),"post"===t&&u('tr.inline-editor textarea[name="tax_input['+(t="post_tag")+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+t,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma}),u("html, body").animate({scrollTop:0},"fast")},edit:function(a){var t,s,e,i,n,l,o,r,d,c=this,p=!0;for(c.revert(),"object"==typeof a&&(a=c.getId(a)),t=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order"],"page"===c.type&&t.push("post_parent","page_template"),s=u("#inline-edit").clone(!0),u("td",s).attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u(c.what+a).removeClass("is-expanded").hide().after(s).after('<tr class="hidden"></tr>'),e=u("#inline_"+a),u(':input[name="post_author"] option[value="'+u(".post_author",e).text()+'"]',s).val()||u(':input[name="post_author"]',s).prepend('<option value="'+u(".post_author",e).text()+'">'+u("#"+c.type+"-"+a+" .author").text()+"</option>"),1===u(':input[name="post_author"] option',s).length&&u("label.inline-edit-author",s).hide(),r=0;r<t.length;r++)(d=u("."+t[r],e)).find("img").replaceWith(function(){return this.alt}),d=d.text(),u(':input[name="'+t[r]+'"]',s).val(d);if("open"===u(".comment_status",e).text()&&u('input[name="comment_status"]',s).prop("checked",!0),"open"===u(".ping_status",e).text()&&u('input[name="ping_status"]',s).prop("checked",!0),"sticky"===u(".sticky",e).text()&&u('input[name="sticky"]',s).prop("checked",!0),u(".post_category",e).each(function(){var t,e=u(this).text();e&&(t=u(this).attr("id").replace("_"+a,""),u("ul."+t+"-checklist :checkbox",s).val(e.split(",")))}),u(".tags_input",e).each(function(){var t=u(this),e=u(this).attr("id").replace("_"+a,""),i=u