mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 15:16:29 +01:00
80be8c138d
Core does not use the jQuery.suggest plugin since [38797]. Props afercia, hareesh-pillai, garrett-eclipse. Fixes #40260. Built from https://develop.svn.wordpress.org/trunk@49213 git-svn-id: http://core.svn.wordpress.org/trunk@48975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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,o,r,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(o=n[0].className.split("-")[1],r=n;u&&0!==(r=r.next("option")).length;)r[0].className.split("-")[1]<=o?u=!1:(r.remove(),r=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"),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"),"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 o=e["wp-check-locked-posts"]||{};h("#the-list tr").each(function(t,e){var i,n,a=e.id,s=h(e);o.hasOwnProperty(a)?s.hasClass("wp-locked")||(i=o[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); |