style: auto-fix linting issues
This commit is contained in:
parent
0d84ac2e95
commit
17e3430691
3 changed files with 30 additions and 12 deletions
|
|
@ -1953,10 +1953,13 @@ export class LosslessAPI {
|
|||
}
|
||||
|
||||
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 '';
|
||||
}
|
||||
|
||||
|
||||
const formattedId = String(id).replace(/-/g, '/');
|
||||
const baseUrl = `https://resources.tidal.com/images/${formattedId}`;
|
||||
return `${baseUrl}/160x160.jpg 160w, ${baseUrl}/320x320.jpg 320w, ${baseUrl}/640x640.jpg 640w`;
|
||||
|
|
@ -1979,7 +1982,7 @@ export class LosslessAPI {
|
|||
if (!id || (typeof id === 'string' && (id.startsWith('blob:') || id.startsWith('assets/')))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
const formattedId = String(id).replace(/-/g, '/');
|
||||
const baseUrl = `https://resources.tidal.com/images/${formattedId}`;
|
||||
return `${baseUrl}/160x160.jpg 160w, ${baseUrl}/320x320.jpg 320w, ${baseUrl}/640x640.jpg 640w`;
|
||||
|
|
|
|||
|
|
@ -308,8 +308,7 @@ export class Player {
|
|||
if (coverEl) {
|
||||
const videoCoverUrl = track.videoUrl || track.videoCoverUrl || track.album?.videoCoverUrl || null;
|
||||
const coverId = track.image || track.cover || track.album?.cover;
|
||||
const coverUrl =
|
||||
videoCoverUrl || this.api.getCoverUrl(coverId);
|
||||
const coverUrl = videoCoverUrl || this.api.getCoverUrl(coverId);
|
||||
const coverSrcset = videoCoverUrl ? null : this.api.getCoverSrcset(coverId);
|
||||
|
||||
if (videoCoverUrl) {
|
||||
|
|
|
|||
30
js/ui.js
30
js/ui.js
|
|
@ -543,27 +543,43 @@ 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';
|
||||
if (this.currentPage === 'search' || className === 'track-item-cover') {
|
||||
size = '80';
|
||||
} else if (type === 'artist') {
|
||||
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) {
|
||||
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 tidalUrl = `https://resources.tidal.com/images/${formattedId}/320x320.jpg`;
|
||||
const wsrvUrl = `https://wsrv.nl/?url=${encodeURIComponent(tidalUrl)}&w=250&h=250&output=webp`;
|
||||
return `<img src="${wsrvUrl}" class="${className}" alt="${alt}" loading="${loading}">`;
|
||||
}
|
||||
|
||||
|
||||
return `<img src="${imageUrl}" class="${className}" alt="${alt}" loading="${loading}">`;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue