v43: Add TLD footer with collapse button

This commit is contained in:
primal
2026-01-30 16:17:59 -05:00
parent cbf16bfbc8
commit 018f47449f
2 changed files with 22 additions and 2 deletions
+21 -1
View File
@@ -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 = `<div class="tld-footer" data-tld="${escapeHtml(tldText)}" style="padding: 6px 10px 12px; color: #555; font-size: 0.85em; cursor: pointer; text-align: center; display: ${isExpanded ? 'block' : 'none'};"><span style="margin-right: 6px; font-size: 0.8em;">▲</span>.${escapeHtml(tldText)}</div>`;
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';
+1 -1
View File
@@ -534,7 +534,7 @@ const dashboardHTML = `<!DOCTYPE html>
<div id="output"></div>
</div>
<div style="color: #333; font-size: 11px; margin-top: 10px;">v42</div>
<div style="color: #333; font-size: 11px; margin-top: 10px;">v43</div>
<div class="updated" id="updatedAt">Last updated: {{.UpdatedAt.Format "2006-01-02 15:04:05"}}</div>
</body>