blame.ts
typescript
sha256:1ccb8409daa5aabe577bd26d11b56ed12f3376d64011d0e75a247e81211a66ee
docs(mwp4/phase5): tick Phase 5 checkboxes, close musehub#109
Sonnet 4.6
20 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:1ccb8409daa5aabe577bd26d11b56ed12f3376d64011d0e75a247e81211a66ee
docs(mwp4/phase5): tick Phase 5 checkboxes, close musehub#109
Sonnet 4.6
20 days ago
sha256:2c523da45351334b5c4dbefed4dc3dd553b3faa8737a4e6caf301e5dc82141be
test(mwp4): Phase 0 RED reproduction tests for RC-4 ordering race
Sonnet 4.6
20 days ago