PageSourceSearch

https://redcross.ru/local/templates/aspro-allcorp3/js/blocks/mobile.js

js redcross.ru collected 2026-10-02 05:02:25 UTC 7,502 bytes, 208 lines download raw bytes

1$(document).ready(function () {
2  /*  --- Bind mobile filter  --- */
3  var $mobilefilter = $("#mobilefilter");
4  var $mobiledMenu = $("#mobilemenu");
5  if ($mobilefilter.length) {
6    $mobilefilter.isOpen = $mobiledMenu.hasClass("show");
7    $mobilefilter.isAppendLeft = false;
8    $mobilefilter.isWrapFilter = false;
9    $mobilefilter.isHorizontalOrCompact = $(".filter_horizontal").length || $(".bx_filter_vertical.compact").length;
10    $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
11
12    $(document).on("click", ".bx-filter-title", function () {
13      OpenMobileFilter();
14    });
15
16    $(document).on("click", "#mobilefilter .svg-close.close-icons", function () {
17      CloseMobileFilter();
18    });
19
20    $(document).on("click", ".bx_filter_select_block", function (e) {
21      var bx_filter_select_container = $(e.target).parents(".bx_filter_select_container");
22      if (bx_filter_select_container.length) {
23        var prop_id = bx_filter_select_container.closest(".bx_filter_parameters_box").attr("data-property_id");
24        if ($("#smartFilterDropDown" + prop_id).length) {
25          $("#smartFilterDropDown" + prop_id).css({
26            "max-width": bx_filter_select_container.width(),
27            "z-index": "3020",
28          });
29        }
30      }
31    });
32
33    $(document).on("mouseup", ".bx_filter_section", function (e) {
34      if ($(e.target).hasClass("bx_filter_search_button")) {
35        CloseMobileFilter();
36      }
37    });
38
39    $(document).on("mouseup", ".bx_filter_parameters_box_title", function (e) {
40      $("[id^='smartFilterDropDown']").hide();
41      if ($(e.target).hasClass("close-icons")) {
42        CloseMobileFilter();
43      }
44    });
45
46    $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
47    var $mobilefilterOverlay = $("#mobilefilter-overlay");
48
49    $mobilefilterOverlay.click(function () {
50      if ($mobilefilter.isOpen) {
51        CloseMobileFilter();
52        //e.stopPropagation();
53      }
54    });
55
56    mobileFilterNum = function (num, def) {
57      if (def) {
58        $(".bx_filter_search_button").text(num.data("f"));
59      } else {
60        var str = "";
61        var $prosLeng = $(".bx_filter_parameters_box > span");
62
63        str +=
64          $prosLeng.data("f") +
65          " " +
66          num +
67          " " +
68          declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm")]);
69        $(".bx_filter_search_button").text(str);
70      }
71    };
72
73    declOfNumFilter = function (number, titles) {
74      cases = [2, 0, 1, 1, 1, 2];
75      return titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[number % 10 < 5 ? number % 10 : 5]];
76    };
77
78    OpenMobileFilter = function () {
79      if (!$mobilefilter.isOpen) {
80        $("body").addClass("jqm-initied wf");
81
82        $(".bx_filter_vertical .slide-block__head.filter_title").removeClass("closed");
83
84        $(".bx_filter_vertical .slide-block__head.filter_title + .slide-block__body").show();
85
86        if (!$mobilefilter.isAppendLeft) {
87          if (!$mobilefilter.isWrapFilter) {
88            $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
89            $mobilefilter.isWrapFilter = true;
90          }
91          $(".bx_filter").appendTo($("#mobilefilter"));
92          var helper = $("#filter-helper");
93          if (helper.length) {
94            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
95          }
96          $mobilefilter.isAppendLeft = true;
97        }
98        if (typeof checkFilterLandgings === "function") {
99          checkFilterLandgings();
100        }
101
102        $("#mobilefilter .bx_filter_parameters").addClass("mobile-scroll scrollbar");
103
104        $("#mobilefilter .slide-block .filter_title").addClass("ignore");
105        $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass(
106          "colored_theme_hover_bg-block"
107        );
108
109        $(".bx_filter_button_box.ajax-btns").addClass("colored_theme_bg");
110        $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass("hidden");
111        // InitCustomScrollBar();
112
113        // show overlay
114        setTimeout(function () {
115          $mobilefilterOverlay.fadeIn("fast");
116        }, 100);
117
118        // fix body
119        $("body").css({ overflow: "hidden", height: "100vh" });
120
121        // show mobile filter
122        $mobilefilter.addClass("show");
123        $mobilefilter.find(".bx_filter").css({ display: "block" });
124        $mobilefilter.isOpen = true;
125
126        $("#mobilefilter .bx_filter_button_box.btns.ajax-btns").removeClass("hidden");
127
128        var init = $mobilefilter.data("init");
129        if (typeof init === "undefined") {
130          $mobilefilter.scroll(function () {
131            $(".bx_filter_section .bx_filter_select_container").each(function () {
132              var prop_id = $(this).closest(".bx_filter_parameters_box").attr("data-property_id");
133              if ($("#smartFilterDropDown" + prop_id).length) {
134                $("#smartFilterDropDown" + prop_id).hide();
135              }
136            });
137          });
138
139          $mobilefilter.data("init", "Y");
140        }
141      }
142    };
143
144    CloseMobileFilter = function (append) {
145      $mobilefilter.find(".bx_filter_parameters").removeClass("scrollbar");
146
147      $("body").removeClass("jqm-initied wf");
148
149      $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass(
150        "colored_theme_hover_bg-block"
151      );
152      $(".slide-block .filter_title").removeClass("ignore");
153      $(".bx_filter_button_box.ajax-btns").removeClass("colored_theme_bg");
154
155      $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass("hidden");
156
157      if ($mobilefilter.isOpen) {
158        // scroll to top
159        $mobilefilter.find(".bx_filter_parameters").scrollTop(0);
160
161        // unfix body
162        $("body").css({ overflow: "", height: "" });
163
164        // hide overlay
165        setTimeout(function () {
166          $mobilefilterOverlay.fadeOut("fast");
167        }, 100);
168
169        // hide mobile filter
170        $mobilefilter.removeClass("show");
171        $mobilefilter.isOpen = false;
172      }
173
174      if (append && $mobilefilter.isAppendLeft) {
175        $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
176        var helper = $("#filter-helper");
177        if (helper.length) {
178          helper.appendTo($("#filter-helper-wrapper"));
179        }
180        $mobilefilter.isAppendLeft = false;
181        $mobilefilter.removeData("init");
182        mobileFilterNum($("#modef_num_mobile"), true);
183      }
184    };
185
186    checkMobileFilter = function () {
187      if (
188        (!window.matchMedia("(max-width: 991px)").matches && !$mobilefilter.isHorizontalOrCompact) ||
189        (!window.matchMedia("(max-width: 767px)").matches && $mobilefilter.isHorizontalOrCompact)
190      ) {
191        CloseMobileFilter(true);
192      }
193    };
194  } else {
195    checkTopFilter();
196    $(document).on("click", ".bx-filter-title", function () {
197      $(this).toggleClass("opened");
198      if ($(".visible_mobile_filter").length) {
199        $(".visible_mobile_filter").show();
200        $(".bx_filter_vertical, .bx_filter").slideToggle(333);
201      } else {
202        $(".bx_filter_vertical").closest("div[id^=bx_incl]").show();
203        $(".bx_filter_vertical, .bx_filter").slideToggle(333);
204      }
205    });
206  }
207  /*  --- END Bind mobile filter  --- */
208});

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.