PageSourceSearch

https://it-premier.ru/bitrix/templates/aspro-allcorp3/js/blocks/controls.js

js it-premier.ru collected 2026-10-07 23:48:20 UTC 8,528 bytes, 250 lines download raw bytes

1$(document).ready(function () {
2  // dropdown-select
3  $(document).on("click", ".dropdown-select .dropdown-select__title", function () {
4    var _this = $(this),
5      menu = _this.parent().find("> .dropdown-select__list");
6
7    if (!_this.hasClass("clicked")) {
8      _this.addClass("clicked");
9
10      _this.toggleClass("opened");
11      menu.stop().slideToggle(100, function () {
12        _this.removeClass("clicked");
13      });
14    }
15  });
16
17  // dropdown-select change item
18  $(document).on("click", ".dropdown-select__list .mixitup-item", function () {
19    var $select = $(this).closest(".dropdown-select");
20
21    $select.find(".dropdown-select__list-link").removeClass("dropdown-select__list-link--current");
22    $(this).find(".dropdown-select__list-link").addClass("dropdown-select__list-link--current");
23
24    $select.find(".dropdown-select__title span").text($(this).text());
25    $select.find(".dropdown-select__title.opened").click();
26
27    const eventData = {
28      type: "change",
29      payload: {
30        item: $(this),
31      },
32    };
33    BX.onCustomEvent("onChangeOptionSelect", [eventData]);
34
35  });
36
37  // close select
38  $("html, body").on("mousedown", function (e) {
39    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
40      e.stopPropagation();
41
42      $(".dropdown-select .dropdown-select__title.opened").each(function () {
43        var $select = $(this).closest(".dropdown-select");
44        if (!$(e.target).closest($select).length) {
45          $(this).click();
46        }
47      });
48    }
49  });
50
51  // hint
52  $(document).on("click", ".hint__icon", function (e) {
53    e.stopImmediatePropagation();
54    var tooltipWrapp = $(this).closest(".hint");
55    if (tooltipWrapp.hasClass("active")) {
56      tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);
57    } else {
58      tooltipWrapp.addClass("active");
59      tooltipWrapp.find(".tooltip").slideDown(200);
60      tooltipWrapp.find(".tooltip_close").click(function (e) {
61        e.stopPropagation();
62        e.stopImmediatePropagation();
63        tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100);
64      });
65    }
66    e.stopPropagation();
67  });
68
69  // mixitUp
70  const containerEl = document.querySelector(".mixitup-container");
71  if (containerEl) {
72    var config = {
73      selectors: {
74        target: '[data-ref="mixitup-target"]',
75      },
76      /*animation: {
77        effects: "fade scale stagger(150ms)", // Set a 'stagger' effect for the loading animation
78      },*/
79      animation: {
80        effects: "", // Set a 'stagger' effect for the loading animation
81      },
82      load: {
83        filter: "none", // Ensure all targets start from hidden (i.e. display: none;)
84      },
85      animation: {
86        duration: 350,
87      },
88      controls: {
89        scope: "local",
90      },
91      callbacks: {
92        onMixStart: function (state) {
93          // console.log(state);
94        },
95        onMixClick: function (state, event) {
96          let $item = event.target.children.length ? event.target : event.target.parentElement;
97          $($item).siblings().removeClass("color-theme head-block__item--active active");
98          $($item).addClass("color-theme head-block__item--active active");
99        },
100        onMixEnd: function () {
101          // InitLazyLoad();
102        },
103      },
104    };
105    var mixer = mixitup(containerEl, config);
106
107    containerEl.classList.add("mixitup-ready");
108
109    mixer.show().then(function () {
110      // Remove the stagger effect for any subsequent operations
111      mixer.configure({
112        animation: {
113          effects: "fade scale",
114        },
115      });
116    });
117  }
118
119  /*show password*/
120  $(".form-group:not(.eye-password-ignore) [type=password]").each(function (item) {
121    let passBlock = $(this).closest(".form-group");
122    let labelBlock = passBlock.find(".label_block");
123    if (labelBlock.length) {
124      labelBlock.addClass("eye-password");
125    } else {
126      passBlock.addClass("eye-password");
127    }
128  });
129  $(document).on("click", ".eye-password:not(.eye-password-ignore)", function (event) {
130    let input = this.querySelector("input");
131    let eyeWidth = 56;
132    if (this.clientWidth - eyeWidth < event.offsetX) {
133      if (input.type == "password") {
134        input.type = "text";
135        this.classList.add("password-show");
136      } else if (input.type == "text") {
137        input.type = "password";
138        this.classList.remove("password-show");
139      }
140      event.stopPropagation();
141    }
142  });
143
144  // reload captcha
145  $(document).on("click", ".refresh", function (e) {
146    var captcha = $(this).parents(".captcha-row");
147    e.preventDefault();
148    $.ajax({
149      url: arAsproOptions["SITE_DIR"] + "ajax/captcha.php",
150    }).done(function (text) {
151      captcha.find("input[name=captcha_sid],input[name=captcha_code]").val(text);
152      captcha.find("img").attr("src", "/bitrix/tools/captcha.php?captcha_sid=" + text);
153      captcha.find("input[name=captcha_word]").val("").removeClass("error");
154      captcha.find(".captcha_input").removeClass("error").find(".error").remove();
155    });
156  });
157});
158
159// gallery switch
160$(document).on("click", ".gallery-view_switch__icons:not(.active)", function () {
161  var $this = $(this);
162  var animationTime = 200;
163  var bSmall = $this.hasClass("gallery-view_switch__icons--small");
164  var $switchGallery = $this.closest(".gallery-view_switch");
165  var $bigGallery = (
166    $this.closest(".big_gallery").length ? $this.closest(".big_gallery") : $this.closest(".gallery")
167  ).find(".gallery-big");
168  var $bigGalleryCounter = $switchGallery.find(".gallery-view_switch__count-wrapper--big");
169  var $smallGallery = (
170    $this.closest(".big_gallery").length ? $this.closest(".big_gallery") : $this.closest(".gallery")
171  ).find(".gallery-small");
172  var $smallGalleryCounter = $switchGallery.find(".gallery-view_switch__count-wrapper--small");
173  var $toHideGallery = bSmall ? $bigGallery : $smallGallery;
174  var $toHideGalleryCounter = bSmall ? $bigGalleryCounter : $smallGalleryCounter;
175  var $toShowGallery = bSmall ? $smallGallery : $bigGallery;
176  var $toShowGalleryCounter = bSmall ? $smallGalleryCounter : $bigGalleryCounter;
177
178  $this.addClass("active");
179  $this.siblings(".active").removeClass("active");
180
181  $toHideGalleryCounter.fadeOut(animationTime, function () {
182    $toShowGalleryCounter.fadeIn(animationTime);
183  });
184
185  $toHideGallery.fadeOut(animationTime, function () {
186    $toShowGallery.fadeIn(animationTime);
187  });
188});
189
190/*buy opt table items*/
191function optBuyBasketAction(basketItems, itemsToNotice) {
192  const basketParams = {
193    type: "multiple",
194    ajaxPost: "Y",
195    // iblock_id: _this.data("iblock_id"),
196    action: "buy",
197    items: [],
198  };
199  if (basketItems) {
200    basketParams["items"] = basketItems;
201  }
202
203  var bBasketTop =
204    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
205    $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
206    $(".basket.top").length;
207  var bBasketFly =
208    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
209
210  if (basketParams["items"].length) {
211    $.ajax({
212      url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
213      type: "POST",
214      data: basketParams,
215    }).done(function (html) {
216      if (bBasketTop) {
217        $(".ajax_basket").replaceWith(html);
218      } else if (bBasketFly) {
219        $(".ajax_basket").html($($.trim(html)).html());
220      }
221
222      // show cart or notice
223      if (typeof JNoticeSurface === "undefined") {
224        if (bBasketTop) {
225          $(".header-cart").addClass("opened");
226
227          if (typeof headerCartHideTimer !== "undefined") {
228            clearTimeout(headerCartHideTimer);
229          }
230
231          headerCartHideTimer = setTimeout(function () {
232            $(".header-cart").removeClass("opened");
233          }, 2000);
234        } else if (bBasketFly) {
235          setTimeout(function () {
236            if (!$(".ajax_basket").hasClass("opened")) {
237              $(".ajax_basket").addClass("opened");
238            }
239          }, 50);
240        }
241      } else {
242        JNoticeSurface.get().onAdd2cart(itemsToNotice);
243      }
244
245      var eventdata = { action: "loadBasket" };
246      BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
247      setBasketItemsClasses();
248    });
249  }
250}

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.