1jQuery(function ($) { 2 const PAGE_SIZE = 25; 3 const $events = $('.lazy-load-item'); 4 const $sentinel = $('#lazy-load-sentinel'); 5 const $loader = $('#lazy-loader'); 6 7 let observer; 8 9 const revealNextBatch = () => { 10 const $next = $events.filter('.hidden').slice(0, PAGE_SIZE); 11 $next.removeClass('hidden'); 12 13 // nothing left - disconnect sentinel 14 if ($events.filter('.hidden').length === 0) { 15 if (observer) { 16 observer.disconnect(); 17 } 18 $sentinel.hide(); 19 } 20 }; 21 22 // initial load 23 revealNextBatch(); 24 25 // Prefetch when the sentinel is within 100 px of the viewport bottom. 26 observer = new IntersectionObserver( 27 (entries) => { 28 entries.forEach((entry) => { 29 if (entry.isIntersecting) { 30 $loader.show(); 31 revealNextBatch(); 32 $loader.hide(); 33 } 34 }); 35 }, 36 { root: null, rootMargin: '0px 0px 100px 0px', threshold: 0 } 37 ); 38 39 // Fallback for old browsers that lack IntersectionObserver 40 if ('IntersectionObserver' in window) { 41 observer.observe($sentinel[0]); 42 } else { 43 $(window).on('scroll.lazyload', function () { 44 const scrollBottom = $(window).scrollTop() + $(window).height(); 45 const sentinelTop = $sentinel.offset().top; 46 if (scrollBottom + 400 >= sentinelTop) { 47 revealNextBatch(); 48 } 49 }); 50 } 51});
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.