var $pager=jQuery('
'); var $cPager=jQuery(''); var $prev=jQuery(''+ (yjlSettings.prev==''? 'Prev':yjlSettings.prev) +''); var $next=jQuery(''+ (yjlSettings.next==''? 'Next':yjlSettings.next) +''); var $moreFront=jQuery(''); var $moreEnd=jQuery(''); var $commentlist=jQuery('.commentlist'); var $respond=jQuery('#respond'); var $message=jQuery('').prependTo("#commentform"); var $list=$commentlist.children(); var totalCom=$list.length; var $textarea=$respond.find('#comment').attr('rows','4'); var comPerPage=parseInt((yjlSettings.comPerpage==''? '5':yjlSettings.comPerpage),10); var currentPage=0,$number,numPerPage,totalPage,$reply; //repostion comment form if enabled if(yjlSettings.repForm!='disable'){ $respond.insertBefore($commentlist.prev()); } function getTotal($comlist){ $list=$comlist.children(); totalCom=$list.length; totalPage=Math.ceil(totalCom/comPerPage); } if(yjlSettings.pagination!='disable')pagination(); function pagination(){ getTotal($commentlist); numPerPage=parseInt((yjlSettings.numPerpage==''? '5':yjlSettings.numPerpage),10); if(totalPage')[1].split('
')[0]); } else if(xhr.status=='timeout'){ $message.empty().append((yjlSettings.timeOut!=''?yjlSettings.timeOut:'Error:Server time out,try again!')); } else{ $message.empty().append((yjlSettings.fast!=''?yjlSettings.fast:'Please slow down,you are posting to fast!')); } }, success:function(data){ $message.empty().append((yjlSettings.thank!=''?yjlSettings.thank:'Thank you for your comment!')).css('color', 'green'); $newComList=jQuery(data).find('.commentlist'); if(totalCom>0){ if($reply)$cancel.trigger('click'); else { if(yjlSettings.order=='desc')currentPage=0; else { getTotal($newComList);currentPage=totalPage-1;} } if(yjlSettings.pagination=='disable' || yjlSettings.pagerPos=='after') $commentlist.prev().replaceWith($newComList.prev()); else $commentlist.prev().prev().replaceWith($newComList.prev()); $commentlist.replaceWith($newComList); }else{ if(yjlSettings.repForm=='disable')$newComList.prev().andSelf().insertBefore($respond); else $newComList.prev().andSelf().insertAfter($respond); } $commentlist=$newComList; if(yjlSettings.pagination!='disable')pagination(); $textarea.val(''); } });//end of ajax return false; });//end of submit function if(yjlSettings.autoGrow!='disable'){ $textarea.autoResize({ // On resize: onResize : function() { jQuery(this).css({opacity:0.8}); }, // After resize: animateCallback : function() { jQuery(this).css({opacity:1}); }, // Quite slow animation: animateDuration : 300, // More extra space: extraSpace : 20 }); }