1(function () { 2 'use strict'; 3 4 function loadVideo( video ) { 5 var sources = video.querySelectorAll( 'source[data-src]' ); 6 sources.forEach( function ( source ) { 7 source.src = source.getAttribute( 'data-src' ); 8 source.removeAttribute( 'data-src' ); 9 } ); 10 11 var dataSrc = video.getAttribute( 'data-src' ); 12 if ( dataSrc ) { 13 video.src = dataSrc; 14 video.removeAttribute( 'data-src' ); 15 } 16 17 video.preload = 'metadata'; 18 video.load(); 19 video.classList.remove( 'lazy-video' ); 20 } 21 22 if ( 'IntersectionObserver' in window ) { 23 var observer = new IntersectionObserver( function ( entries ) { 24 entries.forEach( function ( entry ) { 25 if ( entry.isIntersecting ) { 26 loadVideo( entry.target ); 27 observer.unobserve( entry.target ); 28 } 29 } ); 30 }, { rootMargin: '200px' } ); 31 32 document.querySelectorAll( 'video.lazy-video' ).forEach( function ( video ) { 33 observer.observe( video ); 34 } ); 35 } else { 36 document.querySelectorAll( 'video.lazy-video' ).forEach( loadVideo ); 37 } 38})();
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.