1$(document).ready(function() { 2 function refreshHeaderBasketCounter() { 3 if (window.BX && BX.onCustomEvent) { 4 BX.onCustomEvent(window, 'OnBasketChange'); 5 } 6 for (var key in window) { 7 if (!Object.prototype.hasOwnProperty.call(window, key)) continue; 8 if (!/^bx_basket/.test(key)) continue; 9 var basket = window[key]; 10 if (basket && typeof basket.refreshCart === 'function') { 11 basket.refreshCart({}); 12 } 13 } 14 } 15 16 // ÐобавлÑем обÑабоÑÑик ÑобÑÑÐ¸Ñ ÐºÐ»Ð¸ÐºÐ° на ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ñ ÐºÐ»Ð°ÑÑом custom-label 17 $('.custom-label').on('click', function() { 18 // УÑÑанавливаем задеÑÐ¶ÐºÑ Ð² 1,5 ÑекÑÐ½Ð´Ñ (1500 миллиÑекÑнд) 19 setTimeout(function() { 20 // ÐмиÑиÑÑем клик по ÑлеменÑÑ Ñ id set_filter 21 $('#set_filter').click(); 22 }, 1500); // 1500 миллиÑекÑнд 23 }); 24 function refreshBasketHeaderFromPage() { 25 refreshHeaderBasketCounter(); 26 $.ajax({ 27 type: 'get', 28 url: location.pathname, 29 dataType: 'html', 30 success: function(data){ 31 var $doc = $(data); 32 $('.bx-basket').each(function (i) { 33 var $src = $doc.find('.bx-basket').eq(i); 34 var h = $src.find('.header__btn-count').html(); 35 if (h !== undefined) { 36 $(this).find('.header__btn-count').html(h); 37 } 38 var dc = $src.find('.button-round[data-count]').attr('data-count'); 39 if (dc !== undefined) { 40 $(this).find('.button-round[data-count]').attr('data-count', dc); 41 } 42 }); 43 setTimeout(refreshHeaderBasketCounter, 120); 44 setTimeout(refreshHeaderBasketCounter, 450); 45 } 46 }); 47 } 48 49 $(document).on('click', '.body-selection__custom-table .circle-cart',function(e) { 50 e.preventDefault(); 51 var quantity = $(this).parents('tr').find('[data-quantity-number]').text(); 52 var id = $(this).parents('tr').attr('data-id'); 53 var url = $(this).parents('tr').find('a[href]').attr('href'); 54 $.ajax({ 55 type: 'POST', 56 url: url + '?action=ADD2BASKET&id='+id, 57 data: { 58 ajax_basket: 'Y', 59 quantity: quantity, 60 "prop[0]": '0' 61 } 62 }).done(refreshBasketHeaderFromPage); 63 }); 64 65 function syncProductOfferTitle($root) { 66 var name = $root.find('.product-offers__select option:selected').text(); 67 if (!name) { 68 return; 69 } 70 $root.closest('.mini-cart, .list-item, .card-product, .product__item, [data-entity="item"]') 71 .find('.mini-cart__name, .card-product-title, .product__item-title') 72 .first() 73 .text(name); 74 } 75 76 function initProductOffersSelects(root) { 77 if (typeof select_init !== 'function') { 78 return; 79 } 80 var nodes = (root || document).querySelectorAll('.product-offers__select'); 81 for (var i = 0; i < nodes.length; i++) { 82 if (nodes[i].closest('.select')) { 83 continue; 84 } 85 select_init(nodes[i]); 86 } 87 $(root || document).find('.product-offers').each(function() { 88 syncProductOfferTitle($(this)); 89 }); 90 } 91 92 initProductOffersSelects(); 93 if (window.BX && BX.addCustomEvent) { 94 BX.addCustomEvent('onAjaxSuccess', function() { 95 initProductOffersSelects(); 96 }); 97 } 98 99 $(document).on('change', '.product-offers__select', function() { 100 var $select = $(this); 101 var $root = $select.closest('.product-offers'); 102 var $option = $select.find('option:selected'); 103 var article = $option.attr('data-article') || ''; 104 var price = $option.attr('data-price') || ''; 105 var minQty = parseFloat($option.attr('data-min-qty')) || 1; 106 var canBuy = $option.attr('data-can-buy') === '1'; 107 var id = $option.val(); 108 109 var $article = $root.find('.product-offers__article'); 110 if (article) { 111 $article.text('ÐÑÑ.: ' + article).prop('hidden', false); 112 } else { 113 $article.text('').prop('hidden', true); 114 } 115 116 syncProductOfferTitle($root); 117 118 var status = $option.attr('data-status') || ''; 119 var statusIcon = $option.attr('data-status-icon') || ''; 120 $root.find('.product-offers__status-text').text(status); 121 if (statusIcon) { 122 $root.find('.product-offers__status-icon').attr('src', statusIcon); 123 } 124 125 $root.find('.product-offers__price').html($root.hasClass('product-offers--discontinued') ? ' ' : price); 126 $root.find('.product-offers__controls').attr('data-id', id); 127 128 var $input = $root.find('.product-offers__counter-input'); 129 $input.attr('min', minQty).val(minQty); 130 131 var $cart = $root.find('[data-pcard-offer-basket]'); 132 if (canBuy) { 133 $cart.prop('hidden', false); 134 } else { 135 $cart.prop('hidden', true); 136 } 137 }); 138 139 $(document).on('click', '.pcard__buy-option [data-pcard-qty], .product-offers [data-
139pcard-qty]', function(e) { 140 e.preventDefault(); 141 var $option = $(this).closest('.pcard__buy-option, .product-offers'); 142 var $input = $option.find('.pcard__buy-counter-input, .product-offers__counter-input'); 143 var min = parseFloat($input.attr('min')) || 1; 144 var delta = parseInt($(this).attr('data-pcard-qty'), 10) || 0; 145 var value = (parseFloat($input.val()) || min) + delta; 146 if (value < min) { 147 value = min; 148 } 149 $input.val(value); 150 }); 151 152 $(document).on('click', '[data-pcard-offer-basket]', function(e) { 153 e.preventDefault(); 154 var $root = $(this).closest('.pcard__buy-option, .product-offers'); 155 var id = $root.find('.product-offers__controls').attr('data-id') || $root.attr('data-id'); 156 if (!id) { 157 return; 158 } 159 var quantity = $root.find('.pcard__buy-counter-input, .product-offers__counter-input').val() || 1; 160 var basketUrl = $root.attr('data-url') || location.pathname; 161 $.ajax({ 162 type: 'POST', 163 url: basketUrl + (basketUrl.indexOf('?') >= 0 ? '&' : '?') + 'action=ADD2BASKET&id=' + id, 164 data: { 165 ajax_basket: 'Y', 166 quantity: quantity, 167 'prop[0]': '0' 168 } 169 }).done(refreshBasketHeaderFromPage); 170 }); 171 172 $('.bim-search__input').on('keyup', function() { 173 var value = $(this).val().toLowerCase(); // ÐолÑÑаем знаÑение из Ð¿Ð¾Ð»Ñ Ð²Ð²Ð¾Ð´Ð° 174 $('.bim-items .bim-item').filter(function() { 175 // ФилÑÑÑÑем ÑлеменÑÑ Ð¿Ð¾ имени и аÑÑикÑÐ»Ñ 176 var name = $(this).data('name').toLowerCase(); 177 var artikul = $(this).data('artikul').toString(); 178 $(this).toggle(name.includes(value) || artikul.includes(value)); 179 }); 180 }); 181 182 $('.mod_search').on('click',function(e) { 183 e.preventDefault(); 184 $('.show_search').show(); 185 }); 186 187 // СкÑÑваем блок поиÑка пÑи клике вне его, но не пÑи клике на вÑпадаÑÑий ÑпиÑок 188 $(document).on('click', function(e) { 189 var $target = $(e.target); 190 var $showSearch = $('.show_search'); 191 var $searchDrop = $('.header__search-drop'); 192 193 // Ðе ÑкÑÑваем еÑли клик по кнопке оÑкÑÑÑÐ¸Ñ Ð¿Ð¾Ð¸Ñка 194 if ($target.closest('.mod_search').length > 0) { 195 return; 196 } 197 198 // Ðе ÑкÑÑваем еÑли клик по ÑÐ°Ð¼Ð¾Ð¼Ñ Ð±Ð»Ð¾ÐºÑ Ð¿Ð¾Ð¸Ñка или его ÑодеÑÐ¶Ð¸Ð¼Ð¾Ð¼Ñ 199 if ($target.closest('.show_search').length > 0) { 200 return; 201 } 202 203 // Ðе ÑкÑÑваем еÑли клик по вÑпадаÑÑÐµÐ¼Ñ ÑпиÑÐºÑ ÑезÑлÑÑаÑов 204 if ($target.closest('.header__search-drop').length > 0) { 205 return; 206 } 207 208 // СкÑÑваем блок поиÑка 209 $showSearch.hide(); 210 }); 211 212 $('.has-sub').on('click',function(e) { 213 if($(this).hasClass('active')) { 214 return true; 215 } 216 217 e.preventDefault(); 218 219 $('.mob-menu__wrapper .sub').removeClass('show'); 220 $(this).next().toggleClass('show'); 221 222 $('.has-sub').removeClass('active'); 223 $(this).addClass('active'); 224 225 if($(this).next().hasClass('show')) { 226 $('.mob-menu__wrapper').addClass('clicked'); 227 } 228 }); 229 230 // ФÑнкÑÐ¸Ñ Ð¿ÑовеÑки Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ÑÑи кнопки "ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ" 231 function checkCollapseButton() { 232 $('.collapse-toggle').each(function() { 233 var $button = $(this); 234 var $textCollapse = $button.siblings('.text-collapse'); 235 var $textCollapseContent = $textCollapse.find('.text-collapse-content'); 236 237 // ÐÑеменно ÑбиÑаем огÑаниÑÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð¸Ð·Ð¼ÐµÑÐµÐ½Ð¸Ñ Ð¿Ð¾Ð»Ð½Ð¾Ð¹ вÑÑоÑÑ 238 $textCollapse.removeClass('collapsed'); 239 $textCollapse.css('height', 'auto'); 240 241 var contentHeight = $textCollapseContent[0].scrollHeight; 242 243 if (contentHeight <= 182) { 244 // ÐонÑÐµÐ½Ñ Ð¿Ð¾Ð¼ÐµÑаеÑÑÑ Ð² 182px - ÑкÑÑваем ÐºÐ½Ð¾Ð¿ÐºÑ 245 $button.hide(); 246 $textCollapse.removeClass('collapsed'); 247 $textCollapse.css('height', 'auto'); 248 } else { 249 // ÐонÑÐµÐ½Ñ Ð±Ð¾Ð»ÑÑе 182px - показÑваем ÐºÐ½Ð¾Ð¿ÐºÑ Ð¸ ÑвоÑаÑиваем 250 $button.show(); 251 $textCollapse.addClass('collapsed'); 252 $textCollapse.css('height', '182px'); 253 } 254 }); 255 } 256 257 // ÐÑовеÑÑем пÑи загÑÑзке ÑÑÑаниÑÑ 258 checkCollapseButton(); 259 260 // ÐбÑабоÑÑик Ð´Ð»Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ "ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ" 261 $('.collapse-toggle').on('click', function(e) { 262 e.preventDefault(); 263 264 var $button = $(this); 265 var $textCollapse = $button.siblings('.text-collapse'); 266 var $span = $button.find('span'); 267 268 if ($textCollapse.hasClass('collapsed')) { 269 // РаÑкÑÑваем ÑекÑÑ 270 $textCollapse.removeClass('collapsed'); 271 var fullHeight = $textCollapse[0].scrollHeight; 272 $textCollapse.css('height', fullHeight + 'px'); 273 274 setTimeout(function() { 275 $textCollapse.css('height', 'auto'); 276 }, 300); 277 278 $button.removeClass('collapsed'); 279 $span.text('СвеÑнÑÑÑ'); 280 } else { 281 // СвоÑаÑиваем ÑекÑÑ 282 $textCollapse.css('height', '182px'); 283 284 setTimeout(function() { 285 $textCollapse.addClass('collapsed'); 286 }, 10); 287 288 $button.addClass('collapsed'); 289 $span.text('ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ'); 290 } 291 }); 292 293 294 // new homepage slider 295 var sliderCreative = new Swiper('.slider-creative', { 296 grabCursor: true, 297 speed: 900, 298 loop: true, 299 effect: 'creative', 300 creativeEffect: { 301 prev: { 302 shadow: true, 303 translate: ['-20%', 0, -1], 304 }, 305 next: { 306 translate: ['100%', 0, 0], 307 }, 308 shadowPerProgress: true 309 }, 310 navigation: { 311 prevEl: '.slider-btns__item--prev', 312 nextEl: '.slider-btns__item--next', 313 }, 314 }); 315 316 317 // add to cart effect
318 function addToCartEffect(event) { 319 var clickCoords = { x: event.clientX, y: event.clientY }; 320 var dot = document.createElement('div'); 321 var cart = $('.bx-basket')[0]; 322 var cartCoords = cart.getBoundingClientRect(); 323 console.log(cartCoords); 324 325 dot.className = 'cart-dot'; 326 327 dot.style.left = clickCoords.x + 'px'; 328 dot.style.top = clickCoords.y + 'px'; 329 330 document.body.appendChild(dot); 331 332 requestAnimationFrame(function() { 333 dot.style.left = cartCoords.left + cartCoords.width / 2 + 'px'; 334 dot.style.top = cartCoords.top + cartCoords.height / 2 + 'px'; 335 }); 336 337 dot.addEventListener('transitionend', () => { 338 dot.remove(); 339 }, { once: true }); 340 } 341 342 $(document).on( 343 'click', 344 '.mini-cart__add-cart, .product-item-detail-buy-button, .product__item-cart, .body-selection__custom-table .circle-cart', 345 addToCartEffect 346 ); 347 348 $('.academy-events__list').slick({ 349 slidesToShow: 3, 350 responsive: [ 351 { 352 breakpoint: 1280, 353 settings: { 354 slidesToShow: 2, 355 }, 356 }, 357 { 358 breakpoint: 768, 359 settings: { 360 slidesToShow: 1, 361 }, 362 }, 363 ] 364 }); 365 366 $('body').on('click', '.ez-tabs__button', function() { 367 $('.academy-events__list').slick('setPosition'); 368 }); 369 370 $('.cards__item-media-slider').slick({ 371 arrows: false, 372 dots: true, 373 }); 374});
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.