- Added a few basic keybindings
- Closes #142
This commit is contained in:
Shiny Nematoda 2023-09-22 12:32:41 +00:00
parent 212a0e6dd6
commit b023b67e04
10 changed files with 502 additions and 325 deletions

View file

@ -93,6 +93,31 @@ function parseUrl() {
}
}
function setupKeys() {
window.addEventListener('keydown', e => {
if (
!e.shiftKey ||
e.repeat ||
'string' == typeof e.target.value
) return
switch (e.code) {
case 'Space':
player.toggle('play')
break;
case 'Slash':
nav.show()
break;
case 'KeyN':
data.nextTrack()
break;
case 'KeyP':
data.prevTrack()
break;
}
})
}
function playThis(t) {
const i = data.state.urls.indexOf(t);
data.play(data.state.urls[i]);
@ -134,6 +159,7 @@ onMounted(() => {
/* Setup IndexedDB for storing custom playlists */
useSetupDB();
setupKeys();
parseUrl();
console.log('Mounted <App>!');