1(function ($, Drupal, once) { 2 'use strict'; 3 4 Drupal.behaviors.HologicYoutubeVideo = { 5 attach: function (context, settings) { 6 7 $(once('youtube-video', '.coh-youtube-video')).each(function() { 8 const $youtubeVideo = $(this); 9 var $youtubeOverlay = $('.youtube-overlay', $youtubeVideo); 10 11 if (!$youtubeOverlay.length) { 12 return; 13 } 14 15 var $playButton = $('.coh-style-play-button', $youtubeVideo); 16 var $youtubeEmbedItem = $('.coh-youtube-embed', $youtubeVideo); 17 var $youtubeInnerItem = $('.coh-ce-youtube-inner-video',$youtubeEmbedItem); 18 19 if (!$youtubeEmbedItem.length) { 20 return; 21 } 22 23 var youtubeSrc = $youtubeInnerItem.data('video-url'); 24 if (youtubeSrc) { 25 var matches = youtubeSrc.match(/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/); 26 27 if (matches) { 28 youtubeSrc = 'https://www.youtube.com/embed/' + matches[1]; 29 } else { 30 youtubeSrc = 'https://www.youtube.com/embed/'; 31 } 32 33 $playButton.on('click', function() { 34 var $iframe = $('<iframe>'); 35 var newSrc = youtubeSrc + '?autoplay=1&loop=0&rel=0&controls=1&fs=1&showinfo=1&iv_load_policy=3'; 36 newSrc = newSrc.replace('autoplay=0', 'autoplay=1'); 37 38 $iframe.attr('allow', "autoplay"); 39 $iframe.attr('src', newSrc); 40 $iframe.attr('allowfullscreen', 1); 41 42 $iframe.appendTo($youtubeInnerItem); 43 44 setTimeout(function() { 45 $youtubeVideo.find('.youtube-overlay').hide(); 46 }, 400); 47 }); 48 } 49 }); 50 } 51 }; 52 53})(jQuery, Drupal, once);
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.