diff --git a/js/profile.js b/js/profile.js index b9e8f42..1ca0012 100644 --- a/js/profile.js +++ b/js/profile.js @@ -188,12 +188,27 @@ export async function loadProfile(username) { const statusEl = document.getElementById('profile-status'); try { const statusObj = JSON.parse(profile.status); - statusEl.innerHTML = ` - Listening to: - - ${statusObj.text} - `; - statusEl.querySelector('.status-link').onclick = (e) => { + + statusEl.replaceChildren(); + + const label = document.createElement('span'); + label.style.cssText = 'opacity: 0.7; margin-right: 0.25rem;'; + label.textContent = 'Listening to:'; + + const img = document.createElement('img'); + img.src = statusObj.image; + img.style.cssText = 'width: 20px; height: 20px; border-radius: 2px; vertical-align: middle; margin-right: 0.5rem;'; + + const link = document.createElement('a'); + if (statusObj.link.startsWith("/")) { + link.href = statusObj.link; + } + link.className = 'status-link'; + link.style.cssText = 'color: inherit; text-decoration: none; font-weight: 500;'; + link.textContent = statusObj.text; + + statusEl.append(label, img, link); + link.onclick = (e) => { e.preventDefault(); navigate(statusObj.link); }; diff --git a/package.json b/package.json index cf5edc8..b60e3f3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "monochrome", "type": "module", - "version": "2.5.0", + "version": "2.5.1", "description": "[\"Monochrome](https://monochrome.tf)", "scripts": { "dev": "vite",