PageSourceSearch

https://fregat.ru/local/templates/main/js/custom.js?v=1791016800

js fregat.ru collected 2026-10-03 21:45:30 UTC 36,445 bytes, 1,180 lines download raw bytes

1$(document).ready(function () {
2
3//$('#full_cart').css('display', 'none');
4//$('#empty_cart').css('display', 'none');
5//$('#order_cart').css('display', 'none');
6
7
8
9//ЗАПОЛНЯЕМ ТАБЛИЦУ АКТИВНЫЙ ТОВАРОВ В ТАБЛИЦУ КОРЗИНЫ
10$.ajax({
11            url: '/local/ajax/cart_actions.php?_=' + new Date().getTime(),
12            contentType: false,
13            type: 'GET',
14            dataType: 'json',
15            data: {    
16                action: 'getCount'
17            },
18            success: function (data) {
19                
20				if (data.success) {
21                           
22					   if (data.products) {
23				                
24							     let tableHTML = '';
25							         data.products.forEach(function(product) {
26							           
27									    tableHTML += '<tr>';
28                                         
29                                        tableHTML += '<td style="width: 3%;" class="table-p">';
30                                        tableHTML += '<img src="' + product.picture + '" alt="' + product.name + '" style="max-width: 100px;">';
31                                        tableHTML += '</td>';
32                                        
33                                        tableHTML += '<td class="table-p">' + product.name + '</td>';
34                    
35                                        tableHTML += '<td style="width: 3%;" class="table-p">';
36                                        tableHTML += '<img class="del-product" style="width:27px; cursor:pointer;" data-id="' + product.basketid + '" src="/local/templates/main/img/del.svg">';
37                                        tableHTML += '</td>';
38                    
39                                        tableHTML += '</tr>';
40									 
41									 }); 
42							 
43							 //$('#full_cart').css('display', 'block');
44							 $('#basket_ajax').html(tableHTML);
45							 }else{
46                             // Если нет продуктов
47							
48							 
49							 }								 
50	   
51					   var count = Number(data.count);
52					   if (count < 1){
53					   $('#order_cart').css('display', 'none');
54					   $('#full_cart').css('display', 'none');
55					   $('#empty_cart').css('display', 'block');
56					   }	   
57					   else{
58					   $('#order_cart').css('display', 'none');
59					   $('#full_cart').css('display', 'block');
60					   $('#empty_cart').css('display', 'none');	   
61					   }	   
62					   
63					   $('.quantity').text(count); 
64                } 
65            }
66});
67
68
69
70$('#go-basket').on('click', function() {
71    const form = $(this).closest('form')[0];
72    
73    if (form.checkValidity()) {
74        
75        console.log('Все поля заполнены правильно');
76        	
77			
78		$.ajax({
79        url: '/local/ajax/cart_actions.php?_=' + new Date().getTime(),
80        type: 'POST',
81        data: {'name':$('#user-name').val(), 'phone':$('#user-phone').val(), 'email':$('#user-email').val(), 'company':$('#user-company').val(), 'action':'create_order'},
82        beforeSend: function() {
83           
84            //$('#go-basket').prop('disabled', true).text('Отправка...');
85        },
86        success: function(response) {
87        
88        var res = JSON.parse(response); 
89		
90			if (res.success){
91			
92			$('#order_number_text').text(res.orderId);
93			
94			$('#full_cart').css('display', 'none');
95            $('#empty_cart').css('display', 'none');
96            $('#order_cart').css('display', 'block');
97			
98			$('.quantity').text(0); 
99			
100			$('#order_form').find('input[type="text"], input[type="email"]').val('');			
101			}
102
103//$('#full_cart').css('display', 'none');
104//$('#empty_cart').css('display', 'none');
105//$('#order_cart').css('display', 'block');
106			
107//$('#full_cart').hide();
108//$('#order_cart').show();
109//$('#empty_cart').hide();
110			
111			
112			console.log('Успех:', response);
113            // Действия при успехе
114        },
115        error: function(xhr, status, error) {
116            //console.error('Ошибка:', error);
117            //alert('Произошла ошибка при отправке');
118        },
119        complete: function() {
120            // Вернуть кнопку в исходное состояние
121            //$('#go-basket').prop('disabled', false).text('В корзин
121у');
122        }
123        })
124		
125	
126	  
127    } else {
128        // Форма невалидна - показываем сообщения об ошибках
129        form.reportValidity();
130    }
131});
132
133
134
135
136// УДЛЯЕМ ТОВАР ИЗ КОРЗИНЫ
137$('#basket_ajax').on('click', '.del-product', function() {
138
139if (confirm('Удалить товар из корзины?')) {
140        BX.showWait();
141        var $button = $(this);
142        BX.ajax.post(
143            '/local/ajax/cart_actions.php',
144            {
145            'sessid': BX.bitrix_sessid(),
146            'action': 'delete',
147            'id': $(this).data('id'),
148            '_': new Date().getTime()	
149            },
150            function(result) {
151                BX.closeWait();
152                
153                //console.log(result);
154                var response = JSON.parse(result);
155                 
156                if (response.success) {
157                
158				             if (response.products) {
159				             
160							     let tableHTML = '';
161							         response.products.forEach(function(product) {
162							           
163									    tableHTML += '<tr>';
164                                         
165                                        tableHTML += '<td style="width: 3%;" class="table-p">';
166                                        tableHTML += '<img src="' + product.picture + '" alt="' + product.name + '" style="max-width: 100px;">';
167                                        tableHTML += '</td>';
168                                        
169                                        tableHTML += '<td class="table-p">' + product.name + '</td>';
170                    
171                                        tableHTML += '<td style="width: 3%;" class="table-p">';
172                                        tableHTML += '<img class="del-product" style="width:27px; cursor:pointer;" data-id="' + product.basketid + '" src="/local/templates/main/img/del.svg">';
173                                        tableHTML += '</td>';
174                    
175                                        tableHTML += '</tr>';
176									 
177									 }); 
178							 
179							 
180							 $('#basket_ajax').html(tableHTML);
181							 } 
182				
183				
184                       var count = Number(response.count);
185					   if (count < 1){
186					   $('#order_cart').css('display', 'none');
187					   $('#full_cart').css('display', 'none');
188					   $('#empty_cart').css('display', 'block');
189					   }	
190                       else{
191					   $('#order_cart').css('display', 'none');
192					   $('#full_cart').css('display', 'block');
193					   $('#empty_cart').css('display', 'none');	   
194					   }	
195				
196                       $('.quantity').text(count); 
197
198                $button.closest('tr').remove();
199                } else {
200                alert('Ошибка при удалении товара. Повторите попытку');
201                }
202  
203
204            }
205        );
206}
207});
208
209
210
211
212
213
214
215
216
217
218
219
220
221    $('.mob_menu_toggler').on('click', function (e) {
222        if ($(this).attr('aria-expanded') == 'true') {
223            $('body').css('overflow', 'hidden');
224        } else {
225            $('body').css('overflow', 'auto');
226        }
227
228    });
229
230    $('.header_search_toggler').on('click', function (e) {
231        if ($(this).hasClass('is_active')) {
232            $(this).removeClass('is_active');
233            $(".header-search").removeClass('shown');
234        } else {
235            $(this).addClass('is_active');
236            $(".header-search").addClass('shown');
237        }
238    });
239
240
241    $('.accordion-button').on('click', function (e) {
242
243        let link = $(this).find('a').first();
244        let str = $(this).find('a')[0];
245        //console.log(str);
246        if (e.target === str) {
247            window.location.href = link.attr('href');
248        }
249
250    });
251
252
253    $(document).on('click', '.btn-cart', function (e) {
254
255        e.preventDefault();
256        if ($(this).hasClass('btn-delete-cart')) {
257
258            let pid = $(this).attr('data-pid');
259
260            $.ajax({
261                url: '/local/ajax/order/delete.php',
262                contentType: false,
263                type: 'GET',
264                data: {
265                    pid: pid
266                },
267                success: function (data) {
268                    updateIcon();
269                    updt_cart();
270                }
271            });
272
273        } else {
274            if ($(this).hasClass('btn-addcart-personal')) {
275
276                /* personal - order list */
277                if ($(this).hasClass('added')) {
278
279                    let id = $(this).attr('data-order-id');
280                    removeCart(id);
281                    $(this).removeClass('added');
282                    $(this).text('Заказать');
283
284                } else {
285
286                    add2Cart($(this).attr('data-prod-id'), 1, false, $(this));
287                    $(this).addClass('added');
288                    $(this).text('В корзине');
289
290                }
291
292
293            } else {
294
295                /* Not personal page */
296
297                if ($(this).hasClass('added')) {
298
299                    let id = $('.' + 'input-order-' + $(this).attr('data-id')).val();
300
301                    removeCart(id);
302                    $(this).removeClass('added');
303                    $(this).text('Заказать');
304                } else {
305                    add2Cart($(this).attr('data-id'), $('.' + $(this).attr('data-input')).val(), true, false);
306                    $(this).addClass('added');
307                    $(this).text('В корзине');
308                }
309            }
310        }
311    });
312
313    $(document).on('click', '.btn-cart-plus', function (e) {
314
315        e.preventDefault();
316        let input = $('.' + $(this).attr('data-input'));
317        let prodBtn = $('.btn-cart-' + $(this).attr('data-id'));
318        let inputOrderId = $('.input-order-' + $(this).attr('data-id'));
319
320        if (prodBtn.hasClass('added') || $(this).attr('data-pos') == 'cart') {
321            let val = Number(input.val()) + 1;
322            input.val(val);
323            updateQNT(inputOrderId.val(), val);
324        } else {
325            let val = Number(input.val());
326            input.val(val + 1);
327        }
328
329    });
330
331    $(document).on('click', '.btn-cart-minus', function (e) {
332
333        e.preventDefault();
334        let input = $('.' + $(this).attr('data-input'));
335        let prodBtn = $('.btn-cart-' + $(this).attr('data-id'));
336        let inputOrderId = $('.input-order-' + $(this).attr('data-id'));
337
338        if (Number(input.val()) == 1) {
339            return;
340        }
341
342        if (prodBtn.hasClass('added') || $(this).attr('data-pos') == 'cart') {
343            let val = Number(input.val()) - 1;
344            input.val(val);
345            updateQNT(inputOrderId.val(), val);
346        } else {
347            let val = Number(input.val());
348            input.val(val - 1);
349        }
350
351    });
352
353    function updateIcon() {
354
355        $.ajax({
356            url: '/local/ajax/cart_actions.php',
357            contentType: false,
358            type: 'GET',
359            //dataType: 'json',
360            data: {
361                action: 'updateBasket'
362            },
363            success: function (data) {
364                $('.header_cart').html(data);
365            }
366        });
367
368    }
369
370    function updateQNT(orderID, count) {
371
372        if (count < 1) {
373            console.log('Product ID must be more than 1');
374            return;
375        }
376
377        if (orderID < 1) {
378            console.log('Invalid product id');
379        }
380
381        $.ajax({
382            url: '/local/ajax/cart_actions.php',
383            contentType: false,
384            type: 'GET',
385            dataType: 'json',
386            data: {
387                id: orderID,
388                count: count,
389                action: 'updateQNT'
390            },
391            success: function (data) {
392                updateIcon();
393                console.log(data);
394            }
395        });
396
397    }
398
399
400    function updt_cart() {
401
402        $.ajax({
403            url: '/local/ajax/order/update_cart.php',
404            contentType: false,
405            processData: false,
406            type: 'POST',
407            data: {},
408            success: function (data) {
409                $('.cart-updt').html(data);
410            }
411        });
412
413        $.ajax({
414            url: '/local/ajax/order/cnt_cart.php',
415            contentType: false,
416            processData: false,
417            type: 'POST',
418            data: {},
419            success: function (data) {
420                $('.cart-total-count').html(data);
421            }
422        });
423
424    }
425
426
427    function removeCart(id) {
428
429        if (id < 1) {
430            console.log('Invalid product id');
431        }
432
433        $.ajax({
434            url: '/local/ajax/cart_actions.php',
435            contentType: false,
436            type: 'GET',
437            dataType: 'json',
438            data: {
439                id: id,
440                action: 'delete'
441            },
442            success: function (data) {
443                updateIcon();
444            }
445        });
446
447    }
448
449    function add2Cart(id, count, setInput, el) {
450
451        if (count < 1) {
452            console.log('Product ID must be more than 1');
453            return;
454        }
455
456        if (id < 1) {
457            console.log('Invalid product id');
458        }
459
460        $.ajax({
461            url: '/local/ajax/cart_actions.php',
462            contentType: false,
463            type: 'GET',
464            dataType: 'json',
465            data: {
466                id: id,
467                count: count,
468                action: 'add'
469            },
470            success: function (data) {
471                if (data.success) {
472                
473               
474                $('.quantity').text(data.count); 
475
476                //console.log(data);
477                
478                if (setInput) {
479                        $('.' + 'input-order-' + id).val(data.id);
480                    } else {
481                        el.attr('data-order-id', id);
482                    }
483
484                }
485               // updateIcon();
486            }
487        });
488
489    }
490
491
492    function setCookie(name, value, days) {
493        let expires = "";
494        if (days) {
495            let date = new Date();
496            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
497            expires = "; expires=" + date.toUTCString();
498        }
499        document.cookie = name + "=" + (value || "") + expires + "; path=/";
500    }
501
502    $('.city1 select').on('change', function (e) {
503        let val = $('.city1 select option:selected').attr('value');
504        console.log(val);
505        $('.phone1 .phone-item').hide();
506        $('.phone1 .phone-item[value="' + val + '"]').css('display', 'block');
507        setCookie('FREGAT_CITY', val, 365);
508    });
509    $('.city2 select').on('change', function (e) {
510        console.log(val);
511        let val = $('.city2 select option:selected').attr('value');
512        $('.phone2 .phone-item').hide();
513        $('.phone2 .phone-item[value="' + val + '"]').css('display', 'block');
514        setCookie('FREGAT_CITY', val, 365);
515    });
516
517
518    function getCookie(name) {
519        let matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"));
520        return matches ? decodeURIComponent(matches[1]) : undefined;
521    }
522
523
524    function checkCookies() {
525        let cookieNote = document.getElementById('cookie_note');
526        let cookieBtnAccept = cookieNote.querySelector('.cookie_accept');
527
528        // Если куки cookies_policy нет или она просрочена, то показываем уведомление
529        if (!getCookie('cookies_policy')) {
530            cookieNote.classList.add('show');
531        }
532
533        // При клике на кнопку устанавливаем куку cookies_policy на один год
534        cookieBtnAccept.addEventListener('click', function () {
535            setCookie('cookies_policy', 'true', 365);
536            cookieNote.classList.remove('show');
537        });
538    }
539
540    checkCookies();
541
542    /* Favorites */
543    $('.add2fav').on('click', function (e) {
544        var favorID = $(this).attr('data-item');
545        console.log(favorID);
546        if ($(this).hasClass('active'))
547            var doAction = 'delete';
548        else
549            var doAction = 'add';
550
551        addFavorite(favorID, doAction);
552        //$(this).toggleClass('added');
553    });
554    /* Favorites */
555});
556
557/* Избранное */
558function addFavorite(id, action) {
559    var param = 'id=' + id + "&action=" + action;
560    $.ajax({
561        url: '/local/ajax/favorites.php', // URL отправки запроса
562        type: "GET",
563        dataType: "html",
564        data: param,
565        success: function (response) { // Если Данные отправлены успешно
566            console.log(response);
567            var result = $.parseJSON(response);
568            if (result == 1) { // Если всё чётко, то выполняем действия, которые показывают, что данные отправлены
569                $('.add2fav[data-item="' + id + '"]').addClass('added');
570                //var wishCount = parseInt($('#want .col').html()) + 1;
571                //$('#want .col').html(wishCount); // Визуально меняем количество у иконки
572            }
573            if (result == 2) {
574                $('.add2fav[data-item="' + id + '"]').removeClass('added');
575                //var wishCount = parseInt($('#want .col').html()) - 1;
576                //$('#want .col').html(wishCount); // Визуально меняем количество у иконки
577            }
578        },
579        error: function (jqXHR, textStatus, errorThrown) { // Ошибка
580            console.log('Error: ' + errorThrown);
581        }
582    });
583}
584
585/* Избранное */
586
587$(document).ready(function () {
588
589    /* files upload start */
590
591    document.querySelectorAll(".drop-zone__input").forEach((inputElement) => {
592        const dropZoneElement = inputElement.closest(".drop-zone");
593        dropZoneElement.addEventListener("click", (e) => {
594            inputElement.click();
595        });
596        inputElement.addEventListener("change", (e) => {
597            if (inputElement.files.length) {
598                updateThumbnail(dropZoneElement, inputElement.files[0]);
599                dropZoneElement.querySelector(".drop-zone__prompt").remove();
600            }
601        });
602        dropZoneElement.addEventListener("dragover", (e) => {
603            e.preventDefault();
604            dropZoneElement.classList.add("drop-zone--over");
605        });
606        ["dragleave", "dragend"].forEach((type) => {
607            dropZoneElement.addEventListener(type, (e) => {
608                dropZoneElement.classList.remove("drop-zone--over");
609            });
610        });
611        dropZoneElement.addEventListener("drop", (e) => {
612            e.preventDefault();
613            if (e.dataTransfer.files.length) {
614                inputElement.files = e.dataTransfer.files;
615                updateThumbnail(dropZoneElement, e.dataTransfer.files[0]);
616            }
617            dropZoneElement.classList.remove("drop-zone--over");
618        });
619    });
620
621    function updateThumbnail(dropZoneElement, file) {
622        let thumbnailElement = dropZoneElement.querySelector(".drop-zone__thumb");
623
624        if (dropZoneElement.querySelector(".drop-zone__prompt")) {
625            dropZoneElement.querySelector(".drop-zone__prompt").remove();
626        }
627
628        if (!thumbnailElement) {
629            thumbnailElement = document.createElement("div");
630            thumbnailElement.classList.add("drop-zone__thumb");
631            dropZoneElement.appendChild(thumbnailElement);
632        }
633        thumbnailElement.dataset.label = file.name;
634
635    }
636
637    /* files upload end */
638
639
640    $(document).ready(function () {
641
642
643        $('.claim-form').on('submit', function (e) {
644
645            e.preventDefault();
646            let errors = false;
647
648            /*
649              if ($('.claim-name input').val() == ''){
650                 $('.claim-name').addClass('error');
651                 errors = true;
652              }else{
653                $('.claim-name').removeClass('error');
654              }
655             */
656
657            if ($('.claim-phone input').val() == '') {
658                $('.claim-phone').addClass('error');
659                errors = true;
660            } else {
661                $('.claim-phone').removeClass('error');
662            }
663
664            if ($('.claim-email input').val() == '') {
665                $('.claim-email').addClass('error');
666                errors = true;
667            } else {
668                $('.claim-email').removeClass('error');
669            }
670
671            /*
672              if ($('.claim-org input').val() == ''){
673                 $('.claim-org').addClass('error');
674                 errors = true;
675              }else{
676                $('.claim-org').removeClass('error');
677              }
678
679              if ($('.claim-msg textarea').val() == ''){
680                 $('.claim-msg').addClass('error');
681                 errors = true;
682              }else{
683                $('.claim-msg').removeClass('error');
684              }
685            */
686
687            if (errors) return;
688
689            formData = new FormData($(this).get(0));
690
691            $.ajax({
692                url: '/local/ajax/claim_form.php',
693                contentType: false,
694                processData: false,
695                type: 'POST',
696                dataType: 'json',
697                data: formData,
698                success: function (data) {
699                    if (data.success) {
700                        var myModal = new bootstrap.Modal(document.getElementById('thanksModal'), {}).show();
701                        $('#requestModal').modal('hide');
702                        $('.claim-org input').val('');
703                        $('.claim-email input').val('');
704                        $('.claim-phone input').val('');
705                        $('.claim-name input').val('');
706                        $('.claim-msg textarea').val('');
707                    }
708                }
709            });
710
711        });
712
713        $('.uslugi-form').on('submit', function (e) {
714
715            e.preventDefault();
716            let errors = false;
717
718            if ($('.uslugi-phone input').val() == '') {
719                $('.uslugi-phone').addClass('error');
720                errors = true;
721            } else {
722                $('.uslugi-phone').removeClass('error');
723            }
724
725            if ($('.uslugi-email input').val() == '') {
726                $('.uslugi-email').addClass('error');
727                errors = true;
728            } else {
729                $('.uslugi-email').removeClass('error');
730            }
731
732            if (errors) return;
733
734            formData = new FormData($(this).get(0));
735
736            $.ajax({
737                url: '/local/ajax/uslugi_form.php',
738                contentType: false,
739                processData: false,
740                type: 'POST',
741                dataType: 'json',
742                data: formData,
743                success: function (data) {
744                    if (data.success) {
745                        var myModal = new bootstrap.Modal(document.getElementById('thanksModal'), {}).show();
746                        $('#uslugiModal').modal('hide');
747                        $('.uslugi-email input').val('');
748                        $('.uslugi-phone input').val('');
749                        $('.uslugi-name input').val('');
750                    }
751                }
752            });
753
754        });
755
756        $('.callback-form').on('submit', function (e) {
757
758            e.preventDefault();
759            let errors = false;
760
761            /*if ($('.callback-name input').val() == ''){
762               $('.callback-name').addClass('error');
763               errors = true;
764            }else{
765              $('.callback-name').removeClass('error');
766            }
767            */
768
769            if ($('.callback-phone input').val() == '') {
770                $('.callback-phone').addClass('error');
771                errors = true;
772            } else {
773                $('.callback-phone').removeClass('error');
774            }
775
776            /*if ($('.callback-org input').val() == ''){
777               $('.callback-org').addClass('error');
778               errors = true;
779            }else{
780              $('.callback-org').removeClass('error');
781            }
782
783            if ($('.callback-text textarea').val() == ''){
784               $('.callback-text').addClass('error');
785               errors = true;
786            }else{
787              $('.callback-text').removeClass('error');
788            }*/
789
790            if (errors) return;
791
792            formData = new FormData($(this).get(0));
793
794            $.ajax({
795                url: '/local/ajax/callback_form.php',
796                contentType: false,
797                processData: false,
798                type: 'POST',
799                dataType: 'json',
800                data: formData,
801                success: function (data) {
802                    if (data.success) {
803                        var myModal = new bootstrap.Modal(document.getElementById('thanksModal'), {}).show();
804                        $('#feedbackModal').modal('hide');
805                        $('.callback-org input').val('');
806                        $('.callback-phone input').val('');
807                        $('.callback-name input').val('');
808                        $('.callback-text textarea').val('');
809                    }
810                }
811            });
812
813        });
814
815        if ($('.works-form').length > 0) {
816            $('.works-form').on('submit', function (e) {
817
818                e.preventDefault();
819
820
821                let phone = $('.works-phone').val();
822
823                if ($('.works-phone').val() == '') {
824                    $('.works-phone-gr').addClass('error');
825                    return;
826                } else {
827                    $('.works-phone-gr').removeClass('error');
828                }
829
830                $.ajax({
831                    url: '/local/ajax/works_form.php',
832                    method: 'get',
833                    dataType: 'json',
834                    data: {
835                        phone: phone
836                    },
837                    success: function (data) {
838                        if (data.success) {
839                            var myModal = new bootstrap.Modal(document.getElementById('thanksModal'), {}).show();
840                            $('.works-phone').val('');
841                        }
842                    }
843                });
844
845            });
846        }
847
848    });
849
850
851    $(function () {
852        $.mask.definitions['~'] = "[+-]";
853        $(".phonemask").mask("+7 ( 999 ) 999-99-99");
854    });
855
856    //menu
857    $('.catalog-toggler').click(function () {
858        $(this).toggleClass('active');
859        $('.catalog-menu').toggleClass('active');
860    });
861    $('.mobile-catalog-toggler').click(function () {
862        $(this).toggleClass('active');
863        $('.catalog-menu.-mobile').toggleClass('active');
864    });
865    $('.mobile-menu-wrapper button.nav-link').click(function () {
866        $(this).toggleClass('active');
867    });
868    $('.section-block.have-childs .second-link').click(function (e) {
869        e.preventDefault();
870        $(this).toggleClass('active');
871    });
872    //menu end
873
874    $('.cabinet .edit-data').click(function () {
875        $(this).parents('form').addClass('active');
876        $('form.active').find('.form-control:disabled').prop("disabled", false);
877
878        $(this).hide();
879        $('.save-data').addClass('active');
880    });
881
882    $('.main-catalog-list .accordion-button').click(function () {
883        if ($(this).hasClass('collapsed')) {
884            $(this).parents('.accordion').removeClass('active');
885        } else {
886            $(this).parents('.accordion').addClass('active');
887        }
888    });
889
890    $('.btn-filter').click(function () {
891        $(this).toggleClass('open');
892        $(this).siblings('.section-filters').toggleClass('open');
893    });
894
895    $('.main-catalog-list .name').click(function () {
896        $(this).toggleClass('open');
897        $(this).siblings('.accordion').toggleClass('open');
898    });
899
900    $('.view-switcher a').click(function () {
901        var viewClass = $(this).data('view');
902        $(this).parents('.catalog-section').removeClass('lines');
903        $(this).parents('.catalog-section').addClass(viewClass);
904        $('.view-switcher a').removeClass('active');
905        $(this).addClass('active');
906    });
907
908
909    $('.brands-slick .slick-slider').not('.slick-initialized').slick({
910        infinite: false,
911        slidesToShow: 6,
912        slidesToScroll: 1,
913        nextArrow: $('.brands-slick .carousel-controls .carousel-control-next'),
914        prevArrow: $('.brands-slick .carousel-controls .carousel-control-prev'),
915        responsive: [
916            {
917                breakpoint: 1200,
918                settings: {
919                    slidesToShow: 4,
920                    slidesToScroll: 1,
921                }
922            },
923            {
924                breakpoint: 991,
925                settings: {
926                    slidesToShow: 2,
927                    slidesToScroll: 1,
928                }
929            },
930        ]
931    });
932
933    $('.catalog-slick .slick-slider').not('.slick-initialized').slick({
934        infinite: false,
935        slidesToShow: 5,
936        slidesToScroll: 1,
937        nextArrow: $('.catalog-slick .carousel-controls .carousel-control-next'),
938        prevArrow: $('.catalog-slick .carousel-controls .carousel-control-prev'),
939        responsive: [
940            {
941                breakpoint: 1200,
942                settings: {
943                    slidesToShow: 3,
944                    slidesToScroll: 1,
945                }
946            },
947            {
948                breakpoint: 991,
949                settings: {
950                    slidesToShow: 1,
951                    slidesToScroll: 1,
952                }
953            },
954        ]
955    });
956
957    $('.news-slick .slick-slider').not('.slick-initialized').slick({
958        infinite: false,
959        slidesToShow: 3,
960        slidesToScroll: 1,
961        nextArrow: $('.news-slick .carousel-controls .carousel-control-next'),
962        prevArrow: $('.news-slick .carousel-controls .carousel-control-prev'),
963        responsive: [
964            {
965                breakpoint: 1200,
966                settings: {
967                    slidesToShow: 3,
968                    slidesToScroll: 1,
969                }
970            },
971            {
972                breakpoint: 991,
973                settings: {
974                    slidesToShow: 1,
975                    slidesToScroll: 1,
976                }
977            },
978        ]
979    });
980
981    $('.articles-slick .slick-slider').not('.slick-initialized').slick({
982        infinite: false,
983        slidesToShow: 3,
984        slidesToScroll: 1,
985        nextArrow: $('.articles-slick .carousel-controls .carousel-control-next'),
986        prevArrow: $('.articles-slick .carousel-controls .carousel-control-prev'),
987        responsive: [
988            {
989                breakpoint: 991,
990                settings: {
991                    slidesToShow: 1,
992                    slidesToScroll: 1,
993                }
994            },
995        ]
996    });
997
998    $('.contract__list').not('.slick-initialized').slick({
999        infinite: false,
1000        arrows: false,
1001        slidesToShow: 6,
1002        slidesToScroll: 1,
1003        responsive: [
1004            {
1005                breakpoint: 1200,
1006                settings: {
1007                    slidesToShow: 3,
1008                    slidesToScroll: 1,
1009                    dots: true
1010                }
1011            },
1012            {
1013                breakpoint: 991,
1014                settings: {
1015                    slidesToShow: 2,
1016                    slidesToScroll: 1,
1017                    dots: true
1018                }
1019            },
1020            {
1021                breakpoint: 768,
1022                settings: {
1023                    slidesToShow: 1,
1024                    slidesToScroll: 1,
1025                    dots: true
1026                }
1027            },
1028        ]
1029    });
1030
1031    $('.contract__list-5').not('.slick-initialized').slick({
1032        infinite: false,
1033        arrows: false,
1034        slidesToShow: 5,
1035        slidesToScroll: 1,
1036        responsive: [
1037            {
1038                breakpoint: 1200,
1039                settings: {
1040                    slidesToShow: 3,
1041                    slidesToScroll: 1,
1042                    dots: true
1043                }
1044            },
1045            {
1046                breakpoint: 991,
1047                settings: {
1048                    slidesToShow: 2,
1049                    slidesToScroll: 1,
1050                    dots: true
1051                }
1052            },
1053            {
1054                breakpoint: 768,
1055                settings: {
1056                    slidesToShow: 1,
1057                    slidesToScroll: 1,
1058                    dots: true
1059                }
1060            },
1061        ]
1062    });
1063
1064    $('.product-slider').not('.slick-initialized').slick({
1065        infinite: false,
1066        slidesToShow: 1,
1067        slidesToScroll: 1,
1068        arrows: false,
1069        dots: true,
1070        appendDots: $('.product-slider-wrapper .slider-dots'),
1071        //nextArrow: $('.brands-slick .carousel-controls .carousel-control-next'),
1072        //prevArrow: $('.brands-slick .carousel-controls .carousel-control-prev'),
1073        responsive: [
1074            {
1075                breakpoint: 1200,
1076                settings: {
1077                    slidesToShow: 1,
1078                    slidesToScroll: 1,
1079                }
1080            },
1081            {
1082                breakpoint: 991,
1083                settings: {
1084                    slidesToShow: 1,
1085                    slidesToScroll: 1,
1086                }
1087            },
1088        ]
1089    });
1090
1091
1092    $(document).on('change', '.fregat-checkbox', function () {
1093
1094        if ($(this).prop('checked')) {
1095            $('.' + $(this).attr('fregat-btn')).removeClass('disabled').removeAttr('disabled');
1096        } else {
1097            $('.' + $(this).attr('fregat-btn')).addClass('disabled').attr('disabled', '');
1098        }
1099
1100    });
1101
1102
1103    $(window).scroll(function () {
1104        var scroll = $(window).scrollTop();
1105        if (scroll <= 250) {
1106            $(".header").removeClass("header-fixed");
1107        } else {
1108            $(".header").addClass("header-fixed");
1109        }
1110    });
1111
1112    $('.analog-btn').on('click', function () {
1113        $('#requestModal .modal-title').text('Подобрать аналог, получить консультацию инженера');
1114    });
1115
1116    function getCookie(name) {
1117        let matches = document.cookie.match(new RegExp(
1118            "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
1119        ));
1120        return matches ? decodeURIComponent(matches[1]) : undefined;
1121    }
1122
1123    function setCookie(name, value, options = {}) {
1124
1125        options = {
1126            path: '/',
1127            // при необходимости добавьте другие значения по умолчанию
1128            ...options
1129        };
1130
1131        if (options.expires instanceof Date) {
1132            options.expires = options.expires.toUTCString();
1133        }
1134
1135        let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
1136
1137        for (let optionKey in options) {
1138            updatedCookie += "; " + optionKey;
1139            let optionValue = options[optionKey];
1140            if (optionValue !== true) {
1141                updatedCookie += "=" + optionValue;
1142            }
1143        }
1144
1145        document.cookie = updatedCookie;
1146    }
1147
1148    $(document).on('click', '.setCookie', function (e) {
1149        e.preventDefault();
1150        let name = $(this).data('name'),
1151            val = $(this).data('value');
1152        setCookie(name, val, {'max-age': 2592000});
1153        window.location.reload();
1154    })
1155
1156    $(document).ready(function () {
1157        $(document).on('click', '.btn-load-fregat-more', function (e) {
1158
1159            e.preventDefault();
1160
1161            let page = Number($('.page-cur').val()) + 1;
1162
1163            console.log(page);
1164
1165            $.ajax({
1166                url: '/local/ajax/news_ajax.php',
1167                method: 'get',
1168                data: {
1169                    page: page
1170                },
1171                success: function (data) {
1172                    $('.fregat_pagg').remove();
1173                    $('.fregat_news_container').append(data);
1174                }
1175            });
1176        });
1177    });
1178
1179
1180});

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.