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

1 line
14 KiB
JavaScript
Raw Normal View History

var setCommentsList,theList,theExtraList,commentReply;!function(L){var E,l,I,R,T,m,j,o,i,r=document.title,D=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,s=".post-com-count-"+t,o="comment-count-no-comments",i="comment-count-approved";I("span.approved-count",n),t&&(e=L("span."+i,s),a=L("span."+o,s),e.each(function(){var t=L(this),e=E(t)+n;e<1&&(e=0),0===e?t.removeClass(i).addClass(o):t.addClass(i).removeClass(o),l(t,e)}),a.each(function(){var t=L(this);0<n?t.removeClass(o).addClass(i):t.addClass(o).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){if(D&&t&&t.i18n_comments_text){var e=L("#dashboard_right_now");L(".comment-count a",e).text(t.i18n_comments_text),L(".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;i=i||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),o=o||L("<div />"),e=r,1<=(a=(s=i.exec(document.title))?(s=s[0],o.html(s),E(o)+t):(o.html(0),t))?(l(o,a),(n=i.exec(document.title))&&(e=document.title.replace(n[0],adminCommentsL10n.docTitleCommentsCount.replace("%s",o.text())+" "))):(n=i.exec(e))&&(e=e.replace(n[0],adminCommentsL10n.docTitleComments)),document.title=e},R=function(n,t){var e,a,s=".post-com-count-"+t,o="comment-count-no-pending",i="post-com-count-no-pending",r="comment-count-pending";D||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,s),a=L("span."+o,s),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(o)):(t.parent().removeClass(i),t.addClass(r).removeClass(o)),l(t,e)}),a.each(function(){var t=L(this);0<n?(t.parent().removeClass(i),t.removeClass(o).addClass(r)):(t.parent().addClass(i),t.addClass(o).removeClass(r)),l(t,n)}))},setCommentsList=function(){var w,c,d,t,e,x,n,b,r,k=0;w=L('input[name="_total"]',"#comments-form"),c=L('input[name="_per_page"]',"#comments-form"),d=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,s,o,i=L("#"+e.element);!0!==e.parsed&&(o=e.parsed.responses[0]),n=L("#replyrow"),a=L("#comment_ID",n).val(),s=L("#replybtn",n),i.is(".unapproved")?(e.data.id==a&&s.text(adminCommentsL10n.replyApprove),i.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")):(e.data.id==a&&s.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,o?(j(o.supplemental),R(r,o.supplemental.postId),T(-1*r,o.supplemental.postId)):(R(r),T(-1*r))},e=function(t,e){var n,a,s,o,i,r,l,m=!1,p=L(t.target).attr("data-wp-lists");return t.data._total=w.val()||0,t.data._per_page=c.val()||0,t.data._page=d.val()||0,t.data._url=document.location.href,t.data.comment_status=L('input[name="comment_status"]',"#comments-form").val(),-1!=p.indexOf(":trash=1")?m="trash":-1!=p.indexOf(":spam=1")&&(m="spam"),m&&(a=p.replace(/.*?comment-([0-9]+).*/,"$1"),s=L("#comment-"+a),n=L("#"+m+"-undo-holder").html(),s.find(".check-column :checkbox").prop("checked",!1),s.siblings("#replyrow").length&&commentReply.cid==a&&commentReply.close(),i=s.is("tr")?(o=s.children(":visible").length,l=L(".author strong",s).text(),L('<tr id="undo-'+a+'" class="undo un'+m+'" style="display:none;"><td colspan="'+o+'">'+n+"</td></tr>")):(l=L(".comment-author",s).text(),L('<div id="undo-'+a+'" style="display:none;" class="undo un'+m+'">'+n+"</div>")),s.before(i),L("strong","#undo-"+a).text(l),(r=L(".undo a","#undo-"+a)).attr("href","comment.php?action=un"+m+"comm