1(function ($) { 2Drupal.behaviors.nomensa_amp = { 3 attach: function(context) { 4 //--- 5 6 //var $yt_links = $("a[href*='http://www.youtube.com/watch']"); 7 var $yt_links = $(".video-player"); 8 // Selects all links that have an href value pointing at youtube 9 $.each($yt_links, function(i) { // Iterate through the links creating a new media player for each 10 var $holder = $('<span/>'); // Create a container for the media player 11 $(this).parent().replaceWith($holder); 12 // Replace the parent element of the link (a <p> tag) with the holder 13 var $caption_link = $(this).siblings('.captions'); // Get a reference to any sibling captions links that exist 14 // If the captions link exists extract the href, otherwise set the captions file variable to null 15 var captions_file = ($caption_link.length > 0) ? $caption_link.attr('href') : null; 16 var link = $(this).attr('href').split("=")[1]; 17 // Extract the video id from the YouTube url in the link 18 $holder.player({ // Instantiate the player 19 id : 'yt_player_' + i, // ensure that the index of the current element is appended to the base id 20 media : link, // The media property is assigned the id of the YouTube video that was extracted from the link 21 // A reference to the captions file is also provided. Note that this will be null if no captions are found 22 captions : captions_file 23 }); 24 }); 25 26 //--- 27 } 28 } 29})(jQuery); 30
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.