/** * blame.ts — MIDI note tooltip wiring for the blame page. * * For MIDI blame views, wires mouseenter/mouseleave on .blame2-note elements * to show/hide the floating #blame2-tooltip panel. * * Registered as: window.MusePages['blame'] */ function initMidiTooltip(): void { const tip = document.getElementById('blame2-tooltip'); if (!tip) return; document.querySelectorAll('.blame2-note').forEach((note) => { note.addEventListener('mouseenter', () => { const r = note.getBoundingClientRect(); tip.innerHTML = `
${note.dataset['sha'] ?? ''}
` + `
${note.dataset['msg'] ?? ''}
` + `
Author${note.dataset['author'] ?? ''}
` + `
Pitch${note.dataset['pitch'] ?? ''}
` + `
Beat${note.dataset['beat'] ?? ''}
` + `
Velocity${note.dataset['vel'] ?? ''}
` + `
Duration${note.dataset['dur'] ?? ''}
`; tip.removeAttribute('aria-hidden'); tip.style.display = 'block'; const tipW = tip.offsetWidth; const left = Math.min(r.left + window.scrollX, window.innerWidth - tipW - 12); tip.style.left = `${left}px`; tip.style.top = `${r.bottom + window.scrollY + 6}px`; }); note.addEventListener('mouseleave', () => { tip.style.display = 'none'; tip.setAttribute('aria-hidden', 'true'); }); }); } export function initBlame(data: Record): void { if (data['blameType'] === 'midi') { initMidiTooltip(); } }