Skip to content

Commit

Permalink
Replace more video player shortcut usage in code with corresponding c…
Browse files Browse the repository at this point in the history
…onstants
  • Loading branch information
kommunarr committed Oct 14, 2024
1 parent 764cace commit 6798c3a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const SyncEvents = {
// note: the multi-character shortcut values are currently just for presentational use
const KeyboardShortcuts = {
APP: {
HISTORY_BACKWARD: 'alt+left arrow',
HISTORY_FORWARD: 'alt+right arrow',
HISTORY_BACKWARD: 'alt+arrowleft',
HISTORY_FORWARD: 'alt+arrowright',
NEW_WINDOW: 'ctrl+N'
},
FEED: {
Expand All @@ -139,14 +139,14 @@ const KeyboardShortcuts = {
TAKE_SCREENSHOT: 'u',
LAST_FRAME: ',',
NEXT_FRAME: '.',
VOLUME_UP: 'arrowup',
VOLUME_DOWN: 'arrowdown',
SMALL_REWIND: 'arrowleft',
SMALL_FAST_FORWARD: 'arrowright',

/* For future use
VOLUME_UP: 'up arrow',
VOLUME_DOWN: 'down arrow',
SMALL_REWIND: 'Left arrow',
SMALL_FAST_FORWARD: 'right arrow',
LAST_CHAPTER: 'ctrl+left arrow',
NEXT_CHAPTER: 'ctrl+right arrow',
LAST_CHAPTER: 'ctrl+arrowleft',
NEXT_CHAPTER: 'ctrl+arrowright',
*/
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2063,17 +2063,17 @@ export default defineComponent({
player.setTextTrackVisibility(!currentlyVisible)
}
break
case 'arrowup':
case KeyboardShortcuts.VIDEO_PLAYER.VOLUME_UP:
// Increase volume
event.preventDefault()
changeVolume(0.05)
break
case 'arrowdown':
case KeyboardShortcuts.VIDEO_PLAYER.VOLUME_DOWN:
// Decrease Volume
event.preventDefault()
changeVolume(-0.05)
break
case 'arrowleft':
case KeyboardShortcuts.VIDEO_PLAYER.SMALL_REWIND:
event.preventDefault()
if (canChapterJump(event, 'previous')) {
// Jump to the previous chapter
Expand All @@ -2083,7 +2083,7 @@ export default defineComponent({
seekBySeconds(-defaultSkipInterval.value * video_.playbackRate)
}
break
case 'arrowright':
case KeyboardShortcuts.VIDEO_PLAYER.SMALL_FAST_FORWARD:
event.preventDefault()
if (canChapterJump(event, 'next')) {
// Jump to the next chapter
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,14 +898,14 @@ function getIndividualLocalizedShortcut(shortcut) {
return process.platform === 'darwin'
? i18n.t('Keys.ctrl')
: i18n.t('Keys.cmd')
case 'left arrow':
return i18n.t('Keys.left arrow')
case 'right arrow':
return i18n.t('Keys.right arrow')
case 'up arrow':
return i18n.t('Keys.up arrow')
case 'down arrow':
return i18n.t('Keys.down arrow')
case 'arrowleft':
return i18n.t('Keys.arrowleft')
case 'arrowright':
return i18n.t('Keys.arrowright')
case 'arrowup':
return i18n.t('Keys.arrowup')
case 'arrowdown':
return i18n.t('Keys.arrowdown')
default:
return shortcut
}
Expand Down
8 changes: 4 additions & 4 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ Keys:
alt: Alt
cmd: Cmd
ctrl: Ctrl
down arrow: Down Arrow
left arrow: Left Arrow
right arrow: Right Arrow
up arrow: Up Arrow
arrowdown: Down Arrow
arrowleft: Left Arrow
arrowright: Right Arrow
arrowup: Up Arrow

0 comments on commit 6798c3a

Please sign in to comment.