PageSourceSearch

https://novasoft-it.ru/wp-content/themes/housetech/js/single.js?ver=1.0.276

js novasoft-it.ru collected 2026-10-06 07:15:35 UTC 4,463 bytes, 129 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    function getAnchorOffset() {
3        let offset = 16;
4
5        ['#wpadminbar', '#header', '#nav'].forEach(selector => {
6            const element = document.querySelector(selector);
7
8            if (!element) {
9                return;
10            }
11
12            const styles = window.getComputedStyle(element);
13            const isStickyElement = styles.position === 'fixed' || styles.position === 'sticky';
14
15            if (isStickyElement) {
16                offset += element.getBoundingClientRect().height;
17            }
18        });
19
20        return offset;
21    }
22
23    const starsContainer = document.getElementById('starsContainer');
24    const starLabels = document.querySelectorAll('.star-label');
25    const starInputs = document.querySelectorAll('.rate-this__star');
26    let currentRating = 0;
27
28    function updateStarsDisplay(hoverValue = 0, isHovering = false) {
29        starLabels.forEach(label => {
30            const icon = label.querySelector('.star-icon');
31            icon.classList.remove('hover', 'selected', 'selected-prev');
32        });
33
34        if (isHovering && hoverValue > 0) {
35            starLabels.forEach(label => {
36                const value = parseInt(label.getAttribute('data-value'));
37                const icon = label.querySelector('.star-icon');
38
39                if (value <= hoverValue) {
40                    icon.classList.add('hover');
41                }
42            });
43        }
44        else if (currentRating > 0) {
45            starLabels.forEach(label => {
46                const value = parseInt(label.getAttribute('data-value'));
47                const icon = label.querySelector('.star-icon');
48
49                if (value === currentRating) {
50                    icon.classList.add('selected');
51                } else if (value < currentRating) {
52                    icon.classList.add('selected-prev');
53                }
54            });
55        }
56    }
57
58    if (starsContainer && starLabels.length && starInputs.length) {
59        starLabels.forEach(label => {
60            label.addEventListener('mouseenter', function () {
61                const hoverValue = parseInt(this.getAttribute('data-value'));
62                updateStarsDisplay(hoverValue, true);
63            });
64        });
65
66        starsContainer.addEventListener('mouseleave', function () {
67            updateStarsDisplay(0, false);
68        });
69
70        starInputs.forEach(input => {
71            input.addEventListener('change', function () {
72                currentRating = parseInt(this.value);
73                updateStarsDisplay(0, false);
74                console.log('Выбран рейтинг:', currentRating);
75            });
76        });
77
78        const checkedInput = document.querySelector('.rate-this__star:checked');
79
80        if (checkedInput) {
81            currentRating = parseInt(checkedInput.value);
82            updateStarsDisplay(0, false);
83        }
84    }
85
86    const animationContainer = document.getElementById('lottie-animation-8');
87
88    if (animationContainer && typeof lottie !== 'undefined') {
89        lottie.loadAnimation({
90            container: animationContainer,
91            renderer: 'svg',
92            loop: true,
93            autoplay: true,
94            path: 'animation/icons-serv/anim_Other.json'
95        });
96    }
97
98    /*
99    const title_inners = document.querySelector('.parallax-image-inners');
100    const speed_inners = 0.3;
101    if (title_inners) {
102        title_inners.style.transform = 'translateY( calc( var(--scrollparallax) * 1px ) )';
103
104        window.addEventListener('scroll', function () {
105            console.log(document.documentElement.scrollTop);
106            title_inners.style.setProperty("--scrollparallax", document.documentElement.scrollTop * speed_inners);
107        });
108    }
109    */
110
111    document.querySelectorAll('a[href^="#"]').forEach(link => {
112        link.addEventListener('click', function (e) {
113            e.preventDefault();
114
115            let href = this.getAttribute('href').substring(1);
116
117            const scrollTarget = document.getElementById(href);
118            if (scrollTarget) {
119                const topOffset = getAnchorOffset();
120                const targetPosition = scrollTarget.getBoundingClientRect().top + window.pageYOffset - topOffset;
121
122                window.scrollTo({
123                    top: Math.max(targetPosition, 0),
124                    behavior: 'smooth'
125                });
126            }
127        });
128    });
129});

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.