PageSourceSearch

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

js albinika.ru collected 2026-10-06 06:25:01 UTC 7,690 bytes, 238 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
46          $(this).click();
47        }
48      });
49    }
50  });
51
52  // hint
53  $(document).on("click", ".hint__icon", function (e) {
54    e.stopImmediatePropagation();
55    var tooltipWrapp = $(this).closest(".hint");
56    if (tooltipWrapp.hasClass("active")) {
57      tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);
58    } else {
59      tooltipWrapp.addClass("active");
60      tooltipWrapp.find(".tooltip").slideDown(200);
61      tooltipWrapp.find(".tooltip_close").click(function (e) {
62        e.stopPropagation();
63        e.stopImmediatePropagation();
64        tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100);
65      });
66    }
67    e.stopPropagation();
68  });
69
70  // mixitUp
71  const containerEl = document.querySelector(".mixitup-container");
72  if (containerEl) {
73    var config = {
74      selectors: {
75        target: '[data-ref="mixitup-target"]',
76      },
77      /*animation: {
78        effects: "fade scale stagger(150ms)", // Set a 'stagger' effect for the loading animation
79      },*/
80      animation: {
81        effects: "", // Set a 'stagger' effect for the loading animation
82      },
83      load: {
84        filter: "none", // Ensure all targets start from hidden (i.e. display: none;)
85      },
86      animation: {
87        duration: 350,
88      },
89      controls: {
90        scope: "local",
91      },
92      callbacks: {
93        onMixStart: function (state) {
94          // console.log(state);
95        },
96        onMixClick: function (state, event) {
97          let $item = event.target.children.length ? event.target : event.target.parentElement;
98          $($item).siblings().removeClass("color-theme head-block__item--active active");
99          $($item).addClass("color-theme head-block__item--active active");
100        },
101        onMixEnd: function () {
102          // InitLazyLoad();
103        },
104      },
105    };
106    var mixer = mixitup(containerEl, config);
107
108    containerEl.classList.add("mixitup-ready");
109
110    mixer.show().then(function () {
111      // Remove the stagger effect for any subsequent operations
112      mixer.configure({
113        animation: {
114          effects: "fade scale",
115        },
116      });
117    });
118  }
119
120  /*show password*/
121  $(".form-group:not(.eye-password-ignore) [type=password]").each(function (item) {
122    let passBlock = $(this).closest(".form-group");
123    let labelBlock = passBlock.find(".label_block");
124    if (labelBlock.length) {
125      labelBlock.addClass("eye-password");
126    } else {
127      passBlock.addClass("eye-password");
128    }
129  });
130  $(document).on("click", ".eye-password:not(.eye-password-ignore)", function (event) {
131    let input = this.querySelector("input");
132    let eyeWidth = 56;
133    if (this.clientWidth - eyeWidth < event.offsetX) {
134      if (input.type == "password") {
135        input.type = "text";
136        this.classList.add("password-show");
137      } else if (input.type == "text") {
138        input.type = "password";
139        this.classList.remove("password-show");
140      }
141      event.stopPropagation();
142    }
143  });
144  /**/
145});
146
147// gallery switch
148$(document).on("click", ".gallery-view_switch__icons:not(.active)", function () {
149  var $this = $(this);
150  var animationTime = 200;
151  var bSmall = $this.hasClass("gallery-view_switch__icons--small");
152  var $switchGallery = $this.closest(".gallery-view_switch");
153  var $bigGallery = (
154    $this.closest(".big_gallery").length ? $this.closest(".big_gallery") : $this.closest(".gallery")
155  ).find(".gallery-big");
156  var $bigGalleryCounter = $switchGallery.find(".gallery-view_switch__count-wrapper--big");
157  var $smallGallery = (
158    $this.closest(".big_gallery").length ? $this.closest(".big_gallery") : $this.closest(".gallery")
159  ).find(".gallery-small");
160  var $smallGalleryCounter = $switchGallery.find(".gallery-view_switch__count-wrapper--small");
161  var $toHideGallery = bSmall ? $bigGallery : $smallGallery;
162  var $toHideGalleryCounter = bSmall ? $bigGalleryCounter : $smallGalleryCounter;
163  var $toShowGallery = bSmall ? $smallGallery : $bigGallery;
164  var $toShowGalleryCounter = bSmall ? $smallGalleryCounter : $bigGalleryCounter;
165
166  $this.addClass("active");
167  $this.siblings(".active").removeClass("active");
168
169  $toHideGalleryCounter.fadeOut(animationTime, function () {
170    $toShowGalleryCounter.fadeIn(animationTime);
171  });
172
173  $toHideGallery.fadeOut(animationTime, function () {
174    $toShowGallery.fadeIn(animationTime);
175  });
176});
177
178/*buy opt table items*/
179function optBuyBasketAction(basketItems, itemsToNotice) {
180  const basketParams = {
181    type: "multiple",
182    ajaxPost: "Y",
183    // iblock_id: _this.data("iblock_id"),
184    action: "buy",
185    items: [],
186  };
187  if (basketItems) {
188    basketParams["items"] = basketItems;
189  }
190
191  var bBasketTop =
192    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
193    $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
194    $(".basket.top").length;
195  var bBasketFly =
196    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
197
198  if (basketParams["items"].length) {
199    $.ajax({
200      url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
201      type: "POST",
202      data: basketParams,
203    }).done(function (html) {
204      if (bBasketTop) {
205        $(".ajax_basket").replaceWith(html);
206      } else if (bBasketFly) {
207        $(".ajax_basket").html($($.trim(html)).html());
208      }
209
210      // show cart or notice
211      if (typeof JNoticeSurface === "undefined") {
212        if (bBasketTop) {
213          $(".header-cart").addClass("opened");
214
215          if (typeof headerCartHideTimer !== "undefined") {
216            clearTimeout(headerCartHideTimer);
217          }
218
219          headerCartHideTimer = setTimeout(function () {
220            $(".header-cart").removeClass("opened");
221          }, 2000);
222        } else if (bBasketFly) {
223          setTimeout(function () {
224            if (!$(".ajax_basket").hasClass("opened")) {
225              $(".ajax_basket").addClass("opened");
226            }
227          }, 50);
228        }
229      } else {
230        JNoticeSurface.get().onAdd2cart(itemsToNotice);
231      }
232
233      var eventdata = { action: "loadBasket" };
234      BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
235      setBasketItemsClasses();
236    });
237  }
238}

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.