1(function($, Drupal, once){ 2 "use strict"; 3 4 Drupal.behaviors.CohesionYoutubeBG = { 5 6 attach: function (context, settings) { 7 8 var elements = $('.bgndVideo', context).filter(':visible'); 9 10 $(once('coh-js-youtube-init', elements)).each(function() { 11 12 var options = $(this).data('property'); 13 14 //If there is a / assume it's a URL of some kind - we need just the ID. 15 if (options.videoURL && typeof options.videoURL === 'string' && options.videoURL.indexOf('/') !== -1) { 16 var p = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/; 17 //extract the video id. 18 var videoURL = options.videoURL.match(p); 19 if (videoURL) { 20 options.videoURL = videoURL[1]; 21 } else { 22 options.videoURL = ""; 23 } 24 } 25 26 // Initialise the plugin 27 var cohYtplayer = $(this).YTPlayer(); 28 29 if (options.stopMovieIfInvisible ) { 30 // Only play the video when it becomes visible in the viewport otherwise pause 31 $(cohYtplayer).bind('inview', function(event, visible) { 32 if (visible === true) { 33 $(cohYtplayer).YTPPlay(); 34 } else { 35 $(cohYtplayer).YTPPause(); 36 } 37 }); 38 } 39 }); 40 }, 41 42 detach: function(context) { 43 44 $.each($('.bgndVideo', context), function() { 45 $(this).YTPPause(); 46 }); 47 } 48 }; 49 50})(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.