var setCommentsList,theList,theExtraList,commentReply;!function(a){var b,c,d,e,f,g,h,i,j,k=document.title,l=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){if(l&&b&&b.i18n_comments_text){var c=a("#dashboard_right_now");a(".comment-count a",c).text(b.i18n_comments_text),a(".comment-mod-count a",c).text(b.i18n_moderation_text).parent()[b.in_moderation>0?"removeClass":"addClass"]("hidden")}},g=function(d){var e,f,g,h;j=j||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),i=i||a("
"),e=k,h=j.exec(document.title),h?(h=h[0],i.html(h),g=b(i)+d):(i.html(0),g=d),g>=1?(c(i,g),f=j.exec(document.title),f&&(e=document.title.replace(f[0],adminCommentsL10n.docTitleCommentsCount.replace("%s",i.text())+" "))):(f=j.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",m="comment-count-pending";l||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."+m,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(m).addClass(j)):(e.parent().removeClass(k),e.addClass(m).removeClass(j)),c(e,f)}),h.each(function(){var b=a(this);d>0?(b.parent().removeClass(k),b.removeClass(j).addClass(m)):(b.parent().addClass(k),b.addClass(j).removeClass(m)),c(b,d)}))},setCommentsList=function(){var c,g,i,j,k,m,n,o,p,q=0;c=a('input[name="_total"]',"#comments-form"),g=a('input[name="_per_page"]',"#comments-form"),i=a('input[name="_page"]',"#comments-form"),m=function(a,b,d){b'+e+" | ")):(m=a(".comment-author",h).text(),k=a(''+e+"
")),h.before(k),a("strong","#undo-"+f).text(m),l=a(".undo a","#undo-"+f),l.attr("href","comment.php?action=un"+n+"comment&c="+f+"&_wpnonce="+b.data._ajax_nonce),l.attr("data-wp-lists","delete:the-comment-list:comment-"+f+"::un"+n+"=1"),l.attr("class","vim-z vim-destructive"),a(".avatar",h).first().clone().prependTo("#undo-"+f+" ."+n+"-undo-inside"),l.click(function(b){b.preventDefault(),b.stopPropagation(),d.wpList.del(this),a("#undo-"+f).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove(),a("#comment-"+f).css("backgroundColor","").fadeIn(300,function(){a(this).show()})})})),b},n=function(g,i){var j,k,n,p,r,s,t,u,v=!0===i.parsed?{}:i.parsed.responses[0],w=!0===i.parsed?"":v.supplemental.status,x=!0===i.parsed?"":v.supplemental.postId,y=!0===i.parsed?"":v.supplemental,z=a(i.target).parent(),A=a("#"+i.element),B=A.hasClass("approved"),C=A.hasClass("unapproved"),D=A.hasClass("spam"),E=A.hasClass("trash"),F=!1;h(y),z.is("span.undo")?(z.hasClass("unspam")?(r=-1,"trash"===w?s=1:"1"===w?u=1:"0"===w&&(t=1)):z.hasClass("untrash")&&(s=-1,"spam"===w?r=1:"1"===w?u=1:"0"===w&&(t=1)),F=!0):z.is("span.spam")?(B?u=-1:C?t=-1:E&&(s=-1),r=1):z.is("span.unspam")?(B?t=1:C?u=1:E?z.hasClass("approve")?u=1:z.hasClass("unapprove")&&(t=1):D&&(z.hasClass("approve")?u=1:z.hasClass("unapprove")&&(t=1)),r=-1):z.is("span.trash")?(B?u=-1:C?t=-1:D&&(r=-1),s=1):z.is("span.untrash")?(B?t=1:C?u=1:E&&(z.hasClass("approve")?u=1:z.hasClass("unapprove")&&(t=1)),s=-1):z.is("span.approve:not(.unspam):not(.untrash)")?(u=1,t=-1):z.is("span.unapprove:not(.unspam):not(.untrash)")?(u=-1,t=1):z.is("span.delete")&&(D?r=-1:E&&(s=-1)),t&&(e(t,x),d("span.all-count",t)),u&&(f(u,x),d("span.all-count",u)),r&&d("span.spam-count",r),s&&d("span.trash-count",s),("trash"===i.data.comment_status&&!b(a("span.trash-count"))||"spam"===i.data.comment_status&&!b(a("span.spam-count")))&&a("#delete_all").hide(),l||(k=c.val()?parseInt(c.val(),10):0,a(i.target).parent().is("span.undo")?k++:k--,k<0&&(k=0),"object"==typeof g?v.supplemental.total_items_i18n&&qd||(b?(theExtraList.empty(),c.number=Math.min(8,e)):(c.number=1,c.offset=Math.min(8,e)-1),c.no_placeholder=!0,c.paged++,!0===c.comment_type&&(c.comment_type=""),c=a.extend(c,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()}),a.ajax({url:ajaxurl,global:!1,dataType:"json",data:c,success:function(a){theExtraList.get(0).wpList.add(a.rows)}}))},theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),theList=a("#the-comment-list").wpList({alt:"",delBefore:k,dimAfter:j,delAfter:n,addColor:"none"}).bind("wpListDelEnd",function(b,c){var d=a(c.target).attr("data-wp-lists"),e=c.element.replace(/[^0-9]+/g,"");d.indexOf(":trash=1")==-1&&d.indexOf(":spam=1")==-1||a("#undo-"+e).fadeIn(300,function(){a(this).show()})})},commentReply={cid:"",act:"",originalContent:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()}),a("a.save",b).click(function(){return commentReply.send()}),a("input#author-name, input#author-email, input#author-url",b).keypress(function(a){if(13==a.which)return commentReply.send(),a.preventDefault(),!1}),a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())}),a("#doaction, #doaction2, #post-query-submit").click(function(){a("#the-comment-list #replyrow").length>0&&commentReply.close()}),this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){"none"!==a(b).css("display")&&(a("#replyrow").parent().is("#com-reply")||window.confirm(adminCommentsL10n.warnQuickEdit))&&a(b).find("a.vim-q").click()},revert:function(){return!(a("#the-comment-list #replyrow").length<1)&&(a("#replyrow").fadeOut("fast",function(){commentReply.close()}),!1)},close:function(){var b,c=a("#replyrow");c.parent().is("#com-reply")||(this.cid&&"edit-comment"==this.act&&(b=a("#comment-"+this.cid),b.fadeIn(300,function(){b.show()}).css("backgroundColor","")),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),a("#add-new-comment").css("display",""),c.hide(),a("#com-reply").append(c),a("#replycontent").css("height","").val(""),a("#edithead input").val(""),a(".notice-error",c).addClass("hidden").find(".error").empty(),a(".spinner",c).removeClass("is-active"),this.cid="",this.originalContent="")},open:function(b,c,d){var e,f,g,h,i,j=this,k=a("#comment-"+b),l=k.height(),m=0;return!!this.discardCommentChanges()&&(j.close(),j.cid=b,e=a("#replyrow"),f=a("#inline-"+b),d=d||"replyto",g="edit"==d?"edit":"replyto",g=j.act=g+"-comment",j.originalContent=a("textarea.comment",f).val(),m=a("> th:visible, > td:visible",k).length,e.hasClass("inline-edit-row")&&0!==m&&a("td",e).attr("colspan",m),a("#action",e).val(g),a("#comment_post_ID",e).val(c),a("#comment_ID",e).val(b),"edit"==d?(a("#author-name",e).val(a("div.author",f).text()),a("#author-email",e).val(a("div.author-email",f).text()),a("#author-url",e).val(a("div.author-url",f).text()),a("#status",e).val(a("div.comment_status",f).text()),a("#replycontent",e).val(a("textarea.comment",f).val()),a("#edithead, #editlegend, #savebtn",e).show(),a("#replyhead, #replybtn, #addhead, #addbtn",e).hide(),l>120&&(i=l>500?500:l,a("#replycontent",e).css("height",i+"px")),k.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})):"add"==d?(a("#addhead, #addbtn",e).show(),a("#replyhead, #replybtn, #edithead, #editlegend, #savebtn",e).hide(),a("#the-comment-list").prepend(e),a("#replyrow").fadeIn(300)):(h=a("#replybtn",e),a("#edithead, #editlegend, #savebtn, #addhead, #addbtn",e).hide(),a("#replyhead, #replybtn",e).show(),k.after(e),k.hasClass("unapproved")?h.text(adminCommentsL10n.replyApprove):h.text(adminCommentsL10n.reply),a("#replyrow").fadeIn(300,function(){a(this).show()})),setTimeout(function(){var b,c,d,e,f;b=a("#replyrow").offset().top,c=b+a("#replyrow").height(),d=window.pageYOffset||document.documentElement.scrollTop,e=document.documentElement.clientHeight||window.innerHeight||0,f=d+e,f-20]*?>/g,"")),c&&(d.removeClass("hidden"),e.html(c))},addcomment:function(b){var c=this;a("#add-new-comment").fadeOut(200,function(){c.open(0,b,"add"),a("table.comments-box").css("display",""),a("#no-comments").remove()})},discardCommentChanges:function(){var b=a("#replyrow");return this.originalContent===a("#replycontent",b).val()||window.confirm(adminCommentsL10n.warnCommentChanges)}},a(document).ready(function(){var b,c,d,e;setCommentsList(),commentReply.init(),a(document).on("click","span.delete a.delete",function(a){a.preventDefault()}),"undefined"!=typeof a.table_hotkeys&&(b=function(b){return function(){var c,d;c="next"==b?"first":"last",d=a(".tablenav-pages ."+b+"-page:not(.disabled)"),d.length&&(window.location=d[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+c+"=1")}},c=function(b,c){window.location=a("span.edit a",c).attr("href")},d=function(){a("#cb-select-all-1").data("wp-toggle",1).trigger("click").removeData("wp-toggle")},e=function(b){return function(){var c=a('select[name="action"]');a('option[value="'+b+'"]',c).prop("selected",!0),a("#doaction").click()}},a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",c],["shift+x",d],["shift+a",e("approve")],["shift+s",e("spam")],["shift+d",e("delete")],["shift+t",e("trash")],["shift+z",e("untrash")],["shift+u",e("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:b("prev"),next_page_link_cb:b("next"),hotkeys_opts:{disableInInput:!0,type:"keypress",noDisable:'.check-column input[type="checkbox"]'},cycle_expr:"#the-comment-list tr",start_row_index:0})),a("#the-comment-list").on("click",".comment-inline",function(b){b.preventDefault();var c=a(this),d="replyto";"undefined"!=typeof c.data("action")&&(d=c.data("action")),commentReply.open(c.data("commentId"),c.data("postId"),d)})})}(jQuery);