gabriel / musehub public
blame.ts typescript
24 lines 851 B
Raw
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7 test(mwp3): Phase 4 — fix adjacent suite regressions, lock … Sonnet 4.6 22 days ago
1 /**
2 * blame.ts — interactivity for the code blame page.
3 *
4 * Registered as: window.MusePages['blame']
5 */
6
7 export function initBlame(_data: Record<string, unknown>): void {
8 // Line hash navigation: highlight target line on load and hash change
9 function highlightTargetLine(): void {
10 document.querySelectorAll<HTMLElement>('.blm-code-row--targeted').forEach((el) => {
11 el.classList.remove('blm-code-row--targeted');
12 });
13 const hash = window.location.hash;
14 if (!hash) return;
15 const target = document.querySelector<HTMLElement>(hash);
16 if (target && target.classList.contains('blm-code-row')) {
17 target.classList.add('blm-code-row--targeted');
18 target.scrollIntoView({ behavior: 'smooth', block: 'center' });
19 }
20 }
21
22 highlightTargetLine();
23 window.addEventListener('hashchange', highlightTargetLine);
24 }
File History 2 commits
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7 test(mwp3): Phase 4 — fix adjacent suite regressions, lock … Sonnet 4.6 22 days ago
sha256:1749b9cc5cd2583c56d3261c4c00a342c27435f3946d4bc3e70f76aa2795458a docs(mwp-3): TDD implementation plan for job-enqueue idempo… Opus 4.8 22 days ago