PageSourceSearch

https://dfence.ru/bitrix/templates/aspro-allcorp3/components/bitrix/catalog.section/catalog_block/script.js

js dfence.ru collected 2026-10-08 16:26:21 UTC 2,688 bytes, 93 lines download raw bytes

1if (!funcDefined("sliceItemBlock")) {
2  sliceItemBlock = function () {
3    $(".catalog-block .catalog-block__item:visible .catalog-block__info-title").sliceHeight({
4      row: ".grid-list",
5      item: ".catalog-block__item:visible",
6      mobile: true,
7    });
8  };
9}
10
11(function () {
12  const ready = function (callback) {
13    if (document.readyState !== "loading") {
14      callback();
15    } else {
16      document.addEventListener("DOMContentLoaded", callback);
17    }
18  };
19  const equalHeight = function (options) {
20    const parent = options.items.parent();
21    const parentRect = parent[0].getBoundingClientRect();
22    const index = options.index;
23    let items = options.items;
24    let size = options.size;
25
26    if (!size) {
27      const rect = options.items[0].getBoundingClientRect();
28      size = Math.round(parentRect.width / rect.width);
29    }
30    if (index) {
31      let from = 1;
32      let to = size;
33      if (index % size === 0) {
34        from = index - size;
35      } else {
36        from = index - (index % size);
37      }
38      to += from;
39      items = options.items.slice(from, to);
40    }
41
42    const sizes = [];
43    items.each(function (item) {
44      const _this = $(this).find(options.block);
45      _this.css("height", "");
46      sizes.push(_this[0].clientHeight);
47    });
48    const maxSize = Math.max.apply(null, sizes);
49
50    if (options.current) {
51      options.current.find(options.block).css("height", maxSize);
52    } else if (index) {
53      items
54        .eq(index - 1)
55        .find(options.block)
56        .css("height", maxSize);
57    } else {
58      items.each(function () {
59        $(this).find(options.block).css("height", maxSize);
60      });
61    }
62  };
63  const handler = function () {
64    $(document).on("mouseenter", ".catalog-block__wrapper.has-offers", function () {
65      const _this = $(this);
66      const parent = _this.parent();
67      const bHovered = _this.data("hovered");
68      if (bHovered) {
69        return;
70      }
71      const rect = _this[0].getBoundingClientRect();
72      const index = _this.index() + 1;
73
74      equalHeight({
75        items: parent.find(" .catalog-block__wrapper:visible"),
76        current: _this,
77        block: ".catalog-block__info",
78        index: index,
79      });
80
81      _this.css("height", rect.height);
82      _this.attr("data-hovered", true);
83    });
84    $(document).on("mouseleave", ".catalog-block__wrapper.has-offers", function () {
85      const _this = $(this);
86
87      _this.css("height", "");
88      _this.attr("data-hovered", false);
89      _this.find(".catalog-block__info").css("height", "");
90    });
91  };
92  ready(handler);
93})();

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.