1$(document).ready(function(){$('input:radio').change(function(){$('#userRating').val(this.value);});});function postReply(commentId,replyTo){$("#comment-message").css('display','none');$('#commentId').val(commentId);$('#new_comment').css('display','none');$('#reply-to').html('Replying to: '+replyTo+'. <a onClick="cancelReply()">cancel</a>');$("#comment").focus();} 2function cancelReply(){$("#comment-message").css('display','none');$('#new_comment').css('display','block');$('#reply-to').text("");$('#commentId').val(0);} 3$("#submitButton").click(function(){$("#comment-message").css('display','none');var comment=$("#comment").val().trim();if(!jsdata.is_logged){showCommentError('You need to login to post a comment');return;} 4if(comment.length<10){showCommentError('Please write a comment with at least more than 10 characters');return;} 5commentId=$('#commentId').val();if(commentId<1){var title=$("#title").val().trim();if(title.length<10){showCommentError('Please write a title with at least more than 10 characters') 6return;} 7var rating=$('#userRating').val();if(rating<1){showCommentError('Please give a rating');return;}} 8var str=$("#frm-comment").serialize();$.ajax({url:"/comments.php",data:str,type:'post',success:function(response){var result=eval('('+response+')');$("#comment-message").css('display','block');if(response){var data=JSON.parse(response);if(data.success==1){$('#comment-message').html('<span class="success">Comment Added Successfully!. It will show up once approved.</span>');$("#comment").val("");$("#title").val("");$(".rate input:radio").attr("checked",false);$("#userRating").val(0);$("#commentId").val("");}else{$('#comment-message').html('<span class="error">'+data.msg+'</span>');}}else{$('#comment-message').html('<span class="error">Error occurred. Please try again.</span>');return false;}}});});$(document).ready(function(){listComment(jsdata.id,0);if(jsdata.is_logged){$('#comment-form-container').show();}else{$('#loginContainer').show();}});var commentsCounter=1;var maxComments=5;function listComment(bookId,pageNum){$.post("/comments.php",{book_id:bookId,book_type:jsdata.book_type,page_num:pageNum},function(data){var data=JSON.parse(data);var totalComments=data['total_comments'];if(totalComments==0){$("#output").html('No comments posted yet.');}else{var commentId=0;var replies="";var item="";var list=$("<div>");data=data['comments'];for(var i=0;(i<data.length);i++){if(commentsCounter>maxComments){var mainComment=$("<ul class='extra'>");}else{var mainComment=$("<ul>");} 9commentId=data[i]['comment_id'];item=commentBlock(commentId,data[i],totalComments);mainComment.append(item);if(data[i]['replies'].length>0){for(j=0;j<data[i]['replies'].length;j++){mainComment.append(commentBlock(commentId,data[i]['replies'][j],totalComments));}} 10list.append(mainComment);} 11$("#output").html(list.children());}});} 12function commentBlock(commentId,comment,totalComments){var data='<div class="mt15"><img src="https://www.free-ebooks.net/resources/img/profile/'+comment['profile_image']+'" width="30" height="30" alt="User image" />' 13+' '+comment['name']+'</div><div class="mt10">' 14+ratingStars(comment['rating'])+' <strong>'+comment['title']+'</strong>' 15+'</div><div>'+comment['posted_on']+'</div>' 16+'<div class="mt10">'+comment['comment'] 17+'<br/> <a onCLick="postReply('+commentId+',\''+comment['name']+'\')">Reply</a></div>';if(commentsCounter==maxComments&&totalComments>maxComments){data+='<div id="showAllComments" class="mt20"><a onClick="showAllComments()">Load More Comments</a></div>';} 18if(commentsCounter>maxComments){return $("<li class='extra'>").html(data);}else{commentsCounter+=1;return $("<li>").html(data);}} 19function ratingStars(rating){var ratingText="";for(i=0;i<rating;i++){ratingText+='<span title="Rating: '+rating+'" class="star on"></span>';} 20for(i=rating;i<5;i++){ratingText+='<span title="Rating: '+rating+'" class="star off"></span>';} 21return ratingText;} 22function showAllComments(){$('#showAllComments').hide();$('.extra').show();} 23function showCommentError(error){$('#comment-message').html('<span class="error">Error occurred: '+error+'.</span>');$("#comment-message").css('display','block');} 24function confirmLogin(){if(confirm("You need to login to post comment. Continue with login?")){window.location.href="/login";}}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.