feat: added ALT+Left/Right Arrow to move through pages, chore: added hidden features in README

This commit is contained in:
Roberto Tonino 2020-09-24 18:33:56 +02:00
parent 3c276405af
commit dace87887b
3 changed files with 31 additions and 5 deletions

View File

@ -11,6 +11,14 @@ You can find more informations about deemix at https://deemix.app/
- [deemix-pyweb](https://codeberg.org/RemixDev/deemix-pyweb) - [deemix-pyweb](https://codeberg.org/RemixDev/deemix-pyweb)
- [deemix-tools](https://codeberg.org/RemixDev/deemix-tools) - [deemix-tools](https://codeberg.org/RemixDev/deemix-tools)
# "Hidden" features
- `CTRL+SHIFT+Backspace` deletes all the search bar content
- `CTRL+F` focuses the search bar
- `ALT+Left` goes back to the previous page, if present (like would happen in the browser)
- `ALT+Right` goes forward to the next page, if present (like would happen in the browser)
- Custom context menu: on certain elements, like download buttons or album covers, when opening the context menu, a custom one with more options will appear instead of the default one
# License # License
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,7 @@ function mountApp() {
function initClient() { function initClient() {
store.dispatch('setClientMode', true) store.dispatch('setClientMode', true)
setClientModeKeyBindings()
} }
document.addEventListener('DOMContentLoaded', startApp) document.addEventListener('DOMContentLoaded', startApp)
@ -78,6 +79,23 @@ document.addEventListener('keydown', e => {
} }
}) })
/**
* Sets up key bindings that already work in the browser (server mode)
*/
function setClientModeKeyBindings() {
document.addEventListener('keyup', keyEvent => {
// ALT + left
if (keyEvent.altKey && keyEvent.key === 'ArrowLeft') {
router.back()
}
// ALT + right
if (keyEvent.altKey && keyEvent.key === 'ArrowRight') {
router.forward()
}
})
}
/* ===== Socketio listeners ===== */ /* ===== Socketio listeners ===== */
// Debug messages for socketio // Debug messages for socketio