PageSourceSearch

https://dek-art.ru/bitrix/templates/aspro-priority2/js/blocks/controls.js?17743598708256

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

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.