2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
/*! This file is auto-generated */
|
|
window.wp=window.wp||{},function(h,v){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()||v.i18n.__("(no title)"),i+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+v.i18n.__("Remove From Bulk Edit")+'">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,r,o,l,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(),l=0;l<t.length;l++)(d=h("."+t[l],e)).find("img").replaceWith(function(){return this.alt}),d=d.text(),h(':input[name="'+t[l]+'"]',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=v.i18n._x(",","tag delimiter").trim();t.find("img").replaceWith(function(){return this.alt}),(t=t.text())&&(","!==n&&(t=t.replace(/,/g,n)),i.val(t)),i.wpTagsSuggest()}),"future"!==(i=h("._status",e).text())&&h('select[name="_status"] option[value="future"]',s).remove(),c=h(".inline-edit-password-input").prop("disabled",!1),"private"===i&&(h('input[name="keep_private"]',s).prop("checked",!0),c.val("").prop("disabled",!0)),0<(n=h('select[name="post_parent"] option[value="'+a+'"]',s)).length){for(r=n[0].className.split("-")[1],o=n;u&&0!==(o=o.next("option")).length;)o[0].className.split("-")[1]<=r?u=!1:(o.remove(),o=n);n.remove()}return h(s).attr("id","edit-"+a).addClass("inline-editor").show(),h(".ptitle",s).focus(),!1},save:function(n){var t,e=h(".post_status_page").val()||"";return"object"==typeof n&&(n=this.getId(n)),h("table.widefat .spinner").addClass("is-active"),t={action:"inline-save",post_type:typenow,post_ID:n,edit_date:"true",post_status:e},t=h("#edit-"+n).find(":input").serialize()+"&"+h.param(t),h.post(ajaxurl,t,function(t){var e=h("#edit-"+n+" .inline-edit-save .notice-error"),i=e.find(".error");h("table.widefat .spinner").removeClass("is-active"),h(".ac_results").hide(),t?-1!==t.indexOf("<tr")?(h(inlineEditPost.what+n).siblings("tr.hidden").addBack().remove(),h("#edit-"+n).before(t).remove(),h(inlineEditPost.what+n).hide().fadeIn(400,function(){h(this).find(".editinline").attr("aria-expanded","false").focus(),v.a11y.speak(v.i18n.__("Changes saved."))})):(t=t.replace(/<.[^<>]*?>/g,""),e.removeClass("hidden"),i.html(t),v.a11y.speak(i.text())):(e.removeClass("hidden"),i.text(v.i18n.__("Error while saving the changes.")),v.a11y.speak(v.i18n.__("Error while saving the changes.")))},"html"),!1},revert:function(){var t=h(".widefat"),e=h(".inline-editor",t).attr("id");return e&&(h(".spinner",t).removeClass("is-active"),h(".ac_results").hide(),"bulk-edit"===e?(h("#bulk-edit",t).removeClass("inline-editor").hide().siblings(".hidden").remove(),h("#bulk-titles").empty(),h("#inlineedit").append(h("#bulk-edit")),h("#"+inlineEditPost.whichBulkButtonId).focus()):(h("#"+e).siblings("tr.hidden").addBack().remove(),e=e.substr(e.lastIndexOf("-")+1),h(this.what+e).show().find(".editinline").attr("aria-expanded","false").focus())),!1},getId:function(t){var e=h(t).closest("tr").attr("id").split("-");return e[e.length-1]}},h(document).ready(function(){inlineEditPost.init()}),h(document).on("heartbeat-tick.wp-check-locked-posts",function(t,e){var r=e["wp-check-locked-posts"]||{};h("#the-list tr").each(function(t,e){var i,n,a=e.id,s=h(e);r.hasOwnProperty(a)?s.hasClass("wp-locked")||(i=r[a],s.find(".column-title .locked-text").text(i.text),s.find(".check-column checkbox").prop("checked",!1),i.avatar_src&&(n=h("<img />",{class:"avatar avatar-18 photo",width:18,height:18,alt:"",src:i.avatar_src,srcset:i.avatar_src_2x?i.avatar_src_2x+" 2x":void 0}),s.find(".column-title .locked-avatar").empty().append(n)),s.addClass("wp-locked")):s.hasClass("wp-locked")&&s.removeClass("wp-locked").find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(t,e){var i=[];h("#the-list tr").each(function(t,e){e.id&&i.push(e.id)}),i.length&&(e["wp-check-locked-posts"]=i)}).ready(function(){void 0!==v&&v.heartbeat&&v.heartbeat.interval(15)})}(jQuery,window.wp); |