diff options
author | zrose584 <57181548+zrose584@users.noreply.github.com> | 2020-09-12 10:51:01 +0200 |
---|---|---|
committer | zrose584 <57181548+zrose584@users.noreply.github.com> | 2020-09-12 10:51:01 +0200 |
commit | 57978485ee80e13c6ac1a9f6377934be32c4c67a (patch) | |
tree | de08be49c7378c103b7a39c6c1698c68bd9dae68 /youtube/static | |
parent | 537a8e8ab585c003366d77c08380739243d39a42 (diff) | |
download | yt-local-57978485ee80e13c6ac1a9f6377934be32c4c67a.tar.lz yt-local-57978485ee80e13c6ac1a9f6377934be32c4c67a.tar.xz yt-local-57978485ee80e13c6ac1a9f6377934be32c4c67a.zip |
let jinja create the transcript <details> element
Diffstat (limited to 'youtube/static')
-rw-r--r-- | youtube/static/js/transcript-table.js | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/youtube/static/js/transcript-table.js b/youtube/static/js/transcript-table.js index ac81444..fac33da 100644 --- a/youtube/static/js/transcript-table.js +++ b/youtube/static/js/transcript-table.js @@ -75,30 +75,17 @@ window.addEventListener('DOMContentLoaded', function() { let tts = Q("video").textTracks; if (!tts.length) return; - details_tt = document.createElement("details"); + details_tt = Q("details#transcript-box"); details_tt.addEventListener("toggle", () => { if (details_tt.open) loadCues(); }); - var s = document.createElement("summary"); - s.appendChild(text("Transcript")); - details_tt.appendChild(s); - - var divR = document.createElement("div"); - select_tt = document.createElement("select"); - for (let tt of tts) { - let option = document.createElement("option"); - option.appendChild(text(tt.label)); - select_tt.appendChild(option); - } + select_tt = Q("select#select-tt"); select_tt.selectedIndex = getDefaultTranscriptTrackIdx(); select_tt.addEventListener("change", loadCues); - divR.appendChild(select_tt); - table_tt = document.createElement("table"); - table_tt.id = "transcript-table"; + table_tt = Q("table#transcript-table"); table_tt.appendChild(text("loading..")); - divR.appendChild(table_tt); tts.addEventListener("change", (e) => { // console.log(e); @@ -112,6 +99,5 @@ window.addEventListener('DOMContentLoaded', function() { } }) - details_tt.appendChild(divR); Q(".side-videos").prepend(details_tt); }); |