diff options
author | James Taylor <28744867+user234683@users.noreply.github.com> | 2020-09-24 12:14:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-24 12:14:20 -0700 |
commit | 97b092bf7ad9caa6e639c3672a9917cefdd18d40 (patch) | |
tree | 38edb18c56feec9a20c1eed08cc816c39dc03b98 /youtube/static/js/hotkeys.js | |
parent | e829cc0e89c81f7b6ba0b9cea1d2d95f84951308 (diff) | |
parent | 0830468bd13b59323f244978ae3e915bb715a949 (diff) | |
download | yt-local-97b092bf7ad9caa6e639c3672a9917cefdd18d40.tar.lz yt-local-97b092bf7ad9caa6e639c3672a9917cefdd18d40.tar.xz yt-local-97b092bf7ad9caa6e639c3672a9917cefdd18d40.zip |
Merge pull request #15 from zrose584/transcript_table
Transcript table
Diffstat (limited to 'youtube/static/js/hotkeys.js')
-rw-r--r-- | youtube/static/js/hotkeys.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/youtube/static/js/hotkeys.js b/youtube/static/js/hotkeys.js index c696ac0..b295db9 100644 --- a/youtube/static/js/hotkeys.js +++ b/youtube/static/js/hotkeys.js @@ -1,12 +1,11 @@ -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") { + if (e.ctrlKey) return; + else if (c == "k") { v.paused ? v.play() : v.pause(); } else if (c == "arrowleft") { @@ -25,6 +24,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() { |