diff options
author | Florrie <towerofnix@gmail.com> | 2018-05-31 00:01:05 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-05-31 00:01:05 -0300 |
commit | 98b2c1faa886a20695343b54bac1b2b6f85b3579 (patch) | |
tree | 20eca1142278496f09555ea7b3dae458573f2942 /ui.js | |
parent | 12e2b37d59b29343e4543abbfb2416625a1ab79f (diff) |
Seek controls
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/ui.js b/ui.js index f293671..68c6d73 100644 --- a/ui.js +++ b/ui.js @@ -70,12 +70,32 @@ class AppElement extends FocusElement { } keyPressed(keyBuf) { - if (keyBuf[0] === 0x03 || keyBuf[0] === 'q'.charCodeAt(0) || keyBuf[0] === 'Q'.charCodeAt(0)) { + if (keyBuf[0] === 0x03 || telc.isCaselessLetter(keyBuf, 'q')) { this.shutdown() return } - super.keyPressed(keyBuf) + if (telc.isRight(keyBuf) || telc.isCaselessLetter(keyBuf, 'l')) { + this.seekAhead(10) + } else if (telc.isLeft(keyBuf) || telc.isCaselessLetter(keyBuf, 'j')) { + this.seekBack(10) + } else if (telc.isCaselessLetter(keyBuf, 'p') || telc.isCaselessLetter(keyBuf, 'k')) { + this.togglePause() + } else { + super.keyPressed(keyBuf) + } + } + + seekAhead(seconds) { + this.player.seekAhead(seconds) + } + + seekBack(seconds) { + this.player.seekBack(seconds) + } + + togglePause() { + this.player.togglePause() } async queueGrouplikeItem(item, play = true) { |