aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/static/js/hotkeys.js
diff options
context:
space:
mode:
authorzrose584 <57181548+zrose584@users.noreply.github.com>2020-09-11 21:21:56 +0200
committerzrose584 <57181548+zrose584@users.noreply.github.com>2020-09-11 21:27:49 +0200
commit94ece08a1e04d9ba1f62000b04c7b7ca707c6ab6 (patch)
tree47afdb07ad9a4f07460fc8f28975251cf84cee00 /youtube/static/js/hotkeys.js
parent786d3eb445dfa601bcaca8ce7b5688d86a922377 (diff)
downloadyt-local-94ece08a1e04d9ba1f62000b04c7b7ca707c6ab6.tar.lz
yt-local-94ece08a1e04d9ba1f62000b04c7b7ca707c6ab6.tar.xz
yt-local-94ece08a1e04d9ba1f62000b04c7b7ca707c6ab6.zip
hotkeys.js: add 'c' for transcript
Diffstat (limited to 'youtube/static/js/hotkeys.js')
-rw-r--r--youtube/static/js/hotkeys.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/youtube/static/js/hotkeys.js b/youtube/static/js/hotkeys.js
index c696ac0..8b28f28 100644
--- a/youtube/static/js/hotkeys.js
+++ b/youtube/static/js/hotkeys.js
@@ -1,9 +1,7 @@
-Q = document.querySelector.bind(document);
-
function onKeyDown(e) {
if (['INPUT', 'TEXTAREA'].includes(document.activeElement.tagName)) return false;
- console.log(e);
+ // console.log(e);
let v = Q("video");
let c = e.key.toLowerCase();
if (c == "k") {
@@ -25,6 +23,18 @@ function onKeyDown(e) {
e.preventDefault();
v.currentTime = v.currentTime + 10;
}
+ else if (c == "f") {
+ e.preventDefault();
+ if (document.fullscreen) document.exitFullscreen();
+ else v.requestFullscreen();
+ }
+ else if (c == "c") {
+ e.preventDefault();
+ let tt = getActiveTranscriptTrack();
+ if (tt == null) return;
+ if (tt.mode == "showing") tt.mode = "disabled";
+ else tt.mode = "showing";
+ }
}
window.addEventListener('DOMContentLoaded', function() {