aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/static/js/common.js
diff options
context:
space:
mode:
authorzrose584 <57181548+zrose584@users.noreply.github.com>2020-09-12 10:20:43 +0200
committerzrose584 <57181548+zrose584@users.noreply.github.com>2020-09-12 10:21:12 +0200
commit081058c07e10a4123efcce813918873887eb78c5 (patch)
tree2bfe1836435620a6da5398ed857d820af5c54e16 /youtube/static/js/common.js
parent8222b6205b337730b964a27744699edfaed46b29 (diff)
downloadyt-local-081058c07e10a4123efcce813918873887eb78c5.tar.lz
yt-local-081058c07e10a4123efcce813918873887eb78c5.tar.xz
yt-local-081058c07e10a4123efcce813918873887eb78c5.zip
default to last textTrack
Diffstat (limited to 'youtube/static/js/common.js')
-rw-r--r--youtube/static/js/common.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube/static/js/common.js b/youtube/static/js/common.js
index f2e62fe..4c7ee51 100644
--- a/youtube/static/js/common.js
+++ b/youtube/static/js/common.js
@@ -20,4 +20,13 @@ function getActiveTranscriptTrackIdx() {
}
return cur_tt_idx;
}
-function getActiveTranscriptTrack() { return Q("video").textTracks[getActiveTranscriptTrackIdx()]; } \ No newline at end of file
+function getActiveTranscriptTrack() { return Q("video").textTracks[getActiveTranscriptTrackIdx()]; }
+
+function getDefaultTranscriptTrackIdx() {
+ let tts = Q("video").textTracks;
+ return tts.length - 1;
+}
+
+window.addEventListener('DOMContentLoaded', function() {
+ cur_tt_idx = getDefaultTranscriptTrackIdx();
+});