aboutsummaryrefslogtreecommitdiff
path: root/srcs/wordpress/wp-admin/js/edit-comments.min.js
blob: e69c9a0b28e08ee8c2f26c98e13a981cc9ce6e08 (plain)
1
!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"===<