From 4c8db9fa508ad8f56aad0c0247eb99fae91c9b82 Mon Sep 17 00:00:00 2001 From: Sebastian Delmont Date: Sun, 13 Dec 2020 20:30:10 -0500 Subject: [PATCH] Manual cleanup of a few issues detected by eslint --- package.nw/lib/adif.js | 41 +- package.nw/lib/alerts.js | 8 +- package.nw/lib/callsigns.js | 17 +- package.nw/lib/gt.js | 846 +++++++++++++++++------------------- package.nw/lib/gtws.js | 31 +- package.nw/lib/roster.js | 227 +++++----- 6 files changed, 562 insertions(+), 608 deletions(-) diff --git a/package.nw/lib/adif.js b/package.nw/lib/adif.js index a4d2bf74..478fb9a4 100644 --- a/package.nw/lib/adif.js +++ b/package.nw/lib/adif.js @@ -48,7 +48,6 @@ function findAdiField(row, field) { var newLen = newLenSearch[0]; value = secondSplitArray[1].slice(0, newLen); } - delete secondSplitArray; } return value; } @@ -369,10 +368,6 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { } } - delete rawAdiBuffer; - - delete activeAdifArray; - redrawGrids(); updateCountStats(); updateLogbook(); @@ -591,7 +586,6 @@ function qrzCallback(buffer, flag) { tryToWriteAdifToDocFolder("qrz.adif", htmlString); onAdiLoadComplete(htmlString, true, "qrz.adif", true); - delete htmlString; } } } @@ -1111,14 +1105,13 @@ function getABuffer( let fileBuffer = null; let options = null; - { - options = { - host: url.parse(file_url).host, - port: port, - path: url.parse(file_url).path, - method: "get", - }; - } + options = { + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api + port: port, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api + method: "get" + }; + if (typeof stringOfFlag != "undefined") window[stringOfFlag] = true; if (typeof imgToGray != "undefined") { imgToGray.parentNode.style.background = @@ -1209,9 +1202,9 @@ function getAPostBuffer( var fileBuffer = null; var options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api method: "post", headers: { "Content-Type": "application/x-www-form-urlencoded", @@ -1277,7 +1270,7 @@ function getAPostBuffer( }); }); - req.on("error", function (err) { + req.on("error", function (err) { // eslint-disable-line node/handle-callback-err window[stringOfFlag] = false; if (typeof imgToGray != "undefined") { imgToGray.parentNode.style.background = ""; @@ -1292,7 +1285,7 @@ function getAPostBuffer( function sendUdpMessage(msg, length, port, address) { var dgram = require("dgram"); var socket = dgram.createSocket({ type: "udp4", reuseAddr: true }); - socket.send(msg, 0, length, port, address, (err) => { + socket.send(msg, 0, length, port, address, (err) => { // eslint-disable-line node/handle-callback-err socket.close(); }); } @@ -1897,7 +1890,7 @@ function sendLotwLogEntry(report) { child_process.execFile( g_trustedQslSettings.binaryFile, options, - (error, stdout, stderr) => { + (error, stdout, stderr) => { // eslint-disable-line node/handle-callback-err if (stderr.indexOf("Final Status: Success") < 0) { alert(stderr); addLastTraffic("Fail log to TQSL"); @@ -2235,13 +2228,13 @@ function getPostJSONBuffer( try { var postData = JSON.stringify(theData); var url = require("url"); - var protocol = url.parse(file_url).protocol; + var protocol = url.parse(file_url).protocol; // eslint-disable-line node/no-deprecated-api var http = require(protocol.replace(":", "")); var fileBuffer = null; var options = { - host: url.parse(file_url).hostname, - port: url.parse(file_url).port, - path: url.parse(file_url).path, + host: url.parse(file_url).hostname, // eslint-disable-line node/no-deprecated-api + port: url.parse(file_url).port, // eslint-disable-line node/no-deprecated-api + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api method: "post", headers: { "Content-Type": "application/json", @@ -2273,7 +2266,7 @@ function getPostJSONBuffer( req.abort(); }); }); - req.on("error", function (err) { + req.on("error", function (err) { // eslint-disable-line node/handle-callback-err if (typeof timeoutCallback != "undefined") timeoutCallback( file_url, diff --git a/package.nw/lib/alerts.js b/package.nw/lib/alerts.js index 00396fb2..7cfb1f01 100644 --- a/package.nw/lib/alerts.js +++ b/package.nw/lib/alerts.js @@ -332,7 +332,6 @@ function addNewAlert() { valid = ValidateCallsign(alertValueInput, null); if (!valid) { error = "Invalid Callsign"; - } else { } } } @@ -391,10 +390,11 @@ function resetAlert(key) { } function processAlertMessage(decodeWords, message, band, mode) { - if (Object.keys(g_alerts).length == 0) + if (Object.keys(g_alerts).length == 0) { // no alerts, don't bother return false; - + } + else { var CQ = false; var validQTH = false; @@ -439,7 +439,7 @@ function processAlertMessage(decodeWords, message, band, mode) { msgDEcallsign = decodeWords[1]; } - var okayToAlert = true; + var okayToAlert = true; if (msgDEcallsign + band + mode in g_liveCallsigns) found_callsign = g_liveCallsigns[msgDEcallsign + band + mode]; diff --git a/package.nw/lib/callsigns.js b/package.nw/lib/callsigns.js index 3d9ab254..fcb0ec82 100644 --- a/package.nw/lib/callsigns.js +++ b/package.nw/lib/callsigns.js @@ -142,7 +142,7 @@ function processLotwCallsigns(result, flag) { //var result = String(buffer); var lines = Array(); lines = result.split("\n"); - delete result; + var lotwCallsigns = Object(); for (x in lines) { var breakout = lines[x].split(","); @@ -160,7 +160,7 @@ function processLotwCallsigns(result, flag) { lotwCallsigns[breakout[0]] = parseInt(dateTime.getTime() / 1000) / 86400; } } - delete lines; + g_callsignLookups.lotwLastUpdate = timeNowSec(); var now = timeNowSec(); @@ -472,20 +472,20 @@ function getChunkedBuffer( var options = null; if (cookie != null) { options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, followAllRedirects: true, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api headers: { Cookie: cookie, }, }; } else { options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, followAllRedirects: true, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api }; } http.get(options, function (res) { @@ -502,7 +502,7 @@ function getChunkedBuffer( if (fileBuffer == null) { fileBuffer = callback(data, flag, cookies, true, isEnd); } else { - fileBuffer = callback(fileBuffer + data, flag, cookies, false, isEnd); + fileBuffer = callback(fileBuffer + data, flag, cookies, false, isEnd); // eslint-disable-line node/no-callback-literal } }) .on("end", function () {}) @@ -584,7 +584,6 @@ function processulsCallsigns(data, flag, cookies, starting, finished) { } } } - delete lines; lines = null; }); } @@ -619,7 +618,7 @@ function processulsCallsigns(data, flag, cookies, starting, finished) { }); } - return Buffer(returnBuffer); + return Buffer(returnBuffer); // eslint-disable-line node/no-deprecated-api } function lookupUsCallsign(object, writeState = false) { diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index 7508bb6b..18eeadea 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -288,15 +288,13 @@ function clearAndReload() { chrome.runtime.reload(); } -{ - win.hide(); +win.hide(); - win.on("close", function () { - saveAndCloseApp(); - }); - win.show(); - win.setMinimumSize(200, 600); -} +win.on("close", function () { + saveAndCloseApp(); +}); +win.show(); +win.setMinimumSize(200, 600); var g_wsjtxProcessRunning = false; var g_jtdxProcessRunning = false; @@ -1487,7 +1485,6 @@ function changePathWidth() { if (qrzPathWidthValue.value == 0) { g_layerSources["transmit"].clear(); - delete g_transmitFlightPath; g_transmitFlightPath = null; } else { featureStroke.setWidth(qrzPathWidthValue.value); @@ -2246,7 +2243,6 @@ function tempGridToBox(iQTH, oldGrid, borderColor, boxColor, layer) { if (oldGrid) { if (g_layerSources["temp"].hasFeature(oldGrid)) g_layerSources["temp"].removeFeature(oldGrid); - delete oldGrid; } var bounds = [ [LL.lo1, LL.la1], @@ -3137,8 +3133,6 @@ function mouseUpGrid() { g_layerSources["temp"].removeFeature(g_tempGridBox); } - delete g_tempGridBox; - g_tempGridBox = null; } @@ -4536,7 +4530,6 @@ function setStrikeDistance() { try { g_strikeWebSocket.send(send); } catch (e) { - delete g_strikeWebSocket; g_strikeWebSocket = null; } } else { @@ -4642,17 +4635,14 @@ function loadStrikes() { addLastTraffic(worker); } } - delete Strikes; delete evt.data; }; g_strikeWebSocket.onerror = function () { - delete g_strikeWebSocket; g_strikeWebSocket = null; }; g_strikeWebSocket.onclose = function () { - delete g_strikeWebSocket; g_strikeWebSocket = null; }; } @@ -4988,7 +4978,6 @@ function toggleNexrad() { if (g_nexradEnable == 1) { if (g_Nexrad != null) { g_map.removeLayer(g_Nexrad); - delete g_Nexrad; } g_Nexrad = createNexRad(); @@ -5003,7 +4992,6 @@ function toggleNexrad() { } if (g_Nexrad) { g_map.removeLayer(g_Nexrad); - delete g_Nexrad; g_Nexrad = null; } } @@ -5842,8 +5830,6 @@ function fitViewBetweenPoints(points, maxZoom = 20) { padding: [75, 75, 75, 75], }); - delete feature; - delete line; } var g_spotCollector = {}; @@ -6293,7 +6279,6 @@ function handleWsjtxDecode(newMessage) { if (dxcc != -1) { locality = g_worldGeoData[g_dxccToGeoData[dxcc]].geo; if (locality == "deleted") locality = null; - } else { } } @@ -6827,8 +6812,8 @@ function myDxccCompare(a, b) { } function myDxccIntCompare(a, b) { - if (!a in g_dxccToAltName) return 0; - if (!b in g_dxccToAltName) + if (!(a in g_dxccToAltName)) return 0; + if (!(b in g_dxccToAltName)) return g_dxccToAltName[a].localeCompare(g_dxccToAltName[b]); } @@ -7059,253 +7044,253 @@ function showWorkedBox(sortIndex, nextPage, redraw) { var startIndex = g_qsoPage * g_qsoItemsPerPage; var endIndex = startIndex + g_qsoItemsPerPage; if (endIndex > ObjectCount) endIndex = ObjectCount; - { - var workHead = " Entries (" + ObjectCount + ")"; - if (g_qsoPages > 1) { - workHead += - "
⇦ "; - workHead += - " Page " + - (g_qsoPage + 1) + - " of " + - g_qsoPages + - " (" + - (endIndex - startIndex) + - ") "; - workHead += - " ⇨"; - } - setStatsDiv("workedHeadDiv", workHead); + var workHead = " Entries (" + ObjectCount + ")"; - if (myObjects != null) { - var worker = ""; - worker += - ""; - worker += ""; - worker += - ""; - worker += - ""; - worker += ""; - worker += ""; - worker += ""; - worker += ""; - worker += ""; - worker += ""; - worker += " "; - worker += - ""; - worker += - ""; - worker += - ""; - worker += - ""; - worker += - ""; - worker += ""; - worker += ""; - worker += - ""; - worker += - ""; - worker += - ""; - if (g_callsignLookups.lotwUseEnable == true) worker += ""; - if (g_callsignLookups.eqslUseEnable == true) worker += ""; - if (g_callsignLookups.oqrsUseEnable == true) worker += ""; - worker += ""; - - var key = null; - for (var i = startIndex; i < endIndex; i++) { - key = list[i]; - worker += - ""; - worker += - ""; - worker += ""; - worker += ""; - worker += - ""; - worker += ""; - worker += ""; - worker += - ""; - worker += - ""; - worker += - ""; - if (g_callsignLookups.lotwUseEnable == true) - worker += - ""; - if (g_callsignLookups.eqslUseEnable == true) - worker += - ""; - if (g_callsignLookups.oqrsUseEnable == true) - worker += - ""; - worker += ""; - } - - worker += "
StationGridBandModeQSLSentRcvdDXCCFlagWhenLoTWeQSLOQRS
" + - key.DEcall.formatCallsign() + - "" + - key.grid + - (key.vucc_grids.length ? ", " + key.vucc_grids.join(", ") : "") + - "" + key.band + "" + key.mode + "" + (key.confirmed ? "✔" : "") + "" + key.RSTsent + "" + key.RSTrecv + "" + - g_dxccToAltName[key.dxcc] + - " (" + - (g_dxccToGeoData[key.dxcc] in g_worldGeoData - ? g_worldGeoData[g_dxccToGeoData[key.dxcc]].pp - : "?") + - ")" + - userTimeString(key.time * 1000) + - "" + - (key.DEcall in g_lotwCallsigns ? "✔" : "") + - "" + - (key.DEcall in g_eqslCallsigns ? "✔" : "") + - "" + - (key.DEcall in g_oqrsCallsigns ? "✔" : "") + - "
"; - - setStatsDiv("workedListDiv", worker); - - statsValidateCallByElement("searchWB"); - statsValidateCallByElement("searchGrid"); - - var newSelect = document.createElement("select"); - newSelect.id = "bandFilter"; - newSelect.title = "Band Filter"; - var option = document.createElement("option"); - option.value = "Mixed"; - option.text = "Mixed"; - newSelect.appendChild(option); - Object.keys(bands) - .sort(function (a, b) { - return parseInt(a) - parseInt(b); - }) - .forEach(function (key) { - var option = document.createElement("option"); - option.value = key; - option.text = key; - newSelect.appendChild(option); - }); - statsAppendChild( - "bandFilterDiv", - newSelect, - "filterBandFunction", - g_filterBand, - true - ); - - newSelect = document.createElement("select"); - newSelect.id = "modeFilter"; - newSelect.title = "Mode Filter"; - option = document.createElement("option"); - option.value = "Mixed"; - option.text = "Mixed"; - newSelect.appendChild(option); - - option = document.createElement("option"); - option.value = "Phone"; - option.text = "Phone"; - newSelect.appendChild(option); - - option = document.createElement("option"); - option.value = "Digital"; - option.text = "Digital"; - newSelect.appendChild(option); - - Object.keys(modes) - .sort() - .forEach(function (key) { - var option = document.createElement("option"); - option.value = key; - option.text = key; - newSelect.appendChild(option); - }); - - statsAppendChild( - "modeFilterDiv", - newSelect, - "filterModeFunction", - g_filterMode, - true - ); - - newSelect = document.createElement("select"); - newSelect.id = "dxccFilter"; - newSelect.title = "DXCC Filter"; - option = document.createElement("option"); - option.value = 0; - option.text = "All"; - newSelect.appendChild(option); - - Object.keys(dxccs) - .sort() - .forEach(function (key) { - var option = document.createElement("option"); - option.value = dxccs[key]; - option.text = key; - newSelect.appendChild(option); - }); - - statsAppendChild( - "dxccFilterDiv", - newSelect, - "filterDxccFunction", - g_filterDxcc, - true - ); - - newSelect = document.createElement("select"); - newSelect.id = "qslFilter"; - newSelect.title = "QSL Filter"; - option = document.createElement("option"); - option.value = "All"; - option.text = "All"; - newSelect.appendChild(option); - - option = document.createElement("option"); - option.value = true; - option.text = "Yes"; - newSelect.appendChild(option); - - option = document.createElement("option"); - option.value = false; - option.text = "No"; - newSelect.appendChild(option); - - statsAppendChild( - "qslFilterDiv", - newSelect, - "filterQSLFunction", - g_filterQSL, - true - ); - - statsFocus(g_lastSearchSelection); - - setStatsDivHeight("workedListDiv", getStatsWindowHeight() - 6 + "px"); - } else setStatsDiv("workedListDiv", "None"); + if (g_qsoPages > 1) { + workHead += + "
⇦ "; + workHead += + " Page " + + (g_qsoPage + 1) + + " of " + + g_qsoPages + + " (" + + (endIndex - startIndex) + + ") "; + workHead += + " ⇨"; } + setStatsDiv("workedHeadDiv", workHead); + + if (myObjects != null) { + var worker = ""; + worker += + ""; + worker += ""; + worker += + ""; + worker += + ""; + worker += ""; + worker += ""; + worker += ""; + worker += ""; + worker += ""; + worker += ""; + worker += " "; + worker += + ""; + worker += + ""; + worker += + ""; + worker += + ""; + worker += + ""; + worker += ""; + worker += ""; + worker += + ""; + worker += + ""; + worker += + ""; + if (g_callsignLookups.lotwUseEnable == true) worker += ""; + if (g_callsignLookups.eqslUseEnable == true) worker += ""; + if (g_callsignLookups.oqrsUseEnable == true) worker += ""; + worker += ""; + + var key = null; + for (var i = startIndex; i < endIndex; i++) { + key = list[i]; + worker += + ""; + worker += + ""; + worker += ""; + worker += ""; + worker += + ""; + worker += ""; + worker += ""; + worker += + ""; + worker += + ""; + worker += + ""; + if (g_callsignLookups.lotwUseEnable == true) + worker += + ""; + if (g_callsignLookups.eqslUseEnable == true) + worker += + ""; + if (g_callsignLookups.oqrsUseEnable == true) + worker += + ""; + worker += ""; + } + + worker += "
StationGridBandModeQSLSentRcvdDXCCFlagWhenLoTWeQSLOQRS
" + + key.DEcall.formatCallsign() + + "" + + key.grid + + (key.vucc_grids.length ? ", " + key.vucc_grids.join(", ") : "") + + "" + key.band + "" + key.mode + "" + (key.confirmed ? "✔" : "") + "" + key.RSTsent + "" + key.RSTrecv + "" + + g_dxccToAltName[key.dxcc] + + " (" + + (g_dxccToGeoData[key.dxcc] in g_worldGeoData + ? g_worldGeoData[g_dxccToGeoData[key.dxcc]].pp + : "?") + + ")" + + userTimeString(key.time * 1000) + + "" + + (key.DEcall in g_lotwCallsigns ? "✔" : "") + + "" + + (key.DEcall in g_eqslCallsigns ? "✔" : "") + + "" + + (key.DEcall in g_oqrsCallsigns ? "✔" : "") + + "
"; + + setStatsDiv("workedListDiv", worker); + + statsValidateCallByElement("searchWB"); + statsValidateCallByElement("searchGrid"); + + var newSelect = document.createElement("select"); + newSelect.id = "bandFilter"; + newSelect.title = "Band Filter"; + var option = document.createElement("option"); + option.value = "Mixed"; + option.text = "Mixed"; + newSelect.appendChild(option); + Object.keys(bands) + .sort(function (a, b) { + return parseInt(a) - parseInt(b); + }) + .forEach(function (key) { + var option = document.createElement("option"); + option.value = key; + option.text = key; + newSelect.appendChild(option); + }); + statsAppendChild( + "bandFilterDiv", + newSelect, + "filterBandFunction", + g_filterBand, + true + ); + + newSelect = document.createElement("select"); + newSelect.id = "modeFilter"; + newSelect.title = "Mode Filter"; + option = document.createElement("option"); + option.value = "Mixed"; + option.text = "Mixed"; + newSelect.appendChild(option); + + option = document.createElement("option"); + option.value = "Phone"; + option.text = "Phone"; + newSelect.appendChild(option); + + option = document.createElement("option"); + option.value = "Digital"; + option.text = "Digital"; + newSelect.appendChild(option); + + Object.keys(modes) + .sort() + .forEach(function (key) { + var option = document.createElement("option"); + option.value = key; + option.text = key; + newSelect.appendChild(option); + }); + + statsAppendChild( + "modeFilterDiv", + newSelect, + "filterModeFunction", + g_filterMode, + true + ); + + newSelect = document.createElement("select"); + newSelect.id = "dxccFilter"; + newSelect.title = "DXCC Filter"; + option = document.createElement("option"); + option.value = 0; + option.text = "All"; + newSelect.appendChild(option); + + Object.keys(dxccs) + .sort() + .forEach(function (key) { + var option = document.createElement("option"); + option.value = dxccs[key]; + option.text = key; + newSelect.appendChild(option); + }); + + statsAppendChild( + "dxccFilterDiv", + newSelect, + "filterDxccFunction", + g_filterDxcc, + true + ); + + newSelect = document.createElement("select"); + newSelect.id = "qslFilter"; + newSelect.title = "QSL Filter"; + option = document.createElement("option"); + option.value = "All"; + option.text = "All"; + newSelect.appendChild(option); + + option = document.createElement("option"); + option.value = true; + option.text = "Yes"; + newSelect.appendChild(option); + + option = document.createElement("option"); + option.value = false; + option.text = "No"; + newSelect.appendChild(option); + + statsAppendChild( + "qslFilterDiv", + newSelect, + "filterQSLFunction", + g_filterQSL, + true + ); + + statsFocus(g_lastSearchSelection); + + setStatsDivHeight("workedListDiv", getStatsWindowHeight() - 6 + "px"); + } else setStatsDiv("workedListDiv", "None"); + myObjects = null; } catch (e) { console.log(e); @@ -7360,131 +7345,129 @@ function statsAppendChild(elementString, object, onInputString, defaultValue) { } } function showDXCCsBox() { - { - var worker = getCurrentBandModeHTML(); - var confirmed = 0; - var worked = 0; - var needed = 0; - var List = {}; - var ListConfirmed = {}; - var ListNotWorked = {}; - for (var key in g_worldGeoData) { - if (key != -1) { - if (g_worldGeoData[key].worked == true) { - var item = {}; - item.dxcc = g_worldGeoData[key].dxcc; + var worker = getCurrentBandModeHTML(); + var confirmed = 0; + var worked = 0; + var needed = 0; + var List = {}; + var ListConfirmed = {}; + var ListNotWorked = {}; + for (var key in g_worldGeoData) { + if (key != -1) { + if (g_worldGeoData[key].worked == true) { + var item = {}; + item.dxcc = g_worldGeoData[key].dxcc; - item.flag = g_worldGeoData[key].flag; - item.confirmed = g_worldGeoData[key].confirmed; - List[g_worldGeoData[key].name] = item; - worked++; - } - if (g_worldGeoData[key].confirmed == true) { - var item = {}; - item.dxcc = g_worldGeoData[key].dxcc; + item.flag = g_worldGeoData[key].flag; + item.confirmed = g_worldGeoData[key].confirmed; + List[g_worldGeoData[key].name] = item; + worked++; + } + if (g_worldGeoData[key].confirmed == true) { + var item = {}; + item.dxcc = g_worldGeoData[key].dxcc; - item.flag = g_worldGeoData[key].flag; - item.confirmed = g_worldGeoData[key].confirmed; - ListConfirmed[g_worldGeoData[key].name] = item; - confirmed++; - } - if ( - g_worldGeoData[key].worked == false && - g_worldGeoData[key].confirmed == false && - g_worldGeoData[key].pp != "" && - g_worldGeoData[key].geo != "deleted" - ) { - var item = {}; - item.dxcc = g_worldGeoData[key].dxcc; - item.flag = g_worldGeoData[key].flag; - item.confirmed = g_worldGeoData[key].confirmed; - ListNotWorked[g_worldGeoData[key].name] = item; - needed++; - } + item.flag = g_worldGeoData[key].flag; + item.confirmed = g_worldGeoData[key].confirmed; + ListConfirmed[g_worldGeoData[key].name] = item; + confirmed++; + } + if ( + g_worldGeoData[key].worked == false && + g_worldGeoData[key].confirmed == false && + g_worldGeoData[key].pp != "" && + g_worldGeoData[key].geo != "deleted" + ) { + var item = {}; + item.dxcc = g_worldGeoData[key].dxcc; + item.flag = g_worldGeoData[key].flag; + item.confirmed = g_worldGeoData[key].confirmed; + ListNotWorked[g_worldGeoData[key].name] = item; + needed++; } } - - if (worked > 0) { - worker += - "
"; - Object.keys(List) - .sort() - .forEach(function (key, i) { - var confirmed = List[key].confirmed - ? "" - : "background-clip:content-box;box-shadow: 0 0 8px 3px inset "; - worker += - ""; - - worker += - ""; - worker += - ""; - }); - worker += "
Worked (" + - worked + - ")
NameFlagDXCC
" + - key + - "" + List[key].dxcc + "
"; - } - if (confirmed > 0) { - worker += - "
"; - Object.keys(ListConfirmed) - .sort() - .forEach(function (key, i) { - worker += ""; - worker += - ""; - worker += - ""; - }); - worker += "
Confirmed (" + - confirmed + - ")
NameFlagDXCC
" + key + "" + - ListConfirmed[key].dxcc + - "
"; - } - if (needed > 0) { - worker += - "
"; - Object.keys(ListNotWorked) - .sort() - .forEach(function (key, i) { - worker += ""; - worker += - ""; - worker += - ""; - }); - worker += "
Needed (" + - needed + - ")
NameFlagDXCC
" + key + "" + - ListNotWorked[key].dxcc + - "
"; - } - setStatsDiv("dxccListDiv", worker); } + + if (worked > 0) { + worker += + "
"; + Object.keys(List) + .sort() + .forEach(function (key, i) { + var confirmed = List[key].confirmed + ? "" + : "background-clip:content-box;box-shadow: 0 0 8px 3px inset "; + worker += + ""; + + worker += + ""; + worker += + ""; + }); + worker += "
Worked (" + + worked + + ")
NameFlagDXCC
" + + key + + "" + List[key].dxcc + "
"; + } + if (confirmed > 0) { + worker += + "
"; + Object.keys(ListConfirmed) + .sort() + .forEach(function (key, i) { + worker += ""; + worker += + ""; + worker += + ""; + }); + worker += "
Confirmed (" + + confirmed + + ")
NameFlagDXCC
" + key + "" + + ListConfirmed[key].dxcc + + "
"; + } + if (needed > 0) { + worker += + "
"; + Object.keys(ListNotWorked) + .sort() + .forEach(function (key, i) { + worker += ""; + worker += + ""; + worker += + ""; + }); + worker += "
Needed (" + + needed + + ")
NameFlagDXCC
" + key + "" + + ListNotWorked[key].dxcc + + "
"; + } + setStatsDiv("dxccListDiv", worker); } function showCQzoneBox() { @@ -7682,12 +7665,10 @@ function showRootInfoBox() { } function showSettingsBox() { - { - updateRunningProcesses(); - helpDiv.style.display = "none"; - g_helpShow = false; - rootSettingsDiv.style.display = "inline-block"; - } + updateRunningProcesses(); + helpDiv.style.display = "none"; + g_helpShow = false; + rootSettingsDiv.style.display = "inline-block"; } function toggleBaWindow(event) { @@ -9524,36 +9505,34 @@ function renderBandActivity() { var blockMyBand = ""; if (band == myBand) blockMyBand = " class='myBand' "; - { - var title = - "Score: " + - bandData[band].score + - " Spots: " + - bandData[band].spots + - "\nTx: " + - bandData[band].tx + - "\tRx: " + - bandData[band].rx; - buffer += - "
"; - buffer += - "
"; - buffer += - "
"; - buffer += - "
" + - parseInt(band) + - "
"; - buffer += "
"; - } + var title = + "Score: " + + bandData[band].score + + " Spots: " + + bandData[band].spots + + "\nTx: " + + bandData[band].tx + + "\tRx: " + + bandData[band].rx; + buffer += + "
"; + buffer += + "
"; + buffer += + "
"; + buffer += + "
" + + parseInt(band) + + "
"; + buffer += "
"; } } else { buffer = "..no data yet.."; @@ -10313,7 +10292,6 @@ function loadMaidenHeadData() { var dxcc = dxccGeo.features[key].properties.dxcc_entity_code; g_worldGeoData[g_dxccToGeoData[dxcc]].geo = dxccGeo.features[key]; } - delete dxccGeo; file = "./data/counties.json"; files = fs.readFileSync(file); var countyData = JSON.parse(files); @@ -10560,8 +10538,6 @@ function loadMaidenHeadData() { g_wacZones[name].confirmed_modes = {}; } } - - delete fileBuf; } } @@ -10594,7 +10570,6 @@ function toggleTimezones() { } else { if (g_timezoneLayer != null) { g_map.removeLayer(g_timezoneLayer); - delete g_timezoneLayer; g_timezoneLayer = null; } } @@ -10806,10 +10781,10 @@ function getBuffer(file_url, callback, flag, mode, port, cache = null) { var options = null; options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, followAllRedirects: true, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api }; http.get(options, function (res) { @@ -10851,9 +10826,9 @@ function getPostBuffer( var http = require(mode); var fileBuffer = null; var options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api method: "post", headers: { "Content-Type": "application/x-www-form-urlencoded", @@ -10889,7 +10864,7 @@ function getPostBuffer( req.abort(); }); }); - req.on("error", function (err) { + req.on("error", function (err) { // eslint-disable-line node/handle-callback-err if (typeof timeoutCallback != "undefined") timeoutCallback( file_url, @@ -11863,7 +11838,8 @@ function updateWsjtxListener(port) { g_wsjtUdpSocketError = true; }); g_wsjtUdpServer.on("message", function (message, remote) { - if (g_closing == true) true; + // if (g_closing == true) true; + if ( typeof udpForwardEnable != "undefined" && udpForwardEnable.checked == true @@ -12261,7 +12237,7 @@ function continueWithLookup(callsign, gridPass) { } function callookResults(buffer, gridPass) { var results = JSON.parse(buffer); - if (typeof results.status != undefined) { + if (typeof results.status != "undefined") { if (results.status == "VALID") { var callObject = {}; var dxcc = callsignToDxcc(results.current.callsign); @@ -13200,7 +13176,6 @@ function searchLogForCallsign(call) { setLookupDiv("lookupLocalDiv", worker); } - delete list; list = null; } @@ -13379,7 +13354,6 @@ function mediaCheck() { clearLogFilesAndCounts(); } - delete data; fs.unlinkSync(g_NWappData + "internal_qso.json"); } loadReceptionReports(); diff --git a/package.nw/lib/gtws.js b/package.nw/lib/gtws.js index 8dd55c7d..30386717 100644 --- a/package.nw/lib/gtws.js +++ b/package.nw/lib/gtws.js @@ -87,16 +87,13 @@ function gtConnectChat() { } if (typeof jsmesg.type == "undefined") { g_gtState = ChatState.error; - delete jsmesg; return; } if (jsmesg.type in g_chatRecvFunctions) { g_chatRecvFunctions[jsmesg.type](jsmesg); - delete jsmesg; } else { g_gtState = ChatState.error; - delete jsmesg; return; } } @@ -132,7 +129,6 @@ function closeGtSocket() { if (g_gtChatSocket.readyState != WebSocket.CLOSED) g_gtChatSocket.close(); if (g_gtChatSocket.readyState === WebSocket.CLOSED) { - delete g_gtChatSocket; g_gtChatSocket = null; g_gtState = ChatState.none; } @@ -140,7 +136,6 @@ function closeGtSocket() { } function gtClosedSocket() { - delete g_gtChatSocket; g_gtChatSocket = null; g_gtState = ChatState.none; } @@ -350,14 +345,14 @@ function makeGtPin(obj) { function gtChatNewList(jsmesg) { clearGtFlags(); - for (cid in g_gtFlagPins) { + for (var cid in g_gtFlagPins) { g_gtFlagPins[cid].live = false; if (!(cid in g_gtMessages)) { delete g_gtFlagPins[cid]; } } - for (key in jsmesg.data.calls) { + for (var key in jsmesg.data.calls) { var cid = jsmesg.data.cid[key]; var id = jsmesg.data.id[key]; if (id != myChatId) { @@ -417,7 +412,7 @@ function gtChatMessage(jsmesg) { var cid = jsmesg.cid; jsmesg.when = Date.now(); try { - jsmesg.msg = new Buffer.from(jsmesg.msg, "base64").toString("utf8"); + jsmesg.msg = new Buffer.from(jsmesg.msg, "base64").toString("utf8"); // eslint-disable-line new-cap jsmesg.msg = htmlEntities(jsmesg.msg); } catch (e) { jsmesg.msg = "Corrupt message recieved"; @@ -446,7 +441,7 @@ function gtSendMessage(message, who) { msg.type = "mesg"; msg.uuid = g_appSettings.chatUUID; msg.cid = who; - msg.msg = new Buffer.from(message).toString("base64"); + msg.msg = new Buffer.from(message).toString("base64"); // eslint-disable-line new-cap sendGtJson(JSON.stringify(msg)); msg.msg = htmlEntities(message); msg.id = 0; @@ -567,15 +562,13 @@ function newChatMessage(id, jsmesg) { var g_lastChatMsgAlert = 0; function alertChatMessage() { - { - if (g_msgSettings.msgAlertSelect == 1) { - // Text to speech - speakAlertString(g_msgSettings.msgAlertWord); - } - if (g_msgSettings.msgAlertSelect == 2) { - // Audible - playAlertMediaFile(g_msgSettings.msgAlertMedia); - } - g_lastChatMsgAlert = timeNowSec(); + if (g_msgSettings.msgAlertSelect == 1) { + // Text to speech + speakAlertString(g_msgSettings.msgAlertWord); } + if (g_msgSettings.msgAlertSelect == 2) { + // Audible + playAlertMediaFile(g_msgSettings.msgAlertMedia); + } + g_lastChatMsgAlert = timeNowSec(); } diff --git a/package.nw/lib/roster.js b/package.nw/lib/roster.js index 7da5b001..181cd82a 100644 --- a/package.nw/lib/roster.js +++ b/package.nw/lib/roster.js @@ -438,7 +438,7 @@ function viewRoster() { else allOnlyNewDiv.style.display = "none"; var now = timeNowSec(); - for (callHash in callRoster) { + for (var callHash in callRoster) { var call = callRoster[callHash].DEcall; callRoster[callHash].tx = true; @@ -614,22 +614,21 @@ function viewRoster() { continue; } - { - var hash = - call + - hashMaker( - callRoster[callHash].callObj.band, - callRoster[callHash].callObj.mode - ); - if (callMode == "worked" && hash in g_worked.call) { - callRoster[callHash].tx = false; - continue; - } - if (callMode == "confirmed" && hash in g_confirmed.call) { - callRoster[callHash].tx = false; - continue; - } + var hash = + call + + hashMaker( + callRoster[callHash].callObj.band, + callRoster[callHash].callObj.mode + ); + if (callMode == "worked" && hash in g_worked.call) { + callRoster[callHash].tx = false; + continue; } + if (callMode == "confirmed" && hash in g_confirmed.call) { + callRoster[callHash].tx = false; + continue; + } + if (g_rosterSettings.hunting == "grid") { var hash = callRoster[callHash].callObj.grid.substr(0, 4) + @@ -828,6 +827,7 @@ function viewRoster() { if (g_rosterSettings.hunting == "usstate" && g_currentUSCallsigns) { if (call in g_currentUSCallsigns) { + // Do Nothing } else { callRoster[callHash].tx = false; continue; @@ -921,7 +921,7 @@ function viewRoster() { var wpx = "#FFFF00"; hasGtPin = false; - shouldAlert = false; + var shouldAlert = false; var callsignBg, gridBg, callingBg, @@ -2407,13 +2407,13 @@ function setVisual() { // Award Hunter if (referenceNeed.value == 6) { - /*for ( key in g_rosterSettings.wanted ) - { - document.getElementById(key).checked = true; - var t = key.replace("hunt",""); - if ( t in g_rosterSettings.columns ) - g_rosterSettings.columns[t] = true; - }*/ + /* for ( key in g_rosterSettings.wanted ) + { + document.getElementById(key).checked = true; + var t = key.replace("hunt",""); + if ( t in g_rosterSettings.columns ) + g_rosterSettings.columns[t] = true; + } */ HuntingControls.style.display = "none"; CallsignsControls.style.display = "none"; @@ -2421,7 +2421,7 @@ function setVisual() { huntingMatrixDiv.style.display = ""; updateAwardList(); } else { - for (key in g_rosterSettings.wanted) { + for (var key in g_rosterSettings.wanted) { if (document.getElementById(key)) document.getElementById(key).checked = g_rosterSettings.wanted[key]; } @@ -2615,18 +2615,18 @@ function getBuffer(file_url, callback, flag, mode, port, cookie) { var options = null; if (cookie != null) { options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api headers: { Cookie: cookie, }, }; } else { options = { - host: url.parse(file_url).host, + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, - path: url.parse(file_url).path, + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api }; } http.get(options, function (res) { @@ -2654,7 +2654,7 @@ function callsignResult(buffer, flag) { r_currentUSState = flag; g_currentUSCallsigns = Object(); - for (key in rawData.c) g_currentUSCallsigns[rawData.c[key]] = true; + for (var key in rawData.c) g_currentUSCallsigns[rawData.c[key]] = true; window.opener.goProcessRoster(); } @@ -2728,7 +2728,7 @@ function manifestResult(buffer, flag) { r_callsignManifest = JSON.parse(buffer); var newSelect = document.getElementById("stateSelect"); - for (key in r_callsignManifest.cnt) { + for (var key in r_callsignManifest.cnt) { var option = document.createElement("option"); if (window.opener.g_enums[key]) { option.value = key; @@ -2808,78 +2808,74 @@ function openIgnoreEdit() { editView.style.display = "inline-block"; var worker = ""; var clearString = "none"; - { - if (Object.keys(g_blockedCalls).length > 0) - clearString = - "Clear All"; - worker += - "
" + - clearString + - ""; - Object.keys(g_blockedCalls) - .sort() - .forEach(function (key, i) { - worker += - ""; - }); - worker += "
Callsigns
" + - key + - "
"; - } - { - clearString = "none"; - if (Object.keys(g_blockedCQ).length > 0) - clearString = - "Clear All"; - worker += - "
" + - clearString + - ""; - Object.keys(g_blockedCQ) - .sort() - .forEach(function (key, i) { - worker += - ""; - }); - worker += "
CQ
" + - key + - "
"; - } + if (Object.keys(g_blockedCalls).length > 0) + clearString = + "Clear All"; + worker += + "
" + + clearString + + ""; + Object.keys(g_blockedCalls) + .sort() + .forEach(function (key, i) { + worker += + ""; + }); + worker += "
Callsigns
" + + key + + "
"; + + clearString = "none"; + if (Object.keys(g_blockedCQ).length > 0) + clearString = + "Clear All"; + worker += + "
" + + clearString + + ""; + Object.keys(g_blockedCQ) + .sort() + .forEach(function (key, i) { + worker += + ""; + }); + worker += "
CQ
" + + key + + "
"; + + clearString = "none"; + if (Object.keys(g_blockedDxcc).length > 0) + clearString = + "Clear All"; + worker += + "
" + + clearString + + ""; + Object.keys(g_blockedDxcc) + .sort() + .forEach(function (key, i) { + worker += + ""; + }); + worker += "
DXCCs
" + + window.opener.g_dxccToAltName[key] + + " (" + + window.opener.g_worldGeoData[window.opener.g_dxccToGeoData[key]].pp + + ")
"; - { - clearString = "none"; - if (Object.keys(g_blockedDxcc).length > 0) - clearString = - "Clear All"; - worker += - "
" + - clearString + - ""; - Object.keys(g_blockedDxcc) - .sort() - .forEach(function (key, i) { - worker += - ""; - }); - worker += "
DXCCs
" + - window.opener.g_dxccToAltName[key] + - " (" + - window.opener.g_worldGeoData[window.opener.g_dxccToGeoData[key]].pp + - ")
"; - } editTables.innerHTML = worker; } @@ -2929,7 +2925,7 @@ function init() { window.opener.setRosterSpot(g_rosterSettings.columns.Spot); - for (key in g_rosterSettings.wanted) { + for (var key in g_rosterSettings.wanted) { if (document.getElementById(key)) document.getElementById(key).checked = g_rosterSettings.wanted[key]; } @@ -3930,13 +3926,13 @@ function scoreAIOTA(award, obj) { // NO IOTA YET function testAIOTA(award, obj, baseHash) { /*if ( obj.IOTA ) - { - var test = g_awards[award.sponsor].awards[award.name]; + { + var test = g_awards[award.sponsor].awards[award.name]; - if ( "IOTA" in test.rule && test.rule.IOTA.indexOf(obj.IOTA) == -1 ) - return false; + if ( "IOTA" in test.rule && test.rule.IOTA.indexOf(obj.IOTA) == -1 ) + return false; - }*/ + }*/ return false; } @@ -4278,7 +4274,6 @@ function loadAwardJson() { alert("Core awards.json : " + e); g_awards = {}; } - delete filebuf; } else alert("Missing core awards.json"); } @@ -4309,8 +4304,8 @@ function newAwardTrackerObject(sponsor, award, enable) { newAward.enable = enable; newAward.mode = g_awards[sponsor].awards[award].rule.mode[0]; newAward.band = g_awards[sponsor].awards[award].rule.band[0]; - (newAward.count = g_awards[sponsor].awards[award].rule.count[0]), - (newAward.stat = {}); + newAward.count = g_awards[sponsor].awards[award].rule.count[0]; + newAward.stat = {}; newAward.comp = {}; newAward.test = {}; return newAward; @@ -4421,12 +4416,12 @@ function doubleCompile(award, firstLevel) { } } /*for ( var mode in obj.modes ) - { - if ( !(mode in firstLevel[k].modes) ) - firstLevel[k].modes[mode] = 0; - if ( obj.modes[mode] > 0 ) - firstLevel[k].modes[mode] += 1; - }*/ + { + if ( !(mode in firstLevel[k].modes) ) + firstLevel[k].modes[mode] = 0; + if ( obj.modes[mode] > 0 ) + firstLevel[k].modes[mode] += 1; + }*/ delete firstLevel[k].unique; firstLevel[k].unique = null;