PageSourceSearch

https://musthave.ua/js/site.js?v=1703675393

js musthave.ua collected 2026-09-29 19:40:00 UTC 3,511 bytes, 91 lines download raw bytes

1'use strict'
2
3function adaptiveHeight(blocks) {
4    const divBlocks = document.querySelectorAll(blocks);
5
6    let maxHeight = 0;
7
8    divBlocks.forEach(block => {
9        const blockHeight = block.clientHeight;
10
11        if (blockHeight > maxHeight) {
12            maxHeight = blockHeight;
13        }
14    });
15
16    divBlocks.forEach(block => {
17        block.style.height = maxHeight + 'px';
18    });
19}
20
21const ProductImpression = function(target, items) {
22    let observer = new IntersectionObserver((entries, observer) => {
23        entries.forEach(entry => {
24            if (entry.isIntersecting) {
25                const target = entry.target;
26                let targetPosition = {
27                    top: window.pageYOffset + target.getBoundingClientRect().top,
28                    left: window.pageXOffset + target.getBoundingClientRect().left,
29                    right: window.pageXOffset + target.getBoundingClientRect().right,
30                    bottom: window.pageYOffset + target.getBoundingClientRect().bottom
31                };
32
33                let windowPosition = {
34                    top: window.pageYOffset,
35                    left: window.pageXOffset,
36                    right: window.pageXOffset + document.documentElement.clientWidth,
37                    bottom: window.pageYOffset + document.documentElement.clientHeight
38                };
39
40                if (
41                    targetPosition.bottom > windowPosition.top &&
42                    targetPosition.top < windowPosition.bottom &&
43                    targetPosition.right > windowPosition.left &&
44                    targetPosition.left < windowPosition.right &&
45                    !target.dataset.processed // Проверяем, был ли блок уже обработан
46                ) {
47                    if (items.length > 0) {
48                        const impressions = [];
49
50                        for (const key in items) {
51                            if (items.hasOwnProperty(key)) {
52                                const item = items[key];
53                                impressions.push({
54                                    product_id: item.product_id,
55                                    container_type: item.container_type
56                                });
57                            }
58                        }
59
60                        eS('sendEvent', 'ProductImpressions', {
61                            "ProductImpression": impressions
62                        });
63
64                        target.dataset.processed = true; // Устанавливаем флаг, что блок был обработан
65                        observer.unobserve(target); // Прекращаем отслеживать этот элемент, так как он уже был обработан
66                    }
67                }
68            }
69        });
70    }, { threshold: 0.5 }); // Устанавливаем порог для определения видимости
71
72    observer.observe(target); // Начинаем наблюдение за целевым элементом
73};
74
75// Change lang
76function changeLang(evt) {
77    evt.preventDefault();
78    const url = $(evt.currentTarget).attr('href');
79    const lang = $(evt.currentTarget).attr('hreflang');
80
81    if(url && lang) {
82        $.ajax({
83            url: '/language-switch',
84            method: 'post',
85            data: {lang: lang},
86            success: function(data){
87                location.href = url
88            }
89        });
90    }
91}

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.