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(""); $("#urltable").append(""); $("#urltable").append(""); $("#urltable").append(""); }); 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("
Helpful Sites
SponsorLiveUtilities
" + data.sponsorname + "" + data.livename_1 + "" + data.registersite + "
" + data.cosponsorname + "" + data.livename_2 + "
"); $("#linktable").append("" + ""); $.each(data, function(index,val){ const utcDate = new Date(val.timestamp); var reflector = val.reflector.substring(0,8).trim(); if (reflector.substring(0,3) == "REF") reflector = "" + val.reflector + ""; $("#linktable").append(""); // console.log(index, val); }); }); socket.addEventListener("repeaters", data => { $("#repeaters").empty(); $("#repeaters").append("
Links
RepeaterReflectorProtocolDeviceDirectionTimestamp
" + val.repeater + "" + reflector + "" + val.protocol + "" + val.device + "" + val.direction + "" + utcDate.toLocaleString() + "
"); $("#rptrtable").append("" + ""); $.each(data, function(index,val){ $("#rptrtable").append(""); }); }); socket.addEventListener("lastheard", data => { // console.log("lastheard " + data); $("#lastheard").empty(); $("#lastheard").append("
Repeaters
CallsignFrequencyOffsetDescriptionLocation
" + val.callsign + "" + val.frequency + " Mhz." + val.offset + " Mhz." + val.description1 + " - " + val.description2 + "aprs.fi
"); $("#lhtable").append(""); $.each(data, function(index,val){ // console.log(index, val); const utcDate = val.date.trim() + 'T' + val.time.trim() + 'Z'; const udate = new Date(utcDate); const ldate = udate.toLocaleString(); var mcall = "" + val.mycall + ""; if (val.msg1 != "") mcall += " / " + val.msg1; var rpt1 = val.rpt1.substring(0,7).trim(); if (rpt1.substring(0,3) == "REF") { rpt1 = "" + val.rpt1 + ""} else { rpt1 = val.rpt1 } var rpt2 = val.rpt2.substring(0,7).trim(); if (rpt2.substring(0,3) == "REF") { rpt2 = "" + val.rpt2 + "" } else { rpt2 = val.rpt2 } $("#lhtable").append("" + ""); }) });
Last Heard
MYcallURcallRpt1Rpt2SourceDate GMTTime GMTLocal
" + mcall + ""+ val.urcall + "" + rpt1 + "" + rpt2 + "" + val.source + "" + val.date + "" + val.time + "" + ldate +"