PageSourceSearch

https://gari-museum.ru/static/uil/export/project_mo_theme_short_02…/js-height-equalizer.js?20260220222336

js gari-museum.ru collected 2026-10-08 09:07:23 UTC 3,425 bytes, 105 lines download raw bytes

1(function ($) {
2
3    $.fn.heightEqualizer = function (options) {
4
5        try {
6            document.createEvent('TouchEvent');
7            if (options.isDebug) console.log('heightEqualizer off because detect mobile device');
8            return this;
9        } catch (e) {
10        }
11
12        options = $.extend({
13            getHeight: function ($item) {
14                return $item.height();
15            },
16            precision: 2,
17            min_count: 2,
18            isDebug: false
19        }, options);
20
21        function process_iter($items, get_height, process_num) {
22            if (options.isDebug) console.group('heightEqualizer ' + process_num + ' (' + $items.selector + ')');
23
24            var group = [],
25                group_num = 1,
26                group_height = 0,
27                group_offset = -1,
28                item_offset = -1;
29
30            function applyGroupHeight() {
31                if (group.length >= options.min_count && group_height > 0) {
32                    if (options.isDebug) console.group('group ' + group_num);
33                    if (options.isDebug) console.log([group_offset, item_offset]);
34                    for (var i = 0; i < group.length; i++) {
35                        if (options.isDebug) console.log(group[i][0]);
36                        group[i].css('min-height', group_height + 'px');
37                    }
38                    if (options.isDebug) console.groupEnd();
39                    group_num++;
40                }
41            }
42
43            $items.each(function () {
44                var $item = $(this);
45                item_offset = $item.offset().top;
46                if (Math.abs(group_offset - item_offset) > options.precision) {
47                    applyGroupHeight();
48                    group = [];
49                    group_height = 0;
50                }
51                group.push($item);
52                group_height = Math.max(group_height, get_height($item));
53                group_offset = item_offset;
54            });
55
56            applyGroupHeight();
57
58            if (options.isDebug) console.groupEnd();
59        }
60
61        var is_process_runned = false;
62
63        function process($items) {
64            if (is_process_runned)
65                return;
66            is_process_runned = true;
67            var int_count = 1;
68            process_iter($items, options.getHeight, int_count);
69            int_count++;
70            var int = setInterval(function () {
71                process_iter($items, options.getHeight, int_count);
72                int_count++;
73                if (int_count > 3) {
74                    is_process_runned = false;
75                    clearInterval(int);
76                }
77            }, 2000);
78        }
79
80        var $items = this;
81
82        if ($items.length > 0) {
83            $(window)
84                .on('load', function () {
85                    process($items);
86                })
87                .on('scroll', $.debounce(1000, function () {
88                    process($items);
89                }))
90                .on('resize', $.debounce(1000, function () {
91                    $items.css('min-height', '');
92                    process($items);
93                }));
94            $(document).on('inova_admin.toggle_ui', function (event, state) {
95                if (!state)
96                    $items.css('min-height', '');
97                process($items);
98            });
99        }
100
101        return $items;
102
103    };
104
105})(jQuery);

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.