PageSourceSearch

https://www.skm-mebel.ru/local/templates/aspro_next_modify/js/custom.js

js skm-mebel.ru collected 2026-10-06 04:41:31 UTC 28,300 bytes, 784 lines download raw bytes

1// Функция для получения поддомена из URL
2function getRegionIdFromUrl() {
3  const url = window.location.hostname;
4  const subdomain = url.split('.')[0]; // Получаем поддомен
5
6  if (subdomain === 'www') {
7    return 'ekb'; // Если поддомен 'www', заменяем на 'ekb'
8  }
9  return subdomain;
10}
11
12// Добавляем атрибут в DOM
13const regionId = getRegionIdFromUrl();
14document.body.setAttribute('data-region_id', regionId);
15
16// Определяем переменную в глобальной области видимости
17window.region_id = getRegionIdFromUrl();
18
19document.querySelectorAll(".remove_ajax").forEach((function (elem) {
20    elem.removeAttribute('onclick');
21}));
22window.wishList = function(arWish){
23    if(arWish) {
24        arWish.forEach((element) => {
25                let wish = document.querySelectorAll('[data-item="' + element + '"]')
26                wish.forEach((elem) => {
27                    if (elem) {
28                        elem.classList.add('in-favorite')
29                    }
30                })
31            }
32        );
33    }
34}
35
36
37/*
38You can use this file with your scripts.
39It will not be overwritten when you upgrade solution.
40*/
41$(document).on('ready', function(){
42  $('.popup-close').click(function() {
43    $(this).closest('.popup').removeClass('active');
44    $("body, html").removeClass('overflow');
45  });
46  $(document).on('click', '[data-popup]', function() {
47    const popupId = $(this).data('popup');
48    $('#' + popupId).addClass('active');
49    $("body, html").addClass('overflow');
50});
51	$('.inner_wrapper .to-cart span').text('В корзину');
52	$('.inner_wrapper .in-cart span').text('В корзине');
53	$('.wrapper_inner .to-cart span').text('В корзину');
54	$('.wrapper_inner .in-cart span').text('В корзине');
55
56	$("a[data-href]").each(function() {
57		const href = $(this).data("href")
58		$(this).attr("href", href).attr("data-href", "")
59	})
60
61	/*if ($.cookie('whatsapp-modal') == null) {
62		$modal = $('.js-whatsapp-modal');
63		$modalClsBtn = $('.js-whatsapp-modal-close');
64
65		$modal.removeClass('whatsapp-modal--hide');
66		$modalClsBtn.on('click', function() {
67			$modal.addClass('whatsapp-modal--hide');
68			$.cookie('whatsapp-modal', true, { expires: 365 });
69		});
70	}*/
71
72	if($('.city-select-popup').length) {
73		$('.city-select-popup .city-select-popup__close').click(function(){
74			$('.city-select-popup').remove();
75			$.ajax({
76				url: arNextOptions['SITE_DIR'] + 'ajax/set_region_closer.php',
77				type: 'POST',
78				success: function(html) {
79					console.log('Hide region popup: ' + html);
80				}
81			});
82		})
83	}
84
85	//Добавляем кнопку прокрутки в меню
86	if($('.menu-row .mega-menu table td.wide_menu.catalog .wrap .dropdown-menu .dropdown-submenu').length > 4 && $(window).width() > 1200) {
87		$('.menu-row .mega-menu table td.wide_menu.catalog .wrap').append('<div class="menu-more-sections">Еще категории</div>');
88		button = $('.menu-more-sections');
89		menuWidth = $('.menu-row .mega-menu table td.wide_menu.catalog .wrap .dropdown-menu').width();
90		menuHeight = 485;
91		buttonPositionX = (menuWidth / 2) - button.width();
92		buttonPositionY = menuHeight - button.height();
93		button.css({'top': buttonPositionY,'left': buttonPositionX});
94	}
95
96	//Показываем/прячем кнопку прокрутки
97	$('.menu-row .mega-menu table td.wide_menu.catalog .wrap .dropdown-menu').scroll(function() {
98		if (this.scrollHeight - this.scrollTop === this.clientHeight) {
99	    	button.css('display', 'none');
100	    } else {
101	    	button.css('display', 'block');
102	    }
103	});
104	$('.menu-row .mega-menu table td.wide_menu.catalog').on('mouseenter', function() {
105		button.css('display', 'block');
106		$('.menu-row .mega-menu table td.wide_menu.catalog .wrap .dropdown-menu').animate({scrollTop: 0}, 50);
107	});
108	$('.menu-row .mega-menu table td.wide_menu.catalog').on('mouseleave', function() {
109		button.css('display', 'none');
110	});
111
112	//Прокрутка к концу блока
113	$('.menu-more-sections').on('click', function() {
114		$('.menu-row .mega-menu table td.wide_menu.catalog .wrap .dropdown-menu').animate({scrollTop: $('.menu-row .mega-menu table td.wide_menu.catalog .wrap .dropdown-menu').prop('scrollHeight')}, 800);
115	});
116
117	// открытие фильтра в каталоге на мобильных устройствах begin
118	if(window.matchMedia('(max-width: 991px)').matches) {
119		$(document).on('click', '.filter_opener', (function () {
120			$(this).toggleClass('opened'),
121			$('#content .wrapper_inner .left_block > *').slideToggle(333);
122		}));
123		$('#set_filter').on('click', (function () {
124			console.log('CLICK2!');
125			// $('.filter_opener').toggleClass('opened');
126			$('#content .wrapper_inner .left_block >
126 *').slideUp(333);
127			
128			document.querySelector('body').classList.remove('filter-opened');
129		}));
130	}
131	// открытие фильтра в каталоге на мобильных устройствах end
132	
133	if ($('.bottom_nav .module-pagination').length) {
134  		$(window).scroll(function() {
135			let navElem = $('.bottom_nav .module-pagination');
136	  		let scroll = $(window).scrollTop();
137			let endcheck  = $('.bottom_nav:last').offset().top - $(window).height();
138	  		if (scroll < endcheck) {
139	  		    $(navElem).addClass('_fixed');
140	  		} else {
141	  		    $(navElem).removeClass('_fixed');
142	  		}
143  		});
144		
145		// lazyLoadPagenBlock();
146  	}
147
148    const headerPhoneLink = document.querySelector('.header__phone-link')
149    const headerPhone = document.querySelector('.header__phone-wrap a')
150
151    if(headerPhoneLink) {
152        headerPhoneLink.addEventListener('click', () => {
153            headerPhone.click()
154        })
155    }
156
157	if($('input[name="licenses_order"]').length > 0){
158		$('input[name="licenses_order"]').attr('checked', 'checked');
159		console.log('licenses_order');
160
161}
162    if (window.location.href.substring(0, 33) == 'https://chelyabinsk.skm-mebel.ru/') {
163        document.querySelector('.footer .social-icon_vk').href = 'https://vk.com/skmmebel_chelyabinsk'
164    }
165
166    $(".js-copy-share-link").on("click", function(){
167        event.preventDefault()
168        
169        $.ajax({
170            url: '/ajax/basket/basket_share.php',
171            dataType: 'json',
172            type: 'GET',
173            success: function(data) {
174                if(data.ok) {
175                    const link = window.location.origin + data.link
176                    const header = $(".header")
177                    const noticeCss = "article-copy-notification-showed"
178
179                    if(navigator.clipboard) {
180                        navigator.clipboard.writeText(link)
181
182                        $(".article-copy-notification__text").text("Ссылка скопирована")
183
184                        header.addClass(noticeCss)
185                        setTimeout(() => header.removeClass(noticeCss), 1800);
186                    }
187                    
188                }
189            }
190        });
191    })
192
193    $(document).on("change", ".js-toggle-service", function() {
194        const block = $(this).closest(".service-wrapper")
195        const id = block.data("service-id")
196        const productId = block.data("for-product-id")
197        const counter = block.find(".counter-service")
198        let qty = block.find(".counter-value").val()
199        if(qty < 1) {
200            qty = 1
201        }
202
203        updateServices = $(this).data("update-services")
204
205        if($(this).prop("checked")){
206            $.ajax({
207                url: "/ajax/services/addToBasket.php",
208                data: {id: id, qty: qty, for_product: productId},
209                dataType: "json",
210                type: "POST",
211                success:function(data){
212
213                    if(updateServices) {
214                        loadServices(productId)
215                    }
216                    
217                    refreshBasket()   
218
219                    counter.removeClass('disabled')
220
221                    otherBlocks = $(`[data-service-id='${id}'][data-product-id='${productId}']`)
222                    otherBlocks.each(function(){
223                        $(this).find(".js-toggle-service").prop("checked", true)
224                        $(this).find(".counter-service").removeClass('disabled')
225                        $(this).find(".counter-value").val(qty)
226                    })
227
228                },
229                error: function(xhr, status, error) {
230                    console.error(error);
231                }
232            });
233
234        } else {
235            updateServiceQuantity(id, productId, 0, {"update-services" : updateServices});
236            counter.addClass('disabled')
237        }
238    })
239
240});
241
242function refreshBasket() {
243    if(typeof(BX.Sale) !== 'undefined' && typeof BX.Sale.BasketComponent !== 'undefined') {
244        BX.Sale.BasketComponent.sendRequest('refreshAjax', {fullRecalculation: 'Y'});    
245    } 
246}
247
248function updateServiceQuantity(id, productId, value, params) {
249    $.ajax({
250        url: "/ajax/services/basketUpdate.php",
251        data: {id: id, productId: productId, count: value},
252        dataType: "json",
253        type: "POST",
254        success: function(data){
255
256            refreshBasket()            
257
258            blocks = $(`[data-service-id='${id}'][data-for-product-id='${productId}']`)
259            blocks.each(function(){
260                $(this).find(".js-toggle-service").prop("checked", value > 0)
261                if(value > 0) {
262                    $(this).find(".counter-service").removeClass('disabled')
263                } else {
264                    $(this).find(".counter-service").addClass('disabled')
265                }
266                
267                $(this).find(".counter-value").val(value > 0 ? value : 1)
268            })
269
270            if(params && params["update-services"]) {
271                loadServices(productId)
272            }
273        }
274    });
275}
276
277function loadServices(id) {
278    const area = $(".area-load-services")
279    
280    if(!area.length) {
281        return
282    }
283
284    $.ajax({
285        url: "/ajax/services/getServices.php",
286        type: "POST",
287        data: {id},
288        dataType: "html",
289        success: function(html){
290            $(".area-load-services").html(html)
291            initServicesCounters()
292        }
293    });
294}
295
296function loadServicesInfo() {
297    $.ajax({
298        url: "/ajax/services/getInfo.php",
299        type: "POST",
300        dataType: "json",
301        success: function(data){
302            data.services_items.forEach(item => {
303                blocks = $(`[data-service-id='${item.service_id}'][data-for-product-id='${item.for_product_id}']`)
304                blocks.each(function(){
305                    $(this).find(".js-toggle-service").prop("checked", true)
306                    $(this).find(".counter-service").removeClass('disabled')
307                    $(this).find(".counter-value").val(item.quantity)
308                })
309            })
310
311            initServicesCounters()
312        }
313    });
314}
315
316function initServicesCounters() {
317    const counters = document.querySelectorAll(".counter-service:not(.init)");
318
319    const debounceUpdateService = debounce(updateServiceQuantity, 500)
320
321    if (counters) {
322        counters.forEach((counter) => {
323            const inputMinus = counter.querySelector('.counter__minus');
324            const inputPlus = counter.querySelector('.counter__plus');
325            const inputText = counter.querySelector('.counter-value');
326
327            counter.classList.add("init")
328            const block = counter.closest('.service-wrapper')
329
330            const id = block.dataset.serviceId
331            const productId = block.dataset.forProductId
332
333            inputMinus.addEventListener('click', (e) => minus(e));
334            inputPlus.addEventListener('click', (e) => plus(e));
335            inputText.addEventListener('change', (e) => input(e));
336
337            function minus(e) {
338                const value = parseInt(inputText.value.match(/[0-9]+/)[0]);
339                const newValue = value - 1;
340
341                if(block.querySelector('.counter-service').classList.contains('disabled')) {
342                    return false;
343                }
344
345                debounceUpdateService(id, productId, newValue)
346
347                if (newValue > 0) {
348                    inputText.value = newValue;
349                } else {
350                    document.querySelectorAll(`.service-wrapper[data-service-id='${id}'][data-for-product-id='${productId}']`).forEach(item => {
351                        item.querySelector('.js-toggle-service').checked = false
352                        item.querySelector('.counter-service').classList.add('disabled')
353                    });
354                    
355                    document.querySelector(".cart-value").innerText = Math.max(0, document.querySelector(".cart-value").innerText - 1);
356                }
357            }
358            function plus(e) {
359                const value = parseInt(inputText.value.match(/[0-9]+/)[0]);
360                const newValue = value + 1;
361
362                if(block.querySelector('.counter-service').classList.contains('disabled')) {
363                    return false;
364                }
365
366                debounceUpdateService(id, productId, newValue)
367
368                inputText.value = newValue;
369            }
370            function input(e) {
371                const value = parseInt(inputText.value.replace(/[^\d]/g, '')) || 0
372                inputText.value =  value
373
374                if(block.querySelector('.counter-service').classList.contains('disabled')) {
375                    return false;
376                }
377
378                updateServiceQuantity(id, productId, value)                
379                
380                if (value > 0) {
381                    inputText.value = value;
382                } else {
383                    inputText.value = 1;
384
385                    document.querySelectorAll(`.to-cart[data-item='${id}']`).forEach(button => {
386                        button.classList.remove("in-basket");
387                        button.style.display = '';
388                    });
389                    document.querySelectorAll(`.counter[data-item='${id}']`).forEach(counter => {
390                        counter.style.display = 'none';
391                    });
392                }            
393            }
394        });
395    }
396}
397
398
399function debounce(func, ms) {
400  let timeout;
401  return function() {
402    clearTimeout(timeout);
403    timeout = setTimeout(() => func.apply(this, arguments), ms);
404  };
405}
406
407//const debounceUpdate = debounce(updateBasketQuantity, 500)
408
409
410
411
412
413function moreNews(buttonMore){
414    $.get('', function(data) {
415        let hideItems = document.querySelectorAll(".more_news")
416
417        for (let i = 0; i < 9; i++) {
418            if(hideItems[i]) {
419                hideItems[i].classList.remove("more_news")
420            }
421        }
422        let CountHideItems = document.querySelectorAll(".more_news")
423        if(CountHideItems.length==0){
424            buttonMore.style.display = 'none'
425        }
426    });
427}
428
429$('.js-popup-opener').click(function () {
430
431    const formCode = $(this).data('form-code')
432
433    const formType = $(this).data('target')
434
435    const backurl = $(this).data('backurl')
436
437    const wrapper = $('.wrapper1')
438
439    let url = `/ajax/form.php?formType=${formType}&formCode=${formCode}`
440
441
442    //if (backurl) { url += `&backurl=${backurl}` }
443
444
445    $.ajax({
446        url: url,
447        type: 'GET',
448        dataType: 'html',
449        success: function (result)
450        {
451            const formHTML = $(result)
452
453            wrapper.append(formHTML)
454
455            window.addPhoneMask()
456            window.customSelectsInit()
457            window.validateForms()
458
459
460            /* formHTML.find('button.button.popup__button').on('click', function () {
461                const formData = $('.standart-form').serialize();
462
463                const formDataArray = $('.standart-form').serializeArray();
464
465                const formId = $('.standart-form').attr('id')
466
467                let isLoginAccount = false
468
469
470                if (formType == 'lk-popup') { isLoginAccount = true }
471
472                sendFormResult(formId, formData, isLoginAccount)
473            }) */
474
475
476            document.querySelectorAll('.js-popups-close').forEach((elem) => {
477                elem.addEventListener("click", (e) => {
478                    document.querySelectorAll('.js-opened').forEach((close) 
478=> {
479                        close.classList.remove('js-opened')
480                        document.querySelector('.site_s1').classList.remove('js-scroll-locked')
481                    })
482                })
483            })
484
485        },
486        error: function (xhr, status, error)
487        {
488            console.error(error);
489        }
490    })
491
492})
493
494
495function sendFormResult(formId, formData, isLoginAccount)
496{
497    let url
498
499    if (isLoginAccount) {
500        url = '/auth/?login=yes'
501
502        formData += `&USER_PHONE_NUMBER=${$('.popup .input-block__input.phone-mask').val()}&AUTH_FORM=Y&POPUP_AUTH=Y&Login=Получить код`
503    }
504    else {
505        url = '/ajax/form.php'
506
507        formData += `&WEB_FORM_ID=${formId}&AJAX_CALL=Y&licenses_popup=Y&web_form_submit=Отправить`
508    }
509
510
511
512    $.ajax({
513        url: url,
514        type: 'POST',
515        data: formData,
516        dataType: 'html',
517        success: function (result)
518        {
519            console.log(result)
520        },
521        error: function (xhr, status, error)
522        {
523            console.error(error);
524        }
525    })
526}
527/*$('.catalog-detail__buttons').bind("DOMSubtreeModified",function(){
528    let buyButton = document.querySelector('.catalog-detail__button')
529    let quantity = document.querySelector('.value_counter').innerHTML
530    buyButton.dataset.quantity = quantity
531});*/
532
533$(document).on('ajaxSuccess', function() {
534    $('.to-cart span').text('В корзину');
535    $('.in-cart span').text('В корзине');
536    $('.fast_view_block').text('Быстрый просмотр');
537});
538
539/* digiLayer */
540if(window.digiLayer === undefined) {
541    window.digiLayer = {};
542}
543window.digiLayer.cartState = function() {
544    if(typeof arBasketAspro === 'undefined') {
545        return {};
546    }
547    return arBasketAspro.BASKET_QUANTITY;
548}
549
550window.digiLayer.addToCart = function(offer_id, amount) {
551    if(amount === 0) {
552        return window.digiLayer.removeFromCart(offer_id);
553    }
554
555    var currentQty = window.digiLayer.cartState()[offer_id];
556    if(typeof currentQty !== 'undefined') {
557        return new Promise((resolve, reject) => {
558            if(typeof updateBasketQuantity === 'function') {
559                updateBasketQuantity(offer_id, amount);
560            } else {
561                $.get("/ajax/CustomProductPlusMinus.php?ID=" + offer_id + "&QUANTITY=" + amount);
562            }
563
564            document.querySelectorAll(`.counter[data-item='${offer_id}'] .counter-value`).forEach(input => {
565                input.value = amount;
566            });
567            document.querySelectorAll(`.counter[data-item='${offer_id}'] .counter__value span:first-child`).forEach(span => {
568                span.textContent = amount;
569            });
570
571            $('.to-cart[data-item='+offer_id+']').hide();
572            $('.counter[data-item='+offer_id+']').show().css('display', 'flex');
573
574            if($("#ajax_basket").length)
575                reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
576
577            resolve({ result: true });
578        });
579    }
580    
581    return new Promise((resolve, reject) => {
582        var item = offer_id;
583        var th = $('.to-cart[data-item="'+item+'"]');
584        fill_prop = {
585            prop: [0],
586            quantity: amount,
587            add_item: 'Y',
588            rid: null,
589            offers: 'N',
590            iblockID: 20,
591            part_props: 'Y',
592            add_props: 'N',
593            props: "",
594            item: offer_id,
595            basket_props: null
596        }
597        $.ajax({
598            type:"POST",
599            url:arNextOptions['SITE_DIR']+"ajax/item.php",
600            data:fill_prop,
601            dataType:"json",
602            success:function(data){    
603                getActualBasket(fill_prop.iblockID);
604                
605                var eventdata = {action:'loadForm'};
606                BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
607                arStatusBasketAspro = {};
608        
609                if(typeof data !== 'undefined' && data !==null){
610                    if("STATUS" in data){
611                        if(data.MESSAGE_EXT===null)
612                            data.MESSAGE_EXT='';
613                        if(data.STATUS === 'OK'){
614                            $('.to-cart[data-item='+item+']').hide()
615                            $('.counter[data-item='+item+']').show().css('display', 'flex')
616        
617                            if($("#ajax_basket").length)
618                                reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
619        
620                            if($("#basket_line .basket_fly").length){
621                                if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
622                                    basketFly('open', 'N');
623                                else
624                                    basketFly('open');
625                            }
626                            resolve({ result: true });
627                        }else{
628                            showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT);
629                            reject({ result: false });
630                        }
631                    }else{
632                        showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
633                        reject({ result: false });
634                    }
635                }else{
636                    if(th.length > 0){
637                        th.hide();
638                    }
639                    
640                    $('.to-cart[data-item='+item+']').hide();
641                    $('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
642                    $('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
643                    $('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
644                    // th.parent().find('.in-cart').show();
645                    $('.in-cart[data-item='+item+']').show();
646        
647                    addBasketCounter(item);
648                    $('.wish_item[data-item='+item+']').removeClass("added");
649                    $('.wish_item[data-item='+item+']').find(".value").show();
650                    $('.wish_item[data-item='+item+']').find(".value.added").hide();
651        
652                    if($("#ajax_basket").length)
653                        reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
654        
655                    if($("#basket_line .basket_fly").length)
656                    {
657                        if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
658                            basketFly('open', 'N');
659                        else
660                            basketFly('open');
661                    }
662                    resolve({ result: true });
663                }
664            },
665            error: function(xhr, status, error) {
666                console.error(error);
667                reject({ result: false });
668            }
669        });
670    });
671}
672
673window.digiLayer.removeFromCart = function(offer_id) {
674    return new Promise((resolve, reject) => {
675        var countField = document.querySelectorAll(`.counter[data-item='${offer_id}']`);
676        updateBasketQuantity(offer_id, 0);
677        reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
678
679        document.querySelectorAll(`.to-cart[data-item='${offer_id}']`).forEach(button => {
680            button.classList.remove("in-basket");
681            button.style.display = '';
682        });
683        document.querySelectorAll(`.counter[data-item='${offer_id}']`).forEach(counter => {
684            counter.style.display = 'none';
685        });
686
687        resolve({ result: true });
688    });
689}
690
691window.digiLayer.whishlistState = function() {
692    if(typeof arBasketAspro === undefined || typeof arBasketAspro.DELAY === undefined) {
693        return {};
694    }
695    return Object.keys(arBasketAspro.DELAY);
696}
697
698window.digiLayer.addToWishlist = function(offer_id) {
699    return new Promise((resolve, reject) => {
700        var item = offer_id;
701        var item2 = offer_id;
702        var iblockid = 20;
703        var val = 1;
704        var offer = 'N';
705        var props = '';
706        var th = $('.to-cart[data-item="'+item+'"]');
707        var th_wish = $('.wish_item[data-item="'+item+'"]');
708
709        $.ajax({
710            type:"GET",
711            url:arNextOptions['SITE_DIR']+"ajax/item.php",
712            data:"item="+item2+"&quantity="+val+"&wish_item=Y"+"&offers="+offer+"&iblockID="+iblockid+"&props="+JSON.stringify(props),
713            dataType:"json",
714            success: function(data){
715                if($('.wish_item[data-item=' + item + ']').hasClass('in-favorite')){
716                    $('.wish_item[data-item=' + item + ']').removeClass('in-favorite');
717                }else{
718                    $('.wish_item[data-item=' + item + ']').addClass('in-favorite');
719                }
720            
721                getActualBasket(iblockid);
722                arStatusBasketAspro = {};
723                if(data !== null){
724                    if(data.MESSAGE_EXT === null)
725                        data.MESSAGE_EXT = '';
726                    if("STATUS" in data){
727                        if(data.STATUS === 'OK'){
728                            if(arNextOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
729                                var eventdata = {goal: 'goal_wish_add', params: {id: item2}};
730                                BX.onCustomEvent('onCounterGoals', [eventdata]);
731                            }
732                            if($("#ajax_basket").length)
733                                reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
734
735                            if($("#basket_line .basket_fly").length){
736                                if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
737                                    basketFly('wish', 'N');
738                                else
739                                    basketFly('wish');
740                            }
741                            resolve({ result: true });
742                        }else{
743                            showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
744                            reject({ result: false });
745                        }
746                    }else{
747                        showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
748                        reject({ result: false });
749                    }
750                }else{
751                    if($("#ajax_basket").length)
752                        reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
753
754                    if($("#basket_line .basket_fly").length){
755                        if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
756                            basketFly('wish', 'N');
757                        else
758                            basketFly('wish');
759                    }
760                    resolve({ result: true });
761                }
762            },
763            error: function(xhr, status, error) {
764                console.error(error);
765                reject({ result: false });
766            }
767        });
768    });
769}
770
771window.digiLayer.removeFromWishlist = function(offer_id) {
772    return window.digiLayer.addToWishlist(offer_id);
773}
774
775/* digiLayer */
776
777if (typeof BX !== 'undefined' && typeof BX.addCustomEvent === 'function') {
778    BX.addCustomEvent('onAjaxSuccessFilter', function() {
779        var isMobileGalleryViewport = window.matchMedia && window.matchMedia('(max-width: 480px)').matches;
780        if (isMobileGalleryViewport && typeof initProductGallerySwiper === 'function') {
781            initProductGallerySwiper();
782        }
783    });
784}

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.