PageSourceSearch

https://lkg.ru/bitrix/templates/aspro_max/js/mobile.js

js lkg.ru collected 2026-10-08 03:30:19 UTC 21,833 bytes, 530 lines download raw bytes

1$(document).ready(function(){
2    /*  --- Bind mobile menu  --- */
3        var $mobileMenu = $("#mobilemenu")
4        if($mobileMenu.length){
5            $mobileMenu.isLeftSide = $mobileMenu.hasClass('leftside')
6            $mobileMenu.isOpen = $mobileMenu.hasClass('show')
7            $mobileMenu.isDowndrop = $mobileMenu.find('>.scroller').hasClass('downdrop')
8
9            $('#mobileheader .burger').click(function(){
10                SwipeMobileMenu()
11            })
12
13            if($mobileMenu.isLeftSide){
14                $mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>')
15                var $mobileMenuOverlay = $('#mobilemenu-overlay')
16
17                $mobileMenuOverlay.click(function(){
18                    if($mobileMenu.isOpen){
19                        CloseMobileMenu()
20                    }
21                });
22
23                $(document).swiperight(function(e) {
24                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
25                        OpenMobileMenu()
26                    }
27                });
28
29                $(document).swipeleft(function(e) {
30                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
31                        CloseMobileMenu()
32                    }
33                });
34            }
35            else{
36                $('#mobileheader').click(function(e){
37                    if(!$(e.target).closest('#mobilemenu').length && !$(e.target).closest('.burger').length && $mobileMenu.isOpen){
38                        CloseMobileMenu()
39                    }
40                });
41            }
42
43            $('#mobilemenu .menu a,#mobilemenu .social-icons a').click(function(e){
44                var $this = $(this)
45                if($this.hasClass('parent')){
46                    e.preventDefault()
47
48                    if(!$mobileMenu.isDowndrop){
49                        $this.closest('li').addClass('expanded')
50                        MoveMobileMenuWrapNext()
51                    }
52                    else{
53                        if(!$this.closest('li').hasClass('expanded')){
54                            $this.closest('li').addClass('expanded')
55                        }
56                        else{
57                            $this.closest('li').removeClass('expanded')
58                        }
59                    }
60                }
61                else{
62                    if($this.closest('li').hasClass('counters')){
63                        var href = $this.attr('href')
64                        if(typeof href !== 'undefined'){
65                            window.location.href = href
66                            window.location.reload()
67                        }
68                    }
69
70                    if(!$this.closest('.menu_back').length){
71                        CloseMobileMenu()
72                    }
73                }
74            })
75
76            $('#mobilemenu .dropdown .menu_back').click(function(e){
77                e.preventDefault()
78                var $this = $(this)
79                MoveMobileMenuWrapPrev()
80                setTimeout(function(){
81                    $this.closest('.expanded').removeClass('expanded')
82                }, 400)
83            })
84
85            OpenMobileMenu = function(){
86                CloseMobilePhone();
87
88                if(!$mobileMenu.isOpen){
89                    // hide styleswitcher
90                    if($('.style-switcher').hasClass('active')){
91                        $('.style-switcher .switch').trigger('click')
92                    }
93                    $('.style-switcher .switch').hide()
94
95                    if($mobileMenu.isLeftSide){
96                        // show overlay
97                        setTimeout(function(){
98                            $mobileMenuOverlay.fadeIn('fast')
99                        }, 100)
100                    }
101                    else{
102                        // scroll body to top & set fixed
103                        $('body').scrollTop(0).css({position: 'fixed'})
104
105                        // set menu top = bottom of header
106                        $mobileMenu.css({top: + ($('#mobileheader').height() + $('#mobileheader').offset().top) + 'px'})
107
108                        // change burger icon
109                        $('#mobileheader .burger').addClass('c')
110                    }
111
112                    // show menu
113                    $mobileMenu.addClass('show')
114                    $mobileMenu.isOpen = true
115
116                    if(!$mobileMenu.isDowndrop){
117                        var $wrap = $mobileMenu.find('.wrap').first()
118                        var params =  $wrap.data('params')
119                        if(typeof params === 'undefined'){
120                            params = {
121                                depth: 0,
122                                scroll: {},
123                                height: {}
124                            }
125                        }
126                        $wrap.data('params', params)
127                    }
128                }
129            }
130
131            CloseMobileMenu = function(){
132                if($mobileMenu.isOpen){
133                    // hide menu
134                    $mobileMenu.removeClass('show')
135                    $mobileMenu.isOpen = false
136
137                    // show styleswitcher
138                    $('.style-switcher .switch').show()
139
140                    if($mobileMenu.isLeftSide){
141                        // hide overlay
142                        setTimeout(function(){
143                            $mobileMenuOverlay.fadeOut('fast')
144                        }, 100)
145                    }
146                    else{
147                        // change burger icon
148                        $('#mobileheader .burger').removeClass('c')
149
150                        // body unset fixed
151                        $('body').css({position: ''})
152                    }
153
154                    if(!$mobileMenu.isDowndrop){
155                        setTimeout(function(){
156                            var $scroller = $mobileMenu.find('.scroller').first()
157                            var $wrap = $mobileMenu.find('.wrap').first()
158                            var params =  $wrap.data('params')
159                            params.depth = 0
160                            $wrap.data('params', params).attr('style', '')
161                            $mobileMenu.scrollTop(0)
162                            $scroller.css('height', '')
163                        }, 400)
164                    }
165                }
166            }
167
168            SwipeMobileMenu = function(){
169                if($mobileMenu.isOpen){
170                    CloseMobileMenu()
171                }
172                else{
173                    OpenMobileMenu()
174                }
175            }
176
177            function MoveMobileMenuWrapNext(){
178                if(!$mobileMenu.isDowndrop){
179                    var $scroller = $mobileMenu.find('.scroller').first()
180                    var $wrap = $mobileMenu.find('.wrap').first()
181                    if($wrap.length){
182                        var params =  $wrap.data('params')
183                        var $dropdownNext = $mobileMenu.find('.expanded>.dropdown').eq(params.depth)
184                        if($dropdownNext.length){
185                            // save scroll position
186                            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop())
187
188                            // height while move animating
189                            params.height[params.depth + 1] = Math.max($dropdownNext.height(), (!params.depth ? $wrap.height() : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height()))
190                            $scroller.css('height', params.height[params.depth + 1] + 'px')
191
192                            // inc depth
193                            ++params.depth
194
195                            // translateX for move
196                            $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
197
198                            // scroll to top
199                            setTimeout(function() {
200                                $mobileMenu.animate({scrollTop : 0}, 200);
201                            }, 100)
202
203                            // height on enimating end
204                            var h = $dropdownNext.height()
205                            setTimeout(function() {
206                                if(h){
207                                    $scroller.css('height', h + 'px')
208                                }
209                                else{
210                                    $scroller.css('height', '')
211                                }
212                            }, 200)
213                        }
214
215                        $wrap.data('params', params)
216                    }
217                }
218            }
219
220            function MoveMobileMenuWrapPrev(){
221                if(!$mobileMenu.isDowndrop){
222                    var $scroller = $mobileMenu.find('.scroller').first()
223                    var $wrap = $mobileMenu.find('.wrap').first()
224                    if($wrap.length){
225                        var params =  $wrap.data('params')
226                        if(params.depth > 0){
227                            var $dropdown = $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1)
228                            if($dropdown.length){
229                                // height while move animating
230                                $scroller.css('height', params.height[params.depth] + 'px')
231
232                                // dec depth
233                                --params.depth
234
235                                // translateX for move
236                                $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
237
238                                // restore scroll position
239                                setTimeout(function() {
240                                    $mobileMenu.animate({scrollTop : params.scroll[params.depth]}, 200);
241                                }, 100)
242
243                                // height on enimating end
244                                var h = (!params.depth ? false : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height())
245                                setTimeout(function() {
246                                    if(h){
247                                        $scroller.css('height', h + 'px')
248                                    }
249                                    else{
250                                        $scroller.css('height', '')
251                                    }
252                                }, 200)
253                            }
254                        }
255
256                        $wrap.data('params', params)
257                    }
258                }
259            }
260        }
261    /*  --- END Bind mobile menu  --- */
262
263    /*  --- Bind mobile phone  --- */
264        var $mobileHeader = $("#mobileheader");
265        var $mobilePhone = $("#mobilePhone");
266        $mobilePhone.isOpen = false;
267        if($mobilePhone.length){
268            $mobilePhone.isOpen = $mobilePhone.hasClass('show');
269
270            $(document).on('click', '.wrap_phones .svg-inline-phone', function(e){
271                SwipeMobilePhone();
272                e.stopPropagation();
273            });
274
275            $(document).on('click', '.wrap_phones .svg-inline-close', function(e){
276                CloseMobilePhone();
277                e.stopPropagation();
278            });
279        }
280
281        SwipeMobilePhone = function(){
282            if($mobilePhone.isOpen){
283                CloseMobilePhone();
284            }
285            else{
286                OpenMobilePhone();
287            }
288        }
289
290        OpenMobilePhone = function(){
291            if(!$mobilePhone.isOpen){
292                CloseMobileMenu();
293
294                // show overlay
295                $('<div class="jqmOverlay mobp" style="top:'+($mobileHeader.position().top+$mobileHeader.height())+'px;position:absolute"></div>').appendTo('body');
296
297                // toggle phones
298                setTimeout(function(){
299                    $mobilePhone.slideDown('fast', function(){
300                        $mobilePhone.addClass('show');
301                        $mobilePhone.isOpen = true;
302                    });
303                }, 100);
304            }
305        }
306
307        CloseMobilePhone = function(){
308            if($mobilePhone.isOpen){
309            	// toggle phones
310                setTimeout(function(){
311                    $mobilePhone.slideUp('fast', function(){
312                        $mobilePhone.removeClass('show');
313                        $mobilePhone.isOpen = false;
314
315    		        	// hide overlay
316    		            $('.jqmOverlay.mobp').remove();
317                    });
318                }, 100);
319            }
320        }
321
322        checkMobilePhone = function(){
323            if((!window.matchMedia('(max-width: 991px)').matches)){
324                CloseMobilePhone();
325    		}
326        }
327    /*  --- END Bind mobile phone  --- */
328
329    /*  --- Bind mobile filter  --- */
330        var $mobilefilter = $("#mobilefilter");
331        if($mobilefilter.length){
332            $mobilefilter.isOpen = $mobileMenu.hasClass('show');
333            $mobilefilter.isAppendLeft = false;
334            $mobilefilter.isWrapFilter = false;
335            $mobilefilter.isHorizontalOrCompact = $('.filter_horizontal').length || $('.bx_filter_vertical.compact').length;
336            $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
337
338            $(document).on('click', '.bx-filter-title', function(){
339                OpenMobileFilter();
340            });
341
342            $(document).on('click', '#mobilefilter .svg-close.close-icons', function(){
343                CloseMobileFilter();
344            });
345
346            $(document).on('click', '.bx_filter_select_block', function(e){
347                var bx_filter_select_container = $(e.target).parents('.bx_filter_select_container');
348                if(bx_filter_select_container.length) {
349                    var prop_id = bx_filter_select_container.closest('.bx_filter_parameters_box').attr('data-property_id');
350                    if($('#smartFilterDropDown'+prop_id).length){
351    					$('#smartFilterDropDown'+prop_id).css({"max-width":bx_filter_select_container.width(), "z-index":"3020"});
352                    }
353                }
354            });
355
356            $(document).on('mouseup', '.bx_filter_section', function(e){
357                if($(e.target).hasClass('bx_filter_search_button')) {
358                    CloseMobileFilter();
359                }
360            });
361
362
363            $(document).on('mouseup', '.bx_filter_parameters_box_title', function(e){
364                $("[id^='smartFilterDropDown']").hide();
365                if($(e.target).hasClass('close-icons')) {
366                    CloseMobileFilter();
367                }
368            });
369
370            /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
371                mobileFilterNum($(this));
372            });
373
374            $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
375                mobileFilterNum($(this));
376            });*/
377
378            $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
379            var $mobilefilterOverlay = $('#mobilefilter-overlay');
380
381            $mobilefilterOverlay.click(function(){
382                if($mobilefilter.isOpen){
383                    CloseMobileFilter();
384                    //e.stopPropagation();
385                }
386            });
387
388            mobileFilterNum = function(num, def){
389                if(def){
390                    $('.bx_filter_search_button').text(num.data("f"));;
391                }
392                else {
393                    var str = "";
394                    var $prosLeng = $('.bx_filter_parameters_box > span');
395
396                    str += $prosLeng.data("f") + " " + num + " " + declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm"),]);
397                    $('.bx_filter_search_button').text(str);
398                }
399            }
400
401            declOfNumFilter = function(number, titles){
402                cases = [2, 0, 1, 1, 1, 2];
403                return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
404            }
405
406            OpenMobileFilter = function(){
407                if(!$mobilefilter.isOpen)
408                {
409                    $('body').addClass('jqm-initied wf');
410
411                    $('.bx_filter_vertical .slide-block__head.filter_title').removeClass('closed');
412                    $('.bx_filter_vertical .slide-block__head.filter_title + .slide-block__body').show();
413
414
415                    if(!$mobilefilter.isAppendLeft)
416                    {
417                        if(!$mobilefilter.isWrapFilter)
418                        {
419                            $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
420                            $mobilefilter.isWrapFilter = true;
421                        }
422                        $(".bx_filter").appendTo($("#mobilefilter"));
423                        var helper = $('#filter-helper');
424                        if(helper.length) {
425                            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
426                        }
427                        $mobilefilter.isAppendLeft = true;
428
429                    }
430
431                    $("#mobilefilter .bx_filter_parameters").addClass('scrollbar');
432                    $("#mobilefilter .slide-block .filter_title").addClass('ignore');
433                    $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass('colored_theme_hover_bg-block');
434
435                    $(".bx_filter_button_box.ajax-btns").addClass('colored_theme_bg');
436                    $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass('hidden');
437                    InitCustomScrollBar();
438
439                    // show overlay
440                    setTimeout(function(){
441    					$mobilefilterOverlay.fadeIn('fast');
442                    }, 100);
443
444                    // fix body
445                    $('body').css({'overflow': 'hidden','height': '100vh'});
446
447                    // show mobile filter
448                    $mobilefilter.addClass('show');
449                    $mobilefilter.find('.bx_filter').css({'display':'block'});
450                    $mobilefilter.isOpen = true;
451
452                    var init =  $mobilefilter.data('init');
453                    if(typeof init === 'undefined'){
454                        $mobilefilter.scroll(function() {
455                            $(".bx_filter_section .bx_filter_select_container").each(function(){
456                                var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
457                                if($('#smartFilterDropDown'+prop_id).length){
458                                    $('#smartFilterDropDown'+prop_id).hide();
459                                }
460                            });
461                        });
462
463                        $mobilefilter.data('init', "Y");
464                    };
465                };
466            }
467
468            CloseMobileFilter = function(append){
469                $mobilefilter.find('.bx_filter_parameters').removeClass('scrollbar');
470                
471                if($("#mobilefilter .bx_filter_parameters").length)
472                    $('body').removeClass('jqm-initied wf');
473
474                $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass('colored_theme_hover_bg-block');
475                $(".slide-block .filter_title").removeClass('ignore');
476                $(".bx_filter_button_box.ajax-btns").removeClass('colored_theme_bg');
477
478                $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass('hidden');
479
480                if($mobilefilter.isOpen){
481                	// scroll to top
482                    $mobilefilter.find('.bx_filter_parameters').scrollTop(0);
483
484                    // unfix body
485                    $('body').css({'overflow': '','height': ''});
486
487                    // hide overlay
488                    setTimeout(function(){
489    					$mobilefilterOverlay.fadeOut('fast');
490                    }, 100);
491
492                    // hide mobile filter
493                    $mobilefilter.removeClass('show');
494                    $mobilefilter.isOpen = false;
495                }
496
497                if(append && $mobilefilter.isAppendLeft){
498                    $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
499                    var helper = $('#filter-helper');
500                    if(helper.length) {
501                        helper.appendTo($('#filter-helper-wrapper'));
502                    }
503                    $mobilefilter.isAppendLeft = false;
504                    $mobilefilter.removeData('init');
505                    mobileFilterNum($("#modef_num_mobile"),true);
506    	        }
507            }
508
509            checkMobileFilter = function(){
510                if((!window.matchMedia('(max-width: 991px)').matches && !$mobilefilter.isHorizontalOrCompact) || (!window.matchMedia('(max-width: 767px)').matches && $mobilefilter.isHorizontalOrCompact)){
511                    CloseMobileFilter(true);
512    			}
513            }
514        }
515        else {
516            checkTopFilter();
517            $(document).on('click', '.bx-filter-title', function(){
518    			$(this).toggleClass("opened");
519    			if($('.visible_mobile_filter').length) {
520    				$('.visible_mobile_filter').show();
521    				$('.bx_filter_vertical, .bx_filter').slideToggle(333);
522    			}
523    			else{
524    				$('.bx_filter_vertical').closest('div[id^=bx_incl]').show();
525    			    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
526    			}
527            });
528        }
529    /*  --- END Bind mobile filter  --- */
530})

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.