47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
// Reflector Dashboard — web front-end for SvxReflector
|
|
// Copyright (C) 2026 SA7AUX (Björn)
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify it under
|
|
// the terms of the GNU Affero General Public License as published by the Free
|
|
// Software Foundation, either version 3 of the License, or (at your option) any
|
|
// later version. See the LICENSE file for details.
|
|
|
|
'use strict';
|
|
|
|
function updateTalkerPopup(nodes, talkerMeta){
|
|
const popup = document.getElementById('talkerPopup');
|
|
const title = document.getElementById('talkerTitle');
|
|
const body = document.getElementById('talkerBody');
|
|
|
|
const calls = Object.keys(nodes || {});
|
|
const talkers = calls
|
|
.map(cs => ({ cs, n: nodes[cs] || {} }))
|
|
.filter(x => x.n.isTalker === true && Number(x.n.tg || 0) !== 0);
|
|
|
|
if (talkers.length === 0) {
|
|
popup.style.display = 'none';
|
|
body.innerHTML = '';
|
|
return;
|
|
}
|
|
|
|
title.textContent = `Talking now: ${talkers.length}`;
|
|
|
|
const lines = talkers.map(t => {
|
|
const tg = Number(t.n.tg || 0);
|
|
const nodeType = t.n.nodeClass || 'node';
|
|
const listeners = calls.filter(cs2 => includesTG(nodes[cs2], tg)).length;
|
|
const sysop = (t.n.sysop && t.n.sysop !== t.cs) ? ` <span class="text-secondary">(${t.n.sysop})</span>` : '';
|
|
// Bridge talker meta (via-gated): show the real talker behind the node
|
|
const m = (talkerMeta || {})[String(tg)];
|
|
const who = (m && m.callsign && (!m.via || m.via === t.cs))
|
|
? `<b>${m.callsign}</b> <span class="text-secondary">via</span> <b>${t.cs}</b>`
|
|
: `<b>${t.cs}</b>${sysop}`;
|
|
return `<div>• ${who} <span class="text-secondary">(${nodeType})</span> — TG <b>${tg}</b> — listeners <b>${listeners}</b></div>`;
|
|
});
|
|
|
|
body.innerHTML = lines.join('');
|
|
popup.style.display = 'inline-flex';
|
|
}
|
|
|