PageSourceSearch

https://resanta-profi.ru/local/templates/geon/js/app.js?174064795139509

js resanta-profi.ru collected 2026-10-08 10:08:43 UTC 39,509 bytes, 1,103 lines download raw bytes

1/**
2 * функция инициализации owl-carousel со списками элементов (бренды, карточки товаров, категории и т.п.)
3 * Документация: https://owlcarousel2.github.io/OwlCarousel2/
4 * @param {string} selector
5 * @param {number} items
6 */
7function owlCarouselListInit(selector, desktop, tabletHorizontal, tabletVertical, mobile) {
8    if ($(selector).length > 0) {
9        var owl = $(selector).owlCarousel({
10            responsive: {
11                0: {
12                    items: mobile,
13                    dots: true,
14                },
15                768: {
16                    items: tabletVertical,
17
18                },
19                1024: {
20                    items: tabletHorizontal,
21                },
22                1281: {
23                    items: desktop,
24                }
25            },
26            autoHeight: false,
27            margin: 0,
28            nav: true,
29            dots: false
30        });
31    }
32
33    /* сортировка слайдов */
34    $('.slider-filter__selection').on('click', '.selections-list__item', function() {
35        $(this).addClass("active").siblings().removeClass("active")
36        var $item = $(this);
37        var filter = $item.data('owl-filter');
38        owl.owlcarousel2_filter(filter);
39        if(filter == '*'){
40            $('#related-shopping-btn').hide();
41        }else{
42            $('#related-shopping-btn').show();
43        }
44        // Для аксессуаров - смена ссылки у кнопки раздела
45	    var sectionUrl = $(this).data('filter-href');
46	    if (sectionUrl) {
47		    $('#related-shopping-btn').attr('href', sectionUrl);
48	    }
49    })
50}
51function owlCarouselDotsInit(selector) {
52    $(selector).length > 0 && $(selector).owlCarousel({
53        items: 1,
54        autoHeight: false,
55        margin: 0,
56        nav: true,
57        dots: true
58    });
59}
60function autoPlaySlider(selector){
61    $(selector).length > 0 && $(selector).owlCarousel({
62        loop:true,
63        autoplay:true,
64        autoplayTimeout:10000,
65        autoplaySpeed:1500,
66        autoplayHoverPause:true,
67        items: 1,
68        autoHeight: false,
69		dots: true,
70		nav: true,
71        margin: 0,
72    })
73}
74function toTop() {
75    $(window).scroll(function() {
76        if ($(this).scrollTop() > 500) {
77            $('#back-top').fadeIn();
78        } else {
79            $('#back-top').fadeOut();
80        }
81    });
82
83    // scroll body to 0px on click
84    $('#back-top').click(function() {
85        $('body,html').animate({
86            scrollTop: 0
87        }, 800);
88        return false;
89    });
90}
91
92/**
93 * функция инициализации
94 * @param {string} selector
95 */
96function initTabs(selector) {
97    $(selector + ':not(.no-tabs)').on('click', function(e) {
98        e.preventDefault();
99        $(selector + ', .tabs-body').removeClass('active');
100        var id = $(this).data('id');
101        var $tab = $('#' + id);
102	    $tab.addClass('active');
103        $(this).addClass('active');
104        // Загрузка содержимого вкладки через AJAX
105	    loadTabContent($tab);
106        if ($('.header-sticky').length > 0) {
107            var link = $(this).data('id');
108            $('.header-sticky-menu__item').removeClass('active');
109            $('a[href="#' + link + '"]').parent().addClass('active');
110        }
111    })
112}
113
114
115/**
116 * функция вызова выпадающих меню при наведении на иконки (в шапке сайта)
117 * @param {string} selector
118 */
119function hoverHeaderItem(selector) {
120    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
121        $(document).on('click', selector, function() {
122            $(this).toggleClass('dropdown-active').siblings().removeClass('dropdown-active');
123        });
124    } else {
125        $(selector).hover(function() {
126            $(this).addClass('dropdown-active');
127        });
128        $(selector).mouseleave(function() {
129            $(this).removeClass('dropdown-active');
130        });
131    }
132}
133
134function mobileClickDropdown(selector) {
135    $(selector).on('click', function() {
136        var flag = $(selector).hasClass('authorized');
137        if (flag) {
138            $('.login-authorized').addClass('active');
139        } else {
140            $('.login-guest').addClass('active');
141        }
142    });
143}
144
145
146/**
147 * Инициализация маски для телефона
148 * Документация: https://imask.js.org/
149 */
150function initPhoneMask() {
151    $('input[type=tel], input.phone').each(function(index, element) {
152        var mask = IMask(element, {
153            mask: [{
154                    mask: '+7 (000) 000-00-00',
155                    startsWith: '+7',
156                    country: 'Russia',
157                },
158                {
159                    mask: '+7 (000) 000-00-00',
160                    startsWith: '7',
161                    country: 'Russia',
162                },
163                {
164                    mask: '0 (000) 000-00-00',
165                    startsWith: '8',
166                    country: 'Russia',
167                },
168                {
169                    mask: '+7 (000) 000-00-00',
170                    startsWith: '',
171                    country: 'unknown',
172                },
173            ],
174            dispatch: function(appended, dynamicMasked) {
175                var number = (dynamicMasked.value + appended).replace(/\D/g, '');
176                return dynamicMasked.compiledMasks.find(function(m) {
177                    return number.indexOf(m.startsWith) === 0;
178                });
179            },
180        });
181        $(this).blur(function() {
182            var maskValue = mask.unmaskedValue;
183            var startWith = 10;
184            if (maskValue.charAt(0) === '8') {
185                startWith = 11;
186            }
187            if (maskValue.length < startWith) {
188                // mask.value = '';
189            }
190        });
191    });
192}
193
194/**
195 * Инициализация datepicker  маски для даты
196 * @param element
197 */
198// вызывается в заказе и профиле
199function initDatePicker(element) {
200    $(element).length > 0 && IMask(
201        document.querySelector(element), {
202            mask: Date,
203            lazy: false
204        });
205    var date = new Date();
206    var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
207    console.log(date);
208    $(element).length > 0 && $(element).datepicker({
209       /* minDate: today*/
210    });
211}
212
213/**
214 * Инициализация кастомных селектов
215 * Документация: https://github.com/lcdsantos/jQuery-Selectric
216 */
217function initCustomSelect() {
218    $('.form__custom-select').selectric();
219}
220
221/**
222 * Инициализация модальных окон
223 * Документация: https://jquerymodal.com/
224 */
225function initModals() {
226    $(document).on('click', '[data-modal="true"]',function(e) {
227        e.preventDefault();
228        var modalId = $(this).data('modal-id');
229        $(modalId).modal({
230            fadeDuration: 100,
231        });
232    });
233    $('#fast-view-modal, #detailed-view-modal').on($.modal.OPEN, function(event, modal) {
234        if ($('.product-control-slider').hasClass('slick-initialized')) {
235            $('.product-control-slider').slick('destroy');
236        }
237        if ($('.product-general-slider').hasClass('slick-initialized')) {
238            $('.product-general-slider').slick('destroy');
239        }
240        initProductSlider('.product-general-slider', '.product-control-slider');
241    });
242    $('.modal').on($.modal.BEFORE_BLOCK, function(event, modal) {
243        addModalFix();
244    });
245    $('.modal').on($.modal.AFTER_CLOSE, function(event, modal) {
246        removeModalFix();
247    });
248}
249
250/**
251 * Раскрыть описание страницы
252 * @param {string} selector
253 */
254function cropperShow(selector, parentSelector) {
255    $(document).on('click', selector, function() {
256        $(this).parents(parentSelector).removeClass('disabled');
257        $(this).hide();
258    });
259}
260
261/**
262 * функция копирования содержимого блока по клику на элемент
263 * для использования необходимо добавить атрибуты с одинаковым содержимым:
264 * data-copy="name" - для "кнопки" и data-copy-id="name" - для элемента содержимое котого нужно копировать
265 */
266function copyInfoBlock() {
267    $('.js-copy-btn').on('click', function() {
268        let copyIndex = Number(this.getAttribute("data-index"));
269        var selector = $(this).attr('data-copy');
270        var copytext = document.createElement('input');
271        copytext.value = $('[data-copy-id="' + selector + '"]').html();
272        document.body.appendChild(copytext);
273        copytext.select();
274        document.execCommand('copy');
275        copytext.remove();
276        copyInfoNotify(copyIndex);
277    });
278}
279
280
281function copyInfoNotify(index){
282    const notify = document.querySelectorAll(".js-dropdown-block__notification");
283    notify[index].classList.add('dropdown-block__notification--open');
284
285    setTimeout( () => { notify[index].classList.remove('dropdown-block__notification--open') } , 2000)
286}
287
288let copy_icon_btn = document.querySelectorAll('.js-copy_icon_btn');
289 for(let i = 0 ; i < copy_icon_btn.length; i++){
290  copy_icon_btn[i].onclick = iconCopy;
291 }
292
293function iconCopy(e){
294 let target = e.currentTarget;
295 let value = target.getAttribute('data-copy');
296 let parent = target.closest('div');
297 let notify = parent.querySelector('.js-dropdown-block__notification');
298
299 navigator.clipboard
300        .writeText(value)
301        .then(() => {
302   notify.classList.add('dropdown-block__notification--open');
303   setTimeout( () => { notify.classList.remove('dropdown-block__notification--open') } , 2000)
304        })
305        .catch(() => {
306            // Неудача :(
307        });
308}
309
310/**
311 * Инициализация кастомного скролла
312 * Документация: https://github.com/Grsmto/simplebar
313 */
314function initScrollBar(elements) {
315    elements.each(function() {
316        $(this).mCustomScrollbar();
317    });
318}
319
320/**
321 * Инициализация меню-каталога
322 *
323 */
324function catalogMenuInit() {
325
326    // активирует выпадающее меню и оверлей
327
328    $('.general-preview__sidebar nav').hover(function() {
329        $(this).find('.catalog-menu.js-cat-menu').toggleClass('active');
330        $(this).find('.catalog-submenu-grid').addClass('active');
331    });
332    $('.general-preview__sidebar nav').mouseleave(function() {
333        $(this).find('.catalog-submenu-grid').removeClass('active');
334    });
335
336    // проверка нахождения курсора в блоке, если курсор покидает область выпадающего меню, оно закрывается
337    $('.general-preview__sidebar nav').mouseleave(function() {
338        $('.catalog-submenu.active').each(function() {
339            $(this).removeClass('active');
340        });
341
342        $('.catalog-menu__item').removeClass('hover');
343        $('body').removeClass('body--relative');
344    });
345
346    // инициализация самого меню
347    $('nav [class*="menu__item"]').hover(
348        function() {
349            var submenuId = $(this).data('submenu');
350            var childrenLvl = $('.js-cat-menu' + submenuId).data('lvl');
351            var parentId = $(this).parents('.js-cat-menu');
352            var level = $(this).parents('.js-cat-menu').data('lvl');
353            var slId = $(this).data('slider');
354
355            $('body').addClass('body--relative');
356
357            $('.js-cat-menu[data-lvl="' + level + '"]').each(function() {
358                $(this).find('li.hover').removeClass('hover');
359            });
360
361            $(this).addClass('hover');
362
363            if (($(this).parents('.js-cat-menu').data('lvl') == '1')) {
364                $('.fixed-catalog .js-cat-menu.active').each(function() {
365                    $(this).removeClass('active');
366                    $(this).find('li.hover').removeClass('hover');
367                });
368            }
369            if ($(this).parents('.js-cat-menu').data("lvl") == '2') {
370                $('.js-cat-menu[data-lvl="4"]').removeClass('active');
371                $('.js-cat-menu[data-lvl="4"]').find('li.hover').removeClass('hover');
372            }
373            if ($(this).parents('.catalog-menu').data("lvl") == '1') {
374                $('.js-cat-menu[data-lvl="3"]').removeClass('active');
375                $('.js-cat-menu[data-lvl="3"]').find('li.hover').removeClass('hover');
376            }
377            if (!submenuId) {
378                var parentLvl = $(this).parents('.js-cat-menu').data('lvl');
379                $('.js-cat-menu[data-lvl="' + (parentLvl + 1) + '"]').removeClass('active');
380                $('.js-cat-menu[data-lvl="' + (parentLvl + 2) + '"]').removeClass('active');
381                $('.js-cat-menu[data-lvl="' + (parentLvl + 1) + '"]').find('li.hover').removeClass('hover');
382                $('.js-cat-menu[data-lvl="' + (parentLvl + 2) + '"]').find('li.hover').removeClass('hover');
383            } else {
384                $('.js-cat-menu[data-lvl="' + childrenLvl + '"]').removeClass('active');
385                $('.js-cat-menu[data-lvl="' + (childrenLvl + 1) + '"]').removeClass('active');
386                $('.js-cat-menu[data-lvl="' + childrenLvl + '"]').find('li.hover').removeClass('hover');
387                $('.js-cat-menu[data-lvl="' + (childrenLvl + 1) + '"]').find('li.hover').removeClass('hover');
388
389                //setTimeout(function() {
390                 $('.js-cat-menu' + submenuId).addClass('active');
391               // }, 100);
392
393            }
394            if (!slId) {
395               // $('.catalog-menu-wrapper .catalog-submenu-grid__bs--bottom').removeClass('active');
396            } else {
397                $('.catalog-menu-wrapper .catalog-submenu-grid__bs--bottom').removeClass('active');
398                $('.catalog-menu-wrapper ' + slId).addClass('active');
399            }
400        }
401    );
402}
403
404/**
405 * Получение расстояния которое проскроллил пользователь
406 * @returns {number}
407 */
408 // из addModalFix()
409function getBodyScrollTop() {
410    return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
411}
412
413/**
414 * Добавление фикса для модалок
415 */
416// из initModals()
417function addModalFix() {
418        if ($(window).outerWidth() > $(document).outerWidth()) {
419            $('body,.header-top,.header-bottom').css('padding-right', $(window).outerWidth() - $(document).outerWidth());
420        }
421        var topOffset = getBodyScrollTop();
422        var body = $('body');
423        body.addClass('modal-open');
424}
425
426/**
427 * Удаление фикса для модалок
428 */
429// из initModals()
430function removeModalFix() {
431        var body = $('body');
432        $('body,.header-top,.header-bottom').css('padding-right', '');
433        if ($('body').hasClass('modal-open')) {
434            body.css('overflow', '');
435            body.removeClass('modal-open');
436            var scrollY = document.body.style.top;
437        }
438        if ($('body').hasClass('js-modal-open')) {
439            $('body').removeClass('js-modal-open');
440            $('html').removeClass('js-modal-open');
441        }
442}
443
444/**
445 *
446 * @param {string} sliderGeneral - класс основного слайдера
447 * @param {string} sliderControl - класс слайдера с превью
448 * @param {number} index - номер стартового слайда
449 */
450function initProductSlider(sliderGeneral, sliderControl, index) {
451    $(sliderGeneral).length > 0 && $(sliderGeneral).slick({
452        slidesToShow: 1,
453        slidesToScroll: 1,
454        rows: 0,
455        arrows: false,
456        asNavFor: sliderControl,
457        initialSlide: index
458    });
459
460    $(sliderControl).length > 0 && $(sliderControl).slick({
461        slidesToShow: 4,
462        slidesToScroll: 1,
463        asNavFor: sliderGeneral,
464        initialSlide: index,
465        vertical: true,
466        verticalSwiping: true,
467        infinite: true,
468        dots: false,
469        rows: 0,
470        focusOnSelect: true,
471        prevArrow: '<button class="slick-prev"><img src="/img/slider-arrow--left.svg"></button>',
472        nextArrow: '<button class="slick-next"><img src="/img/slider-arrow--left.svg"></button>',
473        responsive: [{
474                breakpoint: 767,
475                settings: {
476                    vertical: false,
477                    verticalSwiping: false,
478                    arrows: false,
479                    slidesToShow: 5,
480                    slidesToScroll: 1
481                }
482            },
483            {
484                breakpoint: 575,
485                settings: {
486                    vertical: false,
487                    verticalSwiping: false,
488                    arrows: false,
489                    slidesToShow: 4,
490                    slidesToScroll: 1
491                }
492            }
493        ]
494    });
495
496    $(sliderControl).each(function() {
497        var slideCounter = $(this).find('.slick-slide').length;
498        if (slideCounter < 5) {
499            $(this).addClass('slick-no-arrow');
500            $(this).addClass('--no-transform');
501        }
502    });
503}
504
505/**
506 * Переключение вида каталога
507 *
508 */
509// каталог, партнеры, акции, сервис
510function sortDisplay() {
511    // открытие/закрытие пунктов
512    $(".sort-display__list-item").on("click", function(e) {
513        e.preventDefault()
514        $(".catalog-list__layout-wrap").addClass("prod-change__style")
515        $(this).siblings().removeClass("selected")
516        $(this).addClass("selected");
517        var type = 'grid';
518        if ($(this).hasClass("grid-sort")) {
519            setTimeout(function(e) {
520                $(".catalog-list__layout").removeClass('list-sort').addClass('grid-sort')
521            }, 400);
522        } else {
523	        type = 'list';
524            setTimeout(function(e) {
525                $(".catalog-list__layout").removeClass('grid-sort').addClass('list-sort')
526            }, 400);
527        }
528	    BX.setCookie('BITRIX_SM_catalog_type', type, {path: '/'});
529        setTimeout(function() {
530            $(".catalog-list__layout-wrap").removeClass("prod-change__style")
531        }, 800);
532    })
533}
534
535/**
536 * Функция валидации  поля емаил
537 *
538 */
539function validEmail(mail) {
540    var pattern = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
541    if (pattern.test(mail)) {
542        return true;
543    } else {
544        return false;
545    }
546}
547
548/**
549 * Инициализация кастомных инпутов типа "file"
550 */
551function customInputFile() {
552    var wrapper = $(".form__holder--file"),
553        input = wrapper.find(".form__file"),
554        btn = wrapper.find(".form__file-btn"),
555        label = wrapper.find(".form__file-name");
556
557    var file_api = (window.File && window.FileReader && window.FileList && window.Blob) ? true : false;
558
559    input.change(function() {
560        var file_name;
561
562        if (file_api && input[0].files[0]) {
563            file_name = input[0].files[0].name;
564        } else {
565            file_name = input.val().replace("C:\\fakepath\\", '');
566        }
567
568        if (!file_name.length) {
569            return;
570        }
571
572        if (label.is(":visible")) {
573            label.text(file_name);
574            $('.form__file-remove').addClass('active');
575            btn.text("Прикрепить реквизиты");
576        } else {
577            btn.text(file_name);
578        }
579
580    }).change();
581
582    $(window).resize(function() {
583        $(".form__holder--file input").triggerHandler("change");
584    });
585
586    $('.form__file-remove').on('click', function(e) {
587        e.preventDefault();
588        var inpFiles = $(this).siblings('input');
589        $(this).removeClass('active');
590        $(this).siblings('.form__label').find('.form__file-name').html('Файл не выбран');
591        console.log(inpFiles[0].files[0]);
592        inpFiles.val('');
593    });
594}
595
596/**
597 * Модалки проверка заполнености форм
598 *
599 */
600function modalForm() {
601    $(document).on("click", ".form-send__btn", function(e) {
602        var sendBut = $(this);
603        var forma = sendBut.parents('.modal-form');
604        var sendInputs = forma.find('input.isend,textarea.isend,select.isend');
605        if(forma.find('input[name="FORM[RATING]"]').length>0){
606            var rating = forma.find('input[name="FORM[RATING]"]:checked');
607            if (rating.length<=0) {
608              $('.modal__rating').parents('.form__holder').addClass('ierror');
609                e.preventDefault();
610                return false;
611            }else{
612               $('.modal__rating').parents('.form__holder').removeClass('ierror');
613            }
614        }
615        sendInputs.each(function() {
616            if ($(this).hasClass('required')) {
617                if ($(this).val() == '' || $(this).val().match(/_/)) {
618                    $(this).addClass('ierror');
619                    $(this).parents('.form__holder').addClass('ierror');
620                } else {
621                    $(this).removeClass('ierror');
622                    $(this).parents('.form__holder').removeClass('ierror');
623                }
624                if ($(this).hasClass('email')) {
625                    if (validEmail($(this).val())) {
626                        $(this).removeClass('ierror');
627                        $(this).parents('.form__holder').removeClass('ierror');
628                    } else {
629                        $(this).addClass('ierror');
630                        $(this).parents('.form__holder').addClass('ierror');
631                    }
632                }
633            }
634        });
635        if (sendInputs.hasClass('ierror')) {
636            e.preventDefault();
637        } else {
638            // Проверка reCaptcha
639            if (forma.find('.g-recaptcha-response').length > 0)
640            {
641	            $.ajax({
642		            url: '/local/ajax/recaptchaHandler.php',
643		            data: forma.serialize(),
644		            dataType: 'json',
645		            async: false,
646		            success: function (response) {
647			            if (!response.success) {
648				            e.preventDefault();
649			            }
650		            }
651	            });
652            }
653        }
654    });
655}
656
657
658
659/*Смена картинки времен года от даты*/
660const news_form_subscribe = document.querySelector(".js-news-subsribe");
661
662if(news_form_subscribe){
663let bodyWidth = document.querySelector("body").clientWidth;
664let newsDate = new Date();
665let currentMouth = newsDate.getMonth();
666const news_form_subscribe = document.querySelector(".js-news-subsribe");
667const newsFormImgs = {
668    winter: "/img/news_form_winter.png",
669    summer: "/img/news_form_summer.png",
670    spring: "/img/news_form_spring.png",
671    autumn: "/img/news_form_autumn.png",
672    mobile_normal:"/img/mobile_news_form_normal.jpg",
673    mobile_cold:"/img/mobile_news_form_cold.jpg",
674} 
675
676    if(currentMouth === 11 || currentMouth <=1){
677        if(bodyWidth <= 450){
678            news_form_subscribe.style.background= "url(" + newsFormImgs.mobile_cold + ") center center no-repeat";
679        }else{
680            news_form_subscribe.style.background= "url(" + newsFormImgs.winter + ") center center no-repeat";
681        }
682        news_form_subscribe.style.backgroundSize = "cover";
683    }else if(currentMouth >=2 && currentMouth <=4){
684        if(bodyWidth <= 450){
685            news_form_subscribe.style.background= "url(" + newsFormImgs.mobile_normal + ") center center no-repeat";
686        }else{
687            news_form_subscribe.style.background= "url(" + newsFormImgs.spring + ") center center no-repeat";
688        }
689        news_form_subscribe.style.backgroundSize = "cover";
690    }else if(currentMouth >=5 && currentMouth <=7){
691        if(bodyWidth <= 450){
692            news_form_subscribe.style.background= "url(" + newsFormImgs.mobile_normal + ") center center no-repeat";
693        }else{
694            news_form_subscribe.style.background= "url(" + newsFormImgs.summer + ") center center no-repeat";
695        }
696        news_form_subscribe.style.backgroundSize = "cover";
697    }else if(currentMouth >=8 && currentMouth <=10){
698        if(bodyWidth <= 450){
699            news_form_subscribe.style.background= "url(" + newsFormImgs.mobile_normal + ") center center no-repeat";
700        }else{
701        news_form_subscribe.style.background= "url(" + newsFormImgs.autumn + ") center center no-repeat";
702        }
703        news_form_subscribe.style.backgroundSize = "cover";
704    }
705}
706/************************************/
707
708
709/** Проскроллить к определенной точке на странице
710 *
711 * @param {number} elementOffset - отступ от верха страницы
712 * @param {number} time - время перехода
713 */
714function scrollTo(elementOffset, time) {
715   // return;
716    $('body,html').animate({
717        scrollTop: elementOffset
718    }, time);
719}
720
721/**
722 * Скролл к якорю
723 *
724 * data-scroll-anchor - атрибут с именем якоря
725 * data-scroll="true" - указывается у кнопки
726 * data-id -
727 */
728function scrollToAnchor() {
729    $(document).on('click', '[data-scroll="true"]', function(e) {
730        e.preventDefault();
731
732        var anchorName = $(this).data('scroll-id');
733        var selector = '[data-scroll-anchor="' + anchorName + '"]';
734        var topAnchor = $(selector).offset().top;
735
736        if ($('.tabs-content [data-scroll-anchor="' + anchorName + '"]').length > 0) {
737            var parent = $(selector).parents('.tabs-body');
738            var parentId = parent.attr('id');
739            $('[data-id="' + parentId + '"]').click();
740            topAnchor = $(selector).offset().top - 122 - $(".header").height();
741            scrollTo(topAnchor, 400);
742            return false;
743        } else if ($('.ab-index__content [data-scroll-anchor="' + anchorName + '"]').length > 0) {
744            topAnchor = $(selector).offset().top - $(".header").height();
745            scrollTo(topAnchor, 400);
746            return false;
747        } else {
748
749            scrollTo(topAnchor, 400);
750        }
751    });
752}
753
754/**
755 * аккардион вопрос/отзывы в лк
756 */
757// на контентных страницах
758function questionListLk() {
759    $(".question-list__header").on("click", function() {
760        $(this).parent().siblings().find(".question-list__header").removeClass("open");
761        $(this).parent().siblings().find(".question-list__body").slideUp();
762        $(this).toggleClass('open');
763        $(this).parent().find('.question-list__body').slideToggle();
764    });
765}
766
767/**
768 * Выпадающий каталог на внутренних страницах
769 */
770function dropdownCatalog() {
771    if ($('.fixed-catalog').length > 0 && $(window).width() > 768) {
772        $('.header-bottom__catalog').on("mouseenter", function() {
773            $('body').addClass('body--catalog-open');
774            $('.fixed-catalog').addClass('active');
775        });
776        $('.header-bottom__catalog').on("mouseleave", function() {
777           // setTimeout(function() {
778                if($('.fixed-catalog').is(":hover")){
779                    return false;
780                }
781                else {
782                    $('.fixed-catalog').removeClass('active');
783                    $('body').removeClass('body--catalog-open');
784                }
785           // }, 500);
786        });
787        $('.fixed-catalog').on("mouseleave", function(){
788            $('.fixed-catalog').removeClass('active');
789            $('body').removeClass('body--catalog-open');
790        })
791        $('.fixed-catalog .col-md-9, .dropdown__overlay').on('click', function() {
792            $('body').removeClass('body--catalog-open');
793            $('.fixed-catalog').removeClass('active');
794        });
795	} else     if ($('.fixed-catalog').length > 0 && $(window).width() < 768) {
796        $('.header-bottom__catalog').on("click", function() {
797            $('body').addClass('body--catalog-open');
798            $('.fixed-catalog').addClass('active');
799        });
800	}
801
802}
803
804/**
805 * Переместить пункт основного меню в подменю "еще"
806 */
807function moveBlock() {
808    $('.header-top__menu-item.change-tablet').each(function() {
809        var item = $(this).find('.header-top__menu-link');
810        var text = item.text();
811        var link = item.attr('href');
812        $(this).remove();
813        $('.header-top__submenu').append('<li class="header-top__submenu-item"><a href="' + link + '" class="header-top__submenu-link">' + text + '</a></li>')
814    });
815}
816
817/**
818 * Функция для раскрытия мобильного меню в футере
819 */
820function slideToggleFooter() {
821    $('.footer-top__item-caption--arrow').on('click', function() {
822        $(this).siblings('.footer-top__menu').slideToggle();
823        $(this).toggleClass('active');
824    });
825}
826
827// Загрузка содержимого вкладки через AJAX
828function loadTabContent($tab)
829{
830	var ajaxPath = $tab.data('path');
831	var ajaxLoad = $tab.data('load');
832	if (ajaxLoad !== 'Y' && ajaxPath) {
833		$tab.find('.tabs-body__content').load(ajaxPath, { product: parseInt($tab.data('product')) }, function () {
834			$tab.data('load', 'Y').attr('data-load', 'Y');
835
836			initModals();
837		});
838	}
839}
840
841/**
842 *
843 * @param {string} selector - класс элемента
844 */
845function mobileMenuToggle(selector) {
846    $(selector).on('click', function(e) {
847        e.preventDefault();
848        $('.mobile-menu__btn').toggleClass('open');
849        $('.mobile-general-menu__wrapper').toggleClass('active');
850        // $('.general-preview__sidebar').toggleClass('mobile-active');
851        $('.header-bottom__search').removeClass('active');
852
853        $('body').addClass('modal-open');
854        $('html').addClass('modal-open');
855    });
856}
857
858/**
859 * Функция сокрытия мобильного меню
860 * @param {string} selector
861 */
862function mobileMenuClose(selector) {
863    $(document).on('click', selector, function(e) {
864        e.preventDefault();
865        $('.mobile-menu__btn').removeClass('open');
866        $('html').removeClass('modal-open');
867        $('.mobile-general-menu__wrapper').removeClass('active');
868        $('.general-preview__sidebar').removeClass('mobile-active');
869        $('body').removeClass('modal-open body--catalog-open');
870        $('.catalog-submenu-grid').removeClass('active');
871        $('.catalog-submenu').each(function() {
872            $(this).removeClass('active');
873        });
874        $('.header-top__cart-wrapper').removeClass('open');
875        $(".fixed-catalog").removeClass('active');
876        $('.catalog-menu').removeClass('height-small');
877
878    });
879}
880
881/**
882 * Клонировать элемент в мобильную версию и разместить его в конце кода
883 * @param {string} selector
884 */
885function mobileClone(selector) {
886    var item = $(selector);
887
888    if (selector.length > 0) {
889        item.clone(true, true).insertBefore('.dropdown__overlay');
890    }
891}
892
893/**
894 * Инициализация галлереии
895 */
896function galleryInCard() {
897    $('[data-fancybox="gallery"]').fancybox();
898}
899
900$(function() {
901	autoPlaySlider('.general-slider.-mod-min'); // разделы каталога и главная
902    objectFitImages();  
903    initTabs('.tabs-normal__item');// catalog.element
904    initTabs('.tabs-sidebar__item.change-need'); // главная и список элементов 
905    initPhoneMask(); 
906    galleryInCard();
907    toTop();
908    questionListLk();// на контентных страницах
909    modalForm();
910    sortDisplay();// каталог, партнеры, акции, сервис
911    owlCarouselDotsInit('.general-slider');// списки элементов
912    owlCarouselListInit('.js-product-slider', 4, 4, 3, 2);//  списки элементов
913    owlCarouselListInit('.js-product-slider-3', 3, 3, 2, 2);// списки элементов
914    initCustomSelect();
915    initModals();
916    hoverHeaderItem('.js-action-hover');
917    cropperShow('.js-page-desc-btn', '.page-description');
918    copyInfoBlock();  
919    initScrollBar($('.catalog-submenu,.select-city-modal__city-list,.pickup-point__list'));
920    initScrollBar($('.dropdown-block .micro-product__list')); 
921    customInputFile(); 
922    scrollToAnchor(); 
923    cropperShow('.selections-list__show-more', '.selections-list__cropp');
924    dropdownCatalog(); 
925    slideToggleFooter(); 
926    mobileMenuToggle('.mobile-menu__btn');
927    mobileMenuClose('.close-menu');
928    cropperShow('.js-mobile-desc-btn', '.mobile-accordeon-description');
929    cropperShow('.js-page-desc-btn', '.brands-page__item-content');
930
931
932    $('.product-card-general__print').on('click', function(e){
933        $("#printarea").show();
934        window.print();
935    })
936
937    $(".back__btn").on("click", function(e) {
938        e.preventDefault();
939        $(this).parent().removeClass("open");
940        $(this).parents('.tabs-body').css('height', 'auto');
941        $(".form__input").each(function() {
942            $(this).removeClass('ierror')
943            $(this).parents('.form__holder').removeClass('ierror')
944        })
945    })
946
947    if (window.matchMedia("(min-width: 768px)").matches) {
948        catalogMenuInit(); 
949
950        $('.header-bottom__catalog').on("hover", function() {
951            var heights = $('.header-top').height();
952            var top = $(this).offset().top;
953            var left = $(this).offset().left;
954            var width = $(this).outerWidth();
955            var topMenu = top - heights;
956            $('.fixed-catalog .general-preview__sidebar').filter(':first').css('top', topMenu + 'px').toggleClass('mobile-active');
957        });
958    } else {
959
960        mobileClone('.login-guest');
961        mobileClone('.login-authorized');
962        mobileClickDropdown('.js-mobile-login-click');
963        
964        $('.catalog-menu__item .catalog-menu__show-more').on('click', function(e){
965            e.preventDefault();
966
967            var currentId = $(this).parents('li').data('submenu'); //id вызываемого меню
968            var catMenu = $('.catalog-menu');
969            var parents = $(this).parents('.catalog-menu-wrapper');
970
971            $('.catalog-submenu-grid').addClass('active');
972            parents.find(currentId).addClass('active');
973            catMenu.addClass('height-small');
974        });
975
976        $('.catalog-submenu__item .catalog-menu__show-more').on('click', function(e){
977            e.preventDefault();
978
979            var parents = $(this).parents('.catalog-menu-wrapper');
980
981            var currentId = $(this).parents('li').data('submenu'); //id вызываемого меню
982            parents.find(currentId).addClass('active');
983        });
984    }
985
986
987    $('.header-bottom__catalog').on("click", function() {
988        $('.general-preview__sidebar').toggleClass('mobile-active');
989    });
990    $(document).on('scroll', function() {
991        $('body').removeClass('body--catalog-open');
992        $('.fixed-catalog').removeClass('active');
993    });
994    $('.js-global-back').on('click', function() {
995        $(this).closest('.general-preview__sidebar').removeClass('mobile-active');
996    });
997    $('.js-local-back').on('click', function() {
998        var thisParent = $(this).parents('.catalog-submenu');
999        var level = thisParent.data('lvl');
1000
1001        if (level != 2) {
1002            thisParent.removeClass('active');
1003
1004        } else {
1005            var catMenu = $('.catalog-menu');
1006            thisParent.removeClass('active');
1007            $('.catalog-submenu-grid').removeClass('active');
1008            catMenu.removeClass('height-small');
1009        }
1010    });
1011    $(document).on('click', '.js-modal-back', function() {
1012        $('.login-guest,.login-authorized').removeClass('active');
1013        $.modal.close();
1014    });
1015    $(document).on('click', '.close-menu', function() {
1016        $(this).parents('.login-guest,.login-authorized').removeClass('active');
1017    });
1018    $(document).on('click', '.modal-mobile-control .close-menu', function() {
1019        $(this).parents('.modal-mobile-control').find('.close-modal').click();
1020        $('.login-guest,.login-authorized').removeClass('active');
1021    });
1022
1023    if ($(window).width() > 767) {
1024        $(document).on("mouseenter", ".header-top__cart-wrapper", function(e) {
1025            e.preventDefault();
1026            $(this).addClass("open")
1027        })
1028        $(document).on("mouseleave", ".header-top__cart-wrapper", function(e) {
1029            e.preventDefault();
1030            $(this).removeClass("open")
1031        })
1032    } 
1033
1034    if (window.matchMedia("(max-width: 767px)").matches) {
1035        $('.catalog-menu-wrapper > .mobile-menu-control .js-global-back').on('click', function(e){
1036            $(this).parents('.fixed-catalog').removeClass('active');
1037        });
1038    }
1039    $('.header-mobile__search-btn').on('click', function() {
1040        $('.header-bottom__search').toggleClass('active');
1041        $('body').toggleClass('modal-open');
1042        document.querySelectorAll('.header-top')[0].style.display = 'block'
1043        document.querySelectorAll('.header-bottom')[0].style.display = 'block'
1044    });
1045    document.querySelector('.header-bottom__search').addEventListener('click', (event) => {
1046        if (event.target.parentElement.className === 'header-bottom-wrapper' && $('body').hasClass('modal-open')) {
1047            document.querySelectorAll('.header-top')[0].style.display = 'none'
1048            document.querySelectorAll('.header-bottom')[0].style.display = 'none'
1049            $('body').removeClass('modal-open');
1050            $('.header-bottom__search').removeClass('active');
1051        }
1052    })
1053    $('.sorting-nav-mobile__filter').on('click', function() {
1054        $('.catalog-main__sidebar').addClass('active');
1055    });
1056
1057	setTimeout(function(){
1058        $('.title-wrapper .product-item__name').each(function () {
1059            if (window.matchMedia("(min-width: 1024px) and (max-width: 4096px)").matches) {
1060                if( this.scrollHeight > this.clientHeight + 1){
1061                    $(this).parent().addClass('active-title').stop();
1062                }    
1063            }
1064        });
1065      }, 3000);
1066
1067    /*Функционал кнопки закрытия в разделе "Поделиться"*/
1068    $(document).click(".title-close .tooltip-close", function () {
1069        $('.product-card-general__line-item.product-card-general__share').removeClass('hover-active');
1070    });
1071    $(document).mouseover(".product-card-general__line-item.product-card-general__share", function () {
1072        $('.product-card-general__line-item.product-card-general__share').addClass('hover-active');
1073    });
1074
1075    $('.catalog-submenu-grid__bs-active .catalog-submenu-grid__bs--bottom').each(function () {
1076        $('body').addClass('br-bottom');
1077    });
1078
1079    $("button.header-top__geo").click(function () {
1080        let element = document.getElementsByClassName('jquery-modal  blocker');
1081        if (element) {
1082            $('body').addClass('js-modal-open');
1083        }
1084    });
1085});
1086
1087$('[data-fancybox][data-type="iframe"]').fancybox(     
1088    {
1089    openEffect: 'none',
1090    closeEffect: 'none',
1091    nextEffect: 'none',
1092    prevEffect: 'none',
1093    padding: 0,
1094    margin: [20, 0, 20, 0],
1095    autoScale : false,
1096        iframe: {
1097        // Iframe tag attributes
1098        attr: {
1099            allow: "autoplay; fullscreen; encrypted-media; picture-in-picture;",
1100            transparent : "true",
1101            },
1102        }
1103    });

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.