1(function (window, document) { 2 'use strict'; 3 4 var ROOT_SELECTOR = '.js-solos-partners-component'; 5 6 function boot() { 7 var $ = window.jQuery; 8 9 if (!$) { 10 console.error('[solos:partners.slider] jQuery не найден.'); 11 return; 12 } 13 14 if (typeof $.fn.owlCarousel !== 'function') { 15 console.error('[solos:partners.slider] owl.carousel.js не загÑÑжен.'); 16 return; 17 } 18 19 function initCarousel(root) { 20 var $root = $(root); 21 22 if ($root.data('solosPartnersInitialized')) { 23 return true; 24 } 25 26 var $slider = $root.find('.js-solos-partner-slider').first(); 27 28 if (!$slider.length) { 29 return false; 30 } 31 32 $root.data('solosPartnersInitialized', true); 33 34 $slider 35 .on('initialized.owl.carousel.solosPartners', function () { 36 $root.addClass('is-slider-ready'); 37 }) 38 .owlCarousel({ 39 loop: false, 40 rewind: true, 41 margin: 20, 42 nav: false, 43 dots: true, 44 slideBy: 'page', 45 smartSpeed: 450, 46 47 // ШÑаÑнÑй Lazy Load Owl Carousel 2. 48 lazyLoad: true, 49 lazyLoadEager: 0, 50 51 responsive: { 52 0: { items: 2 }, 53 768: { items: 3 }, 54 1024: { items: 4 }, 55 1280: { items: 5 }, 56 1560: { items: 6 } 57 } 58 }); 59 60 $root.find('.js-solos-partners-arrow-left') 61 .off('click.solosPartners') 62 .on('click.solosPartners', function (event) { 63 event.preventDefault(); 64 $slider.trigger('prev.owl.carousel'); 65 }); 66 67 $root.find('.js-solos-partners-arrow-right') 68 .off('click.solosPartners') 69 .on('click.solosPartners', function (event) { 70 event.preventDefault(); 71 $slider.trigger('next.owl.carousel'); 72 }); 73 74 return true; 75 } 76 77 var roots = document.querySelectorAll(ROOT_SELECTOR); 78 79 if (!roots.length) { 80 return; 81 } 82 83 // Owl и изобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð°ÐºÑивиÑÑÑÑÑÑ ÑолÑко пÑи попадании ÑекÑии во viewport. 84 if ('IntersectionObserver' in window) { 85 var observer = new IntersectionObserver(function (entries, instance) { 86 entries.forEach(function (entry) { 87 if (!entry.isIntersecting) { 88 return; 89 } 90 91 if (initCarousel(entry.target)) { 92 instance.unobserve(entry.target); 93 } 94 }); 95 }, { 96 root: null, 97 rootMargin: '0px', 98 threshold: 0.01 99 }); 100 101 Array.prototype.forEach.call(roots, function (root) { 102 observer.observe(root); 103 }); 104 105 return; 106 } 107 108 Array.prototype.forEach.call(roots, function (root) { 109 initCarousel(root); 110 }); 111 } 112 113 // Ðажно: script.js компоненÑа Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð¿Ð¾Ð´ÐºÐ»ÑÑен ÑанÑÑе footer.php. 114 // ÐоÑÑÐ¾Ð¼Ñ jQuery и Owl полÑÑаем ÑолÑко поÑле полной загÑÑзки ÑÑÑаниÑÑ. 115 // if (document.readyState === 'complete') { 116 boot(); 117 // } else { 118 // window.addEventListener('load', boot, { once: true }); 119 // } 120 121})(window, document);
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.