style: auto-fix linting issues
This commit is contained in:
parent
a6736d571f
commit
5c9fcf6a3c
4 changed files with 2762 additions and 1947 deletions
4633
index.html
4633
index.html
File diff suppressed because one or more lines are too long
58
js/events.js
58
js/events.js
|
|
@ -10,12 +10,7 @@ import {
|
||||||
SVG_BIN,
|
SVG_BIN,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { lastFMStorage, waveformSettings } from './storage.js';
|
import { lastFMStorage, waveformSettings } from './storage.js';
|
||||||
import {
|
import { showNotification, downloadTrackWithMetadata, downloadAlbumAsZip, downloadPlaylistAsZip } from './downloads.js';
|
||||||
showNotification,
|
|
||||||
downloadTrackWithMetadata,
|
|
||||||
downloadAlbumAsZip,
|
|
||||||
downloadPlaylistAsZip,
|
|
||||||
} from './downloads.js';
|
|
||||||
import { downloadQualitySettings } from './storage.js';
|
import { downloadQualitySettings } from './storage.js';
|
||||||
import { updateTabTitle, navigate } from './router.js';
|
import { updateTabTitle, navigate } from './router.js';
|
||||||
import { db } from './db.js';
|
import { db } from './db.js';
|
||||||
|
|
@ -568,14 +563,7 @@ export async function handleTrackAction(
|
||||||
|
|
||||||
// Collection Actions (Album, Playlist, Mix)
|
// Collection Actions (Album, Playlist, Mix)
|
||||||
const isCollection = ['album', 'playlist', 'user-playlist', 'mix'].includes(type);
|
const isCollection = ['album', 'playlist', 'user-playlist', 'mix'].includes(type);
|
||||||
const collectionActions = [
|
const collectionActions = ['play-card', 'shuffle-play-card', 'add-to-queue', 'play-next', 'download', 'start-mix'];
|
||||||
'play-card',
|
|
||||||
'shuffle-play-card',
|
|
||||||
'add-to-queue',
|
|
||||||
'play-next',
|
|
||||||
'download',
|
|
||||||
'start-mix',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isCollection && collectionActions.includes(action)) {
|
if (isCollection && collectionActions.includes(action)) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -614,9 +602,21 @@ export async function handleTrackAction(
|
||||||
|
|
||||||
if (action === 'download') {
|
if (action === 'download') {
|
||||||
if (type === 'album') {
|
if (type === 'album') {
|
||||||
await downloadAlbumAsZip(collectionItem, tracks, api, downloadQualitySettings.getQuality(), lyricsManager);
|
await downloadAlbumAsZip(
|
||||||
|
collectionItem,
|
||||||
|
tracks,
|
||||||
|
api,
|
||||||
|
downloadQualitySettings.getQuality(),
|
||||||
|
lyricsManager
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
await downloadPlaylistAsZip(collectionItem, tracks, api, downloadQualitySettings.getQuality(), lyricsManager);
|
await downloadPlaylistAsZip(
|
||||||
|
collectionItem,
|
||||||
|
tracks,
|
||||||
|
api,
|
||||||
|
downloadQualitySettings.getQuality(),
|
||||||
|
lyricsManager
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -696,8 +696,7 @@ export async function handleTrackAction(
|
||||||
}
|
}
|
||||||
} else if (action === 'download') {
|
} else if (action === 'download') {
|
||||||
await downloadTrackWithMetadata(item, downloadQualitySettings.getQuality(), api, lyricsManager);
|
await downloadTrackWithMetadata(item, downloadQualitySettings.getQuality(), api, lyricsManager);
|
||||||
}
|
} else if (action === 'toggle-like') {
|
||||||
else if (action === 'toggle-like') {
|
|
||||||
const added = await db.toggleFavorite(type, item);
|
const added = await db.toggleFavorite(type, item);
|
||||||
syncManager.syncLibraryItem(type, item, added);
|
syncManager.syncLibraryItem(type, item, added);
|
||||||
|
|
||||||
|
|
@ -809,9 +808,10 @@ export async function handleTrackAction(
|
||||||
return `
|
return `
|
||||||
<div class="modal-option ${alreadyContains ? 'already-contains' : ''}" data-id="${p.id}">
|
<div class="modal-option ${alreadyContains ? 'already-contains' : ''}" data-id="${p.id}">
|
||||||
<span>${p.name}</span>
|
<span>${p.name}</span>
|
||||||
${alreadyContains
|
${
|
||||||
? `<button class="remove-from-playlist-btn-modal" title="Remove from playlist" style="background: transparent; border: none; color: inherit; cursor: pointer; padding: 4px; display: flex; align-items: center;">${SVG_BIN}</button>`
|
alreadyContains
|
||||||
: ''
|
? `<button class="remove-from-playlist-btn-modal" title="Remove from playlist" style="background: transparent; border: none; color: inherit; cursor: pointer; padding: 4px; display: flex; align-items: center;">${SVG_BIN}</button>`
|
||||||
|
: ''
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
@ -1106,10 +1106,22 @@ export function initializeTrackInteractions(player, api, mainContent, contextMen
|
||||||
}
|
}
|
||||||
} else if (card) {
|
} else if (card) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const type = card.dataset.albumId ? 'album' : card.dataset.playlistId ? 'playlist' : card.dataset.mixId ? 'mix' : card.dataset.href ? card.dataset.href.split('/')[1] : 'item';
|
const type = card.dataset.albumId
|
||||||
|
? 'album'
|
||||||
|
: card.dataset.playlistId
|
||||||
|
? 'playlist'
|
||||||
|
: card.dataset.mixId
|
||||||
|
? 'mix'
|
||||||
|
: card.dataset.href
|
||||||
|
? card.dataset.href.split('/')[1]
|
||||||
|
: 'item';
|
||||||
const id = card.dataset.albumId || card.dataset.playlistId || card.dataset.mixId;
|
const id = card.dataset.albumId || card.dataset.playlistId || card.dataset.mixId;
|
||||||
|
|
||||||
const item = trackDataStore.get(card) || { id, uuid: id, title: card.querySelector('.card-title')?.textContent };
|
const item = trackDataStore.get(card) || {
|
||||||
|
id,
|
||||||
|
uuid: id,
|
||||||
|
title: card.querySelector('.card-title')?.textContent,
|
||||||
|
};
|
||||||
contextTrack = item;
|
contextTrack = item;
|
||||||
contextMenu._contextTrack = item;
|
contextMenu._contextTrack = item;
|
||||||
contextMenu._contextType = type.replace('userplaylist', 'user-playlist');
|
contextMenu._contextType = type.replace('userplaylist', 'user-playlist');
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ export class Player {
|
||||||
// Warm connection/cache
|
// Warm connection/cache
|
||||||
// For Blob URLs (DASH), this head request is not needed and can cause errors.
|
// For Blob URLs (DASH), this head request is not needed and can cause errors.
|
||||||
if (!streamUrl.startsWith('blob:')) {
|
if (!streamUrl.startsWith('blob:')) {
|
||||||
fetch(streamUrl, { method: 'HEAD', signal: this.preloadAbortController.signal }).catch(() => { });
|
fetch(streamUrl, { method: 'HEAD', signal: this.preloadAbortController.signal }).catch(() => {});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.name !== 'AbortError') {
|
if (error.name !== 'AbortError') {
|
||||||
|
|
|
||||||
14
js/ui.js
14
js/ui.js
|
|
@ -1533,10 +1533,10 @@ export class UIRenderer {
|
||||||
dateDisplay =
|
dateDisplay =
|
||||||
window.innerWidth > 768
|
window.innerWidth > 768
|
||||||
? releaseDate.toLocaleDateString('en-US', {
|
? releaseDate.toLocaleDateString('en-US', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
})
|
})
|
||||||
: year;
|
: year;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2268,9 +2268,9 @@ export class UIRenderer {
|
||||||
<span>${artist.popularity}% popularity</span>
|
<span>${artist.popularity}% popularity</span>
|
||||||
<div class="artist-tags">
|
<div class="artist-tags">
|
||||||
${(artist.artistRoles || [])
|
${(artist.artistRoles || [])
|
||||||
.filter((role) => role.category)
|
.filter((role) => role.category)
|
||||||
.map((role) => `<span class="artist-tag">${role.category}</span>`)
|
.map((role) => `<span class="artist-tag">${role.category}</span>`)
|
||||||
.join('')}
|
.join('')}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue