WordPress/wp-admin/js/inline-edit-post.min.js
desrosj e3353e0860 Build/Test Tools: Support NodeJS 14.x in the 4.2 branch.
This updates the 4.2 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.

Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401).

This change also introduces a `packager-lock.json` file to the branch.

In addition to backporting the package updates that happened after branching 4.2, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [32356-32357,32988,33726,34888,35335,35363,35513,35521,35538-35541,35859,36861-36865,36935,36979,37017,37019-37020,37212,37612,38111,39110,39113,39115-39119,39478,41835,42460,42461,42463,42887,43320,43323,43977,44219,44233,45321,45765,46404,46408-46409,47404,47867,47872-47873,48705,49636,49933,49937,49939,50126,50176,50185] to the 4.2 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.2@50214


git-svn-id: http://core.svn.wordpress.org/branches/4.2@49883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:28:43 +00:00

1 line
6.9 KiB
JavaScript

var inlineEditPost;!function(u){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("a.cancel",t).click(function(){return inlineEditPost.revert()}),u("a.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("a.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(){return inlineEditPost.edit(this),!1}),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=u(this).attr("id").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(".widefat:first thead th:visible").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,r,o,d,p=this,c=!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"===p.type&&t.push("post_parent","page_template"),s=u("#inline-edit").clone(!0),u("td",s).attr("colspan",u(".widefat:first thead th:visible").length),u(p.what+a).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("#"+p.type+"-"+a+" .author").text()+"</option>"),1===u(':input[name="post_author"] option',s).length&&u("label.inline-edit-author",s).hide(),r=u(".post_format",e).text(),u("option.unsupported",s).each(function(){var t=u(this);t.val()!==r&&t.remove()}),o=0;o<t.length;o++)(d=u("."+t[o],e)).find("img").replaceWith(function(){return this.alt}),d=d.text(),u(':input[name="'+t[o]+'"]',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("textarea.tax_input_"+e,s),n=inlineEditL10n.comma;t.find("img").replaceWith(function(){return this.alt}),(t=t.text())&&(","!==n&&(t=t.replace(/,/g,n)),i.val(t)),i.suggest(ajaxurl+"?action=ajax-tag-search&tax="+e,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),"future"!==(p=u("._status",e).text())&&u('select[name="_status"] option[value="future"]',s).remove(),"private"===p&&(u('input[name="keep_private"]',s).prop("checked",!0),u("input.inline-edit-password-input").val("").prop("disabled",!0)),0<(i=u('select[name="post_parent"] option[value="'+a+'"]',s)).length){for(n=i[0].className.split("-")[1],l=i;c&&0!==(l=l.next("option")).length;)l[0].className.split("-")[1]<=n?c=!1:(l.remove(),l=i);i.remove()}return u(s).attr("id","edit-"+a).addClass("inline-editor").show(),u(".ptitle",s).focus(),!1},save:function(e){var t=u(".post_status_page").val()||"";return"object"==typeof e&&(e=this.getId(e)),u("table.widefat .spinner").addClass("is-active"),t={action:"inline-save",post_type:typenow,post_ID:e,edit_date:"true",post_status:t},t=u("#edit-"+e).find(":input").serialize()+"&"+u.param(t),u.post(ajaxurl,t,function(t){u("table.widefat .spinner").removeClass("is-active"),t?-1!==t.indexOf("<tr")?(u(inlineEditPost.what+e).siblings("tr.hidden").addBack().remove(),u("#edit-"+e).before(t).remove(),u(inlineEditPost.what+e).hide().fadeIn()):(t=t.replace(/<.[^<>]*?>/g,""),u("#edit-"+e+" .inline-edit-save .error").html(t).show()):u("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()},"html"),!1},revert:function(){var t=u("table.widefat tr.inline-editor").attr("id");return t&&(u("table.widefat .spinner").removeClass("is-active"),"bulk-edit"===t?(u("table.widefat #bulk-edit").removeClass("inline-editor").hide().siblings("tr.hidden").remove(),u("#bulk-titles").empty(),u("#inlineedit").append(u("#bulk-edit"))):(u("#"+t).siblings("tr.hidden").addBack().remove(),t=t.substr(t.lastIndexOf("-")+1),u(this.what+t).show())),!1},getId:function(t){t=u(t).closest("tr").attr("id").split("-");return t[t.length-1]}},u(document).ready(function(){inlineEditPost.init()}),u(document).on("heartbeat-tick.wp-check-locked-posts",function(t,e){var n=e["wp-check-locked-posts"]||{};u("#the-list tr").each(function(t,e){var i=e.id,e=u(e);n.hasOwnProperty(i)?e.hasClass("wp-locked")||(i=n[i],e.find(".column-title .locked-text").text(i.text),e.find(".check-column checkbox").prop("checked",!1),i.avatar_src&&(i=u('<img class="avatar avatar-18 photo" width="18" height="18" />').attr("src",i.avatar_src.replace(/&amp;/g,"&")),e.find(".column-title .locked-avatar").empty().append(i)),e.addClass("wp-locked")):e.hasClass("wp-locked")&&e.removeClass("wp-locked").delay(1e3).find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(t,e){var i=[];u("#the-list tr").each(function(t,e){e.id&&i.push(e.id)}),i.length&&(e["wp-check-locked-posts"]=i)}).ready(function(){"undefined"!=typeof wp&&wp.heartbeat&&wp.heartbeat.interval(15)})}(jQuery);