1var reviewsToShow = 4; 2 3function populateReviews(response) { 4 var count = 0; 5 for (var i = 0; i < reviewsToShow; i++) { 6 var review = response.reviews[i]; 7 if (review && review.title && review.title.length > 0) { 8 if (count == 0) { 9 // window.jQuery('.pinnedReviewTitle').append(review.title); 10 // window.jQuery('.pinnedReviewComment').append(review.comments); 11 // window.jQuery('.quoteRight').after(getStarHtml(review.rating, ' bigStar', 1)); 12 } 13 // var date = new Date(review.created_date); 14 // var location = review.location ? review.location : ""; 15 // var html = '<div class="review"><div class="left">' + getStarHtml(review.rating, ' smallStar', 1) + '</div><div class="right"><div class="title">"' + review.title + '"</div><div class="footer">' + location + ' on ' + date.toLocaleDateString("en-US") + '</div></div></div>'; 16 // window.jQuery('.list').append(html); 17 count++; 18 } 19 } 20} 21 22function populateShopInfo(response) { 23 var shop = response.business; 24 var rating = shop.rating_avg_verified; 25 var reviewCount = shop.review_count_verified; 26 window.jQuery('.reviewCount').text('(' + reviewCount + ' Reviews)'); 27 window.jQuery('.starContainer').append(getStarHtml(rating, '', 3)); 28} 29 30function getStarHtml(rating, sizeClass, percision) { 31 var html = '';
32 var title = 'title="' + Number(rating).toPrecision(percision); 33 title += rating == 1 ? ' star"' : ' stars"'; 34 for (var i = 0; i < 5; i++) { 35 html += '<div ' + title + ' class="star' + getStarGraphic(i, rating) + sizeClass + '"></div>'; 36 } 37 return html; 38} 39 40function getStarGraphic(starNumber, value) { 41 var val = value - starNumber; 42 var graphic; 43 if (val > 1) { 44 graphic = 'Full'; 45 } else if (val <= .125) { 46 graphic = 'Empty'; 47 } else if (val <= .375) { 48 graphic = '1Q'; 49 } else if (val <= .625) { 50 graphic = '2Q'; 51 } else if (val <= .875) { 52 graphic = '3Q'; 53 } else { 54 graphic = 'Full'; 55 } 56 return graphic; 57} 58 59window.jQuery(document).ready(function () { 60 var widgetHtml = '<div class="review_container wrenches"><div class="starContainer"></div><div class="reviewCount"></div></div>'; 61 window.jQuery('.reviewFrame').html(widgetHtml); 62 var accountNumber = window.jQuery('#accountNumber').val(); 63 64 window.jQuery.getScript('//www.surecritic.com/api/px/businesses/' + accountNumber + '.jsonp?api_key=API-MITCHsN0OiFY9oxPcTxw7&callback=populateShopInfo'); 65 window.jQuery.getScript('//www.surecritic.com/api/pub/businesses/' + accountNumber + '/reviews.jsonp?api_key=API-MITCHsN0OiFY9oxPcTxw7&count=' + reviewsToShow + '&sort=featured&callback=populateReviews'); 66});
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.