PageSourceSearch

https://mega-technika.ru/wp-content/cache/min/1/wp-content/themes/…/js/core/ui-widgets.js?ver=1789634564

js mega-technika.ru collected 2026-10-07 18:11:00 UTC 15,914 bytes, 21 lines download raw bytes

1document.addEventListener('DOMContentLoaded',function(){let sliderInstance=null;function initSlider(){const screenWidth=window.innerWidth;if(screenWidth>991&&!sliderInstance){sliderInstance=createSafeLoopSwiper('.slider__category-slider',{slidesPerView:5,spaceBetween:30,loop:!0,navigation:{nextEl:'.slider .swiper-button-next',prevEl:'.slider .swiper-button-prev',},pagination:{el:'.slider .swiper-pagination',clickable:!0,},breakpoints:{1600:{slidesPerView:5,},1400:{slidesPerView:4,},1200:{slidesPerView:4,},992:{slidesPerView:2,},}})}
2if(screenWidth<=991&&sliderInstance){sliderInstance.destroy(!0,!0);sliderInstance=null}}
3initSlider();window.addEventListener('resize',function(){initSlider()})});document.addEventListener('DOMContentLoaded',function(){document.querySelectorAll('.products__slider').forEach((sliderEl,index)=>{const swiper=createSafeLoopSwiper(sliderEl,{slidesPerView:5,spaceBetween:24,loop:!0,navigation:{nextEl:sliderEl.querySelector('.swiper-button-next'),prevEl:sliderEl.querySelector('.swiper-button-prev'),},pagination:{el:sliderEl.querySelector('.swiper-pagination'),clickable:!0,},breakpoints:{1600:{slidesPerView:4,},1400:{slidesPerView:3,},1200:{slidesPerView:2,},992:{slidesPerView:2,},768:{slidesPerView:2,},576:{slidesPerView:1,},0:{slidesPerView:1,}}})});document.querySelectorAll('.team__slider').forEach((sliderEl,index)=>{const sliderWrapper=sliderEl.closest('.team__slider-wrapper');const swiper=createSafeLoopSwiper(sliderEl,{slidesPerView:5,spaceBetween:24,loop:!0,navigation:{nextEl:sliderWrapper?.querySelector('.swiper-button-next'),prevEl:sliderWrapper?.querySelector('.swiper-button-prev'),},pagination:{el:sliderEl.querySelector('.swiper-pagination'),clickable:!0,},breakpoints:{1600:{slidesPerView:3,},1400:{slidesPerView:3,},1200:{slidesPerView:2,},992:{slidesPerView:2,},768:{slidesPerView:2,},576:{slidesPerView:1,},0:{slidesPerView:1,}}})})});document.addEventListener('DOMContentLoaded',function(){const slider=createSafeLoopSwiper('.reviews__slider',{slidesPerView:4,spaceBetween:24,loop:!0,navigation:{nextEl:'.reviews__slider .swiper-button-next',prevEl:'.reviews__slider .swiper-button-prev',},pagination:{el:'.reviews__slider .swiper-pagination',clickable:!0,},breakpoints:{1600:{slidesPerView:4},1400:{slidesPerView:4},1200:{slidesPerView:3},992:{slidesPerView:2},768:{slidesPerView:2},576:{slidesPerView:1},0:{slidesPerView:1},}});if(!slider)return;const allSlides=Array.from(document.querySelectorAll('.swiper-slide.reviews__item')).map(slide=>slide.outerHTML);let isFiltering=!1;function filterSlides(filter){if(isFiltering)return;isFiltering=!0;try{if(slider.loopedSlides&&slider.loopedSlides.length>0){slider.loopDestroy()}
4let filtered=allSlides.filter(slideHTML=>filter==='all'||slideHTML.includes(`data-category="${filter}"`));if(filtered.length===0){filtered=allSlides}
5const minSlides=slider.params.slidesPerView+1;if(filtered.length>0){while(filtered.length<minSlides){filtered=filtered.concat(filtered)}}
6slider.removeAllSlides();if(filtered.length>0){slider.appendSlide(filtered)}
7if(filtered.length>=minSlides){slider.loopCreate()}
8slider.update()}catch(error){console.error('Ошибка при фильтрации отзывов:',error)}finally{isFiltering=!1}}
9function syncFilters(filter){document.querySelectorAll('.reviews-btn').forEach(btn=>
9{if(btn.dataset.filter===filter){btn.classList.add('active')}else{btn.classList.remove('active')}});const select=document.querySelector('.reviews-select');if(select){select.value=filter}}
10document.querySelectorAll('.reviews-btn').forEach(btn=>{btn.addEventListener('click',()=>{const filter=btn.dataset.filter;syncFilters(filter);filterSlides(filter)})});const select=document.querySelector('.reviews-select');if(select){select.addEventListener('change',()=>{const filter=select.value;syncFilters(filter);filterSlides(filter)})}});function updateRangeBackground(input){const min=+input.min;const max=+input.max;const val=+input.value;const percent=((val-min)/(max-min))*100;input.style.background=`linear-gradient(to right, #fdd525 0%, #fdd525 ${percent}%, #fff ${percent}%, #fff 100%)`}
11document.querySelectorAll('.range-input').forEach(input=>{updateRangeBackground(input);input.addEventListener('input',()=>{updateRangeBackground(input);if(input.id==='payment'){document.getElementById('paymentValue').textContent=input.value+'%'}else if(input.id==='term'){document.getElementById('termValue').textContent=input.value+' мес.'}})});function updateRangeBackground(input){const min=+input.min;const max=+input.max;const val=+input.value;const percent=((val-min)/(max-min))*100;input.style.background=`linear-gradient(to right, #fdd525 0%, #fdd525 ${percent}%, #000 ${percent}%, #000 100%)`}
12document.querySelectorAll('.range-input-price').forEach(input=>{updateRangeBackground(input);input.addEventListener('input',()=>{updateRangeBackground(input);if(input.id==='priceFilter'){document.getElementById('priceFilterValue').textContent=Number(input.value).toLocaleString('ru-RU')+' ₽'}})});document.addEventListener('DOMContentLoaded',function(){const faqItems=document.querySelectorAll('.faq__item');faqItems.forEach(item=>{item.addEventListener('click',()=>{const isActive=item.classList.contains('faq__item-active');faqItems.forEach(el=>el.classList.remove('faq__item-active'));if(!isActive){item.classList.add('faq__item-active')}})})});document.addEventListener('DOMContentLoaded',function(){const infoBlocks=document.querySelectorAll('.info__text');infoBlocks.forEach(function(block){const readMoreBtn=block.querySelector('.readmore');if(!readMoreBtn)return;const children=Array.from(block.children).filter(el=>!el.classList.contains('readmore'));children.forEach((child,index)=>{if(index>1){child.classList.add('hidden-text')}});readMoreBtn.addEventListener('click',function(){block.classList.toggle('open');readMoreBtn.textContent=block.classList.contains('open')?'Свернуть':'Показать еще'})})});document.addEventListener('DOMContentLoaded',function(){const readMoreBtn=document.querySelector('.filter-readmore-link');const hiddenText=document.querySelector('.catalog__filter-hide');if(readMoreBtn&&hiddenText){readMoreBtn.addEventListener('click',function(){hiddenText.classList.toggle('show');readMoreBtn.classList.toggle('show');readMoreBtn.textContent=hiddenText.classList.contains('show')?'Свернуть':'Показать ещё'})}});document.addEventListener('DOMContentLoaded',function(){const showList=document.querySelector('.show-list');const showGrid=document.querySelector('.show-grid');const catalogProducts=document.querySelector('.catalog__products');if(catalogProducts&&showList&&showGrid){function setGridView(){catalogProducts.classList.remove('list');catalogProducts.classList.add('grid');showList.classList.remove('active');showGrid.classList.add('active')}
13if(showList){showList.addEventListener('click',function(){showList.classList.add('active');showGrid.classList.remove('active');catalogProducts.classList.remove('grid');catalogProducts.classList.add('list')})}
14if(showGrid){showGrid.addEventListener('click',function(){setGridView()})}
15window.addEventListener('resize',function(){if(window.innerWidth<991){if(!catalogProducts.classList.contains('grid')){setGridView()}}});if(window.innerWidth<991){setGridView()}}});document.addEventListener('DOMContentLoaded',function(){document.querySelectorAll('.cards__wrapper').forEach((sliderEl)=>{createSafeLoopSwiper(sliderEl,{slidesPerView:1,spaceBetween:16,pagination:{el:sliderEl.querySelector('.swiper-pagination'),clickable:!0,},loop:!1,breakpoints:{0:{slidesPerView:1,spaceBetween:16,},768:{slidesPerView:1,spaceBetween:16,},1200:{slidesPerView:2,spaceBetween:24,},},})})});const tovarThumbsEl=document.querySelector('.tovar__gallery-thumbs');const tovarMainEl=document.querySelector('.tovar__gallery-main');if(tovarThumbsEl&&tovarMainEl){const hasVideoCard=Boolean(document.querySelector('.tovar__gallery-bottom.has-product-video .tovar__gallery-video'));const thumbsSwiper=new Swiper(tovarThumbsEl,{slidesPerView:hasVideoCard?4:5,spaceBetween:8,watchSlidesProgress:!0,breakpoints:{0:{slidesPerView:3,},576:{slidesPerView:4,},992:{slidesPerView:hasVideoCard?4:5,},},});new Swiper(tovarMainEl,{spaceBetween:8,navigation:{nextEl:'.tovar__gallery-arrow--next',prevEl:'.tovar__gallery-arrow--prev',},thumbs:{swiper:thumbsSwiper,},})}
16document.addEventListener('DOMContentLoaded',function(){const btn=document.querySelector('.equipments__action-btn');const list=document.querySelector('.equipments__list');if(btn&&list){btn.addEventListener('click',function(e){e.preventDefault();list.classList.toggle('show-all');if(list.classList.contains('show-all')){btn.textContent='Скрыть комплектации'}else{btn.textContent='Показать все комплектации'}})}});document.addEventListener('DOMContentLoaded',function(){document.querySelectorAll('.similar__slider').forEach((sliderEl,index)=>{const swiper=createSafeLoopSwiper(sliderEl,{slidesPerView:5,spaceBetween:24,loop:!0,navigation:{nextEl:sliderEl.querySelector('.swiper-button-next'),prevEl:sliderEl.querySelector('.swiper-button-prev'),},pagination:{el:sliderEl.querySelector('.swiper-pagination'),clickable:!0,},breakpoints:{1600:{slidesPerView:4,},1400:{slidesPerView:3,},1200:{slidesPerView:2,},992:{slidesPerView:2,},768:{slidesPerView:2,},576:{slidesPerView:1,},0:{slidesPerView:1,}}})})});const thumbsSwiperSpare=new Swiper('.spare__gallery-thumbs',{direction:'vertical',slidesPerView:5,spaceBetween:8,watchSlidesProgress:!0,breakpoints:{0:{direction:'horizontal',slidesPerView:4,},768:{direction:'vertical',slidesPerView:4,}}});const mainSwiperSpare=new Swiper('.spare__gallery-main',{spaceBetween:8,navigation:{nextEl:'.spare__gallery-arrow--next',prevEl:'.spare__gallery-arrow--prev',},thumbs:{swiper:thumbsSwiperSpare,},});(()=>{const COLLAPSED_HEIGHT_PX=160;const blocks=document.querySelectorAll('.spare-info__description-text');if(!blocks.length){return}
17const refreshBlockState=(block)=>{const toggleBtn=block.querySelector('.spare-info__description-readmore');const content=block.querySelector('.spare-info__description-content');if(!toggleBtn||!content){return}
18const hasOverflow=content.scrollHeight>COLLAPSED_HEIGHT_PX+1;
18if(!hasOverflow){block.classList.remove('is-collapsed');toggleBtn.style.display='none';return}
19toggleBtn.style.display='';if(block.classList.contains('is-collapsed')){toggleBtn.textContent='Показать еще'}else{toggleBtn.textContent='Свернуть'}};blocks.forEach((block)=>{const toggleBtn=block.querySelector('.spare-info__description-readmore');if(!toggleBtn){return}
20refreshBlockState(block);toggleBtn.addEventListener('click',()=>{block.classList.toggle('is-collapsed');toggleBtn.textContent=block.classList.contains('is-collapsed')?'Показать еще':'Свернуть'})});window.addEventListener('resize',()=>{blocks.forEach((block)=>refreshBlockState(block))})})();const lightbox=GLightbox({selector:'data-gallery="spare"',closeOnOutsideClick:!0,});const reviewslightbox=GLightbox({selector:'[data-gallery="reviews"]',closeOnOutsideClick:!0,});document.addEventListener('DOMContentLoaded',function(){createSafeLoopSwiper('.brands__wrapper',{slidesPerView:'auto',spaceBetween:82,pagination:{el:'.brands__wrapper .swiper-pagination',clickable:!0},loop:!0,breakpoints:{0:{slidesPerView:2,spaceBetween:12},480:{slidesPerView:2,spaceBetween:12},576:{slidesPerView:'auto',spaceBetween:30},768:{slidesPerView:'auto',spaceBetween:48},992:{slidesPerView:'auto',spaceBetween:48},1199:{slidesPerView:5,spaceBetween:68}}})});document.addEventListener('DOMContentLoaded',function(){createSafeLoopSwiper('.clients-swiper',{slidesPerView:'auto',spaceBetween:82,pagination:{el:'.clients-swiper__pagination',clickable:!0},loop:!0,breakpoints:{0:{slidesPerView:'auto',spaceBetween:20},480:{slidesPerView:'auto',spaceBetween:20},576:{slidesPerView:'auto',spaceBetween:30},768:{slidesPerView:'auto',spaceBetween:48},992:{slidesPerView:'auto',spaceBetween:48},1199:{slidesPerView:5,spaceBetween:68}}})});document.addEventListener("DOMContentLoaded",function(){let swiperInstance=null;const breakpoint=991;const sliderContainer=document.querySelector(".options__slider");if(breakpoint&&sliderContainer){function initOrDestroySwiper(){const isMobile=window.innerWidth<breakpoint;if(isMobile&&!swiperInstance){swiperInstance=createSafeLoopSwiper(sliderContainer,{slidesPerView:1,spaceBetween:24,pagination:{el:sliderContainer.querySelector('.swiper-pagination'),clickable:!0,},breakpoints:{768:{slidesPerView:2,loop:!0,}}})}else if(!isMobile&&swiperInstance){swiperInstance.destroy(!0,!0);swiperInstance=null;const wrapper=sliderContainer.querySelector(".swiper-wrapper");wrapper.removeAttribute("style");
20wrapper.querySelectorAll(".swiper-slide").forEach(slide=>{slide.removeAttribute("style")})}}
21initOrDestroySwiper();window.addEventListener("resize",initOrDestroySwiper)}});document.addEventListener('DOMContentLoaded',function(){document.querySelectorAll('.banks__wrapper').forEach((sliderEl)=>{const sliderWrapper=sliderEl.closest('.banks__slider-wrapper');const swiper=createSafeLoopSwiper(sliderEl,{slidesPerView:4,spaceBetween:82,pagination:{el:sliderEl.querySelector('.swiper-pagination'),clickable:!0},navigation:{nextEl:sliderWrapper?.querySelector('.swiper-button-next'),prevEl:sliderWrapper?.querySelector('.swiper-button-prev'),},loop:!0,breakpoints:{0:{slidesPerView:2,spaceBetween:16},480:{slidesPerView:2,spaceBetween:16},576:{slidesPerView:2,spaceBetween:22},768:{slidesPerView:3,spaceBetween:22},992:{slidesPerView:3,spaceBetween:22},1199:{slidesPerView:3,spaceBetween:22},1399:{slidesPerView:4,spaceBetween:22}}});const toggleDesktopBanksArrows=()=>{if(!sliderWrapper)return;const prevEl=sliderWrapper.querySelector('.swiper-button-prev');const nextEl=sliderWrapper.querySelector('.swiper-button-next');if(!prevEl||!nextEl)return;const slidesCount=sliderEl.querySelectorAll('.swiper-slide:not(.swiper-slide-duplicate)').length;const slidesPerView=Number(swiper?.params?.slidesPerView)||1;const shouldHide=window.innerWidth>=1400&&slidesCount<=slidesPerView;prevEl.style.display=shouldHide?'none':'';nextEl.style.display=shouldHide?'none':''};toggleDesktopBanksArrows();swiper?.on('breakpoint',toggleDesktopBanksArrows);swiper?.on('resize',toggleDesktopBanksArrows);swiper?.on('update',toggleDesktopBanksArrows);window.addEventListener('resize',toggleDesktopBanksArrows)})});document.addEventListener('DOMContentLoaded',()=>{document.addEventListener('click',e=>{const copyButton=e.target.closest('.article-link');if(!copyButton)return;const articleItem=copyButton.closest('.article-item');if(!articleItem)return;const articleNumberEl=articleItem.querySelector('.article-num');if(!articleNumberEl)return;const articleNumber=articleNumberEl.textContent.trim();navigator.clipboard.writeText(articleNumber).then(()=>{console.log(`Скопировано: ${articleNumber}`);showCopiedMessage(copyButton)}).catch(err=>console.error('Ошибка копирования артикула:',err))})});function showCopiedMessage(linkElement){const message=document.createElement('div');message.textContent='Артикул скопирован';message.style.position='absolute';message.style.background='rgba(0,0,0,0.7)';message.style.color='#fff';message.style.padding='6px 12px';message.style.borderRadius='4px';message.style.fontSize='14px';message.style.pointerEvents='none';message.style.zIndex='1000';message.style.opacity='0';message.style.transition='opacity 0.3s ease';document.body.appendChild(message);const rect=linkElement.getBoundingClientRect();message.style.top=`${window.scrollY + rect.top}px`;message.style.left=`${window.scrollX + rect.right + 8}px`;requestAnimationFrame(()=>{message.style.opacity='1'});setTimeout(()=>{message.style.opacity='0';message.addEventListener('transitionend',()=>{message.remove()},{once:!0})},2000)}

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.