var theList,theExtraList,toggleWithKeyboard=!1;!function(u){var h,f,g,v;setCommentsList=function(){var t,c,p=0,m=u('input[name="_total"]',"#comments-form"),r=u('input[name="_per_page"]',"#comments-form"),l=u('input[name="_page"]',"#comments-form"),e=function(t,e){var n=u("#"+e.element),a=u("#replyrow"),o=u("#comment_ID",a).val(),a=u("#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"));e=u("#"+e.element).is("."+e.dimClass)?1:-1;g(e)},n=function(t,e){var n,a,o,s=u(t.target).attr("data-wp-lists"),i=!1;return t.data._total=m.val()||0,t.data._per_page=r.val()||0,t.data._page=l.val()||0,t.data._url=document.location.href,t.data.comment_status=u('input[name="comment_status"]',"#comments-form").val(),-1!=s.indexOf(":trash=1")?i="trash":-1!=s.indexOf(":spam=1")&&(i="spam"),i&&(n=s.replace(/.*?comment-([0-9]+).*/,"$1"),s=u("#comment-"+n),note=u("#"+i+"-undo-holder").html(),s.find(".check-column :checkbox").prop("checked",!1),s.siblings("#replyrow").length&&commentReply.cid==n&&commentReply.close(),a=s.is("tr")?(a=s.children(":visible").length,o=u(".author strong",s).text(),u(''+note+"")):(o=u(".comment-author",s).text(),u('")),s.before(a),u("strong","#undo-"+n).text(o),(o=u(".undo a","#undo-"+n)).attr("href","comment.php?action=un"+i+"comment&c="+n+"&_wpnonce="+t.data._ajax_nonce),o.attr("data-wp-lists","delete:the-comment-list:comment-"+n+"::un"+i+"=1"),o.attr("class","vim-z vim-destructive"),u(".avatar",s).clone().prependTo("#undo-"+n+" ."+i+"-undo-inside"),o.click(function(){return e.wpList.del(this),u("#undo-"+n).css({backgroundColor:"#ceb"}).fadeOut(350,function(){u(this).remove(),u("#comment-"+n).css("backgroundColor","").fadeIn(300,function(){u(this).show()})}),!1})),t},d=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=u.extend(e,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:u("#_ajax_fetch_list_nonce").val()}),u.ajax({url:ajaxurl,global:!1,dataType:"json",data:e,success:function(t){theExtraList.get(0).wpList.add(t.rows)}}))},theExtraList=u("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),theList=u("#the-comment-list").wpList({alt:"",delBefore:n,dimAfter:e,delAfter:t,addColor:"none"}).bind("wpListDelEnd",function(t,e){var n=u(e.target).attr("data-wp-lists"),e=e.element.replace(/[^0-9]+/g,"");-1==n.indexOf(":trash=1")&&-1==n.indexOf(":spam=1")||u("#undo-"+e).fadeIn(300,function(){u(this).show()})})},commentReply={cid:"",act:"",init:function(){var t=u("#replyrow");u("a.cancel",t).click(function(){return commentReply.revert()}),u("a.save",t).click(function(){return commentReply.send()}),u("input#author, input#author-email, input#author-url",t).keypress(function(t){if(13==t.which)return commentReply.send(),t.preventDefault(),!1}),u("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(u(this).parent())}),u("#doaction, #doaction2, #post-query-submit").click(function(t){0 input[name="comment_status"]').val()||""},addEvents:function(t){t.each(function(){u(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(u(this).parent())})})},toggle:function(t){"none"!=u(t).css("display")&&u(t).find("a.vim-q").click()},revert:function(){return u("#the-comment-list #replyrow").length<1||u("#replyrow").fadeOut("fast",function(){commentReply.close()}),!1},close:function(){var t,e=u("#replyrow");e.parent().is("#com-reply")||(this.cid&&"edit-comment"==this.act&&(t=u("#comment-"+this.cid)).fadeIn(300,function(){t.show()}).css("backgroundColor",""),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),u("#add-new-comment").css("display",""),e.hide(),u("#com-reply").append(e),u("#replycontent").css("height","").val(""),u("#edithead input").val(""),u(".error",e).html("").hide(),u(".spinner",e).hide(),this.cid="")},open:function(t,e,n){var a,o,s,i=u("#comment-"+t),r=i.height();return this.close(),this.cid=t,a=u("#replyrow"),o=u("#inline-"+t),s="edit"==(n=n||"replyto")?"edit":"replyto",s=this.act=s+"-comment",u("#action",a).val(s),u("#comment_post_ID",a).val(e),u("#comment_ID",a).val(t),120]*?>/g,""):e)&&u("#replysubmit .error").html(e).show()},addcomment:function(t){var e=this;u("#add-new-comment").fadeOut(200,function(){e.open(0,t,"add"),u("table.comments-box").css("display",""),u("#no-comments").remove()})}},u(document).ready(function(){var t,e,n,a;setCommentsList(),commentReply.init(),u(document).delegate("span.delete a.delete","click",function(){return!1}),void 0!==u.table_hotkeys&&(t=function(n){return function(){var t="next"==n?"first":"last",e=u(".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=u("span.edit a",e).attr("href")},n=function(){toggleWithKeyboard=!0,u("input:checkbox","#cb").click().prop("checked",!1),toggleWithKeyboard=!1},a=function(e){return function(){var t=u('select[name="action"]');u('option[value="'+e+'"]',t).prop("selected",!0),u("#doaction").click()}},u.table_hotkeys(u("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")}))})}(jQuery);