fmt fixes

This commit is contained in:
Shiny Nematoda 2023-09-22 12:39:40 +00:00
parent b023b67e04
commit b807cf1907
6 changed files with 25 additions and 26 deletions

View file

@ -95,27 +95,23 @@ function parseUrl() {
function setupKeys() { function setupKeys() {
window.addEventListener('keydown', e => { window.addEventListener('keydown', e => {
if ( if (!e.shiftKey || e.repeat || 'string' == typeof e.target.value) return;
!e.shiftKey ||
e.repeat ||
'string' == typeof e.target.value
) return
switch (e.code) { switch (e.code) {
case 'Space': case 'Space':
player.toggle('play') player.toggle('play');
break; break;
case 'Slash': case 'Slash':
nav.show() nav.show();
break; break;
case 'KeyN': case 'KeyN':
data.nextTrack() data.nextTrack();
break; break;
case 'KeyP': case 'KeyP':
data.prevTrack() data.prevTrack();
break; break;
} }
}) });
} }
function playThis(t) { function playThis(t) {

View file

@ -1,3 +1,3 @@
{ {
"date": "2023-09-02" "date": "2023-09-22"
} }

View file

@ -62,7 +62,8 @@ async function Stream() {
window.offline = new shaka.offline.Storage(audioPlayer); window.offline = new shaka.offline.Storage(audioPlayer);
window.offline.configure({ window.offline.configure({
offline: { offline: {
progressCallback: ({ appMetadata: { title, artist } }, prog) => a.add(`${title} by ${artist}: ${Math.floor(prog*100)}%`), progressCallback: ({ appMetadata: { title, artist } }, prog) =>
a.add(`${title} by ${artist}: ${Math.floor(prog * 100)}%`),
trackSelectionCallback: tracks => [ trackSelectionCallback: tracks => [
tracks tracks
.sort((a, b) => a.bandwidth - b.bandwidth) .sort((a, b) => a.bandwidth - b.bandwidth)

View file

@ -16,9 +16,9 @@ function search(e) {
watch( watch(
() => nav.state.show, () => nav.state.show,
e => { e => {
if (e === true) setTimeout(() => searchEl.value.focus(), 0) if (e === true) setTimeout(() => searchEl.value.focus(), 0);
} },
) );
</script> </script>
<template> <template>

View file

@ -40,15 +40,17 @@ function getFormattedTime(sec) {
async function Offline() { async function Offline() {
if (window.offline && data.state.url) { if (window.offline && data.state.url) {
window.offline.store(window.audioPlayer.getAssetUri(), { window.offline
title: data.state.title, .store(window.audioPlayer.getAssetUri(), {
url: data.state.url, title: data.state.title,
artist: data.state.artist, url: data.state.url,
artistUrl: data.state.artistUrl, artist: data.state.artist,
}).promise.catch(e => { artistUrl: data.state.artistUrl,
console.error(e) })
a.add('Error: ' + e.code) .promise.catch(e => {
}); console.error(e);
a.add('Error: ' + e.code);
});
} else a.add('offline storage not found'); } else a.add('offline storage not found');
} }

View file

@ -142,7 +142,7 @@ export const useNav = defineStore('nav', () => {
show: false, show: false,
}); });
const show = () => state.show = !state.show const show = () => (state.show = !state.show);
return { state, show }; return { state, show };
}); });