1// source --> https://www.tablelegworld.com/wp-content/plugins/shopper-approved-reviews/public/js/spa_javascript.js 2const ajax_url = spa_javascript_obj.ajaxurl; 3const image_path = spa_javascript_obj.image_path; 4spa_ajax_main_response(0, "newest"); 5 6function spa_ajax_main_response(page, short) { 7 const data = { 8 action: "spa_load_reviews_ajax", 9 page: page, 10 short: short 11 }; 12 let html = ""; 13 let currentRequest = null; 14 currentRequest = jQuery.ajax({ 15 type: "POST", 16 data: data, 17 url: ajax_url, 18 beforeSend: function() { 19 if (currentRequest != null) { 20 currentRequest.abort(); 21 } 22 jQuery("#loader").show(); 23 jQuery("#spa_response").empty(); 24 }, 25 success: function(response) { 26 var reviews = JSON.parse(response); 27 jQuery.each(reviews, function(key, review_temp) { 28 jQuery.each(review_temp, function(key1, review) { 29 html = 30 '<div class="spa_review_border whitebg padding"><div class="spa_review_container"><div class="spa_review_title"><span class="spa_reviewer_name marginright10"><a href="' + 31 review.fullurl + 32 '">' + 33 review.name + 34 '</a></span><span class="small grey"><span class="pipe">|</span>' + 35 review.justlocation + 36 "Submitted " + 37 review.displaydate + 38 '</span></div><div class="spa_star_rating"><img src="' + 39 image_path + 40 "/colorbox-" + 41 parseInt(review.Overall) + 42 '.jpg" alt="colorbox-' + 43 parseInt(review.Overall) + 44 '.jpg"><img src="' + 45 image_path + 46 "/reviews-" + 47 parseInt(review.Overall) + 48 '.png" alt="reviews-' + 49 parseInt(review.Overall) + 50 '.png"></div></div><div class="spa_reviewer_comment"><p class="text-left reviewcomments">' + 51 review.textcomments + 52 '</p></div><div class="spa_various_ratings"><div class="spa_rating product_satisfaction"><span class="heading">Product Satisfaction</span>' + 53 product_rating(review.Product) + 54 '</div><div class="spa_rating customer_service"><span class="heading">Customer Service</span>' + 55 customer_rating(review.CustomerService) + 56 '</div><div class="spa_rating referral"><span class="heading">Referral</span>' + 57 referral_rating(review.Referral) + 58 "</div></div>"; 59 jQuery("#spa_response").append(html); 60 }); 61 }); 62 }, 63 complete: function() { 64 jQuery("#loader").hide(); 65 }, 66 error: function() { 67 html = 68 '<div class="spa_review_border whitebg padding">Some thing went wrong!</div>'; 69 jQuery("#spa_response").append(html); 70 } 71 }); 72} 73 74if (jQuery('div[data-type="spa/spa-render"]').hasClass("is-selected")) { 75 spa_ajax_main_response(0, "newest"); 76} 77 78jQuery(document).on("change", "#review_page", function() { 79 const page = jQuery(this).val(); 80 const short = jQuery("#review_short").val(); 81 spa_ajax_main_response(page, short); 82}); 83 84jQuery(document).on("change", "#review_short", function() { 85 const short = jQuery(this).val(); 86 jQuery("#review_page").val("0"); 87 spa_ajax_main_response(0, short); 88}); 89 90function product_rating(Product) { 91 let product_setisfaction = ""; 92 for (let i = 1; i <= 5; i++) { 93 if (i <= Product) { 94 product_setisfaction = 95 product_setisfaction + '<span class="fa fa-window-minimize checked"/>'; 96 } else { 97 product_setisfaction = 98 product_setisfaction + '<span class="fa fa-window-minimize"/>'; 99 } 100 } 101 return product_setisfaction; 102} 103function customer_rating(CustomerService) { 104 let services = ""; 105 for (let i = 1; i <= 5; i++) { 106 if (i <= CustomerService) { 107 services = services + '<span class="fa fa-window-minimize checked"/>'; 108 } else { 109 services = services + '<span class="fa fa-window-minimize"/>'; 110 } 111 } 112 return services; 113} 114 115/** 116 * @return {string} 117 */ 118function referral_rating(Referral) { 119 let referral_r = ""; 120 for (let i = 1; i <= 5; i++) { 121 if (i <= Referral) { 122 referral_r = referral_r + '<span class="fa fa-window-minimize checked"/>'; 123 } else { 124 referral_r = referral_r + '<span class="fa fa-window-minimize"/>'; 125 } 126 } 127 return referral_r; 128};
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.