1var STT = { 2 settings: STTSettings, 3 media: undefined, 4 skipTo: undefined, 5 isHTML5: false, 6 isYoutube: false, 7 8 doHTML5Skip: function() { 9 STT.media.removeEventListener('canplaythrough', STT.doHTML5Skip); 10 STT.media.currentTime = STT.skipTo; 11 STT.media.play(); 12 }, 13 14 doYoutubeSkip: function() { 15 STT.media.seekTo(STT.skipTo); 16 STT.media.playVideo(); 17 } 18 19}; 20 21STTSkipTo = function(time) { 22 var audio = document.getElementsByTagName('audio'), 23 video = document.getElementsByTagName('video'), 24 iframe = document.getElementsByTagName('iframe'), 25 timeArray = time.split(':').reverse(), 26 seconds = parseInt(timeArray[0]), 27 minutes = timeArray.length > 1 ? parseInt(timeArray[1]) : 0, 28 hours = timeArray.length > 2 ? parseInt(timeArray[2]) : 0; 29 30 STT.skipTo = seconds + (minutes * 60) + (hours * 3600); 31 32 if (STT.media) { 33 STT.doSkip(); 34 return; 35 } 36 37 if ((parseInt(STT.settings.link_audio) && audio.length) || 38 (parseInt(STT.settings.link_video) && video.length)) 39 { 40 STT.doSkip = STT.doHTML5Skip; 41 42 if (parseInt(STT.settings.link_audio) && audio.length) { 43 STT.media = audio[0]; 44 } else { 45 STT.media = video[0]; 46 } 47 48 var playbackRate = STT.media.playbackRate; 49 STT.media.addEventListener('canplaythrough', STT.doHTML5Skip); 50 STT.media.load(); 51 STT.media.playbackRate = playbackRate; 52 STT.media.play(); 53 return; 54 } else if (parseInt(STT.settings.link_youtube && iframe.length)) { 55 // Inspect the iframes, looking for a src with youtube in the URI 56 for (var i = 0; i < iframe.length; i++) { 57 if (iframe[i].src.search('youtube') !== -1) { 58 // Set up the JS interface 59 STT.doSkip = STT.doYoutubeSkip; 60 61 iframe[0].id = 'stt-youtube-player'; 62 STT.media = new YT.Player('stt-youtube-player', { 63 events: { 64 onReady: STT.doYoutubeSkip 65 } 66 }); 67 return; 68 } 69 } 70 } 71 72 console.log('Skip to Timestamp: No media player found!'); 73 return; 74} 75 76// Listen to all clicks on the document 77document.addEventListener('click', function (event) { 78 var elem = event.target; 79 // If the event target doesn't match bail 80 if (!elem.hasAttribute('data-stt-time')) { 81 return; 82 } 83 var time = elem.getAttribute('data-stt-time'); 84 STTSkipTo(time); 85}, false);
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.