Similar Artists orb: match the AudioDB/standard wiring exactly (no inline onclick)

Root cause of 'click does nothing': I flip-flopped between inline onclick and
addEventListener. A cached index.html with my inline onclick + fresh JS with
addEventListener = the click fires the toggle TWICE (pause then resume) = no net
change. Now identical to AudioDB/Deezer/etc.: NO inline onclick on the button,
single addEventListener('click', toggle) in the init. One handler, one fire.
This commit is contained in:
BoulderBadgeDad 2026-06-03 16:03:45 -07:00
parent b79b26b7c5
commit 0a77542d84
2 changed files with 17 additions and 13 deletions

View file

@ -567,8 +567,7 @@
</div> </div>
<!-- Similar Artists (MusicMap) Enrichment Status Icon --> <!-- Similar Artists (MusicMap) Enrichment Status Icon -->
<div class="similar-artists-enrich-button-container"> <div class="similar-artists-enrich-button-container">
<button class="similar-artists-enrich-button" id="similar-artists-enrich-button" title="Similar Artists (MusicMap) Enrichment" <button class="similar-artists-enrich-button" id="similar-artists-enrich-button" title="Similar Artists (MusicMap) Enrichment">
onclick="toggleSimilarArtistsEnrichment()">
<img src="https://www.music-map.com/elements/objects/og_logo.png" <img src="https://www.music-map.com/elements/objects/og_logo.png"
alt="Similar Artists" class="similar-artists-enrich-logo"> alt="Similar Artists" class="similar-artists-enrich-logo">
<div class="similar-artists-enrich-spinner"></div> <div class="similar-artists-enrich-spinner"></div>

View file

@ -1376,20 +1376,25 @@ async function toggleSimilarArtistsEnrichment() {
} }
} }
(function _wireSimilarArtistsBubble() { // Initialize Similar Artists UI on page load — identical pattern to AudioDB/Deezer
// Click is the inline onclick on the button (like Amazon) — we only need to // (addEventListener for the click; no inline onclick on the button).
// kick off + poll the status here. if (document.readyState === 'loading') {
const wire = () => { document.addEventListener('DOMContentLoaded', () => {
if (document.getElementById('similar-artists-enrich-button')) { const button = document.getElementById('similar-artists-enrich-button');
if (button) {
button.addEventListener('click', toggleSimilarArtistsEnrichment);
updateSimilarArtistsEnrichmentStatus(); updateSimilarArtistsEnrichmentStatus();
setInterval(updateSimilarArtistsEnrichmentStatus, 2000); setInterval(updateSimilarArtistsEnrichmentStatus, 2000);
} }
}; });
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', wire); } else {
else wire(); const button = document.getElementById('similar-artists-enrich-button');
})(); if (button) {
button.addEventListener('click', toggleSimilarArtistsEnrichment);
window.toggleSimilarArtistsEnrichment = toggleSimilarArtistsEnrichment; // ensure inline onclick can resolve it updateSimilarArtistsEnrichmentStatus();
setInterval(updateSimilarArtistsEnrichmentStatus, 2000);
}
}
// =================================================================== // ===================================================================
// HYDRABASE P2P MIRROR WORKER // HYDRABASE P2P MIRROR WORKER