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

View file

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