mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 05:08:00 +02:00
parent
212a0e6dd6
commit
b023b67e04
10 changed files with 502 additions and 325 deletions
26
src/App.vue
26
src/App.vue
|
@ -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>!');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue