PageSourceSearch

https://customforging.ru/bitrix/templates/aspro-allcorp3/js/item-action.js

js customforging.ru collected 2026-10-08 17:17:42 UTC 2,750 bytes, 77 lines download raw bytes

1$(document).ready(function () {
2  $(document).on("click", ".js-item-action", function () {
3    const action = $(this).data("action");
4    const _this = $(this);
5
6    _this.blur();
7    _this.toggleClass("active");
8    _this.parent().toggleClass("active");
9
10    if (typeof window[action + "Action"] === "function") {
11      window[action + "Action"](_this);
12    }
13  });
14});
15
16function compareAction(item) {
17  const id = item.data("id");
18
19  $.ajax({
20    url: arAsproOptions["SITE_DIR"] + "ajax/item.php",
21    type: "POST",
22    dataType: "json",
23    data: $.extend(item.data("item_compare"), { sessid: BX.bitrix_sessid(), action: item.data("action") }),
24  })
25    .done(function (data) {
26      arAsproOptions["COMPARE_ITEMS"] = data.items;
27      if (arAsproOptions["COMPARE_ITEMS"].length > 0) {
28        $(".js-compare-block").addClass("icon-block-with-counter--count");
29      } else {
30        $(".js-compare-block").removeClass("icon-block-with-counter--count");
31      }
32      $(".js-compare-block .count").text(arAsproOptions["COMPARE_ITEMS"].length);
33
34      if (BX.util.in_array(id, arAsproOptions["COMPARE_ITEMS"])) {
35        $(".js-item-action[data-id=" + id + "]").addClass("active");
36        $(".js-item-action[data-id=" + id + "]")
37          .parent()
38          .addClass("active");
39        $(".js-item-action[data-id=" + id + "]").attr(
40          "title",
41          $(".js-item-action[data-id=" + id + "]").data("title_compared")
42        );
43      } else {
44        $(".js-item-action[data-id=" + id + "]").removeClass("active");
45        $(".js-item-action[data-id=" + id + "]")
46          .parent()
47          .removeClass("active");
48        $(".js-item-action[data-id=" + id + "]").attr("title", $(".js-item-action[data-id=" + id + "]").data("title"));
49      }
50      if ($(".js-item-action[data-id=" + id + "] .info-buttons__item-text").length) {
51        $(".js-item-action[data-id=" + id + "] .info-buttons__item-text").text(
52          $(".js-item-action[data-id=" + id + "]").attr("title")
53        );
54      }
55      var eventdata = { action: "loadCompare", items: [item[0]] };
56      BX.onCustomEvent("onCompleteAction", [eventdata, arAsproOptions["COMPARE_ITEMS"]]);
57
58      BX.onCustomEvent("onNoticeCompare", [eventdata, arAsproOptions["COMPARE_ITEMS"]]);
59    })
60    .fail(function (res) {
61      console.error(res);
62    });
63}
64
65BX.addCustomEvent("onNoticeCompare", function (eventdata, itemsID) {
66  try {
67    if (eventdata && eventdata.items && $(eventdata.items[0]).closest('.js-popup-block').find('.side-icons__item--compare').hasClass("active")) {
68      // js notice
69      if (typeof JNoticeSurface !== "undefined") {
70        JNoticeSurface.get().onAdd2Compare(eventdata.items);
71      }
72      //
73    }
74  } catch (e) {
75    console.log(e);
76  }
77});

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.