WordPress/wp-admin/js/edit-comments.min.js
Aaron Jorbin 0e21d32900 Build/Test: Bump devDependencies for WordPress 5.3
This upgrades a number of devDependencies.  Some of these include changes to how the tasks are configured.

Uglify: There are deprecated options from 2.x to 4.x, see: https://github.com/gruntjs/grunt-contrib-uglify#options

Autoprefixer: Browserslist now warns when passing in the browser list, so that is put into package.json

As with most changes to uglify, this changes every minified JS file.

Fixes #48203.



Built from https://develop.svn.wordpress.org/trunk@46408


git-svn-id: http://core.svn.wordpress.org/trunk@46206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-05 19:49:10 +00:00

1 line
15 KiB
JavaScript

!function(L){var E,l,I,R,T,m,j,D,s,i,r=document.title,O=L("#dashboard_right_now").length;E=function(t){var e=parseInt(t.html().replace(/[^0-9]+/g,""),10);return isNaN(e)?0:e},l=function(t,e){var n="";if(!isNaN(e)){if(3<(e=e<1?"0":e.toString()).length){for(;3<e.length;)n=thousandsSeparator+e.substr(e.length-3)+n,e=e.substr(0,e.length-3);e+=n}t.html(e)}},T=function(n,t){var e,a,o=".post-com-count-"+t,s="comment-count-no-comments",i="comment-count-approved";I("span.approved-count",n),t&&(e=L("span."+i,o),a=L("span."+s,o),e.each(function(){var t=L(this),e=E(t)+n;e<1&&(e=0),0===e?t.removeClass(i).addClass(s):t.addClass(i).removeClass(s),l(t,e)}),a.each(function(){var t=L(this);0<n?t.removeClass(s).addClass(i):t.addClass(s).removeClass(i),l(t,n)}))},I=function(t,n){L(t).each(function(){var t=L(this),e=E(t)+n;e<1&&(e=0),l(t,e)})},j=function(t){O&&t&&t.i18n_comments_text&&L(".comment-count a","#dashboard_right_now").text(t.i18n_comments_text)},D=function(t){t&&t.i18n_moderation_text&&(L(".comments-in-moderation-text").text(t.i18n_moderation_text),O&&t.in_moderation&&L(".comment-mod-count","#dashboard_right_now")[0<t.in_moderation?"removeClass":"addClass"]("hidden"))},m=function(t){var e,n,a,o;i=i||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),s=s||L("<div />"),e=r,1<=(a=(o=i.exec(document.title))?(o=o[0],s.html(o),E(s)+t):(s.html(0),t))?(l(s,a),(n=i.exec(document.title))&&(e=document.title.replace(n[0],adminCommentsL10n.docTitleCommentsCount.replace("%s",s.text())+" "))):(n=i.exec(e))&&(e=e.replace(n[0],adminCommentsL10n.docTitleComments)),document.title=e},R=function(n,t){var e,a,o=".post-com-count-"+t,s="comment-count-no-pending",i="post-com-count-no-pending",r="comment-count-pending";O||m(n),L("span.pending-count").each(function(){var t=L(this),e=E(t)+n;e<1&&(e=0),t.closest(".awaiting-mod")[0===e?"addClass":"removeClass"]("count-0"),l(t,e)}),t&&(e=L("span."+r,o),a=L("span."+s,o),e.each(function(){var t=L(this),e=E(t)+n;e<1&&(e=0),0===e?(t.parent().addClass(i),t.removeClass(r).addClass(s)):(t.parent().removeClass(i),t.addClass(r).removeClass(s)),l(t,e)}),a.each(function(){var t=L(this);0<n?(t.parent().removeClass(i),t.removeClass(s).addClass(r)):(t.parent().addClass(i),t.addClass(s).removeClass(r)),l(t,n)}))},window.setCommentsList=function(){var w,p,c,t,e,x,n,b,r,k=0;w=L('input[name="_total"]',"#comments-form"),p=L('input[name="_per_page"]',"#comments-form"),c=L('input[name="_page"]',"#comments-form"),x=function(t,e,n){e<k||(n&&(k=e),w.val(t.toString()))},t=function(t,e){var n,a,o,s,i=L("#"+e.element);!0!==e.parsed&&(s=e.parsed.responses[0]),n=L("#replyrow"),a=L("#comment_ID",n).val(),o=L("#replybtn",n),i.is(".unapproved")?(e.data.id==a&&o.text(adminCommentsL10n.replyApprove),i.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")):(e.data.id==a&&o.text(adminCommentsL10n.reply),i.find(".row-actions span.view").removeClass("hidden").end().find("div.comment_status").html("1")),r=L("#"+e.element).is("."+e.dimClass)?1:-1,s?(j(s.supplemental),D(s.supplemental),R(r,s.supplemental.postId),T(-1*r,s.supplemental.postId)):(R(r),T(-1*r))},e=function(t,e){var n,a,o,s,i,r,l,m=!1,d=L(t.target).attr("data-wp-lists");return t.data._total=w.val()||0,t.data._per_page=p.val()||0,t.data._page=c.val()||0,t.data._url=document.location.href,t.data.comment_status=L('input[name="comment_status"]',"#comments-form").val(),-1!=d.indexOf(":trash=1")?m="trash":-1!=d.indexOf(":spam=1")&&(m="spam"),m&&(a=d.replace(/.*?comment-([0-9]+).*/,"$1"),o=L("#comment-"+a),n=L("#"+m+"-undo-holder").html(),o.find(".check-column :checkbox").prop("checked",!1),o.siblings("#replyrow").length&&commentReply.cid==a&&commentReply.close(),i=o.is("tr")?(s=o.children(":visible").length,l=L(".author strong",o).text(),L('<tr id="undo-'+a+'" class="undo un'+m+'" style="display:none;"><td colspan="'+s+'">'+n+"</td></tr>")):(l=L(".comment-author",o).text(),L('<div id="undo-'+a+'" style="display:none;" class="undo un'+m+'">'+n+"</div>")),o.before(i),L("strong","#undo-"+a).text(l),(r=L(".undo a","#undo-"+a)).attr("href","comment.php?action=un"+m+"comment&c="+a+"&_wpnonce="+t.data._ajax_nonce),r.attr("data-wp-lists","delete:the-comment-list:comment-"+a+"::un"+m+"=1"),r.attr("class","vim-z vim-destructive aria-button-if-js"),L(".avatar",o).first().clone().prependTo("#undo-"+a+" ."+m+"-undo-inside"),r.click(function(t){t.preventDefault(),t.stopPropagation(),e.wpList.del(this),L("#undo-"+a).css({backgroundColor:"#ceb"}).fadeOut(350,function(){L(this).remove(),L("#comment-"+a).css("backgroundColor","").fadeIn(300,function(){L(this).show()})})})),t},n=function(t,e){var n,a,o,s,i,r,l,m,d=!0===e.parsed?{}:e.parsed.responses[0],p=!0===e.parsed?"":d.supplemental.status,c=!0===e.parsed?"":d.supplemental.postId,u=!0===e.parsed?"":d.supplemental,h=L(e.target).parent(),f=L("#"+e.element),v=f.hasClass("approved")&&!f.hasClass("unapproved"),g=f.hasClass("unapproved"),C=f.hasClass("spam"),_=f.hasClass("trash"),y=!1;j(u),D(u),h.is("span.undo")?(h.hasClass("unspam")?(i=-1,"trash"===p?r=1:"1"===p?m=1:"0"===p&&(l=1)):h.hasClass("untrash")&&(r=-1,"spam"===p?i=1:"1"===p?m=1:"0"===p&&(l=1)),y=!0):h.is("span.spam")?(v?m=-1:g?l=-1:_&&(r=-1),i=1):h.is("span.unspam")?(v?l=1:g?m=1:_?h.hasClass("approve")?m=1:h.hasClass("unapprove")&&(l=1):C&&(h.hasClass("approve")?m=1:h.hasClass("unapprove")&&(l=1)),i=-1):h.is("span.trash")?(v?m=-1:g?l=-1:C&&(i=-1),r=1):h.is("span.untrash")?(v?l=1:g?m=1:_&&(h.hasClass("approve")?m=1:h.hasClass("unapprove")&&(l=1)),r=-1):h.is("span.approve:not(.unspam):not(.untrash)")?l=-(m=1):h.is("span.unapprove:not(.unspam):not(.untrash)")?(m=-1,l=1):h.is("span.delete")&&(C?i=-1:_&&(r=-1)),l&&(R(l,c),I("span.all-count",l)),m&&(T(m,c),I("span.all-count",m)),i&&I("span.spam-count",i),r&&I("span.trash-count",r),("trash"===e.data.comment_status&&!E(L("span.trash-count"))||"spam"===e.data.comment_status&&!E(L("span.spam-count")))&&L("#delete_all").hide(),O||(a=w.val()?parseInt(w.val(),10):0,L(e.target).parent().is("span.undo")?a++:a--,a<0&&(a=0),"object"==typeof t?d.supplemental.total_items_i18n&&k<d.supplemental.time?((n=d.supplemental.total_items_i18n||"")&&(L(".displaying-num").text(n.replace("&nbsp;",String.fromCharCode(160))),L(".total-pages").text(d.supplemental.total_pages_i18n.replace("&nbsp;",String.fromCharCode(160))),L(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",d.supplemental.total_pages==L(".current-page").val())),x(a,d.supplemental.time,!0)):d.supplemental.time&&x(a,d.supplemental.time,!1):x(a,t,!1)),theExtraList&&0!==theExtraList.length&&0!==theExtraList.children().length&&!y&&(theList.get(0).wpList.add(theExtraList.children(":eq(0):not(.no-items)").remove().clone()),b(),s=function(){L("#the-comment-list tr:visible").length||theList.get(0).wpList.add(theExtraList.find(".no-items").clone())},(o=L(":animated","#the-comment-list")).length?o.promise().done(s):s())},b=function(t){var e=L.query.get(),n=L(".total-pages").text(),a=L('input[name="_per_page"]',"#comments-form").val();e.paged||(e.paged=1),e.paged>n||(t?(theExtraList.empty(),e.number=Math.min(8,a)):(e.number=1,e.offset=Math.min(8,a)-1),e.no_placeholder=!0,e.paged++,!0===e.comment_type&&(e.comment_type=""),e=L.extend(e,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:L("#_ajax_fetch_list_nonce").val()}),L.ajax({url:ajaxurl,global:!1,dataType:"json",data:e,success:function(t){theExtraList.get(0).wpList.add(t.rows)}}))},window.theExtraList=L("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),window.theList=L("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:t,delAfter:n,addColor:"none"}).bind("wpListDelEnd",function(t,e){var n=L(e.target).attr("data-wp-lists"),a=e.element.replace(/[^0-9]+/g,"");-1==n.indexOf(":trash=1")&&-1==n.indexOf(":spam=1")||L("#undo-"+a).fadeIn(300,function(){L(this).show()})})},window.commentReply={cid:"",act:"",originalContent:"",init:function(){var t=L("#replyrow");L(".cancel",t).click(function(){return commentReply.revert()}),L(".save",t).click(function(){return commentReply.send()}),L("input#author-name, input#author-email, input#author-url",t).keypress(function(t){if(13==t.which)return commentReply.send(),t.preventDefault(),!1}),L("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(L(this).parent())}),L("#doaction, #doaction2, #post-query-submit").click(function(){0<L("#the-comment-list #replyrow").length&&commentReply.close()}),this.comments_listing=L('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(t){t.each(function(){L(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(L(this).parent())})})},toggle:function(t){"none"!==L(t).css("display")&&(L("#replyrow").parent().is("#com-reply")||window.confirm(adminCommentsL10n.warnQuickEdit))&&L(t).find("button.vim-q").click()},revert:function(){if(L("#the-comment-list #replyrow").length<1)return!1;L("#replyrow").fadeOut("fast",function(){commentReply.close()})},close:function(){var t=L(),e=L("#replyrow");e.parent().is("#com-reply")||(this.cid&&(t=L("#comment-"+this.cid)),"edit-comment"===this.act&&t.fadeIn(300,function(){t.show().find(".vim-q").attr("aria-expanded","false").focus()}).css("backgroundColor",""),"replyto-comment"===this.act&&t.find(".vim-r").attr("aria-expanded","false").focus(),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),L("#add-new-comment").css("display",""),e.hide(),L("#com-reply").append(e),L("#replycontent").css("height","").val(""),L("#edithead input").val(""),L(".notice-error",e).addClass("hidden").find(".error").empty(),L(".spinner",e).removeClass("is-active"),this.cid="",this.originalContent="")},open:function(t,e,n){var a,o,s,i,r,l,m=L("#comment-"+t),d=m.height();return this.discardCommentChanges()&&(this.close(),this.cid=t,a=L("#replyrow"),o=L("#inline-"+t),s="edit"==(n=n||"replyto")?"edit":"replyto",s=this.act=s+"-comment",this.originalContent=L("textarea.comment",o).val(),l=L("> th:visible, > td:visible",m).length,a.hasClass("inline-edit-row")&&0!==l&&L("td",a).attr("colspan",l),L("#action",a).val(s),L("#comment_post_ID",a).val(e),L("#comment_ID",a).val(t),"edit"==n?(L("#author-name",a).val(L("div.author",o).text()),L("#author-email",a).val(L("div.author-email",o).text()),L("#author-url",a).val(L("div.author-url",o).text()),L("#status",a).val(L("div.comment_status",o).text()),L("#replycontent",a).val(L("textarea.comment",o).val()),L("#edithead, #editlegend, #savebtn",a).show(),L("#replyhead, #replybtn, #addhead, #addbtn",a).hide(),120<d&&(r=500<d?500:d,L("#replycontent",a).css("height",r+"px")),m.after(a).fadeOut("fast",function(){L("#replyrow").fadeIn(300,function(){L(this).show()})})):"add"==n?(L("#addhead, #addbtn",a).show(),L("#replyhead, #replybtn, #edithead, #editlegend, #savebtn",a).hide(),L("#the-comment-list").prepend(a),L("#replyrow").fadeIn(300)):(i=L("#replybtn",a),L("#edithead, #editlegend, #savebtn, #addhead, #addbtn",a).hide(),L("#replyhead, #replybtn",a).show(),m.after(a),m.hasClass("unapproved")?i.text(adminCommentsL10n.replyApprove):i.text(adminCommentsL10n.reply),L("#replyrow").fadeIn(300,function(){L(this).show()})),setTimeout(function(){var t,e,n,a;e=(t=L("#replyrow").offset().top)+L("#replyrow").height(),(n=window.pageYOffset||document.documentElement.scrollTop)+(a=document.documentElement.clientHeight||window.innerHeight||0)-20<e?window.scroll(0,e-a+35):t-20<n&&window.scroll(0,t-35),L("#replycontent").focus().keyup(function(t){27==t.which&&commentReply.revert()})},600)),!1},send:function(){var e={};L("#replysubmit .error-notice").addClass("hidden"),L("#replysubmit .spinner").addClass("is-active"),L("#replyrow input").not(":button").each(function(){var t=L(this);e[t.attr("name")]=t.val()}),e.content=L("#replycontent").val(),e.id=e.comment_post_ID,e.comments_listing=this.comments_listing,e.p=L('[name="p"]').val(),L("#comment-"+L("#comment_ID").val()).hasClass("unapproved")&&(e.approve_parent=1),L.ajax({type:"POST",url:ajaxurl,data:e,success:function(t){commentReply.show(t)},error:function(t){commentReply.error(t)}})},show:function(t){var e,n,a,o,s,i=this;return"string"==typeof t?(i.error({responseText:t}),!1):(e=wpAjax.parseAjaxResponse(t)).errors?(i.error({responseText:wpAjax.broken}),!1):(i.revert(),a="#comment-"+(e=e.responses[0]).id,"edit-comment"==i.act&&L(a).remove(),void(e.supplemental.parent_approved&&(s=L("#comment-"+e.supplemental.parent_approved),R(-1,e.supplemental.parent_post_id),"moderated"==this.comments_listing)?s.animate({backgroundColor:"#CCEEBB"},400,function(){s.fadeOut()}):(e.supplemental.i18n_comments_text&&(j(e.supplemental),D(e.supplemental),T(1,e.supplemental.parent_post_id),I("span.all-count",1)),n=L.trim(e.data),L(n).hide(),L("#replyrow").after(n),a=L(a),i.addEvents(a),o=a.hasClass("unapproved")?"#FFFFE0":a.closest(".widefat, .postbox").css("backgroundColor"),a.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:o},300,function(){s&&s.length&&s.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:o},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}))))},error:function(t){var e=t.statusText,n=L("#replysubmit .notice-error"),a=n.find(".error");L("#replysubmit .spinner").removeClass("is-active"),t.responseText&&(e=t.responseText.replace(/<.[^<>]*?>/g,"")),e&&(n.removeClass("hidden"),a.html(e))},addcomment:function(t){var e=this;L("#add-new-comment").fadeOut(200,function(){e.open(0,t,"add"),L("table.comments-box").css("display",""),L("#no-comments").remove()})},discardCommentChanges:function(){var t=L("#replyrow");return this.originalContent===L("#replycontent",t).val()||window.confirm(adminCommentsL10n.warnCommentChanges)}},L(document).ready(function(){var t,e,n,a;setCommentsList(),commentReply.init(),L(document).on("click","span.delete a.delete",function(t){t.preventDefault()}),void 0!==L.table_hotkeys&&(t=function(n){return function(){var t,e;t="next"==n?"first":"last",(e=L(".tablenav-pages ."+n+"-page:not(.disabled)")).length&&(window.location=e[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+t+"=1")}},e=function(t,e){window.location=L("span.edit a",e).attr("href")},n=function(){L("#cb-select-all-1").data("wp-toggle",1).trigger("click").removeData("wp-toggle")},a=function(e){return function(){var t=L('select[name="action"]');L('option[value="'+e+'"]',t).prop("selected",!0),L("#doaction").click()}},L.table_hotkeys(L("table.widefat"),["a","u","s","d","r","q","z",["e",e],["shift+x",n],["shift+a",a("approve")],["shift+s",a("spam")],["shift+d",a("delete")],["shift+t",a("trash")],["shift+z",a("untrash")],["shift+u",a("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:t("prev"),next_page_link_cb:t("next"),hotkeys_opts:{disableInInput:!0,type:"keypress",noDisable:'.check-column input[type="checkbox"]'},cycle_expr:"#the-comment-list tr",start_row_index:0})),L("#the-comment-list").on("click",".comment-inline",function(){var t=L(this),e="replyto";void 0!==t.data("action")&&(e=t.data("action")),L(this).attr("aria-expanded","true"),commentReply.open(t.data("commentId"),t.data("postId"),e)})})}(jQuery);