diff --git a/static/dashboard.js b/static/dashboard.js index d19a193..328ca51 100644 --- a/static/dashboard.js +++ b/static/dashboard.js @@ -1054,15 +1054,35 @@ function initDashboard() { isExpanded = !collapsedTLDs.has(tldText); } - // Find all domain blocks until next TLD header + // Find all domain blocks until next TLD header, track last domain block let nextEl = header.nextElementSibling; + let lastDomainBlock = null; while (nextEl && !nextEl.classList.contains('tld-header')) { if (nextEl.classList.contains('domain-block')) { nextEl.style.display = isExpanded ? 'block' : 'none'; + lastDomainBlock = nextEl; + } + if (nextEl.classList.contains('tld-footer')) { + nextEl.style.display = isExpanded ? 'block' : 'none'; } nextEl = nextEl.nextElementSibling; } + // Insert footer if it doesn't exist and we have domain blocks + if (lastDomainBlock) { + let footer = lastDomainBlock.nextElementSibling; + if (!footer || !footer.classList.contains('tld-footer')) { + const footerHtml = `
`; + lastDomainBlock.insertAdjacentHTML('afterend', footerHtml); + // Add click handler to new footer + footer = lastDomainBlock.nextElementSibling; + footer.addEventListener('click', () => { + collapsedTLDs.add(tldText); + applyTLDVisibility(); + }); + } + } + // Style header based on expanded state header.style.color = isExpanded ? '#888' : '#555'; diff --git a/templates.go b/templates.go index 49348be..86bad98 100644 --- a/templates.go +++ b/templates.go @@ -534,7 +534,7 @@ const dashboardHTML = ` -