1var resizingTimer = ""; 2var videoHidden = true; 3 4function setYoutubeResize() { 5 var allVideos = $("iframe[src*='//www.youtube']"); 6 7 allVideos.each(function () { 8 $(this) 9 .attr('data-aspect-ratio', this.height / this.width) 10 .attr('data-former-height', this.height) 11 .attr('data-former-width', this.width); 12 }); 13 14 $(window).resize(function () { 15 clearTimeout(resizingTimer); 16 resizingTimer = setTimeout(resizeYoutubeIframes, 200); 17 }); 18 19 $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function (e) { 20 allVideos.width("").height(""); 21 }); 22 23 function resizeYoutubeIframes() { 24 25 allVideos.each(function () { 26 var videoElement = $(this); 27 var videoContainer = videoElement.parent(); 28 29 if (videoContainer.width() !== videoElement.width()) 30 { 31 videoElement 32 .attr("width", videoContainer.width()) 33 .attr("height", videoContainer.width() * videoElement.data('aspect-ratio')); 34 } 35 }); 36 showVideosIfHidden(); 37 } 38 39 function showVideosIfHidden() { 40 if (videoHidden == true) { 41 allVideos.parent().addClass("loaded"); 42 videoHidden = false; 43 } 44 } 45 46 resizeYoutubeIframes(); 47} 48 49document.addEventListener("DOMContentLoaded", function () { 50 setYoutubeResize(); 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.