diff --git a/src/functions/buttons.js b/src/functions/buttons.js index e990c6b..2104c20 100644 --- a/src/functions/buttons.js +++ b/src/functions/buttons.js @@ -141,31 +141,51 @@ function Util() { Button_Volume.addEventListener('click', Toggle_Mute) // Keyboard Shortcuts + /// Grab custom ones, if any + if (video.getAttribute('keyboard-shortcut-fullscreen')) + {var Fullscreen_KeyboardShortcut = video.getAttribute('keyboard-shortcut-fullscreen') + } else {var Fullscreen_KeyboardShortcut = 'f'} + + if (video.getAttribute('keyboard-shortcut-mute')) + {var Mute_KeyboardShortcut = video.getAttribute('keyboard-shortcut-mute') + } else {var Mute_KeyboardShortcut = 'm'} + + if (video.getAttribute('keyboard-shortcut-playpause')) + {var PlayPause_KeyboardShortcut = video.getAttribute('keyboard-shortcut-playpause') + } else {var PlayPause_KeyboardShortcut = 'k'} + + if (video.getAttribute('keyboard-shortcut-skipback')) + {var SkipBack_KeyboardShortcut = video.getAttribute('keyboard-shortcut-skipback') + } else {var SkipBack_KeyboardShortcut = 'j'} + + if (video.getAttribute('keyboard-shortcut-skipforth')) + {var SkipForth_KeyboardShortcut = video.getAttribute('keyboard-shortcut-skipforth') + } else {var SkipForth_KeyboardShortcut = 'l'} + + /// Defaults function keyboardShortcuts(event) { const { key } = event - switch(key) { - case 'k': + if (key === PlayPause_KeyboardShortcut) { Toggle_PlayPause() if (video.paused) { Show_Controls() } else { - setTimeout(() => { + setTimeout(() => { Hide_Controls() - }, 1200) + }, 1200) } - break - case 'm': + } + else if (key === Mute_KeyboardShortcut) { Toggle_Mute() - break - case 'f': + } + else if (key === Fullscreen_KeyboardShortcut) { Toggle_Fullscreen() - break - case 'j': + } + else if (key === SkipBack_KeyboardShortcut) { Toggle_SkipBack() - break - case 'l': + } + else if (key === SkipForth_KeyboardShortcut) { Toggle_SkipForth() - break } } document.addEventListener('keyup', keyboardShortcuts) diff --git a/test/Ennie-and-Yoyki.webm b/test/Ennie-and-Yoyki.webm new file mode 100644 index 0000000..7b444bb Binary files /dev/null and b/test/Ennie-and-Yoyki.webm differ diff --git a/test/index.html b/test/index.html index 2d1b722..e677172 100644 --- a/test/index.html +++ b/test/index.html @@ -9,7 +9,7 @@

Plyx Player By SudoVanilla

- +

Ennie and Yoyki: Ungirly Games By Daniyar Yambushev