Add some statistics stuff

This commit is contained in:
2026-07-25 23:15:34 -05:00
parent 4e1a80ac67
commit 82229dace9
9 changed files with 781 additions and 4 deletions
+25
View File
@@ -0,0 +1,25 @@
function collapseDescendants(row) {
const toggle = row.querySelector('.stats-toggle');
if (!toggle) return;
toggle.setAttribute('aria-expanded', 'false');
const group = toggle.getAttribute('aria-controls');
document.querySelectorAll(`[data-stats-parent="${group}"]`).forEach(child => {
child.hidden = true;
collapseDescendants(child);
});
}
document.addEventListener('click', event => {
const toggle = event.target.closest('.stats-toggle');
if (!toggle) return;
const expanded = toggle.getAttribute('aria-expanded') === 'true';
toggle.setAttribute('aria-expanded', String(!expanded));
const group = toggle.getAttribute('aria-controls');
document.querySelectorAll(`[data-stats-parent="${group}"]`).forEach(row => {
row.hidden = expanded;
if (expanded) collapseDescendants(row);
});
});