var setCommentsList,theList,theExtraList,commentReply;!function(h){var f,v,g;setCommentsList=function(){var t,c,s,m=0,p=h('input[name="_total"]',"#comments-form"),l=h('input[name="_per_page"]',"#comments-form"),d=h('input[name="_page"]',"#comments-form"),e=function(t,e){var n=h("#"+e.element),a=h("#replyrow"),o=h("#comment_ID",a).val(),a=h("#replybtn",a);n.is(".unapproved")?(e.data.id==o&&a.text(adminCommentsL10n.replyApprove),n.find("div.comment_status").html("0")):(e.data.id==o&&a.text(adminCommentsL10n.reply),n.find("div.comment_status").html("1")),s=h("#"+e.element).is("."+e.dimClass)?1:-1,g(s)},n=function(t,e){var n,a,o,s,i=!1,r=h(t.target).attr("data-wp-lists");return t.data._total=p.val()||0,t.data._per_page=l.val()||0,t.data._page=d.val()||0,t.data._url=document.location.href,t.data.comment_status=h('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=h("#comment-"+n),o=h("#"+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=h(".author strong",a).text(),h('
| '+o+" |
")):(s=h(".comment-author",a).text(),h(''+o+"
")),a.before(o),h("strong","#undo-"+n).text(s),(s=h(".undo a","#undo-"+n)).attr("href","comment.php?action=un"+i+"comment&c="+n+"&_wpnonce="+t.data._ajax_nonce),s.attr("data-wp-lists","delete:the-comment-list:comment-"+n+"::un"+i+"=1"),s.attr("class","vim-z vim-destructive"),h(".avatar",a).first().clone().prependTo("#undo-"+n+" ."+i+"-undo-inside"),s.click(function(){return e.wpList.del(this),h("#undo-"+n).css({backgroundColor:"#ceb"}).fadeOut(350,function(){h(this).remove(),h("#comment-"+n).css("backgroundColor","").fadeIn(300,function(){h(this).show()})}),!1})),t},u=function(t,e,n){en||(t?(theExtraList.empty(),e.number=Math.min(8,a)):(e.number=1,e.offset=Math.min(8,a)-1),e.no_placeholder=!0,e.paged++,!0===e.comment_type&&(e.comment_type=""),e=h.extend(e,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:h("#_ajax_fetch_list_nonce").val()}),h.ajax({url:ajaxurl,global:!1,dataType:"json",data:e,success:function(t){theExtraList.get(0).wpList.add(t.rows)}}))},theExtraList=h("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),theList=h("#the-comment-list").wpList({alt:"",delBefore:n,dimAfter:e,delAfter:t,addColor:"none"}).bind("wpListDelEnd",function(t,e){var n=h(e.target).attr("data-wp-lists"),e=e.element.replace(/[^0-9]+/g,"");-1==n.indexOf(":trash=1")&&-1==n.indexOf(":spam=1")||h("#undo-"+e).fadeIn(300,function(){h(this).show()})})},commentReply={cid:"",act:"",init:function(){var t=h("#replyrow");h("a.cancel",t).click(function(){return commentReply.revert()}),h("a.save",t).click(function(){return commentReply.send()}),h("input#author, input#author-email, input#author-url",t).keypress(function(t){if(13==t.which)return commentReply.send(),t.preventDefault(),!1}),h("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(h(this).parent())}),h("#doaction, #doaction2, #post-query-submit").click(function(){0 input[name="comment_status"]').val()||""},addEvents:function(t){t.each(function(){h(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(h(this).parent())})})},toggle:function(t){"none"!=h(t).css("display")&&h(t).find("a.vim-q").click()},revert:function(){return h("#the-comment-list #replyrow").length<1||h("#replyrow").fadeOut("fast",function(){commentReply.close()}),!1},close:function(){var t,e=h("#replyrow");e.parent().is("#com-reply")||(this.cid&&"edit-comment"==this.act&&(t=h("#comment-"+this.cid)).fadeIn(300,function(){t.show()}).css("backgroundColor",""),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),h("#add-new-comment").css("display",""),e.hide(),h("#com-reply").append(e),h("#replycontent").css("height","").val(""),h("#edithead input").val(""),h(".error",e).empty().hide(),h(".spinner",e).removeClass("is-active"),this.cid="")},open:function(t,e,n){var a,o,s,i=h("#comment-"+t),r=i.height();return this.close(),this.cid=t,a=h("#replyrow"),o=h("#inline-"+t),s="edit"==(n=n||"replyto")?"edit":"replyto",s=this.act=s+"-comment",h("#action",a).val(s),h("#comment_post_ID",a).val(e),h("#comment_ID",a).val(t),"edit"==n?(h("#author",a).val(h("div.author",o).text()),h("#author-email",a).val(h("div.author-email",o).text()),h("#author-url",a).val(h("div.author-url",o).text()),h("#status",a).val(h("div.comment_status",o).text()),h("#replycontent",a).val(h("textarea.comment",o).val()),h("#edithead, #savebtn",a).show(),h("#replyhead, #replybtn, #addhead, #addbtn",a).hide(),120]*?>/g,""):e)&&h("#replysubmit .error").html(e).show()},addcomment:function(t){var e=this;h("#add-new-comment").fadeOut(200,function(){e.open(0,t,"add"),h("table.comments-box").css("display",""),h("#no-comments").remove()})}},h(document).ready(function(){var t,e,n,a;setCommentsList(),commentReply.init(),h(document).delegate("span.delete a.delete","click",function(){return!1}),void 0!==h.table_hotkeys&&(t=function(n){return function(){var t="next"==n?"first":"last",e=h(".tablenav-pages ."+n+"-page:not(.disabled)");e.length&&(window.location=e[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+t+"=1")}},e=function(t,e){window.location=h("span.edit a",e).attr("href")},n=function(){h("#cb-select-all-1").data("wp-toggle",1).trigger("click").removeData("wp-toggle")},a=function(e){return function(){var t=h('select[name="action"]');h('option[value="'+e+'"]',t).prop("selected",!0),h("#doaction").click()}},h.table_hotkeys(h("table.widefat"),["a","u","s","d","r","q","z",["e",e],["shift+x",n],["shift+a",a("approve")],["shift+s",a("spam")],["shift+d",a("delete")],["shift+t",a("trash")],["shift+z",a("untrash")],["shift+u",a("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:t("prev"),next_page_link_cb:t("next"),hotkeys_opts:{disableInInput:!0,type:"keypress",noDisable:'.check-column input[type="checkbox"]'},cycle_expr:"#the-comment-list tr",start_row_index:0})),h("#the-comment-list").on("click",".comment-inline",function(t){t.preventDefault();var e=h(this),t="replyto";void 0!==e.data("action")&&(t=e.data("action")),commentReply.open(e.data("commentId"),e.data("postId"),t)})})}(jQuery);