PageSourceSearch

https://analitik-lab.ru/bitrix/cache/js/s1/aspro-lite/page_74f6a0e…9df76a11d0130fc21f595_v1.js?178714999710121

js analitik-lab.ru collected 2026-10-07 17:02:02 UTC 10,121 bytes, 266 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/.default/js/fullpage-init.js?17655412789839";s:6:"source";s:45:"/local/templates/.default/js/fullpage-init.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3document.addEventListener('DOMContentLoaded', function () {
4    const fullpageContainer = document.getElementById('fullpage-index');
5
6    if (fullpageContainer) {
7        initCustomFullpage();
8    }
9});
10
11function initCustomFullpage() {
12    const container = document.getElementById('fullpage-index');
13    const headerContainer = document.querySelector('.headers-container');
14    const footer = document.querySelector('.footer-custom');
15
16    let currentSection = 0;
17    let isScrolling = false;
18    const SCROLL_SPEED = 800; // Скорость скролла в ms
19
20    // --- НОВОЕ: Функция для проверки, открыта ли кнопка "Услуги" ---
21    function isServicesButtonOpened() {
22        if (!headerContainer) return false;
23        const servicesButton = headerContainer.querySelector('.header-menu__link--only-catalog');
24        return servicesButton && servicesButton.classList.contains('opened');
25    }
26    // --- /НОВОЕ ---
27
28    // --- НОВОЕ: Функция для проверки, видима ли строка поиска ---
29    function isSearchResultVisible() {
30        const searchElement = document.querySelector('.title-search-result.title-search-input');
31        return searchElement && searchElement.style.display === 'block';
32    }
33    // --- /НОВОЕ ---
34
35    // --- НОВОЕ: Функция для проверки, открыт ли попап ---
36    function isPopupVisible() {
37        const popupWrapper = document.getElementById('popup_iframe_wrapper');
38        // Проверяем, существует ли элемент и отображается ли он как flex (или block, в зависимости от реализации)
39        // На основе предоставленного HTML, открытый попап имеет style="z-index: 3000; display: flex;"
40        return popupWrapper && popupWrapper.style.display === 'flex';
41    }
42    // --- /НОВОЕ ---
43
44
45    // Добавляем футер как последнюю секцию
46    function setupFooterAsSection() {
47        if (footer && !footer.classList.contains('section')) {
48            const footerClone = footer.cloneNode(true);
49            footerClone.classList.add('section', 'footer-section');
50
51            const wrapper = document.createElement('div');
52            wrapper.className = 'footer-content-wrapper';
53
54            while (footerClone.firstChild) {
55                wrapper.appendChild(footerClone.firstChild);
56            }
57
58            footerClone.appendChild(wrapper);
59            footer.style.display = 'none';
60            container.appendChild(footerClone);
61        }
62    }
63
64    // Получаем все секции включая футер
65    function getAllSections() {
66        return container.querySelectorAll('.section');
67    }
68
69    // Устанавливаем высоту секций
70    function setSectionHeight() {
71        const allSections = getAllSections();
72        const height = window.innerHeight + 'px';
73
74        allSections.forEach(section => {
75            if (section.classList.contains('footer-section')) {
76                section.style.height = 'auto';
77                section.style.minHeight = height;
78            } else {
79                section.style.height = height;
80            }
81        });
82    }
83
84    // Центрируем контент футера
85    function centerFooterContent() {
86        const footerSection = container.querySelector('.footer-section');
87        if (footerSection) {
88            const wrapper = footerSection.querySelector('.footer-content-wrapper');
89            if (wrapper) {
90                const sectionHeight = footerSection.offsetHeight;
91                const wrapperHeight = wrapper.offsetHeight;
92                const viewportHeight = window.innerHeight;
93
94                const topOffset = Math.max((viewportHeight - wrapperHeight) / 2, 0);
95                wrapper.style.paddingTop = topOffset + 'px';
96                wrapper.style.paddingBottom = topOffset + 'px';
97            }
98        }
99    }
100
101    // Управление отображением header'а с плавными переходами
102    function updateHeaderDisplay(isFirstSection) {
103        if (!headerContainer) return;
104
105        const headerTopPart = headerContainer.querySelector('.header__top-part');
106
107        if (isFirstSection) {
108            headerContainer.classList.remove('header-compact');
109            headerContainer.classList.add('header-full');
110
111            if (headerTopPart) {
112                headerTopPart.style.transition = `all ${SCROLL_SPEED}ms ease`;
113                headerTopPart.style.maxHeight = '100px';
114                headerTopPart.style.opacity = '1';
115                headerTopPart.style.visibility = 'visible';
116                headerTopPart.style.transform = 'translateY(0)';
117            }
118
119            headerContainer.style.transition = `all ${SCROLL_SPEED}ms ease`;
120
121        } else {
122            headerContainer.classList.remove('header-full');
123            headerContainer.classList.add('header-compact');
124
125            if (headerTopPart) {
126                headerTopPart.style.transition = `all ${SCROLL_SPEED}ms ease`;
127                headerTopPart.style.maxHeight = '0';
128                headerTopPart.style.opacity = '0';
129                headerTopPart.style.visibility = 'hidden';
130                headerTopPart.style.transform = 'translateY(-10px)';
131            }
132
133            headerContainer.style.transition = `all ${SCROLL_SPEED}ms ease`;
134        }
135    }
136
137    // Скролл к секции
138    function scrollToSection(index) {
139        const allSections = getAllSections();
140        if (index < 0 || index >= allSections.length || isScrolling) return;
141
142        isScrolling = true;
143
144        const previousSection = currentSection;
145        currentSection = index;
146
147        const isScrollingDown = index > previousSection;
148
149        updateHeaderDisplay(index === 0);
150
151        setTimeout(() => {
152            if (index === allSections.length - 1) {
153                allSections[index].scrollIntoView({
154                    behavior: 'smooth',
155                    block: 'start'
156                });
157            } else {
158                allSections[index].scrollIntoView({
159                    behavior: 'smooth'
160                });
161            }
162
163            setTimeout(() => {
164                isScrolling = false;
165            }, SCROLL_SPEED);
166
167        }, isScrollingDown ? 50 : 0);
168    }
169
170    // Обработчик колесика
171    window.addEventListener('wheel', function (e) {
172        if (isScrolling) return;
173
174        // --- ИЗМЕНЕНО: Проверяем статус кнопки "Услуги", строки поиска ИЛИ попапа ---
175        if (isServicesButtonOpened() || isSearchResultVisible() || isPopupVisible()) {
176            // Если любое из условий истинно, предотвращаем прокрутку страницы
177            e.preventDefault();
178            e.stopPropagation(); // Опционально: остановить всплытие события
179            return; // Выходим из обработчика, не вызывая прокрутку fullpage
180        }
181        // --- /ИЗМЕНЕНО ---
182
183        const allSections = getAllSections();
184        const isScrollingUp = e.deltaY < 0;
185
186        if (isScrollingUp) {
187            if (currentSection > 0) {
188                scrollToSection(currentSection - 1);
189            }
190        } else {
191            if (currentSection < allSections.length - 1) {
192                scrollToSection(currentSection + 1);
193            }
194        }
195    });
196
197    // Обработчик клавиш
198    document.addEventListener('keydown', function (e) {
199        if (isScrolling) return;
200
201        const allSections = getAllSections();
202        const isScrollingUp = e.key === 'ArrowUp' || e.key === 'PageUp';
203
204        if (isScrollingUp) {
205            if (currentSection > 0) {
206                scrollToSection(currentSection - 1);
207            }
208        } else if (e.key === 'ArrowDown' || e.key === 'PageDown') {
209            if (currentSection < allSections.length - 1) {
210                scrollToSection(currentSection + 1);
211            }
212        }
213    });
214
215    // Обработчик скролла для определения текущей секции
216    let scrollTimeout;
217    window.addEventListener('scroll', function () {
218        if (isScrolling) return;
219
220        clearTimeout(scrollTimeout);
221        scrollTimeout = setTimeout(() => {
222            updateCurrentSection();
223        }, 10);
224    });
225
226    // Обновление текущей секции на основе позиции скролла
227    function updateCurrentSection() {
228        const allSections = getAllSections();
229        const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
230
231        for (let i = 0; i < allSections.length; i++) {
232            const section = allSections[i];
233            const sectionTop = section.offsetTop;
234            const sectionBottom = sectionTop + section.offsetHeight;
235
236            const viewportCenter = scrollTop + (window.innerHeight / 2);
237
238            if (viewportCenter >= sectionTop && viewportCenter < sectionBottom) {
239                if (currentSection !== i) {
240                    currentSection = i;
241                    updateHeaderDisplay(currentSection === 0);
242                }
243                break;
244            }
245        }
246    }
247
248    // Инициализация
249    setupFooterAsSection();
250    setSectionHeight();
251    centerFooterContent();
252
253    updateHeaderDisplay(true);
254
255    window.addEventListener('resize', function () {
256        setSectionHeight();
257        centerFooterContent();
258    });
259
260    // Начинаем с первой секции
261    setTimeout(() => {
262        scrollToSection(0);
263    }, 10);
264}
265/* End */
266;; /* /local/templates/.default/js/fullpage-init.js?17655412789839*/

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.