1window.addEventListener('load', function () { 2 var $allVideos = []; 3 4 setTimeout(() => { 5 egVideoIndentionAdjustment(); 6 getVideoInView(); 7 applyAspectRatioToVideo(); 8 }, 400); 9 10 function getVideoInView() { 11 $('iframe').each(function () { 12 let src = $(this).attr('src'); 13 if (src !== undefined) { 14 let match = src.match(/^(http:\/\/|https:\/\/)(?:www\.|player\.)?(vimeo\.com|youtu\.be|www\.youtube\.com)\/([\w\/-]+)([\?].*)?$/); 15 if (match !== null) { 16 if (match.length > 0) { 17 $allVideos.push(this); 18 } 19 } 20 } 21 }); 22 } 23 24 function removeAttrAndAddAspectRatio() { 25 // Figure out and save aspect ratio for each video 26 $allVideos.forEach((function (videoObj) { 27 if (videoObj.height !== '' && videoObj.width !== '') { 28 $(videoObj).data('aspectRatio', videoObj.height / videoObj.width) 29 // and remove the hard coded width/height 30 .removeAttr('height') 31 .removeAttr('width'); 32 } 33 })); 34 } 35 36 function applyAspectRatioToVideo() { 37 removeAttrAndAddAspectRatio(); 38 let $contentFrame = $('.rte__content').not('.news-article-date'); 39 let newWidth = $contentFrame[0].clientWidth; 40 // Resize all videos according to their own aspect ratio 41 $allVideos.forEach((function (videoObj) { 42 let $el = $(videoObj); 43 $el.width(newWidth) 44 .height(newWidth * $el.data('aspectRatio')); 45 })); 46 } 47 48 // Remove indention of EG embedded videos. It's in a paragraph tag bec. of ckeditor. 49 function egVideoIndentionAdjustment() { 50 if ($('.eg-rte .style-2 iframe').length > 0) { 51 $('.eg-rte .style-2 .rte__content iframe').parent().css('margin-left', '8.33333%'); 52 } 53 } 54 55 // When the window is resized 56 $(window).resize(function () { 57 applyAspectRatioToVideo(); 58 }).resize(); 59});
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.