kopia lustrzana https://gitlab.com/gridtracker.org/gridtracker
Code cleanup
rodzic
a91bdaf31f
commit
7a6403e7fe
|
@ -52,15 +52,14 @@
|
|||
event.preventDefault();
|
||||
});
|
||||
|
||||
function lockNewWindows() {
|
||||
if (typeof nw != "undefined") {
|
||||
var gui = require("nw.gui");
|
||||
var win = gui.Window.get();
|
||||
win.on("new-win-policy", function (frame, url, policy) {
|
||||
gui.Shell.openExternal(url);
|
||||
policy.ignore();
|
||||
});
|
||||
}
|
||||
function lockNewWindows()
|
||||
{
|
||||
var gui = require("nw.gui");
|
||||
var win = gui.Window.get();
|
||||
win.on("new-win-policy", function (frame, url, policy) {
|
||||
gui.Shell.openExternal(url);
|
||||
policy.ignore();
|
||||
});
|
||||
}
|
||||
|
||||
function timeNowSec() {
|
||||
|
|
|
@ -37,34 +37,39 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
function startLookup(call, grid) {
|
||||
function startLookup(call, grid)
|
||||
{
|
||||
window.opener.startLookup(call, grid);
|
||||
window.opener.focus();
|
||||
}
|
||||
|
||||
function lockNewWindows() {
|
||||
if (typeof nw != "undefined") {
|
||||
var gui = require("nw.gui");
|
||||
var win = gui.Window.get();
|
||||
win.on("new-win-policy", function (frame, url, policy) {
|
||||
gui.Shell.openExternal(url);
|
||||
policy.ignore();
|
||||
});
|
||||
}
|
||||
function lockNewWindows()
|
||||
{
|
||||
var gui = require("nw.gui");
|
||||
var win = gui.Window.get();
|
||||
win.on("new-win-policy", function (frame, url, policy)
|
||||
{
|
||||
gui.Shell.openExternal(url);
|
||||
policy.ignore();
|
||||
});
|
||||
}
|
||||
|
||||
function init() {
|
||||
function init()
|
||||
{
|
||||
lockNewWindows();
|
||||
|
||||
document.addEventListener("keydown", onMyKeyDown, false);
|
||||
}
|
||||
|
||||
function onMyKeyDown(event) {
|
||||
function onMyKeyDown(event)
|
||||
{
|
||||
window.opener.onMyKeyDown(event);
|
||||
}
|
||||
|
||||
document.oncontextmenu = function (event) {
|
||||
if (process.versions["nw-flavor"] != "sdk") {
|
||||
document.oncontextmenu = function (event)
|
||||
{
|
||||
if (process.versions["nw-flavor"] != "sdk")
|
||||
{
|
||||
ev.preventDefault();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ function dropHandler(ev)
|
|||
{
|
||||
// If dropped items aren't files, reject them
|
||||
Entry = ev.dataTransfer.items[i].webkitGetAsEntry();
|
||||
if (Entry && typeof Entry.isFile != "undefined" && Entry.isFile == true)
|
||||
if (Entry && "isFile" in Entry && Entry.isFile === true)
|
||||
{
|
||||
var filename = ev.dataTransfer.items[i].getAsFile().path;
|
||||
var test = filename.toLowerCase();
|
||||
|
@ -2622,25 +2622,22 @@ function sendQrzLogEntry(report)
|
|||
|
||||
if (logQRZqsoCheckBox.checked == true && ValidateQrzApi(qrzApiKey))
|
||||
{
|
||||
if (typeof nw != "undefined")
|
||||
{
|
||||
var postData = {
|
||||
KEY: qrzApiKey.value,
|
||||
ACTION: "INSERT",
|
||||
ADIF: report
|
||||
};
|
||||
getPostBuffer(
|
||||
"https://logbook.qrz.com/api",
|
||||
qrzSendLogResult,
|
||||
null,
|
||||
"https",
|
||||
443,
|
||||
postData,
|
||||
30000,
|
||||
postRetryErrorCallaback,
|
||||
"QRZ.com"
|
||||
);
|
||||
}
|
||||
var postData = {
|
||||
KEY: qrzApiKey.value,
|
||||
ACTION: "INSERT",
|
||||
ADIF: report
|
||||
};
|
||||
getPostBuffer(
|
||||
"https://logbook.qrz.com/api",
|
||||
qrzSendLogResult,
|
||||
null,
|
||||
"https",
|
||||
443,
|
||||
postData,
|
||||
30000,
|
||||
postRetryErrorCallaback,
|
||||
"QRZ.com"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2686,21 +2683,18 @@ function sendCloudlogEntry(report)
|
|||
|
||||
if (logCloudlogQSOCheckBox.checked == true)
|
||||
{
|
||||
if (typeof nw != "undefined")
|
||||
{
|
||||
var postData = { key: CloudlogAPI.value, station_profile_id: CloudlogStationProfileID.value, type: "adif", string: report };
|
||||
getPostJSONBuffer(
|
||||
CloudlogURL.value,
|
||||
CloudlogSendLogResult,
|
||||
null,
|
||||
"https",
|
||||
80,
|
||||
postData,
|
||||
10000,
|
||||
CloudUrlErrorCallback,
|
||||
"Failed to Send"
|
||||
);
|
||||
}
|
||||
var postData = { key: CloudlogAPI.value, station_profile_id: CloudlogStationProfileID.value, type: "adif", string: report };
|
||||
getPostJSONBuffer(
|
||||
CloudlogURL.value,
|
||||
CloudlogSendLogResult,
|
||||
null,
|
||||
"https",
|
||||
80,
|
||||
postData,
|
||||
10000,
|
||||
CloudUrlErrorCallback,
|
||||
"Failed to Send"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2760,21 +2754,18 @@ function hrdCredentialTest(test)
|
|||
{
|
||||
HRDLogTestResult.innerHTML = "Testing";
|
||||
|
||||
if (typeof nw != "undefined")
|
||||
{
|
||||
var postData = {
|
||||
Callsign: HRDLOGCallsign.value,
|
||||
Code: HRDLOGUploadCode.value
|
||||
};
|
||||
getPostBuffer(
|
||||
"https://www.hrdlog.net/NewEntry.aspx",
|
||||
hrdSendLogResult,
|
||||
test,
|
||||
"https",
|
||||
443,
|
||||
postData
|
||||
);
|
||||
}
|
||||
var postData = {
|
||||
Callsign: HRDLOGCallsign.value,
|
||||
Code: HRDLOGUploadCode.value
|
||||
};
|
||||
getPostBuffer(
|
||||
"https://www.hrdlog.net/NewEntry.aspx",
|
||||
hrdSendLogResult,
|
||||
test,
|
||||
"https",
|
||||
443,
|
||||
postData
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2784,21 +2775,18 @@ function ClublogTest(test)
|
|||
{
|
||||
CloudlogTestResult.innerHTML = "Testing";
|
||||
|
||||
if (typeof nw != "undefined")
|
||||
{
|
||||
var postData = { key: CloudlogAPI.value, type: "adif", string: "<eor>" };
|
||||
getPostJSONBuffer(
|
||||
CloudlogURL.value,
|
||||
CloudlogSendLogResult,
|
||||
test,
|
||||
"https",
|
||||
80,
|
||||
postData,
|
||||
10000,
|
||||
CloudUrlErrorCallback,
|
||||
"No Response<br/>or</br>Timeout"
|
||||
);
|
||||
}
|
||||
var postData = { key: CloudlogAPI.value, type: "adif", string: "<eor>" };
|
||||
getPostJSONBuffer(
|
||||
CloudlogURL.value,
|
||||
CloudlogSendLogResult,
|
||||
test,
|
||||
"https",
|
||||
80,
|
||||
postData,
|
||||
10000,
|
||||
CloudUrlErrorCallback,
|
||||
"No Response<br/>or</br>Timeout"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -603,7 +603,9 @@ function getChunkedBuffer(file_url, callback, flag, mode, port, cookie, errorHan
|
|||
var fread = 0;
|
||||
var cookies = null;
|
||||
if (typeof res.headers["set-cookie"] != "undefined")
|
||||
{ cookies = res.headers["set-cookie"]; }
|
||||
{
|
||||
cookies = res.headers["set-cookie"];
|
||||
}
|
||||
res
|
||||
.on("data", function (data)
|
||||
{
|
||||
|
@ -694,8 +696,7 @@ function processulsCallsigns(data, flag, cookies, starting, finished)
|
|||
[],
|
||||
function (rx, results)
|
||||
{
|
||||
var len = results.rows.length,
|
||||
i;
|
||||
var len = results.rows.length;
|
||||
if (len == 1)
|
||||
{
|
||||
ulsCountTd.innerHTML = results.rows[0].cnt;
|
||||
|
|
|
@ -194,7 +194,7 @@ var g_myLon = g_mapSettings.longitude;
|
|||
function loadDefaultsAndMerge(key, def)
|
||||
{
|
||||
var settings = {};
|
||||
if (typeof localStorage[key] != "undefined")
|
||||
if (key in localStorage)
|
||||
{
|
||||
settings = JSON.parse(localStorage[key]);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ function loadDefaultsAndMerge(key, def)
|
|||
function loadArrayIfExists(key)
|
||||
{
|
||||
var data = [];
|
||||
if (typeof localStorage[key] != "undefined")
|
||||
if (key in localStorage)
|
||||
{
|
||||
data = JSON.parse(localStorage[key]);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ function loadArrayIfExists(key)
|
|||
function loadObjectIfExists(key)
|
||||
{
|
||||
var data = {};
|
||||
if (typeof localStorage[key] != "undefined")
|
||||
if (key in localStorage)
|
||||
{
|
||||
data = JSON.parse(localStorage[key]);
|
||||
}
|
||||
|
@ -1732,7 +1732,7 @@ function changePathWidth()
|
|||
|
||||
if (width == 0)
|
||||
{
|
||||
if (typeof g_flightPaths[i].Arrow != "undefined") { g_layerSources.flight.removeFeature(g_flightPaths[i].Arrow); }
|
||||
if ("Arrow" in g_flightPaths[i]) { g_layerSources.flight.removeFeature(g_flightPaths[i].Arrow); }
|
||||
g_layerSources.flight.removeFeature(g_flightPaths[i]);
|
||||
delete g_flightPaths[i];
|
||||
g_flightPaths[i] = null;
|
||||
|
@ -1748,7 +1748,7 @@ function changePathWidth()
|
|||
featureStyle.setStroke(featureStroke);
|
||||
g_flightPaths[i].setStyle(featureStyle);
|
||||
|
||||
if (typeof g_flightPaths[i].Arrow != "undefined")
|
||||
if ("Arrow" in g_flightPaths[i])
|
||||
{
|
||||
var stroke = new ol.style.Stroke({
|
||||
color: color,
|
||||
|
@ -1780,7 +1780,7 @@ function changePathWidth()
|
|||
featureStyle.setStroke(featureStroke);
|
||||
g_transmitFlightPath.setStyle(featureStyle);
|
||||
|
||||
if (typeof g_transmitFlightPath.Arrow != "undefined")
|
||||
if ("Arrow" in g_transmitFlightPath)
|
||||
{
|
||||
var stroke = new ol.style.Stroke({
|
||||
color: getQrzPathColor(),
|
||||
|
@ -15651,39 +15651,28 @@ function pskSpotResults(buffer, flag)
|
|||
if (oDOM != null)
|
||||
{
|
||||
var json = XML2jsobj(oDOM.documentElement);
|
||||
if (typeof json.lastSequenceNumber != "undefined")
|
||||
if ("lastSequenceNumber" in json)
|
||||
{
|
||||
g_receptionReports.lastSequenceNumber = json.lastSequenceNumber.value;
|
||||
|
||||
if (typeof json.receptionReport != "undefined")
|
||||
if ("receptionReport" in json)
|
||||
{
|
||||
for (var key in json.receptionReport)
|
||||
for (const key in json.receptionReport)
|
||||
{
|
||||
if (
|
||||
typeof json.receptionReport[key].frequency != "undefined" &&
|
||||
typeof json.receptionReport[key].sNR != "undefined"
|
||||
)
|
||||
if ("frequency" in json.receptionReport[key] && "sNR" in json.receptionReport[key])
|
||||
{
|
||||
var report;
|
||||
var call = json.receptionReport[key].receiverCallsign;
|
||||
var mode = json.receptionReport[key].mode;
|
||||
var grid = json.receptionReport[key].receiverLocator.substr(0, 6);
|
||||
if (grid.length < 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var band = Number(
|
||||
parseInt(json.receptionReport[key].frequency) / 1000000
|
||||
).formatBand();
|
||||
if (grid.length < 4) { continue; }
|
||||
var band = Number(parseInt(json.receptionReport[key].frequency) / 1000000).formatBand();
|
||||
var hash = call + mode + band + grid.substr(0, 4);
|
||||
|
||||
if (hash in g_receptionReports.spots)
|
||||
{
|
||||
report = g_receptionReports.spots[hash];
|
||||
if (
|
||||
parseInt(json.receptionReport[key].flowStartSeconds) <
|
||||
report.when
|
||||
) { continue; }
|
||||
if (parseInt(json.receptionReport[key].flowStartSeconds) < report.when) { continue; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -15693,13 +15682,9 @@ function pskSpotResults(buffer, flag)
|
|||
report.grid = grid.toUpperCase();
|
||||
report.mode = mode;
|
||||
}
|
||||
if (
|
||||
typeof json.receptionReport[key].receiverCallsign != "undefined"
|
||||
)
|
||||
if ("receiverCallsign" in json.receptionReport[key])
|
||||
{
|
||||
report.dxcc = callsignToDxcc(
|
||||
json.receptionReport[key].receiverCallsign
|
||||
);
|
||||
report.dxcc = callsignToDxcc(json.receptionReport[key].receiverCallsign);
|
||||
}
|
||||
else report.dxcc = -1;
|
||||
report.when = parseInt(json.receptionReport[key].flowStartSeconds);
|
||||
|
|
Ładowanie…
Reference in New Issue