gabriel / musehub public
blame.ts typescript
24 lines 851 B
Raw
sha256:1dd27e6d5c24550177b01b0a171e8375c07cf046b549e7683364706b6522d3bc docs(#139): mark all 11 checklist items resolved, document … Sonnet 5 12 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:1dd27e6d5c24550177b01b0a171e8375c07cf046b549e7683364706b6522d3bc docs(#139): mark all 11 checklist items resolved, document … Sonnet 5 12 days ago
sha256:649011bedd713e22f7dca4c4be94bdefbf3b10950d9fc80235928d0b0b823be8 docs: track issue #139 (two-column app-shell refactor) plan… Sonnet 5 12 days ago