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">
<td>
<div id="localDXcall" style="cursor: pointer" title="Who you're calling or last called"
onclick="startLookup(g_localDXcall,localDXGrid.innerHTML);"
oncontextmenu="showWorkedByCall(g_localDXcall, event);">
onclick="startLookup(GT.localDXcall,localDXGrid.innerHTML);"
oncontextmenu="showWorkedByCall(GT.localDXcall, event);">
-
</div>
</td>
@ -352,12 +352,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<div id="countryCount">0</div>
</td>
<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">
QSL
</td>
<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">
<div id="qslCount">0</div>
</td>
@ -949,7 +949,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</div>
</div>
<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>

Wyświetl plik

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

Wyświetl plik

@ -71,7 +71,7 @@
function userAgrees()
{
window.opener.g_appSettings.gtAgree = "user agrees to messaging";
window.opener.GT.appSettings.gtAgree = "user agrees to messaging";
noticeDiv.style.display = "none";
wrapperDiv.style.display = "block";
}
@ -84,21 +84,21 @@
{
// Do work
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 = "";
// 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.";
window.opener.gtSendMessage(thisMsg, g_currentId);
worker = makeViewMessage("self", window.opener.myDEcall, thisMsg);
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.newMessageSetting(window.opener.msgAwaySelect);
@ -116,7 +116,7 @@
{
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";
wrapperDiv.style.display = "none";
@ -148,7 +148,7 @@
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);
}
@ -166,9 +166,9 @@
{
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
{
@ -183,9 +183,9 @@
function onHoverCid(from)
{
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
{
@ -230,9 +230,9 @@
newDiv.oncontextmenu = openLookupCid;
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>";
newDiv.innerHTML = worker;
@ -267,9 +267,9 @@
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")
{
var show = true;
@ -346,9 +346,9 @@
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")
{
var show = true;
@ -413,15 +413,15 @@
function showAllMessages()
{
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 = "";
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 + "');\">";
if (key in window.opener.g_gtUnread)
if (key in window.opener.GT.gtUnread)
{
worker += "🔥";
}
@ -430,7 +430,7 @@
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>";
}
}
@ -445,8 +445,8 @@
{
try
{
if (what in window.opener.g_gtMessages) delete window.opener.g_gtMessages[what];
if (what in window.opener.g_gtUnread) delete window.opener.g_gtUnread[what];
if (what in window.opener.GT.gtMessages) delete window.opener.GT.gtMessages[what];
if (what in window.opener.GT.gtUnread) delete window.opener.GT.gtUnread[what];
}
catch (e) {}
@ -475,7 +475,7 @@
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 worker = who + " " + time + "</br>";
var msgTextClass = containsDoubleByte(msg) ? "msgTextUnicode" : "msgText";
@ -486,8 +486,8 @@
function newChatMessage(id, jsmesg)
{
if (id == g_currentId) {
var worker = makeViewMessage("them", window.opener.g_gtFlagPins[id].call, jsmesg.msg, jsmesg.when);
if (id in window.opener.g_gtUnread) delete window.opener.g_gtUnread[id];
var worker = makeViewMessage("them", window.opener.GT.gtFlagPins[id].call, jsmesg.msg, jsmesg.when);
if (id in window.opener.GT.gtUnread) delete window.opener.GT.gtUnread[id];
messageTextDiv.innerHTML += worker;
scrollDown(messageTextDiv);
return document.hasFocus();
@ -516,14 +516,14 @@
{
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();
country.innerHTML = window.opener.g_dxccToAltName[window.opener.g_gtFlagPins[id].dxcc];
grid.innerHTML = window.opener.g_gtFlagPins[id].grid;
band.innerHTML = window.opener.g_gtFlagPins[id].band;
mode.innerHTML = window.opener.g_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;
callsign.innerHTML = formatCallsign(window.opener.GT.gtFlagPins[id].call);
country.innerHTML = window.opener.GT.dxccToAltName[window.opener.GT.gtFlagPins[id].dxcc];
grid.innerHTML = window.opener.GT.gtFlagPins[id].grid;
band.innerHTML = window.opener.GT.gtFlagPins[id].band;
mode.innerHTML = window.opener.GT.gtFlagPins[id].mode;
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?
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 = "";
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(
"them",
window.opener.g_gtFlagPins[id].call,
window.opener.g_gtMessages[id].history[msg].msg,
window.opener.g_gtMessages[id].history[msg].when
window.opener.GT.gtFlagPins[id].call,
window.opener.GT.gtMessages[id].history[msg].msg,
window.opener.GT.gtMessages[id].history[msg].when
);
else
worker += makeViewMessage(
"self",
window.opener.myDEcall,
window.opener.g_gtMessages[id].history[msg].msg,
window.opener.g_gtMessages[id].history[msg].when
window.opener.GT.gtMessages[id].history[msg].msg,
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);
showAllMessages();
}
@ -566,7 +566,7 @@
g_currentId = id;
messageAreaDiv.style.display = "inline-block";
if (window.opener.g_gtFlagPins[id].live == false)
if (window.opener.GT.gtFlagPins[id].live == false)
{
notifyNoChat(id);
} else {

Wyświetl plik

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

Wyświetl plik

@ -21,6 +21,7 @@
<link rel="stylesheet" href="./lib/style.css" />
<link id="roster" rel="stylesheet" href="./lib/style_roster.css" />
<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/jquery-3.6.1.min.js"></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/rosterColumnFunctions.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>
<body id="rosterBody" onload="init()" onresize="resize()" style="display:none;" class="roster" oncontextmenu="return handleContextMenu(event);">
<div id="MainCallRoster" style="display:block;";>
@ -215,8 +215,8 @@
class="inputTextValue"
size="12"
id="huntRegexValue"
onfocus="g_typingInRoster=true;"
onblur="g_typingInRoster=false;"
onfocus="CR.typingInRoster=true;"
onblur="CR.typingInRoster=false;"
oninput="valuesChanged();"
onkeydown="blurOnEnter(this);"
/>
@ -365,8 +365,8 @@
class="inputTextValue"
size="8"
id="noMsgValue"
onfocus="g_typingInRoster=true;"
onblur="g_typingInRoster=false;"
onfocus="CR.typingInRoster=true;"
onblur="CR.typingInRoster=false;"
oninput="valuesChanged();"
onkeydown="blurOnEnter(this);"
/>
@ -382,8 +382,8 @@
class="inputTextValue"
size="8"
id="onlyMsgValue"
onfocus="g_typingInRoster=true;"
onblur="g_typingInRoster=false;"
onfocus="CR.typingInRoster=true;"
onblur="CR.typingInRoster=false;"
oninput="valuesChanged();"
onkeydown="blurOnEnter(this);"
/>
@ -400,8 +400,8 @@
class="inputTextValue"
size="12"
id="callsignRegex"
onfocus="g_typingInRoster=true;"
onblur="g_typingInRoster=false;"
onfocus="CR.typingInRoster=true;"
onblur="CR.typingInRoster=false;"
oninput="valuesChanged();"
onkeydown="blurOnEnter(this);"
/>

Wyświetl plik

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

Plik diff jest za duży Load Diff

Wyświetl plik

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

Wyświetl plik

@ -2,7 +2,7 @@
// All rights reserved.
// See LICENSE for more information.
var g_pota = {
GT.pota = {
parks: {},
locations: {},
parksTimeout: null,
@ -17,7 +17,7 @@ var g_pota = {
rbnFrequency: 600000
};
var g_potaSpotTemplate = {
GT.potaSpotTemplate = {
activator: "",
frequency: 0,
mode: "",
@ -33,11 +33,11 @@ var g_potaSpotTemplate = {
spotterGrid: ""
};
var g_parkTemplate = {
GT.parkTemplate = {
feature: null
}
var g_potaUnknownPark = {
GT.potaUnknownPark = {
name: "Unknown park (not yet spotted)",
active: "0",
entityId: "-1",
@ -47,14 +47,14 @@ var g_potaUnknownPark = {
grid: ""
};
var g_gtParkIconActive = new ol.style.Icon({
GT.gtParkIconActive = new ol.style.Icon({
src: "./img/pota_icon_active.png",
anchorYUnits: "pixels",
anchorXUnits: "pixels",
anchor: [10, 19]
});
var g_gtParkIconInactive = new ol.style.Icon({
GT.gtParkIconInactive = new ol.style.Icon({
src: "./img/pota_icon_inactive.png",
anchorYUnits: "pixels",
anchorXUnits: "pixels",
@ -63,15 +63,15 @@ var g_gtParkIconInactive = new ol.style.Icon({
function initPota()
{
potaEnabled.checked = (g_appSettings.potaEnabled == 1);
potaMenu.checked = g_appSettings.potaShowMenu;
potaButton.style.display = (g_appSettings.potaEnabled == 1 && g_appSettings.potaShowMenu && g_mapSettings.offlineMode == false) ? "" : "none";
potaImg.style.filter = g_appSettings.potaMapEnabled ? "" : "grayscale(1)";
potaEnabled.checked = (GT.appSettings.potaEnabled == 1);
potaMenu.checked = GT.appSettings.potaShowMenu;
potaButton.style.display = (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaShowMenu && GT.mapSettings.offlineMode == false) ? "" : "none";
potaImg.style.filter = GT.appSettings.potaMapEnabled ? "" : "grayscale(1)";
g_layerSources.pota.clear();
g_pota.mapParks = {};
GT.layerSources.pota.clear();
GT.pota.mapParks = {};
if (g_appSettings.potaEnabled == 1)
if (GT.appSettings.potaEnabled == 1)
{
getPotaParks();
}
@ -79,11 +79,11 @@ function initPota()
function changePotaEnable()
{
g_appSettings.potaEnabled = (potaEnabled.checked == true) ? 1 : 0;
potaButton.style.display = (g_appSettings.potaEnabled == 1 && g_appSettings.potaShowMenu && g_mapSettings.offlineMode == false) ? "" : "none";
if (!g_appSettings.potaEnabled)
GT.appSettings.potaEnabled = (potaEnabled.checked == true) ? 1 : 0;
potaButton.style.display = (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaShowMenu && GT.mapSettings.offlineMode == false) ? "" : "none";
if (!GT.appSettings.potaEnabled)
{
g_layerSources.pota.clear();
GT.layerSources.pota.clear();
}
else
{
@ -96,18 +96,18 @@ function changePotaEnable()
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";
potaImg.style.filter = g_appSettings.potaMapEnabled ? "" : "grayscale(1)";
potaButton.style.display = (GT.appSettings.potaEnabled == 1 && GT.appSettings.potaShowMenu && GT.mapSettings.offlineMode == false) ? "" : "none";
potaImg.style.filter = GT.appSettings.potaMapEnabled ? "" : "grayscale(1)";
saveAppSettings();
}
function togglePotaMap()
{
g_appSettings.potaMapEnabled = !g_appSettings.potaMapEnabled;
potaImg.style.filter = g_appSettings.potaMapEnabled ? "" : "grayscale(1)";
GT.appSettings.potaMapEnabled = !GT.appSettings.potaMapEnabled;
potaImg.style.filter = GT.appSettings.potaMapEnabled ? "" : "grayscale(1)";
saveAppSettings();
@ -116,11 +116,11 @@ function togglePotaMap()
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();
}
}
@ -129,22 +129,22 @@ function makeParkFeatures()
{
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);
for (const call in g_pota.parkSpots[park])
var parkObj = Object.assign({}, GT.parkTemplate);
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))
{
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.size = 22;
g_pota.mapParks[park] = parkObj;
g_layerSources.pota.addFeature(parkObj.feature);
GT.pota.mapParks[park] = parkObj;
GT.layerSources.pota.addFeature(parkObj.feature);
}
}
}
@ -163,58 +163,58 @@ function potaSpotFromDecode(callObj)
{
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
var newObj = spotFromCallObj(callObj, park, g_pota.parkSpots[park][callObj.DEcall].count);
g_pota.parkSpots[park][callObj.DEcall] = fillObjectFromTemplate(g_pota.parkSpots[park][callObj.DEcall], newObj);
var newObj = spotFromCallObj(callObj, park, GT.pota.parkSpots[park][callObj.DEcall].count);
GT.pota.parkSpots[park][callObj.DEcall] = fillObjectFromTemplate(GT.pota.parkSpots[park][callObj.DEcall], newObj);
// 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;
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;
reportPotaRBN(g_pota.parkSpots[park][callObj.DEcall]);
GT.pota.rbnReportTimes[hash] = Date.now() + GT.pota.rbnFrequency;
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
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);
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;
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;
reportPotaRBN(g_pota.parkSpots[park][callObj.DEcall]);
GT.pota.rbnReportTimes[hash] = Date.now() + GT.pota.rbnFrequency;
reportPotaRBN(GT.pota.parkSpots[park][callObj.DEcall]);
}
}
else
{
if (!(callObj.DEcall in g_pota.callSpots))
if (!(callObj.DEcall in GT.pota.callSpots))
{
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);
}
@ -290,15 +290,15 @@ function reportPotaQSO(record)
function rbnReportResult(buffer, flag, cookies)
{
// It worked! process latest spots!
if (g_pota.spotsTimeout)
if (GT.pota.spotsTimeout)
{
nodeTimers.clearTimeout(g_pota.spotsTimeout);
g_pota.spotsTimeout = null;
nodeTimers.clearTimeout(GT.pota.spotsTimeout);
GT.pota.spotsTimeout = null;
}
processPotaSpots(String(buffer));
g_pota.spotsTimeout = nodeTimers.setTimeout(getPotaSpots, 300000);
GT.pota.spotsTimeout = nodeTimers.setTimeout(getPotaSpots, 300000);
}
function spotFromCallObj(callObj, park, inCount, rbnTime)
@ -308,7 +308,7 @@ function spotFromCallObj(callObj, park, inCount, rbnTime)
activatorGrid: callObj.grid,
spotter: myDEcall + "-#",
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,
mode: callObj.mode,
band: callObj.band,
@ -322,28 +322,28 @@ function spotFromCallObj(callObj, park, inCount, rbnTime)
function addParkSpotFeature(park, report)
{
var parkObj = Object.assign({}, g_parkTemplate);
if (park in g_pota.mapParks)
var parkObj = Object.assign({}, GT.parkTemplate);
if (park in GT.pota.mapParks)
{
parkObj = g_pota.mapParks[park];
parkObj = GT.pota.mapParks[park];
}
else
{
g_pota.mapParks[park] = parkObj;
GT.pota.mapParks[park] = parkObj;
}
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.size = 22;
g_layerSources.pota.addFeature(parkObj.feature);
GT.layerSources.pota.addFeature(parkObj.feature);
}
}
function processPotaParks(buffer)
{
if (g_appSettings.potaEnabled == 1)
if (GT.appSettings.potaEnabled == 1)
{
try
{
@ -361,10 +361,10 @@ function processPotaParks(buffer)
}
newParks[park].locationDesc = locations.join(", ");
}
newParks["?-????"] = g_potaUnknownPark;
newParks["?-????"] = GT.potaUnknownPark;
g_pota.parks = newParks;
g_pota.locations = data.locations;
GT.pota.parks = newParks;
GT.pota.locations = data.locations;
getPotaSchedule();
getPotaSpots();
}
@ -379,13 +379,13 @@ function processPotaParks(buffer)
function getPotaParks()
{
if (g_pota.parksTimeout)
if (GT.pota.parksTimeout)
{
nodeTimers.clearTimeout(g_pota.parksTimeout);
g_pota.spotsTimeout = null;
nodeTimers.clearTimeout(GT.pota.parksTimeout);
GT.pota.spotsTimeout = null;
}
if (g_mapSettings.offlineMode == false && g_appSettings.potaEnabled == 1)
if (GT.mapSettings.offlineMode == false && GT.appSettings.potaEnabled == 1)
{
getBuffer(
"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
@ -425,22 +425,22 @@ function uniqueArrayFromArray(input)
function processPotaSpots(buffer)
{
if (g_appSettings.potaEnabled == 1)
if (GT.appSettings.potaEnabled == 1)
{
try
{
var spots = JSON.parse(buffer);
g_pota.callSpots = {};
g_pota.parkSpots = {};
GT.pota.callSpots = {};
GT.pota.parkSpots = {};
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.frequency = parseInt(newSpot.frequency) / 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))
{
// don't add the spot, they have self-QRT'ed
@ -451,14 +451,14 @@ function processPotaSpots(buffer)
}
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
@ -478,13 +478,13 @@ function processPotaSpots(buffer)
function getPotaSpots()
{
if (g_pota.spotsTimeout)
if (GT.pota.spotsTimeout)
{
nodeTimers.clearTimeout(g_pota.spotsTimeout);
g_pota.spotsTimeout = null;
nodeTimers.clearTimeout(GT.pota.spotsTimeout);
GT.pota.spotsTimeout = null;
}
if (g_mapSettings.offlineMode == false && g_appSettings.potaEnabled == 1)
if (GT.mapSettings.offlineMode == false && GT.appSettings.potaEnabled == 1)
{
getBuffer(
"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)
{
if (g_appSettings.potaEnabled == 1)
if (GT.appSettings.potaEnabled == 1)
{
try
{
var schedules = JSON.parse(buffer);
g_pota.callSchedule = {};
g_pota.parkSchedule = {};
GT.pota.callSchedule = {};
GT.pota.parkSchedule = {};
for (const i in schedules)
{
var newObj = {};
@ -517,13 +517,13 @@ function processPotaSchedule(buffer)
newObj.comments = schedules[i].comments;
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.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
{
@ -534,13 +534,13 @@ function processPotaSchedule(buffer)
}
// 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)
@ -552,13 +552,13 @@ function processPotaSchedule(buffer)
function getPotaSchedule()
{
if (g_pota.scheduleTimeout)
if (GT.pota.scheduleTimeout)
{
nodeTimers.clearTimeout(g_pota.scheduleTimeout);
g_pota.scheduleTimeout = null;
nodeTimers.clearTimeout(GT.pota.scheduleTimeout);
GT.pota.scheduleTimeout = null;
}
if (g_mapSettings.offlineMode == false && g_appSettings.potaEnabled == 1)
if (GT.mapSettings.offlineMode == false && GT.appSettings.potaEnabled == 1)
{
getBuffer(
"https://api.pota.app/activation",
@ -568,18 +568,18 @@ function getPotaSchedule()
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)
{
if (g_lastPark && g_lastPark == feature)
if (GT.lastPark && GT.lastPark == feature)
{
mouseParkMove();
return;
}
g_lastPark = feature;
GT.lastPark = feature;
createParkTipTable(feature);
@ -591,7 +591,7 @@ function mouseOverPark(feature)
function mouseOutPark(mouseEvent)
{
g_lastPark = null;
GT.lastPark = null;
myParktip.style.zIndex = -1;
}
@ -615,57 +615,33 @@ function mouseParkMove()
function createParkTipTable(toolElement)
{
var worker = "";
var key = toolElement.key;
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'>" +
key +
" : <font color='cyan'>" + g_pota.parks[key].name + "" +
" (<font color='yellow'>" + g_dxccToAltName[Number(g_pota.parks[key].entityId)] + "</font>)" +
"</font></br><font color='lightblue'>" + g_pota.parks[key].locationDesc + "</font></div>";
" : <font color='cyan'>" + GT.pota.parks[key].name + "" +
" (<font color='yellow'>" + GT.dxccToAltName[Number(GT.pota.parks[key].entityId)] + "</font>)" +
"</font></br><font color='lightblue'>" + GT.pota.parks[key].locationDesc + "</font></div>";
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>";
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 += "<td style='color:yellow'>" + g_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: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:orange'>" + g_pota.parkSpots[key][i].mode + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].count + "</td>";
worker += "<td style='color:lightblue' >" + parseInt((now - g_pota.parkSpots[key][i].spotTime) / 1000).toDHMS() + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].source + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].comments + "</td>";
worker += "<td style='color:yellow'>" + GT.pota.parkSpots[key][i].activator + "</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' >" + 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'>" + GT.pota.parkSpots[key][i].mode + "</td>";
worker += "<td>" + GT.pota.parkSpots[key][i].count + "</td>";
worker += "<td style='color:lightblue' >" + toDHMS(parseInt((now - GT.pota.parkSpots[key][i].spotTime) / 1000)) + "</td>";
worker += "<td>" + GT.pota.parkSpots[key][i].source + "</td>";
worker += "<td>" + GT.pota.parkSpots[key][i].comments + "</td>";
worker += "</tr>";
}
}
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;
return 1;
}

Wyświetl plik

@ -1,7 +1,7 @@
// GridTracker Copyright © 2023 GridTracker.org
// All rights reserved.
// See LICENSE for more information.
var g_proto_bands = [
const g_proto_bands = [
"OOB",
"OOB",
1,
@ -74,9 +74,8 @@ var g_proto_bands = [
"1.25m"
];
// 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);
if (newFreq > 0 && newFreq < 226) return g_proto_bands[g_proto_bands.indexOf(newFreq) + 1];
else if (newFreq >= 420 && newFreq <= 450) return "70cm";
@ -99,95 +98,53 @@ Number.prototype.formatBand = function ()
else return "OOB";
};
Number.prototype.formatMhz = function (n, x)
function formatMhz(freq, n, x)
{
var re = "\\d(?=(\\d{" + (x || 3) + "})+" + (n > 0 ? "\\." : "$") + ")";
return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, "g"), "$&.");
let re = "\\d(?=(\\d{" + (x || 3) + "})+" + (n > 0 ? "\\." : "$") + ")";
return freq.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, "g"), "$&.");
};
Number.prototype.formatSignalReport = function ()
function formatSignalReport(val)
{
var val = this;
var report = String();
let report = String();
if (val >= 0) report = "+" + val;
else report = val;
return report;
};
var CALLSIGN_REGEX = /0/g
String.prototype.formatCallsign = function ()
const CALLSIGN_REGEX = /0/g
function formatCallsign(call)
{
return this.replace(CALLSIGN_REGEX, "Ø");
return call.replace(CALLSIGN_REGEX, "Ø");
};
Number.prototype.toDHMS = function ()
function toDHMS(inputSeconds)
{
var seconds = this;
var days = Math.floor(seconds / (3600 * 24));
let seconds = inputSeconds;
let days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600);
let hrs = Math.floor(seconds / 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;
let first = days + hrs + mnts;
if (first == "") val = seconds + "s";
else val = first + (seconds > 0 ? seconds + "s" : "");
return val;
};
Number.prototype.msToDHMS = function ()
function toDHM(inputSeconds)
{
var seconds = parseInt(this / 1000);
var days = Math.floor(seconds / (3600 * 24));
let seconds = inputSeconds;
let days = Math.floor(seconds / (3600 * 24));
seconds -= days * 3600 * 24;
var hrs = Math.floor(seconds / 3600);
let 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.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);
let mnts = Math.floor(seconds / 60);
seconds -= mnts * 60;
days = days ? days + "d " : "";
@ -199,46 +156,21 @@ Number.prototype.toDHM = function ()
return val;
};
Number.prototype.toYM = function ()
function toYM(input)
{
var months = this;
var years = parseInt(Math.floor(months / 12));
let months = input;
let years = parseInt(Math.floor(months / 12));
months -= years * 12;
months = parseInt(months);
years = years ? years + "y " : "";
months = months ? months + "m" : "";
var total = years + months;
let total = years + months;
return total == "" ? "any" : total;
};
Number.prototype.toHMS = function ()
function padNumber(number, size)
{
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;
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);
let s = String(number);
while (s.length < (size || 2))
{
s = "0" + s;
@ -246,7 +178,15 @@ Number.prototype.pad = function (size)
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 = {
bands: {},
modes: {},
callMode: g_rosterSettings.callsign,
callMode: CR.rosterSettings.callsign,
onlyHits: false,
isAwardTracker: false,
now: timeNowSec()
@ -19,24 +19,24 @@ function prepareRosterSettings()
rosterSettings.callMode = "all";
rosterSettings.onlyHits = false;
rosterSettings.isAwardTracker = true;
g_rosterSettings.huntNeed = "confirmed";
CR.rosterSettings.huntNeed = "confirmed";
}
// 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
// be it's own function maybe?
rosterSettings.canMsg =
window.opener.g_mapSettings.offlineMode == false &&
window.opener.g_appSettings.gtShareEnable == true &&
window.opener.g_appSettings.gtMsgEnable == true;
window.opener.GT.mapSettings.offlineMode == false &&
window.opener.GT.appSettings.gtShareEnable == true &&
window.opener.GT.appSettings.gtMsgEnable == true;
// The following 3 sections deal with QSLing, do we break them out
// individually or lump them into a qslUser function that sets
// all three at the same time?
// 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 = "";
if (g_rosterSettings.usesLoTW == true)
if (CR.rosterSettings.usesLoTW == true)
{
maxLoTW.style.display = "";
maxLoTWView.style.display = "";
@ -54,22 +54,22 @@ function prepareRosterSettings()
maxLoTWView.style.display = "none";
}
if (g_rosterSettings.huntNeed == "mixed")
if (CR.rosterSettings.huntNeed == "mixed")
{
rosterSettings.huntIndex = g_confirmed;
rosterSettings.workedIndex = g_worked;
rosterSettings.layeredMode = LAYERED_MODE_FOR[String(g_rosterSettings.reference)];
rosterSettings.huntIndex = CR.confirmed;
rosterSettings.workedIndex = CR.worked;
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.layeredMode = false;
}
else if (g_rosterSettings.huntNeed == "confirmed")
else if (CR.rosterSettings.huntNeed == "confirmed")
{
rosterSettings.huntIndex = g_confirmed;
rosterSettings.workedIndex = g_worked;
rosterSettings.huntIndex = CR.confirmed;
rosterSettings.workedIndex = CR.worked;
rosterSettings.layeredMode = false;
}
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
for (const callHash in callRoster)
{
var entry = callRoster[callHash];
var callObj = entry.callObj;
var call = entry.DEcall;
let entry = callRoster[callHash];
let callObj = entry.callObj;
let call = entry.DEcall;
entry.tx = true;
callObj.shouldAlert = false;
@ -40,7 +40,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue;
}
if (rosterSettings.now - callObj.age > g_rosterSettings.rosterTime)
if (rosterSettings.now - callObj.age > CR.rosterSettings.rosterTime)
{
entry.tx = false;
entry.alerted = false;
@ -53,44 +53,44 @@ function processRosterFiltering(callRoster, rosterSettings)
entry.tx = false;
continue;
}
if (g_rosterSettings.noUnknownDXCC && callObj.dxcc === -1)
if (CR.rosterSettings.noUnknownDXCC && callObj.dxcc === -1)
{
entry.tx = false;
continue;
}
if (window.opener.g_instances[callObj.instance].crEnable == false)
if (window.opener.GT.instances[callObj.instance].crEnable == false)
{
entry.tx = false;
continue;
}
if (call in g_blockedCalls)
if (call in CR.blockedCalls)
{
entry.tx = false;
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;
continue;
}
if (callObj.ituz in g_blockedITUz)
if (callObj.ituz in CR.blockedITUz)
{
entry.tx = false;
continue;
}
if (callObj.cqz in g_blockedCQz)
if (callObj.cqz in CR.blockedCQz)
{
entry.tx = false;
continue;
}
if (callObj.dxcc in g_blockedDxcc)
if (callObj.dxcc in CR.blockedDxcc)
{
entry.tx = false;
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)
{
@ -104,10 +104,9 @@ function processRosterFiltering(callRoster, rosterSettings)
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
{
if (!call.match(regexObj))
@ -118,37 +117,37 @@ function processRosterFiltering(callRoster, rosterSettings)
}
catch (e) {}
}
if (g_rosterSettings.requireGrid == true && callObj.grid.length != 4)
if (CR.rosterSettings.requireGrid == true && callObj.grid.length != 4)
{
entry.tx = false;
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;
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;
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;
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;
continue;
}
if (g_rosterSettings.noMsg == true)
if (CR.rosterSettings.noMsg == true)
{
try
{
if (callObj.msg.match(g_rosterSettings.noMsgValue))
if (callObj.msg.match(CR.rosterSettings.noMsgValue))
{
entry.tx = false;
continue;
@ -156,11 +155,11 @@ function processRosterFiltering(callRoster, rosterSettings)
}
catch (e) {}
}
if (g_rosterSettings.onlyMsg == true)
if (CR.rosterSettings.onlyMsg == true)
{
try
{
if (!callObj.msg.match(g_rosterSettings.onlyMsgValue))
if (!callObj.msg.match(CR.rosterSettings.onlyMsgValue))
{
entry.tx = false;
continue;
@ -169,31 +168,31 @@ function processRosterFiltering(callRoster, rosterSettings)
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;
continue;
}
}
else if (g_rosterSettings.onlyMyDxcc == true)
else if (CR.rosterSettings.onlyMyDxcc == true)
{
entry.tx = false;
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;
continue;
}
if (g_rosterSettings.maxLoTW < 27)
if (CR.rosterSettings.maxLoTW < 27)
{
var months = (g_day - window.opener.g_lotwCallsigns[call]) / 30;
if (months > g_rosterSettings.maxLoTW)
let months = (CR.day - window.opener.GT.lotwCallsigns[call]) / 30;
if (months > CR.rosterSettings.maxLoTW)
{
entry.tx = false;
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;
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;
continue;
@ -221,28 +220,28 @@ function processRosterFiltering(callRoster, rosterSettings)
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;
continue;
}
var hash = hashMaker(call, callObj, g_rosterSettings.reference);
if (rosterSettings.callMode == "worked" && hash in g_worked.call)
let hash = hashMaker(call, callObj, CR.rosterSettings.reference);
if (rosterSettings.callMode == "worked" && hash in CR.worked.call)
{
entry.tx = false;
continue;
}
if (rosterSettings.callMode == "confirmed" && hash in g_confirmed.call)
if (rosterSettings.callMode == "confirmed" && hash in CR.confirmed.call)
{
entry.tx = false;
continue;
}
if (g_rosterSettings.hunting == "grid")
if (CR.rosterSettings.hunting == "grid")
{
var hash = hashMaker(callObj.grid.substr(0, 4),
callObj, g_rosterSettings.reference);
let hash = hashMaker(callObj.grid.substr(0, 4),
callObj, CR.rosterSettings.reference);
if (rosterSettings.huntIndex && hash in rosterSettings.huntIndex.grid)
{
entry.tx = false;
@ -255,9 +254,9 @@ function processRosterFiltering(callRoster, rosterSettings)
}
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))
{
@ -267,24 +266,24 @@ function processRosterFiltering(callRoster, rosterSettings)
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;
continue;
}
}
if (g_rosterSettings.hunting == "wpx")
if (CR.rosterSettings.hunting == "wpx")
{
if (String(callObj.px) == null)
{
entry.tx = false;
continue;
}
var hash = hashMaker(String(callObj.px),
callObj, g_rosterSettings.reference);
let hash = hashMaker(String(callObj.px),
callObj, CR.rosterSettings.reference);
if (rosterSettings.huntIndex && (hash in rosterSettings.huntIndex.px))
{
@ -295,7 +294,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue;
}
if (g_rosterSettings.hunting == "cq")
if (CR.rosterSettings.hunting == "cq")
{
if (callObj.cqz == null || !rosterSettings.huntIndex)
{
@ -303,7 +302,7 @@ function processRosterFiltering(callRoster, rosterSettings)
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)
{
@ -314,7 +313,7 @@ function processRosterFiltering(callRoster, rosterSettings)
continue;
}
if (g_rosterSettings.hunting == "itu")
if (CR.rosterSettings.hunting == "itu")
{
if (callObj.ituz == null || !rosterSettings.huntIndex)
{
@ -322,7 +321,7 @@ function processRosterFiltering(callRoster, rosterSettings)
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)
{
@ -333,15 +332,15 @@ function processRosterFiltering(callRoster, rosterSettings)
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;
var finalDxcc = callObj.dxcc;
let state = callObj.state;
let finalDxcc = callObj.dxcc;
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)
{
@ -356,9 +355,9 @@ function processRosterFiltering(callRoster, rosterSettings)
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
}
@ -373,26 +372,26 @@ function processRosterFiltering(callRoster, rosterSettings)
if (rosterSettings.isAwardTracker)
{
var tx = false;
var baseHash = hashMaker("", callObj, g_rosterSettings.reference);
let tx = false;
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);
if (tx)
{
var x = g_awardTracker[award];
let x = CR.awardTracker[award];
// 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;
break;
}
}
}
let didWork = (baseHash in g_worked.call);
let didWork = (baseHash in CR.worked.call);
if (allOnlyNew.checked && didWork && !callObj.qrz)
{
callObj.shouldAlert = false;

Wyświetl plik

@ -15,7 +15,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
const currentYear = new Date().getFullYear();
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,
// 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)
{
// 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
// 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
if ((!(entry.DEcall in g_blockedCalls) && !(callObj.dxcc in g_blockedDxcc)) ||
window.opener.g_instances[callObj.instance].status.DXcall == entry.DEcall)
if ((!(entry.DEcall in CR.blockedCalls) && !(callObj.dxcc in CR.blockedDxcc)) ||
window.opener.GT.instances[callObj.instance].status.DXcall == entry.DEcall)
{
entry.tx = true;
}
@ -52,11 +52,11 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
if (rosterSettings.layeredMode)
{
workHashSuffix = hashMaker("", callObj, rosterSettings.layeredMode);
layeredHashSuffix = hashMaker("", callObj, g_rosterSettings.reference);
layeredHashSuffix = hashMaker("", callObj, CR.rosterSettings.reference);
}
else
{
workHashSuffix = hashMaker("", callObj, g_rosterSettings.reference);
workHashSuffix = hashMaker("", callObj, CR.rosterSettings.reference);
layeredHashSuffix = false
}
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)
// 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;
didWork = true;
callConf = `${unconf}${call}${inversionAlpha};`;
if (hash in g_confirmed.call)
if (hash in CR.confirmed.call)
{
callObj.callFlags.confirmed = true;
callPointer = "text-decoration: line-through; ";
@ -117,12 +117,12 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
}
// Calls that have OAMS chat support
if (callsign in window.opener.g_gtCallsigns)
if (callsign in window.opener.GT.gtCallsigns)
{
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
callObj.callFlags.oams = true;
@ -157,9 +157,9 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
}
// 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.style.call = "class='dxCalling'";
@ -182,7 +182,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
px: false,
cont: false
};
if (g_rosterSettings.reference == LOGBOOK_AWARD_TRACKER)
if (CR.rosterSettings.reference == LOGBOOK_AWARD_TRACKER)
{
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
{
if (callsign.match(huntRegexObj))
@ -410,13 +410,13 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
}
// 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 finalDxcc = callObj.dxcc;
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 layeredHash = rosterSettings.layeredMode && (stateSearch + layeredHashSuffix)
@ -467,7 +467,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
}
// 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;
if (
@ -482,7 +482,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
{
if (callObj.qual == false)
{
let counties = window.opener.g_zipToCounty[callObj.zipcode];
let counties = window.opener.GT.zipToCounty[callObj.zipcode];
let foundHit = false;
for (const cnt in counties)
{
@ -527,7 +527,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
let huntTotal = 1;
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++;
@ -782,12 +782,12 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
callingBg = "#0000FF" + inversionAlpha;
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;
calling = bold;
// 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};`;
calling = `#90EE90${inversionAlpha};`
@ -822,7 +822,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
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);
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
g_isCompactCounty = false;
CR.isCompactCounty = false;
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()'>";
}
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();
var bandView = showBand ? "<div style='color: #" + window.opener.g_pskColors[callObj.band] + ";float:right;display:inline-block;'>" + callObj.band + "</div>" : "";
if (g_rosterSettings.compactEntity == "Band")
let title = callObj.RSTsent + "&#13256;, " + parseInt(callObj.dt * 100) + "ms, " + callObj.delta + "hz" + (callObj.grid.length ? ", " + callObj.grid : "") + ", " + toDHMS(timeNowSec() - callObj.age);
let bandView = showBand ? "<div style='color: #" + window.opener.GT.pskColors[callObj.band] + ";float:right;display:inline-block;'>" + callObj.band + "</div>" : "";
if (CR.rosterSettings.compactEntity == "Band")
{
bandView = "";
}
var onClick = " onClick='initiateQso(\"" + callObj.hash + "\")' id='" + callObj.hash + "' title='" + title + "' ";
var wholeClick = (g_isCompactCounty ? "" : onClick);
var callsignClick = (g_isCompactCounty ? onClick : "");
var worker = "<div class='compact' " + wholeClick + " >";
worker += "<div class='compactCallsign' " + callsignClick + " name='Callsign' " + callObj.style.call + " >" + callObj.DEcall.formatCallsign() + bandView + "</div>";
let onClick = " onClick='initiateQso(\"" + callObj.hash + "\")' id='" + callObj.hash + "' title='" + title + "' ";
let wholeClick = (CR.isCompactCounty ? "" : onClick);
let callsignClick = (CR.isCompactCounty ? onClick : "");
let worker = "<div class='compact' " + wholeClick + " >";
worker += "<div class='compactCallsign' " + callsignClick + " name='Callsign' " + callObj.style.call + " >" + formatCallsign(callObj.DEcall) + bandView + "</div>";
worker += "<div class='compactData'>";
worker += renderEntryForColumn(g_rosterSettings.compactEntity, callObj, "div");
worker += renderEntryForColumn(CR.rosterSettings.compactEntity, callObj, "div");
worker += "</div></div>";
return worker;
}

Wyświetl plik

@ -4,7 +4,7 @@ function renderRoster(callRoster, rosterSettings)
Callsign: true
}
if (window.opener.g_callsignLookups.eqslUseEnable == true)
if (window.opener.GT.callsignLookups.eqslUseEnable == true)
{
useseQSLDiv.style.display = "";
}
@ -14,7 +14,7 @@ function renderRoster(callRoster, rosterSettings)
useseQSLDiv.style.display = "none";
}
if (window.opener.g_callsignLookups.oqrsUseEnable == true)
if (window.opener.GT.callsignLookups.oqrsUseEnable == true)
{
usesOQRSDiv.style.display = "";
}
@ -24,7 +24,7 @@ function renderRoster(callRoster, rosterSettings)
usesOQRSDiv.style.display = "none";
}
if (window.opener.g_callsignLookups.lotwUseEnable == true)
if (window.opener.GT.callsignLookups.lotwUseEnable == true)
{
// Do nothing
}
@ -43,7 +43,7 @@ function renderRoster(callRoster, rosterSettings)
columnOverrides.OAMS = false;
}
if (window.opener.g_appSettings.potaEnabled === 1)
if (window.opener.GT.appSettings.potaEnabled === 1)
{
huntingMatrixPotaDiv.style.display = "";
}
@ -58,7 +58,7 @@ function renderRoster(callRoster, rosterSettings)
columnOverrides.Wanted = true;
}
// 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";
// callmode (all or only new)
@ -104,23 +104,23 @@ function renderRoster(callRoster, rosterSettings)
multiInstance = true;
}
let multiBand = Object.keys(rosterSettings.bands).length > 1;
let showBands = multiBand || g_rosterSettings.columns.Band;
let showModes = (Object.keys(rosterSettings.modes).length > 1) || g_rosterSettings.columns.Mode;
let showBands = multiBand || CR.rosterSettings.columns.Band;
let showModes = (Object.keys(rosterSettings.modes).length > 1) || CR.rosterSettings.columns.Mode;
columnOverrides.Band = showBands;
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);
}
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
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+)?$"))
{ 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'";
}
@ -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;
}

Wyświetl plik

@ -1,6 +1,6 @@
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)
})
@ -21,9 +21,9 @@ function renderHeaderForColumn(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)
@ -53,14 +53,14 @@ function renderRosterTableHTML(tag, attrs)
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
{
g_rosterSettings.sortColumn = column
g_rosterSettings.sortReverse = false
CR.rosterSettings.sortColumn = column
CR.rosterSettings.sortReverse = false
}
writeRosterSettings();
@ -124,14 +124,14 @@ function validateRosterColumnOrder(columns)
function changeRosterColumnOrder(columns)
{
g_rosterSettings.columnOrder = validateRosterColumnOrder(columns);
CR.rosterSettings.columnOrder = validateRosterColumnOrder(columns);
writeRosterSettings();
window.opener.goProcessRoster();
}
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);
if (pos > 1)
{

Wyświetl plik

@ -60,10 +60,10 @@ const ROSTER_COLUMNS = {
align: "left",
onClick: `initiateQso("${callObj.hash}")`,
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])
{
attrs.html = `${attrs.html} <span class='acknowledged'><img class='ackBadge' src='${acks[callObj.DEcall].badge}'></span>`
@ -77,7 +77,7 @@ const ROSTER_COLUMNS = {
Band: {
compare: callObjSimpleComparer("band"),
tableData: (callObj) => ({
style: `color: #${window.opener.g_pskColors[callObj.band]};`,
style: `color: #${window.opener.GT.pskColors[callObj.band]};`,
html: callObj.band
})
},
@ -85,7 +85,7 @@ const ROSTER_COLUMNS = {
Mode: {
compare: callObjSimpleComparer("mode"),
tableData: (callObj) => ({
style: `color: #${g_modeColors[callObj.mode] || "888888"};`,
style: `color: #${CR.modeColors[callObj.mode] || "888888"};`,
html: callObj.mode
})
},
@ -104,7 +104,7 @@ const ROSTER_COLUMNS = {
tableData: (callObj) => ({
rawAttrs: callObj.style.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: {
compare: (a, b) => window.opener.myDxccCompare(a.callObj, b.callObj),
tableData: (callObj) => ({
title: window.opener.g_dxccInfo[callObj.dxcc].pp,
title: window.opener.GT.dxccInfo[callObj.dxcc].pp,
name: `DXCC (${callObj.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) => ({
align: "center",
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 = {
align: "center",
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)
{
attrs.title = $.i18n("rosterColumns.County.title")
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;"
}
return attrs
@ -243,17 +243,17 @@ const ROSTER_COLUMNS = {
compare: false,
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;
if (months > g_rosterSettings.maxLoTW)
let months = (CR.day - window.opener.GT.lotwCallsigns[callObj.DEcall]) / 30;
if (months > CR.rosterSettings.maxLoTW)
{
return {
style: "color: yellow;",
align: "center",
title: `${$.i18n("rosterColumns.LoTW.NoUpdate")} ${Number(months).toYM()}`,
title: `${$.i18n("rosterColumns.LoTW.NoUpdate")} ${toYM(Number(months))}`,
html: "?"
}
}
@ -263,7 +263,7 @@ const ROSTER_COLUMNS = {
style: "color: #0F0;",
align: "center",
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;"
}
@ -275,7 +275,7 @@ const ROSTER_COLUMNS = {
style: "color: #0F0;",
align: "center",
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;"
}
@ -295,7 +295,7 @@ const ROSTER_COLUMNS = {
tableData: (callObj) => ({
style: "color: #0F0;",
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) => ({
style: "color: #0F0;",
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;",
class: "lifeCol",
id: `lm${callObj.hash}`,
html: (timeNowSec() - callObj.life).toDHMS()
html: toDHMS(timeNowSec() - callObj.life)
})
},
@ -359,14 +359,14 @@ const ROSTER_COLUMNS = {
style: "color: #EEE;",
class: "timeCol",
id: `tm${callObj.hash}`,
html: (timeNowSec() - callObj.age).toDHMS()
html: toDHMS(timeNowSec() - callObj.age)
})
},
Spot: {
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 (b.callObj.spot.when <= cutoff) return 1;
@ -426,9 +426,9 @@ function potaColumnHover(callObj)
{
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;

Wyświetl plik

@ -1,36 +1,36 @@
function sendAlerts(callRoster, rosterSettings)
{
var dirPath = window.opener.g_scriptDir;
var scriptExists = false;
var script = "cr-alert.sh";
let dirPath = window.opener.GT.scriptDir;
let scriptExists = false;
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...
// if it's "not visible in the roster, don't put it in the report!"
if (callRoster[entry].tx == false) continue;
var call = callObj.DEcall;
g_scriptReport[call] = Object.assign({}, callObj);
g_scriptReport[call].dxccName = window.opener.g_dxccToAltName[callObj.dxcc];
g_scriptReport[call].distance = (callObj.distance > 0) ? parseInt(callObj.distance * MyCircle.validateRadius(window.opener.distanceUnit.value)) : 0;
let call = callObj.DEcall;
CR.scriptReport[call] = Object.assign({}, callObj);
CR.scriptReport[call].dxccName = window.opener.GT.dxccToAltName[callObj.dxcc];
CR.scriptReport[call].distance = (callObj.distance > 0) ? parseInt(callObj.distance * MyCircle.validateRadius(window.opener.distanceUnit.value)) : 0;
delete g_scriptReport[call].DEcall;
g_scriptReport[call].rect = null;
delete g_scriptReport[call].rect;
delete g_scriptReport[call].style;
delete g_scriptReport[call].wspr;
delete g_scriptReport[call].qso;
delete g_scriptReport[call].instance;
delete CR.scriptReport[call].DEcall;
CR.scriptReport[call].rect = null;
delete CR.scriptReport[call].rect;
delete CR.scriptReport[call].style;
delete CR.scriptReport[call].wspr;
delete CR.scriptReport[call].qso;
delete CR.scriptReport[call].instance;
if (rosterSettings.callMode != "all")
{
g_scriptReport[call].shouldAlert = true;
g_scriptReport[call].reason.push(g_rosterSettings.hunting);
CR.scriptReport[call].shouldAlert = true;
CR.scriptReport[call].reason.push(CR.rosterSettings.hunting);
}
if (callObj.alerted == false && rosterSettings.callMode == "all" && callObj.shouldAlert == true)
@ -52,7 +52,7 @@ function sendAlerts(callRoster, rosterSettings)
{
if (fs.existsSync(dirPath))
{
if (window.opener.g_platform == "windows")
if (window.opener.GT.platform == "windows")
{
script = "cr-alert.bat";
}
@ -61,7 +61,7 @@ function sendAlerts(callRoster, rosterSettings)
scriptExists = true;
scriptIcon.innerHTML =
"<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='yellow'>${$.i18n("sendAlerts.scriptDisabled")}</font>`) +
"</div>";
@ -77,12 +77,12 @@ function sendAlerts(callRoster, rosterSettings)
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")
{
var media = window.opener.huntRosterNotifyMedia.value;
let media = window.opener.huntRosterNotifyMedia.value;
if (media != "none") window.opener.playAlertMediaFile(media);
}
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
{
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;
var cp = require("child_process");
var child = cp.spawn(thisProc, [], {
let thisProc = dirPath + script;
let cp = require("child_process");
let child = cp.spawn(thisProc, [], {
detached: true,
cwd: dirPath.slice(0, -1),
stdio: ["ignore", "ignore", "ignore"]
@ -110,8 +110,8 @@ function sendAlerts(callRoster, rosterSettings)
{
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");
// GridTracker object
var GT = {};
// CallRoster object
var CR = {};
var isShowing = false;
var s_title = null;
var s_screenSettings = {};
var s_zoomLevel = 0;
@ -71,7 +78,7 @@ function saveScreenSettings()
{
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);
@ -83,14 +90,12 @@ function saveScreenSettings()
nw.Screen.on("displayAdded", screenCB.onDisplayAdded);
nw.Screen.on("displayRemoved", screenCB.onDisplayRemoved);
var g_isShowing = false;
nw.Window.get().on("loaded", function ()
{
// 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
s_title = document.title.substr(0, 12).trim();
g_isShowing = false;
isShowing = false;
if (typeof localStorage.screenSettings == "undefined")
{
localStorage.screenSettings = "{}";
@ -109,7 +114,7 @@ nw.Window.get().on("loaded", function ()
{
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;
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.
// 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();
}

Wyświetl plik

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

Wyświetl plik

@ -292,7 +292,7 @@ var dayNight = {
}),
stroke: null
}),
opacity: Number(g_mapSettings.shadow),
opacity: Number(GT.mapSettings.shadow),
zIndex: 0
});
this.map.getLayers().insertAt(1, this.vectorLayer);
@ -305,7 +305,7 @@ var dayNight = {
})
});
this.vectorLayer.setStyle(circleStyle);
this.vectorLayer.setOpacity(Number(g_mapSettings.shadow));
this.vectorLayer.setOpacity(Number(GT.mapSettings.shadow));
this.vectorSource.clear();
this.vectorSource.addFeature(
@ -313,7 +313,7 @@ var dayNight = {
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);
return arr.length > 0;
},
@ -422,10 +422,10 @@ var moonLayer = {
refresh: function ()
{
this.vectorSource.clear();
if (g_appSettings.moonTrack == 1)
if (GT.appSettings.moonTrack == 1)
{
now = timeNowSec();
if (g_appSettings.moonPath == 1)
if (GT.appSettings.moonPath == 1)
{ this.vectorSource.addFeature(this.future(now)); }
this.pin = iconFeature(
ol.proj.fromLonLat(subLunar(now).ll),

Wyświetl plik

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