From 031625f91841e1f891345f87f4cbe85e17c075d8 Mon Sep 17 00:00:00 2001 From: sophie Date: Thu, 1 Aug 2024 23:18:22 +0300 Subject: [PATCH] improve gang --- website/scripts/lastfm.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/website/scripts/lastfm.ts b/website/scripts/lastfm.ts index cbae3ff..3f592ee 100644 --- a/website/scripts/lastfm.ts +++ b/website/scripts/lastfm.ts @@ -69,10 +69,13 @@ const lastFM = { const lastFMElement = document.getElementById("lastfm")! lastFMElement.innerHTML = ""; const img = document.createElement("img"); - img.width = 150 - img.height = 150 + img.width = 174 + img.height = 174 img.alt = "last.fm album art" - img.src = track.image.at(-1)?.["#text"]!; + let imageUrl = track.image.find(z => z.size == "large")?.["#text"]; + if(!imageUrl) imageUrl = track.image.at(-1)?.["#text"]!; + + img.src = imageUrl; lastFMElement?.appendChild(img); const div = document.createElement("div");