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

1 line
15 KiB
JavaScript
Raw Normal View History

!function(a){var b,c,d,e,f,g,h,i,j,k,l=document.title,m=a("#dashboard_right_now").length;b=function(a){var b=parseInt(a.html().replace(/[^0-9]+/g,""),10);return isNaN(b)?0:b},c=function(a,b){var c="";if(!isNaN(b)){if(b=b<1?"0":b.toString(),b.length>3){for(;b.length>3;)c=thousandsSeparator+b.substr(b.length-3)+c,b=b.substr(0,b.length-3);b+=c}a.html(b)}},f=function(e,f){var g,h,i=".post-com-count-"+f,j="comment-count-no-comments",k="comment-count-approved";d("span.approved-count",e),f&&(g=a("span."+k,i),h=a("span."+j,i),g.each(function(){var d=a(this),f=b(d)+e;f<1&&(f=0),0===f?d.removeClass(k).addClass(j):d.addClass(k).removeClass(j),c(d,f)}),h.each(function(){var b=a(this);e>0?b.removeClass(j).addClass(k):b.addClass(j).removeClass(k),c(b,e)}))},d=function(d,e){a(d).each(function(){var d=a(this),f=b(d)+e;f<1&&(f=0),c(d,f)})},h=function(b){m&&b&&b.i18n_comments_text&&a(".comment-count a","#dashboard_right_now").text(b.i18n_comments_text)},i=function(b){b&&b.i18n_moderation_text&&(a(".comments-in-moderation-text").text(b.i18n_moderation_text),m&&b.in_moderation&&a(".comment-mod-count","#dashboard_right_now")[b.in_moderation>0?"removeClass":"addClass"]("hidden"))},g=function(d){var e,f,g,h;k=k||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),j=j||a("<div />"),e=l,h=k.exec(document.title),h?(h=h[0],j.html(h),g=b(j)+d):(j.html(0),g=d),g>=1?(c(j,g),f=k.exec(document.title),f&&(e=document.title.replace(f[0],adminCommentsL10n.docTitleCommentsCount.replace("%s",j.text())+" "))):(f=k.exec(e),f&&(e=e.replace(f[0],adminCommentsL10n.docTitleComments))),document.title=e},e=function(d,e){var f,h,i=".post-com-count-"+e,j="comment-count-no-pending",k="post-com-count-no-pending",l="comment-count-pending";m||g(d),a("span.pending-count").each(function(){var e=a(this),f=b(e)+d;f<1&&(f=0),e.closest(".awaiting-mod")[0===f?"addClass":"removeClass"]("count-0"),c(e,f)}),e&&(f=a("span."+l,i),h=a("span."+j,i),f.each(function(){var e=a(this),f=b(e)+d;f<1&&(f=0),0===f?(e.parent().addClass(k),e.removeClass(l).addClass(j)):(e.parent().removeClass(k),e.addClass(l).removeClass(j)),c(e,f)}),h.each(function(){var b=a(this);d>0?(b.parent().removeClass(k),b.removeClass(j).addClass(l)):(b.parent().addClass(k),b.addClass(j).removeClass(l)),c(b,d)}))},window.setCommentsList=function(){var c,g,j,k,l,n,o,p,q,r=0;c=a('input[name="_total"]',"#comments-form"),g=a('input[name="_per_page"]',"#comments-form"),j=a('input[name="_page"]',"#comments-form"),n=function(a,b,d){b<r||(d&&(r=b),c.val(a.toString()))},k=function(b,c){var d,g,j,k,l=a("#"+c.element);!0!==c.parsed&&(k=c.parsed.responses[0]),d=a("#replyrow"),g=a("#comment_ID",d).val(),j=a("#replybtn",d),l.is(".unapproved")?(c.data.id==g&&j.text(adminCommentsL10n.replyApprove),l.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")):(c.data.id==g&&j.text(adminCommentsL10n.reply),l.find(".row-actions span.view").removeClass("hidden").end().find("div.comment_status").html("1")),q=a("#"+c.element).is("."+c.dimClass)?1:-1,k?(h(k.supplemental),i(k.supplemental),e(q,k.supplemental.postId),f(-1*q,k.supplemental.postId)):(e(q),f(-1*q))},l=function(b,d){var e,f,h,i,k,l,m,n=!1,o=a(b.target).attr("data-wp-lists");return b.data._total=c.val()||0,b.data._per_page=g.val()||0,b.data._page=j.val()||0,b.data._url=document.location.href,b.data.comment_status=a('input[name="comment_status"]',"#comments-form").val(),o.indexOf(":trash=1")!=-1?n="trash":o.indexOf(":spam=1")!=-1&&(n="spam"),n&&(f=o.replace(/.*?comment-([0-9]+).*/,"$1"),h=a("#comment-"+f),e=a("#"+n+"-undo-holder").html(),h.find(".check-column :checkbox").prop("checked",!1),h.siblings("#replyrow").length&&commentReply.cid==f&&commentReply.close(),h.is("tr")?(i=h.children(":visible").length,m=a(".author strong",h).text(),k=a('<tr id="undo-'+f+'" class="undo un'+n+'" style="display:none;"><td colspan="'+i+'">'+e+"</td></tr>")):(m=a(".comment-author",h).text(),k=a('<div id="undo-'+f+'" style="display:none;" class="undo un'+n+'">'+e+"</div>")),h.before(k),a("strong","#undo-"+f).text(m)