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

1 line
12 KiB
JavaScript
Raw Normal View History

var setCommentsList,theList,theExtraList,commentReply;!function(a){var b,c,d;setCommentsList=function(){var e,f,g,h,i,j,k,l,m,n=0;e=a('input[name="_total"]',"#comments-form"),f=a('input[name="_per_page"]',"#comments-form"),g=a('input[name="_page"]',"#comments-form"),h=function(b,c){var e,f,g,h=a("#"+c.element);e=a("#replyrow"),f=a("#comment_ID",e).val(),g=a("#replybtn",e),h.is(".unapproved")?(c.data.id==f&&g.text(adminCommentsL10n.replyApprove),h.find("div.comment_status").html("0")):(c.data.id==f&&g.text(adminCommentsL10n.reply),h.find("div.comment_status").html("1")),m=a("#"+c.element).is("."+c.dimClass)?1:-1,d(m),updateCountText("span.approved-count",-1*m),updateCountText("span.comment-count-approved",-1*m)},i=function(b,c){var d,h,i,j,k,l,m,n=!1,o=a(b.target).attr("data-wp-lists");return b.data._total=e.val()||0,b.data._per_page=f.val()||0,b.data._page=g.val()||0,b.data._url=document.location.href,b.data.comment_status=a('input[name="comment_status"]',"#comments-form").val(),-1!=o.indexOf(":trash=1")?n="trash":-1!=o.indexOf(":spam=1")&&(n="spam"),n&&(h=o.replace(/.*?comment-([0-9]+).*/,"$1"),i=a("#comment-"+h),d=a("#"+n+"-undo-holder").html(),i.find(".check-column :checkbox").prop("checked",!1),i.siblings("#replyrow").length&&commentReply.cid==h&&commentReply.close(),i.is("tr")?(j=i.children(":visible").length,m=a(".author strong",i).text(),k=a('<tr id="undo-'+h+'" class="undo un'+n+'" style="display:none;"><td colspan="'+j+'">'+d+"</td></tr>")):(m=a(".comment-author",i).text(),k=a('<div id="undo-'+h+'" style="display:none;" class="undo un'+n+'">'+d+"</div>")),i.before(k),a("strong","#undo-"+h).text(m),l=a(".undo a","#undo-"+h),l.attr("href","comment.php?action=un"+n+"comment&c="+h+"&_wpnonce="+b.data._ajax_nonce),l.attr("data-wp-lists","delete:the-comment-list:comment-"+h+"::un"+n+"=1"),l.attr("class","vim-z vim-destructive"),a(".avatar",i).first().clone().prependTo("#undo-"+h+" ."+n+"-undo-inside"),l.click(function(){return c.wpList.del(this),a("#undo-"+h).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove(),a("#comment-"+h).css("backgroundColor","").fadeIn(300,function(){a(this).show()})}),!1})),b},j=function(a,b,c){n>b||(c&&(n=b),e.val(a.toString()))},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=1>b?"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)}},d=function(d){a("span.pending-count, .comment-count-pending").each(function(){var e=a(this),f=b(e)+d;1>f&&(f=0),e.closest(".awaiting-mod")[0===f?"addClass":"removeClass"]("count-0"),c(e,f)})},updateCountText=function(d,e){a(d).each(function(){var d=a(this),f=b(d)+e;1>f&&(f=0),c(d,f)})},k=function(b,c){var f,g,h,i,k,m,o=!0===c.parsed?{}:c.parsed.responses[0],p=!0===c.parsed?"":o.supplemental.status,q=a(c.target).parent(),r=a("#"+c.element),s=r.hasClass("approved"),t=r.hasClass("unapproved"),u=r.hasClass("spam"),v=r.hasClass("trash");q.is("span.undo")?q.hasClass("unspam")?(h=-1,"trash"===p?i=1:"1"===p?m=1:"0"===p&&(k=1)):q.hasClass("untrash")&&(i=-1,"spam"===p?h=1:"1"===p?m=1:"0"===p&&(k=1)):q.is("span.spam")?(s?m=-1:t?k=-1:v&&(i=-1),h=1):q.is("span.unspam")?(s?k=1:t?m=1:v?q.hasClass("approve")?m=1:q.hasClass("unapprove")&&(k=1):u&&(q.hasClass("approve")?m=1:q.hasClass("unapprove")&&(k=1)),h=-1):q.is("span.trash")?(s?m=-1:t?k=-1:u&&(h=-1),i=1):q.is("span.untrash")?(s?k=1:t?m=1:v&&(q.hasClass("approve")?m=1:q.hasClass("unapprove")&&(k=1)),i=-1):q.is("span.approve:not(.unspam):not(.untrash)")?(m=1,k=-1):q.is("span.unapprove:not(.unspam):not(.untrash)")?(m=-1,k=1):q.is("span.delete")&&(u?h=-1:v&&(i=-1)),k&&d(k),m&&(updateCountText("span.approved-count",m),updateCountText("span.comment-count-approved",m)),h&&updateCountText("span.spam-count",h),i&&updateCountText("span.trash-count",i),a("#dashboard_right_now").length||(g=e.val()?parseInt(e.val(),10):0,a(c.target).parent().is("span.undo")?g++:g--,0>g&&(g=0),"object"==typeof b?o.supplemental.total_items_i18n&&n<o.supplemental.time?(f=o.supplemen