1$(function() { 2 // sometimes the ready function is not called by yt.. (cache ?) 3 // check when document ready, if API is available and call callback 4 if (typeof YT != 'undefined' && typeof YT.Player != 'undefined') { 5 window.onYouTubeIframeAPIReady(); 6 } 7}) 8 9function onYouTubeIframeAPIReady() { 10 if (typeof ytPlayers != 'undefined' && ytPlayers instanceof Object) { 11 for (_playerId in ytPlayers) { 12 var _identifier = _playerId.substring(8); // delete 'ytplayer' 13 var _videoId = ytPlayers[_playerId]; 14 ytPlayers[_playerId] = new YT.Player(_playerId, { 15 videoId: _videoId, 16 events: { 17 onReady: onYTPlayerReady 18 } 19 }); 20 } 21 } 22} 23 24function onYTPlayerReady(event) { 25 var id = $(event.target.a).attr('id') || $(event.target.f).attr('id') || $(event.target.h).attr('id') || $(event.target.o).attr('id'); 26 if (typeof id != 'undefined') { 27 var _identifier = id.substring(8); 28 $('#ytplaylist' + _identifier + ' li').on('click', function() { 29 var _playerIdentifier = 'ytplayer' + $(this).parent().attr('id').substring(10); // delete 'ytplaylist' 30 $(this).siblings().removeClass('active'); 31 $(this).addClass('active'); 32 event.target.loadVideoById($(this).data('youtubeid')); 33 }); 34 } 35}
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.