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

1 line
7.1 KiB
JavaScript
Raw Normal View History

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