style: auto-fix linting issues
This commit is contained in:
parent
0d84ac2e95
commit
17e3430691
3 changed files with 30 additions and 12 deletions
|
|
@ -1953,7 +1953,10 @@ export class LosslessAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
getCoverSrcset(id) {
|
getCoverSrcset(id) {
|
||||||
if (!id || (typeof id === 'string' && (id.startsWith('http') || id.startsWith('blob:') || id.startsWith('assets/')))) {
|
if (
|
||||||
|
!id ||
|
||||||
|
(typeof id === 'string' && (id.startsWith('http') || id.startsWith('blob:') || id.startsWith('assets/')))
|
||||||
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -308,8 +308,7 @@ export class Player {
|
||||||
if (coverEl) {
|
if (coverEl) {
|
||||||
const videoCoverUrl = track.videoUrl || track.videoCoverUrl || track.album?.videoCoverUrl || null;
|
const videoCoverUrl = track.videoUrl || track.videoCoverUrl || track.album?.videoCoverUrl || null;
|
||||||
const coverId = track.image || track.cover || track.album?.cover;
|
const coverId = track.image || track.cover || track.album?.cover;
|
||||||
const coverUrl =
|
const coverUrl = videoCoverUrl || this.api.getCoverUrl(coverId);
|
||||||
videoCoverUrl || this.api.getCoverUrl(coverId);
|
|
||||||
const coverSrcset = videoCoverUrl ? null : this.api.getCoverSrcset(coverId);
|
const coverSrcset = videoCoverUrl ? null : this.api.getCoverSrcset(coverId);
|
||||||
|
|
||||||
if (videoCoverUrl) {
|
if (videoCoverUrl) {
|
||||||
|
|
|
||||||
22
js/ui.js
22
js/ui.js
|
|
@ -543,7 +543,15 @@ export class UIRenderer {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCoverHTML(cover, alt, className = 'card-image', loading = 'lazy', videoCoverUrl = null, isEditorsPick = false, type = 'album') {
|
getCoverHTML(
|
||||||
|
cover,
|
||||||
|
alt,
|
||||||
|
className = 'card-image',
|
||||||
|
loading = 'lazy',
|
||||||
|
videoCoverUrl = null,
|
||||||
|
isEditorsPick = false,
|
||||||
|
type = 'album'
|
||||||
|
) {
|
||||||
let size = '320';
|
let size = '320';
|
||||||
if (this.currentPage === 'search' || className === 'track-item-cover') {
|
if (this.currentPage === 'search' || className === 'track-item-cover') {
|
||||||
size = '80';
|
size = '80';
|
||||||
|
|
@ -551,13 +559,21 @@ export class UIRenderer {
|
||||||
size = '160';
|
size = '160';
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageUrl = type === 'artist' ? this.api.getArtistPictureUrl(cover, size) : this.api.getCoverUrl(cover, size);
|
const imageUrl =
|
||||||
|
type === 'artist' ? this.api.getArtistPictureUrl(cover, size) : this.api.getCoverUrl(cover, size);
|
||||||
|
|
||||||
if (videoCoverUrl) {
|
if (videoCoverUrl) {
|
||||||
return `<video src="${videoCoverUrl}" poster="${imageUrl}" class="${className}" alt="${alt}" preload="metadata" playsinline muted></video>`;
|
return `<video src="${videoCoverUrl}" poster="${imageUrl}" class="${className}" alt="${alt}" preload="metadata" playsinline muted></video>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEditorsPick && cover && typeof cover === 'string' && !cover.startsWith('http') && !cover.startsWith('blob:') && !cover.startsWith('assets/')) {
|
if (
|
||||||
|
isEditorsPick &&
|
||||||
|
cover &&
|
||||||
|
typeof cover === 'string' &&
|
||||||
|
!cover.startsWith('http') &&
|
||||||
|
!cover.startsWith('blob:') &&
|
||||||
|
!cover.startsWith('assets/')
|
||||||
|
) {
|
||||||
const formattedId = String(cover).replace(/-/g, '/');
|
const formattedId = String(cover).replace(/-/g, '/');
|
||||||
const tidalUrl = `https://resources.tidal.com/images/${formattedId}/320x320.jpg`;
|
const tidalUrl = `https://resources.tidal.com/images/${formattedId}/320x320.jpg`;
|
||||||
const wsrvUrl = `https://wsrv.nl/?url=${encodeURIComponent(tidalUrl)}&w=250&h=250&output=webp`;
|
const wsrvUrl = `https://wsrv.nl/?url=${encodeURIComponent(tidalUrl)}&w=250&h=250&output=webp`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue