diff --git a/public/nodes.js b/public/nodes.js index cd44068..71ad2e6 100644 --- a/public/nodes.js +++ b/public/nodes.js @@ -286,11 +286,29 @@ if (h) h.textContent = 'Neighbors (' + data.neighbors.length + ')'; } var html = renderNeighborTable(data.neighbors, limit); - if (limit && data.neighbors.length > limit && viewAllPubkey) { - html += '
'; + if (limit && data.neighbors.length > limit) { + html += ''; + } else if (!limit && data.neighbors.length > 5) { + // Collapse toggle when expanded (#855) + html += ''; } el.innerHTML = html; + // Wire "Show all neighbors" expand button (#855) + var expandBtn = el.querySelector('.show-all-neighbors-btn'); + if (expandBtn) { + expandBtn.addEventListener('click', function() { + renderNeighborData(data, containerId, 0, headerSelector, null); + }); + } + // Wire collapse button (#855) + var collapseBtn = el.querySelector('.collapse-neighbors-btn'); + if (collapseBtn) { + collapseBtn.addEventListener('click', function() { + renderNeighborData(data, containerId, 5, headerSelector, null); + }); + } + // Initialize TableSort on neighbor table var neighborTable = el.querySelector('.neighbor-sort-table'); if (neighborTable && window.TableSort) { @@ -355,7 +373,7 @@ app.innerHTML = `