1jQuery(function($) { 2 var canBeLoaded = true; 3 $(".btn-shop-loadmore").click(function() { 4 // AJAX 5 6 var button = $(this), 7 data = { 8 action: "blogloadmore", 9 query: blog_loadmore_params.posts, 10 page: parseInt(blog_loadmore_params.current_page) + 1, 11 12 }; 13 14 if (canBeLoaded == true && $("#product-container").length) { 15 var counter = parseInt(blog_loadmore_params.current_page) + 1; 16 var countItem = $("#product-container .item").length; 17 var dataValue= $("#product-container").data('value'); 18 var ItemValue = $(".item-count").length; 19 20 21 22 23 $.ajax({ 24 url: blog_loadmore_params.ajaxurl, 25 data: data, 26 type: 'POST', 27 beforeSend: function(xhr) { 28 button.text('Loading...'); 29 30 31 canBeLoaded = false; 32 }, 33 34 success: function(response) { 35 if (response.success) { 36 button.text('Load More'); 37 var count = 0; 38 var html = ""; 39 40 $(response.data.post).each(function(i, v) { 41 var trimDescColomn = v.post_desc.replace('Product Description:',''); 42 var trimDesc = trimDescColomn.replace('Product Description',''); 43 44 count++; 45 ItemValue++; 46 47 html += '<div class="item on-sale item-count" data-value="' + count + '" id="item-val">'; 48 if (v.post_sale == true) { 49 html += '<div class="sale-banner">Item on Sale!</div>'; 50 } 51 html += '<div class="item-img">'; 52 if(v.post_featured_image){ 53 html += '<a href="' + v.permalink + '"><img src="' + v.post_featured_image + '" alt="' + v.post_title + '"></a>'; 54 }else{ 55 html += '<a href="' + v.permalink + '"><img src="' + v.post_placeholder + '/images/product-placeholder.jpg" alt="Product Image Placeholder"></a>'; 56 } 57 html += '</div>'; 58 html += '<div class="item-body">'; 59 html += '<a href="' + v.permalink + '" class="item-name">' + v.post_title + '</a>'; 60 html += '<p class="item-desc">' + trimDesc + '</p>'; 61 html += '<div class="price-con">'; 62 // html += '<div class="left">'; 63 // html += '<div class="item-no">Item# <span>' + v.post_id + '</span></div>'; 64 // if (v.post_sale == true) { 65 // html += '<div class="price">' +/* v.post_price + */'</div>'; 66 // } else { 67 68 // html += '<div class="price" style="color: orange;">' +/* v.post_price + */ '</div>'; 69 70 // } 71 // html += '</div>'; 72 html += '<div class="right">'; 73 if (v.post_external) { 74 html += '<a href="' + v.post_external_link + '" class="woocommerce-LoopProductImage-link shop-btn" rel="nofollow">'; 75 } else { 76 77 html += '<a href="' + v.permalink + '" class="shop-btn" rel="nofollow">'; 78 79 } 80 html += '<i class="fas fa-arrow-right"></I>'; 81 html += '<span>Check Latest Price</span>'; 82 html += '</a>'; 83 html += '</div>'; 84 html += '</div>'; 85 html += '</div>'; 86 html += '</div>'; 87 88 }); 89 90 91 92 $("#product-container").append(html); 93 94 95 canBeLoaded = true; 96 //if total item value loop + offset is equals to the total products published 97 //button will hide 98 if ( (ItemValue + 6) >= dataValue ) { 99 100 button.hide(); 101 102 103 } 104 105 106 107 } else { 108 //do nothing 109 } 110 111 blog_loadmore_params.current_page++; 112 } 113 }); 114 } 115 }); 116 }); 117
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.