PageSourceSearch

https://komplektadr.ru/bitrix/templates/aspro_max/js/blocks/blocks.js

js komplektadr.ru collected 2026-10-08 15:20:11 UTC 7,489 bytes, 218 lines download raw bytes

1InitMenuNavigationAim = function () {
2  var $block = $(".menu-navigation__sections-wrapper .menu-navigation__sections:not(.aim-init)");
3  if ($block.length) {
4    $block.addClass("aim-init");
5    loadScripts(arAsproOptions["SITE_TEMPLATE_PATH"] + "/vendor/js/jquery.menu-aim.js", function () {
6      $block.menuAim({
7        firstActiveRow: true,
8        rowSelector: "> .menu-navigation__sections-item",
9        activate: function activate(a) {
10          var _this = $(a),
11            index = _this.index(),
12            items = _this.closest(".menu-navigation__sections-wrapper").next(),
13            link = _this.find("> a");
14
15          _this.siblings().find("> a").addClass("dark_link");
16          link.addClass("colored_theme_text").removeClass("dark_link");
17          items.find(".parent-items").siblings().hide();
18          items.find(".parent-items").eq(index).show();
19        },
20        deactivate: function deactivate(a) {
21          var _this = $(a),
22            index = _this.index(),
23            items = _this.closest(".menu-navigation__sections-wrapper").next(),
24            link = _this.find("> a");
25
26          link.removeClass("colored_theme_text").addClass("dark_link");
27          items.find(".parent-items").siblings().hide();
28        },
29      });
30    });
31  }
32};
33
34readyDOM(function () {
35  window.asproAllProgressBar = document.querySelectorAll(".header-progress-bar__inner");
36});
37
38/*progress bar in header*/
39function updateProgressBar() {
40  let allProgressBar = typeofExt(window.asproAllProgressBar) === "nodelist" ? window.asproAllProgressBar : false;
41  if (allProgressBar && allProgressBar.length) {
42    let scrollHeight = Math.max(
43      document.body.scrollHeight,
44      document.documentElement.scrollHeight,
45      document.body.offsetHeight,
46      document.documentElement.offsetHeight,
47      document.body.clientHeight,
48      document.documentElement.clientHeight
49    );
50    let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
51    let clientHeight = document.documentElement.clientHeight;
52    let scrollProcent = Math.round((scrollTop / (scrollHeight - clientHeight)) * 100);
53    if (allProgressBar.length) {
54      for (let item = 0; item < allProgressBar.length; item++) {
55        allProgressBar[item].style.width = scrollProcent + "%";
56      }
57    }
58  }
59}
60/**/
61
62$(document).ready(function () {
63  //dropdown-select
64  $(document).on("click", ".dropdown-select .dropdown-select__title", function () {
65    var _this = $(this),
66      menu = _this.parent().find("> .dropdown-select__list");
67
68    BX.onCustomEvent("onCloseDropDown");
69
70   _this.toggleClass("dropdown-select__title--opened", menu.is(":hidden"));
71    menu.stop().slideToggle();
72  });
73
74  // close select
75  $("html, body").on("mousedown", function (e) {
76    if (e.target.className.toString().indexOf("adm") < 0) {
77      e.stopPropagation();
78      if (!$(e.target).closest(".dropdown-select").length) {
79        BX.onCustomEvent("onCloseDropDown");
80      }
81    }
82  });
83
84  BX.addCustomEvent("onCloseDropDown", function () {
85    $(".dropdown-select .dropdown-select__title").removeClass("dropdown-select__title--opened");
86    $(".dropdown-select__list:visible").stop().slideUp();
87  });
88  /**/
89
90  /*side head block*/
91  $(document).on("click", ".slide-block .slide-block__head", function (e) {
92    var _this = $(this),
93      menu = _this.siblings(".slide-block__body"),
94      bVisibleMeu = menu.is(":visible"),
95      animate = bVisibleMeu ? "slideUp" : "slideDown";
96
97    if (!_this.hasClass("clicked") && menu.length && !_this.hasClass("ignore") && !$(e.target).attr("href")) {
98      var type = _this.data("id");
99      _this.addClass("clicked");
100
101      if (bVisibleMeu) $.cookie(type + "_CLOSED", "Y");
102      else $.removeCookie(type + "_CLOSED");
103
104      menu.stop().slideToggle({
105        duration: 150,
106        start: function () {
107          _this.toggleClass("closed");
108        },
109        complete: function () {
110          _this.removeClass("clicked");
111
112          if (typeof window["stickySidebar"] !== "undefined") {
113            window["stickySidebar"].updateSticky();
114          }
115        },
116      });
117    }
118  });
119  /**/
120
121  /**/
122  $(".switch-item-block .switch-item-block__icons").on("click", function () {
123    var $this = $(this),
124      animationTime = 200;
125
126    if ($this.hasClass("switch-item-block__icons--small") && !$this.hasClass("active")) {
127      $this.addClass("active");
128      $this.siblings(".switch-item-block__icons--big").removeClass("active");
129      $this
130        .closest(".switch-item-block")
131        .find(".switch-item-block__count-wrapper--big")
132        .fadeOut(animationTime, function () {
133          $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--small").fadeIn(animationTime);
134        });
135
136      $this
137        .closest(".switch-item-block")
138        .siblings(".big-gallery-block")
139        .fadeOut(animationTime, function () {
140          $this.closest(".switch-item-block").siblings(".small-gallery-block").fadeIn(animationTime);
141        });
142    } else if ($this.hasClass("switch-item-block__icons--big") && !$this.hasClass("active")) {
143      $this.addClass("active");
144      $this.siblings(".switch-item-block__icons--small").removeClass("active");
145      $this
146        .closest(".switch-item-block")
147        .find(".switch-item-block__count-wrapper--small")
148        .fadeOut(animationTime, function () {
149          $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--big").fadeIn(animationTime);
150        });
151
152      $this
153        .closest(".switch-item-block")
154        .siblings(".small-gallery-block")
155        .fadeOut(animationTime, function () {
156          $this.closest(".switch-item-block").siblings(".big-gallery-block").fadeIn(animationTime);
157        });
158    }
159    setTimeout(function () {
160      InitLazyLoad();
161    }, 300);
162  });
163  /**/
164
165  /*many items menu*/
166
167  //   InitMenuNavigationAim();
168  /**/
169
170  /*progress bar in header*/
171  window.addEventListener("scroll", throttle(updateProgressBar, 200));
172  /**/
173
174  /*show password*/
175  $(".form-control:not(.eye-password-ignore) [type=password]").each(function (item) {
176    let passBlock = $(this).closest(".form-control");
177    let labelBlock = passBlock.find(".label_block");
178    if (labelBlock.length) {
179      labelBlock.addClass("eye-password");
180    } else {
181      passBlock.addClass("eye-password");
182    }
183  });
184  $(document).on("click", ".eye-password:not(.eye-password-ignore)", function (event) {
185    let input = this.querySelector("input");
186    let eyeWidth = 56;
187    if (this.clientWidth - eyeWidth < event.offsetX) {
188      if (input.type == "password") {
189        input.type = "text";
190        this.classList.add("password-show");
191      } else if (input.type == "text") {
192        input.type = "password";
193        this.classList.remove("password-show");
194      }
195    }
196  });
197  /**/
198});
199
200$(document).ready(function () {
201  $('.phone.with_dropdown').hover(
202    function(e) {
203      if (!$(this).closest('.mobileheader').length) {
204        let $dropdown = $(this).find('.dropdown');
205        if ($dropdown.length) {
206          let dropdown_rect = $dropdown[0].getBoundingClientRect();
207          let dropdown_left = $dropdown.closest('.right_menu_block').length ? 28 : 48;
208          if (dropdown_rect.right > document.body.clientWidth) {
209            $dropdown.css('left', (document.body.clientWidth - dropdown_rect.right - dropdown_left) + 'px');
210          }
211        }
212      }
213    },
214    function () {
215      $(this).find('.dropdown').css('left', '');
216    }
217  );
218});

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.