1(function() { 2 "use strict"; 3 class i { 4 number; 5 startTime; 6 endTime; 7 text; 8 constructor(t, e, s, r) { 9 this.number = t, 10 this.startTime = e, 11 this.endTime = s, 12 this.text = r 13 } 14 } 15 function c(n) { 16 try { 17 if (!n || n === " ") 18 return !1; 19 const t = { 20 number: parseInt(n.match(/^\d+/g)[0]), 21 timing: { 22 start: n.match(/(\d+:){2}\d+,\d+/g)[0].replace(",", "."), 23 end: n.match(/(\d+:){2}\d+,\d+/g)[1].replace(",", ".") 24 }, 25 text: n.split(/\r?\n/g).slice(2, n.split(/\r?\n/g).length).join('\n') 26 }; 27 return new i(t.number,a(t.timing.start),a(t.timing.end),t.text) 28 } catch { 29 return !1 30 } 31 } 32 function a(n) { 33 let t = n.split(":") 34 , e = 0 35 , s = 1; 36 for (; t.length > 0; ) 37 e += s * parseFloat(t.pop(), 10), 38 s *= 60; 39 return e 40 } 41 async function o(n, t="utf-8") { 42 return (!t || t === "") && (t = "utf-8"), 43 fetch(n).then(e => e.arrayBuffer()).then(e => new TextDecoder(t).decode(e)) 44 } 45 class d { 46 src; 47 encoding; 48 lang; 49 kind; 50 label; 51 default; 52 body; 53 needsTransform; 54 cues = []; 55 constructor(t) { 56 this.src = t.src, 57 this.encoding = t.dataset.encoding, 58 this.lang = t.srclang, 59 this.kind = t.kind, 60 this.label = t.label, 61 this.default = t.default, 62 this.needsTransform = !this.src.toLowerCase().endsWith(".vtt") 63 } 64 async parse() { 65 this.body = await o(this.src, this.encoding), 66 this.cues = this.body.split(/\r?\n\r?\n/g).map(c).filter(Boolean) 67 } 68 } 69 async function l(n) { 70 const t = [...n.querySelectorAll("track")].map(e => new d(e)); 71 for (const e of t) { 72 if (!e.needsTransform) 73 continue; 74 await e.parse(); 75 const s = n.addTextTrack(e.kind, e.label, e.lang); 76 e.cues.forEach(r => s.addCue(new VTTCue(r.startTime,r.endTime,r.text))), 77 s.mode = "showing" 78 } 79 // also include inline <script type="text/srt"> 80 const inlineScripts = [...n.querySelectorAll('script[type="text/srt"]')]; 81 for (const script of inlineScripts) { 82 const label = script.dataset.label || 'English'; 83 const lang = script.dataset.lang || 'en'; 84 const srt = script.textContent.trim(); 85 const cues = srt.split(/\r?\n\r?\n/g).map(c).filter(Boolean); 86 const textTrack = n.addTextTrack('subtitles', label, lang); 87 cues.forEach(r => textTrack.addCue(new VTTCue(r.startTime, r.endTime, r.text))); 88 textTrack.mode = 'showing'; 89 } 90 } 91 window.loadTracks = function() { 92 [...document.querySelectorAll("video")].forEach( (v) => { 93 l(v); 94 } 95 ); 96 } 97 ; 98} 99)();
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.