symbols.ts
typescript
sha256:bb2baaabdd19320bde50cb69d447fd1c1e571467df729be1a23b5e93064b046a
feat(intel): standardize headers, gauge icon, velocity card…
Sonnet 4.6
minor
⚠ breaking
144 days ago
| 1 | /** |
| 2 | * symbols.ts — Symbol list page behaviour. |
| 3 | * |
| 4 | * - Live text filter on symbol addresses (data-addr attribute) |
| 5 | * - Client-side kind filter (fn / class / sym) via data-kind attribute |
| 6 | */ |
| 7 | |
| 8 | export function initSymbols(): void { |
| 9 | const searchInput = document.getElementById('sym2-search-input') as HTMLInputElement | null; |
| 10 | const kindBtns = Array.from(document.querySelectorAll<HTMLElement>('[data-kind]')); |
| 11 | const rows = Array.from(document.querySelectorAll<HTMLElement>('.sym2-row')); |
| 12 | let activeKind = ''; |
| 13 | |
| 14 | function applyFilter(): void { |
| 15 | const q = searchInput ? searchInput.value.toLowerCase() : ''; |
| 16 | rows.forEach((row) => { |
| 17 | const addr = (row.dataset.addr ?? '').toLowerCase(); |
| 18 | const kind = row.dataset.kind ?? ''; |
| 19 | const matchQ = !q || addr.includes(q); |
| 20 | const matchKind = !activeKind || kind === activeKind; |
| 21 | row.classList.toggle('sym2-row--hidden', !(matchQ && matchKind)); |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | if (searchInput) { |
| 26 | searchInput.addEventListener('input', applyFilter); |
| 27 | } |
| 28 | |
| 29 | kindBtns.forEach((btn) => { |
| 30 | btn.addEventListener('click', () => { |
| 31 | activeKind = btn.dataset.kind ?? ''; |
| 32 | kindBtns.forEach((b) => b.classList.remove('sym2-pill--active')); |
| 33 | btn.classList.add('sym2-pill--active'); |
| 34 | applyFilter(); |
| 35 | }); |
| 36 | }); |
| 37 | } |
File History
1 commit
sha256:bb2baaabdd19320bde50cb69d447fd1c1e571467df729be1a23b5e93064b046a
feat(intel): standardize headers, gauge icon, velocity card…
Sonnet 4.6
minor
⚠
144 days ago