mirror of
https://github.com/goodtube4u/goodtube.git
synced 2025-11-22 10:16:11 +00:00
Support 'c' shortcut for captions
This commit is contained in:
13
goodtube.js
13
goodtube.js
@@ -657,6 +657,8 @@
|
||||
keyPressed === 'm' ||
|
||||
// Toggle fullscreen
|
||||
keyPressed === 'f' ||
|
||||
// Toggle captions
|
||||
keyPressed === 'c' ||
|
||||
// Prev 10 seconds
|
||||
keyPressed === 'j' ||
|
||||
// Next 10 seconds
|
||||
@@ -720,6 +722,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('trigger ' + shortcut);
|
||||
|
||||
// Trigger the keyboard shortcut
|
||||
let e = false;
|
||||
e = new window.KeyboardEvent('focus', {
|
||||
@@ -2268,6 +2272,15 @@
|
||||
document.dispatchEvent(event);
|
||||
}
|
||||
|
||||
// Toggle captions
|
||||
if (keyPressed === 'c') {
|
||||
let captionsButton = document.querySelector('.ytp-subtitles-button');
|
||||
|
||||
if (captionsButton) {
|
||||
captionsButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
// Prev 10 seconds
|
||||
else if (keyPressed === 'j') {
|
||||
player.currentTime -= 10;
|
||||
|
||||
Reference in New Issue
Block a user