1function loadMainBannerSlide(slide) { 2 if (!slide) { 3 return null; 4 } 5 6 // Узкий Ð¼Ð°ÐºÐµÑ Ð±Ð°Ð½Ð½ÐµÑа â оÑделÑÐ½Ð°Ñ ÐºÐ°ÑÑинка в <source media>, поÑÑÐ¾Ð¼Ñ 7 // Ð½Ð°Ð±Ð¾Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½Ñем ÑанÑÑе Ñамой каÑÑинки: вÑÐ±Ð¾Ñ Ð²Ð½ÑÑÑи <picture> бÑаÑÐ·ÐµÑ 8 // Ð´ÐµÐ»Ð°ÐµÑ Ð² моменÑ, когда Ñ <img> поÑвлÑеÑÑÑ src, и к ÑÑой ÑекÑнде 9 // ваÑианÑÑ Ñже Ð´Ð¾Ð»Ð¶Ð½Ñ Ð±ÑÑÑ Ð½Ð° меÑÑе. ÐнаÑе на ÑелеÑоне Ð¿Ð¾Ð´Ñ Ð²Ð°ÑиÑÑÑ 10 // ÑиÑокий Ñайл. 11 var sources = slide.querySelectorAll('source[data-srcset]'); 12 for (var i = 0; i < sources.length; i++) { 13 sources[i].srcset = sources[i].dataset.srcset; 14 sources[i].removeAttribute('data-srcset'); 15 } 16 17 var image = slide.querySelector('img[data-src]'); 18 if (image) { 19 image.src = image.dataset.src; 20 image.removeAttribute('data-src'); 21 } 22 23 return slide.querySelector('img'); 24} 25 26function loadVisibleMainBannerSlides(swiper) { 27 if (!swiper.slides || swiper.slides.length < 2) { 28 return; 29 } 30 31 var nextIndex = (swiper.activeIndex + 1) % swiper.slides.length; 32 loadMainBannerSlide(swiper.slides[swiper.activeIndex]); 33 loadMainBannerSlide(swiper.slides[nextIndex]); 34} 35 36function scheduleFollowingMainBannerSlide(swiper) { 37 var loadFollowing = function() { 38 if (!swiper.slides || swiper.slides.length < 3) { 39 return; 40 } 41 42 var followingIndex = (swiper.activeIndex + 2) % swiper.slides.length; 43 loadMainBannerSlide(swiper.slides[followingIndex]); 44 }; 45 46 if ('requestIdleCallback' in window) { 47 window.requestIdleCallback(loadFollowing, {timeout: 2000}); 48 } else { 49 window.setTimeout(loadFollowing, 300); 50 } 51} 52 53var mainBannerAutoplayDelay = window.matchMedia('(max-width: 600px)').matches ? 10000 : 5000; 54 55var swipermain = new Swiper(".mainBanner", { 56 spaceBetween: 30, 57 speed: 1000, 58 centeredSlides: true, 59 // Слайд Ñам ÑвлÑеÑÑÑ ÑÑÑлкой. СÑандаÑÑнÑй role="group" Ð¾Ñ Swiper Ð´Ð»Ñ 60 // ÑлеменÑа <a> недопÑÑÑим и Ð»Ð¾Ð¼Ð°ÐµÑ accessibility tree в Lighthouse. 61 a11y: { 62 slideRole: null, 63 }, 64 autoplay: { 65 // Avoid replacing the largest first-screen image during initial mobile rendering. 66 delay: mainBannerAutoplayDelay, 67 disableOnInteraction: false, 68 }, 69 navigation: { 70 nextEl: ".swiper-button-next", 71 prevEl: ".swiper-button-prev", 72 }, 73 // ÐÑогÑеÑÑ-Ð±Ð°Ñ Ð½Ð°ÑÑÑаиваеÑÑÑ ÑеÑез pagination Ñ Ñипом progressbar 74 pagination: { 75 el: ".mainBanner .swiper-progressbar", 76 type: "progressbar", 77 }, 78 // ÐобавлÑем наблÑдаÑелей 79 observer: true, 80 observeParents: true, 81 on: { 82 init: function() { 83 // УбиÑаем клаÑÑ lock пÑинÑдиÑелÑно 84 const progressbar = document.querySelector('.mainBanner .swiper-progressbar'); 85 if (progressbar) { 86 progressbar.classList.remove('swiper-pagination-lock'); 87 } 88 loadVisibleMainBannerSlides(this); 89 // Do not download the third banner during the first screen load. 90 // It is scheduled after the first transition below. 91 }, 92 slideChangeTransitionStart: function() { 93 loadVisibleMainBannerSlides(this); 94 }, 95 slideChangeTransitionEnd: function() { 96 scheduleFollowingMainBannerSlide(this); 97 } 98 }, 99 breakpoints: { 100 0: { 101 slidesPerView: 1.08, 102 spaceBetween: 8, 103 centeredSlides: false 104 }, 105 360: { 106 slidesPerView: 1.08, 107 spaceBetween: 8, 108 centeredSlides: false 109 }, 110 601: { 111 slidesPerView: 1, 112 spaceBetween: 0, 113 centeredSlides: true 114 }, 115 1024: { 116 slidesPerView: 1, 117 spaceBetween: 0, 118 centeredSlides: true 119 } 120 } 121});
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.