mirror of
https://github.com/l5yth/potato-mesh.git
synced 2026-07-07 02:11:16 +02:00
leftpad short names in chat window
This commit is contained in:
@@ -134,11 +134,12 @@
|
||||
legend.addTo(map);
|
||||
|
||||
// --- Helpers ---
|
||||
function addChatEntry(n) {
|
||||
function renderShortHtml(short){ return String(short).padStart(4, ' ').replace(/ /g, ' '); }
|
||||
function addNewNodeChatEntry(n) {
|
||||
const div = document.createElement('div');
|
||||
const ts = formatDate(new Date(n.last_heard * 1000));
|
||||
div.className = 'chat-entry';
|
||||
div.textContent = `[${ts}] ${n.node_id || ''} ${n.short_name || ''} ${n.long_name || ''}`;
|
||||
div.innerHTML = `[${ts}] ${n.node_id || ''} ${renderShortHtml(n.short_name || '')} <em>New node: ${n.long_name || ''}</em>`;
|
||||
chatEl.appendChild(div);
|
||||
chatEl.scrollTop = chatEl.scrollHeight;
|
||||
}
|
||||
@@ -256,7 +257,7 @@
|
||||
}
|
||||
newNodes.sort((a, b) => (a.last_heard ?? 0) - (b.last_heard ?? 0));
|
||||
for (const n of newNodes) {
|
||||
addChatEntry(n);
|
||||
addNewNodeChatEntry(n);
|
||||
}
|
||||
allNodes = nodes;
|
||||
applyFilter();
|
||||
|
||||
Reference in New Issue
Block a user