diff options
author | Jesús <heckyel@hyperbola.info> | 2020-12-15 12:30:46 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-12-15 12:30:46 -0500 |
commit | f9461a2e79cd0be50937139eb9d0ad1a55e0578f (patch) | |
tree | 5b73b4e68349da83df4dd664728efe17ddbe048d /youtube/static/js/common.js | |
parent | a6f21bbc6596a2e20e657dcecac0c64144c497d6 (diff) | |
download | yt-local-f9461a2e79cd0be50937139eb9d0ad1a55e0578f.tar.lz yt-local-f9461a2e79cd0be50937139eb9d0ad1a55e0578f.tar.xz yt-local-f9461a2e79cd0be50937139eb9d0ad1a55e0578f.zip |
Migration general theme: fix query video tag
Diffstat (limited to 'youtube/static/js/common.js')
-rw-r--r-- | youtube/static/js/common.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube/static/js/common.js b/youtube/static/js/common.js index 20cfddd..c15921c 100644 --- a/youtube/static/js/common.js +++ b/youtube/static/js/common.js @@ -1,5 +1,6 @@ -Q = document.querySelector.bind(document); -QA = document.querySelectorAll.bind(document); +const Q = document.querySelector.bind(document); +const QA = document.querySelectorAll.bind(document); +const QId = document.getElementById.bind(document); function text(msg) { return document.createTextNode(msg); } function clearNode(node) { while (node.firstChild) node.removeChild(node.firstChild); } function toTimestamp(seconds) { @@ -20,7 +21,7 @@ function toTimestamp(seconds) { var cur_track_idx = 0; function getActiveTranscriptTrackIdx() { - let textTracks = Q("video").textTracks; + let textTracks = QId("js-video-player").textTracks; if (!textTracks.length) return; for (let i=0; i < textTracks.length; i++) { if (textTracks[i].mode == "showing") { @@ -30,10 +31,10 @@ function getActiveTranscriptTrackIdx() { } return cur_track_idx; } -function getActiveTranscriptTrack() { return Q("video").textTracks[getActiveTranscriptTrackIdx()]; } +function getActiveTranscriptTrack() { return QId("js-video-player").textTracks[getActiveTranscriptTrackIdx()]; } function getDefaultTranscriptTrackIdx() { - let textTracks = Q("video").textTracks; + let textTracks = QId("js-video-player").textTracks; return textTracks.length - 1; } @@ -109,4 +110,4 @@ function copyTextToClipboard(text) { window.addEventListener('DOMContentLoaded', function() { cur_track_idx = getDefaultTranscriptTrackIdx(); -});
\ No newline at end of file +}); |