|
|
|
const socket = io();
|
|
|
|
|
|
|
|
socket.addEventListener("connect", () => {
|
|
|
|
socket.emit("Hello from script.js");
|
|
|
|
});
|
|
|
|
|
|
|
|
socket.addEventListener("info", indata => {
|
|
|
|
// console.log(indata);
|
|
|
|
const data = JSON.parse(indata);
|
|
|
|
$("#instruct").empty();
|
|
|
|
$("#instruct").append("<table id=\"urltable\"><caption>Helpful URLs</caption>");
|
|
|
|
$("#urltable").append("<tr><th>Sponsor</th><th>Live</th><th>Utilities</th></tr>");
|
|
|
|
$("#urltable").append("<tr><td><a target=\"sponsor\" href=\"" + data.sponsor + "\">" +
|
|
|
|
data.sponsorname + "</a></td><td><a target=\"live\" href=\"" + data.live_1 + "\">" +
|
|
|
|
data.livename_1 + "</a></td><td><a target=\"register\" href=\"" + data.registration +
|
|
|
|
"\">" + data.registersite + "</a></td></tr>");
|
|
|
|
$("#urltable").append("<tr><td><a target=\"sponsor\" href=\"" + data.cosponsor + "\">" +
|
|
|
|
data.cosponsorname + "</a></td><td><a target=\"live\" href=\"" + data.live_2 + "\">" +
|
|
|
|
data.livename_2 + "</a></td><td></td></tr>");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
socket.addEventListener("title", data => {
|
|
|
|
// console.log(data);
|
|
|
|
$("title").text(data);
|
|
|
|
$("#intro").text(data);
|
|
|
|
});
|
|
|
|
|
|
|
|
socket.addEventListener("links", data => {
|
|
|
|
// console.log("links " + data);
|
|
|
|
$("#links").empty();
|
|
|
|
$("#links").append("<table id=\"linktable\"><caption>Links</caption>");
|
|
|
|
$("#linktable").append("<tr><th>Repeater</th><th>Reflector</th><th>Protocol</th>" +
|
|
|
|
"<th>Device</th><th>Direction</th><th>Timestamp</th></tr>");
|
|
|
|
$.each(data, function(index,val){
|
|
|
|
$("#linktable").append("<tr><td>" + val.repeater + "</td><td>" + val.reflector +
|
|
|
|
"</td><td>" + val.protocol + "</td><td>" + val.device + "</td><td>" +
|
|
|
|
val.direction + "</td><td>" + val.timestamp + "</td></tr>");
|
|
|
|
// console.log(index, val);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
socket.addEventListener("repeaters", data => {
|
|
|
|
$("#repeaters").empty();
|
|
|
|
$("#repeaters").append("<table id=\"rptrtable\"><caption>Repeaters</caption>");
|
|
|
|
$("#rptrtable").append("<tr><th>Callsign</th><th>Frequency</th><th>Offset</th><th>Description</th>" +
|
|
|
|
"<th>Location</th></tr>");
|
|
|
|
$.each(data, function(index,val){
|
|
|
|
$("#rptrtable").append("<tr><td>" + val.callsign + "</td><td>" + val.frequency +
|
|
|
|
" Mhz.</td><td>" + val.offset + " Mhz.</td><td>" + val.description1 + " - " +
|
|
|
|
val.description2 +
|
|
|
|
"</td><td><a target=\"location\" href=\"https://aprs.fi/#!mt=roadmap&z=11&call=a%2F" +
|
|
|
|
val.callsign + "\">" + val.latitude + " " + val.longitude + "</a></td></tr>");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
socket.addEventListener("lastheard", data => {
|
|
|
|
// console.log("lastheard " + data);
|
|
|
|
$("#lastheard").empty();
|
|
|
|
$("#lastheard").append("<table id=\"lhtable\"><caption>Last Heard</caption>");
|
|
|
|
$("#lhtable").append("<tr><th>MYcall</th><th>URcall</th><th>Rpt1</th><th>Rpt2</th><th>Source</th><th>Date</th><th>Time</th></tr>");
|
|
|
|
$.each(data, function(index,val){
|
|
|
|
// console.log(index, val);
|
|
|
|
var mcall = val.mycall;
|
|
|
|
if (val.msg1 != "") mcall += " / " + val.msg1;
|
|
|
|
$("#lhtable").append("<tr><td>" + mcall + "</td><td>"+ val.urcall +
|
|
|
|
"</td><td>" + val.rpt1 + "</td><td>" + val.rpt2 +
|
|
|
|
"</td><td>" + val.source + "</td><td>" + val.date + "</td><td>" + val.time + "</td></tr>");
|
|
|
|
})
|
|
|
|
});
|