;jQuery(document).ready(function(jQuery){$('body').on('click','.comment-reply-link',function(){if($(this).attr('onclick')) return;addComment.moveForm($(this).attr('data-belowelement'),$(this).attr('data-commentid'),$(this).attr('data-respondelement'),$(this).attr('data-postid'));return false;});var __cancel=jQuery('#cancel-comment-reply-link'),__cancel_text=__cancel.text(),__list='list';jQuery(document).on("submit","#commentform",function(){jQuery.ajax({url:ajaxcomment.ajax_url,data:jQuery(this).serialize()+"&action=ajax_comment",type:jQuery(this).attr('method'),beforeSend:addComment.createButterbar("正在提交"),error:function(request){var t=addComment;t.createButterbar(request.responseText)},success:function(data){jQuery('textarea').each(function(){this.value=''});var t=addComment,cancel=t.I('cancel-comment-reply-link'),temp=t.I('wp-temp-form-div'),respond=t.I(t.respondId),post=t.I('comment_post_ID').value,parent=t.I('comment_parent').value;if(parent!='0'){jQuery('#respond').before('
    '+data+'
')}else if(!jQuery('.'+__list).length){if(ajaxcomment.formpostion=='bottom'){jQuery('#respond').before('
    '+data+'
')}else{jQuery('#respond').after('
    '+data+'
')}}else{if(ajaxcomment.order=='asc'){jQuery('.'+__list).append(data)}else{jQuery('.'+__list).prepend(data)}}t.createButterbar("提交成功");cancel.style.display='none';cancel.onclick=null;t.I('comment_parent').value='0';if(temp&&respond){temp.parentNode.insertBefore(respond,temp);temp.parentNode.removeChild(temp)}}});return false});addComment={moveForm:function(commId,parentId,respondId){var t=this,div,comm=t.I(commId),respond=t.I(respondId),cancel=t.I('cancel-comment-reply-link'),parent=t.I('comment_parent'),post=t.I('comment_post_ID');__cancel.text(__cancel_text);t.respondId=respondId;if(!t.I('wp-temp-form-div')){div=document.createElement('div');div.id='wp-temp-form-div';div.style.display='none';respond.parentNode.insertBefore(div,respond)}!comm?(temp=t.I('wp-temp-form-div'),t.I('comment_parent').value='0',temp.parentNode.insertBefore(respond,temp),temp.parentNode.removeChild(temp)):comm.parentNode.insertBefore(respond,comm.nextSibling);jQuery("body").animate({scrollTop:jQuery('#respond').offset().top-180},400);parent.value=parentId;cancel.style.display='';cancel.onclick=function(){var t=addComment,temp=t.I('wp-temp-form-div'),respond=t.I(t.respondId);t.I('comment_parent').value='0';if(temp&&respond){temp.parentNode.insertBefore(respond,temp);temp.parentNode.removeChild(temp)}this.style.display='none';this.onclick=null;return false};try{t.I('comment').focus()}catch(e){}return false},I:function(e){return document.getElementById(e)},createButterbar:function(message){var t=this;layer.msg(message)}}});