feat: added ALT+Left/Right Arrow to move through pages, chore: added hidden features in README
This commit is contained in:
18
src/app.js
18
src/app.js
@@ -45,6 +45,7 @@ function mountApp() {
|
||||
|
||||
function initClient() {
|
||||
store.dispatch('setClientMode', true)
|
||||
setClientModeKeyBindings()
|
||||
}
|
||||
|
||||
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 ===== */
|
||||
|
||||
// Debug messages for socketio
|
||||
|
||||
Reference in New Issue
Block a user