Many globals vars removed

Removed Number and String prototypes
merge-requests/237/merge
Tag 2023-02-16 16:35:44 -08:00
rodzic a3f14a2e2f
commit f989f099fd
28 zmienionych plików z 5165 dodań i 5249 usunięć

Wyświetl plik

@ -244,8 +244,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<tr id="dxCallBoxDiv" class="DXCallBox"> <tr id="dxCallBoxDiv" class="DXCallBox">
<td> <td>
<div id="localDXcall" style="cursor: pointer" title="Who you're calling or last called" <div id="localDXcall" style="cursor: pointer" title="Who you're calling or last called"
onclick="startLookup(g_localDXcall,localDXGrid.innerHTML);" onclick="startLookup(GT.localDXcall,localDXGrid.innerHTML);"
oncontextmenu="showWorkedByCall(g_localDXcall, event);"> oncontextmenu="showWorkedByCall(GT.localDXcall, event);">
- -
</div> </div>
</td> </td>
@ -352,12 +352,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<div id="countryCount">0</div> <div id="countryCount">0</div>
</td> </td>
<td data-i18n="quickStats.QSL.label" style="cursor: pointer" <td data-i18n="quickStats.QSL.label" style="cursor: pointer"
onclick="resetSearch(); g_filterQSL = 'true'; openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox)" onclick="resetSearch(); GT.filterQSL = 'true'; openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox)"
title="Show Confirmed List" align="right"> title="Show Confirmed List" align="right">
QSL QSL
</td> </td>
<td style="cursor: pointer" class="roundBorderValue" <td style="cursor: pointer" class="roundBorderValue"
onclick="resetSearch(); g_filterQSL = 'true'; openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox)" onclick="resetSearch(); GT.filterQSL = 'true'; openInfoTab('qsobox', 'workedBoxDiv', showWorkedBox)"
title="Show Confirmed List" align="center"> title="Show Confirmed List" align="center">
<div id="qslCount">0</div> <div id="qslCount">0</div>
</td> </td>
@ -949,7 +949,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</div> </div>
</div> </div>
<div style="top: 6px; right: 6px; position: absolute"> <div style="top: 6px; right: 6px; position: absolute">
<button class="Xbutton" onclick="g_helpShow=false;helpDiv.style.display='none';">X</button> <button class="Xbutton" onclick="GT.helpShow=false;helpDiv.style.display='none';">X</button>
</div> </div>
</div> </div>

Wyświetl plik

@ -40,7 +40,7 @@
<body <body
id="mainBody" id="mainBody"
onload="window.opener.g_baWindowInitialized = true" onload="window.opener.GT.baWindowInitialized = true"
style=" style="
-webkit-app-region: drag; -webkit-app-region: drag;
margin: 0px; margin: 0px;

Wyświetl plik

