PageSourceSearch

https://1939.ru/assets/template/js/scripts.js

js 1939.ru collected 2026-10-02 17:55:05 UTC 25,553 bytes, 836 lines download raw bytes

1$(function() {
2    
3    $('.mobile-menu .dropdown-button').addClass('active')
4
5    $('.product-slider').slick({
6        dots: true,
7        arrows: false,
8        infinite: true,
9        speed: 300,
10        slidesToShow: 1,
11        slidesToScroll: 1
12    });
13
14	let elementId = ".cookie-box";
15	
16	let closed = $.cookie(elementId);
17	
18    if (typeof closed === "undefined") {
19    	$(elementId).show();
20    }
21    
22    
23	$(elementId + ' ._close').click(function(e) {
24		e.preventDefault();
25		
26    	$(elementId).remove();
27    	
28		$.cookie(elementId, 1, {
29            expires: 9999999,
30            path: '/'
31        });
32	});
33
34    
35    
36    
37    
38let prevLastItem = $('.breadcrumb li').not('.active').last();
39let text = prevLastItem.text().trim(); 
40let link = prevLastItem.find('a').attr('href'); 
41$('.breadcrumb-mobile a').attr('href', link)
42$('.breadcrumb-mobile span').html(text)
43
44
45$('.faq-item section').on('click', function() {
46    $(this).find('svg').toggleClass('rotate')
47    $(this).next().slideToggle()
48})
49
50
51    $('.openSearch').on('click', function() {
52        $('.mobile-search-form form').slideToggle()
53    })
54    
55    const changeQuantity = (b, key = false, minus = 0) => {
56        let value, new_value;
57        const parent = $(b).closest('.col-sm-4')
58        if(!key) {
59            value = parent.find('.input-number').val() 
60        } else {
61            value = new_value = key
62        }
63        if(value) {
64            let price = parent.find('form').attr('data-price')
65            price = price.replace(/[^\d]/,'',price)
66            if(!key) {
67                 new_value = minus === 1 ? +value - 1 : +value + 1
68            }
69            return { new_value, price, parent }
70        }
71    }
72    
73    const plusQuantity = (b,value = false, minus = 0) => {
74        let { new_value, price, parent } = changeQuantity(b,value, minus)
75        if(price && price > 0) {
76             price = +price * +new_value
77             parent.next().find('.summa').html(price)
78        }
79    }
80    
81    
82    $('.cart-body .btn-plus').on('click', function() {
83        plusQuantity(this, false)
84    })
85    
86    $('.cart-body .btn-minus').on('click', function() {
87        plusQuantity(this, false, 1)
88    })
89    
90    $('.input-number').on('keyup', function(event) {
91        const value = event.target.value.replace(/[^\d]/,'',event.target.value);
92        if(value < 1) {
93            return false
94        } 
95        plusQuantity(this, value, 1)
96    })
97    
98    
99    
100    
101    var top_show = 280; // В каком положении полосы прокрутки начинать показ кнопки "Наверх"
102    var speed = 500; // Скорость прокрутки
103    var $backButton = $('#up');
104    
105    
106    $(".header-top ul li:lt(6)").hover(function() {
107        $(this).find("ul").stop(true, true).toggle()
108    });
109
110    
111    $('.tab_header > div').on('click', function() {
112        $('.tab_header div').removeClass('active')
113        const data_id = $(this).attr('data-id')
114        $(this).addClass('active')
115        $('.tab_body > div').hide();
116        $('#tab_'+data_id).fadeIn('fast')
117    })
118    
119
120    $(window).scroll(function() { // При прокрутке попадаем в эту функцию
121        /* В зависимости от положения полосы прокрукти и значения top_show, скрываем или открываем кнопку "Наверх" */
122        if ($(this).scrollTop() > top_show) {
123            $backButton.fadeIn();
124        } else {
125            $backButton.fadeOut();
126        }
127    });
128    
129
130    $backButton.click(function() { // При клике по кнопке "Наверх" попадаем в эту функцию
131        /* Плавная прокрутка наверх */
132        scrollto(0, speed);
133    });
134    
135    // $('.catalog .element').hover(function() {
136    //     $(this).css({
137    //         height: '500px'
138    //     })
139    // })
140
141
142    // scrollto
143    window.scrollto = function(destination, speed) {
144        if (typeof speed == 'undefined') {
145            speed = 800;
146        }
147        jQuery("html:not(:animated),body:not(:animated)").animate({
148            scrollTop: destination - 60
149        }, speed);
150    };
151    $("a.scrollto").click(function() {
152        var elementClick = $(this).attr("href")
153        var destination = $(elementClick).offset().top;
154        scrollto(destination);
155        return false;
156    });
157    // end scrollto 
158
159
160    // fancybox
161    // $('.fancybox').fancybox({
162    //     padding: 0,
163    //     openEffect: 'fade',
164    //     closeEffect: 'fade',
165    //     nextEffect: 'none',
166    //     prevEffect: 'none',
167    //     wrapCSS : 'fancybox-gallery-wrap',
168    //     helpers: {
169    //         overlay: {
170    //             locked: false
171    //         }
172    //     }
173    // });
174
175    $('.fancyboxModal').fancybox({
176        autoResize: true,
177        padding: 0,
178        openEffect: 'fade',
179        closeEffect: 'fade',
180        nextEffect: 'none',
181        prevEffect: 'none',
182        fitToView: false,
183        maxWidth: '100%',
184        scrolling: "no",
185        helpers: {
186            overlay: {
187                locked: false
188            }
189        }
190    });
191
192    // end fancybox
193
194
195    // validation
196        
197        $('.rf').each(function(){
198            var item = $(this), 
199            btn = item.find('.btn');
200            
201            function checkInput(){
202                item.find('select.required').each(function(){
203                    if($(this).val() == '0'){
204                        $(this).parents('.form-group').addClass('error');
205                        $(this).parents('.form-group').find('.error-message').show();
206                    } else {
207                        $(this).parents('.form-group').removeClass('error');
208                    }
209                });
210                
211                item.find('input[type=text].required').each(function(){
212                    if($(this).val() != ''){
213                        $(this).removeClass('error');
214                    } else {
215                        $(this).addClass('error');
216                        $(this).parent('.form-group').find('.error-message').show();
217                    }
218                });
219                
220                item.find('input[type=tel].required').each(function(){
221                    if($(this).val() != ''){
222                        $(this).removeClass('error');
223                    } else {
224                        $(this).addClass('error');
225                        $(this).parent('.form-group').find('.error-message').show();
226                    }
227                });
228                
229                item.find('textarea.required').each(function(){
230                    if($(this).val() != ''){
231                        $(this).removeClass('error');
232                    } else {
233                        $(this).addClass('error');
234                        $(this).parent('.form-group').find('.error-message').show();
235                    }
236                });
237                
238                item.find('input[type=email]').each(function(){
239                    var regexp = /^([a-z0-9_-]+\.)*[a-z0-9_-]+@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.[a-z]{2,6}$/i;
240                    var $this = $(this);
241                    if($this.hasClass('required')){
242                        if (regexp.test($this.val())) {
243                            $this.removeClass('error');
244                        }else {
245                            $this.addClass('error');
246                            $(this).parent('.form-group').find('.error-message').show();
247                        }
248                    }else{
249                        if($this.val() != ''){
250                            if (regexp.test($this.val())) {
251                                $this.removeClass('error');
252                            }else {
253                            
254                            $this.addClass('error');
255                            $(this).parent('.form-group').find('.error-message').show();
256                            }
257                        }else{
258                            $this.removeClass('error');
259                        }
260                    }
261                });
262                
263                
264                item.find('input[type=checkbox].required').each(function(){
265                    if($(this).is(':checked')){
266                        $(this).removeClass('error');
267                    } else {
268                        $(this).addClass('error');
269                        $(this).parent('.form-group').find('.error-message').show();
270                    }
271                });
272            }
273
274            btn.click(function(){
275                checkInput();
276                var sizeEmpty = item.find('.error:visible').length;
277                if(sizeEmpty > 0){
278                    return false;
279                } else {
280                    item.submit();
281                    $.fancybox.close();
282                }
283            });
284        });
285        
286        
287        $('select').change(function(){
288            if($(this).val() == ''){     
289                $(this).parents('.form-group').removeClass('selected');
290            } else {
291                $(this).parents('.form-group').addClass('selected');
292                $(this).parents('.form-group').removeClass('error');
293            }
294        });
295        
296    // end validation
297
298
299
300
301    // проверка на Internet Explorer 6-11
302    var isIE = /*@cc_on!@*/ false || !!document.documentMode;
303
304
305    if (isIE) {
306        $('body').addClass('ie');
307    }
308    // end   
309
310
311
312
313    $('.menu-button').click(function() {
314        $('.menu-button').toggleClass('active');
315        $('.mobile-menu').toggleClass('open');
316    });
317    $('.mobile-menu, .menu-button').click(function(e) {
318        if ($(e.target).hasClass('fancyboxModal') == false) {
319            e.stopPropagation();
320        }
321    });
322    $('body').click(function() {
323        $('.mobile-menu').removeClass('open');
324        $('.menu-button').removeClass('active');
325    });
326
327
328    $('.mobile-menu ul > li').has('ul').addClass('down');
329    $('.mobile-menu .down > ul').before('<span class="dropdown-button active"></span>');
330
331
332
333    $('.mobile-menu > div > ul > li > ul > li.down > .dropdown-button').removeClass('active').siblings('ul').hide();
334
335
336
337    $('.mobile-menu .dropdown-button').click(function() {
338        $(this).toggleClass('active');
339        if ($(this).siblings('ul').is(':visible')) {
340            $(this).siblings('ul').slideUp();
341        } else {
342            $(this).siblings('ul').slideDown();
343        }
344
345    });
346    
347    
348    
349    $('.anchor-menu-init .mobile-menu ul li a').click(function(){
350        $('.mobile-menu').removeClass('open');
351        $('.menu-button').removeClass('active');
352    });
353    
354    
355    
356    
357    // fixed top menu
358    
359    // var panel=$('.header-bottom'), pos=panel.offset().top, windWidth;
360        
361    //     $(window).scroll(function(){
362    //         if($(this).scrollTop() > pos && !panel.hasClass('fixed')){
363    //             panel.addClass('fixed');
364    //         }else if($(this).scrollTop() < pos && panel.hasClass('fixed')){         
365    //             panel.removeClass('fixed');  
366    //         }
367    //     });
368        
369        
370        
371        var panel = $('.header-bottom');
372var originalOffset = panel.offset().top; // Сохраняем оригинальную позицию ДО добавления fixed
373
374$(window).scroll(function() {
375    var scrollTop = $(this).scrollTop();
376    
377    console.log('ScrollTop:', scrollTop, 'OriginalOffset:', originalOffset); // Для отладки
378    
379    if (scrollTop > originalOffset && !panel.hasClass('fixed')) {
380        // Добавляем fixed и запоминаем высоту панели
381        panel.addClass('fixed').data('height', panel.outerHeight());
382        // Добавляем отступ для контента, чтобы не было скачка
383        $('body').css('padding-top', panel.data('height'));
384    } 
385    else if (scrollTop <= originalOffset && panel.hasClass('fixed')) {
386        // Убираем fixed и отступ
387        panel.removeClass('fixed');
388        $('body').css('padding-top', 0);
389    }
390});
391
392// Обновляем позицию при ресайзе
393$(window).resize(function() {
394    if (!panel.hasClass('fixed')) {
395        originalOffset = panel.offset().top;
396    }
397});
398        
399        window.addEventListener("resize", function() {
400            windWidth = window.innerWidth;
401            pos=panel.offset().top;
402            
403            if(windWidth > 767){
404                panel.removeClass('fixed');
405            }
406            
407            if($(this).scrollTop() > pos && !panel.hasClass('fixed')){
408                panel.addClass('fixed');
409            }else if($(this).scrollTop() < pos && panel.hasClass('fixed')){         
410                panel.removeClass('fixed');  
411            }
412                           
413        }, false);
414    
415    
416        window.addEventListener("orientationchange", function() {
417            windWidth = window.innerWidth;
418            pos=panel.offset().top;
419            
420            if(windWidth > 767){
421                panel.removeClass('fixed');
422            }
423            
424            if($(this).scrollTop() > pos && !panel.hasClass('fixed')){
425                panel.addClass('fixed');
426            }else if($(this).scrollTop() < pos && panel.hasClass('fixed')){         
427                panel.removeClass('fixed');  
428            }
429        }, false);
430
431    
432    // /. fixed top menu
433    
434    
435    $('.brands-carousel').slick({
436        infinite: true,
437        slidesToShow: 8,
438        slidesToScroll: 1,
439        autoplay: true,
440        autoplaySpeed: 4000,
441        speed: 800,
442        arrows: false,    
443        responsive: [
444            {
445                breakpoint: 1190,
446                settings: {
447                    slidesToShow: 6
448                }
449            },
450            {
451                breakpoint: 992,
452                settings: {
453                    slidesToShow: 5
454                }
455            },
456            {
457                breakpoint: 768,
458                settings: {
459                    slidesToShow: 4
460                }
461            },
462            {
463                breakpoint: 500,
464                settings: {
465                    slidesToShow: 3
466                }
467            }
468        ]    
469    }); 
470    
471    
472    $('.product-carousel').slick({
473        slidesToShow: 1,
474        slidesToScroll: 1,
475        arrows: false,
476        fade: true,
477        draggable: false,
478        infinite: true,
479        asNavFor: '.product-thumb-carousel'
480    });
481       
482
483$('.product-thumb-carousel').slick({
484    slidesToShow: 7,
485    slidesToScroll: 1,
486    asNavFor: '.product-carousel',
487    focusOnSelect: true,
488    swipeToSlide: true,
489    infinite: true,
490    arrows: false,
491    dots: true,
492    prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left"></i></button>',
493    nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right"></i></button>',
494    responsive: [{
495        breakpoint: 768,
496        settings: {
497            slidesToShow: 3,
498            arrows: false,
499            dots: true,
500            prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left"></i></button>',
501            nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right"></i></button>'
502        }
503    }]
504});
505    
506    $('#catalogcarousel1, #catalogcarousel2').slick({
507        slidesToShow: 4,
508        slidesToScroll: 1,
509        swipeToSlide: true,
510        infinite: true,
511        arrows: true,
512        prevArrow: '<a href="#" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>',
513        nextArrow: '<a href="#" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>',
514        centerPadding: '0',
515        responsive: [
516            {
517                breakpoint: 1190,
518                settings: {
519                    slidesToShow: 3
520                }
521            },
522            {
523                breakpoint: 992,
524                settings: {
525                    slidesToShow: 2
526                }
527            },
528            {
529                breakpoint: 700,
530                settings: {
531                    slidesToShow: 1
532                }
533            },
534            {
535                breakpoint: 500,
536                settings: {
537                    slidesToShow: 1,
538                    arrows: false
539                }
540            }
541        ] 
542    });
543    
544    
545    $('.banners-carousel').slick({
546        infinite: true,
547        slidesToShow: 5,
548        slidesToScroll: 5,
549        arrows: true,
550        prevArrow: '<a href="#" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>',
551        nextArrow: '<a href="#" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>',
552        responsive: [
553            {
554                breakpoint: 1470,
555                settings: {
556                    arrows: false
557                }
558            },
559            {
560                breakpoint: 992,
561                settings: {
562                    arrows: false,
563                    slidesToShow: 4,
564                    slidesToScroll: 4,
565                }
566            },
567            {
568                breakpoint: 767,
569                settings: {
570                    arrows: false,
571                    slidesToShow: 3,
572                    slidesToScroll: 3,
573                }
574            },
575            {
576                breakpoint: 500,
577                settings: {
578                    arrows: false,
579                    slidesToShow: 2,
580                    slidesToScroll: 2,
581                }
582            }
583        ]
584    });
585    
586    
587    
588    
589    // styler
590        if($('.select-styler').length > 0){
591            $('.select-styler').styler({
592                selectSearch: false,
593                onSelectOpened: function() { 
594                    if ( !$("html").hasClass("touch") ){
595                        $(this).find(".jq-selectbox__dropdown ul").jScrollPane({
596                            verticalDragMinHeight: 30,
597                            verticalDragMaxHeight: 50
598                        });
599                    }
600                    
601                }
602            }); 
603        }
604        
605
606    // end styler 
607    
608    
609    
610    
611/****************************** plus minus goods counter ************************************/        
612//plugin bootstrap minus and plus
613//http://jsfiddle.net/laelitenetwork/puJ6G/
614$.fn.globalNumber = function(){
615$('.btn-number').click(function(e){
616    e.preventDefault();
617    fieldName = $(this).attr('data-field');
618    type      = $(this).attr('data-type');
619    var input = $("input#"+fieldName);
620
621    var currentVal = parseInt(input.val());
622    if (!isNaN(currentVal)) {
623        if(type == 'minus') {
624            
625            if(currentVal > input.attr('min')) {
626                input.val(currentVal - 1).change();
627            } 
628            if(parseInt(input.val()) == input.attr('min')) {
629                $(this).attr('disabled', true);
630            }
631
632        } else if(type == 'plus') {
633
634            if(currentVal < input.attr('max')) {
635                input.val(currentVal + 1).change();
636            }
637            if(parseInt(input.val()) == input.attr('max')) {
638                $(this).attr('disabled', true);
639            }
640
641        }
642    } else {
643        input.val(0);
644    }
645});
646$('.input-number').focusin(function(){
647   $(this).data('oldValue', $(this).val());
648});
649$('.input-number').change(function() {
650    
651    minValue =  parseInt($(this).attr('min'));
652    maxValue =  parseInt($(this).attr('max'));
653    valueCurrent = parseInt($(this).val());
654
655    name = $(this).attr('id');
656    if(valueCurrent >= minValue) {
657        $(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
658    } else {
659        alert('К сожалению, было достигнуто минимальное значение');
660        $(this).val($(this).data('oldValue'));
661    }
662    if(valueCurrent <= maxValue) {
663        $(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
664    } else {
665        alert('К сожалению, было превышено максимальное значение');
666        $(this).val($(this).data('oldValue'));
667    }
668    
669    
670});
671$(".input-number").keydown(function (e) {
672        // Allow: backspace, delete, tab, escape, enter and .
673        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
674             // Allow: Ctrl+A
675            (e.keyCode == 65 && e.ctrlKey === true) || 
676             // Allow: home, end, left, right
677            (e.keyCode >= 35 && e.keyCode <= 39)) {
678                 // let it happen, don't do anything
679                 return;
680        }
681        // Ensure that it is a number and stop the keypress
682        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
683            e.preventDefault();
684        }
685    });
686};$.fn.globalNumber();
687/****************************** plus minus goods counter ************************************/ 
688
689    
690        $('.product-info-btn').click(function(e){
691            e.stopPropagation();
692            $(this).toggleClass('active');
693            $(this).parents('.element').find('.element-text').toggleClass('active');
694        });
695        
696        $('.catalog .element-text').click(function(e){
697            e.stopPropagation();
698        });
699        
700        $('body').click(function(){
701            $('.product-info-btn, .catalog .element-text').removeClass('active');
702        });
703        
704        
705        if (window.devicePixelRatio > 1) {
706            var lowresImages = $('img[data-retinasrc]'), thiswidth, thisheight;
707            
708            lowresImages.each(function(i) {
709                thiswidth = $(this).width();
710                thisheight = $(this).height();
711                
712                $(this).attr( 'width', thiswidth );
713                $(this).attr( 'height', thisheight );
714                
715                var lowres = $(this).attr('src');
716                var highres = $(this).data('retinasrc');
717                $(this).attr('src', highres);
718            });
719        }
720        
721        
722        $('.top-menu-catalog-wrapper, .top-menu-catalog-inner').hover(function(){
723            $('.one_icon').hide();
724            $('.hidden_icon_menu').show();
725            $('.top-menu-catalog-wrapper .title').addClass('hover');
726        },function(){
727            $('.hidden_icon_menu').hide()
728            $('.one_icon').show()
729            $('.top-menu-catalog-wrapper .title').removeClass('hover');
730        });
731        
732        
733        
734        
735        
736        $('#orderbutton').prop('disabled', true);
737        
738        $('#agreementorder').change(function () {
739            
740            if ($(this).prop('checked')==false){ 
741                $('#orderbutton').prop('disabled', true).addClass('disabled');
742            }else{
743                $('#orderbutton').prop('disabled', false).removeClass('disabled');
744            }
745        });
746    
747        
748        $('.search-switch-btn').click(function(){
749            $('.search-form-block').addClass('active');
750        });
751        
752        $('.search-form-block-after, .search-form-block-close').click(function(){
753            $('.search-form-block').removeClass('active');
754        });
755        
756        
757        
758        // ASIDE MENU
759        
760        
761        $('.aside-menu li').has('ul').addClass('down');
762        
763        $('.aside-menu > ul li.down > ul').before('<span class="dropdown-button"></span>');
764        
765        
766        $('.aside-menu .down .dropdown-button').each(function(){
767            if($(this).siblings('ul').is(':visible')){
768                $(this).addClass('active');
769            }
770        });
771        
772        
773        
774        $('.aside-menu .down .dropdown-button').click(function(){
775            
776            
777            
778            $(this).parent().toggleClass('open');
779            if($(this).siblings('ul').is(':visible')){
780                $(this).siblings('ul').slideUp();
781                $(this).removeClass('active');
782            }else{
783                $(this).siblings('ul').slideDown();
784                $(this).addClass('active');
785            }
786            
787        });
788        
789        
790        $('.aside-menu-title').click(function(){
791            $('.aside-menu').toggleClass('active');
792        });
793        
794        
795        // ASIDE MENU END
796        
797        
798        
799        var thisHeight,windWidth = window.innerWidth;;
800        
801        function figureScrollPane(){
802            if(windWidth > 992){
803                $('.aside-accordeon figure').each(function(){
804                    thisHeight = $(this).height();
805                    if(thisHeight > 169){
806                        $(this).jScrollPane({
807                            verticalDragMinHeight: 30,
808                            verticalDragMaxHeight: 50
809                        });   
810                    }
811                });
812            }
813        }
814        figureScrollPane();
815        
816        
817        $('.aside-accordeon > li .switch').click(function(){
818            if($(this).parents('li').children('ul').is(':visible')){
819                $(this).parents('li').removeClass('active');
820            }else{
821                $(this).parents('li').addClass('active');
822                figureScrollPane(); 
823            }
824        });
825        
826        
827        
828        $('.aside-filters-title').click(function(){
829            $(this).parents('.aside-filters-block').toggleClass('active');
830        });
831        
832        
833        
834    
835    
836}); // end ready

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.