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.