WordPress/wp-admin/js/edit-comments.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

var setCommentsList,theList,theExtraList,commentReply;!function(C){var o,s,i=document.title,w=C("#dashboard_right_now").length,r=function(t){t=parseInt(t.html().replace(/[^0-9]+/g,""),10);return isNaN(t)?0:t},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)}},x=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-comments",o="comment-count-approved";b("span.approved-count",n),t&&(t=C("span."+o,e),e=C("span."+a,e),t.each(function(){var t=C(this),e=r(t)+n;0===(e=e<1?0:e)?t.removeClass(o).addClass(a):t.addClass(o).removeClass(a),l(t,e)}),e.each(function(){var t=C(this);0<n?t.removeClass(a).addClass(o):t.addClass(a).removeClass(o),l(t,n)}))},b=function(t,n){C(t).each(function(){var t=C(this),e=r(t)+n;l(t,e=e<1?0:e)})},k=function(t){var e;w&&t&&t.i18n_comments_text&&(e=C("#dashboard_right_now"),C(".comment-count a",e).text(t.i18n_comments_text),C(".comment-mod-count a",e).text(t.i18n_moderation_text).parent()[0<t.in_moderation?"removeClass":"addClass"]("hidden"))},m=function(t){var e,n,a;s=s||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),o=o||C("<div />"),e=i,1<=(t=(a=s.exec(document.title))?(a=a[0],o.html(a),r(o)+t):(o.html(0),t))?(l(o,t),(n=s.exec(document.title))&&(e=document.title.replace(n[0],adminCommentsL10n.docTitleCommentsCount.replace("%s",o.text())+" "))):(n=s.exec(e))&&(e=e.replace(n[0],adminCommentsL10n.docTitleComments)),document.title=e},L=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-pending",o="post-com-count-no-pending",s="comment-count-pending";w||m(n),C("span.pending-count").each(function(){var t=C(this),e=r(t)+n;e<1&&(e=0),t.closest(".awaiting-mod")[0===e?"addClass":"removeClass"]("count-0"),l(t,e)}),t&&(t=C("span."+s,e),e=C("span."+a,e),t.each(function(){var t=C(this),e=r(t)+n;0===(e=e<1?0:e)?(t.parent().addClass(o),t.removeClass(s).addClass(a)):(t.parent().removeClass(o),t.addClass(s).removeClass(a)),l(t,e)}),e.each(function(){var t=C(this);0<n?(t.parent().removeClass(o),t.removeClass(a).addClass(s)):(t.parent().addClass(o),t.addClass(a).removeClass(s)),l(t,n)}))};setCommentsList=function(){var i,f=0,g=C('input[name="_total"]',"#comments-form"),l=C('input[name="_per_page"]',"#comments-form"),m=C('input[name="_page"]',"#comments-form"),y=function(t,e,n){e<f||(n&&(f=e),g.val(t.toString()))},t=function(t,e){var n,a,o,s=C("#"+e.element);!0!==e.parsed&&(o=e.parsed.responses[0]),a=C("#replyrow"),n=C("#comment_ID",a).val(),a=C("#replybtn",a),s.is(".unapproved")?(e.data.id==n&&a.text(adminCommentsL10n.replyApprove),s.find("div.comment_status").html("0")):(e.data.id==n&&a.text(adminCommentsL10n.reply),s.find("div.comment_status").html("1")),i=C("#"+e.element).is("."+e.dimClass)?1:-1,o?(k(o.supplemental),L(i,o.supplemental.postId),x(-1*i,o.supplemental.postId)):(L(i),x(-1*i))},e=function(t,e){var n,a,o,s,i=!1,r=C(t.target).attr("data-wp-lists");return t.data._total=g.val()||0,t.data._per_page=l.val()||0,t.data._page=m.val()||0,t.data._url=document.location.href,t.data.comment_status=C('input[name="comment_status"]',"#comments-form").val(),-1!=r.indexOf(":trash=1")?i="trash":-1!=r.indexOf(":spam=1")&&(i="spam"),i&&(n=r.replace(/.*?comment-([0-9]+).*/,"$1"),a=C("#comment-"+n),o=C("#"+i+"-undo-holder").html(),a.find(".check-column :checkbox").prop("checked",!1),a.siblings("#replyrow").length&&commentReply.cid==n&&commentReply.close(),o=a.is("tr")?(r=a.children(":visible").length,s=C(".author strong",a).text(),C('<tr id="undo-'+n+'" class="undo un'+i+'" style="display:none;"><td colspan="'+r+'">'+o+"</td></tr>")):(s=C(".comment-author",a).text(),C('<div id="undo-'+n+'" style="display:none;" class="undo un'+i+'">'+o+"</div>")),a.before(o),C("strong","#undo-"+n).text(s),(s=C(".undo a","#undo-"+n)).attr("href","comment.php?action=un"+i+"comment&c="+n+"&_wpnonce="+t.data._ajax_nonce),s.attr("data-wp-lists","delete:the-comment-list:comment-"+n+"::un"+i+"=1"),s.attr("class","vim-z vim-destructive"),C(".avatar",a)