PageSourceSearch

https://philipkingsley-russia.ru/bitrix/templates/aspro_max/js/blocks/blocks.js

js philipkingsley-russia.ru collected 2026-10-05 00:13:10 UTC 12,375 bytes, 339 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        curCode = _this.closest(".cur").data("code");
144
145      /* request params */
146      obParams = {
147        PARAMS: bDetail ? $(".js-sku-config").data("params") : _this.closest(".js_wrapper_items").data("params"),
148        ID: container.data("offer_id"),
149        SITE_ID: container.data("site_id"),
150        LINK_ID: container.data("id") + "_" + (bDetail ? "detail" : (curCode ? curCode : 'block')),
151        IBLOCK_ID: container.data("offer_iblockid"),
152        IBLOCK_ID_PARENT: container.data("iblockid"),
153        PROPERTY_ID: container.data("propertyid"),
154        DEPTH: _this.closest(".item_wrapper").index(),
155        VALUE: selectMode ? _this.find("option:selected").data("onevalue") : _this.data("onevalue"),
156        CLASS: "inner_content",
157        PICTURE: img.data("src") ? img.data("src") : img.attr("src"),
158        ARTICLE_NAME: _this.closest(".item-parent").find(".article_block").data("name"),
159        ARTICLE_VALUE: _this.closest(".item-parent").find(".article_block").data("value"),
160      };
161      /**/
162
163      if ("clear_cache" in objUrl) {
164        if (objUrl.clear_cache == "Y") add_url += "?clear_cache=Y";
165      }
166
167      let isActiveContainer = container.hasClass("js-selected");
168      // set active
169      $(".bx_catalog_item_scu").removeClass("js-selected");
170      container.addClass("js-selected");
171
172      /* save selected values */
173      for (i = 0; i < obParams.DEPTH + 1; i++) {
174        strName = "PROP_" + container.find(".item_wrapper:eq(" + i + ") > div").data("id");
175        if (container.find(".item_wrapper:eq(" + i + ") select").length) {
176          obSelect[strName] = container.find(".item_wrapper:eq(" + i + ") select option:selected").data("onevalue");
177          obParams[strName] = container.find(".item_wrapper:eq(" + i + ") select option:selected").data("onevalue");
178        } else {
179          obSelect[strName] = container.find(".item_wrapper:eq(" + i + ") li.item.active").data("onevalue");
180          obParams[strName] = container.find(".item_wrapper:eq(" + i + ") li.item.active").data("onevalue");
181        }
182      }
183
184      // obParams.SELECTED = JSON.stringify(obSelect);
185      /**/
186
187      if (!selectMode) {
188        _this.siblings().removeClass("active");
189        _this.addClass("active");
190      }
191
192      if (_this.attr("title")) {
193        var skuVal = _this.attr("title").split(":")[1];
194        _this.closest(".item_wrapper").find(".show_class .val").text(skuVal);
195      } else {
196        var img_row = _this.find(" > i");
197        if (img_row.length && img_row.attr("title")) {
198          var skuVal = img_row.attr("title").split(":")[1];
199          _this.closest(".item_wrapper").find(".show_class .val").text(skuVal);
200        }
201      }
202
203      /* get sku */
204      if (window.obOffers && typeofExt(obOffers) === "array" && isActiveContainer) {
205        //from /ajax/js_item_detail.php
206        selectedValues = obSelect;
207        strPropValue = obParams["VALUE"];
208        depth = obParams["DEPTH"];
209        //wrapper = item;
210        arFilter = {};
211        tmpFilter = [];
212
213        UpdateSKUInfoByProps();
214        finalActionSKUInfo(_this);
215      } else {
216        /* get sku */
217        $.ajax({
218          url: arMaxOptions["SITE_DIR"] + "ajax/js_item_detail.php" + add_url,
219          type: "POST",
220          data: obParams,
221          success: function (html) {
222            var ob = BX.processHTML(html);
223            BX.ajax.processScripts(ob.SCRIPT);
224            finalActionSKUInfo(_this);
225          }
226        })
227      }
228      function finalActionSKUInfo(th) {
229        if ($(".counter_wrapp.list")) {
230          $(".counter_wrapp.list .counter_block.big").removeClass("big");
231        }
232        var sku_props = th.closest(".sku_props").find(".item_wrapper .item.active, .item_wrapper .list_values_wrapper");
233        $.each(sku_props, function (index, value) {
234          value = $(value);
235          var skuVal = ""
236          if (value.attr("title")) {
237            skuVal = value.attr("title").split(":")[1];
238          } else if(typeof value.val() !== 'undefined'){
239              skuVal = value.val()
240          } else {
241            var img_row = value.find(" > i");
242            if (img_row.length && img_row.attr("title")) {
243              skuVal = img_row.attr("title").split(":")[1];
244            }
245          }
246
247          if( skuVal != "" ){
248            value.closest(".item_wrapper").find(".show_class .val").text(skuVal);
249          }
250        });
251      }
252    };
253    $(document).on("click", ".ajax_load .bx_catalog_item_scu li.item", SelectOfferProp);
254    $(document).on("change", ".ajax_load .bx_catalog_item_scu select.list_values_wrapper", SelectOfferProp);
255    //detail
256    $(document).on("click", ".bx_catalog_item_scu.sku_in_detail li.item", SelectOfferProp);
257    $(document).on("change", ".bx_catalog_item_scu.sku_in_detail select.list_values_wrapper", SelectOfferProp);
258  }
259
260  /**/
261
262  /**/
263  $(".switch-item-block .switch-item-block__icons").on("click", function () {
264    var $this = $(this),
265      animationTime = 200;
266
267    if ($this.hasClass("switch-item-block__icons--small") && !$this.hasClass("active")) {
268      $this.addClass("active");
269      $this.siblings(".switch-item-block__icons--big").removeClass("active");
270      $this
271        .closest(".switch-item-block")
272        .find(".switch-item-block__count-wrapper--big")
273        .fadeOut(animationTime, function () {
274          $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--small").fadeIn(animationTime);
275        });
276
277      $this
278        .closest(".switch-item-block")
279        .siblings(".big-gallery-block")
280        .fadeOut(animationTime, function () {
281          $this.closest(".switch-item-block").siblings(".small-gallery-block").fadeIn(animationTime);
282        });
283    } else if ($this.hasClass("switch-item-block__icons--big") && !$this.hasClass("active")) {
284      $this.addClass("active");
285      $this.siblings(".switch-item-block__icons--small").removeClass("active");
286      $this
287        .closest(".switch-item-block")
288        .find(".switch-item-block__count-wrapper--small")
289        .fadeOut(animationTime, function () {
290          $this.closest(".switch-item-block").find(".switch-item-block__count-wrapper--big").fadeIn(animationTime);
291        });
292
293      $this
294        .closest(".switch-item-block")
295        .siblings(".small-gallery-block")
296        .fadeOut(animationTime, function () {
297          $this.closest(".switch-item-block").siblings(".big-gallery-block").fadeIn(animationTime);
298        });
299    }
300    setTimeout(function () {
301      InitLazyLoad();
302    }, 300);
303  });
304  /**/
305
306  /*many items menu*/
307
308  //   InitMenuNavigationAim();
309  /**/
310
311  /*progress bar in header*/
312  window.addEventListener("scroll", throttle(updateProgressBar, 200));
313  /**/
314
315  /*show password*/
316  $(".form-control:not(.eye-password-ignore) [type=password]").each(function (item) {
317    let passBlock = $(this).closest(".form-control");
318    let labelBlock = passBlock.find(".label_block");
319    if (labelBlock.length) {
320      labelBlock.addClass("eye-password");
321    } else {
322      passBlock.addClass("eye-password");
323    }
324  });
325  $(document).on("click", ".eye-password:not(.eye-password-ignore)", function (event) {
326    let input = this.querySelector("input");
327    let eyeWidth = 56;
328    if (this.clientWidth - eyeWidth < event.offsetX) {
329      if (input.type == "password") {
330        input.type = "text";
331        this.classList.add("password-show");
332      } else if (input.type == "text") {
333        input.type = "password";
334        this.classList.remove("password-show");
335      }
336    }
337  });
338  /**/
339});

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.