PageSourceSearch

https://atriumceramic.ru/local/templates/aspro_max/js/mobile.js

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

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.