This commit is contained in:
zyqunix 2025-05-11 15:02:58 +02:00
parent 13de9931b0
commit 75a96b576c
No known key found for this signature in database
GPG key ID: 134A8DEEA83B80E6
3 changed files with 8 additions and 2 deletions

View file

@ -624,7 +624,11 @@ div[class="cards sitemap shadow"] > h4 {
}
#artist {
cursor: pointer;
transition: color 0.1s;
}
#artist:hover {
color: #c099ff;
}
#song-cover {

View file

@ -211,6 +211,7 @@ function fetchSong() {
fetch(url)
.then(response => response.json())
.then(data => {
console.log(data);
const track = data?.recenttracks?.track?.[0];
if (!track) return;
const artist = track.artist["#text"];
@ -218,6 +219,7 @@ function fetchSong() {
const image = track.image.find(img => img.size === "extralarge")?.["#text"] || "";
document.getElementById("artist").innerText = artist;
document.getElementById("artist").href = `https://duckduckgo.com/?q=${artist}`;
document.getElementById("song-name").innerText = title;
document.getElementById("song-cover").src = !image ? "https://lastfm.freetls.fastly.net/i/u/64s/4128a6eb29f94943c9d206c08e625904.jpg" : image;
document.getElementById("song-url").href = track.url;