Skip to content

Commit

Permalink
fallback neutral track and album images
Browse files Browse the repository at this point in the history
  • Loading branch information
StigNygaard committed Oct 5, 2024
1 parent bf67248 commit a2825b9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
26 changes: 16 additions & 10 deletions widgets/lastfm.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,14 @@ class Tracks extends HTMLElement {
this.#scrobblesProcessor.process(scrobbles).getItems().forEach(item => {
if (item.type === 'track') {
lines.push(create('div', {class: item.pinfo.text === 'playing' ? 'trackinfo nowplaying' : 'trackinfo'},
create('a', {class: 'cover', href: item.albumUrl, tabindex: '-1'}, create('img', {
src: item.albumCover,
alt: '',
title: item.albumTitle
})),
create('a', {class: 'cover', href: item.albumUrl, tabindex: '-1'},
item.albumCover ?
create('img', {
src: item.albumCover,
alt: '',
title: item.albumTitle
})
: ''),
create('a', {
class: item.loved ? 'track loved' : 'track',
href: item.trackUrl,
Expand All @@ -787,11 +790,14 @@ class Tracks extends HTMLElement {
create('div', {class: 'play', title: item.pinfo.text === 'playing' ? 'Scrobbling now...' : item.pinfo.title}, item.pinfo.text)
));
} else if (item.type === 'album') {
const coverLink = create('a', {class: 'cover', href: item.albumUrl, tabindex: '-1'}, create('img', {
src: item.albumCover,
alt: '',
title: item.albumTitle
}));
const coverLink = create('a', {class: 'cover', href: item.albumUrl, tabindex: '-1'},
item.albumCover ?
create('img', {
src: item.albumCover,
alt: '',
title: item.albumTitle
})
: '');
const artistLink = create('a', {
href: item.artistUrl,
title: item.artistName,
Expand Down
Loading

0 comments on commit a2825b9

Please sign in to comment.