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

1 line
15 KiB
JavaScript
Raw Permalink Normal View History

!function(y){var o,s,i=document.title,w=y("#dashboard_right_now").length,x=function(t){t=parseInt(t.html().replace(/[^0-9]+/g,""),10);return isNaN(t)?0:t},r=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)}},b=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-comments",o="comment-count-approved";k("span.approved-count",n),t&&(t=y("span."+o,e),e=y("span."+a,e),t.each(function(){var t=y(this),e=x(t)+n;0===(e=e<1?0:e)?t.removeClass(o).addClass(a):t.addClass(o).removeClass(a),r(t,e)}),e.each(function(){var t=y(this);0<n?t.removeClass(a).addClass(o):t.addClass(a).removeClass(o),r(t,n)}))},k=function(t,n){y(t).each(function(){var t=y(this),e=x(t)+n;r(t,e=e<1?0:e)})},L=function(t){w&&t&&t.i18n_comments_text&&y(".comment-count a","#dashboard_right_now").text(t.i18n_comments_text)},E=function(t){t&&t.i18n_moderation_text&&(y(".comments-in-moderation-text").text(t.i18n_moderation_text),w&&t.in_moderation&&y(".comment-mod-count","#dashboard_right_now")[0<t.in_moderation?"removeClass":"addClass"]("hidden"))},l=function(t){var e,n,a;s=s||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),o=o||y("<div />"),e=i,1<=(t=(a=s.exec(document.title))?(a=a[0],o.html(a),x(o)+t):(o.html(0),t))?(r(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},I=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||l(n),y("span.pending-count").each(function(){var t=y(this),e=x(t)+n;e<1&&(e=0),t.closest(".awaiting-mod")[0===e?"addClass":"removeClass"]("count-0"),r(t,e)}),t&&(t=y("span."+s,e),e=y("span."+a,e),t.each(function(){var t=y(this),e=x(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)),r(t,e)}),e.each(function(){var t=y(this);0<n?(t.parent().removeClass(o),t.removeClass(a).addClass(s)):(t.parent().addClass(o),t.addClass(a).removeClass(s)),r(t,n)}))};window.setCommentsList=function(){var i,v=0,g=y('input[name="_total"]',"#comments-form"),l=y('input[name="_per_page"]',"#comments-form"),m=y('input[name="_page"]',"#comments-form"),_=function(t,e,n){e<v||(n&&(v=e),g.val(t.toString()))},t=function(t,e){var n,a,o,s=y("#"+e.element);!0!==e.parsed&&(o=e.parsed.responses[0]),a=y("#replyrow"),n=y("#comment_ID",a).val(),a=y("#replybtn",a),s.is(".unapproved")?(e.data.id==n&&a.text(adminCommentsL10n.replyApprove),s.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")):(e.data.id==n&&a.text(adminCommentsL10n.reply),s.find(".row-actions span.view").removeClass("hidden").end().find("div.comment_status").html("1")),i=y("#"+e.element).is("."+e.dimClass)?1:-1,o?(L(o.supplemental),E(o.supplemental),I(i,o.supplemental.postId),b(-1*i,o.supplemental.postId)):(I(i),b(-1*i))},e=function(t,e){var n,a,o,s,i=!1,r=y(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=y('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=y("#comment-"+n),o=y("#"+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=y(".author strong",a).text(),y('<tr id="undo-'+n+'" class="undo un'+i+'" style="display:none;"><td colspan="'+r+'">'+o+"</td></tr>")):(s=y(".comment-author",a).text(),y('<div id="undo-'+n+'" style="display:none;" class="undo un'+i+'">'+o+"</div>")),a.before(o),y("strong","#undo-"+n).text(s),(s=y(".undo a","#undo-"+n)).attr("href","comment.php?action=un"+