@ -71,7 +71,7 @@
function userAgrees() function userAgrees()
{ {
window.opener.g_appSettings.gtAgree = "user agrees to messaging"; window.opener.GT.appSettings.gtAgree = "user agrees to messaging";
noticeDiv.style.display = "none"; noticeDiv.style.display = "none";
wrapperDiv.style.display = "block"; wrapperDiv.style.display = "block";
} }
@ -84,21 +84,21 @@
{ {
// Do work // Do work
var msg = messageInput.value.replace(/[\n\r]/g, ''); var msg = messageInput.value.replace(/[\n\r]/g, '');
if (msg.length > 0 && g_currentId != 0 && g_currentId in window.opener.g_gtFlagPins && window.opener.g_gtFlagPins[g_currentId].canmsg == true) if (msg.length > 0 && g_currentId != 0 && g_currentId in window.opener.GT.gtFlagPins && window.opener.GT.gtFlagPins[g_currentId].canmsg == true)
{ {
var worker = ""; var worker = "";
// No message history, so lets clear the div // No message history, so lets clear the div
if (!(g_currentId in window.opener.g_gtMessages)) messageTextDiv.innerHTML = ""; if (!(g_currentId in window.opener.GT.gtMessages)) messageTextDiv.innerHTML = "";
if (g_currentId in window.opener.g_gtSentAwayToCid) if (g_currentId in window.opener.GT.gtSentAwayToCid)
{ {
var thisMsg = "Returned from away."; var thisMsg = "Returned from away.";
window.opener.gtSendMessage(thisMsg, g_currentId); window.opener.gtSendMessage(thisMsg, g_currentId);
worker = makeViewMessage("self", window.opener.myDEcall, thisMsg); worker = makeViewMessage("self", window.opener.myDEcall, thisMsg);
messageTextDiv.innerHTML += worker; messageTextDiv.innerHTML += worker;
delete window.opener.g_gtSentAwayToCid[g_currentId]; delete window.opener.GT.gtSentAwayToCid[g_currentId];
} }
if (window.opener.g_msgSettings.msgAwaySelect == 1) if (window.opener.GT.msgSettings.msgAwaySelect == 1)
{ {
window.opener.msgAwaySelect.value = 0; window.opener.msgAwaySelect.value = 0;
window.opener.newMessageSetting(window.opener.msgAwaySelect); window.opener.newMessageSetting(window.opener.msgAwaySelect);
@ -116,7 +116,7 @@
{ {
lockNewWindows(); lockNewWindows();
if (window.opener.g_appSettings.gtAgree != "user agrees to messaging") if (window.opener.GT.appSettings.gtAgree != "user agrees to messaging")
{ {
noticeDiv.style.display = "block"; noticeDiv.style.display = "block";
wrapperDiv.style.display = "none"; wrapperDiv.style.display = "none";
@ -148,7 +148,7 @@
function openIdCid(from) function openIdCid(from)
{ {
if (from.currentTarget.id in window.opener.g_gtFlagPins) if (from.currentTarget.id in window.opener.GT.gtFlagPins)
{ {
openId(from.currentTarget.id); openId(from.currentTarget.id);
} }
@ -166,9 +166,9 @@
{ {
from.preventDefault(); from.preventDefault();
if (from.currentTarget.id in window.opener.g_gtFlagPins) if (from.currentTarget.id in window.opener.GT.gtFlagPins)
{ {
doLookup(window.opener.g_gtFlagPins[from.currentTarget.id].call); doLookup(window.opener.GT.gtFlagPins[from.currentTarget.id].call);
} }
else else
{ {
@ -183,9 +183,9 @@
function onHoverCid(from) function onHoverCid(from)
{ {
var cid = from.currentTarget.id; var cid = from.currentTarget.id;
if (cid in window.opener.g_gtFlagPins) if (cid in window.opener.GT.gtFlagPins)
{ {
from.currentTarget.title = window.opener.g_gtFlagPins[cid].band + " , " + window.opener.g_gtFlagPins[cid].mode + " , " + window.opener.g_dxccToAltName[window.opener.g_gtFlagPins[cid].dxcc]; from.currentTarget.title = window.opener.GT.gtFlagPins[cid].band + " , " + window.opener.GT.gtFlagPins[cid].mode + " , " + window.opener.GT.dxccToAltName[window.opener.GT.gtFlagPins[cid].dxcc];
} }
else else
{ {
@ -230,9 +230,9 @@
newDiv.oncontextmenu = openLookupCid; newDiv.oncontextmenu = openLookupCid;
var worker = "<div id='"+callObj.cid +"CALL' style='clear:both;' class='"+ (callObj.live == false ? "rosterOff" : "rosterOn") + "'>" + callObj.fCall; var worker = "<div id='"+callObj.cid +"CALL' style='clear:both;' class='"+ (callObj.live == false ? "rosterOff" : "rosterOn") + "'>" + callObj.fCall;
if (callObj.dxcc > 0 && callObj.dxcc in window.opener.g_dxccInfo) if (callObj.dxcc > 0 && callObj.dxcc in window.opener.GT.dxccInfo)
{ {
worker += "<img src='./img/flags/16/" + window.opener.g_dxccInfo[callObj.dxcc].flag +"' style='float:right;'>"; worker += "<img src='./img/flags/16/" + window.opener.GT.dxccInfo[callObj.dxcc].flag +"' style='float:right;'>";
} }
worker += "</div>"; worker += "</div>";
newDiv.innerHTML = worker; newDiv.innerHTML = worker;
@ -267,9 +267,9 @@
function updateCallsign(id) function updateCallsign(id)
{ {
if (id in window.opener.g_gtFlagPins) if (id in window.opener.GT.gtFlagPins)
{ {
var obj = window.opener.g_gtFlagPins[id]; var obj = window.opener.GT.gtFlagPins[id];
if (obj.call != "" && obj.call != "NOCALL") if (obj.call != "" && obj.call != "NOCALL")
{ {
var show = true; var show = true;
@ -346,9 +346,9 @@
removeAllChildNodes(allCallDiv); removeAllChildNodes(allCallDiv);
} }
for (const x in window.opener.g_gtFlagPins) for (const x in window.opener.GT.gtFlagPins)
{ {
var obj = window.opener.g_gtFlagPins[x]; var obj = window.opener.GT.gtFlagPins[x];
if (obj.call != "" && obj.call != "NOCALL") if (obj.call != "" && obj.call != "NOCALL")
{ {
var show = true; var show = true;
@ -413,15 +413,15 @@
function showAllMessages() function showAllMessages()
{ {
activeCallsignsDiv.innerHTML = "<font color='gray'>no message history</font>"; activeCallsignsDiv.innerHTML = "<font color='gray'>no message history</font>";
if (Object.keys(window.opener.g_gtMessages).length > 0) if (Object.keys(window.opener.GT.gtMessages).length > 0)
{ {
var worker = ""; var worker = "";
for (const key in window.opener.g_gtMessages) for (const key in window.opener.GT.gtMessages)
{ {
if (key in window.opener.g_gtFlagPins) if (key in window.opener.GT.gtFlagPins)
{ {
worker += "<tr style='cursor:pointer;vertical-align:bottom;'><td align=left onclick=\"openId('" + key + "');\">"; worker += "<tr style='cursor:pointer;vertical-align:bottom;'><td align=left onclick=\"openId('" + key + "');\">";
if (key in window.opener.g_gtUnread) if (key in window.opener.GT.gtUnread)
{ {
worker += "🔥"; worker += "🔥";
} }
@ -430,7 +430,7 @@
worker += "💬"; worker += "💬";
} }
worker += "</td><td align=left style='color:cyan;' onclick=\"openId('" + key + "');\" >" + window.opener.g_gtFlagPins[key].call.formatCallsign() + "</td>"; worker += "</td><td align=left style='color:cyan;' onclick=\"openId('" + key + "');\" >" + formatCallsign(window.opener.GT.gtFlagPins[key].call) + "</td>";
worker += "<td align=right title='Clear Messages' style='padding-bottom:2px' onclick=\"clearMessage('" + key + "');\" ></td></tr>"; worker += "<td align=right title='Clear Messages' style='padding-bottom:2px' onclick=\"clearMessage('" + key + "');\" ></td></tr>";
} }
} }
@ -445,8 +445,8 @@
{ {
try try
{ {
if (what in window.opener.g_gtMessages) delete window.opener.g_gtMessages[what]; if (what in window.opener.GT.gtMessages) delete window.opener.GT.gtMessages[what];
if (what in window.opener.g_gtUnread) delete window.opener.g_gtUnread[what]; if (what in window.opener.GT.gtUnread) delete window.opener.GT.gtUnread[what];
} }
catch (e) {} catch (e) {}
@ -475,7 +475,7 @@
function makeViewMessage(className, who, msg, when) function makeViewMessage(className, who, msg, when)
{ {
var who = "<text class='" + className + "'>" + who.formatCallsign() + "</text>"; var who = "<text class='" + className + "'>" + formatCallsign(who) + "</text>";
var time = "<text class='when'>" + window.opener.userTimeString(when) + "</text>"; var time = "<text class='when'>" + window.opener.userTimeString(when) + "</text>";
var worker = who + " " + time + "</br>"; var worker = who + " " + time + "</br>";
var msgTextClass = containsDoubleByte(msg) ? "msgTextUnicode" : "msgText"; var msgTextClass = containsDoubleByte(msg) ? "msgTextUnicode" : "msgText";
@ -486,8 +486,8 @@
function newChatMessage(id, jsmesg) function newChatMessage(id, jsmesg)
{ {
if (id == g_currentId) { if (id == g_currentId) {
var worker = makeViewMessage("them", window.opener.g_gtFlagPins[id].call, jsmesg.msg, jsmesg.when); var worker = makeViewMessage("them", window.opener.GT.gtFlagPins[id].call, jsmesg.msg, jsmesg.when);
if (id in window.opener.g_gtUnread) delete window.opener.g_gtUnread[id]; if (id in window.opener.GT.gtUnread) delete window.opener.GT.gtUnread[id];
messageTextDiv.innerHTML += worker; messageTextDiv.innerHTML += worker;
scrollDown(messageTextDiv); scrollDown(messageTextDiv);
return document.hasFocus(); return document.hasFocus();
@ -516,14 +516,14 @@
{ {
if (id == 0) return; if (id == 0) return;
if (id in window.opener.g_gtFlagPins) if (id in window.opener.GT.gtFlagPins)
{ {
callsign.innerHTML = window.opener.g_gtFlagPins[id].call.formatCallsign(); callsign.innerHTML = formatCallsign(window.opener.GT.gtFlagPins[id].call);
country.innerHTML = window.opener.g_dxccToAltName[window.opener.g_gtFlagPins[id].dxcc]; country.innerHTML = window.opener.GT.dxccToAltName[window.opener.GT.gtFlagPins[id].dxcc];
grid.innerHTML = window.opener.g_gtFlagPins[id].grid; grid.innerHTML = window.opener.GT.gtFlagPins[id].grid;
band.innerHTML = window.opener.g_gtFlagPins[id].band; band.innerHTML = window.opener.GT.gtFlagPins[id].band;
mode.innerHTML = window.opener.g_gtFlagPins[id].mode; mode.innerHTML = window.opener.GT.gtFlagPins[id].mode;
appSource.innerHTML = window.opener.g_gtFlagPins[id].src in g_knownSources ? g_knownSources[window.opener.g_gtFlagPins[id].src] : window.opener.g_gtFlagPins[id].src; appSource.innerHTML = window.opener.GT.gtFlagPins[id].src in g_knownSources ? g_knownSources[window.opener.GT.gtFlagPins[id].src] : window.opener.GT.gtFlagPins[id].src;
} }
} }
@ -533,31 +533,31 @@
// already displayed? // already displayed?
if (id == g_currentId && messageAreaDiv.style.display == "inline-block") return; if (id == g_currentId && messageAreaDiv.style.display == "inline-block") return;
if (!(id in window.opener.g_gtFlagPins)) return; if (!(id in window.opener.GT.gtFlagPins)) return;
var worker = ""; var worker = "";
if (id in window.opener.g_gtMessages && window.opener.g_gtMessages[id].history.length > 0) if (id in window.opener.GT.gtMessages && window.opener.GT.gtMessages[id].history.length > 0)
{ {
for (msg in window.opener.g_gtMessages[id].history) for (msg in window.opener.GT.gtMessages[id].history)
{ {
if (window.opener.g_gtMessages[id].history[msg].id != 0) if (window.opener.GT.gtMessages[id].history[msg].id != 0)
worker += makeViewMessage( worker += makeViewMessage(
"them", "them",
window.opener.g_gtFlagPins[id].call, window.opener.GT.gtFlagPins[id].call,
window.opener.g_gtMessages[id].history[msg].msg, window.opener.GT.gtMessages[id].history[msg].msg,
window.opener.g_gtMessages[id].history[msg].when window.opener.GT.gtMessages[id].history[msg].when
); );
else else
worker += makeViewMessage( worker += makeViewMessage(
"self", "self",
window.opener.myDEcall, window.opener.myDEcall,
window.opener.g_gtMessages[id].history[msg].msg, window.opener.GT.gtMessages[id].history[msg].msg,
window.opener.g_gtMessages[id].history[msg].when window.opener.GT.gtMessages[id].history[msg].when
); );
} }
if (id in window.opener.g_gtUnread) if (id in window.opener.GT.gtUnread)
{ {
delete window.opener.g_gtUnread[id]; delete window.opener.GT.gtUnread[id];
updateCallsign(id); updateCallsign(id);
showAllMessages(); showAllMessages();
} }
@ -566,7 +566,7 @@
g_currentId = id; g_currentId = id;
messageAreaDiv.style.display = "inline-block"; messageAreaDiv.style.display = "inline-block";
if (window.opener.g_gtFlagPins[id].live == false) if (window.opener.GT.gtFlagPins[id].live == false)
{ {
notifyNoChat(id); notifyNoChat(id);
} else { } else {

Wyświetl plik

@ -39,7 +39,7 @@
} }
function statsFocus(selection) { function statsFocus(selection) {
var which = document.getElementById(selection); let which = document.getElementById(selection);
if (which != null) { if (which != null) {
which.focus(); which.focus();
which.selectionStart = which.selectionEnd = which.value.length; which.selectionStart = which.selectionEnd = which.value.length;
@ -48,7 +48,7 @@
function ValidateCallsign(inputText, validDiv) { function ValidateCallsign(inputText, validDiv) {
if (inputText.value.length > 0) { if (inputText.value.length > 0) {
var passed = false; let passed = false;
inputText.value = inputText.value.toUpperCase(); inputText.value = inputText.value.toUpperCase();
if (/\d/.test(inputText.value) || /[A-Z]/.test(inputText.value)) { if (/\d/.test(inputText.value) || /[A-Z]/.test(inputText.value)) {
passed = true; passed = true;
@ -78,7 +78,7 @@
function init() { function init() {
ValidateCallsign(lookupCallsignInput, null); ValidateCallsign(lookupCallsignInput, null);
window.opener.g_lookupWindowInitialized = true; window.opener.GT.lookupWindowInitialized = true;
} }
function addTextToClipboard(data) { function addTextToClipboard(data) {
@ -86,8 +86,8 @@
} }
function setClipboardFromLookup() { function setClipboardFromLookup() {
if (window.opener.g_lastLookupAddress) { if (window.opener.GT.lastLookupAddress) {
addTextToClipboard(window.opener.g_lastLookupAddress); addTextToClipboard(window.opener.GT.lastLookupAddress);
} }
} }

Wyświetl plik

@ -21,6 +21,7 @@
<link rel="stylesheet" href="./lib/style.css" /> <link rel="stylesheet" href="./lib/style.css" />
<link id="roster" rel="stylesheet" href="./lib/style_roster.css" /> <link id="roster" rel="stylesheet" href="./lib/style_roster.css" />
<script src="./lib/protos.js" type="text/javascript"></script> <script src="./lib/protos.js" type="text/javascript"></script>
<script src="./lib/screens.js" type="text/javascript"></script>
<script src="./lib/third-party.js" type="text/javascript"></script> <script src="./lib/third-party.js" type="text/javascript"></script>
<script src="./lib/jquery-3.6.1.min.js"></script> <script src="./lib/jquery-3.6.1.min.js"></script>
<script src="./lib/CLDRPluralRuleParser.js" type="text/javascript"></script> <script src="./lib/CLDRPluralRuleParser.js" type="text/javascript"></script>
@ -41,7 +42,6 @@
<script src="./lib/roster/rosterColumns.js" type="text/javascript"></script> <script src="./lib/roster/rosterColumns.js" type="text/javascript"></script>
<script src="./lib/roster/rosterColumnFunctions.js" type="text/javascript"></script> <script src="./lib/roster/rosterColumnFunctions.js" type="text/javascript"></script>
<script src="./lib/roster/sendAlerts.js" type="text/javascript"></script> <script src="./lib/roster/sendAlerts.js" type="text/javascript"></script>
<script src="./lib/screens.js" type="text/javascript"></script>
</head> </head>
<body id="rosterBody" onload="init()" onresize="resize()" style="display:none;" class="roster" oncontextmenu="return handleContextMenu(event);"> <body id="rosterBody" onload="init()" onresize="resize()" style="display:none;" class="roster" oncontextmenu="return handleContextMenu(event);">
<div id="MainCallRoster" style="display:block;";> <div id="MainCallRoster" style="display:block;";>
@ -215,8 +215,8 @@
class="inputTextValue" class="inputTextValue"
size="12" size="12"
id="huntRegexValue" id="huntRegexValue"
onfocus="g_typingInRoster=true;" onfocus="CR.typingInRoster=true;"
onblur="g_typingInRoster=false;" onblur="CR.typingInRoster=false;"
oninput="valuesChanged();" oninput="valuesChanged();"
onkeydown="blurOnEnter(this);" onkeydown="blurOnEnter(this);"
/> />
@ -365,8 +365,8 @@
class="inputTextValue" class="inputTextValue"
size="8" size="8"
id="noMsgValue" id="noMsgValue"
onfocus="g_typingInRoster=true;" onfocus="CR.typingInRoster=true;"
onblur="g_typingInRoster=false;" onblur="CR.typingInRoster=false;"
oninput="valuesChanged();" oninput="valuesChanged();"
onkeydown="blurOnEnter(this);" onkeydown="blurOnEnter(this);"
/> />
@ -382,8 +382,8 @@
class="inputTextValue" class="inputTextValue"
size="8" size="8"
id="onlyMsgValue" id="onlyMsgValue"
onfocus="g_typingInRoster=true;" onfocus="CR.typingInRoster=true;"
onblur="g_typingInRoster=false;" onblur="CR.typingInRoster=false;"
oninput="valuesChanged();" oninput="valuesChanged();"
onkeydown="blurOnEnter(this);" onkeydown="blurOnEnter(this);"
/> />
@ -400,8 +400,8 @@
class="inputTextValue" class="inputTextValue"
size="12" size="12"
id="callsignRegex" id="callsignRegex"
onfocus="g_typingInRoster=true;" onfocus="CR.typingInRoster=true;"
onblur="g_typingInRoster=false;" onblur="CR.typingInRoster=false;"
oninput="valuesChanged();" oninput="valuesChanged();"
onkeydown="blurOnEnter(this);" onkeydown="blurOnEnter(this);"
/> />

Wyświetl plik

@ -20,6 +20,7 @@
<title>Statistics</title> <title>Statistics</title>
<link rel="stylesheet" href="./lib/style.css" /> <link rel="stylesheet" href="./lib/style.css" />
<script src="./lib/protos.js" type="text/javascript"></script> <script src="./lib/protos.js" type="text/javascript"></script>
<script src="./lib/screens.js"></script>
<script src="./lib/jquery-3.6.1.min.js"></script> <script src="./lib/jquery-3.6.1.min.js"></script>
<script src="./lib/jquery.i18n.js" type="text/javascript"></script> <script src="./lib/jquery.i18n.js" type="text/javascript"></script>
<script src="./lib/jquery.i18n.messagestore.js" type="text/javascript"></script> <script src="./lib/jquery.i18n.messagestore.js" type="text/javascript"></script>
@ -29,7 +30,6 @@
<script src="./lib/jquery.i18n.language.js" type="text/javascript"></script> <script src="./lib/jquery.i18n.language.js" type="text/javascript"></script>
<script src="./lib/i18n.js" type="text/javascript"></script> <script src="./lib/i18n.js" type="text/javascript"></script>
<script src="./lib/stats.js"></script> <script src="./lib/stats.js"></script>
<script src="./lib/screens.js"></script>
</head> </head>
<body id="mainBody" onresize="Resize();" onload="init();"> <body id="mainBody" onresize="Resize();" onload="init();">

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff

Wyświetl plik

@ -2,23 +2,23 @@
// All rights reserved. // All rights reserved.
// See LICENSE for more information. // See LICENSE for more information.
var g_lotwCallsigns = Object(); GT.lotwCallsigns = Object();
var g_lotwFile = ""; GT.lotwFile = "";
var g_lotwWhenDate = 0; GT.lotwWhenDate = 0;
var g_lotwLoadTimer = null; GT.lotwLoadTimer = null;
var g_eqslCallsigns = Object(); GT.eqslCallsigns = Object();
var g_eqslFile = ""; GT.eqslFile = "";
var g_eqslWhenDate = 0; GT.eqslWhenDate = 0;
var g_eqslLoadTimer = null; GT.eqslLoadTimer = null;
var g_ulsCallsignsCount = 0; GT.ulsCallsignsCount = 0;
var g_ulsWhenDate = 0; GT.ulsWhenDate = 0;
var g_ulsLoadTimer = null; GT.ulsLoadTimer = null;
var g_oqrsCallsigns = Object(); GT.oqrsCallsigns = Object();
var g_oqrsFile = ""; GT.oqrsFile = "";
var g_oqrsWhenDate = 0; GT.oqrsWhenDate = 0;
var g_oqrsLoadTimer = null; GT.oqrsLoadTimer = null;
function dumpFile(file) function dumpFile(file)
{ {
@ -41,33 +41,33 @@ function dumpDir(dir)
function callsignServicesInit() function callsignServicesInit()
{ {
// Dump old data files we no longer reference // Dump old data files we no longer reference
dumpFile(g_jsonDir + "uls-callsigns.json"); dumpFile(GT.jsonDir + "uls-callsigns.json");
dumpFile(g_jsonDir + "us-callsigns.json"); dumpFile(GT.jsonDir + "us-callsigns.json");
dumpFile(g_jsonDir + "lotw-callsigns.json"); dumpFile(GT.jsonDir + "lotw-callsigns.json");
dumpFile(g_jsonDir + "lotw-ts-callsigns.json"); dumpFile(GT.jsonDir + "lotw-ts-callsigns.json");
dumpFile(g_jsonDir + "eqsl-callsigns.json"); dumpFile(GT.jsonDir + "eqsl-callsigns.json");
dumpFile(g_jsonDir + "cloqrs-callsigns.json"); dumpFile(GT.jsonDir + "cloqrs-callsigns.json");
dumpFile(g_jsonDir + "internal_qso.json"); dumpFile(GT.jsonDir + "internal_qso.json");
dumpFile(g_jsonDir + "spots.json"); dumpFile(GT.jsonDir + "spots.json");
dumpDir(g_jsonDir); dumpDir(GT.jsonDir);
g_lotwFile = g_NWappData + "lotw-ts-callsigns.json"; GT.lotwFile = GT.NWappData + "lotw-ts-callsigns.json";
g_eqslFile = g_NWappData + "eqsl-callsigns.json"; GT.eqslFile = GT.NWappData + "eqsl-callsigns.json";
g_oqrsFile = g_NWappData + "cloqrs-callsigns.json"; GT.oqrsFile = GT.NWappData + "cloqrs-callsigns.json";
if (g_callsignLookups.lotwUseEnable) if (GT.callsignLookups.lotwUseEnable)
{ {
lotwLoadCallsigns(); lotwLoadCallsigns();
} }
if (g_callsignLookups.eqslUseEnable) if (GT.callsignLookups.eqslUseEnable)
{ {
eqslLoadCallsigns(); eqslLoadCallsigns();
} }
if (g_callsignLookups.ulsUseEnable) if (GT.callsignLookups.ulsUseEnable)
{ {
ulsLoadCallsigns(); ulsLoadCallsigns();
} }
if (g_callsignLookups.oqrsUseEnable) if (GT.callsignLookups.oqrsUseEnable)
{ {
oqrsLoadCallsigns(); oqrsLoadCallsigns();
} }
@ -80,37 +80,37 @@ function callsignServicesInit()
function saveCallsignSettings() function saveCallsignSettings()
{ {
localStorage.callsignLookups = JSON.stringify(g_callsignLookups); localStorage.callsignLookups = JSON.stringify(GT.callsignLookups);
} }
function lotwLoadCallsigns() function lotwLoadCallsigns()
{ {
var now = timeNowSec(); var now = timeNowSec();
if (now - g_callsignLookups.lotwLastUpdate > 86400 * 7) if (now - GT.callsignLookups.lotwLastUpdate > 86400 * 7)
{ g_callsignLookups.lotwLastUpdate = 0; } { GT.callsignLookups.lotwLastUpdate = 0; }
else else
{ {
var lotwWhenTimer = 86400 * 7 - (now - g_callsignLookups.lotwLastUpdate); var lotwWhenTimer = 86400 * 7 - (now - GT.callsignLookups.lotwLastUpdate);
g_lotwWhenDate = now + lotwWhenTimer; GT.lotwWhenDate = now + lotwWhenTimer;
g_lotwLoadTimer = nodeTimers.setTimeout(lotwDownload, lotwWhenTimer * 1000); GT.lotwLoadTimer = nodeTimers.setTimeout(lotwDownload, lotwWhenTimer * 1000);
} }
try try
{ {
if (!fs.existsSync(g_lotwFile)) if (!fs.existsSync(GT.lotwFile))
{ {
g_callsignLookups.lotwLastUpdate = 0; GT.callsignLookups.lotwLastUpdate = 0;
} }
else else
{ {
var data = fs.readFileSync(g_lotwFile); var data = fs.readFileSync(GT.lotwFile);
g_lotwCallsigns = JSON.parse(data); GT.lotwCallsigns = JSON.parse(data);
if (Object.keys(g_lotwCallsigns).length < 100) if (Object.keys(GT.lotwCallsigns).length < 100)
{ {
lotwDownload(); lotwDownload();
} }
} }
if (g_callsignLookups.lotwLastUpdate == 0) if (GT.callsignLookups.lotwLastUpdate == 0)
{ {
lotwDownload(); lotwDownload();
} }
@ -118,40 +118,40 @@ function lotwLoadCallsigns()
catch (e) catch (e)
{ {
console.log(e); console.log(e);
g_callsignLookups.lotwLastUpdate = 0; GT.callsignLookups.lotwLastUpdate = 0;
lotwDownload(); lotwDownload();
} }
} }
function lotwSettingsDisplay() function lotwSettingsDisplay()
{ {
lotwUseEnable.checked = g_callsignLookups.lotwUseEnable; lotwUseEnable.checked = GT.callsignLookups.lotwUseEnable;
if (g_callsignLookups.lotwLastUpdate == 0) if (GT.callsignLookups.lotwLastUpdate == 0)
{ {
lotwUpdatedTd.innerHTML = "Never"; lotwUpdatedTd.innerHTML = "Never";
} }
else else
{ {
lotwUpdatedTd.innerHTML = userTimeString( lotwUpdatedTd.innerHTML = userTimeString(
g_callsignLookups.lotwLastUpdate * 1000 GT.callsignLookups.lotwLastUpdate * 1000
); );
} }
if (!g_callsignLookups.lotwUseEnable) if (!GT.callsignLookups.lotwUseEnable)
{ {
if (g_lotwLoadTimer != null) nodeTimers.clearTimeout(g_lotwLoadTimer); if (GT.lotwLoadTimer != null) nodeTimers.clearTimeout(GT.lotwLoadTimer);
g_lotwLoadTimer = null; GT.lotwLoadTimer = null;
g_lotwCallsigns = Object(); GT.lotwCallsigns = Object();
} }
lotwCountTd.innerHTML = Object.keys(g_lotwCallsigns).length; lotwCountTd.innerHTML = Object.keys(GT.lotwCallsigns).length;
} }
function lotwValuesChanged() function lotwValuesChanged()
{ {
g_callsignLookups.lotwUseEnable = lotwUseEnable.checked; GT.callsignLookups.lotwUseEnable = lotwUseEnable.checked;
saveCallsignSettings(); saveCallsignSettings();
if (g_callsignLookups.lotwUseEnable == true) if (GT.callsignLookups.lotwUseEnable == true)
{ {
lotwLoadCallsigns(); lotwLoadCallsigns();
} }
@ -159,7 +159,7 @@ function lotwValuesChanged()
setAlertVisual(); setAlertVisual();
goProcessRoster(); goProcessRoster();
if (g_rosterInitialized) g_callRosterWindowHandle.window.resize(); if (GT.rosterInitialized) GT.callRosterWindowHandle.window.resize();
} }
function lotwDownload(fromSettings) function lotwDownload(fromSettings)
@ -200,19 +200,19 @@ function processLotwCallsigns(result, flag)
} }
} }
g_callsignLookups.lotwLastUpdate = timeNowSec(); GT.callsignLookups.lotwLastUpdate = timeNowSec();
var now = timeNowSec(); var now = timeNowSec();
if (g_lotwLoadTimer != null) nodeTimers.clearTimeout(g_lotwLoadTimer); if (GT.lotwLoadTimer != null) nodeTimers.clearTimeout(GT.lotwLoadTimer);
var lotwWhenTimer = 86400 * 7 - (now - g_callsignLookups.lotwLastUpdate); var lotwWhenTimer = 86400 * 7 - (now - GT.callsignLookups.lotwLastUpdate);
g_lotwWhenDate = now + lotwWhenTimer; GT.lotwWhenDate = now + lotwWhenTimer;
g_lotwLoadTimer = nodeTimers.setTimeout(lotwDownload, lotwWhenTimer * 1000); GT.lotwLoadTimer = nodeTimers.setTimeout(lotwDownload, lotwWhenTimer * 1000);
if (Object.keys(lotwCallsigns).length > 100) if (Object.keys(lotwCallsigns).length > 100)
{ {
g_lotwCallsigns = lotwCallsigns; GT.lotwCallsigns = lotwCallsigns;
fs.writeFileSync(g_lotwFile, JSON.stringify(g_lotwCallsigns)); fs.writeFileSync(GT.lotwFile, JSON.stringify(GT.lotwCallsigns));
} }
lotwSettingsDisplay(); lotwSettingsDisplay();
@ -221,67 +221,67 @@ function processLotwCallsigns(result, flag)
function oqrsLoadCallsigns() function oqrsLoadCallsigns()
{ {
var now = timeNowSec(); var now = timeNowSec();
if (now - g_callsignLookups.oqrsLastUpdate > 86400 * 7) if (now - GT.callsignLookups.oqrsLastUpdate > 86400 * 7)
{ g_callsignLookups.oqrsLastUpdate = 0; } { GT.callsignLookups.oqrsLastUpdate = 0; }
else else
{ {
var oqrsWhenTimer = 86400 * 7 - (now - g_callsignLookups.oqrsLastUpdate); var oqrsWhenTimer = 86400 * 7 - (now - GT.callsignLookups.oqrsLastUpdate);
g_oqrsWhenDate = now + oqrsWhenTimer; GT.oqrsWhenDate = now + oqrsWhenTimer;
g_oqrsLoadTimer = nodeTimers.setTimeout(oqrsDownload, oqrsWhenTimer * 1000); GT.oqrsLoadTimer = nodeTimers.setTimeout(oqrsDownload, oqrsWhenTimer * 1000);
} }
try try
{ {
if (!fs.existsSync(g_oqrsFile)) if (!fs.existsSync(GT.oqrsFile))
{ {
g_callsignLookups.oqrsLastUpdate = 0; GT.callsignLookups.oqrsLastUpdate = 0;
} }
else else
{ {
var data = fs.readFileSync(g_oqrsFile); var data = fs.readFileSync(GT.oqrsFile);
g_oqrsCallsigns = JSON.parse(data); GT.oqrsCallsigns = JSON.parse(data);
} }
if (g_callsignLookups.oqrsLastUpdate == 0) if (GT.callsignLookups.oqrsLastUpdate == 0)
{ {
oqrsDownload(); oqrsDownload();
} }
} }
catch (e) catch (e)
{ {
g_callsignLookups.oqrsLastUpdate = 0; GT.callsignLookups.oqrsLastUpdate = 0;
oqrsDownload(); oqrsDownload();
} }
} }
function oqrsSettingsDisplay() function oqrsSettingsDisplay()
{ {
oqrsUseEnable.checked = g_callsignLookups.oqrsUseEnable; oqrsUseEnable.checked = GT.callsignLookups.oqrsUseEnable;
if (g_callsignLookups.oqrsLastUpdate == 0) if (GT.callsignLookups.oqrsLastUpdate == 0)
{ {
oqrsUpdatedTd.innerHTML = "Never"; oqrsUpdatedTd.innerHTML = "Never";
} }
else else
{ {
oqrsUpdatedTd.innerHTML = userTimeString( oqrsUpdatedTd.innerHTML = userTimeString(
g_callsignLookups.oqrsLastUpdate * 1000 GT.callsignLookups.oqrsLastUpdate * 1000
); );
} }
if (!g_callsignLookups.oqrsUseEnable) if (!GT.callsignLookups.oqrsUseEnable)
{ {
if (g_oqrsLoadTimer != null) nodeTimers.clearTimeout(g_oqrsLoadTimer); if (GT.oqrsLoadTimer != null) nodeTimers.clearTimeout(GT.oqrsLoadTimer);
g_oqrsLoadTimer = null; GT.oqrsLoadTimer = null;
g_oqrsCallsigns = Object(); GT.oqrsCallsigns = Object();
} }
oqrsCountTd.innerHTML = Object.keys(g_oqrsCallsigns).length; oqrsCountTd.innerHTML = Object.keys(GT.oqrsCallsigns).length;
} }
function oqrsValuesChanged() function oqrsValuesChanged()
{ {
g_callsignLookups.oqrsUseEnable = oqrsUseEnable.checked; GT.callsignLookups.oqrsUseEnable = oqrsUseEnable.checked;
saveCallsignSettings(); saveCallsignSettings();
if (g_callsignLookups.oqrsUseEnable == true) if (GT.callsignLookups.oqrsUseEnable == true)
{ {
oqrsLoadCallsigns(); oqrsLoadCallsigns();
} }
@ -289,7 +289,7 @@ function oqrsValuesChanged()
setAlertVisual(); setAlertVisual();
goProcessRoster(); goProcessRoster();
if (g_rosterInitialized) g_callRosterWindowHandle.window.resize(); if (GT.rosterInitialized) GT.callRosterWindowHandle.window.resize();
} }
function oqrsDownload(fromSettings) function oqrsDownload(fromSettings)
@ -306,45 +306,45 @@ function oqrsDownload(fromSettings)
function processoqrsCallsigns(buffer, flag) function processoqrsCallsigns(buffer, flag)
{ {
g_oqrsCallsigns = JSON.parse(buffer); GT.oqrsCallsigns = JSON.parse(buffer);
g_callsignLookups.oqrsLastUpdate = timeNowSec(); GT.callsignLookups.oqrsLastUpdate = timeNowSec();
var now = timeNowSec(); var now = timeNowSec();
if (g_oqrsLoadTimer != null) nodeTimers.clearTimeout(g_oqrsLoadTimer); if (GT.oqrsLoadTimer != null) nodeTimers.clearTimeout(GT.oqrsLoadTimer);
var oqrsWhenTimer = 86400 * 7 - (now - g_callsignLookups.oqrsLastUpdate); var oqrsWhenTimer = 86400 * 7 - (now - GT.callsignLookups.oqrsLastUpdate);
g_oqrsWhenDate = now + oqrsWhenTimer; GT.oqrsWhenDate = now + oqrsWhenTimer;
g_oqrsLoadTimer = nodeTimers.setTimeout(oqrsDownload, oqrsWhenTimer * 1000); GT.oqrsLoadTimer = nodeTimers.setTimeout(oqrsDownload, oqrsWhenTimer * 1000);
fs.writeFileSync(g_oqrsFile, JSON.stringify(g_oqrsCallsigns)); fs.writeFileSync(GT.oqrsFile, JSON.stringify(GT.oqrsCallsigns));
oqrsSettingsDisplay(); oqrsSettingsDisplay();
} }
function eqslLoadCallsigns() function eqslLoadCallsigns()
{ {
var now = timeNowSec(); var now = timeNowSec();
if (now - g_callsignLookups.eqslLastUpdate > 86400 * 7) if (now - GT.callsignLookups.eqslLastUpdate > 86400 * 7)
{ g_callsignLookups.eqslLastUpdate = 0; } { GT.callsignLookups.eqslLastUpdate = 0; }
else else
{ {
var eqslWhenTimer = 86400 * 7 - (now - g_callsignLookups.eqslLastUpdate); var eqslWhenTimer = 86400 * 7 - (now - GT.callsignLookups.eqslLastUpdate);
g_eqslWhenDate = now + eqslWhenTimer; GT.eqslWhenDate = now + eqslWhenTimer;
g_eqslLoadTimer = nodeTimers.setTimeout(eqslDownload, eqslWhenTimer * 1000); GT.eqslLoadTimer = nodeTimers.setTimeout(eqslDownload, eqslWhenTimer * 1000);
} }
try try
{ {
if (!fs.existsSync(g_eqslFile)) if (!fs.existsSync(GT.eqslFile))
{ {
g_callsignLookups.eqslLastUpdate = 0; GT.callsignLookups.eqslLastUpdate = 0;
} }
else else
{ {
var data = fs.readFileSync(g_eqslFile); var data = fs.readFileSync(GT.eqslFile);
g_eqslCallsigns = JSON.parse(data); GT.eqslCallsigns = JSON.parse(data);
} }
if (g_callsignLookups.eqslLastUpdate == 0) if (GT.callsignLookups.eqslLastUpdate == 0)
{ {
eqslDownload(); eqslDownload();
} }
@ -352,40 +352,40 @@ function eqslLoadCallsigns()
catch (e) catch (e)
{ {
console.log(e); console.log(e);
g_callsignLookups.eqslLastUpdate = 0; GT.callsignLookups.eqslLastUpdate = 0;
eqslDownload(); eqslDownload();
} }
} }
function eqslSettingsDisplay() function eqslSettingsDisplay()
{ {
eqslUseEnable.checked = g_callsignLookups.eqslUseEnable; eqslUseEnable.checked = GT.callsignLookups.eqslUseEnable;
if (g_callsignLookups.eqslLastUpdate == 0) if (GT.callsignLookups.eqslLastUpdate == 0)
{ {
eqslUpdatedTd.innerHTML = "Never"; eqslUpdatedTd.innerHTML = "Never";
} }
else else
{ {
eqslUpdatedTd.innerHTML = userTimeString( eqslUpdatedTd.innerHTML = userTimeString(
g_callsignLookups.eqslLastUpdate * 1000 GT.callsignLookups.eqslLastUpdate * 1000
); );
} }
if (!g_callsignLookups.eqslUseEnable) if (!GT.callsignLookups.eqslUseEnable)
{ {
if (g_eqslLoadTimer != null) nodeTimers.clearTimeout(g_eqslLoadTimer); if (GT.eqslLoadTimer != null) nodeTimers.clearTimeout(GT.eqslLoadTimer);
g_eqslLoadTimer = null; GT.eqslLoadTimer = null;
g_eqslCallsigns = Object(); GT.eqslCallsigns = Object();
} }
eqslCountTd.innerHTML = Object.keys(g_eqslCallsigns).length; eqslCountTd.innerHTML = Object.keys(GT.eqslCallsigns).length;
} }
function eqslValuesChanged() function eqslValuesChanged()
{ {
g_callsignLookups.eqslUseEnable = eqslUseEnable.checked; GT.callsignLookups.eqslUseEnable = eqslUseEnable.checked;
saveCallsignSettings(); saveCallsignSettings();
if (g_callsignLookups.eqslUseEnable == true) if (GT.callsignLookups.eqslUseEnable == true)
{ {
eqslLoadCallsigns(); eqslLoadCallsigns();
} }
@ -393,7 +393,7 @@ function eqslValuesChanged()
setAlertVisual(); setAlertVisual();
goProcessRoster(); goProcessRoster();
if (g_rosterInitialized) g_callRosterWindowHandle.window.resize(); if (GT.rosterInitialized) GT.callRosterWindowHandle.window.resize();
} }
function eqslDownload(fromSettings) function eqslDownload(fromSettings)
@ -413,52 +413,52 @@ function processeqslCallsigns(buffer, flag)
var result = String(buffer); var result = String(buffer);
var lines = Array(); var lines = Array();
lines = result.split("\n"); lines = result.split("\n");
g_eqslCallsigns = Object(); GT.eqslCallsigns = Object();
for (x in lines) for (x in lines)
{ {
g_eqslCallsigns[lines[x].trim()] = true; GT.eqslCallsigns[lines[x].trim()] = true;
} }
g_callsignLookups.eqslLastUpdate = timeNowSec(); GT.callsignLookups.eqslLastUpdate = timeNowSec();
var now = timeNowSec(); var now = timeNowSec();
if (g_eqslLoadTimer != null) nodeTimers.clearTimeout(g_eqslLoadTimer); if (GT.eqslLoadTimer != null) nodeTimers.clearTimeout(GT.eqslLoadTimer);
var eqslWhenTimer = 86400 * 7 - (now - g_callsignLookups.eqslLastUpdate); var eqslWhenTimer = 86400 * 7 - (now - GT.callsignLookups.eqslLastUpdate);
g_eqslWhenDate = now + eqslWhenTimer; GT.eqslWhenDate = now + eqslWhenTimer;
g_eqslLoadTimer = nodeTimers.setTimeout(eqslDownload, eqslWhenTimer * 1000); GT.eqslLoadTimer = nodeTimers.setTimeout(eqslDownload, eqslWhenTimer * 1000);
if (Object.keys(g_eqslCallsigns).length > 10000) if (Object.keys(GT.eqslCallsigns).length > 10000)
{ fs.writeFileSync(g_eqslFile, JSON.stringify(g_eqslCallsigns)); } { fs.writeFileSync(GT.eqslFile, JSON.stringify(GT.eqslCallsigns)); }
eqslSettingsDisplay(); eqslSettingsDisplay();
} }
function ulsLoadCallsigns() function ulsLoadCallsigns()
{ {
if (g_ulsLoadTimer != null) if (GT.ulsLoadTimer != null)
{ {
nodeTimers.clearTimeout(g_ulsLoadTimer); nodeTimers.clearTimeout(GT.ulsLoadTimer);
g_ulsLoadTimer = null; GT.ulsLoadTimer = null;
} }
var now = timeNowSec(); var now = timeNowSec();
if (now - g_callsignLookups.ulsLastUpdate > 86400 * 7) ulsDownload(); if (now - GT.callsignLookups.ulsLastUpdate > 86400 * 7) ulsDownload();
else else
{ {
var ulsWhenTimer = 86400 * 7 - (now - g_callsignLookups.ulsLastUpdate); var ulsWhenTimer = 86400 * 7 - (now - GT.callsignLookups.ulsLastUpdate);
g_ulsWhenDate = now + ulsWhenTimer; GT.ulsWhenDate = now + ulsWhenTimer;
g_ulsLoadTimer = nodeTimers.setTimeout(ulsDownload, ulsWhenTimer * 1000); GT.ulsLoadTimer = nodeTimers.setTimeout(ulsDownload, ulsWhenTimer * 1000);
updateCallsignCount(); updateCallsignCount();
} }
} }
function updateQSO() function updateQSO()
{ {
if (g_ulsCallsignsCount > 0) if (GT.ulsCallsignsCount > 0)
{ {
for (hash in g_QSOhash) for (hash in GT.QSOhash)
{ {
var details = g_QSOhash[hash]; var details = GT.QSOhash[hash];
var lookupCall = false; var lookupCall = false;
if ((details.cnty == null || details.state == null) && isKnownCallsignDXCC(details.dxcc)) if ((details.cnty == null || details.state == null) && isKnownCallsignDXCC(details.dxcc))
@ -468,11 +468,11 @@ function updateQSO()
} }
else if (details.cnty != null && isKnownCallsignUSplus(details.dxcc)) else if (details.cnty != null && isKnownCallsignUSplus(details.dxcc))
{ {
if (!(details.cnty in g_cntyToCounty)) if (!(details.cnty in GT.cntyToCounty))
{ {
if (details.cnty.indexOf(",") == -1) if (details.cnty.indexOf(",") == -1)
{ {
if (!(details.state + "," + details.cnty in g_cntyToCounty)) if (!(details.state + "," + details.cnty in GT.cntyToCounty))
{ {
lookupCall = true; lookupCall = true;
} }
@ -485,7 +485,7 @@ function updateQSO()
} }
if (lookupCall) if (lookupCall)
{ {
if (g_callsignLookups.ulsUseEnable) if (GT.callsignLookups.ulsUseEnable)
{ {
lookupUsCallsign(details, true); lookupUsCallsign(details, true);
} }
@ -496,7 +496,7 @@ function updateQSO()
function updateCallsignCount() function updateCallsignCount()
{ {
g_ulsDatabase.transaction(function (tx) GT.ulsDatabase.transaction(function (tx)
{ {
tx.executeSql("SELECT count(*) as cnt FROM calls", [], tx.executeSql("SELECT count(*) as cnt FROM calls", [],
function (tx, results) function (tx, results)
@ -504,8 +504,8 @@ function updateCallsignCount()
var len = results.rows.length, i; var len = results.rows.length, i;
if (len == 1) if (len == 1)
{ {
g_ulsCallsignsCount = results.rows[0].cnt; GT.ulsCallsignsCount = results.rows[0].cnt;
ulsCountTd.innerHTML = g_ulsCallsignsCount; ulsCountTd.innerHTML = GT.ulsCallsignsCount;
updateQSO(); updateQSO();
} }
@ -517,31 +517,31 @@ function updateCallsignCount()
function ulsSettingsDisplay() function ulsSettingsDisplay()
{ {
ulsUseEnable.checked = g_callsignLookups.ulsUseEnable; ulsUseEnable.checked = GT.callsignLookups.ulsUseEnable;
if (g_callsignLookups.ulsLastUpdate == 0) if (GT.callsignLookups.ulsLastUpdate == 0)
{ {
ulsUpdatedTd.innerHTML = "Never"; ulsUpdatedTd.innerHTML = "Never";
} }
else else
{ {
ulsUpdatedTd.innerHTML = userTimeString(g_callsignLookups.ulsLastUpdate * 1000); ulsUpdatedTd.innerHTML = userTimeString(GT.callsignLookups.ulsLastUpdate * 1000);
} }
if (!g_callsignLookups.ulsUseEnable) if (!GT.callsignLookups.ulsUseEnable)
{ {
if (g_ulsLoadTimer != null) nodeTimers.clearTimeout(g_ulsLoadTimer); if (GT.ulsLoadTimer != null) nodeTimers.clearTimeout(GT.ulsLoadTimer);
g_ulsLoadTimer = null; GT.ulsLoadTimer = null;
g_ulsCallsignsCount = 0; GT.ulsCallsignsCount = 0;
ulsCountTd.innerHTML = g_ulsCallsignsCount; ulsCountTd.innerHTML = GT.ulsCallsignsCount;
} }
} }
function ulsValuesChanged() function ulsValuesChanged()
{ {
g_callsignLookups.ulsUseEnable = ulsUseEnable.checked; GT.callsignLookups.ulsUseEnable = ulsUseEnable.checked;
if (g_callsignLookups.ulsUseEnable == true) if (GT.callsignLookups.ulsUseEnable == true)
{ {
ulsLoadCallsigns(); ulsLoadCallsigns();
} }
@ -554,7 +554,7 @@ function ulsValuesChanged()
ulsSettingsDisplay(); ulsSettingsDisplay();
goProcessRoster(); goProcessRoster();
if (g_rosterInitialized) g_callRosterWindowHandle.window.resize(); if (GT.rosterInitialized) GT.callRosterWindowHandle.window.resize();
} }
function ulsDownload() function ulsDownload()
@ -630,22 +630,22 @@ function getChunkedBuffer(file_url, callback, flag, mode, port, cookie, errorHan
}); });
} }
var g_ulsDatabase = openDatabase( GT.ulsDatabase = openDatabase(
"ulsDB", "ulsDB",
"1.0", "1.0",
"US Callsigns", "US Callsigns",
50 * 1024 * 1024 50 * 1024 * 1024
); );
g_ulsDatabase.transaction(function (tx) GT.ulsDatabase.transaction(function (tx)
{ {
tx.executeSql("CREATE TABLE IF NOT EXISTS calls (callsign TEXT PRIMARY KEY, zip, state)"); tx.executeSql("CREATE TABLE IF NOT EXISTS calls (callsign TEXT PRIMARY KEY, zip, state)");
}); });
function resetULSDatabase() function resetULSDatabase()
{ {
g_callsignLookups.ulsLastUpdate = 0; GT.callsignLookups.ulsLastUpdate = 0;
g_ulsCallsignsCount = 0; GT.ulsCallsignsCount = 0;
} }
function processulsCallsigns(data, flag, cookies, starting, finished) function processulsCallsigns(data, flag, cookies, starting, finished)
@ -670,17 +670,17 @@ function processulsCallsigns(data, flag, cookies, starting, finished)
if (lines.length > 0) if (lines.length > 0)
{ {
g_ulsDatabase.transaction(function (tx) GT.ulsDatabase.transaction(function (tx)
{ {
if (starting == true) if (starting == true)
{ {
if (g_ulsLoadTimer != null) if (GT.ulsLoadTimer != null)
{ {
nodeTimers.clearTimeout(g_ulsLoadTimer); nodeTimers.clearTimeout(GT.ulsLoadTimer);
} }
g_ulsLoadTimer = null; GT.ulsLoadTimer = null;
g_ulsWhenDate = 0; GT.ulsWhenDate = 0;
g_ulsCallsignsCount = 0; GT.ulsCallsignsCount = 0;
ulsUpdatedTd.innerHTML = "<b><i>Processing...</i></b>"; ulsUpdatedTd.innerHTML = "<b><i>Processing...</i></b>";
tx.executeSql("delete from calls"); tx.executeSql("delete from calls");
} }
@ -688,9 +688,9 @@ function processulsCallsigns(data, flag, cookies, starting, finished)
{ {
if (lines[x].length) if (lines[x].length)
{ {
++g_ulsCallsignsCount; ++GT.ulsCallsignsCount;
tx.executeSql("INSERT INTO calls (rowid, callsign, zip, state) VALUES (" + g_ulsCallsignsCount + ",\"" + lines[x].substr(7) + "\",\"" + lines[x].substr(0, 5) + "\",\"" + lines[x].substr(5, 2) + "\")"); tx.executeSql("INSERT INTO calls (rowid, callsign, zip, state) VALUES (" + GT.ulsCallsignsCount + ",\"" + lines[x].substr(7) + "\",\"" + lines[x].substr(0, 5) + "\",\"" + lines[x].substr(5, 2) + "\")");
if (g_ulsCallsignsCount % 10000 == 0) if (GT.ulsCallsignsCount % 10000 == 0)
{ {
tx.executeSql( tx.executeSql(
"SELECT count(*) as cnt FROM calls", "SELECT count(*) as cnt FROM calls",
@ -716,16 +716,16 @@ function processulsCallsigns(data, flag, cookies, starting, finished)
{ {
var now = timeNowSec(); var now = timeNowSec();
if (g_ulsLoadTimer != null) if (GT.ulsLoadTimer != null)
{ {
nodeTimers.clearTimeout(g_ulsLoadTimer); nodeTimers.clearTimeout(GT.ulsLoadTimer);
} }
var ulsWhenTimer = 86400 * 7; var ulsWhenTimer = 86400 * 7;
g_ulsWhenDate = ulsWhenTimer + now; GT.ulsWhenDate = ulsWhenTimer + now;
g_ulsLoadTimer = nodeTimers.setTimeout(ulsDownload, ulsWhenTimer * 1000); GT.ulsLoadTimer = nodeTimers.setTimeout(ulsDownload, ulsWhenTimer * 1000);
g_ulsDatabase.transaction(function (tx) GT.ulsDatabase.transaction(function (tx)
{ {
tx.executeSql( tx.executeSql(
"SELECT count(*) as cnt FROM calls", "SELECT count(*) as cnt FROM calls",
@ -736,9 +736,9 @@ function processulsCallsigns(data, flag, cookies, starting, finished)
i; i;
if (len == 1) if (len == 1)
{ {
g_ulsCallsignsCount = results.rows[0].cnt; GT.ulsCallsignsCount = results.rows[0].cnt;
ulsCountTd.innerHTML = g_ulsCallsignsCount; ulsCountTd.innerHTML = GT.ulsCallsignsCount;
g_callsignLookups.ulsLastUpdate = timeNowSec(); GT.callsignLookups.ulsLastUpdate = timeNowSec();
saveCallsignSettings(); saveCallsignSettings();
ulsSettingsDisplay(); ulsSettingsDisplay();
updateQSO(); updateQSO();
@ -753,7 +753,7 @@ function processulsCallsigns(data, flag, cookies, starting, finished)
function lookupUsCallsign(object, writeState = false) function lookupUsCallsign(object, writeState = false)
{ {
g_ulsDatabase.transaction(function (tx) GT.ulsDatabase.transaction(function (tx)
{ {
let qry = "SELECT * FROM calls where callsign = \"" + object.DEcall + "\""; let qry = "SELECT * FROM calls where callsign = \"" + object.DEcall + "\"";
tx.executeSql( tx.executeSql(
@ -782,7 +782,7 @@ function lookupUsCallsign(object, writeState = false)
object.zipcode = String(results.rows[0].zip); object.zipcode = String(results.rows[0].zip);
if (object.cnty == null) if (object.cnty == null)
{ {
let request = g_Idb.transaction(["lookups"], "readwrite").objectStore("lookups").get(object.DEcall); let request = GT.Idb.transaction(["lookups"], "readwrite").objectStore("lookups").get(object.DEcall);
request.onsuccess = function (event) request.onsuccess = function (event)
{ {
@ -792,9 +792,9 @@ function lookupUsCallsign(object, writeState = false)
object.qual = true; object.qual = true;
} }
if (object.cnty == null && object.zipcode in g_zipToCounty) if (object.cnty == null && object.zipcode in GT.zipToCounty)
{ {
var counties = g_zipToCounty[object.zipcode]; var counties = GT.zipToCounty[object.zipcode];
if (counties.length > 1) if (counties.length > 1)
{ {
object.qual = false; object.qual = false;
@ -871,8 +871,8 @@ function processCtyDat(buffer)
if (key in ctydata) if (key in ctydata)
{ {
dxccInfo[key].cqzone = Number(ctydata[key].cqzone).pad(2); dxccInfo[key].cqzone = padNumber(Number(ctydata[key].cqzone), 2);
dxccInfo[key].ituzone = Number(ctydata[key].ituzone).pad(2); dxccInfo[key].ituzone = padNumber(Number(ctydata[key].ituzone), 2);
// Skip Guantanamo Bay, hand crafted with love // Skip Guantanamo Bay, hand crafted with love
if (key != "105") if (key != "105")
@ -896,12 +896,12 @@ function processCtyDat(buffer)
var cqTest = test.match(/\((.*)\)/); var cqTest = test.match(/\((.*)\)/);
if (cqTest) if (cqTest)
{ {
cq = Number(cqTest[1]).pad(2); cq = padNumber(Number(cqTest[1]), 2);
} }
var ituTest = test.match(/\[(.*)\]/); var ituTest = test.match(/\[(.*)\]/);
if (ituTest) if (ituTest)
{ {
itu = Number(ituTest[1]).pad(2); itu = padNumber(Number(ituTest[1]), 2);
} }
var i = test.indexOf("("); var i = test.indexOf("(");

Plik diff jest za duży Load Diff

Wyświetl plik

@ -2,8 +2,8 @@
// All rights reserved. // All rights reserved.
// See LICENSE for more information. // See LICENSE for more information.
var g_gtEngineInterval = null; GT.gtEngineInterval = null;
var g_chatRecvFunctions = { GT.chatRecvFunctions = {
uuid: gtChatSetUUID, uuid: gtChatSetUUID,
list: gtChatNewList, list: gtChatNewList,
info: gtChatUpdateCall, info: gtChatUpdateCall,
@ -24,7 +24,7 @@ ChatState.status = 4;
ChatState.closed = 5; ChatState.closed = 5;
ChatState.error = 6; ChatState.error = 6;
var g_gtStateToFunction = { GT.gtStateToFunction = {
"-1": gtSetIdle, "-1": gtSetIdle,
0: gtCanConnect, 0: gtCanConnect,
1: gtConnectChat, 1: gtConnectChat,
@ -36,58 +36,58 @@ var g_gtStateToFunction = {
7: gtWaitUUID 7: gtWaitUUID
}; };
var g_gtChatSocket = null; GT.gtChatSocket = null;
var g_gtFlagPins = Object(); GT.gtFlagPins = Object();
var g_gtMessages = Object(); GT.gtMessages = Object();
var g_gtUnread = Object(); GT.gtUnread = Object();
var g_gtCallsigns = Object(); GT.gtCallsigns = Object();
var g_gtSentAwayToCid = Object(); GT.gtSentAwayToCid = Object();
var g_gtState = ChatState.none; GT.gtState = ChatState.none;
var g_gtStatusCount = 0; GT.gtStatusCount = 0;
var g_gtStatusTime = 500; GT.gtStatusTime = 500;
var g_gtMaxChatMessages = 100; GT.gtMaxChatMessages = 100;
var g_gtNeedUsersList = true; GT.gtNeedUsersList = true;
var g_gtUuidValid = false; GT.gtUuidValid = false;
var g_gtLiveStatusUpdate = false; GT.gtLiveStatusUpdate = false;
var g_oamsBandActivityData = null; GT.oamsBandActivityData = null;
var myChatId = 0; var myChatId = 0;
var myRoom = 0; var myRoom = 0;
var g_gtCurrentMessageCount = 0; GT.gtCurrentMessageCount = 0;
function gtConnectChat() function gtConnectChat()
{ {
if (g_gtChatSocket != null) if (GT.gtChatSocket != null)
{ {
// we should start over // we should start over
g_gtState = ChatState.error; GT.gtState = ChatState.error;
return; return;
} }
var rnd = parseInt(Math.random() * 10) + 18360; var rnd = parseInt(Math.random() * 10) + 18360;
try try
{ {
g_gtState = ChatState.connecting; GT.gtState = ChatState.connecting;
g_gtChatSocket = new WebSocket("ws://oams.space:" + rnd); GT.gtChatSocket = new WebSocket("ws://oams.space:" + rnd);
} }
catch (e) catch (e)
{ {
g_gtState = ChatState.error; GT.gtState = ChatState.error;
return; return;
} }
g_gtChatSocket.onopen = function () GT.gtChatSocket.onopen = function ()
{ {
g_gtState = ChatState.connected; GT.gtState = ChatState.connected;
}; };
g_gtChatSocket.onmessage = function (evt) GT.gtChatSocket.onmessage = function (evt)
{ {
if (g_appSettings.gtShareEnable == true) if (GT.appSettings.gtShareEnable == true)
{ {
let jsmesg = false; let jsmesg = false;
try try
@ -97,18 +97,18 @@ function gtConnectChat()
catch (err) catch (err)
{ {
// bad message, dumping client // bad message, dumping client
g_gtState = ChatState.error; GT.gtState = ChatState.error;
return; return;
} }
if (!("type" in jsmesg)) if (!("type" in jsmesg))
{ {
g_gtState = ChatState.error; GT.gtState = ChatState.error;
return; return;
} }
if (jsmesg.type in g_chatRecvFunctions) if (jsmesg.type in GT.chatRecvFunctions)
{ {
g_chatRecvFunctions[jsmesg.type](jsmesg); GT.chatRecvFunctions[jsmesg.type](jsmesg);
} }
else else
{ {
@ -118,14 +118,14 @@ function gtConnectChat()
} }
}; };
g_gtChatSocket.onerror = function () GT.gtChatSocket.onerror = function ()
{ {
g_gtState = ChatState.error; GT.gtState = ChatState.error;
}; };
g_gtChatSocket.onclose = function () GT.gtChatSocket.onclose = function ()
{ {
g_gtState = ChatState.closed; GT.gtState = ChatState.closed;
}; };
} }
@ -140,106 +140,106 @@ function gtChatSendClose()
{ {
msg = Object(); msg = Object();
msg.type = "close"; msg.type = "close";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
sendGtJson(JSON.stringify(msg)); sendGtJson(JSON.stringify(msg));
} }
function closeGtSocket() function closeGtSocket()
{ {
if (g_gtChatSocket != null) if (GT.gtChatSocket != null)
{ {
gtChatSendClose(); gtChatSendClose();
if (g_gtChatSocket.readyState != WebSocket.CLOSED) g_gtChatSocket.close(); if (GT.gtChatSocket.readyState != WebSocket.CLOSED) GT.gtChatSocket.close();
if (g_gtChatSocket.readyState === WebSocket.CLOSED) if (GT.gtChatSocket.readyState === WebSocket.CLOSED)
{ {
g_gtChatSocket = null; GT.gtChatSocket = null;
g_gtState = ChatState.none; GT.gtState = ChatState.none;
} }
} }
else g_gtState = ChatState.none; else GT.gtState = ChatState.none;
} }
function gtClosedSocket() function gtClosedSocket()
{ {
g_gtChatSocket = null; GT.gtChatSocket = null;
g_gtState = ChatState.none; GT.gtState = ChatState.none;
} }
// Connect 15 seconds after startup // Connect 15 seconds after startup
var g_lastConnectAttempt = parseInt(Date.now() / 1000) - 15; GT.lastConnectAttempt = parseInt(Date.now() / 1000) - 15;
function gtCanConnect() function gtCanConnect()
{ {
g_lastConnectAttempt = timeNowSec(); GT.lastConnectAttempt = timeNowSec();
g_gtState = ChatState.connect; GT.gtState = ChatState.connect;
} }
function gtSetIdle() function gtSetIdle()
{ {
if (timeNowSec() - g_lastConnectAttempt >= 30) if (timeNowSec() - GT.lastConnectAttempt >= 30)
{ {
g_gtStatusCount = 0; GT.gtStatusCount = 0;
g_gtNeedUsersList = true; GT.gtNeedUsersList = true;
g_gtState = ChatState.idle; GT.gtState = ChatState.idle;
g_lastGtStatus = ""; GT.lastGtStatus = "";
} }
g_gtUuidValid = false; GT.gtUuidValid = false;
} }
function gtStatusCheck() function gtStatusCheck()
{ {
if (g_gtStatusCount > 0) if (GT.gtStatusCount > 0)
{ {
g_gtStatusCount--; GT.gtStatusCount--;
} }
if (g_gtStatusCount == 0 || g_gtLiveStatusUpdate == true) if (GT.gtStatusCount == 0 || GT.gtLiveStatusUpdate == true)
{ {
if (g_gtLiveStatusUpdate == true) if (GT.gtLiveStatusUpdate == true)
{ {
g_gtLiveStatusUpdate = false; GT.gtLiveStatusUpdate = false;
} }
else else
{ {
g_lastGtStatus = ""; GT.lastGtStatus = "";
g_gtStatusCount = g_gtStatusTime; GT.gtStatusCount = GT.gtStatusTime;
} }
gtChatSendStatus(); gtChatSendStatus();
} }
if (g_gtNeedUsersList == true) if (GT.gtNeedUsersList == true)
{ {
g_gtNeedUsersList = false; GT.gtNeedUsersList = false;
gtChatGetList(); gtChatGetList();
} }
} }
function sendGtJson(json, isUUIDrequest = false) function sendGtJson(json, isUUIDrequest = false)
{ {
if (g_appSettings.gtShareEnable == true && g_gtChatSocket != null) if (GT.appSettings.gtShareEnable == true && GT.gtChatSocket != null)
{ {
if (g_gtChatSocket.readyState === WebSocket.OPEN && (isUUIDrequest || g_gtUuidValid)) if (GT.gtChatSocket.readyState === WebSocket.OPEN && (isUUIDrequest || GT.gtUuidValid))
{ {
g_gtChatSocket.send(json); GT.gtChatSocket.send(json);
} }
else else
{ {
if (g_gtChatSocket.readyState === WebSocket.CLOSED) if (GT.gtChatSocket.readyState === WebSocket.CLOSED)
{ {
g_gtState = ChatState.closed; GT.gtState = ChatState.closed;
} }
} }
} }
} }
var g_lastGtStatus = ""; GT.lastGtStatus = "";
function gtChatSendStatus() function gtChatSendStatus()
{ {
var msg = Object(); var msg = Object();
msg.type = "status"; msg.type = "status";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
msg.call = myDEcall; msg.call = myDEcall;
msg.grid = myRawGrid; msg.grid = myRawGrid;
@ -247,14 +247,14 @@ function gtChatSendStatus()
msg.mode = myMode; msg.mode = myMode;
msg.band = myBand; msg.band = myBand;
msg.src = "GT"; msg.src = "GT";
msg.canmsg = g_appSettings.gtMsgEnable; msg.canmsg = GT.appSettings.gtMsgEnable;
msg.o = g_appSettings.gtSpotEnable == true ? 1 : 0; msg.o = GT.appSettings.gtSpotEnable == true ? 1 : 0;
msg = JSON.stringify(msg); msg = JSON.stringify(msg);
if (msg != g_lastGtStatus) if (msg != GT.lastGtStatus)
{ {
sendGtJson(msg); sendGtJson(msg);
g_lastGtStatus = msg; GT.lastGtStatus = msg;
} }
} }
@ -262,7 +262,7 @@ function gtChatSendSpots(spotsObject, detailsObject)
{ {
let msg = Object(); let msg = Object();
msg.type = "o"; msg.type = "o";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
msg.o = spotsObject; msg.o = spotsObject;
msg.d = detailsObject; msg.d = detailsObject;
@ -273,17 +273,17 @@ function gtChatSendDecodes(instancesObject)
{ {
let msg = Object(); let msg = Object();
msg.type = "d"; msg.type = "d";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
msg.i = instancesObject; msg.i = instancesObject;
sendGtJson(JSON.stringify(msg)); sendGtJson(JSON.stringify(msg));
} }
function oamsBandActivityCheck() function oamsBandActivityCheck()
{ {
if (g_appSettings.oamsBandActivity == true && myDEGrid.length >= 4) if (GT.appSettings.oamsBandActivity == true && myDEGrid.length >= 4)
{ {
let grid = myDEGrid.substring(0, 4).toUpperCase(); let grid = myDEGrid.substring(0, 4).toUpperCase();
if (g_appSettings.oamsBandActivityNeighbors == true) if (GT.appSettings.oamsBandActivityNeighbors == true)
{ {
gtChatSendBandActivityRequest(squareToNeighbors(grid)); gtChatSendBandActivityRequest(squareToNeighbors(grid));
} }
@ -298,14 +298,14 @@ function gtChatSendBandActivityRequest(gridArray)
{ {
msg = Object(); msg = Object();
msg.type = "ba"; msg.type = "ba";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
msg.ga = gridArray; msg.ga = gridArray;
sendGtJson(JSON.stringify(msg)); sendGtJson(JSON.stringify(msg));
} }
function bandActivityReply(jsmesg) function bandActivityReply(jsmesg)
{ {
g_oamsBandActivityData = jsmesg.r; GT.oamsBandActivityData = jsmesg.r;
renderBandActivity(); renderBandActivity();
} }
@ -314,40 +314,40 @@ function gtChatRemoveCall(jsmesg)
var id = jsmesg.id; var id = jsmesg.id;
var cid = jsmesg.cid; var cid = jsmesg.cid;
if (cid in g_gtFlagPins) if (cid in GT.gtFlagPins)
{ {
if (id in g_gtFlagPins[cid].ids) if (id in GT.gtFlagPins[cid].ids)
{ {
delete g_gtFlagPins[cid].ids[id]; delete GT.gtFlagPins[cid].ids[id];
} }
else else
{ {
console.log("drop: No such id in g_gtFlagPins.ids:"); console.log("drop: No such id in GT.gtFlagPins.ids:");
console.log(jsmesg); console.log(jsmesg);
console.log(g_gtFlagPins[cid].ids); console.log(GT.gtFlagPins[cid].ids);
} }
if (Object.keys(g_gtFlagPins[cid].ids).length == 0) if (Object.keys(GT.gtFlagPins[cid].ids).length == 0)
{ {
delete g_gtCallsigns[g_gtFlagPins[cid].call][cid]; delete GT.gtCallsigns[GT.gtFlagPins[cid].call][cid];
if (g_gtFlagPins[cid].pin != null) if (GT.gtFlagPins[cid].pin != null)
{ {
// remove pin from map here // remove pin from map here
if (g_layerSources.gtflags.hasFeature(g_gtFlagPins[cid].pin)) if (GT.layerSources.gtflags.hasFeature(GT.gtFlagPins[cid].pin))
{ g_layerSources.gtflags.removeFeature(g_gtFlagPins[cid].pin); } { GT.layerSources.gtflags.removeFeature(GT.gtFlagPins[cid].pin); }
delete g_gtFlagPins[cid].pin; delete GT.gtFlagPins[cid].pin;
g_gtFlagPins[cid].pin = null; GT.gtFlagPins[cid].pin = null;
} }
g_gtFlagPins[cid].live = false; GT.gtFlagPins[cid].live = false;
notifyNoChat(cid); notifyNoChat(cid);
if (!(cid in g_gtMessages)) if (!(cid in GT.gtMessages))
{ {
if (Object.keys(g_gtCallsigns[g_gtFlagPins[cid].call]).length == 0) if (Object.keys(GT.gtCallsigns[GT.gtFlagPins[cid].call]).length == 0)
{ {
delete g_gtCallsigns[g_gtFlagPins[cid].call]; delete GT.gtCallsigns[GT.gtFlagPins[cid].call];
} }
delete g_gtFlagPins[cid]; delete GT.gtFlagPins[cid];
} }
updateChatWindow(cid); updateChatWindow(cid);
@ -360,60 +360,60 @@ function gtChatUpdateCall(jsmesg)
var id = jsmesg.id; var id = jsmesg.id;
var cid = jsmesg.cid; var cid = jsmesg.cid;
if (cid in g_gtFlagPins) if (cid in GT.gtFlagPins)
{ {
g_gtFlagPins[cid].ids[id] = true; GT.gtFlagPins[cid].ids[id] = true;
// Did they move grid location? // Did they move grid location?
if (jsmesg.grid != g_gtFlagPins[cid].grid && g_gtFlagPins[cid].pin != null) if (jsmesg.grid != GT.gtFlagPins[cid].grid && GT.gtFlagPins[cid].pin != null)
{ {
// remove pin from map here // remove pin from map here
if (g_layerSources.gtflags.hasFeature(g_gtFlagPins[cid].pin)) if (GT.layerSources.gtflags.hasFeature(GT.gtFlagPins[cid].pin))
{ g_layerSources.gtflags.removeFeature(g_gtFlagPins[cid].pin); } { GT.layerSources.gtflags.removeFeature(GT.gtFlagPins[cid].pin); }
delete g_gtFlagPins[cid].pin; delete GT.gtFlagPins[cid].pin;
g_gtFlagPins[cid].pin = null; GT.gtFlagPins[cid].pin = null;
} }
// Changed callsign? // Changed callsign?
if (g_gtFlagPins[cid].call != jsmesg.call) if (GT.gtFlagPins[cid].call != jsmesg.call)
{ {
delete g_gtCallsigns[g_gtFlagPins[cid].call][cid]; delete GT.gtCallsigns[GT.gtFlagPins[cid].call][cid];
} }
} }
else else
{ {
g_gtFlagPins[cid] = Object(); GT.gtFlagPins[cid] = Object();
g_gtFlagPins[cid].pin = null; GT.gtFlagPins[cid].pin = null;
g_gtFlagPins[cid].ids = Object(); GT.gtFlagPins[cid].ids = Object();
g_gtFlagPins[cid].ids[id] = true; GT.gtFlagPins[cid].ids[id] = true;
} }
g_gtFlagPins[cid].cid = jsmesg.cid; GT.gtFlagPins[cid].cid = jsmesg.cid;
g_gtFlagPins[cid].call = jsmesg.call; GT.gtFlagPins[cid].call = jsmesg.call;
g_gtFlagPins[cid].fCall = jsmesg.call.formatCallsign(); GT.gtFlagPins[cid].fCall = formatCallsign(jsmesg.call);
g_gtFlagPins[cid].grid = jsmesg.grid; GT.gtFlagPins[cid].grid = jsmesg.grid;
g_gtFlagPins[cid].freq = jsmesg.freq; GT.gtFlagPins[cid].freq = jsmesg.freq;
g_gtFlagPins[cid].band = jsmesg.band; GT.gtFlagPins[cid].band = jsmesg.band;
g_gtFlagPins[cid].mode = jsmesg.mode; GT.gtFlagPins[cid].mode = jsmesg.mode;
g_gtFlagPins[cid].src = jsmesg.src; GT.gtFlagPins[cid].src = jsmesg.src;
g_gtFlagPins[cid].canmsg = jsmesg.canmsg; GT.gtFlagPins[cid].canmsg = jsmesg.canmsg;
g_gtFlagPins[cid].o = jsmesg.o; GT.gtFlagPins[cid].o = jsmesg.o;
g_gtFlagPins[cid].dxcc = callsignToDxcc(jsmesg.call); GT.gtFlagPins[cid].dxcc = callsignToDxcc(jsmesg.call);
g_gtFlagPins[cid].live = true; GT.gtFlagPins[cid].live = true;
// Make a pin here // Make a pin here
if (g_gtFlagPins[cid].pin == null) if (GT.gtFlagPins[cid].pin == null)
{ {
makeGtPin(g_gtFlagPins[cid]); makeGtPin(GT.gtFlagPins[cid]);
if (g_gtFlagPins[cid].pin != null) if (GT.gtFlagPins[cid].pin != null)
{ {
g_layerSources.gtflags.addFeature(g_gtFlagPins[cid].pin); GT.layerSources.gtflags.addFeature(GT.gtFlagPins[cid].pin);
} }
} }
if (!(g_gtFlagPins[cid].call in g_gtCallsigns)) if (!(GT.gtFlagPins[cid].call in GT.gtCallsigns))
{ {
// Can happen when a user changes callsign // Can happen when a user changes callsign
g_gtCallsigns[g_gtFlagPins[cid].call] = {}; GT.gtCallsigns[GT.gtFlagPins[cid].call] = {};
} }
g_gtCallsigns[g_gtFlagPins[cid].call][cid] = true; GT.gtCallsigns[GT.gtFlagPins[cid].call][cid] = true;
updateChatWindow(cid); updateChatWindow(cid);
} }
@ -422,7 +422,7 @@ function gtChatGetList()
{ {
msg = Object(); msg = Object();
msg.type = "list"; msg.type = "list";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
sendGtJson(JSON.stringify(msg)); sendGtJson(JSON.stringify(msg));
} }
@ -430,19 +430,19 @@ function gtChatGetList()
function redrawPins() function redrawPins()
{ {
clearGtFlags(); clearGtFlags();
for (cid in g_gtFlagPins) for (cid in GT.gtFlagPins)
{ {
if (g_gtFlagPins[cid].pin != null) if (GT.gtFlagPins[cid].pin != null)
{ {
delete g_gtFlagPins[cid].pin; delete GT.gtFlagPins[cid].pin;
g_gtFlagPins[cid].pin = null; GT.gtFlagPins[cid].pin = null;
} }
makeGtPin(g_gtFlagPins[cid]); makeGtPin(GT.gtFlagPins[cid]);
if (g_gtFlagPins[cid].pin != null) if (GT.gtFlagPins[cid].pin != null)
{ {
g_layerSources.gtflags.addFeature(g_gtFlagPins[cid].pin); GT.layerSources.gtflags.addFeature(GT.gtFlagPins[cid].pin);
} }
} }
} }
@ -453,9 +453,9 @@ function makeGtPin(obj)
{ {
if (obj.pin) if (obj.pin)
{ {
if (g_layerSources.gtflags.hasFeature(obj.pin)) if (GT.layerSources.gtflags.hasFeature(obj.pin))
{ {
g_layerSources.gtflags.removeFeature(obj.pin); GT.layerSources.gtflags.removeFeature(obj.pin);
} }
delete obj.pin; delete obj.pin;
obj.pin = null; obj.pin = null;
@ -475,7 +475,7 @@ function makeGtPin(obj)
} }
var LL = squareToCenter(obj.grid); var LL = squareToCenter(obj.grid);
obj.pin = iconFeature(ol.proj.fromLonLat([LL.o, LL.a]), g_gtFlagIcon, 100); obj.pin = iconFeature(ol.proj.fromLonLat([LL.o, LL.a]), GT.gtFlagIcon, 100);
obj.pin.key = obj.cid; obj.pin.key = obj.cid;
obj.pin.isGtFlag = true; obj.pin.isGtFlag = true;
obj.pin.size = 1; obj.pin.size = 1;
@ -488,11 +488,11 @@ function gtChatNewList(jsmesg)
clearGtFlags(); clearGtFlags();
// starting clean if we're getting a new chat list // starting clean if we're getting a new chat list
g_gtFlagPins = Object() GT.gtFlagPins = Object()
g_gtMessages = Object(); GT.gtMessages = Object();
g_gtUnread = Object(); GT.gtUnread = Object();
g_gtCallsigns = Object(); GT.gtCallsigns = Object();
g_gtSentAwayToCid = Object(); GT.gtSentAwayToCid = Object();
for (var key in jsmesg.data.calls) for (var key in jsmesg.data.calls)
{ {
@ -500,43 +500,43 @@ function gtChatNewList(jsmesg)
var id = jsmesg.data.id[key]; var id = jsmesg.data.id[key];
if (id != myChatId) if (id != myChatId)
{ {
if (cid in g_gtFlagPins) if (cid in GT.gtFlagPins)
{ {
g_gtFlagPins[cid].ids[id] = true; GT.gtFlagPins[cid].ids[id] = true;
} }
else else
{ {
g_gtFlagPins[cid] = Object(); GT.gtFlagPins[cid] = Object();
g_gtFlagPins[cid].ids = Object(); GT.gtFlagPins[cid].ids = Object();
g_gtFlagPins[cid].ids[id] = true; GT.gtFlagPins[cid].ids[id] = true;
g_gtFlagPins[cid].pin = null; GT.gtFlagPins[cid].pin = null;
} }
g_gtFlagPins[cid].call = jsmesg.data.calls[key]; GT.gtFlagPins[cid].call = jsmesg.data.calls[key];
g_gtFlagPins[cid].fCall = g_gtFlagPins[cid].call.formatCallsign(); GT.gtFlagPins[cid].fCall = formatCallsign(GT.gtFlagPins[cid].call);
g_gtFlagPins[cid].grid = jsmesg.data.grid[key]; GT.gtFlagPins[cid].grid = jsmesg.data.grid[key];
g_gtFlagPins[cid].freq = jsmesg.data.freq[key]; GT.gtFlagPins[cid].freq = jsmesg.data.freq[key];
g_gtFlagPins[cid].band = jsmesg.data.band[key]; GT.gtFlagPins[cid].band = jsmesg.data.band[key];
g_gtFlagPins[cid].mode = jsmesg.data.mode[key]; GT.gtFlagPins[cid].mode = jsmesg.data.mode[key];
g_gtFlagPins[cid].src = jsmesg.data.src[key]; GT.gtFlagPins[cid].src = jsmesg.data.src[key];
g_gtFlagPins[cid].cid = cid; GT.gtFlagPins[cid].cid = cid;
g_gtFlagPins[cid].canmsg = jsmesg.data.canmsg[key]; GT.gtFlagPins[cid].canmsg = jsmesg.data.canmsg[key];
g_gtFlagPins[cid].o = jsmesg.data.o[key]; GT.gtFlagPins[cid].o = jsmesg.data.o[key];
g_gtFlagPins[cid].dxcc = callsignToDxcc(g_gtFlagPins[cid].call); GT.gtFlagPins[cid].dxcc = callsignToDxcc(GT.gtFlagPins[cid].call);
g_gtFlagPins[cid].live = true; GT.gtFlagPins[cid].live = true;
if (!(g_gtFlagPins[cid].call in g_gtCallsigns)) if (!(GT.gtFlagPins[cid].call in GT.gtCallsigns))
{ {
g_gtCallsigns[g_gtFlagPins[cid].call] = Object(); GT.gtCallsigns[GT.gtFlagPins[cid].call] = Object();
} }
g_gtCallsigns[g_gtFlagPins[cid].call][cid] = true; GT.gtCallsigns[GT.gtFlagPins[cid].call][cid] = true;
makeGtPin(g_gtFlagPins[cid]); makeGtPin(GT.gtFlagPins[cid]);
if (g_gtFlagPins[cid].pin != null) if (GT.gtFlagPins[cid].pin != null)
{ {
g_layerSources.gtflags.addFeature(g_gtFlagPins[cid].pin); GT.layerSources.gtflags.addFeature(GT.gtFlagPins[cid].pin);
} }
} }
} }
@ -548,16 +548,16 @@ function gtChatNewList(jsmesg)
function appendToHistory(cid, jsmesg) function appendToHistory(cid, jsmesg)
{ {
if (!(cid in g_gtMessages)) if (!(cid in GT.gtMessages))
{ {
g_gtMessages[cid] = Object(); GT.gtMessages[cid] = Object();
g_gtMessages[cid].history = Array(); GT.gtMessages[cid].history = Array();
} }
g_gtMessages[cid].history.push(jsmesg); GT.gtMessages[cid].history.push(jsmesg);
while (g_gtMessages[cid].history.length > g_gtMaxChatMessages) while (GT.gtMessages[cid].history.length > GT.gtMaxChatMessages)
{ {
g_gtMessages[cid].history.shift(); GT.gtMessages[cid].history.shift();
} }
} }
@ -572,7 +572,7 @@ function htmlEntities(str)
function gtChatMessage(jsmesg) function gtChatMessage(jsmesg)
{ {
if (g_appSettings.gtMsgEnable == true) if (GT.appSettings.gtMsgEnable == true)
{ {
var cid = jsmesg.cid; var cid = jsmesg.cid;
jsmesg.when = Date.now(); jsmesg.when = Date.now();
@ -589,16 +589,16 @@ function gtChatMessage(jsmesg)
if (jsmesg.call != null && jsmesg.call != "" && jsmesg.call != "NOCALL") if (jsmesg.call != null && jsmesg.call != "" && jsmesg.call != "NOCALL")
{ {
appendToHistory(cid, jsmesg); appendToHistory(cid, jsmesg);
g_gtUnread[cid] = true; GT.gtUnread[cid] = true;
g_gtCurrentMessageCount++; GT.gtCurrentMessageCount++;
if (newChatMessage(cid, jsmesg) == false) alertChatMessage(); if (newChatMessage(cid, jsmesg) == false) alertChatMessage();
if (g_msgSettings.msgAwaySelect == 1 && !(cid in g_gtSentAwayToCid)) if (GT.msgSettings.msgAwaySelect == 1 && !(cid in GT.gtSentAwayToCid))
{ {
g_gtSentAwayToCid[cid] = true; GT.gtSentAwayToCid[cid] = true;
gtSendMessage( gtSendMessage(
"Away message [ " + g_msgSettings.msgAwayText + " ]", "Away message [ " + GT.msgSettings.msgAwayText + " ]",
cid cid
); );
} }
@ -610,7 +610,7 @@ function gtSendMessage(message, who)
{ {
msg = Object(); msg = Object();
msg.type = "mesg"; msg.type = "mesg";
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
msg.cid = who; msg.cid = who;
msg.msg = new Buffer.from(message).toString("base64"); // eslint-disable-line new-cap msg.msg = new Buffer.from(message).toString("base64"); // eslint-disable-line new-cap
sendGtJson(JSON.stringify(msg)); sendGtJson(JSON.stringify(msg));
@ -624,9 +624,9 @@ function gtChatSendUUID()
{ {
var msg = Object(); var msg = Object();
msg.type = "uuid"; msg.type = "uuid";
if (g_appSettings.chatUUID != "") if (GT.appSettings.chatUUID != "")
{ {
msg.uuid = g_appSettings.chatUUID; msg.uuid = GT.appSettings.chatUUID;
} }
else else
{ {
@ -637,7 +637,7 @@ function gtChatSendUUID()
msg.ver = gtShortVersion; msg.ver = gtShortVersion;
sendGtJson(JSON.stringify(msg), true); sendGtJson(JSON.stringify(msg), true);
g_gtState = ChatState.waitUUID; GT.gtState = ChatState.waitUUID;
} }
function gtWaitUUID() function gtWaitUUID()
@ -647,67 +647,67 @@ function gtWaitUUID()
function gtChatSetUUID(jsmesg) function gtChatSetUUID(jsmesg)
{ {
g_appSettings.chatUUID = jsmesg.uuid; GT.appSettings.chatUUID = jsmesg.uuid;
myChatId = jsmesg.id; myChatId = jsmesg.id;
g_gtUuidValid = true; GT.gtUuidValid = true;
gtChatSendStatus(); gtChatSendStatus();
g_gtLiveStatusUpdate = false; GT.gtLiveStatusUpdate = false;
g_gtStatusCount = g_gtStatusTime; GT.gtStatusCount = GT.gtStatusTime;
g_gtState = ChatState.status; GT.gtState = ChatState.status;
} }
var g_getEngineWasRunning = false; GT.getEngineWasRunning = false;
function gtChatStateMachine() function gtChatStateMachine()
{ {
if (g_appSettings.gtShareEnable == true && g_mapSettings.offlineMode == false) if (GT.appSettings.gtShareEnable == true && GT.mapSettings.offlineMode == false)
{ {
var now = timeNowSec(); var now = timeNowSec();
g_gtStateToFunction[g_gtState](); GT.gtStateToFunction[GT.gtState]();
if (Object.keys(g_gtUnread).length > 0 && now % 2 == 0) if (Object.keys(GT.gtUnread).length > 0 && now % 2 == 0)
{ {
msgImg.style.webkitFilter = "invert(1)"; msgImg.style.webkitFilter = "invert(1)";
} }
else msgImg.style.webkitFilter = ""; else msgImg.style.webkitFilter = "";
if (g_msgSettings.msgFrequencySelect > 0 && Object.keys(g_gtUnread).length > 0) if (GT.msgSettings.msgFrequencySelect > 0 && Object.keys(GT.gtUnread).length > 0)
{ {
if (now - g_lastChatMsgAlert > g_msgSettings.msgFrequencySelect * 60) if (now - GT.lastChatMsgAlert > GT.msgSettings.msgFrequencySelect * 60)
{ {
alertChatMessage(); alertChatMessage();
} }
} }
g_getEngineWasRunning = true; GT.getEngineWasRunning = true;
} }
else else
{ {
if (g_getEngineWasRunning == true) if (GT.getEngineWasRunning == true)
{ {
g_getEngineWasRunning = false; GT.getEngineWasRunning = false;
closeGtSocket(); closeGtSocket();
g_lastGtStatus = ""; GT.lastGtStatus = "";
} }
} }
} }
function gtSpotMessage(jsmesg) function gtSpotMessage(jsmesg)
{ {
if (jsmesg.cid in g_gtFlagPins) if (jsmesg.cid in GT.gtFlagPins)
{ {
let frequency, band, mode; let frequency, band, mode;
if (jsmesg.ex != null) if (jsmesg.ex != null)
{ {
frequency = Number(jsmesg.ex[0]); frequency = Number(jsmesg.ex[0]);
band = Number(frequency / 1000000).formatBand(); band = formatBand(Number(frequency / 1000000));
mode = String(jsmesg.ex[1]); mode = String(jsmesg.ex[1]);
} }
else else
{ {
frequency = g_gtFlagPins[jsmesg.cid].freq; frequency = GT.gtFlagPins[jsmesg.cid].freq;
band = g_gtFlagPins[jsmesg.cid].band; band = GT.gtFlagPins[jsmesg.cid].band;
mode = g_gtFlagPins[jsmesg.cid].mode; mode = GT.gtFlagPins[jsmesg.cid].mode;
} }
addNewOAMSSpot(jsmesg.cid, jsmesg.db, frequency, band, mode); addNewOAMSSpot(jsmesg.cid, jsmesg.db, frequency, band, mode);
@ -716,55 +716,55 @@ function gtSpotMessage(jsmesg)
function gtChatSystemInit() function gtChatSystemInit()
{ {
g_gtEngineInterval = nodeTimers.setInterval(gtChatStateMachine, 1000); GT.gtEngineInterval = nodeTimers.setInterval(gtChatStateMachine, 1000);
} }
function showGtFlags() function showGtFlags()
{ {
if (g_appSettings.gtFlagImgSrc > 0) if (GT.appSettings.gtFlagImgSrc > 0)
{ {
if (g_mapSettings.offlineMode == false) if (GT.mapSettings.offlineMode == false)
{ {
redrawPins(); redrawPins();
g_layerVectors.gtflags.setVisible(true); GT.layerVectors.gtflags.setVisible(true);
} }
else else
{ {
g_layerVectors.gtflags.setVisible(false); GT.layerVectors.gtflags.setVisible(false);
} }
} }
else g_layerVectors.gtflags.setVisible(false); else GT.layerVectors.gtflags.setVisible(false);
} }
function clearGtFlags() function clearGtFlags()
{ {
g_layerSources.gtflags.clear(); GT.layerSources.gtflags.clear();
} }
function toggleGtMap() function toggleGtMap()
{ {
g_appSettings.gtFlagImgSrc += 1; GT.appSettings.gtFlagImgSrc += 1;
g_appSettings.gtFlagImgSrc %= 2; GT.appSettings.gtFlagImgSrc %= 2;
gtFlagImg.src = g_gtFlagImageArray[g_appSettings.gtFlagImgSrc]; gtFlagImg.src = GT.gtFlagImageArray[GT.appSettings.gtFlagImgSrc];
if (g_spotView > 0 && g_receptionSettings.mergeSpots == false) return; if (GT.spotView > 0 && GT.receptionSettings.mergeSpots == false) return;
if (g_appSettings.gtFlagImgSrc > 0) if (GT.appSettings.gtFlagImgSrc > 0)
{ {
redrawPins(); redrawPins();
g_layerVectors.gtflags.setVisible(true); GT.layerVectors.gtflags.setVisible(true);
} }
else else
{ {
g_layerVectors.gtflags.setVisible(false); GT.layerVectors.gtflags.setVisible(false);
} }
} }
function notifyNoChat(id) function notifyNoChat(id)
{ {
if (g_chatWindowHandle != null) if (GT.chatWindowHandle != null)
{ {
try try
{ {
g_chatWindowHandle.window.notifyNoChat(id); GT.chatWindowHandle.window.notifyNoChat(id);
} }
catch (e) {} catch (e) {}
} }
@ -772,17 +772,17 @@ function notifyNoChat(id)
function updateChatWindow(id = null) function updateChatWindow(id = null)
{ {
if (g_chatWindowHandle != null) if (GT.chatWindowHandle != null)
{ {
try try
{ {
if (id) if (id)
{ {
g_chatWindowHandle.window.updateCallsign(id); GT.chatWindowHandle.window.updateCallsign(id);
} }
else else
{ {
g_chatWindowHandle.window.updateEverything(); GT.chatWindowHandle.window.updateEverything();
} }
} }
catch (e) {} catch (e) {}
@ -792,33 +792,33 @@ function updateChatWindow(id = null)
function newChatMessage(id, jsmesg) function newChatMessage(id, jsmesg)
{ {
var hasFocus = false; var hasFocus = false;
if (g_msgSettings.msgActionSelect == 1) showMessaging(); if (GT.msgSettings.msgActionSelect == 1) showMessaging();
if (g_chatWindowHandle != null) if (GT.chatWindowHandle != null)
{ {
try try
{ {
hasFocus = g_chatWindowHandle.window.newChatMessage(id, jsmesg); hasFocus = GT.chatWindowHandle.window.newChatMessage(id, jsmesg);
g_chatWindowHandle.window.messagesRedraw(); GT.chatWindowHandle.window.messagesRedraw();
} }
catch (e) {} catch (e) {}
} }
return hasFocus; return hasFocus;
} }
var g_lastChatMsgAlert = 0; GT.lastChatMsgAlert = 0;
function alertChatMessage() function alertChatMessage()
{ {
if (g_msgSettings.msgAlertSelect == 1) if (GT.msgSettings.msgAlertSelect == 1)
{ {
// Text to speech // Text to speech
speakAlertString(g_msgSettings.msgAlertWord); speakAlertString(GT.msgSettings.msgAlertWord);
} }
if (g_msgSettings.msgAlertSelect == 2) if (GT.msgSettings.msgAlertSelect == 2)
{ {
// Audible // Audible
playAlertMediaFile(g_msgSettings.msgAlertMedia); playAlertMediaFile(GT.msgSettings.msgAlertMedia);
} }
g_lastChatMsgAlert = timeNowSec(); GT.lastChatMsgAlert = timeNowSec();
} }

Wyświetl plik

@ -8,7 +8,7 @@ function loadi18n()
{ {
$.i18n().load(languages).done(function () $.i18n().load(languages).done(function ()
{ {
$.i18n().locale = g_appSettings.locale; $.i18n().locale = GT.appSettings.locale;
}); });
} }
@ -20,8 +20,8 @@ function renderI18n(locale)
function changeLocale() function changeLocale()
{ {
g_appSettings.locale = languageLocale.value; GT.appSettings.locale = languageLocale.value;
renderI18n(g_appSettings.locale); renderI18n(GT.appSettings.locale);
saveAppSettings(); saveAppSettings();
chrome.runtime.reload(); chrome.runtime.reload();
} }
@ -30,7 +30,7 @@ function loadChildWindowI18n()
{ {
$.i18n().load(languages).done(function () $.i18n().load(languages).done(function ()
{ {
renderI18n(window.opener.g_appSettings.locale); renderI18n(window.opener.GT.appSettings.locale);
}); });
} }
@ -38,12 +38,12 @@ function loadRosteri18n()
{ {
$.i18n().load(languages).done(function () $.i18n().load(languages).done(function ()
{ {
renderI18n(window.opener.g_appSettings.locale); renderI18n(window.opener.GT.appSettings.locale);
addControls(); addControls();
}); });
} }
function renderLocale() function renderLocale()
{ {
renderI18n(g_appSettings.locale); renderI18n(GT.appSettings.locale);
} }

Wyświetl plik

@ -2,7 +2,7 @@
// All rights reserved. // All rights reserved.
// See LICENSE for more information. // See LICENSE for more information.
var g_pota = { GT.pota = {
parks: {}, parks: {},
locations: {}, locations: {},
parksTimeout: null, parksTimeout: null,
@ -17,7 +17,7 @@ var g_pota = {
rbnFrequency: 600000 rbnFrequency: 600000
}; };
var g_potaSpotTemplate = { GT.potaSpotTemplate = {
activator: "", activator: "",
frequency: 0, frequency: 0,
mode: "", mode: "",
@ -33,11 +33,11 @@ var g_potaSpotTemplate = {
spotterGrid: "" spotterGrid: ""
}; };
var g_parkTemplate = { GT.parkTemplate = {
feature: null feature: null
} }
var g_potaUnknownPark = { GT.potaUnknownPark = {
name: "Unknown park (not yet spotted)", name: "Unknown park (not yet spotted)",
active: "0", active: "0",
entityId: "-1", entityId: "-1",
@ -47,14 +47,14 @@ var g_potaUnknownPark = {
grid: "" grid: ""
}; };
var g_gtParkIconActive = new ol.style.Icon({ GT.gtParkIconActive = new ol.style.Icon({
src: "./img/pota_icon_active.png", src: "./img/pota_icon_active.png",
anchorYUnits: "pixels", anchorYUnits: "pixels",
anchorXUnits: "pixels", anchorXUnits: "pixels",
anchor: [10, 19] anchor: [10, 19]
}); });
var g_gtParkIconInactive = new ol.style.Icon({ GT.gtParkIconInactive = new ol.style.Icon({
src: "./img/pota_icon_inactive.png", src: "./img/pota_icon_inactive.png",
anchorYUnits: "pixels", anchorYUnits: "pixels",
anchorXUnits: "pixels", anchorXUnits: "pixels",
@ -63,15 +63,15 @@ var g_gtParkIconInactive = new ol.style.Icon({
function initPota() function initPota()
{ {
potaEnabled.checked = (g_appSettings.potaEnabled == 1); potaEnabled.checked = (GT.appSettings.potaEnabled == 1);
potaMenu.checked = g_appSettings.potaShowMenu; potaMenu.checked = GT.appSettings.potaShowMenu;
potaButton.style.display = (g_appSettings.potaEnabled == 1 && g_appSettings.potaShowMenu && g_mapSettings.offlineMode == false) ? "" : "none"; potaButton.style.display = (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaShowMenu && GT.mapSettings.offlineMode == false) ? "" : "none";
potaImg.style.filter = g_appSettings.potaMapEnabled ? "" : "grayscale(1)"; potaImg.style.filter = GT.appSettings.potaMapEnabled ? "" : "grayscale(1)";
g_layerSources.pota.clear(); GT.layerSources.pota.clear();
g_pota.mapParks = {}; GT.pota.mapParks = {};
if (g_appSettings.potaEnabled == 1) if (GT.appSettings.potaEnabled == 1)
{ {
getPotaParks(); getPotaParks();
} }
@ -79,11 +79,11 @@ function initPota()
function changePotaEnable() function changePotaEnable()
{ {
g_appSettings.potaEnabled = (potaEnabled.checked == true) ? 1 : 0; GT.appSettings.potaEnabled = (potaEnabled.checked == true) ? 1 : 0;
potaButton.style.display = (g_appSettings.potaEnabled == 1 && g_appSettings.potaShowMenu && g_mapSettings.offlineMode == false) ? "" : "none"; potaButton.style.display = (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaShowMenu && GT.mapSettings.offlineMode == false) ? "" : "none";
if (!g_appSettings.potaEnabled) if (!GT.appSettings.potaEnabled)
{ {
g_layerSources.pota.clear(); GT.layerSources.pota.clear();
} }
else else
{ {
@ -96,18 +96,18 @@ function changePotaEnable()
function changePotaMenu() function changePotaMenu()
{ {
g_appSettings.potaShowMenu = potaMenu.checked; GT.appSettings.potaShowMenu = potaMenu.checked;
potaButton.style.display = (g_appSettings.potaEnabled == 1 && g_appSettings.potaShowMenu && g_mapSettings.offlineMode == false) ? "" : "none"; potaButton.style.display = (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaShowMenu && GT.mapSettings.offlineMode == false) ? "" : "none";
potaImg.style.filter = g_appSettings.potaMapEnabled ? "" : "grayscale(1)"; potaImg.style.filter = GT.appSettings.potaMapEnabled ? "" : "grayscale(1)";
saveAppSettings(); saveAppSettings();
} }
function togglePotaMap() function togglePotaMap()
{ {
g_appSettings.potaMapEnabled = !g_appSettings.potaMapEnabled; GT.appSettings.potaMapEnabled = !GT.appSettings.potaMapEnabled;
potaImg.style.filter = g_appSettings.potaMapEnabled ? "" : "grayscale(1)"; potaImg.style.filter = GT.appSettings.potaMapEnabled ? "" : "grayscale(1)";
saveAppSettings(); saveAppSettings();
@ -116,11 +116,11 @@ function togglePotaMap()
function redrawParks() function redrawParks()
{ {
g_layerSources.pota.clear(); GT.layerSources.pota.clear();
if (g_appSettings.potaEnabled == 1 && g_appSettings.potaMapEnabled) if (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaMapEnabled)
{ {
g_pota.mapParks = {}; GT.pota.mapParks = {};
makeParkFeatures(); makeParkFeatures();
} }
} }
@ -129,22 +129,22 @@ function makeParkFeatures()
{ {
try try
{ {
for (const park in g_pota.parkSpots) for (const park in GT.pota.parkSpots)
{ {
if (park in g_pota.parks) if (park in GT.pota.parks)
{ {
var parkObj = Object.assign({}, g_parkTemplate); var parkObj = Object.assign({}, GT.parkTemplate);
for (const call in g_pota.parkSpots[park]) for (const call in GT.pota.parkSpots[park])
{ {
var report = g_pota.parkSpots[park][call]; var report = GT.pota.parkSpots[park][call];
if (parkObj.feature == null && validateMapBandAndMode(report.band, report.mode)) if (parkObj.feature == null && validateMapBandAndMode(report.band, report.mode))
{ {
parkObj.feature = iconFeature(ol.proj.fromLonLat([Number(g_pota.parks[park].longitude), Number(g_pota.parks[park].latitude)]), g_gtParkIconActive, 1); parkObj.feature = iconFeature(ol.proj.fromLonLat([Number(GT.pota.parks[park].longitude), Number(GT.pota.parks[park].latitude)]), GT.gtParkIconActive, 1);
parkObj.feature.key = park; parkObj.feature.key = park;
parkObj.feature.size = 22; parkObj.feature.size = 22;
g_pota.mapParks[park] = parkObj; GT.pota.mapParks[park] = parkObj;
g_layerSources.pota.addFeature(parkObj.feature); GT.layerSources.pota.addFeature(parkObj.feature);
} }
} }
} }
@ -163,58 +163,58 @@ function potaSpotFromDecode(callObj)
{ {
var park = callObj.pota; var park = callObj.pota;
if (callObj.DEcall in g_pota.callSpots && park in g_pota.parkSpots) if (callObj.DEcall in GT.pota.callSpots && park in GT.pota.parkSpots)
{ {
// update spot // update spot
var newObj = spotFromCallObj(callObj, park, g_pota.parkSpots[park][callObj.DEcall].count); var newObj = spotFromCallObj(callObj, park, GT.pota.parkSpots[park][callObj.DEcall].count);
g_pota.parkSpots[park][callObj.DEcall] = fillObjectFromTemplate(g_pota.parkSpots[park][callObj.DEcall], newObj); GT.pota.parkSpots[park][callObj.DEcall] = fillObjectFromTemplate(GT.pota.parkSpots[park][callObj.DEcall], newObj);
// may or may not be on screen, so try // may or may not be on screen, so try
if (g_appSettings.potaMapEnabled) if (GT.appSettings.potaMapEnabled)
{ {
addParkSpotFeature(park, g_pota.parkSpots[park][callObj.DEcall]); addParkSpotFeature(park, GT.pota.parkSpots[park][callObj.DEcall]);
} }
var hash = park + callObj.DEcall; var hash = park + callObj.DEcall;
if (!(hash in g_pota.rbnReportTimes) || Date.now() > g_pota.rbnReportTimes[hash]) if (!(hash in GT.pota.rbnReportTimes) || Date.now() > GT.pota.rbnReportTimes[hash])
{ {
g_pota.rbnReportTimes[hash] = Date.now() + g_pota.rbnFrequency; GT.pota.rbnReportTimes[hash] = Date.now() + GT.pota.rbnFrequency;
reportPotaRBN(g_pota.parkSpots[park][callObj.DEcall]); reportPotaRBN(GT.pota.parkSpots[park][callObj.DEcall]);
} }
} }
else if (callObj.DEcall in g_pota.callSchedule) else if (callObj.DEcall in GT.pota.callSchedule)
{ {
// Looks like it's scheduled, so it's new // Looks like it's scheduled, so it's new
g_pota.callSpots[callObj.DEcall] = park; GT.pota.callSpots[callObj.DEcall] = park;
if (!(park in g_pota.parkSpots)) if (!(park in GT.pota.parkSpots))
{ {
g_pota.parkSpots[park] = {}; GT.pota.parkSpots[park] = {};
} }
var newObj = spotFromCallObj(callObj, park, 0); var newObj = spotFromCallObj(callObj, park, 0);
newObj.expire = newObj.spotTime + 300000; newObj.expire = newObj.spotTime + 300000;
g_pota.parkSpots[park][callObj.DEcall] = newObj; GT.pota.parkSpots[park][callObj.DEcall] = newObj;
if (g_appSettings.potaMapEnabled) if (GT.appSettings.potaMapEnabled)
{ {
addParkSpotFeature(park, g_pota.parkSpots[park][callObj.DEcall]); addParkSpotFeature(park, GT.pota.parkSpots[park][callObj.DEcall]);
} }
var hash = park + callObj.DEcall; var hash = park + callObj.DEcall;
if (!(hash in g_pota.rbnReportTimes) || Date.now() > g_pota.rbnReportTimes[hash]) if (!(hash in GT.pota.rbnReportTimes) || Date.now() > GT.pota.rbnReportTimes[hash])
{ {
g_pota.rbnReportTimes[hash] = Date.now() + g_pota.rbnFrequency; GT.pota.rbnReportTimes[hash] = Date.now() + GT.pota.rbnFrequency;
reportPotaRBN(g_pota.parkSpots[park][callObj.DEcall]); reportPotaRBN(GT.pota.parkSpots[park][callObj.DEcall]);
} }
} }
else else
{ {
if (!(callObj.DEcall in g_pota.callSpots)) if (!(callObj.DEcall in GT.pota.callSpots))
{ {
console.log("No call spot: " + callObj.DEcall); console.log("No call spot: " + callObj.DEcall);
} }
if (!(park in g_pota.parkSpots)) if (!(park in GT.pota.parkSpots))
{ {
console.log("No park spot: " + park); console.log("No park spot: " + park);
} }
@ -290,15 +290,15 @@ function reportPotaQSO(record)
function rbnReportResult(buffer, flag, cookies) function rbnReportResult(buffer, flag, cookies)
{ {
// It worked! process latest spots! // It worked! process latest spots!
if (g_pota.spotsTimeout) if (GT.pota.spotsTimeout)
{ {
nodeTimers.clearTimeout(g_pota.spotsTimeout); nodeTimers.clearTimeout(GT.pota.spotsTimeout);
g_pota.spotsTimeout = null; GT.pota.spotsTimeout = null;
} }
processPotaSpots(String(buffer)); processPotaSpots(String(buffer));
g_pota.spotsTimeout = nodeTimers.setTimeout(getPotaSpots, 300000); GT.pota.spotsTimeout = nodeTimers.setTimeout(getPotaSpots, 300000);
} }
function spotFromCallObj(callObj, park, inCount, rbnTime) function spotFromCallObj(callObj, park, inCount, rbnTime)
@ -308,7 +308,7 @@ function spotFromCallObj(callObj, park, inCount, rbnTime)
activatorGrid: callObj.grid, activatorGrid: callObj.grid,
spotter: myDEcall + "-#", spotter: myDEcall + "-#",
spotterGrid: myDEGrid, spotterGrid: myDEGrid,
frequency: Number((g_instances[callObj.instance].status.Frequency / 1000000).toFixed(3)), frequency: Number((GT.instances[callObj.instance].status.Frequency / 1000000).toFixed(3)),
reference: park, reference: park,
mode: callObj.mode, mode: callObj.mode,
band: callObj.band, band: callObj.band,
@ -322,28 +322,28 @@ function spotFromCallObj(callObj, park, inCount, rbnTime)
function addParkSpotFeature(park, report) function addParkSpotFeature(park, report)
{ {
var parkObj = Object.assign({}, g_parkTemplate); var parkObj = Object.assign({}, GT.parkTemplate);
if (park in g_pota.mapParks) if (park in GT.pota.mapParks)
{ {
parkObj = g_pota.mapParks[park]; parkObj = GT.pota.mapParks[park];
} }
else else
{ {
g_pota.mapParks[park] = parkObj; GT.pota.mapParks[park] = parkObj;
} }
if (parkObj.feature == null && validateMapBandAndMode(report.band, report.mode)) if (parkObj.feature == null && validateMapBandAndMode(report.band, report.mode))
{ {
parkObj.feature = iconFeature(ol.proj.fromLonLat([Number(g_pota.parks[park].longitude), Number(g_pota.parks[park].latitude)]), g_gtParkIconActive, 1); parkObj.feature = iconFeature(ol.proj.fromLonLat([Number(GT.pota.parks[park].longitude), Number(GT.pota.parks[park].latitude)]), GT.gtParkIconActive, 1);
parkObj.feature.key = park; parkObj.feature.key = park;
parkObj.feature.size = 22; parkObj.feature.size = 22;
g_layerSources.pota.addFeature(parkObj.feature); GT.layerSources.pota.addFeature(parkObj.feature);
} }
} }
function processPotaParks(buffer) function processPotaParks(buffer)
{ {
if (g_appSettings.potaEnabled == 1) if (GT.appSettings.potaEnabled == 1)
{ {
try try
{ {
@ -361,10 +361,10 @@ function processPotaParks(buffer)
} }
newParks[park].locationDesc = locations.join(", "); newParks[park].locationDesc = locations.join(", ");
} }
newParks["?-????"] = g_potaUnknownPark; newParks["?-????"] = GT.potaUnknownPark;
g_pota.parks = newParks; GT.pota.parks = newParks;
g_pota.locations = data.locations; GT.pota.locations = data.locations;
getPotaSchedule(); getPotaSchedule();
getPotaSpots(); getPotaSpots();
} }
@ -379,13 +379,13 @@ function processPotaParks(buffer)
function getPotaParks() function getPotaParks()
{ {
if (g_pota.parksTimeout) if (GT.pota.parksTimeout)
{ {
nodeTimers.clearTimeout(g_pota.parksTimeout); nodeTimers.clearTimeout(GT.pota.parksTimeout);
g_pota.spotsTimeout = null; GT.pota.spotsTimeout = null;
} }
if (g_mapSettings.offlineMode == false && g_appSettings.potaEnabled == 1) if (GT.mapSettings.offlineMode == false && GT.appSettings.potaEnabled == 1)
{ {
getBuffer( getBuffer(
"https://storage.googleapis.com/gt_app/pota.json?cb=" + Date.now(), "https://storage.googleapis.com/gt_app/pota.json?cb=" + Date.now(),
@ -396,7 +396,7 @@ function getPotaParks()
); );
} }
g_pota.parksTimeout = nodeTimers.setTimeout(getPotaParks, 86400000) GT.pota.parksTimeout = nodeTimers.setTimeout(getPotaParks, 86400000)
} }
// This is a shallow copy, don't use with objects that contain other objects or arrays // This is a shallow copy, don't use with objects that contain other objects or arrays
@ -425,22 +425,22 @@ function uniqueArrayFromArray(input)
function processPotaSpots(buffer) function processPotaSpots(buffer)
{ {
if (g_appSettings.potaEnabled == 1) if (GT.appSettings.potaEnabled == 1)
{ {
try try
{ {
var spots = JSON.parse(buffer); var spots = JSON.parse(buffer);
g_pota.callSpots = {}; GT.pota.callSpots = {};
g_pota.parkSpots = {}; GT.pota.parkSpots = {};
for (const spot in spots) for (const spot in spots)
{ {
if (spots[spot].reference in g_pota.parks) if (spots[spot].reference in GT.pota.parks)
{ {
var newSpot = fillObjectFromTemplate(g_potaSpotTemplate, spots[spot]); var newSpot = fillObjectFromTemplate(GT.potaSpotTemplate, spots[spot]);
newSpot.spotTime = Date.parse(newSpot.spotTime + "Z"); newSpot.spotTime = Date.parse(newSpot.spotTime + "Z");
newSpot.frequency = parseInt(newSpot.frequency) / 1000; newSpot.frequency = parseInt(newSpot.frequency) / 1000;
newSpot.expire = newSpot.spotTime + (Number(newSpot.expire) * 1000); newSpot.expire = newSpot.spotTime + (Number(newSpot.expire) * 1000);
newSpot.band = newSpot.frequency.formatBand(); newSpot.band = formatBand(newSpot.frequency);
if (newSpot.spotter == newSpot.activator && newSpot.comments.match(/qrt/gi)) if (newSpot.spotter == newSpot.activator && newSpot.comments.match(/qrt/gi))
{ {
// don't add the spot, they have self-QRT'ed // don't add the spot, they have self-QRT'ed
@ -451,14 +451,14 @@ function processPotaSpots(buffer)
} }
else else
{ {
g_pota.callSpots[newSpot.activator] = newSpot.reference; GT.pota.callSpots[newSpot.activator] = newSpot.reference;
if (!(newSpot.reference in g_pota.parkSpots)) if (!(newSpot.reference in GT.pota.parkSpots))
{ {
g_pota.parkSpots[newSpot.reference] = {}; GT.pota.parkSpots[newSpot.reference] = {};
} }
g_pota.parkSpots[newSpot.reference][newSpot.activator] = newSpot; GT.pota.parkSpots[newSpot.reference][newSpot.activator] = newSpot;
} }
} }
else else
@ -478,13 +478,13 @@ function processPotaSpots(buffer)
function getPotaSpots() function getPotaSpots()
{ {
if (g_pota.spotsTimeout) if (GT.pota.spotsTimeout)
{ {
nodeTimers.clearTimeout(g_pota.spotsTimeout); nodeTimers.clearTimeout(GT.pota.spotsTimeout);
g_pota.spotsTimeout = null; GT.pota.spotsTimeout = null;
} }
if (g_mapSettings.offlineMode == false && g_appSettings.potaEnabled == 1) if (GT.mapSettings.offlineMode == false && GT.appSettings.potaEnabled == 1)
{ {
getBuffer( getBuffer(
"https://api.pota.app/spot/activator", "https://api.pota.app/spot/activator",
@ -495,18 +495,18 @@ function getPotaSpots()
); );
} }
g_pota.spotsTimeout = nodeTimers.setTimeout(getPotaSpots, 300000); GT.pota.spotsTimeout = nodeTimers.setTimeout(getPotaSpots, 300000);
} }
function processPotaSchedule(buffer) function processPotaSchedule(buffer)
{ {
if (g_appSettings.potaEnabled == 1) if (GT.appSettings.potaEnabled == 1)
{ {
try try
{ {
var schedules = JSON.parse(buffer); var schedules = JSON.parse(buffer);
g_pota.callSchedule = {}; GT.pota.callSchedule = {};
g_pota.parkSchedule = {}; GT.pota.parkSchedule = {};
for (const i in schedules) for (const i in schedules)
{ {
var newObj = {}; var newObj = {};
@ -517,13 +517,13 @@ function processPotaSchedule(buffer)
newObj.comments = schedules[i].comments; newObj.comments = schedules[i].comments;
if (Date.now() < newObj.end) if (Date.now() < newObj.end)
{ {
if (newObj.id in g_pota.parks) if (newObj.id in GT.pota.parks)
{ {
(g_pota.callSchedule[schedules[i].activator] = g_pota.callSchedule[schedules[i].activator] || []).push(newObj); (GT.pota.callSchedule[schedules[i].activator] = GT.pota.callSchedule[schedules[i].activator] || []).push(newObj);
newObj = Object.assign({}, newObj); newObj = Object.assign({}, newObj);
newObj.id = schedules[i].activator; newObj.id = schedules[i].activator;
(g_pota.parkSchedule[schedules[i].reference] = g_pota.parkSchedule[schedules[i].reference] || []).push(newObj); (GT.pota.parkSchedule[schedules[i].reference] = GT.pota.parkSchedule[schedules[i].reference] || []).push(newObj);
} }
else else
{ {
@ -534,13 +534,13 @@ function processPotaSchedule(buffer)
} }
// Sanity dedupe checks // Sanity dedupe checks
for (const key in g_pota.callSchedule) for (const key in GT.pota.callSchedule)
{ {
g_pota.callSchedule[key] = uniqueArrayFromArray(g_pota.callSchedule[key]); GT.pota.callSchedule[key] = uniqueArrayFromArray(GT.pota.callSchedule[key]);
} }
for (const key in g_pota.parkSchedule) for (const key in GT.pota.parkSchedule)
{ {
g_pota.parkSchedule[key] = uniqueArrayFromArray(g_pota.parkSchedule[key]); GT.pota.parkSchedule[key] = uniqueArrayFromArray(GT.pota.parkSchedule[key]);
} }
} }
catch (e) catch (e)
@ -552,13 +552,13 @@ function processPotaSchedule(buffer)
function getPotaSchedule() function getPotaSchedule()
{ {
if (g_pota.scheduleTimeout) if (GT.pota.scheduleTimeout)
{ {
nodeTimers.clearTimeout(g_pota.scheduleTimeout); nodeTimers.clearTimeout(GT.pota.scheduleTimeout);
g_pota.scheduleTimeout = null; GT.pota.scheduleTimeout = null;
} }
if (g_mapSettings.offlineMode == false && g_appSettings.potaEnabled == 1) if (GT.mapSettings.offlineMode == false && GT.appSettings.potaEnabled == 1)
{ {
getBuffer( getBuffer(
"https://api.pota.app/activation", "https://api.pota.app/activation",
@ -568,18 +568,18 @@ function getPotaSchedule()
443 443
); );
} }
g_pota.scheduleTimeout = nodeTimers.setTimeout(getPotaSchedule, 900000); GT.pota.scheduleTimeout = nodeTimers.setTimeout(getPotaSchedule, 900000);
} }
var g_lastPark = null; GT.lastPark = null;
function mouseOverPark(feature) function mouseOverPark(feature)
{ {
if (g_lastPark && g_lastPark == feature) if (GT.lastPark && GT.lastPark == feature)
{ {
mouseParkMove(); mouseParkMove();
return; return;
} }
g_lastPark = feature; GT.lastPark = feature;
createParkTipTable(feature); createParkTipTable(feature);
@ -591,7 +591,7 @@ function mouseOverPark(feature)
function mouseOutPark(mouseEvent) function mouseOutPark(mouseEvent)
{ {
g_lastPark = null; GT.lastPark = null;
myParktip.style.zIndex = -1; myParktip.style.zIndex = -1;
} }
@ -615,57 +615,33 @@ function mouseParkMove()
function createParkTipTable(toolElement) function createParkTipTable(toolElement)
{ {
var worker = ""; var worker = "";
var key = toolElement.key; var key = toolElement.key;
var now = Date.now(); var now = Date.now();
worker += "<div style='background-color:#000;color:lightgreen;font-weight:bold;font-size:12px;border:1px solid gray;margin:0px' class='roundBorder'>" + worker += "<div style='background-color:#000;color:lightgreen;font-weight:bold;font-size:12px;border:1px solid gray;margin:0px' class='roundBorder'>" +
key + key +
" : <font color='cyan'>" + g_pota.parks[key].name + "" + " : <font color='cyan'>" + GT.pota.parks[key].name + "" +
" (<font color='yellow'>" + g_dxccToAltName[Number(g_pota.parks[key].entityId)] + "</font>)" + " (<font color='yellow'>" + GT.dxccToAltName[Number(GT.pota.parks[key].entityId)] + "</font>)" +
"</font></br><font color='lightblue'>" + g_pota.parks[key].locationDesc + "</font></div>"; "</font></br><font color='lightblue'>" + GT.pota.parks[key].locationDesc + "</font></div>";
worker += "<table id='potaSpotsTable' class='darkTable' style='margin: 0 auto;'>"; worker += "<table id='potaSpotsTable' class='darkTable' style='margin: 0 auto;'>";
worker += "<tr><th>Activator</th><th>Spotter</th><th>Freq</th><th>Mode</th><th>Count</th><th>When</th><th>Source</th><th>Comment</th></tr>"; worker += "<tr><th>Activator</th><th>Spotter</th><th>Freq</th><th>Mode</th><th>Count</th><th>When</th><th>Source</th><th>Comment</th></tr>";
for (const i in g_pota.parkSpots[key]) for (const i in GT.pota.parkSpots[key])
{ {
if (validateMapBandAndMode(g_pota.parkSpots[key][i].band, g_pota.parkSpots[key][i].mode)) if (validateMapBandAndMode(GT.pota.parkSpots[key][i].band, GT.pota.parkSpots[key][i].mode))
{ {
worker += "<tr>"; worker += "<tr>";
worker += "<td style='color:yellow'>" + g_pota.parkSpots[key][i].activator + "</td>"; worker += "<td style='color:yellow'>" + GT.pota.parkSpots[key][i].activator + "</td>";
worker += "<td style='color:cyan'>" + ((g_pota.parkSpots[key][i].spotter == g_pota.parkSpots[key][i].activator) ? "Self" : g_pota.parkSpots[key][i].spotter) + "</td>"; worker += "<td style='color:cyan'>" + ((GT.pota.parkSpots[key][i].spotter == GT.pota.parkSpots[key][i].activator) ? "Self" : GT.pota.parkSpots[key][i].spotter) + "</td>";
worker += "<td style='color:lightgreen' >" + g_pota.parkSpots[key][i].frequency.formatMhz(3, 3) + " <font color='yellow'>(" + g_pota.parkSpots[key][i].band + ")</font></td>"; worker += "<td style='color:lightgreen' >" + formatMhz(GT.pota.parkSpots[key][i].frequency, 3, 3) + " <font color='yellow'>(" + GT.pota.parkSpots[key][i].band + ")</font></td>";
worker += "<td style='color:orange'>" + g_pota.parkSpots[key][i].mode + "</td>"; worker += "<td style='color:orange'>" + GT.pota.parkSpots[key][i].mode + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].count + "</td>"; worker += "<td>" + GT.pota.parkSpots[key][i].count + "</td>";
worker += "<td style='color:lightblue' >" + parseInt((now - g_pota.parkSpots[key][i].spotTime) / 1000).toDHMS() + "</td>"; worker += "<td style='color:lightblue' >" + toDHMS(parseInt((now - GT.pota.parkSpots[key][i].spotTime) / 1000)) + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].source + "</td>"; worker += "<td>" + GT.pota.parkSpots[key][i].source + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].comments + "</td>"; worker += "<td>" + GT.pota.parkSpots[key][i].comments + "</td>";
worker += "</tr>"; worker += "</tr>";
} }
} }
worker += "</table>"; worker += "</table>";
/*
buffer += "<div style='background-color:#000;color:#fff;font-size:12px;border:1px solid gray;margin:1px' class='roundBorder'>Activations (scheduled)"
buffer += "<table id='potaScheduleTable' class='darkTable' style='margin: 0 auto;'>";
buffer += "<tr><th>Activator</th><th>Start</th><th>End</th><th>Frequencies</th><th>Comment</th></tr>";
for (const i in g_pota.parkSchedule[key])
{
var start = g_pota.parkSchedule[key][i].start;
var end = g_pota.parkSchedule[key][i].end;
if (now < end)
{
buffer += "<tr>";
buffer += "<td style='color:yellow'>" + g_pota.parkSchedule[key][i].id + "</td>";
buffer += "<td style='color:lightblue'>" + ((now >= start) ? "<font color='white'>Now</font>" : (userTimeString(start) + "</br><font color='lightgreen'>T- " + Number(start - now).msToDHMS() + "</font>")) + "</td>";
buffer += "<td style='color:lightblue'>" + (userTimeString(end) + "</br><font color='orange'>T- " + Number(end - now).msToDHMS() + "</font>") + "</td>";
buffer += "<td style='color:lightgreen'>" + g_pota.parkSchedule[key][i].frequencies + "</td>";
buffer += "<td>" + g_pota.parkSchedule[key][i].comments.substr(0, 40) + "</td>";
buffer += "</tr>";
active++;
}
}
*/
myParktip.innerHTML = worker; myParktip.innerHTML = worker;
return 1;
} }

Wyświetl plik

@ -1,7 +1,7 @@
// GridTracker Copyright © 2023 GridTracker.org // GridTracker Copyright © 2023 GridTracker.org
// All rights reserved. // All rights reserved.
// See LICENSE for more information. // See LICENSE for more information.
var g_proto_bands = [ const g_proto_bands = [
"OOB", "OOB",
"OOB", "OOB",
1, 1,
@ -74,9 +74,8 @@ var g_proto_bands = [
"1.25m" "1.25m"
]; ];
// Incoming is already float fixed ( 14.037 ) for 14,037,000hz // Incoming is already float fixed ( 14.037 ) for 14,037,000hz
Number.prototype.formatBand = function () function formatBand(freq)
{ {
let freq = this;
let newFreq = parseInt(freq); let newFreq = parseInt(freq);
if (newFreq > 0 && newFreq < 226) return g_proto_bands[g_proto_bands.indexOf(newFreq) + 1]; if (newFreq > 0 && newFreq < 226) return g_proto_bands[g_proto_bands.indexOf(newFreq) + 1];
else if (newFreq >= 420 && newFreq <= 450) return "70cm"; else if (newFreq >= 420 && newFreq <= 450) return "70cm";
@ -99,95 +98,53 @@ Number.prototype.formatBand = function ()
else return "OOB"; else return "OOB";
}; };
Number.prototype.formatMhz = function (n, x) function formatMhz(freq, n, x)
{ {
var re = "\\d(?=(\\d{" + (x || 3) + "})+" + (n > 0 ? "\\." : "$") + ")"; let re = "\\d(?=(\\d{" + (x || 3) + "})+" + (n > 0 ? "\\." : "$") + ")";
return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, "g"), "$&."); return freq.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, "g"), "$&.");
}; };
Number.prototype.formatSignalReport = function () function formatSignalReport(val)
{ {
var val = this; let report = String();
var report = String();
if (val >= 0) report = "+" + val; if (val >= 0) report = "+" + val;
else report = val; else report = val;
return report; return report;
}; };
var CALLSIGN_REGEX = /0/g const CALLSIGN_REGEX = /0/g
String.prototype.formatCallsign = function () function formatCallsign(call)
{ {
return this.replace(CALLSIGN_REGEX, "Ø"); return call.replace(CALLSIGN_REGEX, "Ø");
}; };
Number.prototype.toDHMS = function () function toDHMS(inputSeconds)
{ {
var seconds = this; let seconds = inputSeconds;
var days = Math.floor(seconds / (3600 * 24)); let days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24; seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600); let hrs = Math.floor(seconds / 3600);
seconds -= hrs * 3600; seconds -= hrs * 3600;
var mnts = Math.floor(seconds / 60); let mnts = Math.floor(seconds / 60);
seconds -= mnts * 60; seconds -= mnts * 60;
days = days ? days + "d " : ""; days = days ? days + "d " : "";
hrs = hrs ? hrs + "h " : ""; hrs = hrs ? hrs + "h " : "";
mnts = mnts ? mnts + "m " : ""; mnts = mnts ? mnts + "m " : "";
var first = days + hrs + mnts; let first = days + hrs + mnts;
if (first == "") val = seconds + "s"; if (first == "") val = seconds + "s";
else val = first + (seconds > 0 ? seconds + "s" : ""); else val = first + (seconds > 0 ? seconds + "s" : "");
return val; return val;
}; };
Number.prototype.msToDHMS = function () function toDHM(inputSeconds)
{ {
var seconds = parseInt(this / 1000); let seconds = inputSeconds;
var days = Math.floor(seconds / (3600 * 24)); let days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24; seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600); let hrs = Math.floor(seconds / 3600);
seconds -= hrs * 3600; seconds -= hrs * 3600;
var mnts = Math.floor(seconds / 60); let mnts = Math.floor(seconds / 60);
seconds -= mnts * 60;
days = days ? days + "d " : "";
hrs = hrs ? hrs + "h " : "";
mnts = mnts ? mnts + "m " : "";
var first = days + hrs + mnts;
if (first == "") val = seconds + "s";
else val = first + (seconds > 0 ? seconds + "s" : "");
return val;
};
Number.prototype.toDHMS15 = function ()
{
// round to earliest 15 seconds
var seconds = Math.floor(this / 15) * 15;
var days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600);
seconds -= hrs * 3600;
var mnts = Math.floor(seconds / 60);
seconds -= mnts * 60;
days = days ? days + "d " : "";
hrs = hrs ? hrs + "h " : "";
mnts = mnts ? mnts + "m " : "";
var first = days + hrs + mnts;
if (first == "") val = seconds + "s";
else val = first + (seconds > 0 ? seconds + "s" : "");
return val;
};
Number.prototype.toDHM = function ()
{
var seconds = this;
var days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600);
seconds -= hrs * 3600;
var mnts = Math.floor(seconds / 60);
seconds -= mnts * 60; seconds -= mnts * 60;
days = days ? days + "d " : ""; days = days ? days + "d " : "";
@ -199,46 +156,21 @@ Number.prototype.toDHM = function ()
return val; return val;
}; };
Number.prototype.toYM = function () function toYM(input)
{ {
var months = this; let months = input;
var years = parseInt(Math.floor(months / 12)); let years = parseInt(Math.floor(months / 12));
months -= years * 12; months -= years * 12;
months = parseInt(months); months = parseInt(months);
years = years ? years + "y " : ""; years = years ? years + "y " : "";
months = months ? months + "m" : ""; months = months ? months + "m" : "";
var total = years + months; let total = years + months;
return total == "" ? "any" : total; return total == "" ? "any" : total;
}; };
Number.prototype.toHMS = function () function padNumber(number, size)
{ {
var seconds = this; let s = String(number);
var days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600);
seconds -= hrs * 3600;
var mnts = Math.floor(seconds / 60);
seconds -= mnts * 60;
hrs = hrs < 10 ? "0" + hrs : hrs;
mnts = mnts < 10 ? "0" + mnts : mnts;
seconds = seconds < 10 ? "0" + seconds : seconds;
val = hrs + "" + mnts + "" + seconds;
return val;
};
String.prototype.toProperCase = function ()
{
return this.replace(/\w\S*/g, function (txt)
{
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
};
Number.prototype.pad = function (size)
{
var s = String(this);
while (s.length < (size || 2)) while (s.length < (size || 2))
{ {
s = "0" + s; s = "0" + s;
@ -246,7 +178,15 @@ Number.prototype.pad = function (size)
return s; return s;
}; };
String.prototype.replaceAll = function (str1, str2) function replaceAll(input, str1, str2)
{ {
return this.split(str1).join(str2); return input.split(str1).join(str2);
};
function toProperCase(text)
{
return text.replace(/\w\S*/g, function (txt)
{
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}; };

Plik diff jest za duży Load Diff

Wyświetl plik

@ -3,7 +3,7 @@ function prepareRosterSettings()
let rosterSettings = { let rosterSettings = {
bands: {}, bands: {},
modes: {}, modes: {},
callMode: g_rosterSettings.callsign, callMode: CR.rosterSettings.callsign,
onlyHits: false, onlyHits: false,
isAwardTracker: false, isAwardTracker: false,
now: timeNowSec() now: timeNowSec()
@ -19,24 +19,24 @@ function prepareRosterSettings()
rosterSettings.callMode = "all"; rosterSettings.callMode = "all";
rosterSettings.onlyHits = false; rosterSettings.onlyHits = false;
rosterSettings.isAwardTracker = true; rosterSettings.isAwardTracker = true;
g_rosterSettings.huntNeed = "confirmed"; CR.rosterSettings.huntNeed = "confirmed";
} }
// this appears to be determine if we should show the OAMS column // this appears to be determine if we should show the OAMS column
// if the user is not in offline mode and has OAMS enabled, this could // if the user is not in offline mode and has OAMS enabled, this could
// be it's own function maybe? // be it's own function maybe?
rosterSettings.canMsg = rosterSettings.canMsg =
window.opener.g_mapSettings.offlineMode == false && window.opener.GT.mapSettings.offlineMode == false &&
window.opener.g_appSettings.gtShareEnable == true && window.opener.GT.appSettings.gtShareEnable == true &&
window.opener.g_appSettings.gtMsgEnable == true; window.opener.GT.appSettings.gtMsgEnable == true;
// The following 3 sections deal with QSLing, do we break them out // The following 3 sections deal with QSLing, do we break them out
// individually or lump them into a qslUser function that sets // individually or lump them into a qslUser function that sets
// all three at the same time? // all three at the same time?
// this section is for LoTW users, can be a function // this section is for LoTW users, can be a function
if (window.opener.g_callsignLookups.lotwUseEnable == true) if (window.opener.GT.callsignLookups.lotwUseEnable == true)
{ {
usesLoTWDiv.style.display = ""; usesLoTWDiv.style.display = "";
if (g_rosterSettings.usesLoTW == true) if (CR.rosterSettings.usesLoTW == true)
{ {
maxLoTW.style.display = ""; maxLoTW.style.display = "";
maxLoTWView.style.display = ""; maxLoTWView.style.display = "";
@ -54,22 +54,22 @@ function prepareRosterSettings()
maxLoTWView.style.display = "none"; maxLoTWView.style.display = "none";
} }
if (g_rosterSettings.huntNeed == "mixed") if (CR.rosterSettings.huntNeed == "mixed")
{ {
rosterSettings.huntIndex = g_confirmed; rosterSettings.huntIndex = CR.confirmed;
rosterSettings.workedIndex = g_worked; rosterSettings.workedIndex = CR.worked;
rosterSettings.layeredMode = LAYERED_MODE_FOR[String(g_rosterSettings.reference)]; rosterSettings.layeredMode = LAYERED_MODE_FOR[String(CR.rosterSettings.reference)];
} }
else if (g_rosterSettings.huntNeed == "worked") else if (CR.rosterSettings.huntNeed == "worked")
{ {
rosterSettings.huntIndex = g_worked; rosterSettings.huntIndex = CR.worked;
rosterSettings.workedIndex = false; rosterSettings.workedIndex = false;
rosterSettings.layeredMode = false; rosterSettings.layeredMode = false;
} }
else if (g_rosterSettings.huntNeed == "confirmed") else if (CR.rosterSettings.huntNeed == "confirmed")
{ {
rosterSettings.huntIndex = g_confirmed; rosterSettings.huntIndex = CR.confirmed;
rosterSettings.workedIndex = g_worked; rosterSettings.workedIndex = CR.worked;
rosterSettings.layeredMode = false; rosterSettings.layeredMode = false;
} }
else else

Wyświetl plik

@ -24,9 +24,9 @@ function processRosterFiltering(callRoster, rosterSettings)
// this whole section is full of individual if's that could be broken out // this whole section is full of individual if's that could be broken out
for (const callHash in callRoster) for (const callHash in callRoster)
{ {
var entry = callRoster[callHash]; let entry = callRoster[callHash];
var callObj = entry.callObj; let callObj = entry.callObj;
var call = entry.DEcall; let call = entry.DEcall;
entry.tx = true; entry.tx = true;
callObj.shouldAlert = false; callObj.shouldAlert = false;
@ -40,7 +40,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
if (rosterSettings.now - callObj.age > g_rosterSettings.rosterTime) if (rosterSettings.now - callObj.age > CR.rosterSettings.rosterTime)
{ {
entry.tx = false; entry.tx = false;
entry.alerted = false; entry.alerted = false;
@ -53,44 +53,44 @@ function processRosterFiltering(callRoster, rosterSettings)
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.noUnknownDXCC && callObj.dxcc === -1) if (CR.rosterSettings.noUnknownDXCC && callObj.dxcc === -1)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (window.opener.g_instances[callObj.instance].crEnable == false) if (window.opener.GT.instances[callObj.instance].crEnable == false)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (call in g_blockedCalls) if (call in CR.blockedCalls)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (entry.DXcall + " from All" in g_blockedCQ || entry.DXcall + " from " + window.opener.g_dxccToAltName[callObj.dxcc] in g_blockedCQ) if (entry.DXcall + " from All" in CR.blockedCQ || entry.DXcall + " from " + window.opener.GT.dxccToAltName[callObj.dxcc] in CR.blockedCQ)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (callObj.ituz in g_blockedITUz) if (callObj.ituz in CR.blockedITUz)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (callObj.cqz in g_blockedCQz) if (callObj.cqz in CR.blockedCQz)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (callObj.dxcc in g_blockedDxcc) if (callObj.dxcc in CR.blockedDxcc)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.cqOnly == true) if (CR.rosterSettings.cqOnly == true)
{ {
if (g_rosterSettings.wantRRCQ) if (CR.rosterSettings.wantRRCQ)
{ {
if (callObj.RR73 == false && callObj.CQ == false) if (callObj.RR73 == false && callObj.CQ == false)
{ {
@ -104,10 +104,9 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
} }
if (g_rosterSettings.useRegex && g_rosterSettings.callsignRegex.length > 0) if (CR.rosterSettings.useRegex && CR.rosterSettings.callsignRegex.length > 0)
{ {
var regexObj = regexObj || new RegExp(g_rosterSettings.callsignRegex, "i") var regexObj = regexObj || new RegExp(CR.rosterSettings.callsignRegex, "i")
try try
{ {
if (!call.match(regexObj)) if (!call.match(regexObj))
@ -118,37 +117,37 @@ function processRosterFiltering(callRoster, rosterSettings)
} }
catch (e) {} catch (e) {}
} }
if (g_rosterSettings.requireGrid == true && callObj.grid.length != 4) if (CR.rosterSettings.requireGrid == true && callObj.grid.length != 4)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.wantMinDB == true && entry.message.SR < g_rosterSettings.minDb) if (CR.rosterSettings.wantMinDB == true && entry.message.SR < CR.rosterSettings.minDb)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.wantMaxDT == true && Math.abs(entry.message.DT) > g_rosterSettings.maxDT) if (CR.rosterSettings.wantMaxDT == true && Math.abs(entry.message.DT) > CR.rosterSettings.maxDT)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.wantMinFreq == true && entry.message.DF < g_rosterSettings.minFreq) if (CR.rosterSettings.wantMinFreq == true && entry.message.DF < CR.rosterSettings.minFreq)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.wantMaxFreq == true && entry.message.DF > g_rosterSettings.maxFreq) if (CR.rosterSettings.wantMaxFreq == true && entry.message.DF > CR.rosterSettings.maxFreq)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.noMsg == true) if (CR.rosterSettings.noMsg == true)
{ {
try try
{ {
if (callObj.msg.match(g_rosterSettings.noMsgValue)) if (callObj.msg.match(CR.rosterSettings.noMsgValue))
{ {
entry.tx = false; entry.tx = false;
continue; continue;
@ -156,11 +155,11 @@ function processRosterFiltering(callRoster, rosterSettings)
} }
catch (e) {} catch (e) {}
} }
if (g_rosterSettings.onlyMsg == true) if (CR.rosterSettings.onlyMsg == true)
{ {
try try
{ {
if (!callObj.msg.match(g_rosterSettings.onlyMsgValue)) if (!callObj.msg.match(CR.rosterSettings.onlyMsgValue))
{ {
entry.tx = false; entry.tx = false;
continue; continue;
@ -169,31 +168,31 @@ function processRosterFiltering(callRoster, rosterSettings)
catch (e) {} catch (e) {}
} }
if (callObj.dxcc == window.opener.g_myDXCC) if (callObj.dxcc == window.opener.GT.myDXCC)
{ {
if (g_rosterSettings.noMyDxcc == true) if (CR.rosterSettings.noMyDxcc == true)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
} }
else if (g_rosterSettings.onlyMyDxcc == true) else if (CR.rosterSettings.onlyMyDxcc == true)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (window.opener.g_callsignLookups.lotwUseEnable == true && g_rosterSettings.usesLoTW == true) if (window.opener.GT.callsignLookups.lotwUseEnable == true && CR.rosterSettings.usesLoTW == true)
{ {
if (!(call in window.opener.g_lotwCallsigns)) if (!(call in window.opener.GT.lotwCallsigns))
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.maxLoTW < 27) if (CR.rosterSettings.maxLoTW < 27)
{ {
var months = (g_day - window.opener.g_lotwCallsigns[call]) / 30; let months = (CR.day - window.opener.GT.lotwCallsigns[call]) / 30;
if (months > g_rosterSettings.maxLoTW) if (months > CR.rosterSettings.maxLoTW)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
@ -201,18 +200,18 @@ function processRosterFiltering(callRoster, rosterSettings)
} }
} }
if (window.opener.g_callsignLookups.eqslUseEnable == true && g_rosterSettings.useseQSL == true) if (window.opener.GT.callsignLookups.eqslUseEnable == true && CR.rosterSettings.useseQSL == true)
{ {
if (!(call in window.opener.g_eqslCallsigns)) if (!(call in window.opener.GT.eqslCallsigns))
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
} }
if (window.opener.g_callsignLookups.oqrsUseEnable == true && g_rosterSettings.usesOQRS == true) if (window.opener.GT.callsignLookups.oqrsUseEnable == true && CR.rosterSettings.usesOQRS == true)
{ {
if (!(call in window.opener.g_oqrsCallsigns)) if (!(call in window.opener.GT.oqrsCallsigns))
{ {
entry.tx = false; entry.tx = false;
continue; continue;
@ -221,28 +220,28 @@ function processRosterFiltering(callRoster, rosterSettings)
if (rosterSettings.callMode != "all") if (rosterSettings.callMode != "all")
{ {
if (entry.DXcall == "CQ DX" && callObj.dxcc == window.opener.g_myDXCC) if (entry.DXcall == "CQ DX" && callObj.dxcc == window.opener.GT.myDXCC)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
var hash = hashMaker(call, callObj, g_rosterSettings.reference); let hash = hashMaker(call, callObj, CR.rosterSettings.reference);
if (rosterSettings.callMode == "worked" && hash in g_worked.call) if (rosterSettings.callMode == "worked" && hash in CR.worked.call)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (rosterSettings.callMode == "confirmed" && hash in g_confirmed.call) if (rosterSettings.callMode == "confirmed" && hash in CR.confirmed.call)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (g_rosterSettings.hunting == "grid") if (CR.rosterSettings.hunting == "grid")
{ {
var hash = hashMaker(callObj.grid.substr(0, 4), let hash = hashMaker(callObj.grid.substr(0, 4),
callObj, g_rosterSettings.reference); callObj, CR.rosterSettings.reference);
if (rosterSettings.huntIndex && hash in rosterSettings.huntIndex.grid) if (rosterSettings.huntIndex && hash in rosterSettings.huntIndex.grid)
{ {
entry.tx = false; entry.tx = false;
@ -255,9 +254,9 @@ function processRosterFiltering(callRoster, rosterSettings)
} }
continue; continue;
} }
if (g_rosterSettings.hunting == "dxcc") if (CR.rosterSettings.hunting == "dxcc")
{ {
let hash = hashMaker(String(callObj.dxcc) + "|", callObj, g_rosterSettings.reference); let hash = hashMaker(String(callObj.dxcc) + "|", callObj, CR.rosterSettings.reference);
if (rosterSettings.huntIndex && (hash in rosterSettings.huntIndex.dxcc)) if (rosterSettings.huntIndex && (hash in rosterSettings.huntIndex.dxcc))
{ {
@ -267,24 +266,24 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
if (g_rosterSettings.hunting == "dxccs" && r_currentDXCCs != -1) if (CR.rosterSettings.hunting == "dxccs" && CR.currentDXCCs != -1)
{ {
if (callObj.dxcc != r_currentDXCCs) if (callObj.dxcc != CR.currentDXCCs)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
} }
if (g_rosterSettings.hunting == "wpx") if (CR.rosterSettings.hunting == "wpx")
{ {
if (String(callObj.px) == null) if (String(callObj.px) == null)
{ {
entry.tx = false; entry.tx = false;
continue; continue;
} }
var hash = hashMaker(String(callObj.px), let hash = hashMaker(String(callObj.px),
callObj, g_rosterSettings.reference); callObj, CR.rosterSettings.reference);
if (rosterSettings.huntIndex && (hash in rosterSettings.huntIndex.px)) if (rosterSettings.huntIndex && (hash in rosterSettings.huntIndex.px))
{ {
@ -295,7 +294,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
if (g_rosterSettings.hunting == "cq") if (CR.rosterSettings.hunting == "cq")
{ {
if (callObj.cqz == null || !rosterSettings.huntIndex) if (callObj.cqz == null || !rosterSettings.huntIndex)
{ {
@ -303,7 +302,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
var hash = hashMaker(callObj.cqz + "|", callObj, g_rosterSettings.reference); let hash = hashMaker(callObj.cqz + "|", callObj, CR.rosterSettings.reference);
if (hash in rosterSettings.huntIndex.cqz) if (hash in rosterSettings.huntIndex.cqz)
{ {
@ -314,7 +313,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
if (g_rosterSettings.hunting == "itu") if (CR.rosterSettings.hunting == "itu")
{ {
if (callObj.ituz == null || !rosterSettings.huntIndex) if (callObj.ituz == null || !rosterSettings.huntIndex)
{ {
@ -322,7 +321,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
var hash = hashMaker(callObj.ituz + "|", callObj, g_rosterSettings.reference); let hash = hashMaker(callObj.ituz + "|", callObj, CR.rosterSettings.reference);
if (hash in rosterSettings.huntIndex.ituz) if (hash in rosterSettings.huntIndex.ituz)
{ {
@ -333,15 +332,15 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
if (g_rosterSettings.hunting == "usstates" && window.opener.g_callsignLookups.ulsUseEnable == true) if (CR.rosterSettings.hunting == "usstates" && window.opener.GT.callsignLookups.ulsUseEnable == true)
{ {
var state = callObj.state; let state = callObj.state;
var finalDxcc = callObj.dxcc; let finalDxcc = callObj.dxcc;
if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6) if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6)
{ {
if (state in window.opener.g_StateData) if (state in window.opener.GT.StateData)
{ {
var hash = hashMaker(state, callObj, g_rosterSettings.reference); let hash = hashMaker(state, callObj, CR.rosterSettings.reference);
if (rosterSettings.huntIndex && hash in rosterSettings.huntIndex.state) if (rosterSettings.huntIndex && hash in rosterSettings.huntIndex.state)
{ {
@ -356,9 +355,9 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
if (g_rosterSettings.hunting == "usstate" && g_currentUSCallsigns) if (CR.rosterSettings.hunting == "usstate" && CR.currentUSCallsigns)
{ {
if (call in g_currentUSCallsigns) if (call in CR.currentUSCallsigns)
{ {
// Do Nothing // Do Nothing
} }
@ -373,26 +372,26 @@ function processRosterFiltering(callRoster, rosterSettings)
if (rosterSettings.isAwardTracker) if (rosterSettings.isAwardTracker)
{ {
var tx = false; let tx = false;
var baseHash = hashMaker("", callObj, g_rosterSettings.reference); let baseHash = hashMaker("", callObj, CR.rosterSettings.reference);
for (const award in g_awardTracker) for (const award in CR.awardTracker)
{ {
if (g_awardTracker[award].enable) if (CR.awardTracker[award].enable)
{ {
tx = testAward(award, callObj, baseHash); tx = testAward(award, callObj, baseHash);
if (tx) if (tx)
{ {
var x = g_awardTracker[award]; let x = CR.awardTracker[award];
// TODO: Move award reason out of exclusions code? // TODO: Move award reason out of exclusions code?
callObj.awardReason = g_awards[x.sponsor].awards[x.name].tooltip + " (" + g_awards[x.sponsor].sponsor + ")"; callObj.awardReason = CR.awards[x.sponsor].awards[x.name].tooltip + " (" + CR.awards[x.sponsor].sponsor + ")";
callObj.shouldAlert = true; callObj.shouldAlert = true;
break; break;
} }
} }
} }
let didWork = (baseHash in g_worked.call); let didWork = (baseHash in CR.worked.call);
if (allOnlyNew.checked && didWork && !callObj.qrz) if (allOnlyNew.checked && didWork && !callObj.qrz)
{ {
callObj.shouldAlert = false; callObj.shouldAlert = false;

Wyświetl plik

@ -15,7 +15,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const currentYearSuffix = `&rsquo;${currentYear - 2000}`; const currentYearSuffix = `&rsquo;${currentYear - 2000}`;
const potaEnabled = (window.opener.g_appSettings.potaEnabled === 1); const potaEnabled = (window.opener.GT.appSettings.potaEnabled === 1);
// TODO: Hunting results might be used to filter, based on the "Callsigns: Only Wanted" option, // TODO: Hunting results might be used to filter, based on the "Callsigns: Only Wanted" option,
// so maybe we can move this loop first, and add a check to the filtering loop? // so maybe we can move this loop first, and add a check to the filtering loop?
@ -29,14 +29,14 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
if (callObj.qrz == true && entry.tx == false) if (callObj.qrz == true && entry.tx == false)
{ {
// The instance has to be enabled // The instance has to be enabled
if (window.opener.g_instances[callObj.instance].crEnable == true) if (window.opener.GT.instances[callObj.instance].crEnable == true)
{ {
// Calling us, but we wouldn't normally display // Calling us, but we wouldn't normally display
// If they are not ignored or we're in a QSO with them, let it through // If they are not ignored or we're in a QSO with them, let it through
// TODO: This is here because it's after the filtering stage // TODO: This is here because it's after the filtering stage
if ((!(entry.DEcall in g_blockedCalls) && !(callObj.dxcc in g_blockedDxcc)) || if ((!(entry.DEcall in CR.blockedCalls) && !(callObj.dxcc in CR.blockedDxcc)) ||
window.opener.g_instances[callObj.instance].status.DXcall == entry.DEcall) window.opener.GT.instances[callObj.instance].status.DXcall == entry.DEcall)
{ {
entry.tx = true; entry.tx = true;
} }
@ -52,11 +52,11 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
if (rosterSettings.layeredMode) if (rosterSettings.layeredMode)
{ {
workHashSuffix = hashMaker("", callObj, rosterSettings.layeredMode); workHashSuffix = hashMaker("", callObj, rosterSettings.layeredMode);
layeredHashSuffix = hashMaker("", callObj, g_rosterSettings.reference); layeredHashSuffix = hashMaker("", callObj, CR.rosterSettings.reference);
} }
else else
{ {
workHashSuffix = hashMaker("", callObj, g_rosterSettings.reference); workHashSuffix = hashMaker("", callObj, CR.rosterSettings.reference);
layeredHashSuffix = false layeredHashSuffix = false
} }
let workHash = workHashSuffix; // TODO: Remove after replacing all occurrences with Suffix let workHash = workHashSuffix; // TODO: Remove after replacing all occurrences with Suffix
@ -102,13 +102,13 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
let layeredHash = layeredHashSuffix && (callsign + layeredHashSuffix) let layeredHash = layeredHashSuffix && (callsign + layeredHashSuffix)
// Call worked in current logbook settings, regardless of hunting mode // Call worked in current logbook settings, regardless of hunting mode
if (hash in g_worked.call) if (hash in CR.worked.call)
{ {
callObj.callFlags.worked = true; callObj.callFlags.worked = true;
didWork = true; didWork = true;
callConf = `${unconf}${call}${inversionAlpha};`; callConf = `${unconf}${call}${inversionAlpha};`;
if (hash in g_confirmed.call) if (hash in CR.confirmed.call)
{ {
callObj.callFlags.confirmed = true; callObj.callFlags.confirmed = true;
callPointer = "text-decoration: line-through; "; callPointer = "text-decoration: line-through; ";
@ -117,12 +117,12 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
} }
// Calls that have OAMS chat support // Calls that have OAMS chat support
if (callsign in window.opener.g_gtCallsigns) if (callsign in window.opener.GT.gtCallsigns)
{ {
callObj.gt = 0; callObj.gt = 0;
for (const cid in window.opener.g_gtCallsigns[callsign]) for (const cid in window.opener.GT.gtCallsigns[callsign])
{ {
if (cid in window.opener.g_gtFlagPins && window.opener.g_gtFlagPins[cid].canmsg == true) if (cid in window.opener.GT.gtFlagPins && window.opener.GT.gtFlagPins[cid].canmsg == true)
{ {
// found the first one we can message, break now // found the first one we can message, break now
callObj.callFlags.oams = true; callObj.callFlags.oams = true;
@ -157,9 +157,9 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
} }
// Entries currently calling or being called by us // Entries currently calling or being called by us
if (callObj.DEcall == window.opener.g_instances[callObj.instance].status.DXcall) if (callObj.DEcall == window.opener.GT.instances[callObj.instance].status.DXcall)
{ {
if (window.opener.g_instances[callObj.instance].status.TxEnabled == 1) if (window.opener.GT.instances[callObj.instance].status.TxEnabled == 1)
{ {
callObj.hunting.call = "calling"; callObj.hunting.call = "calling";
callObj.style.call = "class='dxCalling'"; callObj.style.call = "class='dxCalling'";
@ -182,7 +182,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
px: false, px: false,
cont: false cont: false
}; };
if (g_rosterSettings.reference == LOGBOOK_AWARD_TRACKER) if (CR.rosterSettings.reference == LOGBOOK_AWARD_TRACKER)
{ {
for (let key in awardTracker) for (let key in awardTracker)
{ {
@ -252,9 +252,9 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
} }
} }
if (huntRegex.checked == true && g_rosterSettings.huntRegexValue.length > 0) if (huntRegex.checked == true && CR.rosterSettings.huntRegexValue.length > 0)
{ {
var huntRegexObj = huntRegexObj || new RegExp(g_rosterSettings.huntRegexValue, "gi") var huntRegexObj = huntRegexObj || new RegExp(CR.rosterSettings.huntRegexValue, "gi")
try try
{ {
if (callsign.match(huntRegexObj)) if (callsign.match(huntRegexObj))
@ -410,13 +410,13 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
} }
// Hunting for US States // Hunting for US States
if ((huntState.checked || awardTrackerOverrides.states) && window.opener.g_callsignLookups.ulsUseEnable == true) if ((huntState.checked || awardTrackerOverrides.states) && window.opener.GT.callsignLookups.ulsUseEnable == true)
{ {
let stateSearch = callObj.state; let stateSearch = callObj.state;
let finalDxcc = callObj.dxcc; let finalDxcc = callObj.dxcc;
if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6) if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6)
{ {
if (stateSearch in window.opener.g_StateData) if (stateSearch in window.opener.GT.StateData)
{ {
let hash = stateSearch + workHashSuffix; let hash = stateSearch + workHashSuffix;
let layeredHash = rosterSettings.layeredMode && (stateSearch + layeredHashSuffix) let layeredHash = rosterSettings.layeredMode && (stateSearch + layeredHashSuffix)
@ -467,7 +467,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
} }
// Hunting for US Counties // Hunting for US Counties
if ((huntCounty.checked || awardTrackerOverrides.cnty) && window.opener.g_callsignLookups.ulsUseEnable == true) if ((huntCounty.checked || awardTrackerOverrides.cnty) && window.opener.GT.callsignLookups.ulsUseEnable == true)
{ {
let finalDxcc = callObj.dxcc; let finalDxcc = callObj.dxcc;
if ( if (
@ -482,7 +482,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
{ {
if (callObj.qual == false) if (callObj.qual == false)
{ {
let counties = window.opener.g_zipToCounty[callObj.zipcode]; let counties = window.opener.GT.zipToCounty[callObj.zipcode];
let foundHit = false; let foundHit = false;
for (const cnt in counties) for (const cnt in counties)
{ {
@ -527,7 +527,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
let huntTotal = 1; let huntTotal = 1;
let workedFound = 0; let workedFound = 0;
let hash = g_dayAsString + callsign + callObj.pota + (rosterSettings.layeredMode ? layeredHashSuffix : workHashSuffix); let hash = CR.dayAsString + callsign + callObj.pota + (rosterSettings.layeredMode ? layeredHashSuffix : workHashSuffix);
if (rosterSettings.workedIndex && hash in rosterSettings.workedIndex.pota) workedFound++; if (rosterSettings.workedIndex && hash in rosterSettings.workedIndex.pota) workedFound++;
@ -782,12 +782,12 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
callingBg = "#0000FF" + inversionAlpha; callingBg = "#0000FF" + inversionAlpha;
calling = "#FFFF00;text-shadow: 0px 0px 2px #FFFF00"; calling = "#FFFF00;text-shadow: 0px 0px 2px #FFFF00";
} }
else if ((callObj.CQ == true || (g_rosterSettings.wantRRCQ && callObj.RR73 == true)) && !g_rosterSettings.cqOnly) else if ((callObj.CQ == true || (CR.rosterSettings.wantRRCQ && callObj.RR73 == true)) && !CR.rosterSettings.cqOnly)
{ {
callingBg = calling + inversionAlpha; callingBg = calling + inversionAlpha;
calling = bold; calling = bold;
// If treating RR73/73 as CQ, soften highlighting to help differentiate foreshadow from an actual CQ // If treating RR73/73 as CQ, soften highlighting to help differentiate foreshadow from an actual CQ
if (g_rosterSettings.wantRRCQ && callObj.RR73 == true) if (CR.rosterSettings.wantRRCQ && callObj.RR73 == true)
{ {
callingConf = `${unconf}#90EE90${inversionAlpha};`; callingConf = `${unconf}#90EE90${inversionAlpha};`;
calling = `#90EE90${inversionAlpha};` calling = `#90EE90${inversionAlpha};`
@ -822,7 +822,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
callObj.style = colorObject; callObj.style = colorObject;
if (g_rosterSettings.columns.Spot) if (CR.rosterSettings.columns.Spot)
{ {
callObj.spot = window.opener.getSpotTime(callObj.DEcall + callObj.mode + callObj.band + callObj.grid); callObj.spot = window.opener.getSpotTime(callObj.DEcall + callObj.mode + callObj.band + callObj.grid);
if (callObj.spot == null) if (callObj.spot == null)

Wyświetl plik

@ -1,27 +1,27 @@
// Because the County is clickable we do not allow the whole compact div to trigger an initiateQSO // Because the County is clickable we do not allow the whole compact div to trigger an initiateQSO
g_isCompactCounty = false; CR.isCompactCounty = false;
function renderCompactRosterHeaders() function renderCompactRosterHeaders()
{ {
g_isCompactCounty = (g_rosterSettings.compactEntity == "County"); CR.isCompactCounty = (CR.rosterSettings.compactEntity == "County");
return "<div id=\"buttonsDiv\" style=\"margin-left:0px;white-space:normal;\" onmouseenter='rosterInFocus()' onmouseleave='rosterNoFocus()'>"; return "<div id=\"buttonsDiv\" style=\"margin-left:0px;white-space:normal;\" onmouseenter='rosterInFocus()' onmouseleave='rosterNoFocus()'>";
} }
function renderCompactRosterRow(callObj, showBand) function renderCompactRosterRow(callObj, showBand)
{ {
var title = callObj.RSTsent + "&#13256;, " + parseInt(callObj.dt * 100) + "ms, " + callObj.delta + "hz" + (callObj.grid.length ? ", " + callObj.grid : "") + ", " + (timeNowSec() - callObj.age).toDHMS(); let title = callObj.RSTsent + "&#13256;, " + parseInt(callObj.dt * 100) + "ms, " + callObj.delta + "hz" + (callObj.grid.length ? ", " + callObj.grid : "") + ", " + toDHMS(timeNowSec() - callObj.age);
var bandView = showBand ? "<div style='color: #" + window.opener.g_pskColors[callObj.band] + ";float:right;display:inline-block;'>" + callObj.band + "</div>" : ""; let bandView = showBand ? "<div style='color: #" + window.opener.GT.pskColors[callObj.band] + ";float:right;display:inline-block;'>" + callObj.band + "</div>" : "";
if (g_rosterSettings.compactEntity == "Band") if (CR.rosterSettings.compactEntity == "Band")
{ {
bandView = ""; bandView = "";
} }
var onClick = " onClick='initiateQso(\"" + callObj.hash + "\")' id='" + callObj.hash + "' title='" + title + "' "; let onClick = " onClick='initiateQso(\"" + callObj.hash + "\")' id='" + callObj.hash + "' title='" + title + "' ";
var wholeClick = (g_isCompactCounty ? "" : onClick); let wholeClick = (CR.isCompactCounty ? "" : onClick);
var callsignClick = (g_isCompactCounty ? onClick : ""); let callsignClick = (CR.isCompactCounty ? onClick : "");
var worker = "<div class='compact' " + wholeClick + " >"; let worker = "<div class='compact' " + wholeClick + " >";
worker += "<div class='compactCallsign' " + callsignClick + " name='Callsign' " + callObj.style.call + " >" + callObj.DEcall.formatCallsign() + bandView + "</div>"; worker += "<div class='compactCallsign' " + callsignClick + " name='Callsign' " + callObj.style.call + " >" + formatCallsign(callObj.DEcall) + bandView + "</div>";
worker += "<div class='compactData'>"; worker += "<div class='compactData'>";
worker += renderEntryForColumn(g_rosterSettings.compactEntity, callObj, "div"); worker += renderEntryForColumn(CR.rosterSettings.compactEntity, callObj, "div");
worker += "</div></div>"; worker += "</div></div>";
return worker; return worker;
} }

Wyświetl plik

@ -4,7 +4,7 @@ function renderRoster(callRoster, rosterSettings)
Callsign: true Callsign: true
} }
if (window.opener.g_callsignLookups.eqslUseEnable == true) if (window.opener.GT.callsignLookups.eqslUseEnable == true)
{ {
useseQSLDiv.style.display = ""; useseQSLDiv.style.display = "";
} }
@ -14,7 +14,7 @@ function renderRoster(callRoster, rosterSettings)
useseQSLDiv.style.display = "none"; useseQSLDiv.style.display = "none";
} }
if (window.opener.g_callsignLookups.oqrsUseEnable == true) if (window.opener.GT.callsignLookups.oqrsUseEnable == true)
{ {
usesOQRSDiv.style.display = ""; usesOQRSDiv.style.display = "";
} }
@ -24,7 +24,7 @@ function renderRoster(callRoster, rosterSettings)
usesOQRSDiv.style.display = "none"; usesOQRSDiv.style.display = "none";
} }
if (window.opener.g_callsignLookups.lotwUseEnable == true) if (window.opener.GT.callsignLookups.lotwUseEnable == true)
{ {
// Do nothing // Do nothing
} }
@ -43,7 +43,7 @@ function renderRoster(callRoster, rosterSettings)
columnOverrides.OAMS = false; columnOverrides.OAMS = false;
} }
if (window.opener.g_appSettings.potaEnabled === 1) if (window.opener.GT.appSettings.potaEnabled === 1)
{ {
huntingMatrixPotaDiv.style.display = ""; huntingMatrixPotaDiv.style.display = "";
} }
@ -58,7 +58,7 @@ function renderRoster(callRoster, rosterSettings)
columnOverrides.Wanted = true; columnOverrides.Wanted = true;
} }
// dealing with spots // dealing with spots
if (g_rosterSettings.columns.Spot == true) onlySpotDiv.style.display = ""; if (CR.rosterSettings.columns.Spot == true) onlySpotDiv.style.display = "";
else onlySpotDiv.style.display = "none"; else onlySpotDiv.style.display = "none";
// callmode (all or only new) // callmode (all or only new)
@ -104,23 +104,23 @@ function renderRoster(callRoster, rosterSettings)
multiInstance = true; multiInstance = true;
} }
let multiBand = Object.keys(rosterSettings.bands).length > 1; let multiBand = Object.keys(rosterSettings.bands).length > 1;
let showBands = multiBand || g_rosterSettings.columns.Band; let showBands = multiBand || CR.rosterSettings.columns.Band;
let showModes = (Object.keys(rosterSettings.modes).length > 1) || g_rosterSettings.columns.Mode; let showModes = (Object.keys(rosterSettings.modes).length > 1) || CR.rosterSettings.columns.Mode;
columnOverrides.Band = showBands; columnOverrides.Band = showBands;
columnOverrides.Mode = showModes; columnOverrides.Mode = showModes;
const rosterColumns = rosterColumnList(g_rosterSettings.columns, columnOverrides); const rosterColumns = rosterColumnList(CR.rosterSettings.columns, columnOverrides);
if (g_rosterSettings.compact) if (CR.rosterSettings.compact)
{ {
sortCallList(visibleCallList, "Age", false, rosterColumns); sortCallList(visibleCallList, "Age", false, rosterColumns);
} }
else else
{ {
sortCallList(visibleCallList, g_rosterSettings.sortColumn, g_rosterSettings.sortReverse); sortCallList(visibleCallList, CR.rosterSettings.sortColumn, CR.rosterSettings.sortReverse);
} }
let worker = g_rosterSettings.compact ? renderCompactRosterHeaders() : renderNormalRosterHeaders(rosterColumns); let worker = CR.rosterSettings.compact ? renderCompactRosterHeaders() : renderNormalRosterHeaders(rosterColumns);
// Third loop: render all rows // Third loop: render all rows
for (let x in visibleCallList) for (let x in visibleCallList)
@ -133,9 +133,9 @@ function renderRoster(callRoster, rosterSettings)
if (callObj.DEcall.match("^[KNW][0-9][A-W|Y|Z](/w+)?$")) if (callObj.DEcall.match("^[KNW][0-9][A-W|Y|Z](/w+)?$"))
{ callObj.style.call = "class='oneByOne'"; } { callObj.style.call = "class='oneByOne'"; }
if (callObj.DEcall == window.opener.g_instances[callObj.instance].status.DXcall) if (callObj.DEcall == window.opener.GT.instances[callObj.instance].status.DXcall)
{ {
if (window.opener.g_instances[callObj.instance].status.TxEnabled == 1) if (window.opener.GT.instances[callObj.instance].status.TxEnabled == 1)
{ {
callObj.style.call = "class='dxCalling'"; callObj.style.call = "class='dxCalling'";
} }
@ -145,10 +145,10 @@ function renderRoster(callRoster, rosterSettings)
} }
} }
worker += g_rosterSettings.compact ? renderCompactRosterRow(callObj, multiInstance || multiBand) : renderNormalRosterRow(rosterColumns, callObj); worker += CR.rosterSettings.compact ? renderCompactRosterRow(callObj, multiInstance || multiBand) : renderNormalRosterRow(rosterColumns, callObj);
} }
worker += g_rosterSettings.compact ? renderCompactRosterFooter() : renderNormalRosterFooter(); worker += CR.rosterSettings.compact ? renderCompactRosterFooter() : renderNormalRosterFooter();
RosterTable.innerHTML = worker; RosterTable.innerHTML = worker;
} }

Wyświetl plik

@ -1,6 +1,6 @@
function rosterColumnList(settings = {}, overrides = {}) function rosterColumnList(settings = {}, overrides = {})
{ {
return g_rosterSettings.columnOrder.filter(column => return CR.rosterSettings.columnOrder.filter(column =>
{ {
return column && (settings[column] || overrides[column]) && !(overrides[column] === false) return column && (settings[column] || overrides[column]) && !(overrides[column] === false)
}) })
@ -21,9 +21,9 @@ function renderHeaderForColumn(column)
attrs.onClick = `setRosterSorting('${column}');` attrs.onClick = `setRosterSorting('${column}');`
} }
if (g_rosterSettings.sortColumn == column) if (CR.rosterSettings.sortColumn == column)
{ {
attrs.html += "<div style='display:inline-block;margin:0px;padding:0px;'>&nbsp;" + (g_rosterSettings.sortReverse == false ? "▲" : "▼") + "</div>"; attrs.html += "<div style='display:inline-block;margin:0px;padding:0px;'>&nbsp;" + (CR.rosterSettings.sortReverse == false ? "▲" : "▼") + "</div>";
} }
return renderRosterTableHTML("th", attrs) return renderRosterTableHTML("th", attrs)
@ -53,14 +53,14 @@ function renderRosterTableHTML(tag, attrs)
function setRosterSorting(column) function setRosterSorting(column)
{ {
if (g_rosterSettings.sortColumn === column) if (CR.rosterSettings.sortColumn === column)
{ {
g_rosterSettings.sortReverse = !g_rosterSettings.sortReverse CR.rosterSettings.sortReverse = !CR.rosterSettings.sortReverse
} }
else else
{ {
g_rosterSettings.sortColumn = column CR.rosterSettings.sortColumn = column
g_rosterSettings.sortReverse = false CR.rosterSettings.sortReverse = false
} }
writeRosterSettings(); writeRosterSettings();
@ -124,14 +124,14 @@ function validateRosterColumnOrder(columns)
function changeRosterColumnOrder(columns) function changeRosterColumnOrder(columns)
{ {
g_rosterSettings.columnOrder = validateRosterColumnOrder(columns); CR.rosterSettings.columnOrder = validateRosterColumnOrder(columns);
writeRosterSettings(); writeRosterSettings();
window.opener.goProcessRoster(); window.opener.goProcessRoster();
} }
function moveColumnLeft(column) function moveColumnLeft(column)
{ {
const columns = rosterColumnList(g_rosterSettings.columns, { Callsign: true, Grid: true }); const columns = rosterColumnList(CR.rosterSettings.columns, { Callsign: true, Grid: true });
const pos = columns.indexOf(column); const pos = columns.indexOf(column);
if (pos > 1) if (pos > 1)
{ {

Wyświetl plik

@ -60,10 +60,10 @@ const ROSTER_COLUMNS = {
align: "left", align: "left",
onClick: `initiateQso("${callObj.hash}")`, onClick: `initiateQso("${callObj.hash}")`,
rawAttrs: callObj.style.call, rawAttrs: callObj.style.call,
html: html = (callObj.DEcallHTML || callObj.DEcall).formatCallsign() html: html = formatCallsign((callObj.DEcallHTML || callObj.DEcall))
} }
let acks = window.opener.g_acknowledgedCalls || {}; let acks = window.opener.GT.acknowledgedCalls || {};
if (acks[callObj.DEcall]) if (acks[callObj.DEcall])
{ {
attrs.html = `${attrs.html} <span class='acknowledged'><img class='ackBadge' src='${acks[callObj.DEcall].badge}'></span>` attrs.html = `${attrs.html} <span class='acknowledged'><img class='ackBadge' src='${acks[callObj.DEcall].badge}'></span>`
@ -77,7 +77,7 @@ const ROSTER_COLUMNS = {
Band: { Band: {
compare: callObjSimpleComparer("band"), compare: callObjSimpleComparer("band"),
tableData: (callObj) => ({ tableData: (callObj) => ({
style: `color: #${window.opener.g_pskColors[callObj.band]};`, style: `color: #${window.opener.GT.pskColors[callObj.band]};`,
html: callObj.band html: callObj.band
}) })
}, },
@ -85,7 +85,7 @@ const ROSTER_COLUMNS = {
Mode: { Mode: {
compare: callObjSimpleComparer("mode"), compare: callObjSimpleComparer("mode"),
tableData: (callObj) => ({ tableData: (callObj) => ({
style: `color: #${g_modeColors[callObj.mode] || "888888"};`, style: `color: #${CR.modeColors[callObj.mode] || "888888"};`,
html: callObj.mode html: callObj.mode
}) })
}, },
@ -104,7 +104,7 @@ const ROSTER_COLUMNS = {
tableData: (callObj) => ({ tableData: (callObj) => ({
rawAttrs: callObj.style.calling, rawAttrs: callObj.style.calling,
name: callObj.CQ ? "CQ" : "Calling", name: callObj.CQ ? "CQ" : "Calling",
html: (g_rosterSettings.wantRRCQ && callObj.RR73) ? "RR73" : callObj.DXcall.formatCallsign() html: (CR.rosterSettings.wantRRCQ && callObj.RR73) ? "RR73" : formatCallsign(callObj.DXcall)
}) })
}, },
@ -116,10 +116,10 @@ const ROSTER_COLUMNS = {
DXCC: { DXCC: {
compare: (a, b) => window.opener.myDxccCompare(a.callObj, b.callObj), compare: (a, b) => window.opener.myDxccCompare(a.callObj, b.callObj),
tableData: (callObj) => ({ tableData: (callObj) => ({
title: window.opener.g_dxccInfo[callObj.dxcc].pp, title: window.opener.GT.dxccInfo[callObj.dxcc].pp,
name: `DXCC (${callObj.dxcc})`, name: `DXCC (${callObj.dxcc})`,
rawAttrs: callObj.style.dxcc, rawAttrs: callObj.style.dxcc,
html: (callObj.dxccSuffix ? [window.opener.g_dxccToAltName[callObj.dxcc], callObj.dxccSuffix].join("&nbsp;") : window.opener.g_dxccToAltName[callObj.dxcc]) html: (callObj.dxccSuffix ? [window.opener.GT.dxccToAltName[callObj.dxcc], callObj.dxccSuffix].join("&nbsp;") : window.opener.GT.dxccToAltName[callObj.dxcc])
}) })
}, },
@ -128,7 +128,7 @@ const ROSTER_COLUMNS = {
tableData: (callObj) => ({ tableData: (callObj) => ({
align: "center", align: "center",
style: "margin:0; padding:0;", style: "margin:0; padding:0;",
html: `<img style='margin-bottom:-3px;height:14px' src='./img/flags/16/${window.opener.g_dxccInfo[callObj.dxcc].flag}'>` html: `<img style='margin-bottom:-3px;height:14px' src='./img/flags/16/${window.opener.GT.dxccInfo[callObj.dxcc].flag}'>`
}) })
}, },
@ -150,13 +150,13 @@ const ROSTER_COLUMNS = {
let attrs = { let attrs = {
align: "center", align: "center",
rawAttrs: callObj.style.cnty, rawAttrs: callObj.style.cnty,
html: callObj.cnty ? window.opener.g_cntyToCounty[callObj.cnty] : "&nbsp;" html: callObj.cnty ? window.opener.GT.cntyToCounty[callObj.cnty] : "&nbsp;"
} }
if (callObj.cnty && callObj.qual == false) if (callObj.cnty && callObj.qual == false)
{ {
attrs.title = $.i18n("rosterColumns.County.title") attrs.title = $.i18n("rosterColumns.County.title")
attrs.onClick = `window.opener.lookupCallsign("${callObj.DEcall}", "${callObj.grid}")` attrs.onClick = `window.opener.lookupCallsign("${callObj.DEcall}", "${callObj.grid}")`
attrs.html = attrs.html + " +" + String(window.opener.g_zipToCounty[callObj.zipcode].length - 1) attrs.html = attrs.html + " +" + String(window.opener.GT.zipToCounty[callObj.zipcode].length - 1)
attrs.style = "cursor: pointer; color: cyan;" attrs.style = "cursor: pointer; color: cyan;"
} }
return attrs return attrs
@ -243,17 +243,17 @@ const ROSTER_COLUMNS = {
compare: false, compare: false,
tableData: (callObj) => tableData: (callObj) =>
{ {
if (callObj.DEcall in window.opener.g_lotwCallsigns) if (callObj.DEcall in window.opener.GT.lotwCallsigns)
{ {
if (g_rosterSettings.maxLoTW < 27) if (CR.rosterSettings.maxLoTW < 27)
{ {
let months = (g_day - window.opener.g_lotwCallsigns[callObj.DEcall]) / 30; let months = (CR.day - window.opener.GT.lotwCallsigns[callObj.DEcall]) / 30;
if (months > g_rosterSettings.maxLoTW) if (months > CR.rosterSettings.maxLoTW)
{ {
return { return {
style: "color: yellow;", style: "color: yellow;",
align: "center", align: "center",
title: `${$.i18n("rosterColumns.LoTW.NoUpdate")} ${Number(months).toYM()}`, title: `${$.i18n("rosterColumns.LoTW.NoUpdate")} ${toYM(Number(months))}`,
html: "?" html: "?"
} }
} }
@ -263,7 +263,7 @@ const ROSTER_COLUMNS = {
style: "color: #0F0;", style: "color: #0F0;",
align: "center", align: "center",
title: `${$.i18n("rosterColumns.LoTW.LastUpdate")}${ title: `${$.i18n("rosterColumns.LoTW.LastUpdate")}${
window.opener.userDayString(window.opener.g_lotwCallsigns[callObj.DEcall] * 86400000) window.opener.userDayString(window.opener.GT.lotwCallsigns[callObj.DEcall] * 86400000)
}`, }`,
html: "&#10004;" html: "&#10004;"
} }
@ -275,7 +275,7 @@ const ROSTER_COLUMNS = {
style: "color: #0F0;", style: "color: #0F0;",
align: "center", align: "center",
title: `${$.i18n("rosterColumns.LoTW.LastUpdate")}${ title: `${$.i18n("rosterColumns.LoTW.LastUpdate")}${
window.opener.userDayString(window.opener.g_lotwCallsigns[callObj.DEcall] * 86400000) window.opener.userDayString(window.opener.GT.lotwCallsigns[callObj.DEcall] * 86400000)
}`, }`,
html: "&#10004;" html: "&#10004;"
} }
@ -295,7 +295,7 @@ const ROSTER_COLUMNS = {
tableData: (callObj) => ({ tableData: (callObj) => ({
style: "color: #0F0;", style: "color: #0F0;",
align: "center", align: "center",
html: (callObj.DEcall in window.opener.g_eqslCallsigns ? "&#10004;" : "&nbsp;") html: (callObj.DEcall in window.opener.GT.eqslCallsigns ? "&#10004;" : "&nbsp;")
}) })
}, },
@ -304,7 +304,7 @@ const ROSTER_COLUMNS = {
tableData: (callObj) => ({ tableData: (callObj) => ({
style: "color: #0F0;", style: "color: #0F0;",
align: "center", align: "center",
html: (callObj.DEcall in window.opener.g_oqrsCallsigns ? "&#10004;" : "&nbsp;") html: (callObj.DEcall in window.opener.GT.oqrsCallsigns ? "&#10004;" : "&nbsp;")
}) })
}, },
@ -314,7 +314,7 @@ const ROSTER_COLUMNS = {
style: "color: #EEE;", style: "color: #EEE;",
class: "lifeCol", class: "lifeCol",
id: `lm${callObj.hash}`, id: `lm${callObj.hash}`,
html: (timeNowSec() - callObj.life).toDHMS() html: toDHMS(timeNowSec() - callObj.life)
}) })
}, },
@ -359,14 +359,14 @@ const ROSTER_COLUMNS = {
style: "color: #EEE;", style: "color: #EEE;",
class: "timeCol", class: "timeCol",
id: `tm${callObj.hash}`, id: `tm${callObj.hash}`,
html: (timeNowSec() - callObj.age).toDHMS() html: toDHMS(timeNowSec() - callObj.age)
}) })
}, },
Spot: { Spot: {
compare: (a, b) => compare: (a, b) =>
{ {
let cutoff = timeNowSec() - window.opener.g_receptionSettings.viewHistoryTimeSec; let cutoff = timeNowSec() - window.opener.GT.receptionSettings.viewHistoryTimeSec;
if (a.callObj.spot.when <= cutoff) return -1; if (a.callObj.spot.when <= cutoff) return -1;
if (b.callObj.spot.when <= cutoff) return 1; if (b.callObj.spot.when <= cutoff) return 1;
@ -426,9 +426,9 @@ function potaColumnHover(callObj)
{ {
let value = ""; let value = "";
if (callObj.pota in window.opener.g_pota.parks) if (callObj.pota in window.opener.GT.pota.parks)
{ {
value += callObj.pota + " - " + window.opener.g_pota.parks[callObj.pota].name + "\n"; value += callObj.pota + " - " + window.opener.GT.pota.parks[callObj.pota].name + "\n";
} }
return value; return value;

Wyświetl plik

@ -1,36 +1,36 @@
function sendAlerts(callRoster, rosterSettings) function sendAlerts(callRoster, rosterSettings)
{ {
var dirPath = window.opener.g_scriptDir; let dirPath = window.opener.GT.scriptDir;
var scriptExists = false; let scriptExists = false;
var script = "cr-alert.sh"; let script = "cr-alert.sh";
var shouldAlert = 0; let shouldAlert = 0;
for (entry in callRoster) for (const entry in callRoster)
{ {
var callObj = callRoster[entry].callObj; let callObj = callRoster[entry].callObj;
// chrbayer: what does the tx field mean? no alerts are generated (at all) if this is in place... // chrbayer: what does the tx field mean? no alerts are generated (at all) if this is in place...
// if it's "not visible in the roster, don't put it in the report!" // if it's "not visible in the roster, don't put it in the report!"
if (callRoster[entry].tx == false) continue; if (callRoster[entry].tx == false) continue;
var call = callObj.DEcall; let call = callObj.DEcall;
g_scriptReport[call] = Object.assign({}, callObj); CR.scriptReport[call] = Object.assign({}, callObj);
g_scriptReport[call].dxccName = window.opener.g_dxccToAltName[callObj.dxcc]; CR.scriptReport[call].dxccName = window.opener.GT.dxccToAltName[callObj.dxcc];
g_scriptReport[call].distance = (callObj.distance > 0) ? parseInt(callObj.distance * MyCircle.validateRadius(window.opener.distanceUnit.value)) : 0; CR.scriptReport[call].distance = (callObj.distance > 0) ? parseInt(callObj.distance * MyCircle.validateRadius(window.opener.distanceUnit.value)) : 0;
delete g_scriptReport[call].DEcall; delete CR.scriptReport[call].DEcall;
g_scriptReport[call].rect = null; CR.scriptReport[call].rect = null;
delete g_scriptReport[call].rect; delete CR.scriptReport[call].rect;
delete g_scriptReport[call].style; delete CR.scriptReport[call].style;
delete g_scriptReport[call].wspr; delete CR.scriptReport[call].wspr;
delete g_scriptReport[call].qso; delete CR.scriptReport[call].qso;
delete g_scriptReport[call].instance; delete CR.scriptReport[call].instance;
if (rosterSettings.callMode != "all") if (rosterSettings.callMode != "all")
{ {
g_scriptReport[call].shouldAlert = true; CR.scriptReport[call].shouldAlert = true;
g_scriptReport[call].reason.push(g_rosterSettings.hunting); CR.scriptReport[call].reason.push(CR.rosterSettings.hunting);
} }
if (callObj.alerted == false && rosterSettings.callMode == "all" && callObj.shouldAlert == true) if (callObj.alerted == false && rosterSettings.callMode == "all" && callObj.shouldAlert == true)
@ -52,7 +52,7 @@ function sendAlerts(callRoster, rosterSettings)
{ {
if (fs.existsSync(dirPath)) if (fs.existsSync(dirPath))
{ {
if (window.opener.g_platform == "windows") if (window.opener.GT.platform == "windows")
{ {
script = "cr-alert.bat"; script = "cr-alert.bat";
} }
@ -61,7 +61,7 @@ function sendAlerts(callRoster, rosterSettings)
scriptExists = true; scriptExists = true;
scriptIcon.innerHTML = scriptIcon.innerHTML =
"<div class='buttonScript' onclick='window.opener.toggleCRScript();'>" + "<div class='buttonScript' onclick='window.opener.toggleCRScript();'>" +
(window.opener.g_crScript == 1 (window.opener.GT.crScript == 1
? `<font color='lightgreen'>${$.i18n("sendAlerts.scriptEnabled")}</font>` ? `<font color='lightgreen'>${$.i18n("sendAlerts.scriptEnabled")}</font>`
: `<font color='yellow'>${$.i18n("sendAlerts.scriptDisabled")}</font>`) + : `<font color='yellow'>${$.i18n("sendAlerts.scriptDisabled")}</font>`) +
"</div>"; "</div>";
@ -77,12 +77,12 @@ function sendAlerts(callRoster, rosterSettings)
if (shouldAlert > 0) if (shouldAlert > 0)
{ {
if (window.opener.g_classicAlerts.huntRoster == true) if (window.opener.GT.classicAlerts.huntRoster == true)
{ {
var notify = window.opener.huntRosterNotify.value; let notify = window.opener.huntRosterNotify.value;
if (notify == "0") if (notify == "0")
{ {
var media = window.opener.huntRosterNotifyMedia.value; let media = window.opener.huntRosterNotifyMedia.value;
if (media != "none") window.opener.playAlertMediaFile(media); if (media != "none") window.opener.playAlertMediaFile(media);
} }
else if (notify == "1") else if (notify == "1")
@ -91,15 +91,15 @@ function sendAlerts(callRoster, rosterSettings)
} }
} }
if (scriptExists && window.opener.g_crScript == 1) if (scriptExists && window.opener.GT.crScript == 1)
{ {
try try
{ {
fs.writeFileSync(dirPath + "cr-alert.json", JSON.stringify(g_scriptReport, null, 2)); fs.writeFileSync(dirPath + "cr-alert.json", JSON.stringify(CR.scriptReport, null, 2));
var thisProc = dirPath + script; let thisProc = dirPath + script;
var cp = require("child_process"); let cp = require("child_process");
var child = cp.spawn(thisProc, [], { let child = cp.spawn(thisProc, [], {
detached: true, detached: true,
cwd: dirPath.slice(0, -1), cwd: dirPath.slice(0, -1),
stdio: ["ignore", "ignore", "ignore"] stdio: ["ignore", "ignore", "ignore"]
@ -110,8 +110,8 @@ function sendAlerts(callRoster, rosterSettings)
{ {
conosle.log(e); conosle.log(e);
} }
g_scriptReport = Object(); CR.scriptReport = Object();
} }
else g_scriptReport = Object(); else CR.scriptReport = Object();
} }
} }

Wyświetl plik

@ -1,5 +1,12 @@
const nodeTimers = require("timers"); const nodeTimers = require("timers");
// GridTracker object
var GT = {};
// CallRoster object
var CR = {};
var isShowing = false;
var s_title = null; var s_title = null;
var s_screenSettings = {}; var s_screenSettings = {};
var s_zoomLevel = 0; var s_zoomLevel = 0;
@ -71,7 +78,7 @@ function saveScreenSettings()
{ {
setWindowInfo(); setWindowInfo();
var setting = { showing: g_isShowing, zoomLevel: s_zoomLevel, window: g_windowInfo }; var setting = { showing: isShowing, zoomLevel: s_zoomLevel, window: g_windowInfo };
s_screenSettings = JSON.parse(localStorage.screenSettings); s_screenSettings = JSON.parse(localStorage.screenSettings);
@ -83,14 +90,12 @@ function saveScreenSettings()
nw.Screen.on("displayAdded", screenCB.onDisplayAdded); nw.Screen.on("displayAdded", screenCB.onDisplayAdded);
nw.Screen.on("displayRemoved", screenCB.onDisplayRemoved); nw.Screen.on("displayRemoved", screenCB.onDisplayRemoved);
var g_isShowing = false;
nw.Window.get().on("loaded", function () nw.Window.get().on("loaded", function ()
{ {
// Use the first 12 bytes of the title(trimmed) as storage names // Use the first 12 bytes of the title(trimmed) as storage names
// This cannot be changed as current installs (12,000+) use this naming convention // This cannot be changed as current installs (12,000+) use this naming convention
s_title = document.title.substr(0, 12).trim(); s_title = document.title.substr(0, 12).trim();
g_isShowing = false; isShowing = false;
if (typeof localStorage.screenSettings == "undefined") if (typeof localStorage.screenSettings == "undefined")
{ {
localStorage.screenSettings = "{}"; localStorage.screenSettings = "{}";
@ -109,7 +114,7 @@ nw.Window.get().on("loaded", function ()
{ {
saveScreenSettings(); saveScreenSettings();
} }
g_isShowing = s_screenSettings[s_title].showing; isShowing = s_screenSettings[s_title].showing;
nw.Window.get().zoomLevel = s_zoomLevel = s_screenSettings[s_title].zoomLevel; nw.Window.get().zoomLevel = s_zoomLevel = s_screenSettings[s_title].zoomLevel;
g_windowInfo = s_screenSettings[s_title].window; g_windowInfo = s_screenSettings[s_title].window;
@ -122,7 +127,7 @@ nw.Window.get().on("loaded", function ()
// Check the first part of the string, only one window has "GridTracker" in the name. // Check the first part of the string, only one window has "GridTracker" in the name.
// It is reserved to the main app window. // It is reserved to the main app window.
if (g_isShowing || s_title.indexOf("GridTracker") == 0) if (isShowing || s_title.indexOf("GridTracker") == 0)
{ {
this.show(); this.show();
} }

Wyświetl plik

@ -8,23 +8,23 @@
* https://groups.io/g/PstRotator/message/5825 * https://groups.io/g/PstRotator/message/5825
* *
*/ */
var g_pstrotatorSettings = {}; GT.pstrotatorSettings = {};
function pstrotatorServiceChanged() function pstrotatorServiceChanged()
{ {
if (g_pstrotatorSettings.enabled != pstrotatorCheckBox.checked) if (GT.pstrotatorSettings.enabled != pstrotatorCheckBox.checked)
{ {
// This setting toggles the presence of a contextual menu item in the roster, // This setting toggles the presence of a contextual menu item in the roster,
// which is constructed only during roster initialization. // which is constructed only during roster initialization.
// //
// So when this setting is changed, we need to reload the entire roster window. // So when this setting is changed, we need to reload the entire roster window.
// //
g_pstrotatorSettings.enable = pstrotatorCheckBox.checked; GT.pstrotatorSettings.enable = pstrotatorCheckBox.checked;
if (g_rosterInitialized) if (GT.rosterInitialized)
{ {
try try
{ {
g_callRosterWindowHandle.window.location.reload(); GT.callRosterWindowHandle.window.location.reload();
} }
catch (e) catch (e)
{ {
@ -33,8 +33,8 @@ function pstrotatorServiceChanged()
} }
} }
g_pstrotatorSettings.ip = pstrotatorIpInput.value; GT.pstrotatorSettings.ip = pstrotatorIpInput.value;
g_pstrotatorSettings.port = pstrotatorPortInput.value; GT.pstrotatorSettings.port = pstrotatorPortInput.value;
saveLogSettings(); saveLogSettings();
} }
@ -44,9 +44,9 @@ function aimRotator(info)
const { callObj } = info const { callObj } = info
if ( if (
g_pstrotatorSettings.enable == true && GT.pstrotatorSettings.enable == true &&
g_pstrotatorSettings.port > 0 && GT.pstrotatorSettings.port > 0 &&
g_pstrotatorSettings.ip.length > 4 && GT.pstrotatorSettings.ip.length > 4 &&
(callObj.distance > 0) (callObj.distance > 0)
) )
{ {
@ -58,8 +58,8 @@ function aimRotator(info)
sendUdpMessage( sendUdpMessage(
payload, payload,
payload.length, payload.length,
parseInt(g_pstrotatorSettings.port), parseInt(GT.pstrotatorSettings.port),
g_pstrotatorSettings.ip GT.pstrotatorSettings.ip
); );
if (callObj.DEcall) if (callObj.DEcall)
{ {

Wyświetl plik

@ -292,7 +292,7 @@ var dayNight = {
}), }),
stroke: null stroke: null
}), }),
opacity: Number(g_mapSettings.shadow), opacity: Number(GT.mapSettings.shadow),
zIndex: 0 zIndex: 0
}); });
this.map.getLayers().insertAt(1, this.vectorLayer); this.map.getLayers().insertAt(1, this.vectorLayer);
@ -305,7 +305,7 @@ var dayNight = {
}) })
}); });
this.vectorLayer.setStyle(circleStyle); this.vectorLayer.setStyle(circleStyle);
this.vectorLayer.setOpacity(Number(g_mapSettings.shadow)); this.vectorLayer.setOpacity(Number(GT.mapSettings.shadow));
this.vectorSource.clear(); this.vectorSource.clear();
this.vectorSource.addFeature( this.vectorSource.addFeature(
@ -313,7 +313,7 @@ var dayNight = {
featureProjection: "EPSG:3857" featureProjection: "EPSG:3857"
}) })
); );
var point = ol.proj.fromLonLat([g_myLon, g_myLat]); var point = ol.proj.fromLonLat([GT.myLon, GT.myLat]);
var arr = this.vectorSource.getFeaturesAtCoordinate(point); var arr = this.vectorSource.getFeaturesAtCoordinate(point);
return arr.length > 0; return arr.length > 0;
}, },
@ -422,10 +422,10 @@ var moonLayer = {
refresh: function () refresh: function ()
{ {
this.vectorSource.clear(); this.vectorSource.clear();
if (g_appSettings.moonTrack == 1) if (GT.appSettings.moonTrack == 1)
{ {
now = timeNowSec(); now = timeNowSec();
if (g_appSettings.moonPath == 1) if (GT.appSettings.moonPath == 1)
{ this.vectorSource.addFeature(this.future(now)); } { this.vectorSource.addFeature(this.future(now)); }
this.pin = iconFeature( this.pin = iconFeature(
ol.proj.fromLonLat(subLunar(now).ll), ol.proj.fromLonLat(subLunar(now).ll),

Wyświetl plik

@ -136,9 +136,9 @@ function addTextToClipboard(data)
function setClipboardFromLookup() function setClipboardFromLookup()
{ {
if (window.opener.g_lastLookupAddress) if (window.opener.GT.lastLookupAddress)
{ {
addTextToClipboard(window.opener.g_lastLookupAddress); addTextToClipboard(window.opener.GT.lastLookupAddress);
} }
} }

Wyświetl plik

@ -297,10 +297,10 @@ function flightFeature(line, opts, layer, canAnimate) {
var dash = []; var dash = [];
var dashOff = 0; var dashOff = 0;
if ( canAnimate == true && g_mapSettings.animate == true ) if ( canAnimate == true && GT.mapSettings.animate == true )
{ {
dash = g_flightPathLineDash; dash = GT.flightPathLineDash;
dashOff = g_flightPathTotal - g_flightPathOffset; dashOff = GT.flightPathTotal - GT.flightPathOffset;
} }
var featureArrow = new ol.Feature(new ol.geom.Point(line[0])); var featureArrow = new ol.Feature(new ol.geom.Point(line[0]));
@ -324,8 +324,8 @@ function flightFeature(line, opts, layer, canAnimate) {
featureArrow.setStyle(thisStle); featureArrow.setStyle(thisStle);
feature.Arrow = featureArrow; feature.Arrow = featureArrow;
g_layerSources[layer].addFeature(featureArrow); GT.layerSources[layer].addFeature(featureArrow);
g_layerSources[layer].addFeature(feature); GT.layerSources[layer].addFeature(feature);
return feature; return feature;
} }