v43: Add TLD footer with collapse button
This commit is contained in:
+21
-1
@@ -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
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user