PageSourceSearch

https://www.1mf.ru/bitrix/templates/aspro_max_new/js/blocks/blocks.js?177883093912309

js 1mf.ru collected 2026-09-29 15:57:48 UTC 12,309 bytes, 337 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    BX.loadScript(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      bVisibleMeu = menu.is(":visible"),
68      animate = !bVisibleMeu ? "transition.slideUpIn" : "fadeOut";
69
70    if (!_this.hasClass("clicked")) {
71      _this.addClass("clicked");
72
73      menu.velocity("stop").velocity(animate, {
74        duration: 300,
75        // delay: 250,
76        begin: function () {
77          _this.toggleClass("opened");
78        },
79        complete: function () {
80          _this.removeClass("clicked");
81        },
82      });
83    }
84  });
85
86  // close select
87  $("html, body").on("mousedown", function (e) {
88    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
89      e.stopPropagation();
90
91      if (!$(e.target).closest(".dropdown-select").length) {
92        $(".dropdown-select .dropdown-select__title.opened").click();
93      }
94    }
95  });
96  /**/
97
98  /*side head block*/
99  $(document).on("click", ".slide-block .slide-block__head", function (e) {
100    var _this = $(this),
101      menu = _this.siblings(".slide-block__body"),
102      bVisibleMeu = menu.is(":visible"),
103      animate = bVisibleMeu ? "slideUp" : "slideDown";
104
105    if (!_this.hasClass("clicked") && menu.length && !_this.hasClass("ignore") && !$(e.target).attr("href")) {
106      var type = _this.data("id");
107      _this.addClass("clicked");
108
109      if (bVisibleMeu) $.cookie(type + "_CLOSED", "Y");
110      else $.removeCookie(type + "_CLOSED");
111
112      menu.velocity("stop").velocity(animate, {
113        duration: 150,
114        // delay: 250,
115        begin: function () {
116          _this.toggleClass("closed");
117        },
118        complete: function () {
119          _this.removeClass("clicked");
120
121          if (typeof window["stickySidebar"] !== "undefined") {
122            window["stickySidebar"].updateSticky();
123          }
124        },
125      });
126    }
127  });
128  /**/
129
130  /*sku change props*/
131  if (!("SelectOfferProp" in window) && typeof window.SelectOfferProp != "function") {
132    SelectOfferProp = function () {
133      // return false;
134      var _this = $(this),
135        obParams = {},
136        obSelect = {},
137        objUrl = parseUrlQuery(),
138        add_url = "",
139        selectMode = _this.hasClass("list_values_wrapper") ? true : false,
140        container = _this.closest(".bx_catalog_item_scu"),
141        img = _this.closest(".item-parent").find(".thumb img"),
142        bDetail = _this.closest(".product-main").length;
143
144      /* request params */
145      obParams = {
146        PARAMS: bDetail ? $(".js-sku-config").data("params") : _this.closest(".js_wrapper_items").data("params"),
147        ID: container.data("offer_id"),
148        SITE_ID: container.data("site_id"),
149        LINK_ID: container.data("id") + "_" + (bDetail ? "detail" : _this.closest(".cur").data("code")),
150        IBLOCK_ID: container.data("offer_iblockid"),
151        IBLOCK_ID_PARENT: container.data("iblockid"),
152        PROPERTY_ID: container.data("propertyid"),
153        DEPTH: _this.closest(".item_wrapper").index(),
154        VALUE: selectMode ? _this.find("option:selected").data("onevalue") : _this.data("onevalue"),
155        CLASS: "inner_content",
156        PICTURE: img.data("src") ? img.data("src") : img.attr("src"),
157        ARTICLE_NAME: _this.closest(".item-parent").find(".article_block").data("name"),
158        ARTICLE_VALUE: _this.closest(".item-parent").find(".article_block").data("value"),
159      };
160      /**/
161
162      if ("clear_cache" in objUrl) {
163        if (objUrl.clear_cache == "Y") add_url += "?clear_cache=Y";
164      }
165
166      let isActiveContainer = container.hasClass("js-selected");
167      // set active
168      $(".bx_catalog_item_scu").removeClass("js-selected");
169      container.addClass("js-selected");
170
171      /* save selected values */
172      for (i = 0; i < obParams.DEPTH + 1; i++) {
173        strName = "PROP_" + container.find(".item_wrapper:eq(" + i + ") > div").data("id");
174        if (container.find(".item_wrapper:eq(" + i + ") select").length) {
175          obSelect[strName] = container.find(".item_wrapper:eq(" + i + ") select option:selected").data("onevalue");
176          obParams[strName] = container.find(".item_wrapper:eq(" + i + ") select option:selected").data("onevalue");
177        } else {
178          obSelect[strName] = container.find(".item_wrapper:eq(" + i + ") li.item.active").data("onevalue");
179          obParams[strName] = container.find(".item_wrapper:eq(" + i + ") li.item.active").data("onevalue");
180        }
181      }
182
183      // obParams.SELECTED = JSON.stringify(obSelect);
184      /**/
185
186      if (!selectMode) {
187        _this.siblings().removeClass("active");
188        _this.addClass("active");
189      }
190
191      if (_this.attr("title")) {
192        var skuVal = _this.attr("title").split(":")[1];
193        _this.closest(".item_wrapper").find(".show_class .val").text(skuVal);
194      } else {
195        var img_row = _this.find(" > i");
196        if (img_row.length && img_row.attr("title")) {
197          var skuVal = img_row.attr("title").split(":")[1];
198          _this.closest(".item_wrapper").find(".show_class .val").text(skuVal);
199        }
200      }
201
202      /* get sku */
203      if (window.obOffers && typeofExt(obOffers) === "array" && isActiveContainer) {
204        //from /ajax/js_item_detail.php
205        selectedValues = obSelect;
206        strPropValue = obParams["VALUE"];
207        depth = obParams["DEPTH"];
208        //wrapper = item;
209        arFilter = {};
210        tmpFilter = [];
211
212        UpdateSKUInfoByProps();
213        finalActionSKUInfo(_this);
214      } else {
215        /* get sku */
216        $.ajax({
217          url: arMaxOptions["SITE_DIR"] + "ajax/js_item_detail.php" + add_url,
218          type: "POST",
219          data: obParams,
220        }).success(function (html) {
221          var ob = BX.processHTML(html);
222          BX.ajax.processScripts(ob.SCRIPT);
223          finalActionSKUInfo(_this);
224        });
225      }
226      function finalActionSKUInfo(th) {
227        if ($(".counter_wrapp.list")) {
228          $(".counter_wrapp.list .counter_block.big").removeClass("big");
229        }
230        var sku_props = th.closest(".sku_props").find(".item_wrapper .item.active, .item_wrapper .list_values_wrapper");
231        $.each(sku_props, function (index, value) {
232          value = $(value);
233          var skuVal = ""
234          if (value.attr("title")) {
235            skuVal = value.attr("title").split(":")[1];
236          } else if(typeof value.val() !== 'undefined'){
237              skuVal = value.val()
238          } else {
239            var img_row = value.find(" > i");
240            if (img_row.length && img_row.attr("title")) {
241              skuVal = img_row.attr("title").split(":")[1];
242            }
243          }
244
245          if( skuVal != "" ){
246            value.closest(".item_wrapper").find(".show_class .val").text(skuVal);
247          }
248        });
249      }
250    };
251    $(document).on("click", ".ajax_load .bx_catalog_item_scu li.item", SelectOfferProp);
252    $(document).on("change", ".ajax_load .bx_catalog_item_scu select.list_values_wrapper", SelectOfferProp);
253    //detail
254    $(document).on("click", ".bx_catalog_item_scu.sku_in_detail li.item", SelectOfferProp);
255    $(document).on("change", ".bx_catalog_item_scu.sku_in_detail select.list_values_wrapper", SelectOfferProp);
256  }
257
258  /**/
259
260  /**/
261  $(".switch-item-block .switch-item-block__icons").on("click", function () {
262    var $this = $(this),
263      animationTime = 200;
264
265    if ($this.hasClass("switch-item-block__icons--small") && !$this.hasClass("active")) {
266      $this.addClass("active");
267      $this.siblings(".switch-item-block__icons--big").removeClass("active");
268      $this
269        .closest(".switch-item-block")
270        .find(".switch-item-block__count-wrapper--big")
271        .fadeOut(animationTime, function () {
272          $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--small").fadeIn(animationTime);
273        });
274
275      $this
276        .closest(".switch-item-block")
277        .siblings(".big-gallery-block")
278        .fadeOut(animationTime, function () {
279          $this.closest(".switch-item-block").siblings(".small-gallery-block").fadeIn(animationTime);
280        });
281    } else if ($this.hasClass("switch-item-block__icons--big") && !$this.hasClass("active")) {
282      $this.addClass("active");
283      $this.siblings(".switch-item-block__icons--small").removeClass("active");
284      $this
285        .closest(".switch-item-block")
286        .find(".switch-item-block__count-wrapper--small")
287        .fadeOut(animationTime, function () {
288          $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--big").fadeIn(animationTime);
289        });
290
291      $this
292        .closest(".switch-item-block")
293        .siblings(".small-gallery-block")
294        .fadeOut(animationTime, function () {
295          $this.closest(".switch-item-block").siblings(".big-gallery-block").fadeIn(animationTime);
296        });
297    }
298    setTimeout(function () {
299      InitLazyLoad();
300    }, 300);
301  });
302  /**/
303
304  /*many items menu*/
305
306  //   InitMenuNavigationAim();
307  /**/
308
309  /*progress bar in header*/
310  window.addEventListener("scroll", throttle(updateProgressBar, 200));
311  /**/
312
313  /*show password*/
314  $(".form-control:not(.eye-password-ignore) [type=password]").each(function (item) {
315    let passBlock = $(this).closest(".form-control");
316    let labelBlock = passBlock.find(".label_block");
317    if (labelBlock.length) {
318      labelBlock.addClass("eye-password");
319    } else {
320      passBlock.addClass("eye-password");
321    }
322  });
323  $(document).on("click", ".eye-password:not(.eye-password-ignore)", function (event) {
324    let input = this.querySelector("input");
325    let eyeWidth = 56;
326    if (this.clientWidth - eyeWidth < event.offsetX) {
327      if (input.type == "password") {
328        input.type = "text";
329        this.classList.add("password-show");
330      } else if (input.type == "text") {
331        input.type = "password";
332        this.classList.remove("password-show");
333      }
334    }
335  });
336  /**/
337});

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.