1(function () { 2 3 window.update_small_basket = function () { 4 5 document.querySelectorAll('.compare__add-cart').forEach(button => { 6 button.addEventListener('click', () => { 7 let addedBlockCart = document.querySelector('.addedCart'); 8 addedBlockCart.classList.add('show'); 9 setTimeout(() => { 10 addedBlockCart.classList.remove('show'); 11 }, 3000); 12 }); 13 }); 14 15 let $basket_quantity = $(".basket-head-count"); 16 return function (response) { 17 18 console.log(response); 19 20 $('#cart').load('/local/ajax/mini_basket.php', { ajax: 'Y' }); // Ð¼Ð°Ð»Ð°Ñ ÐºÐ°Ñзина 21 $('.bestsellers-slider').load('/local/ajax/sections.php', { ajax: 'Y' }); // Ñ Ð¸Ñ Ð¿Ñодаж на главной 22 let element_id = $("#element_id").val(); 23 24 $('.promotion__list').load('/local/ajax/promotion.php', { ajax: 'Y', code: element_id }); // акÑии 25 26 /* 27 let sect = $("#sections").val(); 28 if (sect) { 29 $('.catalog__cards').load('/local/ajax/catalog.php', { ajax: 'Y', code: sect }); // ÑпиÑак каÑалога /local/ajax/catalog.php 30 31 } 32 let veiwed = $("#veiwed").val(); 33 if (veiwed) { 34 $('.watch-slider__wrapper').load('/local/ajax/catalog_veiw.php', { ajax: 'Y', code: veiwed }); // ÑпиÑак пÑоÑмоÑÑеннÑе ÑоваÑÑ 35 } 36 $('#favorite').load('/local/ajax/favorite.php', { ajax: 'Y' }); // избÑанное 37 38 $('#similar').load('/local/ajax/similar_products.php', { ajax: 'Y' }); // Ð¿Ð¾Ñ Ð¾Ð¶Ð¸Ðµ ÑоваÑÑ Ð½Ð° деÑалке 39 */ 40 let $basket_price = $(".basket-head-sum"); 41 let items = 0; 42 if (response.data.answer && response.data.answer.SUM) { 43 44 const sum = response.data.answer.SUM; 45 $basket_price.html(sum.PRICE + 'â½'); 46 $basket_quantity.html(response.data.answer.SUM.TOTAL_COUNT_BASKET_ITEMS); 47 $(".basket-head-count").text(response.data.answer.SUM.TOTAL_COUNT_BASKET_ITEMS); 48 $('.mobile-count-basket').text(response.data.answer.SUM.TOTAL_COUNT_BASKET_ITEMS); 49 50 } 51 let idd = response.data.answer.ITEMS[0]['id']; 52 53 54 const $card = $("[data-card=" + idd + "]"); 55 56 const $quantity = $("[data-quantity=" + idd + "]"); 57 const $minus = $("[data-minus=" + idd + "]"); 58 const $plus = $("[data-plus=" + idd + "]"); 59 60 //let $quantity_m = response.data.answer.SUM.QUANTITY-1; 61 // let $quantity_p = response.data.answer.SUM.QUANTITY+1; 62 let arr = response.data.answer.ITEMS; 63 $.each(arr, function (key, value) { 64 if (value.id == idd) { 65 let $quantity_m = value.quantity - 1; 66 let $quantity_p = value.quantity + 1; 67 console.log($quantity_m); 68 console.log($quantity_p); 69 70 if (response.data.answer.SUM.TOTAL_COUNT_BASKET_ITEMS > 0 && idd) { 71 $card.addClass('up'); 72 $quantity.html(value.quantity); 73 $minus.attr('onclick', 'window.bu_ajax.basket.update({id: ' + idd + ', quantity: ' + $quantity_m + '})'); 74 $plus.attr('onclick', "window.bu_ajax.basket.update({id: " + idd + ", quantity: " + $quantity_p + "})"); 75 } 76 if (response.data.answer.SUM.TOTAL_COUNT_BASKET_ITEMS == 0) { 77 $card.removeClass('up'); 78 } 79 } 80 }); 81 82 83 //const arrf = {response.data.answer.ITEMS}; 84 /*$.each(arrf, function(inf, valf) 85 { 86 console.log(inf + ': ' + valf); 87 }*/ 88 89 90 } 91 } 92 93 94 function update_favorite(resp) { 95 Object.keys(resp.data.answer).forEach(function (id) { 96 97 const $fav = $("[data-favid=" + id + "]"); 98 if (resp.data.answer[id]) { 99 //$fav.addClass('added'); 100 } else { 101 //$fav.removeClass('added'); 102 } 103 }) 104 bu_ajax.favorite.check(); 105 } 106 107 function update_all_favorites(resp) { 108 //data-favid 109 110 if (resp.data && resp.data.answer && Object.keys(resp.data.answer).length) { 111 $('#count-saved').text(Object.keys(resp.data.answer).length) 112 Object.values(resp.data.answer).forEach(function (id) { 113 //$("[data-favid=" + id + "]").addClass('added'); 114 }) 115 } 116 else { 117 $('#count-saved').text(Object.keys(resp.data.answer).length) 118 Object.values(resp.data.answer).forEach(function (id) { 119 //$("[data-favid=" + id + "]").removeClass('added'); 120 }) 121 } 122 123 } 124 125 function update_compare(resp) { 126 Object.keys(resp.data.answer).forEach(function (id) { 127 128 const $comp = $("[data-compid=" + id + "]"); 129 if (resp.data.answer[id]) { 130 $comp.addClass('added1'); 131 } else { 132 $comp.removeClass('added1'); 133 } 134 }) 135 bu_ajax.compar.check(); 136 } 137 138 function update_all_compares(resp) { 139 140 if (resp.data && resp.data.answer && Object.keys(resp.data.answer).length) { 141 $('#count-compare').text(Object.keys(resp.data.answer).length) 142 Object.values(resp.data.answer).forEach(function (id) { 143 $("[data-compid=" + id + "]").addClass('added1'); 144 }) 145 } 146 else { 147 $('#count-compare').text(Object.keys(resp.data.answer).length) 148 Object.values(resp.data.answer).forEach(function (id) { 149 $("[data-compid=" + id + "]").removeClass('added1'); 150 }) 151 } 152 153 } 154 155 156 157 window.bu_livecircle = { 158 update_small_basket: update_small_basket(), 159 update_favorite: update_favorite, 160 update_all_favorites: update_all_favorites, 161 update_compare: update_compare, 162 update_all_compares: update_all_compares, 163 meta: { 164 title: function (message) { 165 $("title, h1").text(message); 166 } 167 } 168 }; 169 170 171})();
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.