PageSourceSearch

https://allrusbooks.eu/local/templates/aspro_max/js/mobile.js?161435190624621

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

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.