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("
Helpful URLs");
$("#urltable").append("Sponsor | Live | Utilities |
");
$("#urltable").append("" +
data.sponsorname + " | " +
data.livename_1 + " | " + data.registersite + " |
");
$("#urltable").append("" +
data.cosponsorname + " | " +
data.livename_2 + " | |
");
});
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("Links");
$("#linktable").append("Repeater | Reflector | Protocol | " +
"Device | Direction | Timestamp |
");
$.each(data, function(index,val){
$("#linktable").append("" + val.repeater + " | " + val.reflector +
" | " + val.protocol + " | " + val.device + " | " +
val.direction + " | " + val.timestamp + " |
");
// console.log(index, val);
});
});
socket.addEventListener("repeaters", data => {
$("#repeaters").empty();
$("#repeaters").append("Repeaters");
$("#rptrtable").append("Callsign | Frequency | Offset | Description | " +
"Location |
");
$.each(data, function(index,val){
$("#rptrtable").append("" + val.callsign + " | " + val.frequency +
" Mhz. | " + val.offset + " Mhz. | " + val.description1 + " - " +
val.description2 +
" | " + val.latitude + " " + val.longitude + " |
");
});
});
socket.addEventListener("lastheard", data => {
// console.log("lastheard " + data);
$("#lastheard").empty();
$("#lastheard").append("Last Heard");
$("#lhtable").append("MYcall | URcall | Rpt1 | Rpt2 | Source | Date | Time |
");
$.each(data, function(index,val){
// console.log(index, val);
var mcall = val.mycall;
if (val.msg1 != "") mcall += " / " + val.msg1;
$("#lhtable").append("" + mcall + " | "+ val.urcall +
" | " + val.rpt1 + " | " + val.rpt2 +
" | " + val.source + " | " + val.date + " | " + val.time + " |
");
})
});