diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..5bec868f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,42 @@ +module.exports = { + env: { + browser: true, + commonjs: true, + es6: true, + node: true + }, + extends: [ + "standard" + ], + globals: { + Atomics: "readonly", + SharedArrayBuffer: "readonly" + }, + parserOptions: { + ecmaVersion: 2018 + }, + rules: { + /* See https://eslint.org/docs/rules/ */ + /* 0: off, 1: warn, 2: error */ + + /* Style rules reflecting Tag's preferences */ + "brace-style": [1, "allman", { allowSingleLine: true }], + quotes: [2, "double"], + camelcase: 0, + semi: 0, + "space-before-function-paren": 0, + "one-var": 0, + + /* ESLint checks we should consider fixing in the future */ + eqeqeq: 0, + "no-unused-vars": 0, + "no-redeclare": 0, + "no-undef": 0, + "no-array-constructor": 0, + "prefer-const": 0, + "no-var": 0, + "no-extend-native": 0, + "prefer-regex-literals": 0, + "no-prototype-builtins": 0 + } +}; diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 0442f2ef..00000000 --- a/.prettierignore +++ /dev/null @@ -1,10 +0,0 @@ -node_modules/ -macos/ -debian/ -build/ -package.nw/lib/ol.js -package.nw/lib/moment-with-locales.js -package.nw/lib/moment-timezone-with-data.js -package.nw/lib/datepicker.js -package.nw/lib/third-party.js - diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 1cbe6869..00000000 --- a/.prettierrc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "printWidth": 80, - "overrides": [ - { - "files": ["*.html"], - "options": { - "printWidth": 120 - } - } - ] -} diff --git a/README.md b/README.md index ec9543ee..ca493df4 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,11 @@ among other things. ### Code Formatting -We use `prettier` to enforce code formatting rules, and we follow -the [JavaScript Standard Style](https://standardjs.com/) +We use `eslint` to enforce code formatting rules. You can use all kinds of plugins and configurations in your text editor to verify these rules, and even reformat code automatically, but if you want to run on the command line, you can (after running `npm install`) run the -`npm run prettier-check` command to verify the formatting of all files, or `npm run prettier-write` to reformat -all files to match the standard. - -If you want to know more about why these tools are useful, -[watch this talk](https://www.youtube.com/watch?v=kuHfMw8j4xk) +`npm run lint-check` command to verify the formatting of all files, or `npm run lint-fix` to reformat all files to match the standard. # Developer Environment Setup diff --git a/package.json b/package.json index 1982d686..e2b14977 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,18 @@ "name": "gridtracker-development", "version": "1.0.0", "devDependencies": { + "eslint": "^7.15.0", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1", "nwjs-builder-phoenix": "^1.15.0", "prettier": "^2.2.1" }, "scripts": { - "test": "npm run prettier-check", - "prettier-check": "npx prettier --check package.nw", - "prettier-write": "npx prettier --write package.nw", + "test": "eslint package.nw", + "lint-check": "eslint --fix package.nw", + "lint-fix": "eslint --fix package.nw", "dist": "build --concurrent --tasks win-x86,win-x64,linux-x86,linux-x64,mac-x64 package.nw", "distsome": "build --debug --tasks linux-x64,mac-x64 package.nw", "start": "run package.nw" diff --git a/package.nw/lib/adif.js b/package.nw/lib/adif.js index a4d2bf74..738d2954 100644 --- a/package.nw/lib/adif.js +++ b/package.nw/lib/adif.js @@ -4,32 +4,36 @@ var selectStartupLink = null; -function dragOverHandler(ev) { +function dragOverHandler(ev) +{ // Prevent default behavior (Prevent file from being opened) ev.preventDefault(); } -function dropHandler(ev) { +function dropHandler(ev) +{ // Prevent default behavior (Prevent file from being opened) ev.preventDefault(); - if (ev.dataTransfer.items) { + if (ev.dataTransfer.items) + { // Use DataTransferItemList interface to access the file(s) - for (var i = 0; i < ev.dataTransfer.items.length; i++) { + for (var i = 0; i < ev.dataTransfer.items.length; i++) + { // 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 && typeof Entry.isFile != "undefined" && Entry.isFile == true) + { var filename = ev.dataTransfer.items[i].getAsFile().path; var test = filename.toLowerCase(); var valid = test.endsWith(".adi") ? true : test.endsWith(".adif") - ? true - : test.endsWith(".log") - ? true - : test.endsWith(".txt") - ? true - : false; - if (valid && fs.existsSync(filename)) { + ? true + : test.endsWith(".log") + ? true + : !!test.endsWith(".txt"); + if (valid && fs.existsSync(filename)) + { onAdiLoadComplete(fs.readFileSync(filename, "UTF-8"), false); } } @@ -37,23 +41,26 @@ function dropHandler(ev) { } } -function findAdiField(row, field) { +function findAdiField(row, field) +{ var value = ""; var regex = new RegExp("<" + field + ":", "i"); var firstSplitArray = row.split(regex); - if (firstSplitArray && firstSplitArray.length == 2) { + if (firstSplitArray && firstSplitArray.length == 2) + { var secondSplitArray = firstSplitArray[1].split(">"); - if (secondSplitArray.length > 1) { + if (secondSplitArray.length > 1) + { var newLenSearch = secondSplitArray[0].split(":"); var newLen = newLenSearch[0]; value = secondSplitArray[1].slice(0, newLen); } - delete secondSplitArray; } return value; } -function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { +function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) +{ let rawAdiBuffer = ""; if (typeof adiBuffer == "object") rawAdiBuffer = String(adiBuffer); else rawAdiBuffer = adiBuffer; @@ -63,7 +70,8 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { if (rawAdiBuffer.indexOf("PSKReporter") > -1) activeAdifLogMode = false; - if (rawAdiBuffer.length > 1) { + if (rawAdiBuffer.length > 1) + { let regex = new RegExp("", "i"); activeAdifArray = rawAdiBuffer.split(regex); } @@ -71,11 +79,14 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { let dateTime = new Date(); let dupes = 0; - for (let x = 0; x < activeAdifArray.length; x++) { + for (let x = 0; x < activeAdifArray.length; x++) + { let finalMode = ""; - if (activeAdifArray[x].length > 3) { - if (activeAdifLogMode) { + if (activeAdifArray[x].length > 3) + { + if (activeAdifLogMode) + { let confirmed = false; let finalGrid = findAdiField( activeAdifArray[x], @@ -100,7 +111,7 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { g_appSettings.workingCallsignEnable && !(finalDEcall in g_appSettings.workingCallsigns) ) - continue; + { continue; } let finalRSTsent = findAdiField(activeAdifArray[x], "RST_SENT"); let finalRSTrecv = findAdiField(activeAdifArray[x], "RST_RCVD"); let finalBand = findAdiField(activeAdifArray[x], "BAND").toLowerCase(); @@ -123,16 +134,18 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { if (finalCont.length == 0) finalCont = null; let finalCnty = findAdiField(activeAdifArray[x], "CNTY").toUpperCase(); if (finalCnty.length == 0) finalCnty = null; - else { + else + { finalCnty = finalCnty.replaceAll(" ", ""); } let finalMode = findAdiField(activeAdifArray[x], "MODE").toUpperCase(); let subMode = findAdiField(activeAdifArray[x], "SUBMODE"); if (subMode == "FT4" && (finalMode == "MFSK" || finalMode == "DATA")) - finalMode = "FT4"; + { finalMode = "FT4"; } if (subMode == "JS8" && finalMode == "MFSK") finalMode = "JS8"; - if (finalBand == "oob" || finalBand == "") { + if (finalBand == "oob" || finalBand == "") + { finalBand = Number( findAdiField(activeAdifArray[x], "FREQ") ).formatBand(); @@ -143,13 +156,13 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { let finalQslMsgIntl = findAdiField(activeAdifArray[x], "QSLMSG_INTL"); if (finalQslMsg.length > 1) finalMsg = finalQslMsg; if (finalQslMsgIntl.length > 1 && finalMsg == "") - finalMsg = finalQslMsgIntl; + { finalMsg = finalQslMsgIntl; } let finalDxcc = Number(findAdiField(activeAdifArray[x], "DXCC")); if (finalDxcc == 0) finalDxcc = Number(callsignToDxcc(finalDXcall)); if (!(finalDxcc in g_dxccToGeoData)) - finalDxcc = Number(callsignToDxcc(finalDXcall)); + { finalDxcc = Number(callsignToDxcc(finalDXcall)); } // If my callsign isn't present, it must be for me anyway @@ -157,13 +170,13 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { if (finalCqZone.length == 1) finalCqZone = "0" + finalCqZone; if (parseInt(finalCqZone) < 1 || parseInt(finalCqZone) > 40) - finalCqZone = ""; + { finalCqZone = ""; } finalCqZone = String(finalCqZone); let finalItuZone = findAdiField(activeAdifArray[x], "ITUZ"); if (finalItuZone.length == 1) finalItuZone = "0" + finalItuZone; if (parseInt(finalItuZone) < 1 || parseInt(finalItuZone) > 90) - finalItuZone = ""; + { finalItuZone = ""; } finalItuZone = String(finalItuZone); let finalIOTA = findAdiField(activeAdifArray[x], "IOTA").toUpperCase(); @@ -187,7 +200,7 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { lotw_qsl_rcvd == "V" || lotwConfirmed1 == "Y" ) - confirmed = true; + { confirmed = true; } let dateTime = new Date( Date.UTC( @@ -206,24 +219,28 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { g_appSettings.workingDateEnable && finalTime < g_appSettings.workingDate ) - continue; + { continue; } finalGrid = finalGrid.substr(0, 6); if (!validateGridFromString(finalGrid)) finalGrid = ""; - if (finalGrid == "" && vuccGrids != "") { + if (finalGrid == "" && vuccGrids != "") + { finalVucc = vuccGrids.split(","); finalGrid = finalVucc[0]; finalVucc.shift(); } let isDigital = false; let isPhone = false; - if (finalMode in g_modes) { + if (finalMode in g_modes) + { isDigital = g_modes[finalMode]; } - if (finalMode in g_modes_phone) { + if (finalMode in g_modes_phone) + { isPhone = g_modes_phone[finalMode]; } if (finalDXcall != "") + { addDeDx( finalGrid, finalDXcall, @@ -252,7 +269,10 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { finalIOTA, finalSatName ); - } else { + } + } + else + { let finalMyGrid = findAdiField( activeAdifArray[x], "MY_GRIDSQUARE" @@ -272,7 +292,8 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { ).formatBand(); let finalMsg = "-"; let finalDxcc = Number(findAdiField(activeAdifArray[x], "DXCC")); - if (finalDxcc == 0) { + if (finalDxcc == 0) + { if (finalDXcall == myDEcall) finalDxcc = callsignToDxcc(finalDEcall); else finalDxcc = callsignToDxcc(finalDXcall); } @@ -294,8 +315,10 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { finalGrid != "" && finalDXcall != "" && validateGridFromString(finalGrid) - ) { + ) + { if (finalDXcall == myDEcall) + { addDeDx( finalMyGrid, finalDEcall, @@ -318,7 +341,9 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { null, null ); + } else if (finalDEcall == myDEcall) + { addDeDx( finalGrid, finalDXcall, @@ -341,7 +366,9 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { null, null ); + } else + { addDeDx( finalGrid, finalDXcall, @@ -364,20 +391,18 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { null, null ); + } } } } } - delete rawAdiBuffer; - - delete activeAdifArray; - redrawGrids(); updateCountStats(); updateLogbook(); - if (g_fromDirectCallNoFileDialog == false) { + if (g_fromDirectCallNoFileDialog == false) + { fileSelector.setAttribute("type", ""); fileSelector.setAttribute("type", "file"); fileSelector.setAttribute("accept", ".adi,"); @@ -389,15 +414,22 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { goProcessRoster(); } -function clubLogCallback(buffer, flag, cookie) { +function clubLogCallback(buffer, flag, cookie) +{ var rawAdiBuffer = String(buffer); - if (rawAdiBuffer.indexOf("Invalid login") > -1) { + if (rawAdiBuffer.indexOf("Invalid login") > -1) + { if (flag) clubTestResult.innerHTML = "Invalid"; - } else if (buffer == null) { + } + else if (buffer == null) + { if (flag) clubTestResult.innerHTML = "Unknown Error"; - } else { + } + else + { if (flag) clubTestResult.innerHTML = "Passed"; - else { + else + { g_fromDirectCallNoFileDialog = true; rawAdiBuffer = cleanAndPrepADIF("clublog.adif", rawAdiBuffer); @@ -410,14 +442,16 @@ function clubLogCallback(buffer, flag, cookie) { } var g_isGettingClub = false; -function grabClubLog(test) { - if (g_isGettingClub == false) { +function grabClubLog(test) +{ + if (g_isGettingClub == false) + { if (test) clubTestResult.innerHTML = "Testing"; var postData = { email: clubEmail.value, password: clubPassword.value, - call: clubCall.value, + call: clubCall.value }; getAPostBuffer( "https://clublog.org/getadif.php", @@ -432,22 +466,30 @@ function grabClubLog(test) { } } -function tryToWriteAdifToDocFolder(filename, buffer, append = false) { +function tryToWriteAdifToDocFolder(filename, buffer, append = false) +{ var finalFile = g_appData + g_dirSeperator + filename; - try { - if (append == false) { + try + { + if (append == false) + { fs.writeFileSync(finalFile, buffer); return buffer; - } else { + } + else + { fs.appendFileSync(finalFile, buffer); return fs.readFileSync(finalFile); } - } catch (e) { + } + catch (e) + { return false; } } -function cleanAndPrepADIF(name, adiBuffer, reverse = false, noheader = false) { +function cleanAndPrepADIF(name, adiBuffer, reverse = false, noheader = false) +{ var rawAdiBuffer = adiBuffer; var regex = new RegExp("", "i"); rawAdiBuffer = rawAdiBuffer.replace(regex, ""); @@ -459,17 +501,23 @@ function cleanAndPrepADIF(name, adiBuffer, reverse = false, noheader = false) { if (noheader == false) finalBuffer = name + "\r\n"; - if (adiArray.length > 1) { + if (adiArray.length > 1) + { regex = new RegExp("", "i"); activeAdifArray = adiArray[1].split(regex); - if (reverse == false) { - for (var x = 0; x < activeAdifArray.length - 1; x++) { + if (reverse == false) + { + for (var x = 0; x < activeAdifArray.length - 1; x++) + { var row = activeAdifArray[x].replace(/[\n\r]/g, ""); if (row.length > 0) finalBuffer += row + "\r\n"; } - } else { - for (var x = activeAdifArray.length - 1; x > -1; x--) { + } + else + { + for (var x = activeAdifArray.length - 1; x > -1; x--) + { var row = activeAdifArray[x].replace(/[\n\r]/g, ""); if (row.length > 0) finalBuffer += row + "\r\n"; } @@ -479,14 +527,17 @@ function cleanAndPrepADIF(name, adiBuffer, reverse = false, noheader = false) { return finalBuffer; } -function addZero(i) { - if (i < 10) { +function addZero(i) +{ + if (i < 10) + { i = "0" + i; } return i; } -function getUTCString(d) { +function getUTCString(d) +{ var Y = d.getUTCFullYear(); var M = addZero(d.getUTCMonth() + 1); var D = addZero(d.getUTCDate()); @@ -496,13 +547,18 @@ function getUTCString(d) { return Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s; } -function lotwCallback(buffer, flag) { +function lotwCallback(buffer, flag) +{ var rawAdiBuffer = String(buffer); - if (rawAdiBuffer.indexOf("password incorrect") > -1) { + if (rawAdiBuffer.indexOf("password incorrect") > -1) + { if (flag) lotwTestResult.innerHTML = "Invalid"; - } else { + } + else + { if (flag) lotwTestResult.innerHTML = "Passed"; - else { + else + { var shouldAppend = false; g_fromDirectCallNoFileDialog = true; @@ -524,34 +580,45 @@ function lotwCallback(buffer, flag) { } } -function shouldWeAppendInsteadOfCreate(filename) { +function shouldWeAppendInsteadOfCreate(filename) +{ var finalFile = g_appData + g_dirSeperator + filename; - try { + try + { if (fs.existsSync(finalFile)) return true; else return false; - } catch (e) { + } + catch (e) + { return false; } } -function tryToDeleteLog(filename) { +function tryToDeleteLog(filename) +{ var finalFile = g_appData + g_dirSeperator + filename; - try { - if (fs.existsSync(finalFile)) { + try + { + if (fs.existsSync(finalFile)) + { fs.unlinkSync(finalFile); } - } catch (e) {} + } + catch (e) {} } var g_lotwCount = 0; var g_isGettingLOTW = false; -function grabLOtWLog(test) { - if (g_isGettingLOTW == false) { +function grabLOtWLog(test) +{ + if (g_isGettingLOTW == false) + { var lastQSLDateString = "&qso_qsorxsince=1945-01-01&qso_qslsince=1945-01-01"; - if (test == true) { + if (test == true) + { lotwTestResult.innerHTML = "Testing"; lastQSLDateString = "&qso_qsosince=2100-01-01"; } @@ -574,13 +641,20 @@ function grabLOtWLog(test) { } } -function qrzCallback(buffer, flag) { - if (buffer.indexOf("invalid api key") > -1) { +function qrzCallback(buffer, flag) +{ + if (buffer.indexOf("invalid api key") > -1) + { if (flag) qrzTestResult.innerHTML = "Invalid"; - } else { - if (flag) { + } + else + { + if (flag) + { qrzTestResult.innerHTML = "Passed"; - } else { + } + else + { g_fromDirectCallNoFileDialog = true; var htmlString = String(buffer).replace(/</g, "<"); htmlString = htmlString.replace(/>/g, ">"); @@ -591,16 +665,18 @@ function qrzCallback(buffer, flag) { tryToWriteAdifToDocFolder("qrz.adif", htmlString); onAdiLoadComplete(htmlString, true, "qrz.adif", true); - delete htmlString; } } } var g_isGettingQRZCom = false; -function grabQrzComLog(test) { - if (g_isGettingQRZCom == false) { +function grabQrzComLog(test) +{ + if (g_isGettingQRZCom == false) + { var action = "FETCH"; - if (test) { + if (test) + { qrzTestResult.innerHTML = "Testing"; action = "STATUS"; } @@ -621,28 +697,37 @@ function grabQrzComLog(test) { } } -function ValidateQrzApi(inputText) { +function ValidateQrzApi(inputText) +{ inputText.value = inputText.value.toUpperCase(); - if (inputText.value.length == 19) { + if (inputText.value.length == 19) + { var passed = false; var dashcount = 0; - for (var i = 0; i < inputText.value.length; i++) { + for (var i = 0; i < inputText.value.length; i++) + { if (inputText.value[i] == "-") dashcount++; } - if (dashcount == 3) { + if (dashcount == 3) + { passed = true; } - if (passed) { + if (passed) + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; return true; - } else { + } + else + { inputText.style.color = "white"; inputText.style.backgroundColor = "red"; return false; } - } else { + } + else + { inputText.style.color = "white"; inputText.style.backgroundColor = "red"; @@ -650,19 +735,24 @@ function ValidateQrzApi(inputText) { } } -function ValidateText(inputText) { - if (inputText.value.length > 0) { +function ValidateText(inputText) +{ + if (inputText.value.length > 0) + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; return true; - } else { + } + else + { inputText.style.color = "white"; inputText.style.backgroundColor = "red"; return false; } } -function pskCallback(buffer, flag) { +function pskCallback(buffer, flag) +{ g_fromDirectCallNoFileDialog = true; var rawAdiBuffer = String(buffer); @@ -671,10 +761,12 @@ function pskCallback(buffer, flag) { var g_isGettingPsk = false; -function grabPsk24() { +function grabPsk24() +{ if (g_isGettingPsk == true) return; - if (myDEcall.length > 0 && myDEcall != "NOCALL") { + if (myDEcall.length > 0 && myDEcall != "NOCALL") + { var days = 1; if (pskImg.src == 1) days = 7; getABuffer( @@ -692,12 +784,16 @@ function grabPsk24() { } } -function adifMenuCheckBoxChanged(what) { - g_adifLogSettings["menu"][what.id] = what.checked; +function adifMenuCheckBoxChanged(what) +{ + g_adifLogSettings.menu[what.id] = what.checked; var menuItem = what.id + "Div"; - if (what.checked == true) { + if (what.checked == true) + { document.getElementById(menuItem).style.display = "inline-block"; - } else { + } + else + { document.getElementById(menuItem).style.display = "none"; } @@ -706,20 +802,26 @@ function adifMenuCheckBoxChanged(what) { if (what == buttonAdifCheckBox) setAdifStartup(loadAdifCheckBox); } -function adifStartupCheckBoxChanged(what) { - g_adifLogSettings["startup"][what.id] = what.checked; +function adifStartupCheckBoxChanged(what) +{ + g_adifLogSettings.startup[what.id] = what.checked; localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); if (what == loadAdifCheckBox) setAdifStartup(loadAdifCheckBox); } -function adifLogQsoCheckBoxChanged(what) { - g_adifLogSettings["qsolog"][what.id] = what.checked; - if (what.id == "logLOTWqsoCheckBox") { - if (what.checked == true) { +function adifLogQsoCheckBoxChanged(what) +{ + g_adifLogSettings.qsolog[what.id] = what.checked; + if (what.id == "logLOTWqsoCheckBox") + { + if (what.checked == true) + { lotwUpload.style.display = "inline-block"; trustedTestButton.style.display = "inline-block"; - } else { + } + else + { lotwUpload.style.display = "none"; trustedTestButton.style.display = "none"; } @@ -727,34 +829,44 @@ function adifLogQsoCheckBoxChanged(what) { localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); } -function adifNicknameCheckBoxChanged(what) { - g_adifLogSettings["nickname"][what.id] = what.checked; - if (what.id == "nicknameeQSLCheckBox") { - if (what.checked == true) { +function adifNicknameCheckBoxChanged(what) +{ + g_adifLogSettings.nickname[what.id] = what.checked; + if (what.id == "nicknameeQSLCheckBox") + { + if (what.checked == true) + { eQSLNickname.style.display = "inline-block"; - } else { + } + else + { eQSLNickname.style.display = "none"; } } localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); } -function adifTextValueChange(what) { - g_adifLogSettings["text"][what.id] = what.value; +function adifTextValueChange(what) +{ + g_adifLogSettings.text[what.id] = what.value; localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); } var fileSelector = document.createElement("input"); fileSelector.setAttribute("type", "file"); fileSelector.setAttribute("accept", ".adi,.adif"); -fileSelector.onchange = function () { - if (this.files && this.files[0]) { +fileSelector.onchange = function () +{ + if (this.files && this.files[0]) + { path = this.value.replace(this.files[0].name, ""); fileSelector.setAttribute("nwworkingdir", path); var reader = new FileReader(); - reader.onload = function (e) { - if (e.target.error == null) { + reader.onload = function (e) + { + if (e.target.error == null) + { onAdiLoadComplete(e.target.result, false); } }; @@ -763,7 +875,8 @@ fileSelector.onchange = function () { } }; -function adifLoadDialog() { +function adifLoadDialog() +{ var exists = fileSelector.getAttribute("nwworkingdir"); fileSelector.setAttribute("nwworkingdir", g_appData); @@ -776,9 +889,12 @@ function adifLoadDialog() { var startupFileSelector = document.createElement("input"); startupFileSelector.setAttribute("type", "file"); startupFileSelector.setAttribute("accept", ".adi,.adif"); -startupFileSelector.onchange = function () { - if (this.files && this.files[0]) { - for (var i in g_startupLogs) { +startupFileSelector.onchange = function () +{ + if (this.files && this.files[0]) + { + for (var i in g_startupLogs) + { if (this.value == g_startupLogs[i].file) return; } var newObject = Object(); @@ -794,8 +910,10 @@ startupFileSelector.onchange = function () { } }; -function start_and_end(str) { - if (str.length > 31) { +function start_and_end(str) +{ + if (str.length > 31) + { return ( str.substr(0, 16) + " ... " + str.substr(str.length - 15, str.length) ); @@ -803,13 +921,16 @@ function start_and_end(str) { return str; } -function setFileSelectors() { +function setFileSelectors() +{ selectStartupLink = document.getElementById("selectAdifButton"); - selectStartupLink.onclick = function () { + selectStartupLink.onclick = function () + { var exists = startupFileSelector.getAttribute("nwworkingdir"); - if (exists == null) { + if (exists == null) + { if (g_workingIniPath.length > 1) - startupFileSelector.setAttribute("nwworkingdir", g_appData); + { startupFileSelector.setAttribute("nwworkingdir", g_appData); } } startupFileSelector.click(); @@ -817,7 +938,8 @@ function setFileSelectors() { }; selectTqsl = document.getElementById("selectTQSLButton"); - selectTqsl.onclick = function () { + selectTqsl.onclick = function () + { tqslFileSelector.click(); return false; }; @@ -827,8 +949,10 @@ function setFileSelectors() { var tqslFileSelector = document.createElement("input"); tqslFileSelector.setAttribute("type", "file"); tqslFileSelector.setAttribute("accept", "*"); -tqslFileSelector.onchange = function () { - if (this.files && this.files[0]) { +tqslFileSelector.onchange = function () +{ + if (this.files && this.files[0]) + { g_trustedQslSettings.binaryFile = this.files[0].path; var fs = require("fs"); @@ -836,13 +960,18 @@ tqslFileSelector.onchange = function () { fs.existsSync(g_trustedQslSettings.binaryFile) && (g_trustedQslSettings.binaryFile.endsWith("tqsl.exe") || g_trustedQslSettings.binaryFile.endsWith("tqsl")) - ) { + ) + { g_trustedQslSettings.binaryFileValid = true; - } else g_trustedQslSettings.binaryFileValid = false; + } + else g_trustedQslSettings.binaryFileValid = false; - if (g_trustedQslSettings.binaryFileValid == true) { + if (g_trustedQslSettings.binaryFileValid == true) + { tqslFileDiv.style.backgroundColor = "blue"; - } else { + } + else + { tqslFileDiv.style.backgroundColor = "red"; } @@ -851,10 +980,12 @@ tqslFileSelector.onchange = function () { } }; -function loadGtQSOLogFile() { +function loadGtQSOLogFile() +{ var fs = require("fs"); - if (fs.existsSync(g_qsoLogFile)) { + if (fs.existsSync(g_qsoLogFile)) + { var rawAdiBuffer = fs.readFileSync(g_qsoLogFile); g_fromDirectCallNoFileDialog = true; @@ -863,47 +994,62 @@ function loadGtQSOLogFile() { } } -function loadWsjtLogFile() { +function loadWsjtLogFile() +{ var fs = require("fs"); - if (fs.existsSync(g_workingIniPath + "wsjtx_log.adi")) { + if (fs.existsSync(g_workingIniPath + "wsjtx_log.adi")) + { var rawAdiBuffer = fs.readFileSync(g_workingIniPath + "wsjtx_log.adi"); g_fromDirectCallNoFileDialog = true; onAdiLoadComplete(rawAdiBuffer, false); } } -function findTrustedQSLPaths() { +function findTrustedQSLPaths() +{ var process = require("process"); var base = null; - if (g_trustedQslSettings.stationFileValid == true) { + if (g_trustedQslSettings.stationFileValid == true) + { // double check the presence of the station_data; - if (!fs.existsSync(g_trustedQslSettings.stationFile)) { + if (!fs.existsSync(g_trustedQslSettings.stationFile)) + { g_trustedQslSettings.stationFileValid = false; } } - if (g_trustedQslSettings.stationFileValid == false) { - if (g_platform == "windows") { + if (g_trustedQslSettings.stationFileValid == false) + { + if (g_platform == "windows") + { base = process.env.APPDATA + "\\TrustedQSL\\station_data"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.stationFile = base; g_trustedQslSettings.stationFileValid = true; - } else { + } + else + { base = process.env.LOCALAPPDATA + "\\TrustedQSL\\station_data"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.stationFile = base; g_trustedQslSettings.stationFileValid = true; } } - } else { + } + else + { base = process.env.HOME + "/.tqsl/station_data"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.stationFile = base; g_trustedQslSettings.stationFileValid = true; } } } - if (g_trustedQslSettings.stationFileValid == true) { + if (g_trustedQslSettings.stationFileValid == true) + { var validate = false; var option = document.createElement("option"); option.value = ""; @@ -914,69 +1060,95 @@ function findTrustedQSLPaths() { parser = new DOMParser(); xmlDoc = parser.parseFromString(buffer, "text/xml"); var x = xmlDoc.getElementsByTagName("StationData"); - for (var i = 0; i < x.length; i++) { + for (var i = 0; i < x.length; i++) + { option = document.createElement("option"); option.value = x[i].getAttribute("name"); option.text = x[i].getAttribute("name"); - if (option.value == g_adifLogSettings.text.lotwStation) { + if (option.value == g_adifLogSettings.text.lotwStation) + { option.selected = true; validate = true; } lotwStation.appendChild(option); } - if (validate) { + if (validate) + { ValidateText(lotwStation); } } - if (g_trustedQslSettings.binaryFileValid == true) { + if (g_trustedQslSettings.binaryFileValid == true) + { // double check the presence of the TrustedQSL binary; - if (!fs.existsSync(g_trustedQslSettings.binaryFile)) { + if (!fs.existsSync(g_trustedQslSettings.binaryFile)) + { g_trustedQslSettings.binaryFileValid = false; } } - if (g_trustedQslSettings.binaryFileValid == false || g_platform == "mac") { - if (g_platform == "windows") { + if (g_trustedQslSettings.binaryFileValid == false || g_platform == "mac") + { + if (g_platform == "windows") + { base = process.env["ProgramFiles(x86)"] + "\\TrustedQSL\\tqsl.exe"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; } - } else if (g_platform == "mac") { + } + else if (g_platform == "mac") + { base = "/Applications/TrustedQSL/tqsl.app/Contents/MacOS/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; - } else { + } + else + { base = process.env.HOME + "/Applications/TrustedQSL/tqsl.app/Contents/MacOS/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; - } else { + } + else + { base = process.env.HOME + "/Applications/tqsl.app/Contents/MacOS/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; - } else { + } + else + { base = "/Applications/tqsl.app/Contents/MacOS/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; - } else { + } + else + { base = process.env.HOME + "/Desktop/TrustedQSL/tqsl.app/Contents/MacOS/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; - } else { + } + else + { base = process.env.HOME + "/Applications/Ham Radio/tqsl.app/Contents/MacOS/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; } @@ -985,14 +1157,20 @@ function findTrustedQSLPaths() { } } } - } else if (g_platform == "linux") { + } + else if (g_platform == "linux") + { base = "/usr/bin/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; - } else { + } + else + { base = "/usr/local/bin/tqsl"; - if (fs.existsSync(base)) { + if (fs.existsSync(base)) + { g_trustedQslSettings.binaryFile = base; g_trustedQslSettings.binaryFileValid = true; } @@ -1002,44 +1180,58 @@ function findTrustedQSLPaths() { localStorage.trustedQslSettings = JSON.stringify(g_trustedQslSettings); } -function startupAdifLoadFunction() { +function startupAdifLoadFunction() +{ var fs = require("fs"); - for (var i in g_startupLogs) { - try { - if (fs.existsSync(g_startupLogs[i].file)) { + for (var i in g_startupLogs) + { + try + { + if (fs.existsSync(g_startupLogs[i].file)) + { var rawAdiBuffer = fs.readFileSync(g_startupLogs[i].file); g_fromDirectCallNoFileDialog = true; onAdiLoadComplete(rawAdiBuffer, false); } - } catch (e) {} + } + catch (e) {} } } -function setAdifStartup(checkbox) { +function setAdifStartup(checkbox) +{ if (g_trustedQslSettings.binaryFile == null) - g_trustedQslSettings.binaryFile = ""; + { g_trustedQslSettings.binaryFile = ""; } if ( g_trustedQslSettings.binaryFile.endsWith("tqsl.exe") || g_trustedQslSettings.binaryFile.endsWith("tqsl") - ) { + ) + { g_trustedQslSettings.binaryFileValid = true; - } else g_trustedQslSettings.binaryFileValid = false; + } + else g_trustedQslSettings.binaryFileValid = false; - if (g_trustedQslSettings.binaryFileValid == true) { + if (g_trustedQslSettings.binaryFileValid == true) + { tqslFileDiv.style.backgroundColor = "blue"; - } else { + } + else + { tqslFileDiv.style.backgroundColor = "red"; } tqslFileDiv.innerHTML = "" + start_and_end(g_trustedQslSettings.binaryFile) + ""; - if (buttonAdifCheckBox.checked || loadAdifCheckBox.checked) { + if (buttonAdifCheckBox.checked || loadAdifCheckBox.checked) + { var worker = ""; - if (g_startupLogs.length > 0) { + if (g_startupLogs.length > 0) + { worker += ""; - for (var i in g_startupLogs) { + for (var i in g_startupLogs) + { worker += ""; } worker += "
"; - } else { + } + else + { worker = "No file(s) selected"; } startupLogFileDiv.innerHTML = worker; selectFileOnStartupDiv.style.display = "block"; - } else { + } + else + { startupLogFileDiv.innerHTML = "No file(s) selected"; startupFileSelector.setAttribute("type", ""); startupFileSelector.setAttribute("type", "file"); @@ -1065,15 +1261,18 @@ function setAdifStartup(checkbox) { } } -function removeStartupLog(i) { - if (i in g_startupLogs) { +function removeStartupLog(i) +{ + if (i in g_startupLogs) + { g_startupLogs.splice(i, 1); localStorage.startupLogs = JSON.stringify(g_startupLogs); setAdifStartup(loadAdifCheckBox); } } -function startupAdifLoadCheck() { +function startupAdifLoadCheck() +{ logEventMedia.value = g_alertSettings.logEventMedia; loadWsjtLogFile(); @@ -1081,9 +1280,10 @@ function startupAdifLoadCheck() { if (loadGTCheckBox.checked == true) loadGtQSOLogFile(); if (loadAdifCheckBox.checked == true && g_startupLogs.length > 0) - startupAdifLoadFunction(); + { startupAdifLoadFunction(); } - if (g_mapSettings.offlineMode == false) { + if (g_mapSettings.offlineMode == false) + { if (g_appSettings.gtFlagImgSrc == 1) showGtFlags(); if (loadLOTWCheckBox.checked == true) grabLOtWLog(false); @@ -1105,39 +1305,43 @@ function getABuffer( imgToGray, stringOfFlag, timeoutX -) { +) +{ let url = require("url"); let http = require(mode); 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") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = "linear-gradient(grey 0%, black 0% 100% )"; imgToGray.style.webkitFilter = "invert(100%) grayscale(1)"; } - let req = http.request(options, function (res) { + let req = http.request(options, function (res) + { let fsize = res.headers["content-length"]; let cookies = null; if (typeof res.headers["set-cookie"] != "undefined") - cookies = res.headers["set-cookie"]; + { cookies = res.headers["set-cookie"]; } res - .on("data", function (data) { + .on("data", function (data) + { if (fileBuffer == null) fileBuffer = data; else fileBuffer += data; - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { let percent = 0; if (fsize > 0) percent = parseInt((fileBuffer.length / fsize) * 100); else percent = parseInt(((fileBuffer.length / 100000) * 100) % 100); @@ -1149,41 +1353,53 @@ function getABuffer( "% 100% )"; } }) - .on("end", function () { - if (typeof callback === "function") { + .on("end", function () + { + if (typeof callback === "function") + { // Call it, since we have confirmed it is callable callback(fileBuffer, flag, cookies); } - if (typeof stringOfFlag != "undefined") { + if (typeof stringOfFlag != "undefined") + { window[stringOfFlag] = false; } - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = ""; imgToGray.style.webkitFilter = ""; } }) - .on("error", function () { - if (typeof stringOfFlag != "undefined") { + .on("error", function () + { + if (typeof stringOfFlag != "undefined") + { window[stringOfFlag] = false; } - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = ""; imgToGray.style.webkitFilter = ""; } }); }); - req.on("socket", function (socket) { - socket.on("timeout", function () { + req.on("socket", function (socket) + { + socket.on("timeout", function () + { req.abort(); }); }); - req.on("error", function () { - if (typeof stringOfFlag != "undefined") { + req.on("error", function () + { + if (typeof stringOfFlag != "undefined") + { window[stringOfFlag] = false; } - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = ""; imgToGray.style.webkitFilter = ""; } @@ -1201,7 +1417,8 @@ function getAPostBuffer( theData, imgToGray, stringOfFlag -) { +) +{ var querystring = require("querystring"); var postData = querystring.stringify(theData); var url = require("url"); @@ -1209,36 +1426,40 @@ 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", - "Content-Length": postData.length, - }, + "Content-Length": postData.length + } }; window[stringOfFlag] = true; - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = "linear-gradient(grey 0%, black 0% 100% )"; imgToGray.style.webkitFilter = "invert(100%) grayscale(1)"; } - var req = http.request(options, function (res) { + var req = http.request(options, function (res) + { var fsize = res.headers["content-length"]; 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) { + .on("data", function (data) + { if (fileBuffer == null) fileBuffer = data; else fileBuffer += data; - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { var percent = 0; if (fsize > 0) percent = parseInt((fileBuffer.length / fsize) * 100); else percent = parseInt(((fileBuffer.length / 100000) * 100) % 100); @@ -1251,35 +1472,44 @@ function getAPostBuffer( "% 100% )"; } }) - .on("end", function () { - if (typeof callback === "function") { + .on("end", function () + { + if (typeof callback === "function") + { // Call it, since we have confirmed it is callable callback(fileBuffer, flag, cookies); window[stringOfFlag] = false; - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = ""; imgToGray.style.webkitFilter = ""; } } }) - .on("error", function () { + .on("error", function () + { window[stringOfFlag] = false; - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = ""; imgToGray.style.webkitFilter = ""; } }); }); - req.on("socket", function (socket) { - socket.on("timeout", function () { + req.on("socket", function (socket) + { + socket.on("timeout", function () + { req.abort(); }); }); - req.on("error", function (err) { + req.on("error", function (err) // eslint-disable-line node/handle-callback-err + { window[stringOfFlag] = false; - if (typeof imgToGray != "undefined") { + if (typeof imgToGray != "undefined") + { imgToGray.parentNode.style.background = ""; imgToGray.style.webkitFilter = ""; } @@ -1289,41 +1519,51 @@ function getAPostBuffer( req.end(); } -function sendUdpMessage(msg, length, port, address) { +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(); }); } -function sendTcpMessage(msg, length, port, address) { +function sendTcpMessage(msg, length, port, address) +{ var net = require("net"); var client = new net.Socket(); client.setTimeout(30000); - client.connect(port, address, function () { + client.connect(port, address, function () + { client.write(msg); }); client.on("close", function () {}); } -function valueToAdiField(field, value) { +function valueToAdiField(field, value) +{ var adi = "<" + field + ":"; adi += String(value).length + ">"; adi += String(value) + " "; return adi; } -function pad(value) { - if (value < 10) { +function pad(value) +{ + if (value < 10) + { return "0" + value; - } else { + } + else + { return value; } } -function HMSfromMilli(milli) { +function HMSfromMilli(milli) +{ var seconds = parseInt(milli / 1000); var days = Math.floor(seconds / (3600 * 24)); seconds -= days * 3600 * 24; @@ -1336,7 +1576,8 @@ function HMSfromMilli(milli) { return String(val); } -function colonHMSfromMilli(milli) { +function colonHMSfromMilli(milli) +{ var seconds = parseInt(milli / 1000); var days = Math.floor(seconds / (3600 * 24)); seconds -= days * 3600 * 24; @@ -1349,7 +1590,8 @@ function colonHMSfromMilli(milli) { return String(val); } -function colonHMSfromSeconds(secondsIn) { +function colonHMSfromSeconds(secondsIn) +{ var seconds = secondsIn; var days = Math.floor(seconds / (3600 * 24)); seconds -= days * 3600 * 24; @@ -1362,7 +1604,8 @@ function colonHMSfromSeconds(secondsIn) { return String(val); } -function convertToDate(julian) { +function convertToDate(julian) +{ var DAY = 86400000; var HALF_DAY = DAY / 2; var UNIX_EPOCH_JULIAN_DATE = 2440587.5; @@ -1376,7 +1619,8 @@ var lastReportHash = null; var g_oldStyleLogMessage = null; -function oldSendToLogger() { +function oldSendToLogger() +{ var newMessage = Object.assign({}, g_oldStyleLogMessage); var band = Number(newMessage.Frequency / 1000000).formatBand(); @@ -1384,7 +1628,8 @@ function oldSendToLogger() { if ( newMessage.DXGrid.length == 0 && newMessage.DXCall + band + newMessage.MO in g_liveCallsigns - ) { + ) + { newMessage.DXGrid = g_liveCallsigns[ newMessage.DXCall + band + newMessage.MO ].grid.substr(0, 4); @@ -1424,24 +1669,29 @@ function oldSendToLogger() { report += valueToAdiField("GRIDSQUARE", newMessage.DXGrid); if (newMessage.Comments.length > 0) - report += valueToAdiField("COMMENT", newMessage.Comments); + { report += valueToAdiField("COMMENT", newMessage.Comments); } if (newMessage.Name.length > 0) - report += valueToAdiField("NAME", newMessage.Name); + { report += valueToAdiField("NAME", newMessage.Name); } - if (newMessage.Operatorcall.length > 0) { + if (newMessage.Operatorcall.length > 0) + { report += valueToAdiField("OPERATOR", newMessage.Operatorcall); } - if (newMessage.Mycall.length > 0) { + if (newMessage.Mycall.length > 0) + { report += valueToAdiField("STATION_CALLSIGN", newMessage.Mycall); - } else if (myDEcall != "NOCALL" && myDEcall.length > 0) - report += valueToAdiField("STATION_CALLSIGN", myDEcall); + } + else if (myDEcall != "NOCALL" && myDEcall.length > 0) + { report += valueToAdiField("STATION_CALLSIGN", myDEcall); } - if (newMessage.Mygrid.length > 0) { + if (newMessage.Mygrid.length > 0) + { report += valueToAdiField("MY_GRIDSQUARE", newMessage.Mygrid); - } else if (myDEGrid.length > 1) - report += valueToAdiField("MY_GRIDSQUARE", myDEGrid); + } + else if (myDEGrid.length > 1) + { report += valueToAdiField("MY_GRIDSQUARE", myDEGrid); } report += ""; @@ -1456,115 +1706,138 @@ var g_adifLookupMap = { cqzone: "CQZ", ituzone: "ITUZ", email: "EMAIL", - county: "CNTY", + county: "CNTY" }; -function sendToLogger(ADIF) { +function sendToLogger(ADIF) +{ let regex = new RegExp("", "i"); let record = parseADIFRecord(ADIF.split(regex)[1]); - let localMode = record["MODE"]; + let localMode = record.MODE; - if (localMode == "MFSK" && "SUBMODE" in record) { - localMode = record["SUBMODE"]; + if (localMode == "MFSK" && "SUBMODE" in record) + { + localMode = record.SUBMODE; } if ( - (!("GRIDSQUARE" in record) || record["GRIDSQUARE"].length == 0) && - record["CALL"] + record["BAND"] + localMode in g_liveCallsigns - ) { - record["GRIDSQUARE"] = g_liveCallsigns[ - record["CALL"] + record["BAND"] + localMode + (!("GRIDSQUARE" in record) || record.GRIDSQUARE.length == 0) && + record.CALL + record.BAND + localMode in g_liveCallsigns + ) + { + record.GRIDSQUARE = g_liveCallsigns[ + record.CALL + record.BAND + localMode ].grid.substr(0, 4); } - if ("TX_PWR" in record) { - record["TX_PWR"] = String(parseInt(record["TX_PWR"])); + if ("TX_PWR" in record) + { + record.TX_PWR = String(parseInt(record.TX_PWR)); } if ( (!("STATION_CALLSIGN" in record) || - record["STATION_CALLSIGN"].length == 0) && + record.STATION_CALLSIGN.length == 0) && myDEcall != "NOCALL" && myDEcall.length > 0 - ) { - record["STATION_CALLSIGN"] = myDEcall; + ) + { + record.STATION_CALLSIGN = myDEcall; } if ( - (!("MY_GRIDSQUARE" in record) || record["MY_GRIDSQUARE"].length == 0) && + (!("MY_GRIDSQUARE" in record) || record.MY_GRIDSQUARE.length == 0) && myDEGrid.length > 1 - ) { - record["MY_GRIDSQUARE"] = myDEGrid; + ) + { + record.MY_GRIDSQUARE = myDEGrid; } - if (!("DXCC" in record)) { - let dxcc = callsignToDxcc(record["CALL"]); + if (!("DXCC" in record)) + { + let dxcc = callsignToDxcc(record.CALL); if (dxcc == -1) dxcc = 0; - record["DXCC"] = String(dxcc); + record.DXCC = String(dxcc); } - if (!("COUNTRY" in record) && Number(record["DXCC"]) > 0) { - record["COUNTRY"] = g_dxccToADIFName[Number(record["DXCC"])]; + if (!("COUNTRY" in record) && Number(record.DXCC) > 0) + { + record.COUNTRY = g_dxccToADIFName[Number(record.DXCC)]; } - if (g_appSettings.lookupMerge == true) { + if (g_appSettings.lookupMerge == true) + { let request = g_Idb .transaction(["lookups"], "readwrite") .objectStore("lookups") - .get(record["CALL"]); + .get(record.CALL); - request.onsuccess = function (event) { - if (request.result) { + request.onsuccess = function (event) + { + if (request.result) + { let lookup = request.result; - for (let key in lookup) { - if (key in g_adifLookupMap) { + for (let key in lookup) + { + if (key in g_adifLookupMap) + { record[g_adifLookupMap[key]] = lookup[key]; } } - if ("GRIDSQUARE" in record && "grid" in lookup) { + if ("GRIDSQUARE" in record && "grid" in lookup) + { if ( - record["GRIDSQUARE"].substr(0, 4) == lookup["grid"].substr(0, 4) - ) { - record["GRIDSQUARE"] = lookup["grid"]; + record.GRIDSQUARE.substr(0, 4) == lookup.grid.substr(0, 4) + ) + { + record.GRIDSQUARE = lookup.grid; } } if ( g_appSettings.lookupMissingGrid && "grid" in lookup && - (!("GRIDSQUARE" in record) || record["GRIDSQUARE"].length == 0) - ) { - record["GRIDSQUARE"] = lookup["grid"]; + (!("GRIDSQUARE" in record) || record.GRIDSQUARE.length == 0) + ) + { + record.GRIDSQUARE = lookup.grid; } } finishSendingReport(record, localMode); }; - request.onerror = function (event) { + request.onerror = function (event) + { finishSendingReport(record, localMode); }; - } else { + } + else + { finishSendingReport(record, localMode); } } -function finishSendingReport(record, localMode) { +function finishSendingReport(record, localMode) +{ let report = ""; - let reportHash = record["CALL"] + record["MODE"] + localMode; + let reportHash = record.CALL + record.MODE + localMode; - for (let key in record) { + for (let key in record) + { report += "<" + key + ":" + record[key].length + ">" + record[key] + " "; } report += ""; - if (reportHash != lastReportHash) { + if (reportHash != lastReportHash) + { lastReportHash = reportHash; if ( g_N1MMSettings.enable == true && g_N1MMSettings.port > 1024 && g_N1MMSettings.ip.length > 4 - ) { + ) + { sendUdpMessage( report, report.length, @@ -1578,7 +1851,8 @@ function finishSendingReport(record, localMode) { g_log4OMSettings.enable == true && g_log4OMSettings.port > 1024 && g_log4OMSettings.ip.length > 4 - ) { + ) + { sendUdpMessage( "ADD " + report, report.length + 4, @@ -1588,47 +1862,66 @@ function finishSendingReport(record, localMode) { addLastTraffic("Logged to Log4OM"); } - try { + try + { onAdiLoadComplete("GT" + report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception Internal Log"); } - try { + try + { // Log worthy - if (logGTqsoCheckBox.checked == true) { + if (logGTqsoCheckBox.checked == true) + { var fs = require("fs"); fs.appendFileSync(g_qsoLogFile, report + "\r\n"); addLastTraffic( "Logged to GridTracker backup" ); } - } catch (e) { + } + catch (e) + { addLastTraffic( "Exception GridTracker backup" ); } - try { + try + { sendQrzLogEntry(report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception QRZ Log"); } - try { + try + { sendClubLogEntry(report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception ClubLog Log"); } - try { + try + { sendHrdLogEntry(report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception HrdLog.net Log"); } - try { + try + { sendCloudlogEntry(report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception Cloudlog Log"); } @@ -1636,11 +1929,15 @@ function finishSendingReport(record, localMode) { g_acLogSettings.enable == true && g_acLogSettings.port > 0 && g_acLogSettings.ip.length > 4 - ) { - try { + ) + { + try + { sendACLogMessage(record, g_acLogSettings.port, g_acLogSettings.ip); addLastTraffic("Logged to N3FJP"); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception N3FJP Log"); } } @@ -1649,15 +1946,19 @@ function finishSendingReport(record, localMode) { g_dxkLogSettings.enable == true && g_dxkLogSettings.port > 0 && g_dxkLogSettings.ip.length > 4 - ) { - try { + ) + { + try + { sendDXKeeperLogMessage( report, g_dxkLogSettings.port, g_dxkLogSettings.ip ); addLastTraffic("Logged to DXKeeper"); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception DXKeeper Log"); } } @@ -1666,8 +1967,10 @@ function finishSendingReport(record, localMode) { g_HRDLogbookLogSettings.enable == true && g_HRDLogbookLogSettings.port > 0 && g_HRDLogbookLogSettings.ip.length > 4 - ) { - try { + ) + { + try + { sendHRDLogbookEntry( record, g_HRDLogbookLogSettings.port, @@ -1676,14 +1979,19 @@ function finishSendingReport(record, localMode) { addLastTraffic( "Logged to HRD Logbook" ); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception HRD Log"); } } - try { + try + { sendLotwLogEntry(report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception LoTW Log"); } @@ -1691,32 +1999,44 @@ function finishSendingReport(record, localMode) { logeQSLQSOCheckBox.checked == true && nicknameeQSLCheckBox.checked == true && eQSLNickname.value.trim().length > 0 - ) { - record["APP_EQSL_QTH_NICKNAME"] = eQSLNickname.value.trim(); + ) + { + record.APP_EQSL_QTH_NICKNAME = eQSLNickname.value.trim(); report = ""; - for (var key in record) { + for (var key in record) + { report += "<" + key + ":" + record[key].length + ">" + record[key] + " "; } report += ""; } - try { + try + { sendeQSLEntry(report); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception LoTW Log"); } - try { + try + { alertLogMessage(); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception Alert Log"); } - if (lookupCloseLog.checked == true) { - try { + if (lookupCloseLog.checked == true) + { + try + { openLookupWindow(false); - } catch (e) { + } + catch (e) + { addLastTraffic("Exception Hide Lookup"); } } @@ -1725,57 +2045,81 @@ function finishSendingReport(record, localMode) { return report; } -function alertLogMessage() { - if (logEventMedia.value != "none") { +function alertLogMessage() +{ + if (logEventMedia.value != "none") + { playAlertMediaFile(logEventMedia.value); } } -function eqslCallback(buffer, flag) { +function eqslCallback(buffer, flag) +{ var result = String(buffer); - if (flag) { - if (result.indexOf("No such Username/Password found") != -1) { + if (flag) + { + if (result.indexOf("No such Username/Password found") != -1) + { eQSLTestResult.innerHTML = "Bad
Password
or
Nickname"; logeQSLQSOCheckBox.checked = false; adifLogQsoCheckBoxChanged(logeQSLQSOCheckBox); - } else if (result.indexOf("No such Callsign found") != -1) { + } + else if (result.indexOf("No such Callsign found") != -1) + { eQSLTestResult.innerHTML = "Unknown
Callsign"; logeQSLQSOCheckBox.checked = false; adifLogQsoCheckBoxChanged(logeQSLQSOCheckBox); - } else if (result.indexOf("Your ADIF log file has been built") != -1) { + } + else if (result.indexOf("Your ADIF log file has been built") != -1) + { eQSLTestResult.innerHTML = "Passed"; - } else if ( + } + else if ( result.indexOf("specify the desired User by using the QTHNickname") != -1 - ) { + ) + { eQSLTestResult.innerHTML = "QTH Nickname
Needed"; - } else { + } + else + { eQSLTestResult.innerHTML = "Unknown
Error"; logeQSLQSOCheckBox.checked = false; adifLogQsoCheckBoxChanged(logeQSLQSOCheckBox); } - } else { - if (result.indexOf("Error: No match on eQSL_User/eQSL_Pswd") != -1) { + } + else + { + if (result.indexOf("Error: No match on eQSL_User/eQSL_Pswd") != -1) + { addLastTraffic( "Fail log eQSL.cc (credentials)" ); } if ( result.indexOf("specify the desired User by using the QTHNickname") != -1 - ) { + ) + { addLastTraffic( "Fail log eQSL.cc (nickname)" ); - } else if (result.indexOf("Result: 0 out of 1 records") != -1) { + } + else if (result.indexOf("Result: 0 out of 1 records") != -1) + { addLastTraffic("Fail log eQSL.cc (dupe)"); - } else if (result.indexOf("Result: 1 out of 1 records added") != -1) { + } + else if (result.indexOf("Result: 1 out of 1 records added") != -1) + { addLastTraffic("Logged to eQSL.cc"); - } else { + } + else + { addLastTraffic("Fail log eQSL.cc (?)"); } } } -function eQSLTest(test) { +function eQSLTest(test) +{ if (g_mapSettings.offlineMode == true) return; eQSLTestResult.innerHTML = "Testing"; @@ -1788,14 +2132,16 @@ function eQSLTest(test) { "&RcvdSince=2020101"; if (nicknameeQSLCheckBox.checked == true) - fUrl += "&QTHNickname=" + encodeURIComponent(eQSLNickname.value); + { fUrl += "&QTHNickname=" + encodeURIComponent(eQSLNickname.value); } getABuffer(fUrl, eqslCallback, true, "https", 443); } -function sendeQSLEntry(report) { +function sendeQSLEntry(report) +{ if (g_mapSettings.offlineMode == true) return; - if (logeQSLQSOCheckBox.checked == true) { + if (logeQSLQSOCheckBox.checked == true) + { var pid = "GridTracker"; var pver = String(gtVersion); var header = "" + pid + "\r\n"; @@ -1813,8 +2159,10 @@ function sendeQSLEntry(report) { } } -function testTrustedQSL(test) { - if (g_mapSettings.offlineMode == true) { +function testTrustedQSL(test) +{ + if (g_mapSettings.offlineMode == true) + { lotwTestResult.innerHTML = "Currently
offline"; return; } @@ -1824,7 +2172,8 @@ function testTrustedQSL(test) { g_trustedQslSettings.binaryFileValid == true && g_trustedQslSettings.stationFileValid == true && lotwStation.value.length > 0 - ) { + ) + { lotwTestResult.innerHTML = "Testing Upload"; var child_process = require("child_process"); @@ -1835,29 +2184,32 @@ function testTrustedQSL(test) { child_process.execFile( g_trustedQslSettings.binaryFile, options, - (error, stdout, stderr) => { - if (error) { + (error, stdout, stderr) => + { + if (error) + { lotwTestResult.innerHTML = "Error encountered"; } lotwTestResult.innerHTML = stderr; } ); - return; - } else { + } + else + { var worker = ""; if (g_trustedQslSettings.binaryFileValid == false) - worker += "Invalid tqsl executable
"; + { worker += "Invalid tqsl executable
"; } if (g_trustedQslSettings.stationFileValid == false) - worker += "TrustQSL not installed
"; + { worker += "TrustQSL not installed
"; } if (!ValidateText(lotwTrusted)) worker += "TQSL Password missing
"; if (!ValidateText(lotwStation)) worker += "Select Station
"; lotwTestResult.innerHTML = worker; - return; } } var g_trustTempPath = ""; -function sendLotwLogEntry(report) { +function sendLotwLogEntry(report) +{ if (g_mapSettings.offlineMode == true) return; if ( @@ -1865,7 +2217,8 @@ function sendLotwLogEntry(report) { g_trustedQslSettings.binaryFileValid == true && g_trustedQslSettings.stationFileValid == true && lotwStation.value.length > 0 - ) { + ) + { var header = "Generated " + userTimeString(null) + " for " + myDEcall + "\r\n\r\n"; var pid = "GridTracker"; @@ -1884,7 +2237,8 @@ function sendLotwLogEntry(report) { options.push("all"); options.push("-l"); options.push(lotwStation.value); - if (lotwTrusted.value.length > 0) { + if (lotwTrusted.value.length > 0) + { options.push("-p"); options.push(lotwTrusted.value); } @@ -1897,11 +2251,15 @@ function sendLotwLogEntry(report) { child_process.execFile( g_trustedQslSettings.binaryFile, options, - (error, stdout, stderr) => { - if (stderr.indexOf("Final Status: Success") < 0) { + (error, stdout, stderr) => // eslint-disable-line node/handle-callback-err + { + if (stderr.indexOf("Final Status: Success") < 0) + { alert(stderr); addLastTraffic("Fail log to TQSL"); - } else { + } + else + { addLastTraffic("Logged to TQSL"); } fs.unlinkSync(g_trustTempPath); @@ -1910,7 +2268,8 @@ function sendLotwLogEntry(report) { } } -function n1mmLoggerChanged() { +function n1mmLoggerChanged() +{ g_N1MMSettings.enable = buttonN1MMCheckBox.checked; g_N1MMSettings.ip = N1MMIpInput.value; g_N1MMSettings.port = N1MMPortInput.value; @@ -1918,7 +2277,8 @@ function n1mmLoggerChanged() { localStorage.N1MMSettings = JSON.stringify(g_N1MMSettings); } -function log4OMLoggerChanged() { +function log4OMLoggerChanged() +{ g_log4OMSettings.enable = buttonLog4OMCheckBox.checked; g_log4OMSettings.ip = log4OMIpInput.value; g_log4OMSettings.port = log4OMPortInput.value; @@ -1926,7 +2286,8 @@ function log4OMLoggerChanged() { localStorage.log4OMSettings = JSON.stringify(g_log4OMSettings); } -function acLogLoggerChanged() { +function acLogLoggerChanged() +{ g_acLogSettings.enable = buttonacLogCheckBox.checked; g_acLogSettings.ip = acLogIpInput.value; g_acLogSettings.port = acLogPortInput.value; @@ -1934,7 +2295,8 @@ function acLogLoggerChanged() { localStorage.acLogSettings = JSON.stringify(g_acLogSettings); } -function dxkLogLoggerChanged() { +function dxkLogLoggerChanged() +{ g_dxkLogSettings.enable = buttondxkLogCheckBox.checked; g_dxkLogSettings.ip = dxkLogIpInput.value; g_dxkLogSettings.port = dxkLogPortInput.value; @@ -1942,7 +2304,8 @@ function dxkLogLoggerChanged() { localStorage.dxkLogSettings = JSON.stringify(g_dxkLogSettings); } -function hrdLogbookLoggerChanged() { +function hrdLogbookLoggerChanged() +{ g_HRDLogbookLogSettings.enable = buttonHrdLogbookCheckBox.checked; g_HRDLogbookLogSettings.ip = hrdLogbookIpInput.value; g_HRDLogbookLogSettings.port = hrdLogbookPortInput.value; @@ -1960,54 +2323,74 @@ function CloudUrlErrorCallback( timeoutMs, timeoutCallback, message -) { +) +{ CloudlogTestResult.innerHTML = message; } -function CloudlogSendLogResult(buffer, flag) { - if (flag && flag == true) { - if (buffer) { - if (buffer.indexOf("missing api key") > -1) { +function CloudlogSendLogResult(buffer, flag) +{ + if (flag && flag == true) + { + if (buffer) + { + if (buffer.indexOf("missing api key") > -1) + { CloudlogTestResult.innerHTML = "API Key Invalid"; - } else if (buffer.indexOf("created") > -1) { + } + else if (buffer.indexOf("created") > -1) + { CloudlogTestResult.innerHTML = "Passed"; - } else { + } + else + { CloudlogTestResult.innerHTML = "Invalid Response"; } - } else { + } + else + { CloudlogTestResult.innerHTML = "Invalid Response"; } - } else { + } + else + { if (buffer && buffer.indexOf("created") > -1) - addLastTraffic("Logged to Cloudlog"); + { addLastTraffic("Logged to Cloudlog"); } else addLastTraffic("Fail log to Cloudlog"); } } -function qrzSendLogResult(buffer, flag) { - if (typeof buffer != "undefined" && buffer != null) { +function qrzSendLogResult(buffer, flag) +{ + if (typeof buffer != "undefined" && buffer != null) + { var data = String(buffer); var kv = data.split("&"); - if (kv.length > 0) { + if (kv.length > 0) + { var arrData = Object(); - for (var x in kv) { + for (var x in kv) + { var split = kv[x].split("="); arrData[split[0]] = split[1]; } if ( - typeof arrData["RESULT"] == "undefined" || - arrData["RESULT"] != "OK" - ) { + typeof arrData.RESULT == "undefined" || + arrData.RESULT != "OK" + ) + { alert( "Error uploading QSO to QRZ.com (" + - (arrData["REASON"] || "Unknown error") + + (arrData.REASON || "Unknown error") + ")" ); addLastTraffic("Fail log to QRZ.com"); - } else - addLastTraffic("Logged to QRZ.com"); + } + else + { addLastTraffic("Logged to QRZ.com"); } } - } else alert("Error uploading QSO to QRZ.com (No response)"); + } + else alert("Error uploading QSO to QRZ.com (No response)"); } function postDialogRetryCallback( @@ -2020,8 +2403,10 @@ function postDialogRetryCallback( timeoutMs, timeoutCallback, who -) { - if (window.confirm("Error sending QSO to " + who + ", retry?")) { +) +{ + if (window.confirm("Error sending QSO to " + who + ", retry?")) + { getPostBuffer( file_url, callback, @@ -2046,7 +2431,8 @@ function postRetryErrorCallaback( timeoutMs, timeoutCallback, who -) { +) +{ getPostBuffer( file_url, callback, @@ -2060,15 +2446,18 @@ function postRetryErrorCallaback( ); } -function sendQrzLogEntry(report) { +function sendQrzLogEntry(report) +{ if (g_mapSettings.offlineMode == true) return; - if (logQRZqsoCheckBox.checked == true && ValidateQrzApi(qrzApiKey)) { - if (typeof nw != "undefined") { + if (logQRZqsoCheckBox.checked == true && ValidateQrzApi(qrzApiKey)) + { + if (typeof nw != "undefined") + { var postData = { KEY: qrzApiKey.value, ACTION: "INSERT", - ADIF: report, + ADIF: report }; getPostBuffer( "https://logbook.qrz.com/api", @@ -2085,21 +2474,25 @@ function sendQrzLogEntry(report) { } } -function clubLogQsoResult(buffer, flag) { +function clubLogQsoResult(buffer, flag) +{ addLastTraffic("Logged to ClubLog.org"); } -function sendClubLogEntry(report) { +function sendClubLogEntry(report) +{ if (g_mapSettings.offlineMode == true) return; - if (logClubqsoCheckBox.checked == true) { - if (typeof nw != "undefined") { + if (logClubqsoCheckBox.checked == true) + { + if (typeof nw != "undefined") + { var postData = { email: clubEmail.value, password: clubPassword.value, callsign: clubCall.value, adif: report, - api: CLk, + api: CLk }; getPostBuffer( @@ -2117,11 +2510,14 @@ function sendClubLogEntry(report) { } } -function sendCloudlogEntry(report) { +function sendCloudlogEntry(report) +{ if (g_mapSettings.offlineMode == true) return; - if (logCloudlogQSOCheckBox.checked == true) { - if (typeof nw != "undefined") { + if (logCloudlogQSOCheckBox.checked == true) + { + if (typeof nw != "undefined") + { var postData = { key: CloudlogAPI.value, type: "adif", string: report }; getPostJSONBuffer( CloudlogURL.value, @@ -2138,31 +2534,40 @@ function sendCloudlogEntry(report) { } } -function hrdSendLogResult(buffer, flag) { - if (flag && flag == true) { - if (buffer.indexOf("Unknown user") > -1) { +function hrdSendLogResult(buffer, flag) +{ + if (flag && flag == true) + { + if (buffer.indexOf("Unknown user") > -1) + { HRDLogTestResult.innerHTML = "Failed"; logHRDLOGqsoCheckBox.checked = false; adifLogQsoCheckBoxChanged(logHRDLOGqsoCheckBox); - } else HRDLogTestResult.innerHTML = "Passed"; - } else { + } + else HRDLogTestResult.innerHTML = "Passed"; + } + else + { if (buffer.indexOf("Unknown user") == -1) - addLastTraffic("Logged to HRDLOG.net"); + { addLastTraffic("Logged to HRDLOG.net"); } else - addLastTraffic("Fail log to HRDLOG.net"); + { addLastTraffic("Fail log to HRDLOG.net"); } } } -function sendHrdLogEntry(report) { +function sendHrdLogEntry(report) +{ if (g_mapSettings.offlineMode == true) return; - if (logHRDLOGqsoCheckBox.checked == true) { - if (typeof nw != "undefined") { + if (logHRDLOGqsoCheckBox.checked == true) + { + if (typeof nw != "undefined") + { var postData = { Callsign: HRDLOGCallsign.value, Code: HRDLOGUploadCode.value, App: "GridTracker " + gtVersion, - ADIFData: report, + ADIFData: report }; getPostBuffer( "https://www.hrdlog.net/NewEntry.aspx", @@ -2179,14 +2584,17 @@ function sendHrdLogEntry(report) { } } -function hrdCredentialTest(test) { - if (test && test == true) { +function hrdCredentialTest(test) +{ + if (test && test == true) + { HRDLogTestResult.innerHTML = "Testing"; - if (typeof nw != "undefined") { + if (typeof nw != "undefined") + { var postData = { Callsign: HRDLOGCallsign.value, - Code: HRDLOGUploadCode.value, + Code: HRDLOGUploadCode.value }; getPostBuffer( "https://www.hrdlog.net/NewEntry.aspx", @@ -2200,11 +2608,14 @@ function hrdCredentialTest(test) { } } -function ClublogTest(test) { - if (test && test == true) { +function ClublogTest(test) +{ + if (test && test == true) + { CloudlogTestResult.innerHTML = "Testing"; - if (typeof nw != "undefined") { + if (typeof nw != "undefined") + { var postData = { key: CloudlogAPI.value, type: "adif", string: "" }; getPostJSONBuffer( CloudlogURL.value, @@ -2231,50 +2642,61 @@ function getPostJSONBuffer( timeoutMs, timeoutCallback, who -) { - try { +) +{ + 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", - "Content-Length": postData.length, - }, + "Content-Length": postData.length + } }; - var req = http.request(options, function (res) { + var req = http.request(options, function (res) + { var fsize = res.headers["content-length"]; 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) { + .on("data", function (data) + { if (fileBuffer == null) fileBuffer = data; else fileBuffer += data; }) - .on("end", function () { - if (typeof callback === "function") { + .on("end", function () + { + if (typeof callback === "function") + { // Call it, since we have confirmed it is callable callback(fileBuffer, flag, cookies); } }) .on("error", function () {}); }); - if (typeof timeoutMs == "number" && timeoutMs > 0) { - req.on("socket", function (socket) { + if (typeof timeoutMs == "number" && timeoutMs > 0) + { + req.on("socket", function (socket) + { socket.setTimeout(timeoutMs); - socket.on("timeout", function () { + socket.on("timeout", function () + { 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, callback, @@ -2286,12 +2708,16 @@ function getPostJSONBuffer( timeoutCallback, who ); + } }); } req.write(postData); req.end(); - } catch (e) { + } + catch (e) + { if (typeof timeoutCallback != "undefined") + { timeoutCallback( file_url, callback, @@ -2303,17 +2729,20 @@ function getPostJSONBuffer( timeoutCallback, "Invalid Url" ); + } } } -function valueToXmlField(field, value) { +function valueToXmlField(field, value) +{ var adi = "<" + field + ">"; adi += String(value); adi += ""; return adi; } -function aclUpdateControlValue(control, value) { +function aclUpdateControlValue(control, value) +{ return ( valueToXmlField( "CMD", @@ -2324,18 +2753,21 @@ function aclUpdateControlValue(control, value) { ); } -function aclAction(action) { +function aclAction(action) +{ return ( valueToXmlField("CMD", "" + valueToXmlField("VALUE", action)) + "\r\n" ); } -function adifField(record, key) { +function adifField(record, key) +{ if (key in record) return record[key]; else return ""; } -function sendACLogMessage(record, port, address) { +function sendACLogMessage(record, port, address) +{ var report = ""; report += aclAction("CLEAR"); @@ -2347,12 +2779,14 @@ function sendACLogMessage(record, port, address) { adifField(record, "FREQ") ); if (adifField(record, "SUBMODE").length > 0) + { report += aclUpdateControlValue( "TXTENTRYMODE", adifField(record, "SUBMODE") ); + } else - report += aclUpdateControlValue("TXTENTRYMODE", adifField(record, "MODE")); + { report += aclUpdateControlValue("TXTENTRYMODE", adifField(record, "MODE")); } var date = adifField(record, "QSO_DATE"); var dataString = @@ -2406,12 +2840,15 @@ function sendACLogMessage(record, port, address) { report += aclUpdateControlValue("TXTENTRYCOUNTYR", adifField(record, "CNTY")); var sentSpcNum = false; - if (adifField(record, "SRX").length > 0) { + if (adifField(record, "SRX").length > 0) + { report += aclUpdateControlValue( "TXTENTRYSERIALNOR", adifField(record, "SRX") ); - } else if (adifField(record, "CONTEST_ID").length > 0) { + } + else if (adifField(record, "CONTEST_ID").length > 0) + { report += aclUpdateControlValue( "TXTENTRYSPCNUM", adifField(record, "SRX_STRING") @@ -2427,16 +2864,19 @@ function sendACLogMessage(record, port, address) { ); } - if (adifField(record, "STATE").length > 0) { + if (adifField(record, "STATE").length > 0) + { report += aclUpdateControlValue( "TXTENTRYSTATE", adifField(record, "STATE") ); if (sentSpcNum == false) + { report += aclUpdateControlValue( "TXTENTRYSPCNUM", adifField(record, "STATE") ); + } } report += aclAction("ENTER"); @@ -2444,7 +2884,8 @@ function sendACLogMessage(record, port, address) { sendTcpMessage(report, report.length, port, address); } -function sendDXKeeperLogMessage(newMessage, port, address) { +function sendDXKeeperLogMessage(newMessage, port, address) +{ var report = ""; report += valueToAdiField("command", "log"); @@ -2454,7 +2895,8 @@ function sendDXKeeperLogMessage(newMessage, port, address) { sendTcpMessage(report, report.length, Number(port) + 1, address); } -function parseADIFRecord(adif) { +function parseADIFRecord(adif) +{ var regex = new RegExp("", "i"); var newLine = adif.split(regex); var line = newLine[0].trim(); // Catch the naughty case of someone sending two records at the same time @@ -2463,19 +2905,24 @@ function parseADIFRecord(adif) { // because strings are not escaped for adif.. ie: :'s and <'s .. we have to walk from left to right // cheesy, but damn i'm tired of parsing things var x = 0; - while (line.length > 0) { - while (line.charAt(0) != "<" && line.length > 0) { + while (line.length > 0) + { + while (line.charAt(0) != "<" && line.length > 0) + { line = line.substr(1); } - if (line.length > 0) { + if (line.length > 0) + { line = line.substr(1); var where = line.indexOf(":"); - if (where != -1) { + if (where != -1) + { var fieldName = line.substr(0, where).toUpperCase(); line = line.substr(fieldName.length + 1); var fieldLength = parseInt(line); var end = line.indexOf(">"); - if (end > 0) { + if (end > 0) + { line = line.substr(end + 1); var fieldValue = line.substr(0, fieldLength); line = line.substr(fieldLength); @@ -2488,14 +2935,16 @@ function parseADIFRecord(adif) { return record; } -function sendHRDLogbookEntry(report, port, address) { +function sendHRDLogbookEntry(report, port, address) +{ var command = "ver\rdb add {"; var items = Object.assign({}, report); - items["FREQ"] = items["FREQ"].split(".").join(""); + items.FREQ = items.FREQ.split(".").join(""); - for (var item in items) { - command += item + '="' + items[item] + '" '; + for (var item in items) + { + command += item + "=\"" + items[item] + "\" "; } command += "}\rexit\r"; diff --git a/package.nw/lib/alerts.js b/package.nw/lib/alerts.js index 00396fb2..2cfdb193 100644 --- a/package.nw/lib/alerts.js +++ b/package.nw/lib/alerts.js @@ -11,8 +11,10 @@ var g_audioSettings = Object(); var g_speechAvailable = false; var g_alertSettings = Object(); -function loadAlerts() { - if (typeof localStorage.classicAlertsVersion == "undefined") { +function loadAlerts() +{ + if (typeof localStorage.classicAlertsVersion == "undefined") + { g_classicAlerts = { huntCallsign: false, huntGrid: false, @@ -43,7 +45,7 @@ function loadAlerts() { huntDXCCNotifyMedia: "none", huntCQzNotifyMedia: "none", huntITUzNotifyMedia: "none", - huntStatesNotifyMedia: "none", + huntStatesNotifyMedia: "none" }; localStorage.classicAlerts = JSON.stringify(g_classicAlerts); @@ -69,23 +71,28 @@ function loadAlerts() { localStorage.alertSettings = JSON.stringify(g_alertSettings); localStorage.classicAlertsVersion = gtVersion; - } else { + } + else + { g_classicAlerts = JSON.parse(localStorage.classicAlerts); g_alertSettings = JSON.parse(localStorage.alertSettings); } - if (typeof g_alertSettings.reference == "undefined") { + if (typeof g_alertSettings.reference == "undefined") + { g_alertSettings.reference = 0; localStorage.alertSettings = JSON.stringify(g_alertSettings); } - if (typeof g_alertSettings.logEventMedia == "undefined") { + if (typeof g_alertSettings.logEventMedia == "undefined") + { g_alertSettings.logEventMedia = "Ping-coin.mp3"; localStorage.alertSettings = JSON.stringify(g_alertSettings); } - if (typeof g_classicAlerts.huntRoster == "undefined") { + if (typeof g_classicAlerts.huntRoster == "undefined") + { g_classicAlerts.huntRoster = false; g_classicAlerts.huntRosterNotify = 1; g_classicAlerts.huntRosterNotifyWord = "New hit"; @@ -96,7 +103,8 @@ function loadAlerts() { loadClassicAlertView(); - if (typeof localStorage.savedAlerts == "undefined") { + if (typeof localStorage.savedAlerts == "undefined") + { g_alerts = { popup: { value: "QRZ", @@ -108,8 +116,8 @@ function loadAlerts() { lastMessage: "", lastTime: 0, fired: 0, - needAck: 0, - }, + needAck: 0 + } }; g_speechSettings = Object(); @@ -121,9 +129,12 @@ function loadAlerts() { g_speechSettings.phonetics = true; g_audioSettings.volume = 1; saveAlerts(); - } else { + } + else + { g_alerts = JSON.parse(localStorage.savedAlerts); - for (var key in g_alerts) { + for (var key in g_alerts) + { if ( g_alerts[key].type != 0 && g_alerts[key].type != 2 && @@ -131,14 +142,15 @@ function loadAlerts() { g_alerts[key].type != 5 && g_alerts[key].type != 6 ) - delete g_alerts[key]; + { delete g_alerts[key]; } if (g_alerts[key].repeat == 3) delete g_alerts[key]; } g_speechSettings = JSON.parse(localStorage.speechSettings); g_audioSettings = JSON.parse(localStorage.audioSettings); } - if (g_speechSettings.voice > 0) { + if (g_speechSettings.voice > 0) + { alertVoiceInput.value = g_speechSettings.voice - 1; } @@ -179,12 +191,14 @@ function loadAlerts() { setAlertVisual(); } -function newLogEventSetting(obj) { +function newLogEventSetting(obj) +{ g_alertSettings.logEventMedia = obj.value; localStorage.alertSettings = JSON.stringify(g_alertSettings); } -function exceptionValuesChanged() { +function exceptionValuesChanged() +{ setAlertVisual(); g_alertSettings.requireGrid = wantGrid.checked; @@ -212,71 +226,87 @@ function exceptionValuesChanged() { localStorage.alertSettings = JSON.stringify(g_alertSettings); } -function hashMaker(band, mode) { - //"Current Band & Mode" +function hashMaker(band, mode) +{ + // "Current Band & Mode" if (g_alertSettings.reference == 0) return band + mode; - //"Current Band, Any Mode" + // "Current Band, Any Mode" if (g_alertSettings.reference == 1) return band; - //"Current Band, Any Digi Mode" + // "Current Band, Any Digi Mode" if (g_alertSettings.reference == 2) return band + "dg"; - //"Current Mode, Any Band" + // "Current Mode, Any Band" if (g_alertSettings.reference == 3) return mode; - //"Any Band, Any Mode" + // "Any Band, Any Mode" if (g_alertSettings.reference == 4) return ""; - //"Any Band, Any Digit Mode" + // "Any Band, Any Digit Mode" if (g_alertSettings.reference == 5) return "dg"; } -function setAlertVisual() { - if (wantMaxDT.checked == true) { +function setAlertVisual() +{ + if (wantMaxDT.checked == true) + { maxDT.style.display = "block"; maxDTView.style.display = "block"; - } else { + } + else + { maxDT.style.display = "none"; maxDTView.style.display = "none"; } - if (wantMinDB.checked == true) { + if (wantMinDB.checked == true) + { minDb.style.display = "block"; minDbView.style.display = "block"; - } else { + } + else + { minDb.style.display = "none"; minDbView.style.display = "none"; } - if (wantMinFreq.checked == true) { + if (wantMinFreq.checked == true) + { minFreq.style.display = "block"; minFreqView.style.display = "block"; - } else { + } + else + { minFreq.style.display = "none"; minFreqView.style.display = "none"; } - if (wantMaxFreq.checked == true) { + if (wantMaxFreq.checked == true) + { maxFreq.style.display = "block"; maxFreqView.style.display = "block"; - } else { + } + else + { maxFreq.style.display = "none"; maxFreqView.style.display = "none"; } if (g_callsignLookups.lotwUseEnable == true) - usesLoTWDiv.style.display = "block"; + { usesLoTWDiv.style.display = "block"; } else usesLoTWDiv.style.display = "none"; if (g_callsignLookups.eqslUseEnable == true) - useseQSLDiv.style.display = "block"; + { useseQSLDiv.style.display = "block"; } else useseQSLDiv.style.display = "none"; } -function saveAlertSettings() { +function saveAlertSettings() +{ localStorage.speechSettings = JSON.stringify(g_speechSettings); localStorage.audioSettings = JSON.stringify(g_audioSettings); } -function saveAlerts() { +function saveAlerts() +{ localStorage.savedAlerts = JSON.stringify(g_alerts); saveAlertSettings(); @@ -284,7 +314,8 @@ function saveAlerts() { var g_testAudioTimer = null; -function changeAudioValues() { +function changeAudioValues() +{ if (g_testAudioTimer) clearTimeout(g_testAudioTimer); g_audioSettings.volume = audioVolume.value; @@ -294,11 +325,13 @@ function changeAudioValues() { saveAlertSettings(); } -function playTestFile() { +function playTestFile() +{ playAlertMediaFile("Sysenter-7.mp3"); } -function changeSpeechValues() { +function changeSpeechValues() +{ chrome.tts.stop(); g_speechSettings.volume = speechVolume.value; @@ -313,30 +346,38 @@ function changeSpeechValues() { saveAlertSettings(); } -function addNewAlert() { +function addNewAlert() +{ var error = "Added"; var valid = true; var filename = ""; var shortname = ""; - if (alertNotifySelect.value == 0) { - if (alertMediaSelect.value == "none") { + if (alertNotifySelect.value == 0) + { + if (alertMediaSelect.value == "none") + { valid = false; error = "Select File!"; - } else { + } + else + { filename = alertMediaSelect.value; shortname = alertMediaSelect.selectedOptions[0].innerText; } } - if (valid) { - if (alertTypeSelect.value == 0 || alertTypeSelect.value == 5) { + if (valid) + { + if (alertTypeSelect.value == 0 || alertTypeSelect.value == 5) + { valid = ValidateCallsign(alertValueInput, null); - if (!valid) { + if (!valid) + { error = "Invalid Callsign"; - } else { } } } - if (valid) { + if (valid) + { valid = addAlert( alertValueInput.value, alertTypeSelect.value, @@ -345,7 +386,8 @@ function addNewAlert() { filename, shortname ); - if (!valid) { + if (!valid) + { error = "Duplicate!"; } } @@ -353,10 +395,12 @@ function addNewAlert() { displayAlerts(); } -function addAlert(value, type, notify, repeat, filename, shortname) { +function addAlert(value, type, notify, repeat, filename, shortname) +{ var newKey = unique(value + type + notify + repeat + filename); - if (!g_alerts.hasOwnProperty(newKey)) { + if (!g_alerts.hasOwnProperty(newKey)) + { var alertItem = Object(); alertItem.value = value; alertItem.type = type; @@ -376,13 +420,15 @@ function addAlert(value, type, notify, repeat, filename, shortname) { return false; // we have this alert already } -function deleteAlert(key) { +function deleteAlert(key) +{ delete g_alerts[key]; saveAlerts(); displayAlerts(); } -function resetAlert(key) { +function resetAlert(key) +{ g_alerts[key].lastMessage = ""; g_alerts[key].lastTime = 0; g_alerts[key].fired = 0; @@ -390,11 +436,14 @@ function resetAlert(key) { displayAlerts(); } -function processAlertMessage(decodeWords, message, band, mode) { +function processAlertMessage(decodeWords, message, band, mode) +{ if (Object.keys(g_alerts).length == 0) + { // no alerts, don't bother return false; - + } + else { var CQ = false; var validQTH = false; @@ -404,17 +453,22 @@ function processAlertMessage(decodeWords, message, band, mode) { // Grab the last word in the decoded message var grid = decodeWords[decodeWords.length - 1].trim(); - if (grid.length == 4) { + if (grid.length == 4) + { // maybe it's a grid var LETTERS = grid.substr(0, 2); var NUMBERS = grid.substr(2, 2); - if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) { + if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) + { theirGrid = LETTERS + NUMBERS; - if (theirGrid != "RR73") { + if (theirGrid != "RR73") + { validQTH = true; - } else { + } + else + { theirGrid = null; validQTH = false; } @@ -423,29 +477,32 @@ function processAlertMessage(decodeWords, message, band, mode) { if (validQTH) msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); if (validQTH == false && decodeWords.length == 3) - msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); + { msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); } if (validQTH == false && decodeWords.length == 2) - msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); - if (decodeWords[0] == "CQ") { + { msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); } + if (decodeWords[0] == "CQ") + { CQ = true; } - if (decodeWords.length >= 3 && CQ == true && validQTH == false) { + if (decodeWords.length >= 3 && CQ == true && validQTH == false) + { if (validateNumAndLetter(decodeWords[decodeWords.length - 1].trim())) - msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); + { msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); } else msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); } - if (decodeWords.length >= 4 && CQ == false) { + if (decodeWords.length >= 4 && CQ == false) + { msgDEcallsign = decodeWords[1]; } var okayToAlert = true; if (msgDEcallsign + band + mode in g_liveCallsigns) - found_callsign = g_liveCallsigns[msgDEcallsign + band + mode]; + { found_callsign = g_liveCallsigns[msgDEcallsign + band + mode]; } if (okayToAlert == true) - return checkAlerts(msgDEcallsign, theirGrid, message, found_callsign); + { return checkAlerts(msgDEcallsign, theirGrid, message, found_callsign); } } return false; } @@ -457,61 +514,81 @@ function checkAlerts( callsignRecord, band, mode -) { +) +{ var hadAlert = false; - for (var key in g_alerts) { + for (var key in g_alerts) + { var nalert = g_alerts[key]; - if (nalert.type == 0) { + if (nalert.type == 0) + { // callsign exatch match - if (DEcallsign == nalert.value) { + if (DEcallsign == nalert.value) + { handleAlert(nalert, DEcallsign, originalMessage, callsignRecord); hadAlert = true; } - } else if (grid && nalert.type == 2) { + } + else if (grid && nalert.type == 2) + { // gridsquare if ( !(DEcallsign + band + mode in g_tracker.worked.call) && grid.indexOf(nalert.value) == 0 - ) { + ) + { handleAlert(nalert, DEcallsign, originalMessage, callsignRecord, grid); hadAlert = true; } - } else if (nalert.type == 4) { + } + else if (nalert.type == 4) + { // QRZ - if (myDEcall.length > 0 && originalMessage.indexOf(myDEcall + " ") == 0) { + if (myDEcall.length > 0 && originalMessage.indexOf(myDEcall + " ") == 0) + { handleAlert(nalert, DEcallsign, originalMessage, callsignRecord); hadAlert = true; } - } else if (nalert.type == 5) { + } + else if (nalert.type == 5) + { // callsign partial if ( !(DEcallsign + band + mode in g_tracker.worked.call) && DEcallsign.indexOf(nalert.value) == 0 - ) { + ) + { handleAlert(nalert, DEcallsign, originalMessage, callsignRecord); hadAlert = true; } - } else if (nalert.type == 6) { + } + else if (nalert.type == 6) + { // callsign regex - try { + try + { if ( !(DEcallsign + band + mode in g_tracker.worked.call) && DEcallsign.match(nalert.value) - ) { + ) + { handleAlert(nalert, DEcallsign, originalMessage, callsignRecord); hadAlert = true; } - } catch (e) {} + } + catch (e) {} } } - if (hadAlert) { + if (hadAlert) + { displayAlerts(); return true; } return false; } -function handleAlert(nAlert, target, lastMessage, callsignRecord, grid) { +function handleAlert(nAlert, target, lastMessage, callsignRecord, grid) +{ if (nAlert.fired > 0 && nAlert.repeat == 0) return; if (nAlert.fired == 1 && nAlert.repeat == 1) return; @@ -519,12 +596,14 @@ function handleAlert(nAlert, target, lastMessage, callsignRecord, grid) { nAlert.lastMessage = lastMessage; nAlert.lastTime = timeNowSec(); - if (callsignRecord != null) { + if (callsignRecord != null) + { if ( typeof callsignRecord.rect != "undefined" && callsignRecord.rect != null && nAlert.notify == 3 - ) { + ) + { // Fix me g_map .getView() @@ -536,19 +615,22 @@ function handleAlert(nAlert, target, lastMessage, callsignRecord, grid) { if (nAlert.notify == 2) nAlert.needAck = 1; - if (nAlert.type == 0 || nAlert.type == 5 || nAlert.type == 6) { + if (nAlert.type == 0 || nAlert.type == 5 || nAlert.type == 6) + { if (nAlert.notify == 0) playAlertMediaFile(nAlert.filename); if (nAlert.notify == 1) speakAlertString("Callsign", target, null); if (nAlert.notify == 2) displayAlertPopUp("Seeking", target, null); } - if (nAlert.type == 2) { + if (nAlert.type == 2) + { if (nAlert.notify == 0) playAlertMediaFile(nAlert.filename); if (nAlert.notify == 1) speakAlertString("Grid square", grid, null); if (nAlert.notify == 2) displayAlertPopUp("Gridsquare", grid, target); } - if (nAlert.type == 4) { + if (nAlert.type == 4) + { if (nAlert.notify == 0) playAlertMediaFile(nAlert.filename); if (nAlert.notify == 1) speakQRZString(target, "Calling", myDEcall); if (nAlert.notify == 2) displayAlertPopUp("QRZ", null, null); @@ -556,7 +638,8 @@ function handleAlert(nAlert, target, lastMessage, callsignRecord, grid) { nAlert.fired++; } -function playAlertMediaFile(filename, overrideMute) { +function playAlertMediaFile(filename, overrideMute) +{ if (g_appSettings.alertMute && !overrideMute) return; var fpath = path.join(g_userMediaDir, filename); @@ -569,12 +652,15 @@ function playAlertMediaFile(filename, overrideMute) { audio.play(); } -function stringToPhonetics(string) { +function stringToPhonetics(string) +{ var newMsg = ""; - for (var x = 0; x < string.length; x++) { + for (var x = 0; x < string.length; x++) + { if (g_speechSettings.phonetics == true) - newMsg += g_phonetics[string.substr(x, 1)]; - else { + { newMsg += g_phonetics[string.substr(x, 1)]; } + else + { if (string.substr(x, 1) == " ") newMsg += ", "; else newMsg += string.substr(x, 1); } @@ -584,19 +670,22 @@ function stringToPhonetics(string) { return newMsg; } -function speakQRZString(caller, words, you) { - if (g_appSettings.alertMute == 0) { +function speakQRZString(caller, words, you) +{ + if (g_appSettings.alertMute == 0) + { var sCaller = ""; var sYou = ""; if (caller) sCaller = stringToPhonetics(caller); if (you) sYou = stringToPhonetics(you); - if (g_speechAvailable) { + if (g_speechAvailable) + { var speak = sCaller.trim() + ", " + words.trim() + ", " + sYou.trim(); var msg = new SpeechSynthesisUtterance(speak); msg.lang = g_localeString; if (g_speechSettings.voice > 0) - msg.voice = g_voices[g_speechSettings.voice - 1]; + { msg.voice = g_voices[g_speechSettings.voice - 1]; } msg.rate = g_speechSettings.rate; msg.pitch = g_speechSettings.pitch; msg.volume = g_speechSettings.volume; @@ -605,19 +694,22 @@ function speakQRZString(caller, words, you) { } } -function speakAlertString(what, message, target) { - if (g_appSettings.alertMute == 0) { +function speakAlertString(what, message, target) +{ + if (g_appSettings.alertMute == 0) + { var sMsg = ""; var sTarget = ""; if (message) sMsg = stringToPhonetics(message); if (target) sTarget = stringToPhonetics(target); - if (g_speechAvailable) { + if (g_speechAvailable) + { var speak = what.trim() + ", " + sMsg.trim() + ", " + sTarget.trim(); var msg = new SpeechSynthesisUtterance(speak); msg.lang = g_localeString; if (g_speechSettings.voice > 0) - msg.voice = g_voices[g_speechSettings.voice - 1]; + { msg.voice = g_voices[g_speechSettings.voice - 1]; } msg.rate = g_speechSettings.rate; msg.pitch = g_speechSettings.pitch; msg.volume = g_speechSettings.volume; @@ -628,13 +720,16 @@ function speakAlertString(what, message, target) { var g_alertFlasher = null; -function unflashAlertPopUp() { +function unflashAlertPopUp() +{ var worker = ""; var acount = 0; alertsPopDiv.style.backgroundColor = "#000"; - if (Object.keys(g_alerts).length > 0) { - for (var key in g_alerts) { + if (Object.keys(g_alerts).length > 0) + { + for (var key in g_alerts) + { if (g_alerts[key].needAck) acount++; } @@ -656,21 +751,25 @@ function unflashAlertPopUp() { worker += "When"; worker += ""; - for (var key in g_alerts) { - if (g_alerts[key].needAck) { + for (var key in g_alerts) + { + if (g_alerts[key].needAck) + { worker += ""; worker += "" + g_alertTypeOptions[g_alerts[key].type] + ""; if (g_alerts[key].type == 0) - worker += "" + g_alerts[key].value + ""; + { worker += "" + g_alerts[key].value + ""; } if (g_alerts[key].type == 2) - worker += "" + g_alerts[key].value + ""; + { worker += "" + g_alerts[key].value + ""; } if (g_alerts[key].type == 4) - worker += "" + myDEcall + ""; + { worker += "" + myDEcall + ""; } if (g_alerts[key].type == 5) + { worker += "" + g_alerts[key].value + "*"; + } if (g_alerts[key].type == 6) - worker += "" + g_alerts[key].value + ""; + { worker += "" + g_alerts[key].value + ""; } worker += "" + g_alertValueOptions[g_alerts[key].notify] + ""; worker += "" + g_alertRepeatOptions[g_alerts[key].repeat] + ""; @@ -699,7 +798,8 @@ function unflashAlertPopUp() { g_alertFlasher = null; } -function displayAlertPopUp(what, message, target) { +function displayAlertPopUp(what, message, target) +{ if (g_alertFlasher) clearTimeout(g_alertFlasher); alertPopListDiv.innerHTML = @@ -709,48 +809,63 @@ function displayAlertPopUp(what, message, target) { g_alertFlasher = setTimeout(unflashAlertPopUp, 100); } -function ackAlerts() { +function ackAlerts() +{ alertsPopDiv.style.display = "none"; - for (var key in g_alerts) { + for (var key in g_alerts) + { g_alerts[key].needAck = 0; } } -function alertTypeChanged() { +function alertTypeChanged() +{ addError.innerHTML = ""; - if (alertTypeSelect.value == 0 || alertTypeSelect.value == 5) { + if (alertTypeSelect.value == 0 || alertTypeSelect.value == 5) + { alertValueSelect.innerHTML = ""; alertValueSelect.innerHTML = - ''; + ""; ValidateCallsign(alertValueInput, null); - } else if (alertTypeSelect.value == 2) { + } + else if (alertTypeSelect.value == 2) + { alertValueSelect.innerHTML = ""; alertValueSelect.innerHTML = - ''; + ""; ValidateGridsquareOnly4(alertValueInput, null); - } else if (alertTypeSelect.value == 4) { + } + else if (alertTypeSelect.value == 4) + { alertValueSelect.innerHTML = - ''; + "\" maxlength=\"12\" size=\"5\" oninput=\"ValidateCallsign(this,null);\" / >"; ValidateCallsign(alertValueInput, null); - } else if (alertTypeSelect.value == 6) { + } + else if (alertTypeSelect.value == 6) + { alertValueSelect.innerHTML = ""; alertValueSelect.innerHTML = - ''; + ""; ValidateText(alertValueInput); } } -function alertNotifyChanged(who = "") { +function alertNotifyChanged(who = "") +{ addError.innerHTML = ""; - if (alertNotifySelect.value == 0) { + if (alertNotifySelect.value == 0) + { alertMediaSelect.style.display = "block"; - if (who == "media") { + if (who == "media") + { playAlertMediaFile(alertMediaSelect.value); } - } else { + } + else + { alertMediaSelect.style.display = "none"; } } @@ -779,10 +894,12 @@ g_alertRepeatOptions["1"] = "Once"; g_alertRepeatOptions["2"] = "Inf"; g_alertRepeatOptions["3"] = "Inf(Session)"; -function displayAlerts() { +function displayAlerts() +{ var worker = ""; - if (Object.keys(g_alerts).length > 0) { + if (Object.keys(g_alerts).length > 0) + { worker += "
" + g_alerts[key].value + ""; + { worker += "" + g_alerts[key].value + ""; } if (g_alerts[key].type == 2) - worker += "" + g_alerts[key].value + ""; + { worker += "" + g_alerts[key].value + ""; } if (g_alerts[key].type == 4) - worker += "" + myDEcall + ""; + { worker += "" + myDEcall + ""; } if (g_alerts[key].type == 5) + { worker += "" + g_alerts[key].value + "*"; + } if (g_alerts[key].type == 6) - worker += "" + g_alerts[key].value + ""; + { worker += "" + g_alerts[key].value + ""; } worker += "" + g_alertValueOptions[g_alerts[key].notify] + ""; worker += "" + g_alertRepeatOptions[g_alerts[key].repeat] + ""; @@ -850,51 +970,71 @@ function displayAlerts() { alertListDiv.innerHTML = worker; } -function loadClassicAlertView() { - for (node in g_classicAlerts) { +function loadClassicAlertView() +{ + for (node in g_classicAlerts) + { what = document.getElementById(node); - if (what != null) { - if (what.type == "select-one" || what.type == "text") { + if (what != null) + { + if (what.type == "select-one" || what.type == "text") + { what.value = g_classicAlerts[node]; - if (what.id.endsWith("Notify")) { + if (what.id.endsWith("Notify")) + { var mediaNode = document.getElementById(what.id + "Media"); var wordNode = document.getElementById(what.id + "Word"); - if (what.value == "0") { + if (what.value == "0") + { mediaNode.style.display = "block"; wordNode.style.display = "none"; - } else { + } + else + { mediaNode.style.display = "none"; wordNode.style.display = "block"; } } - if (what.type == "text") { + if (what.type == "text") + { ValidateText(what); } - } else if (what.type == "checkbox") { + } + else if (what.type == "checkbox") + { what.checked = g_classicAlerts[node]; } } } } -function wantedChanged(what) { - if (what.type == "select-one" || what.type == "text") { +function wantedChanged(what) +{ + if (what.type == "select-one" || what.type == "text") + { g_classicAlerts[what.id] = what.value; - if (what.id.endsWith("Notify")) { + if (what.id.endsWith("Notify")) + { var mediaNode = document.getElementById(what.id + "Media"); var wordNode = document.getElementById(what.id + "Word"); - if (what.value == "0") { + if (what.value == "0") + { mediaNode.style.display = "block"; wordNode.style.display = "none"; - } else { + } + else + { mediaNode.style.display = "none"; wordNode.style.display = "block"; } } - if (what.id.endsWith("Media")) { + if (what.id.endsWith("Media")) + { if (what.value != "none") playAlertMediaFile(what.value); } - } else if (what.type == "checkbox") { + } + else if (what.type == "checkbox") + { g_classicAlerts[what.id] = what.checked; } localStorage.classicAlerts = JSON.stringify(g_classicAlerts); @@ -906,7 +1046,7 @@ var g_classic_alert_count_template = { huntDXCC: 0, huntCQz: 0, huntITUz: 0, - huntStates: 0, + huntStates: 0 }; var g_classic_alert_counts = Object.assign({}, g_classic_alert_count_template); @@ -917,7 +1057,7 @@ var g_classic_alert_functions = { huntDXCC: alertCheckDXCC, huntCQz: alertCheckCQz, huntITUz: alertCheckITUz, - huntStates: alertCheckStates, + huntStates: alertCheckStates }; var g_classic_alert_words = { @@ -926,20 +1066,26 @@ var g_classic_alert_words = { huntDXCC: "DXCC", huntCQz: "CQ Zone", huntITUz: "I-T-U Zone", - huntStates: "State", + huntStates: "State" }; -function processClassicAlerts() { - for (key in g_classic_alert_counts) { +function processClassicAlerts() +{ + for (key in g_classic_alert_counts) + { if ( document.getElementById(key).checked == true && g_classic_alert_counts[key] > 0 - ) { + ) + { var notify = document.getElementById(key + "Notify").value; - if (notify == "0") { + if (notify == "0") + { var media = document.getElementById(key + "Notify" + "Media").value; if (media != "none") playAlertMediaFile(media); - } else if (notify == "1") { + } + else if (notify == "1") + { speakAlertString( document.getElementById(key + "Notify" + "Word").value ); @@ -949,57 +1095,66 @@ function processClassicAlerts() { g_classic_alert_counts = Object.assign({}, g_classic_alert_count_template); } -function checkClassicAlerts(CQ, callObj, message, DXcall) { +function checkClassicAlerts(CQ, callObj, message, DXcall) +{ var didAlert = false; if (g_alertSettings.cqOnly == true && CQ == false) return didAlert; if (g_alertSettings.requireGrid == true && callObj.grid.length != 4) - return didAlert; + { return didAlert; } if (g_alertSettings.wantMinDB == true && message.SR < g_alertSettings.minDb) - return didAlert; + { return didAlert; } if ( g_alertSettings.wantMaxDT == true && Math.abs(message.DT) > g_alertSettings.maxDT ) - return didAlert; + { return didAlert; } if ( g_alertSettings.wantMinFreq == true && message.DF < g_alertSettings.minFreq ) - return didAlert; + { return didAlert; } if ( g_alertSettings.wantMaxFreq == true && message.DF > g_alertSettings.maxFreq ) - return didAlert; + { return didAlert; } - if (DXcall == "CQ RU") { + if (DXcall == "CQ RU") + { if (g_alertSettings.noRoundUp == true) return didAlert; - } else { + } + else + { if (g_alertSettings.onlyRoundUp == true) return didAlert; } - if (callObj.dxcc == g_myDXCC) { + if (callObj.dxcc == g_myDXCC) + { if (g_alertSettings.noMyDxcc == true) return didAlert; - } else { + } + else + { if (g_alertSettings.onlyMyDxcc == true) return didAlert; } if ( g_callsignLookups.lotwUseEnable == true && g_alertSettings.usesLoTW == true - ) { + ) + { if (!(callObj.DEcall in g_lotwCallsigns)) return didAlert; } if ( g_callsignLookups.eqslUseEnable == true && g_alertSettings.useseQSL == true - ) { + ) + { if (!(callObj.DEcall in g_eqslCallsigns)) return didAlert; } @@ -1009,10 +1164,12 @@ function checkClassicAlerts(CQ, callObj, message, DXcall) { callObj.DEcall + hashMaker(callObj.band, callObj.mode) in g_tracker.worked.call ) - return didAlert; + { return didAlert; } - for (key in g_classic_alert_functions) { - if (document.getElementById(key).checked == true) { + for (key in g_classic_alert_functions) + { + if (document.getElementById(key).checked == true) + { var alerted = g_classic_alert_functions[key](key, callObj); if (alerted == true) didAlert = true; g_classic_alert_counts[key] += alerted; @@ -1022,7 +1179,8 @@ function checkClassicAlerts(CQ, callObj, message, DXcall) { return didAlert; } -function alertCheckCallsign(key, callObj) { +function alertCheckCallsign(key, callObj) +{ var status = document.getElementById(key + "Need").value; if ( @@ -1030,18 +1188,19 @@ function alertCheckCallsign(key, callObj) { callObj.DEcall + hashMaker(callObj.band, callObj.mode) in g_tracker.worked.call ) - return 0; + { return 0; } if ( status == "confirmed" && callObj.DEcall + hashMaker(callObj.band, callObj.mode) in g_tracker.confirmed.call ) - return 0; + { return 0; } return 1; } -function alertCheckGrid(key, callObj) { +function alertCheckGrid(key, callObj) +{ var status = document.getElementById(key + "Need").value; if (callObj.grid.length == 0) return 0; @@ -1050,18 +1209,19 @@ function alertCheckGrid(key, callObj) { callObj.grid + hashMaker(callObj.band, callObj.mode) in g_tracker.worked.grid ) - return 0; + { return 0; } if ( status == "confirmed" && callObj.grid + hashMaker(callObj.band, callObj.mode) in g_tracker.confirmed.grid ) - return 0; + { return 0; } return 1; } -function alertCheckDXCC(key, callObj) { +function alertCheckDXCC(key, callObj) +{ var status = document.getElementById(key + "Need").value; if ( @@ -1069,23 +1229,25 @@ function alertCheckDXCC(key, callObj) { String(callObj.dxcc) + hashMaker(callObj.band, callObj.mode) in g_tracker.worked.dxcc ) - return 0; + { return 0; } if ( status == "confirmed" && String(callObj.dxcc) + hashMaker(callObj.band, callObj.mode) in g_tracker.confirmed.dxcc ) - return 0; + { return 0; } return 1; } -function alertCheckCQz(key, callObj) { +function alertCheckCQz(key, callObj) +{ var workedTotal = (confirmedTotal = callObj.cqza.length); if (workedTotal == 0) return 0; var workedFound = (confirmedFound = 0); - for (index in callObj.cqza) { + for (index in callObj.cqza) + { var hash = callObj.cqza[index] + hashMaker(callObj.band, callObj.mode); if (hash in g_tracker.worked.cqz) workedFound++; @@ -1100,12 +1262,14 @@ function alertCheckCQz(key, callObj) { return 1; } -function alertCheckITUz(key, callObj) { +function alertCheckITUz(key, callObj) +{ var workedTotal = (confirmedTotal = callObj.ituza.length); if (workedTotal == 0) return 0; var workedFound = (confirmedFound = 0); - for (index in callObj.ituza) { + for (index in callObj.ituza) + { var hash = callObj.ituza[index] + hashMaker(callObj.band, callObj.mode); if (hash in g_tracker.worked.ituz) workedFound++; @@ -1120,9 +1284,12 @@ function alertCheckITUz(key, callObj) { return 1; } -function alertCheckStates(key, callObj) { - if (callObj.dxcc == 291 || callObj.dxcc == 110 || callObj.dxcc == 6) { - if (callObj.state in g_StateData) { +function alertCheckStates(key, callObj) +{ + if (callObj.dxcc == 291 || callObj.dxcc == 110 || callObj.dxcc == 6) + { + if (callObj.state in g_StateData) + { var hash = callObj.state + hashMaker(callObj.band, callObj.mode); var status = document.getElementById(key + "Need").value; diff --git a/package.nw/lib/arc.js b/package.nw/lib/arc.js index df563424..4c6d30c3 100644 --- a/package.nw/lib/arc.js +++ b/package.nw/lib/arc.js @@ -3,75 +3,94 @@ var D2R = Math.PI / 180; var R2D = 180 / Math.PI; -var Coord = function (lon, lat) { +var Coord = function (lon, lat) +{ this.lon = lon; this.lat = lat; this.x = D2R * lon; this.y = D2R * lat; }; -Coord.prototype.view = function () { +Coord.prototype.view = function () +{ return String(this.lon).slice(0, 4) + "," + String(this.lat).slice(0, 4); }; -Coord.prototype.antipode = function () { +Coord.prototype.antipode = function () +{ var anti_lat = -1 * this.lat; var anti_lon = this.lon < 0 ? 180 + this.lon : (180 - this.lon) * -1; return new Coord(anti_lon, anti_lat); }; -var LineString = function () { +var LineString = function () +{ this.coords = []; this.length = 0; }; -LineString.prototype.move_to = function (coord) { +LineString.prototype.move_to = function (coord) +{ this.length++; this.coords.push(coord); }; -var Arc = function (properties) { +var Arc = function (properties) +{ this.properties = properties || {}; this.geometries = []; }; -Arc.prototype.json = function () { - if (this.geometries.length <= 0) { +Arc.prototype.json = function () +{ + if (this.geometries.length <= 0) + { return { geometry: { type: "LineString", coordinates: null }, type: "Feature", - properties: this.properties, + properties: this.properties }; - } else if (this.geometries.length == 1) { + } + else if (this.geometries.length == 1) + { return { geometry: { type: "LineString", coordinates: this.geometries[0].coords }, type: "Feature", - properties: this.properties, + properties: this.properties }; - } else { + } + else + { var multiline = []; - for (var i = 0; i < this.geometries.length; i++) { + for (var i = 0; i < this.geometries.length; i++) + { multiline.push(this.geometries[i].coords); } return { geometry: { type: "MultiLineString", coordinates: multiline }, type: "Feature", - properties: this.properties, + properties: this.properties }; } }; // TODO - output proper multilinestring -Arc.prototype.wkt = function () { +Arc.prototype.wkt = function () +{ var wkt_string = ""; var wkt = "LINESTRING("; - var collect = function (c) { + var collect = function (c) + { wkt += c[0] + " " + c[1] + ","; }; - for (var i = 0; i < this.geometries.length; i++) { - if (this.geometries[i].coords.length === 0) { + for (var i = 0; i < this.geometries.length; i++) + { + if (this.geometries[i].coords.length === 0) + { return "LINESTRING(empty)"; - } else { + } + else + { var coords = this.geometries[i].coords; coords.forEach(collect); wkt_string += wkt.substring(0, wkt.length - 1) + ")"; @@ -84,13 +103,16 @@ Arc.prototype.wkt = function () { * http://en.wikipedia.org/wiki/Great-circle_distance * */ -var GreatCircle = function (start, end, properties) { - if (!start || start.x === undefined || start.y === undefined) { +var GreatCircle = function (start, end, properties) +{ + if (!start || start.x === undefined || start.y === undefined) + { throw new Error( "GreatCircle constructor expects two args: start and end objects with x and y properties" ); } - if (!end || end.x === undefined || end.y === undefined) { + if (!end || end.x === undefined || end.y === undefined) + { throw new Error( "GreatCircle constructor expects two args: start and end objects with x and y properties" ); @@ -108,7 +130,8 @@ var GreatCircle = function (start, end, properties) { Math.pow(Math.sin(w / 2.0), 2); this.g = 2.0 * Math.asin(Math.sqrt(z)); - if (this.g == Math.PI) { + if (this.g == Math.PI) + { throw new Error( "it appears " + start.view() + @@ -116,7 +139,9 @@ var GreatCircle = function (start, end, properties) { end.view() + " are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite" ); - } else if (isNaN(this.g)) { + } + else if (isNaN(this.g)) + { throw new Error( "could not calculate great circle between " + start + " and " + end ); @@ -126,7 +151,8 @@ var GreatCircle = function (start, end, properties) { /* * http://williams.best.vwh.net/avform.htm#Intermediate */ -GreatCircle.prototype.interpolate = function (f) { +GreatCircle.prototype.interpolate = function (f) +{ var A = Math.sin((1 - f) * this.g) / Math.sin(this.g); var B = Math.sin(f * this.g) / Math.sin(this.g); var x = @@ -144,14 +170,19 @@ GreatCircle.prototype.interpolate = function (f) { /* * Generate points along the great circle */ -GreatCircle.prototype.Arc = function (npoints, options) { +GreatCircle.prototype.Arc = function (npoints, options) +{ var first_pass = []; - if (!npoints || npoints <= 2) { + if (!npoints || npoints <= 2) + { first_pass.push([this.start.lon, this.start.lat]); first_pass.push([this.end.lon, this.end.lat]); - } else { + } + else + { var delta = 1.0 / (npoints - 1); - for (var i = 0; i < npoints; ++i) { + for (var i = 0; i < npoints; ++i) + { var step = delta * i; var pair = this.interpolate(step); first_pass.push(pair); @@ -173,7 +204,8 @@ GreatCircle.prototype.Arc = function (npoints, options) { var dfDiffSpace = 360 - dfDateLineOffset; // https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342 - for (var j = 1; j < first_pass.length; ++j) { + for (var j = 1; j < first_pass.length; ++j) + { var dfPrevX = first_pass[j - 1][0]; var dfX = first_pass[j][0]; var dfDiffLong = Math.abs(dfX - dfPrevX); @@ -181,20 +213,26 @@ GreatCircle.prototype.Arc = function (npoints, options) { dfDiffLong > dfDiffSpace && ((dfX > dfLeftBorderX && dfPrevX < dfRightBorderX) || (dfPrevX > dfLeftBorderX && dfX < dfRightBorderX)) - ) { + ) + { bHasBigDiff = true; - } else if (dfDiffLong > dfMaxSmallDiffLong) { + } + else if (dfDiffLong > dfMaxSmallDiffLong) + { dfMaxSmallDiffLong = dfDiffLong; } } var poMulti = []; - if (bHasBigDiff && dfMaxSmallDiffLong < dfDateLineOffset) { + if (bHasBigDiff && dfMaxSmallDiffLong < dfDateLineOffset) + { var poNewLS = []; poMulti.push(poNewLS); - for (var k = 0; k < first_pass.length; ++k) { + for (var k = 0; k < first_pass.length; ++k) + { var dfX0 = parseFloat(first_pass[k][0]); - if (k > 0 && Math.abs(dfX0 - first_pass[k - 1][0]) > dfDiffSpace) { + if (k > 0 && Math.abs(dfX0 - first_pass[k - 1][0]) > dfDiffSpace) + { var dfX1 = parseFloat(first_pass[k - 1][0]); var dfY1 = parseFloat(first_pass[k - 1][1]); var dfX2 = parseFloat(first_pass[k][0]); @@ -206,26 +244,30 @@ GreatCircle.prototype.Arc = function (npoints, options) { k + 1 < first_pass.length && first_pass[k - 1][0] > -180 && first_pass[k - 1][0] < dfRightBorderX - ) { + ) + { poNewLS.push([-180, first_pass[k][1]]); k++; poNewLS.push([first_pass[k][0], first_pass[k][1]]); continue; - } else if ( + } + else if ( dfX1 > dfLeftBorderX && dfX1 < 180 && dfX2 == -180 && k + 1 < first_pass.length && first_pass[k - 1][0] > dfLeftBorderX && first_pass[k - 1][0] < 180 - ) { + ) + { poNewLS.push([180, first_pass[k][1]]); k++; poNewLS.push([first_pass[k][0], first_pass[k][1]]); continue; } - if (dfX1 < dfRightBorderX && dfX2 > dfLeftBorderX) { + if (dfX1 < dfRightBorderX && dfX2 > dfLeftBorderX) + { // swap dfX1, dfX2 var tmpX = dfX1; dfX1 = dfX2; @@ -235,59 +277,73 @@ GreatCircle.prototype.Arc = function (npoints, options) { dfY1 = dfY2; dfY2 = tmpY; } - if (dfX1 > dfLeftBorderX && dfX2 < dfRightBorderX) { + if (dfX1 > dfLeftBorderX && dfX2 < dfRightBorderX) + { dfX2 += 360; } - if (dfX1 <= 180 && dfX2 >= 180 && dfX1 < dfX2) { + if (dfX1 <= 180 && dfX2 >= 180 && dfX1 < dfX2) + { var dfRatio = (180 - dfX1) / (dfX2 - dfX1); var dfY = dfRatio * dfY2 + (1 - dfRatio) * dfY1; poNewLS.push([ first_pass[k - 1][0] > dfLeftBorderX ? 180 : -180, - dfY, + dfY ]); poNewLS = []; poNewLS.push([ first_pass[k - 1][0] > dfLeftBorderX ? -180 : 180, - dfY, + dfY ]); poMulti.push(poNewLS); - } else { + } + else + { poNewLS = []; poMulti.push(poNewLS); } poNewLS.push([dfX0, first_pass[k][1]]); - } else { + } + else + { poNewLS.push([first_pass[k][0], first_pass[k][1]]); } } - } else { + } + else + { // add normally var poNewLS0 = []; poMulti.push(poNewLS0); - for (var l = 0; l < first_pass.length; ++l) { + for (var l = 0; l < first_pass.length; ++l) + { poNewLS0.push([first_pass[l][0], first_pass[l][1]]); } } var arc = new Arc(this.properties); - for (var m = 0; m < poMulti.length; ++m) { + for (var m = 0; m < poMulti.length; ++m) + { var line = new LineString(); arc.geometries.push(line); var points = poMulti[m]; - for (var j0 = 0; j0 < points.length; ++j0) { + for (var j0 = 0; j0 < points.length; ++j0) + { line.move_to(points[j0]); } } return arc; }; -if (typeof module !== "undefined" && typeof module.exports !== "undefined") { +if (typeof module !== "undefined" && typeof module.exports !== "undefined") +{ // nodejs module.exports.Coord = Coord; module.exports.Arc = Arc; module.exports.GreatCircle = GreatCircle; -} else { +} +else +{ // browser var arc = {}; arc.Coord = Coord; diff --git a/package.nw/lib/callsigns.js b/package.nw/lib/callsigns.js index 3d9ab254..b2566324 100644 --- a/package.nw/lib/callsigns.js +++ b/package.nw/lib/callsigns.js @@ -20,19 +20,26 @@ var g_oqrsFile = ""; var g_oqrsWhenDate = 0; var g_oqrsLoadTimer = null; -function dumpFile(file) { - try { +function dumpFile(file) +{ + try + { if (fs.existsSync(file)) fs.unlinkSync(file); - } catch (e) {} + } + catch (e) {} } -function dumpDir(dir) { - try { +function dumpDir(dir) +{ + try + { if (fs.existsSync(dir)) fs.rmdirSync(dir); - } catch (e) {} + } + catch (e) {} } -function callsignServicesInit() { +function callsignServicesInit() +{ // Dump old data files we no longer reference dumpFile(g_jsonDir + "uls-callsigns.json"); dumpFile(g_jsonDir + "us-callsigns.json"); @@ -48,16 +55,20 @@ function callsignServicesInit() { g_eqslFile = g_NWappData + "eqsl-callsigns.json"; g_oqrsFile = g_NWappData + "cloqrs-callsigns.json"; - if (g_callsignLookups.lotwUseEnable) { + if (g_callsignLookups.lotwUseEnable) + { lotwLoadCallsigns(); } - if (g_callsignLookups.eqslUseEnable) { + if (g_callsignLookups.eqslUseEnable) + { eqslLoadCallsigns(); } - if (g_callsignLookups.ulsUseEnable) { + if (g_callsignLookups.ulsUseEnable) + { ulsLoadCallsigns(); } - if (g_callsignLookups.oqrsUseEnable) { + if (g_callsignLookups.oqrsUseEnable) + { oqrsLoadCallsigns(); } @@ -67,46 +78,59 @@ function callsignServicesInit() { oqrsSettingsDisplay(); } -function saveCallsignSettings() { +function saveCallsignSettings() +{ localStorage.callsignLookups = JSON.stringify(g_callsignLookups); } -function lotwLoadCallsigns() { +function lotwLoadCallsigns() +{ var now = timeNowSec(); if (now - g_callsignLookups.lotwLastUpdate > 86400 * 7) - g_callsignLookups.lotwLastUpdate = 0; - else { + { g_callsignLookups.lotwLastUpdate = 0; } + else + { var lotwWhenTimer = 86400 * 7 - (now - g_callsignLookups.lotwLastUpdate); g_lotwWhenDate = now + lotwWhenTimer; g_lotwLoadTimer = setTimeout(lotwDownload, lotwWhenTimer * 1000); } - if (!fs.existsSync(g_lotwFile)) { + if (!fs.existsSync(g_lotwFile)) + { g_callsignLookups.lotwLastUpdate = 0; - } else { + } + else + { var data = fs.readFileSync(g_lotwFile); g_lotwCallsigns = JSON.parse(data); - if (Object.keys(g_lotwCallsigns).length < 100) { + if (Object.keys(g_lotwCallsigns).length < 100) + { lotwDownload(); } } - if (g_callsignLookups.lotwLastUpdate == 0) { + if (g_callsignLookups.lotwLastUpdate == 0) + { lotwDownload(); } } -function lotwSettingsDisplay() { +function lotwSettingsDisplay() +{ lotwUseEnable.checked = g_callsignLookups.lotwUseEnable; - if (g_callsignLookups.lotwLastUpdate == 0) { + if (g_callsignLookups.lotwLastUpdate == 0) + { lotwUpdatedTd.innerHTML = "Never"; - } else { + } + else + { lotwUpdatedTd.innerHTML = userTimeString( g_callsignLookups.lotwLastUpdate * 1000 ); } - if (!g_callsignLookups.lotwUseEnable) { + if (!g_callsignLookups.lotwUseEnable) + { if (g_lotwLoadTimer != null) clearTimeout(g_lotwLoadTimer); g_lotwLoadTimer = null; g_lotwCallsigns = Object(); @@ -114,10 +138,12 @@ function lotwSettingsDisplay() { lotwCountTd.innerHTML = Object.keys(g_lotwCallsigns).length; } -function lotwValuesChanged() { +function lotwValuesChanged() +{ g_callsignLookups.lotwUseEnable = lotwUseEnable.checked; saveCallsignSettings(); - if (g_callsignLookups.lotwUseEnable == true) { + if (g_callsignLookups.lotwUseEnable == true) + { lotwLoadCallsigns(); } lotwSettingsDisplay(); @@ -127,7 +153,8 @@ function lotwValuesChanged() { if (g_callRosterWindowHandle) g_callRosterWindowHandle.window.resize(); } -function lotwDownload(fromSettings) { +function lotwDownload(fromSettings) +{ lotwUpdatedTd.innerHTML = "Downloading..."; getBuffer( "https://lotw.arrl.org/lotw-user-activity.csv", @@ -138,15 +165,18 @@ function lotwDownload(fromSettings) { ); } -function processLotwCallsigns(result, flag) { - //var result = String(buffer); +function processLotwCallsigns(result, flag) +{ + // var result = String(buffer); var lines = Array(); lines = result.split("\n"); - delete result; + var lotwCallsigns = Object(); - for (x in lines) { + for (x in lines) + { var breakout = lines[x].split(","); - if (breakout.length == 3) { + if (breakout.length == 3) + { var dateTime = new Date( Date.UTC( breakout[1].substr(0, 4), @@ -160,7 +190,7 @@ function processLotwCallsigns(result, flag) { lotwCallsigns[breakout[0]] = parseInt(dateTime.getTime() / 1000) / 86400; } } - delete lines; + g_callsignLookups.lotwLastUpdate = timeNowSec(); var now = timeNowSec(); @@ -170,7 +200,8 @@ function processLotwCallsigns(result, flag) { g_lotwWhenDate = now + lotwWhenTimer; g_lotwLoadTimer = setTimeout(lotwDownload, lotwWhenTimer * 1000); - if (Object.keys(lotwCallsigns).length > 100) { + if (Object.keys(lotwCallsigns).length > 100) + { g_lotwCallsigns = lotwCallsigns; fs.writeFileSync(g_lotwFile, JSON.stringify(g_lotwCallsigns)); } @@ -178,39 +209,50 @@ function processLotwCallsigns(result, flag) { lotwSettingsDisplay(); } -function oqrsLoadCallsigns() { +function oqrsLoadCallsigns() +{ var now = timeNowSec(); if (now - g_callsignLookups.oqrsLastUpdate > 86400 * 7) - g_callsignLookups.oqrsLastUpdate = 0; - else { + { g_callsignLookups.oqrsLastUpdate = 0; } + else + { var oqrsWhenTimer = 86400 * 7 - (now - g_callsignLookups.oqrsLastUpdate); g_oqrsWhenDate = now + oqrsWhenTimer; g_oqrsLoadTimer = setTimeout(oqrsDownload, oqrsWhenTimer * 1000); } - if (!fs.existsSync(g_oqrsFile)) { + if (!fs.existsSync(g_oqrsFile)) + { g_callsignLookups.oqrsLastUpdate = 0; - } else { + } + else + { var data = fs.readFileSync(g_oqrsFile); g_oqrsCallsigns = JSON.parse(data); } - if (g_callsignLookups.oqrsLastUpdate == 0) { + if (g_callsignLookups.oqrsLastUpdate == 0) + { oqrsDownload(); } } -function oqrsSettingsDisplay() { +function oqrsSettingsDisplay() +{ oqrsUseEnable.checked = g_callsignLookups.oqrsUseEnable; - if (g_callsignLookups.oqrsLastUpdate == 0) { + if (g_callsignLookups.oqrsLastUpdate == 0) + { oqrsUpdatedTd.innerHTML = "Never"; - } else { + } + else + { oqrsUpdatedTd.innerHTML = userTimeString( g_callsignLookups.oqrsLastUpdate * 1000 ); } - if (!g_callsignLookups.oqrsUseEnable) { + if (!g_callsignLookups.oqrsUseEnable) + { if (g_oqrsLoadTimer != null) clearTimeout(g_oqrsLoadTimer); g_oqrsLoadTimer = null; g_oqrsCallsigns = Object(); @@ -218,10 +260,12 @@ function oqrsSettingsDisplay() { oqrsCountTd.innerHTML = Object.keys(g_oqrsCallsigns).length; } -function oqrsValuesChanged() { +function oqrsValuesChanged() +{ g_callsignLookups.oqrsUseEnable = oqrsUseEnable.checked; saveCallsignSettings(); - if (g_callsignLookups.oqrsUseEnable == true) { + if (g_callsignLookups.oqrsUseEnable == true) + { oqrsLoadCallsigns(); } oqrsSettingsDisplay(); @@ -231,7 +275,8 @@ function oqrsValuesChanged() { if (g_callRosterWindowHandle) g_callRosterWindowHandle.window.resize(); } -function oqrsDownload(fromSettings) { +function oqrsDownload(fromSettings) +{ oqrsUpdatedTd.innerHTML = "Downloading..."; getBuffer( "http://app.gridtracker.org/callsigns/clublog.json", @@ -242,7 +287,8 @@ function oqrsDownload(fromSettings) { ); } -function processoqrsCallsigns(buffer, flag) { +function processoqrsCallsigns(buffer, flag) +{ g_oqrsCallsigns = JSON.parse(buffer); g_callsignLookups.oqrsLastUpdate = timeNowSec(); @@ -258,39 +304,50 @@ function processoqrsCallsigns(buffer, flag) { oqrsSettingsDisplay(); } -function eqslLoadCallsigns() { +function eqslLoadCallsigns() +{ var now = timeNowSec(); if (now - g_callsignLookups.eqslLastUpdate > 86400 * 7) - g_callsignLookups.eqslLastUpdate = 0; - else { + { g_callsignLookups.eqslLastUpdate = 0; } + else + { var eqslWhenTimer = 86400 * 7 - (now - g_callsignLookups.eqslLastUpdate); g_eqslWhenDate = now + eqslWhenTimer; g_eqslLoadTimer = setTimeout(eqslDownload, eqslWhenTimer * 1000); } - if (!fs.existsSync(g_eqslFile)) { + if (!fs.existsSync(g_eqslFile)) + { g_callsignLookups.eqslLastUpdate = 0; - } else { + } + else + { var data = fs.readFileSync(g_eqslFile); g_eqslCallsigns = JSON.parse(data); } - if (g_callsignLookups.eqslLastUpdate == 0) { + if (g_callsignLookups.eqslLastUpdate == 0) + { eqslDownload(); } } -function eqslSettingsDisplay() { +function eqslSettingsDisplay() +{ eqslUseEnable.checked = g_callsignLookups.eqslUseEnable; - if (g_callsignLookups.eqslLastUpdate == 0) { + if (g_callsignLookups.eqslLastUpdate == 0) + { eqslUpdatedTd.innerHTML = "Never"; - } else { + } + else + { eqslUpdatedTd.innerHTML = userTimeString( g_callsignLookups.eqslLastUpdate * 1000 ); } - if (!g_callsignLookups.eqslUseEnable) { + if (!g_callsignLookups.eqslUseEnable) + { if (g_eqslLoadTimer != null) clearTimeout(g_eqslLoadTimer); g_eqslLoadTimer = null; g_eqslCallsigns = Object(); @@ -298,10 +355,12 @@ function eqslSettingsDisplay() { eqslCountTd.innerHTML = Object.keys(g_eqslCallsigns).length; } -function eqslValuesChanged() { +function eqslValuesChanged() +{ g_callsignLookups.eqslUseEnable = eqslUseEnable.checked; saveCallsignSettings(); - if (g_callsignLookups.eqslUseEnable == true) { + if (g_callsignLookups.eqslUseEnable == true) + { eqslLoadCallsigns(); } eqslSettingsDisplay(); @@ -311,7 +370,8 @@ function eqslValuesChanged() { if (g_callRosterWindowHandle) g_callRosterWindowHandle.window.resize(); } -function eqslDownload(fromSettings) { +function eqslDownload(fromSettings) +{ eqslUpdatedTd.innerHTML = "Downloading..."; getBuffer( "https://www.eqsl.cc/qslcard/DownloadedFiles/AGMemberList.txt", @@ -322,12 +382,14 @@ function eqslDownload(fromSettings) { ); } -function processeqslCallsigns(buffer, flag) { +function processeqslCallsigns(buffer, flag) +{ var result = String(buffer); var lines = Array(); lines = result.split("\n"); g_eqslCallsigns = Object(); - for (x in lines) { + for (x in lines) + { g_eqslCallsigns[lines[x].trim()] = true; } g_callsignLookups.eqslLastUpdate = timeNowSec(); @@ -340,20 +402,23 @@ function processeqslCallsigns(buffer, flag) { g_eqslLoadTimer = setTimeout(eqslDownload, eqslWhenTimer * 1000); if (Object.keys(g_eqslCallsigns).length > 10000) - fs.writeFileSync(g_eqslFile, JSON.stringify(g_eqslCallsigns)); + { fs.writeFileSync(g_eqslFile, JSON.stringify(g_eqslCallsigns)); } eqslSettingsDisplay(); } -function ulsLoadCallsigns() { - if (g_ulsLoadTimer != null) { +function ulsLoadCallsigns() +{ + if (g_ulsLoadTimer != null) + { clearTimeout(g_ulsLoadTimer); g_ulsLoadTimer = null; } var now = timeNowSec(); if (now - g_callsignLookups.ulsLastUpdate > 86400 * 7) ulsDownload(); - else { + else + { var ulsWhenTimer = 86400 * 7 - (now - g_callsignLookups.ulsLastUpdate); g_ulsWhenDate = now + ulsWhenTimer; g_ulsLoadTimer = setTimeout(ulsDownload, ulsWhenTimer * 1000); @@ -361,28 +426,39 @@ function ulsLoadCallsigns() { } } -function updateQSO() { - if (g_ulsCallsignsCount > 0) { - for (hash in g_QSOhash) { +function updateQSO() +{ + if (g_ulsCallsignsCount > 0) + { + for (hash in g_QSOhash) + { var details = g_QSOhash[hash]; var lookupCall = false; if ( (details.cnty == null || details.state == null) && isKnownCallsignDXCC(details.dxcc) - ) { + ) + { // Do County Lookup lookupCall = true; - } else if (details.cnty != null && isKnownCallsignUSplus(details.dxcc)) { - if (!(details.cnty in g_cntyToCounty)) { - if (details.cnty.indexOf(",") == -1) { + } + else if (details.cnty != null && isKnownCallsignUSplus(details.dxcc)) + { + if (!(details.cnty in g_cntyToCounty)) + { + if (details.cnty.indexOf(",") == -1) + { if (!(details.state + "," + details.cnty in g_cntyToCounty)) - lookupCall = true; - } else lookupCall = true; + { lookupCall = true; } + } + else lookupCall = true; } } - if (lookupCall) { - if (g_callsignLookups.ulsUseEnable) { + if (lookupCall) + { + if (g_callsignLookups.ulsUseEnable) + { lookupUsCallsign(details, true); } } @@ -390,16 +466,20 @@ function updateQSO() { } } -function updateCallsignCount() { - g_ulsDatabase.transaction(function (tx) { +function updateCallsignCount() +{ + g_ulsDatabase.transaction(function (tx) + { tx.executeSql( "SELECT count(*) as cnt FROM calls", [], - function (tx, results) { + function (tx, results) + { var len = results.rows.length, i; - if (len == 1) { - g_ulsCallsignsCount = results.rows[0]["cnt"]; + if (len == 1) + { + g_ulsCallsignsCount = results.rows[0].cnt; ulsCountTd.innerHTML = g_ulsCallsignsCount; updateQSO(); @@ -410,18 +490,23 @@ function updateCallsignCount() { }); } -function ulsSettingsDisplay() { +function ulsSettingsDisplay() +{ ulsUseEnable.checked = g_callsignLookups.ulsUseEnable; - if (g_callsignLookups.ulsLastUpdate == 0) { + if (g_callsignLookups.ulsLastUpdate == 0) + { ulsUpdatedTd.innerHTML = "Never"; - } else { + } + else + { ulsUpdatedTd.innerHTML = userTimeString( g_callsignLookups.ulsLastUpdate * 1000 ); } - if (!g_callsignLookups.ulsUseEnable) { + if (!g_callsignLookups.ulsUseEnable) + { if (g_ulsLoadTimer != null) clearTimeout(g_ulsLoadTimer); g_ulsLoadTimer = null; g_ulsCallsignsCount = 0; @@ -429,12 +514,16 @@ function ulsSettingsDisplay() { } } -function ulsValuesChanged() { +function ulsValuesChanged() +{ g_callsignLookups.ulsUseEnable = ulsUseEnable.checked; - if (g_callsignLookups.ulsUseEnable == true) { + if (g_callsignLookups.ulsUseEnable == true) + { ulsLoadCallsigns(); - } else { + } + else + { resetULSDatabase(); ulsCountTd.innerHTML = 0; } @@ -445,7 +534,8 @@ function ulsValuesChanged() { if (g_callRosterWindowHandle) g_callRosterWindowHandle.window.resize(); } -function ulsDownload() { +function ulsDownload() +{ ulsUpdatedTd.innerHTML = "Downloading..."; ulsCountTd.innerHTML = 0; getChunkedBuffer( @@ -465,48 +555,58 @@ function getChunkedBuffer( port, cookie, errorHandler -) { +) +{ var url = require("url"); var http = require(mode); var fileBuffer = null; var options = null; - if (cookie != 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, - port: port, - followAllRedirects: true, - path: url.parse(file_url).path, + Cookie: cookie + } }; } - http.get(options, function (res) { + else + { + options = { + host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api + port: port, + followAllRedirects: true, + path: url.parse(file_url).path // eslint-disable-line node/no-deprecated-api + }; + } + http.get(options, function (res) + { var fsize = res.headers["content-length"]; 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) { + .on("data", function (data) + { var isEnd = false; fread += data.length; if (fread == fsize) isEnd = true; - if (fileBuffer == null) { + if (fileBuffer == null) + { fileBuffer = callback(data, flag, cookies, true, isEnd); - } else { - fileBuffer = callback(fileBuffer + data, flag, cookies, false, isEnd); + } + else + { + fileBuffer = callback(fileBuffer + data, flag, cookies, false, isEnd); // eslint-disable-line node/no-callback-literal } }) .on("end", function () {}) - .on("error", function (e) { + .on("error", function (e) + { console.error("Got error: " + e.message); }); }); @@ -519,35 +619,45 @@ var g_ulsDatabase = openDatabase( 50 * 1024 * 1024 ); -g_ulsDatabase.transaction(function (tx) { +g_ulsDatabase.transaction(function (tx) +{ tx.executeSql( "CREATE TABLE IF NOT EXISTS calls ( callsign TEXT PRIMARY KEY, zip, state)" ); }); -function resetULSDatabase() { +function resetULSDatabase() +{ g_callsignLookups.ulsLastUpdate = 0; g_ulsCallsignsCount = 0; } -function processulsCallsigns(data, flag, cookies, starting, finished) { +function processulsCallsigns(data, flag, cookies, starting, finished) +{ var buffer = String(data); var returnBuffer = ""; - if (buffer && buffer.length > 0) { + if (buffer && buffer.length > 0) + { var lines = null; - if (buffer[buffer.length - 1] == "\n") { + if (buffer[buffer.length - 1] == "\n") + { lines = buffer.split("\n"); - } else { + } + else + { var lastIndex = buffer.lastIndexOf("\n"); returnBuffer = buffer.substring(lastIndex); lines = buffer.substring(0, lastIndex).split("\n"); } - if (lines.length > 0) { - g_ulsDatabase.transaction(function (tx) { - if (starting == true) { + if (lines.length > 0) + { + g_ulsDatabase.transaction(function (tx) + { + if (starting == true) + { if (g_ulsLoadTimer != null) clearTimeout(g_ulsLoadTimer); g_ulsLoadTimer = null; g_ulsWhenDate = 0; @@ -555,42 +665,47 @@ function processulsCallsigns(data, flag, cookies, starting, finished) { ulsUpdatedTd.innerHTML = "Processing..."; tx.executeSql("delete from calls"); } - for (var x in lines) { - if (lines[x].length) { + for (var x in lines) + { + 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) { + if (g_ulsCallsignsCount % 10000 == 0) + { tx.executeSql( "SELECT count(*) as cnt FROM calls", [], - function (rx, results) { + function (rx, results) + { var len = results.rows.length, i; - if (len == 1) { - ulsCountTd.innerHTML = results.rows[0]["cnt"]; + if (len == 1) + { + ulsCountTd.innerHTML = results.rows[0].cnt; } } ); } } } - delete lines; lines = null; }); } } - if (finished == true) { + if (finished == true) + { var now = timeNowSec(); if (g_ulsLoadTimer != null) clearTimeout(g_ulsLoadTimer); @@ -599,15 +714,18 @@ function processulsCallsigns(data, flag, cookies, starting, finished) { g_ulsWhenDate = ulsWhenTimer + now; g_ulsLoadTimer = setTimeout(ulsDownload, ulsWhenTimer * 1000); - g_ulsDatabase.transaction(function (tx) { + g_ulsDatabase.transaction(function (tx) + { tx.executeSql( "SELECT count(*) as cnt FROM calls", [], - function (rx, results) { + function (rx, results) + { var len = results.rows.length, i; - if (len == 1) { - g_ulsCallsignsCount = results.rows[0]["cnt"]; + if (len == 1) + { + g_ulsCallsignsCount = results.rows[0].cnt; ulsCountTd.innerHTML = g_ulsCallsignsCount; g_callsignLookups.ulsLastUpdate = timeNowSec(); saveCallsignSettings(); @@ -619,50 +737,64 @@ 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) { - g_ulsDatabase.transaction(function (tx) { - var qry = 'SELECT * FROM calls where callsign = "' + object.DEcall + '"'; +function lookupUsCallsign(object, writeState = false) +{ + g_ulsDatabase.transaction(function (tx) + { + var qry = "SELECT * FROM calls where callsign = \"" + object.DEcall + "\""; tx.executeSql( qry, [], - function (tx, results) { + function (tx, results) + { var len = results.rows.length, i; - if (len == 1) { - if (object.state == null) { - if (object.dxcc == 1) { - object.state = "CA-" + results.rows[0]["state"]; - } else { - object.state = "US-" + results.rows[0]["state"]; + if (len == 1) + { + if (object.state == null) + { + if (object.dxcc == 1) + { + object.state = "CA-" + results.rows[0].state; + } + else + { + object.state = "US-" + results.rows[0].state; } if (writeState) setState(object); } - object.zipcode = String(results.rows[0]["zip"]); - if (object.cnty == null) { + object.zipcode = String(results.rows[0].zip); + if (object.cnty == null) + { let request = g_Idb .transaction(["lookups"], "readwrite") .objectStore("lookups") .get(object.DEcall); - request.onsuccess = function (event) { - if (request.result) { + request.onsuccess = function (event) + { + if (request.result) + { object.cnty = request.result.cnty; object.qual = true; } - if (object.cnty == null && object.zipcode in g_zipToCounty) { + if (object.cnty == null && object.zipcode in g_zipToCounty) + { var counties = g_zipToCounty[object.zipcode]; if (counties.length > 1) object.qual = false; else object.qual = true; object.cnty = counties[0]; - } else object.qual = false; + } + else object.qual = false; if (writeState) setState(object); }; - request.onerror = function (event) { + request.onerror = function (event) + { object.qual = false; if (writeState) setState(object); }; diff --git a/package.nw/lib/datepicker.js b/package.nw/lib/datepicker.js index d507c57a..0c871f5a 100644 --- a/package.nw/lib/datepicker.js +++ b/package.nw/lib/datepicker.js @@ -1,5 +1,6 @@ var picker = { - attach : function (opt) { + attach: function (opt) + { // attach() : attach datepicker to target // opt : options (object) // target : datepicker will populate this field @@ -10,47 +11,50 @@ var picker = { // (A) Create new datepicker var dp = document.createElement("div"); dp.dataset.target = opt.target; - dp.dataset.fire = opt.fire; + dp.dataset.fire = opt.fire; dp.dataset.startmon = opt.startmon ? "1" : "0"; dp.classList.add("picker"); - if (opt.disableday) { + if (opt.disableday) + { dp.dataset.disableday = JSON.stringify(opt.disableday); } // (B) Default to current month + year // ! NOTE: UTC+0 ! var today = new Date(), - thisMonth = today.getUTCMonth(), // Note: Jan is 0 - thisYear = today.getUTCFullYear(), - months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + thisMonth = today.getUTCMonth(), // Note: Jan is 0 + thisYear = today.getUTCFullYear(), + months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; // (C) Month select var select = document.createElement("select"), - option = null; + option = null; select.classList.add("picker-m"); - for (var mth in months) { + for (var mth in months) + { option = document.createElement("option"); option.value = parseInt(mth) + 1; option.text = months[mth]; select.appendChild(option); } select.selectedIndex = thisMonth; - select.addEventListener("change", function(){ picker.draw(this); }); + select.addEventListener("change", function() { picker.draw(this); }); dp.appendChild(select); // (D) Year select var yRange = 100; // Year range to show, I.E. from thisYear-yRange to thisYear+yRange select = document.createElement("select"); select.classList.add("picker-y"); - for (var y = thisYear-yRange; y < thisYear+20; y++) { + for (var y = thisYear - yRange; y < thisYear + 20; y++) + { option = document.createElement("option"); option.value = y; option.text = y; select.appendChild(option); } select.selectedIndex = yRange; - select.addEventListener("change", function(){ picker.draw(this); }); + select.addEventListener("change", function() { picker.draw(this); }); dp.appendChild(select); // (E) Day select @@ -62,10 +66,12 @@ var picker = { picker.draw(select); // (F1) Popup datepicker - if (opt.container==1) { + if (opt.container == 1) + { // Mark this as a "popup" var uniqueID = 0; - while (document.getElementById("picker-" + uniqueID) != null) { + while (document.getElementById("picker-" + uniqueID) != null) + { uniqueID = Math.floor(Math.random() * (100 - 2)) + 1; } dp.dataset.popup = "1"; @@ -80,11 +86,14 @@ var picker = { // Attach onclick to show/hide datepicker var target = document.getElementById(opt.target); target.dataset.dp = uniqueID; - target.onfocus = function () { + target.onfocus = function () + { document.getElementById("picker-" + this.dataset.dp).classList.add("show"); }; - wrapper.addEventListener("click", function (evt) { - if (evt.target.classList.contains("picker-wrap")) { + wrapper.addEventListener("click", function (evt) + { + if (evt.target.classList.contains("picker-wrap")) + { this.classList.remove("show"); } }); @@ -94,82 +103,93 @@ var picker = { } // (F2) Inline datepicker - else { + else + { document.getElementById(opt.container).appendChild(dp); } }, - draw : function (el) { + draw: function (el) + { // draw() : draw the days in month // el : HTML reference to either year or month selector // (A) Get date picker components var parent = el.parentElement, - year = parent.getElementsByClassName("picker-y")[0].value, - month = parent.getElementsByClassName("picker-m")[0].value, - days = parent.getElementsByClassName("picker-d")[0]; + year = parent.getElementsByClassName("picker-y")[0].value, + month = parent.getElementsByClassName("picker-m")[0].value, + days = parent.getElementsByClassName("picker-d")[0]; // (B) Date range calculation // ! NOTE: UTC+0 ! var daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate(), - startDay = new Date(Date.UTC(year, month-1, 1)).getUTCDay(), // Note: Sun = 0 - endDay = new Date(Date.UTC(year, month-1, daysInMonth)).getUTCDay(), - startDay = startDay==0 ? 7 : startDay, - endDay = endDay==0 ? 7 : endDay; + startDay = new Date(Date.UTC(year, month - 1, 1)).getUTCDay(), // Note: Sun = 0 + endDay = new Date(Date.UTC(year, month - 1, daysInMonth)).getUTCDay(), + startDay = startDay == 0 ? 7 : startDay, + endDay = endDay == 0 ? 7 : endDay; // (C) Generate date squares (in array first) var squares = [], - disableday = null; - if (parent.dataset.disableday) { + disableday = null; + if (parent.dataset.disableday) + { disableday = JSON.parse(parent.dataset.disableday); } // (C1) Empty squares before first day of month - if (parent.dataset.startmon=="1" && startDay!=1) { - for (var i=1; i 0 ) - { - window[parent.dataset.fire](); - } + if (parent.dataset.fire.length > 0) + { + window[parent.dataset.fire](); + } // (D) Popup only - close the popup - if (parent.dataset.popup == "1") { + if (parent.dataset.popup == "1") + { document.getElementById("picker-" + parent.dataset.dpid).classList.remove("show"); } } -}; \ No newline at end of file +}; diff --git a/package.nw/lib/defaults.js b/package.nw/lib/defaults.js index f59a3bd3..f386dfde 100644 --- a/package.nw/lib/defaults.js +++ b/package.nw/lib/defaults.js @@ -26,7 +26,7 @@ var validSettings = [ "speechSettings", "startupLogs", "trustedQslSettings", - "screenSettings", + "screenSettings" ]; var def_appSettings = { @@ -88,7 +88,7 @@ var def_appSettings = { workingCallsigns: {}, workingDateEnable: false, workingDate: 0, - gtSpotEnable: true, + gtSpotEnable: true }; var def_mapSettings = { @@ -125,7 +125,7 @@ var def_mapSettings = { trafficDecode: true, usNexrad: false, zoom: 4, - mapTrans: 0.5, + mapTrans: 0.5 }; var def_adifLogSettings = { @@ -134,7 +134,7 @@ var def_adifLogSettings = { buttonClubCheckBox: false, buttonLOTWCheckBox: false, buttonQRZCheckBox: false, - buttonPsk24CheckBox: true, + buttonPsk24CheckBox: true }, startup: { loadAdifCheckBox: false, @@ -142,7 +142,7 @@ var def_adifLogSettings = { loadQRZCheckBox: false, loadLOTWCheckBox: false, loadClubCheckBox: false, - loadGTCheckBox: true, + loadGTCheckBox: true }, qsolog: { logQRZqsoCheckBox: false, @@ -151,10 +151,10 @@ var def_adifLogSettings = { logHRDLOGqsoCheckBox: false, logClubqsoCheckBox: false, logCloudlogQSOCheckBox: false, - logeQSLQSOCheckBox: false, + logeQSLQSOCheckBox: false }, nickname: { - nicknameeQSLCheckBox: false, + nicknameeQSLCheckBox: false }, text: { lotwLogin: "", @@ -171,9 +171,9 @@ var def_adifLogSettings = { CloudlogAPI: "", eQSLUser: "", eQSLPassword: "", - eQSLNickname: "", + eQSLNickname: "" }, - downloads: {}, + downloads: {} }; var def_msgSettings = { @@ -183,7 +183,7 @@ var def_msgSettings = { msgFrequencySelect: 0, msgActionSelect: 0, msgAwaySelect: 0, - msgAwayText: "I am away from the shack at the moment", + msgAwayText: "I am away from the shack at the moment" }; var def_receptionSettings = { @@ -194,39 +194,39 @@ var def_receptionSettings = { pathColor: -1, pathNightColor: 361, spotWidth: 0.8, - mergeSpots: false, + mergeSpots: false }; var def_N1MMSettings = { enable: false, port: 2333, - ip: "127.0.0.1", + ip: "127.0.0.1" }; var def_log4OMSettings = { enable: false, port: 2236, - ip: "127.0.0.1", + ip: "127.0.0.1" }; var def_dxkLogSettings = { enable: false, port: 52000, - ip: "127.0.0.1", + ip: "127.0.0.1" }; var def_HRDLogbookLogSettings = { enable: false, port: 7826, - ip: "127.0.0.1", + ip: "127.0.0.1" }; var def_acLogSettings = { enable: false, port: 1100, - ip: "127.0.0.1", + ip: "127.0.0.1" }; var def_trustedQslSettings = { stationFile: "", stationFileValid: false, binaryFile: "", - binaryFileValid: false, + binaryFileValid: false }; var def_callsignLookups = { lotwUseEnable: true, @@ -240,10 +240,10 @@ var def_callsignLookups = { ulsLastUpdate: 0, oqrsUseEnable: false, oqrsWeeklyEnable: false, - oqrsLastUpdate: 0, + oqrsLastUpdate: 0 }; var def_bandActivity = { lastUpdate: {}, - lines: {}, + lines: {} }; diff --git a/package.nw/lib/fw.js b/package.nw/lib/fw.js index 63303031..5bca8f89 100644 --- a/package.nw/lib/fw.js +++ b/package.nw/lib/fw.js @@ -1,9 +1,10 @@ -function hooray() { +function hooray() +{ var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight, mousePos = { x: 400, - y: 300, + y: 300 }, // create canvas canvas = document.createElement("canvas"), @@ -14,7 +15,8 @@ function hooray() { colorCode = 0; // init - $(document).ready(function () { + $(document).ready(function () + { document.body.appendChild(canvas); canvas.width = SCREEN_WIDTH; canvas.height = SCREEN_HEIGHT; @@ -23,27 +25,33 @@ function hooray() { }); // update mouse position - $(document).mousemove(function (e) { + $(document).mousemove(function (e) + { e.preventDefault(); mousePos = { x: e.clientX, - y: e.clientY, + y: e.clientY }; }); // launch more rockets!!! - $(document).mousedown(function (e) { - for (var i = 0; i < 5; i++) { + $(document).mousedown(function (e) + { + for (var i = 0; i < 5; i++) + { launchFrom((Math.random() * SCREEN_WIDTH * 2) / 3 + SCREEN_WIDTH / 6); } }); - function launch() { + function launch() + { launchFrom(mousePos.x); } - function launchFrom(x) { - if (rockets.length < 10) { + function launchFrom(x) + { + if (rockets.length < 10) + { var rocket = new Rocket(x); rocket.explosionColor = Math.floor((Math.random() * 360) / 10) * 10; rocket.vel.y = Math.random() * -3 - 4; @@ -55,12 +63,15 @@ function hooray() { } } - function loop() { + function loop() + { // update screen size - if (SCREEN_WIDTH != window.innerWidth) { + if (SCREEN_WIDTH != window.innerWidth) + { canvas.width = SCREEN_WIDTH = window.innerWidth; } - if (SCREEN_HEIGHT != window.innerHeight) { + if (SCREEN_HEIGHT != window.innerHeight) + { canvas.height = SCREEN_HEIGHT = window.innerHeight; } @@ -70,7 +81,8 @@ function hooray() { var existingRockets = []; - for (var i = 0; i < rockets.length; i++) { + for (var i = 0; i < rockets.length; i++) + { // update and render rockets[i].update(); rockets[i].render(context); @@ -98,9 +110,12 @@ function hooray() { rockets[i].vel.y >= 0 || distance < 50 || randomChance - ) { + ) + { rockets[i].explode(); - } else { + } + else + { existingRockets.push(rockets[i]); } } @@ -109,11 +124,13 @@ function hooray() { var existingParticles = []; - for (var i = 0; i < particles.length; i++) { + for (var i = 0; i < particles.length; i++) + { particles[i].update(); // render and save particles that can be rendered - if (particles[i].exists()) { + if (particles[i].exists()) + { particles[i].render(context); existingParticles.push(particles[i]); } @@ -122,19 +139,21 @@ function hooray() { // update array with existing particles - old particles should be garbage collected particles = existingParticles; - while (particles.length > MAX_PARTICLES) { + while (particles.length > MAX_PARTICLES) + { particles.shift(); } } - function Particle(pos) { + function Particle(pos) + { this.pos = { x: pos ? pos.x : 0, - y: pos ? pos.y : 0, + y: pos ? pos.y : 0 }; this.vel = { x: 0, - y: 0, + y: 0 }; this.shrink = 0.97; this.size = 2; @@ -149,7 +168,8 @@ function hooray() { this.color = 0; } - Particle.prototype.update = function () { + Particle.prototype.update = function () + { // apply resistance this.vel.x *= this.resistance; this.vel.y *= this.resistance; @@ -168,8 +188,10 @@ function hooray() { this.alpha -= this.fade; }; - Particle.prototype.render = function (c) { - if (!this.exists()) { + Particle.prototype.render = function (c) + { + if (!this.exists()) + { return; } @@ -206,16 +228,18 @@ function hooray() { c.restore(); }; - Particle.prototype.exists = function () { + Particle.prototype.exists = function () + { return this.alpha >= 0.1 && this.size >= 1; }; - function Rocket(x) { + function Rocket(x) + { Particle.apply(this, [ { x: x, - y: SCREEN_HEIGHT, - }, + y: SCREEN_HEIGHT + } ]); this.explosionColor = 0; @@ -224,10 +248,12 @@ function hooray() { Rocket.prototype = new Particle(); Rocket.prototype.constructor = Rocket; - Rocket.prototype.explode = function () { + Rocket.prototype.explode = function () + { var count = Math.random() * 10 + 80; - for (var i = 0; i < count; i++) { + for (var i = 0; i < count; i++) + { var particle = new Particle(this.pos); var angle = Math.random() * Math.PI * 2; @@ -250,8 +276,10 @@ function hooray() { } }; - Rocket.prototype.render = function (c) { - if (!this.exists()) { + Rocket.prototype.render = function (c) + { + if (!this.exists()) + { return; } diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index 7508bb6b..fad91be9 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -7,12 +7,13 @@ var gtBeta = pjson.betaVersion; var g_startVersion = 0; if (typeof localStorage.currentVersion != "undefined") - g_startVersion = localStorage.currentVersion; +{ g_startVersion = localStorage.currentVersion; } if ( typeof localStorage.currentVersion == "undefined" || localStorage.currentVersion != String(gtVersion) -) { +) +{ localStorage.currentVersion = String(gtVersion); var gui = require("nw.gui"); gui.App.clearCache(); @@ -38,7 +39,8 @@ const path = require("path"); const g_dirSeperator = path.sep; var g_platform = os.platform(); -if (g_platform.indexOf("win") == 0 || g_platform.indexOf("Win") == 0) { +if (g_platform.indexOf("win") == 0 || g_platform.indexOf("Win") == 0) +{ g_platform = "windows"; } if (g_platform.indexOf("inux") > -1) g_platform = "linux"; @@ -78,25 +80,28 @@ var g_callsignDatabaseDXCC = { 1: true, 6: true, 110: true, - 202: true, + 202: true }; var g_callsignDatabaseUS = { 291: true, 6: true, - 110: true, + 110: true }; var g_callsignDatabaseUSplus = { 291: true, 6: true, 110: true, - 202: true, + 202: true }; -function loadAllSettings() { - for (var x in localStorage) { - if (!validSettings.includes(x) && typeof localStorage[x] == "string") { +function loadAllSettings() +{ + for (var x in localStorage) + { + if (!validSettings.includes(x) && typeof localStorage[x] == "string") + { delete localStorage[x]; } } @@ -134,9 +139,11 @@ function loadAllSettings() { g_startupLogs = loadArrayIfExists("startupLogs"); g_mapMemory = loadArrayIfExists("mapMemory"); - if (g_mapMemory.length != 7) { + if (g_mapMemory.length != 7) + { g_mapMemory = []; - for (var x = 0; x < 7; x++) { + for (var x = 0; x < 7; x++) + { g_mapMemory[x] = {}; g_mapMemory[x].zoom = -1; g_mapMemory[x].LoLa = [0, 0]; @@ -164,14 +171,18 @@ var g_heatEnabled = g_appSettings.heatEnabled; var g_myLat = g_mapSettings.latitude; var g_myLon = g_mapSettings.longitude; -function loadDefaultsAndMerge(key, def) { +function loadDefaultsAndMerge(key, def) +{ var settings = {}; - if (typeof localStorage[key] != "undefined") { + if (typeof localStorage[key] != "undefined") + { settings = JSON.parse(localStorage[key]); } var merged = deepmerge(def, settings); - for (var x in merged) { - if (!(x in def)) { + for (var x in merged) + { + if (!(x in def)) + { delete merged[x]; } } @@ -179,35 +190,43 @@ function loadDefaultsAndMerge(key, def) { return merged; } -function loadArrayIfExists(key) { +function loadArrayIfExists(key) +{ var data = []; - if (typeof localStorage[key] != "undefined") { + if (typeof localStorage[key] != "undefined") + { data = JSON.parse(localStorage[key]); } return data; } -function loadObjectIfExists(key) { +function loadObjectIfExists(key) +{ var data = {}; - if (typeof localStorage[key] != "undefined") { + if (typeof localStorage[key] != "undefined") + { data = JSON.parse(localStorage[key]); } return data; } -function saveAppSettings() { +function saveAppSettings() +{ localStorage.appSettings = JSON.stringify(g_appSettings); } -function saveMapSettings() { +function saveMapSettings() +{ localStorage.mapSettings = JSON.stringify(g_mapSettings); } -function saveStartupLogs() { +function saveStartupLogs() +{ localStorage.startupLogs = JSON.stringify(g_startupLogs); } -function saveLogSettings() { +function saveLogSettings() +{ localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); localStorage.N1MMSettings = JSON.stringify(g_N1MMSettings); localStorage.log4OMSettings = JSON.stringify(g_log4OMSettings); @@ -217,12 +236,14 @@ function saveLogSettings() { localStorage.trustedQslSettings = JSON.stringify(g_trustedQslSettings); } -function saveAndCloseApp() { +function saveAndCloseApp() +{ g_closing = true; saveReceptionReports(); - try { + try + { var data = {}; data.tracker = g_tracker; @@ -233,36 +254,47 @@ function saveAndCloseApp() { data.version = gtVersion; fs.writeFileSync(g_NWappData + "internal_qso.json", JSON.stringify(data)); - } catch (e) { + } + catch (e) + { console.log(e); } - if (g_map) { + if (g_map) + { mapMemory(6, true, true); g_mapSettings.zoom = g_map.getView().getZoom(); saveMapSettings(); } - if (g_wsjtUdpServer != null) { - try { - if (multicastEnable.checked == true && g_appSettings.wsjtIP != "") { + if (g_wsjtUdpServer != null) + { + try + { + if (multicastEnable.checked == true && g_appSettings.wsjtIP != "") + { g_wsjtUdpServer.dropMembership(g_appSettings.wsjtIP); } g_wsjtUdpServer.close(); - } catch (e) { + } + catch (e) + { console.log(e); } } - if (g_forwardUdpServer != null) { + if (g_forwardUdpServer != null) + { g_forwardUdpServer.close(); } saveAppSettings(); saveMapSettings(); - try { - if (g_callRosterWindowHandle) { + try + { + if (g_callRosterWindowHandle) + { g_callRosterWindowHandle.window.writeRosterSettings(); } if (g_popupWindowHandle != null) g_popupWindowHandle.window.close(true); @@ -273,13 +305,16 @@ function saveAndCloseApp() { g_lookupWindowHandle.window.close(true); g_baWindowHandle.window.close(true); g_callRosterWindowHandle.window.close(true); - } catch (e) {} + } + catch (e) {} nw.App.quit(); } -function clearAndReload() { +function clearAndReload() +{ g_closing = true; - if (g_wsjtUdpServer != null) { + if (g_wsjtUdpServer != null) + { g_wsjtUdpServer.close(); g_wsjtUdpServer = null; } @@ -288,15 +323,14 @@ 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; @@ -344,19 +378,19 @@ var g_colorBands = [ "2m", "1.25m", "70cm", - "23cm", + "23cm" ]; var g_pathIgnore = {}; -g_pathIgnore["RU"] = true; -g_pathIgnore["FTRU"] = true; -g_pathIgnore["FD"] = true; -g_pathIgnore["TEST"] = true; -g_pathIgnore["DX"] = true; -g_pathIgnore["CQ"] = true; +g_pathIgnore.RU = true; +g_pathIgnore.FTRU = true; +g_pathIgnore.FD = true; +g_pathIgnore.TEST = true; +g_pathIgnore.DX = true; +g_pathIgnore.CQ = true; var g_replaceCQ = {}; -g_replaceCQ["ASIA"] = "AS"; +g_replaceCQ.ASIA = "AS"; var g_searchBand = "dummy"; @@ -394,7 +428,8 @@ var g_tracker = {}; initQSOdata(); -function initQSOdata() { +function initQSOdata() +{ g_tracker.worked = {}; g_tracker.confirmed = {}; @@ -432,10 +467,10 @@ var g_layerVectors = {}; var g_scaleLine = null; var g_scaleUnits = {}; -g_scaleUnits["MI"] = "us"; -g_scaleUnits["KM"] = "metric"; -g_scaleUnits["NM"] = "nautical"; -g_scaleUnits["DG"] = "degrees"; +g_scaleUnits.MI = "us"; +g_scaleUnits.KM = "metric"; +g_scaleUnits.NM = "nautical"; +g_scaleUnits.DG = "degrees"; var g_passingToolTipTableString = ""; var g_mouseX = 0; @@ -465,7 +500,7 @@ var g_us48Data = {}; var g_startupFunctions = Array(); var g_pskColors = {}; -g_pskColors["OOB"] = "888888"; +g_pskColors.OOB = "888888"; g_pskColors["4000m"] = "45E0FF"; g_pskColors["2200m"] = "FF4500"; g_pskColors["630m"] = "1E90FF"; @@ -500,7 +535,7 @@ var g_UTCoptions = { minute: "2-digit", second: "2-digit", timeZone: "UTC", - timeZoneName: "short", + timeZoneName: "short" }; var g_LocalOptions = { @@ -510,7 +545,7 @@ var g_LocalOptions = { hour: "2-digit", minute: "2-digit", second: "2-digit", - timeZoneName: "short", + timeZoneName: "short" }; var g_earthShadowImageArray = Array(); @@ -573,14 +608,17 @@ var g_gridAlpha = "88"; if (typeof g_mapMemory[6] == "undefined") g_mapMemory[6] = g_mapMemory[0]; -function qsoBackupFileInit() { +function qsoBackupFileInit() +{ var adifHeader = "GridTracker v" + gtVersion + " \r\n"; - if (!fs.existsSync(g_qsoLogFile)) { + if (!fs.existsSync(g_qsoLogFile)) + { fs.writeFileSync(g_qsoLogFile, adifHeader); } } -function gtBandFilterChanged(selector) { +function gtBandFilterChanged(selector) +{ g_appSettings.gtBandFilter = selector.value; removePaths(); @@ -588,65 +626,78 @@ function gtBandFilterChanged(selector) { redrawSpots(); } -function gtModeFilterChanged(selector) { +function gtModeFilterChanged(selector) +{ g_appSettings.gtModeFilter = selector.value; redrawGrids(); redrawSpots(); } -function gtPropFilterChanged(selector) { +function gtPropFilterChanged(selector) +{ g_appSettings.gtPropFilter = selector.value; redrawGrids(); redrawSpots(); } -function setBandAndModeToAuto() { +function setBandAndModeToAuto() +{ g_appSettings.gtModeFilter = g_appSettings.gtBandFilter = gtBandFilter.value = gtModeFilter.value = "auto"; redrawGrids(); redrawSpots(); } -function hideLiveGrid(i) { - if (g_layerSources["live"].hasFeature(g_liveGrids[i].rectangle)) { - g_layerSources["live"].removeFeature(g_liveGrids[i].rectangle); +function hideLiveGrid(i) +{ + if (g_layerSources.live.hasFeature(g_liveGrids[i].rectangle)) + { + g_layerSources.live.removeFeature(g_liveGrids[i].rectangle); } } -function liveTriangleGrid(i) { - if (g_liveGrids[i].isTriangle == false) { - if (g_layerSources["live"].hasFeature(g_liveGrids[i].rectangle)) { - g_layerSources["live"].removeFeature(g_liveGrids[i].rectangle); +function liveTriangleGrid(i) +{ + if (g_liveGrids[i].isTriangle == false) + { + if (g_layerSources.live.hasFeature(g_liveGrids[i].rectangle)) + { + g_layerSources.live.removeFeature(g_liveGrids[i].rectangle); } gridToTriangle(i, g_liveGrids[i].rectangle, false); g_liveGrids[i].isTriangle = true; - g_layerSources["live"].addFeature(g_liveGrids[i].rectangle); + g_layerSources.live.addFeature(g_liveGrids[i].rectangle); } } -function qsoTriangleGrid(i) { - if (g_qsoGrids[i].isTriangle == false) { - if (g_layerSources["qso"].hasFeature(g_qsoGrids[i].rectangle)) { - g_layerSources["qso"].removeFeature(g_qsoGrids[i].rectangle); +function qsoTriangleGrid(i) +{ + if (g_qsoGrids[i].isTriangle == false) + { + if (g_layerSources.qso.hasFeature(g_qsoGrids[i].rectangle)) + { + g_layerSources.qso.removeFeature(g_qsoGrids[i].rectangle); } gridToTriangle(i, g_qsoGrids[i].rectangle, true); g_qsoGrids[i].isTriangle = true; - g_layerSources["qso"].addFeature(g_qsoGrids[i].rectangle); + g_layerSources.qso.addFeature(g_qsoGrids[i].rectangle); } } -function setGridViewMode(mode) { +function setGridViewMode(mode) +{ g_appSettings.gridViewMode = mode; gridViewButton.innerHTML = g_gridViewArray[g_appSettings.gridViewMode]; redrawGrids(); goProcessRoster(); } -function cycleGridView() { +function cycleGridView() +{ var mode = g_appSettings.gridViewMode; mode++; if (mode > 3) mode = 1; @@ -657,23 +708,29 @@ function cycleGridView() { redrawGrids(); } -function toggleEarth() { +function toggleEarth() +{ g_appSettings.earthImgSrc ^= 1; earthImg.src = g_earthShadowImageArray[g_appSettings.earthImgSrc]; - if (g_appSettings.earthImgSrc == 1) { + if (g_appSettings.earthImgSrc == 1) + { dayNight.hide(); g_nightTime = dayNight.refresh(); - } else { + } + else + { g_nightTime = dayNight.refresh(); dayNight.show(); } changeMapLayer(); } -function toggleOffline() { +function toggleOffline() +{ if (g_map == null) return; - if (g_mapSettings.offlineMode == true) { + if (g_mapSettings.offlineMode == true) + { g_mapSettings.offlineMode = false; offlineImg.src = g_mapImageArray[1]; conditionsButton.style.display = "inline-block"; @@ -683,28 +740,37 @@ function toggleOffline() { buttonPSKSpotsBoxDiv.style.display = "inline-block"; donateButton.style.display = "inline-block"; - if (g_appSettings.gtShareEnable == true) { + if (g_appSettings.gtShareEnable == true) + { gtFlagButton.style.display = "inline-block"; if (g_appSettings.gtMsgEnable == true) - msgButton.style.display = "inline-block"; + { msgButton.style.display = "inline-block"; } else msgButton.style.display = "none"; - } else { + } + else + { msgButton.style.display = "none"; gtFlagButton.style.display = "none"; } - for (var key in g_adifLogSettings.menu) { + for (var key in g_adifLogSettings.menu) + { var value = g_adifLogSettings.menu[key]; var where = key + "Div"; document.getElementById(key).checked = value; - if (value == true) { + if (value == true) + { document.getElementById(where).style.display = "inline-block"; - } else { + } + else + { document.getElementById(where).style.display = "none"; } } pskReporterBandActivityDiv.style.display = "block"; - } else { + } + else + { g_mapSettings.offlineMode = true; offlineImg.src = g_mapImageArray[0]; conditionsButton.style.display = "none"; @@ -726,14 +792,18 @@ function toggleOffline() { changeMapValues(); } -function ignoreMessagesToggle() { +function ignoreMessagesToggle() +{ g_ignoreMessages ^= 1; - if (g_ignoreMessages == 0) { + if (g_ignoreMessages == 0) + { txrxdec.style.backgroundColor = "Green"; txrxdec.style.borderColor = "GreenYellow"; txrxdec.innerHTML = "RECEIVE"; txrxdec.title = "Click to ignore incoming messages"; - } else { + } + else + { txrxdec.style.backgroundColor = "DimGray"; txrxdec.style.borderColor = "DarkGray"; txrxdec.innerHTML = "IGNORE"; @@ -741,18 +811,21 @@ function ignoreMessagesToggle() { } } -function toggleTime() { +function toggleTime() +{ g_appSettings.useLocalTime ^= 1; displayTime(); } -function dateToString(dateTime) { +function dateToString(dateTime) +{ if (g_appSettings.useLocalTime == 1) - return dateTime.toLocaleString().replace(/,/g, ""); + { return dateTime.toLocaleString().replace(/,/g, ""); } else return dateTime.toUTCString().replace(/GMT/g, "UTC").replace(/,/g, ""); } -function userDayString(Msec) { +function userDayString(Msec) +{ var dateTime; if (Msec != null) dateTime = new Date(Msec); else dateTime = new Date(); @@ -765,30 +838,34 @@ function userDayString(Msec) { return dra.join(" "); } -function userTimeString(Msec) { +function userTimeString(Msec) +{ var dateTime; if (Msec != null) dateTime = new Date(Msec); else dateTime = new Date(); return dateToString(dateTime); } -function getWpx(callsign) { +function getWpx(callsign) +{ var prefix = null; if (callsign.includes("/")) - // Handle in the future? - return null; + // Handle in the future? + { return null; } if (!/\d/.test(callsign)) - // Insert 0, never seen this - return null; + // Insert 0, never seen this + { return null; } var end = callsign.length; var foundPrefix = false; var prefixEnd = 1; - while (prefixEnd != end) { - if (/\d/.test(callsign.charAt(prefixEnd))) { + while (prefixEnd != end) + { + if (/\d/.test(callsign.charAt(prefixEnd))) + { while (prefixEnd + 1 != end && /\d/.test(callsign.charAt(prefixEnd + 1))) - prefixEnd++; + { prefixEnd++; } foundPrefix = true; break; } @@ -800,56 +877,65 @@ function getWpx(callsign) { return prefix; } -function setState(details) { - if (details.state != null && details.state.length > 0) { +function setState(details) +{ + if (details.state != null && details.state.length > 0) + { var isDigi = details.digital; if (details.state.substr(0, 2) != "US") - details.state = "US-" + details.state; + { details.state = "US-" + details.state; } g_tracker.worked.state[details.state + details.band + details.mode] = true; g_tracker.worked.state[details.state] = true; g_tracker.worked.state[details.state + details.mode] = true; g_tracker.worked.state[details.state + details.band] = true; - if (isDigi) { + if (isDigi) + { g_tracker.worked.state[details.state + "dg"] = true; g_tracker.worked.state[details.state + details.band + "dg"] = true; } - if (details.confirmed) { + if (details.confirmed) + { g_tracker.confirmed.state[ details.state + details.band + details.mode ] = true; g_tracker.confirmed.state[details.state] = true; g_tracker.confirmed.state[details.state + details.mode] = true; g_tracker.confirmed.state[details.state + details.band] = true; - if (isDigi) { + if (isDigi) + { g_tracker.confirmed.state[details.state + "dg"] = true; g_tracker.confirmed.state[details.state + details.band + "dg"] = true; } } } - if (details.cnty != null && details.cnty.length > 0) { + if (details.cnty != null && details.cnty.length > 0) + { var isDigi = details.digital; g_tracker.worked.cnty[details.cnty + details.band + details.mode] = true; g_tracker.worked.cnty[details.cnty] = true; g_tracker.worked.cnty[details.cnty + details.mode] = true; g_tracker.worked.cnty[details.cnty + details.band] = true; - if (isDigi) { + if (isDigi) + { g_tracker.worked.cnty[details.cnty + "dg"] = true; g_tracker.worked.cnty[details.cnty + details.band + "dg"] = true; } - if (details.confirmed) { + if (details.confirmed) + { g_tracker.confirmed.cnty[ details.cnty + details.band + details.mode ] = true; g_tracker.confirmed.cnty[details.cnty] = true; g_tracker.confirmed.cnty[details.cnty + details.mode] = true; g_tracker.confirmed.cnty[details.cnty + details.band] = true; - if (isDigi) { + if (isDigi) + { g_tracker.confirmed.cnty[details.cnty + "dg"] = true; g_tracker.confirmed.cnty[details.cnty + details.band + "dg"] = true; } @@ -857,17 +943,20 @@ function setState(details) { } } -function isKnownCallsignDXCC(dxcc) { +function isKnownCallsignDXCC(dxcc) +{ if (dxcc in g_callsignDatabaseDXCC) return true; return false; } -function isKnownCallsignUS(dxcc) { +function isKnownCallsignUS(dxcc) +{ if (dxcc in g_callsignDatabaseUS) return true; return false; } -function isKnownCallsignUSplus(dxcc) { +function isKnownCallsignUSplus(dxcc) +{ if (dxcc in g_callsignDatabaseUSplus) return true; return false; } @@ -899,7 +988,8 @@ function addDeDx( finalPhone = false, finalIOTA = "", finalSatName = "" -) { +) +{ var callsign = null; var rect = null; var worked = false; @@ -910,22 +1000,25 @@ function addDeDx( var finalMsg = ifinalMsg.trim(); if (finalMsg.length > 40) finalMsg = finalMsg.substring(0, 40) + "..."; var details = null; - if (!notQso) { + if (!notQso) + { var timeMod = finalTime - (finalTime % 360) + 180; hash = unique(mode + band + finalDXcall + timeMod); var lookupCall = false; - if (hash in g_QSOhash) { + if (hash in g_QSOhash) + { details = g_QSOhash[hash]; - if (finalGrid.length > 0 && finalGrid != details.grid) { + if (finalGrid.length > 0 && finalGrid != details.grid) + { // only touch the grid if it's larger than the last grid && the 4wide is the same if ( details.grid.length < 6 && (details.grid.substr(0, 4) == finalGrid.substr(0, 4) || details.grid.length == 0) ) - details.grid = finalGrid; + { details.grid = finalGrid; } } if (finalRSTsent.length > 0) details.RSTsent = finalRSTsent; if (finalRSTrecv.length > 0) details.RSTrecv = finalRSTrecv; @@ -940,7 +1033,9 @@ function addDeDx( if (finalVucc.length > 0) details.vucc_grids = finalVucc; if (finalIOTA.length > 0) details.IOTA = finalIOTA; if (finalSatName.length > 0) details.satName = finalSatName; - } else { + } + else + { details = {}; details.grid = finalGrid; details.RSTsent = finalRSTsent; @@ -972,40 +1067,50 @@ function addDeDx( if (finalDxcc < 1) finalDxcc = callsignToDxcc(finalDXcall); details.dxcc = finalDxcc; - if (details.dxcc > 0 && details.px == null) { + if (details.dxcc > 0 && details.px == null) + { details.px = getWpx(finalDXcall); if (details.px) - details.zone = Number(details.px.charAt(details.px.length - 1)); + { details.zone = Number(details.px.charAt(details.px.length - 1)); } } if ( details.state == null && isKnownCallsignUSplus(finalDxcc) && finalGrid.length > 0 - ) { + ) + { var fourGrid = finalGrid.substr(0, 4); - if (fourGrid in g_gridToState && g_gridToState[fourGrid].length == 1) { + if (fourGrid in g_gridToState && g_gridToState[fourGrid].length == 1) + { details.state = g_gridToState[fourGrid][0]; } lookupCall = true; } details.cont = finalCont; - if (details.cont == null && finalDxcc > 0) { + if (details.cont == null && finalDxcc > 0) + { details.cont = g_worldGeoData[g_dxccToGeoData[finalDxcc]].continent; if (details.dxcc == 390 && details.zone == 1) details.cont = "EU"; } details.cnty = finalCnty; - if (details.cnty) { + if (details.cnty) + { details.qual = true; } - if (isKnownCallsignUSplus(finalDxcc)) { - if (details.cnty == null) { + if (isKnownCallsignUSplus(finalDxcc)) + { + if (details.cnty == null) + { lookupCall = true; - } else { - if (!(details.cnty in g_cntyToCounty)) { + } + else + { + if (!(details.cnty in g_cntyToCounty)) + { lookupCall = true; } } @@ -1022,18 +1127,21 @@ function addDeDx( g_tracker.worked.call[finalDXcall + mode] = true; g_tracker.worked.call[finalDXcall + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.call[finalDXcall + "dg"] = true; g_tracker.worked.call[finalDXcall + band + "dg"] = true; } var fourGrid = details.grid.substr(0, 4); - if (fourGrid != "") { + if (fourGrid != "") + { g_tracker.worked.grid[fourGrid + band + mode] = true; g_tracker.worked.grid[fourGrid] = true; g_tracker.worked.grid[fourGrid + mode] = true; g_tracker.worked.grid[fourGrid + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.grid[fourGrid + "dg"] = true; g_tracker.worked.grid[fourGrid + band + "dg"] = true; } @@ -1042,15 +1150,18 @@ function addDeDx( details.ituz.length == 0 && fourGrid in g_gridToITUZone && g_gridToITUZone[fourGrid].length == 1 - ) { + ) + { details.ituz = g_gridToITUZone[fourGrid][0]; } - if (details.ituz.length > 0) { + if (details.ituz.length > 0) + { g_tracker.worked.ituz[details.ituz + band + mode] = true; g_tracker.worked.ituz[details.ituz] = true; g_tracker.worked.ituz[details.ituz + mode] = true; g_tracker.worked.ituz[details.ituz + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.ituz[details.ituz + "dg"] = true; g_tracker.worked.ituz[details.ituz + band + "dg"] = true; } @@ -1059,57 +1170,68 @@ function addDeDx( details.cqz.length == 0 && fourGrid in g_gridToCQZone && g_gridToCQZone[fourGrid].length == 1 - ) { + ) + { details.cqz = g_gridToCQZone[fourGrid][0]; } - if (details.cqz.length > 0) { + if (details.cqz.length > 0) + { g_tracker.worked.cqz[details.cqz + band + mode] = true; g_tracker.worked.cqz[details.cqz] = true; g_tracker.worked.cqz[details.cqz + mode] = true; g_tracker.worked.cqz[details.cqz + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.cqz[details.cqz + "dg"] = true; g_tracker.worked.cqz[details.cqz + band + "dg"] = true; } } - if (details.dxcc > 0) { + if (details.dxcc > 0) + { var sDXCC = String(details.dxcc); g_tracker.worked.dxcc[sDXCC + band + mode] = true; g_tracker.worked.dxcc[sDXCC] = true; g_tracker.worked.dxcc[sDXCC + mode] = true; g_tracker.worked.dxcc[sDXCC + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.dxcc[sDXCC + "dg"] = true; g_tracker.worked.dxcc[sDXCC + band + "dg"] = true; } } - if (details.px) { + if (details.px) + { g_tracker.worked.px[details.px + band + mode] = true; g_tracker.worked.px[details.px] = hash; g_tracker.worked.px[details.px + mode] = true; g_tracker.worked.px[details.px + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.px[details.px + "dg"] = true; g_tracker.worked.px[details.px + band + "dg"] = true; } - if (isPhone == true) { + if (isPhone == true) + { g_tracker.worked.px[details.px + "ph"] = true; g_tracker.worked.px[details.px + band + "ph"] = true; } } - if (details.cont) { + if (details.cont) + { g_tracker.worked.cont[details.cont + band + mode] = true; g_tracker.worked.cont[details.cont] = hash; g_tracker.worked.cont[details.cont + mode] = true; g_tracker.worked.cont[details.cont + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.worked.cont[details.cont + "dg"] = true; g_tracker.worked.cont[details.cont + band + "dg"] = true; } - if (isPhone == true) { + if (isPhone == true) + { g_tracker.worked.cont[details.cont + "ph"] = true; g_tracker.worked.cont[details.cont + band + "ph"] = true; } @@ -1118,7 +1240,8 @@ function addDeDx( worked = true; locked = true; details.worked = worked; - if (typeof details.confirmed == "undefined" || details.confirmed == false) { + if (typeof details.confirmed == "undefined" || details.confirmed == false) + { details.confirmed = confirmed; } @@ -1126,73 +1249,88 @@ function addDeDx( setState(details); - if (lookupCall) { - if (g_callsignLookups.ulsUseEnable) { + if (lookupCall) + { + if (g_callsignLookups.ulsUseEnable) + { lookupUsCallsign(details, true); } } - if (confirmed == true) { - if (fourGrid != "") { + if (confirmed == true) + { + if (fourGrid != "") + { g_tracker.confirmed.grid[fourGrid + band + mode] = true; g_tracker.confirmed.grid[fourGrid] = true; g_tracker.confirmed.grid[fourGrid + mode] = true; g_tracker.confirmed.grid[fourGrid + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.grid[fourGrid + "dg"] = true; g_tracker.confirmed.grid[fourGrid + band + "dg"] = true; } } - if (details.ituz.length > 0) { + if (details.ituz.length > 0) + { g_tracker.confirmed.ituz[details.ituz + band + mode] = true; g_tracker.confirmed.ituz[details.ituz] = true; g_tracker.confirmed.ituz[details.ituz + mode] = true; g_tracker.confirmed.ituz[details.ituz + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.ituz[details.ituz + "dg"] = true; g_tracker.confirmed.ituz[details.ituz + band + "dg"] = true; } } - if (details.cqz.length > 0) { + if (details.cqz.length > 0) + { g_tracker.confirmed.cqz[details.cqz + band + mode] = true; g_tracker.confirmed.cqz[details.cqz] = true; g_tracker.confirmed.cqz[details.cqz + mode] = true; g_tracker.confirmed.cqz[details.cqz + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.cqz[details.cqz + "dg"] = true; g_tracker.confirmed.cqz[details.cqz + band + "dg"] = true; } } - if (details.dxcc > 0) { + if (details.dxcc > 0) + { var sDXCC = String(details.dxcc); g_tracker.confirmed.dxcc[sDXCC + band + mode] = true; g_tracker.confirmed.dxcc[sDXCC] = true; g_tracker.confirmed.dxcc[sDXCC + mode] = true; g_tracker.confirmed.dxcc[sDXCC + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.dxcc[sDXCC + "dg"] = true; g_tracker.confirmed.dxcc[sDXCC + band + "dg"] = true; } } - if (details.px) { + if (details.px) + { g_tracker.confirmed.px[details.px + band + mode] = true; g_tracker.confirmed.px[details.px] = hash; g_tracker.confirmed.px[details.px + mode] = true; g_tracker.confirmed.px[details.px + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.px[details.px + "dg"] = true; g_tracker.confirmed.px[details.px + band + "dg"] = true; } } - if (details.cont) { + if (details.cont) + { g_tracker.confirmed.cont[details.cont + band + mode] = true; g_tracker.confirmed.cont[details.cont] = hash; g_tracker.confirmed.cont[details.cont + mode] = true; g_tracker.confirmed.cont[details.cont + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.cont[details.cont + "dg"] = true; g_tracker.confirmed.cont[details.cont + band + "dg"] = true; } @@ -1202,7 +1340,8 @@ function addDeDx( g_tracker.confirmed.call[finalDXcall] = true; g_tracker.confirmed.call[finalDXcall + mode] = true; g_tracker.confirmed.call[finalDXcall + band] = true; - if (isDigi == true) { + if (isDigi == true) + { g_tracker.confirmed.call[finalDXcall + "dg"] = true; g_tracker.confirmed.call[finalDXcall + band + "dg"] = true; } @@ -1213,11 +1352,13 @@ function addDeDx( if (finalDxcc < 1) finalDxcc = callsignToDxcc(finalDXcall); hash = finalDXcall + band + mode; - if (notQso) { + if (notQso) + { if (hash in g_liveCallsigns) callsign = g_liveCallsigns[hash]; } - if (!notQso) { + if (!notQso) + { if ( (g_appSettings.gtBandFilter.length == 0 || (g_appSettings.gtBandFilter == "auto" @@ -1225,7 +1366,8 @@ function addDeDx( : g_appSettings.gtBandFilter == band)) && validateMapMode(mode) && validatePropMode(finalPropMode) - ) { + ) + { details.rect = qthToQsoBox( finalGrid, hash, @@ -1240,7 +1382,9 @@ function addDeDx( ); } return; - } else { + } + else + { if (finalDxcc in g_dxccCount) g_dxccCount[finalDxcc]++; else g_dxccCount[finalDxcc] = 1; @@ -1250,7 +1394,8 @@ function addDeDx( ? myBand == band : g_appSettings.gtBandFilter == band)) && validateMapMode(mode) - ) { + ) + { rect = qthToBox( finalGrid, finalDXcall, @@ -1265,7 +1410,8 @@ function addDeDx( } } - if (callsign == null) { + if (callsign == null) + { var newCallsign = {}; newCallsign.DEcall = finalDXcall; newCallsign.grid = finalGrid; @@ -1284,23 +1430,29 @@ function addDeDx( newCallsign.zone = null; newCallsign.cnty = finalCnty; newCallsign.cont = finalCont; - if (finalDxcc > -1) { + if (finalDxcc > -1) + { newCallsign.px = getWpx(finalDXcall); if (newCallsign.px) + { newCallsign.zone = Number( newCallsign.px.charAt(newCallsign.px.length - 1) ); + } - if (newCallsign.cont == null) { + if (newCallsign.cont == null) + { newCallsign.cont = g_worldGeoData[g_dxccToGeoData[finalDxcc]].continent; if (newCallsign.dxcc == 390 && newCallsign.zone == 1) - newCallsign.cont = "EU"; + { newCallsign.cont = "EU"; } } } - if (finalRSTsent != null) { + if (finalRSTsent != null) + { newCallsign.RSTsent = finalRSTsent; } - if (finalRSTrecv != null) { + if (finalRSTrecv != null) + { newCallsign.RSTrecv = finalRSTrecv; } newCallsign.time = finalTime; @@ -1325,24 +1477,31 @@ function addDeDx( newCallsign.state == null && isKnownCallsignDXCC(finalDxcc) && finalGrid.length > 0 - ) { - if (g_callsignLookups.ulsUseEnable) { + ) + { + if (g_callsignLookups.ulsUseEnable) + { lookupUsCallsign(newCallsign); } - if (newCallsign.state == null && isKnownCallsignUSplus(finalDxcc)) { + if (newCallsign.state == null && isKnownCallsignUSplus(finalDxcc)) + { var fourGrid = finalGrid.substr(0, 4); if ( fourGrid in g_gridToState && g_gridToState[finalGrid.substr(0, 4)].length == 1 - ) { + ) + { newCallsign.state = g_gridToState[finalGrid.substr(0, 4)][0]; } } } g_liveCallsigns[hash] = newCallsign; - } else { - if (callsign.DXcall != "Self" && finalTime > callsign.time) { + } + else + { + if (callsign.DXcall != "Self" && finalTime > callsign.time) + { callsign.time = finalTime; callsign.mode = mode; callsign.band = band; @@ -1357,7 +1516,7 @@ function addDeDx( finalGrid.length == callsign.grid.length && finalGrid != callsign.grid ) - callsign.grid = finalGrid; + { callsign.grid = finalGrid; } if (finalRSTsent != null) callsign.RSTsent = finalRSTsent; if (finalRSTrecv != null) callsign.RSTrecv = finalRSTrecv; callsign.vucc_grids = []; @@ -1370,20 +1529,23 @@ function addDeDx( } } -function timeoutSetUdpPort() { +function timeoutSetUdpPort() +{ g_appSettings.wsjtUdpPort = udpPortInput.value; lastMsgTimeDiv.innerHTML = "Waiting for msg..."; g_setNewUdpPortTimeoutHandle = null; } -function setUdpPort() { +function setUdpPort() +{ if (g_setNewUdpPortTimeoutHandle != null) - window.clearTimeout(g_setNewUdpPortTimeoutHandle); + { window.clearTimeout(g_setNewUdpPortTimeoutHandle); } lastMsgTimeDiv.innerHTML = "..setting.."; g_setNewUdpPortTimeoutHandle = window.setTimeout(timeoutSetUdpPort, 1000); } -function changeGridDecay() { +function changeGridDecay() +{ g_appSettings.gridsquareDecayTime = parseInt(gridDecay.value); decayRateTd.innerHTML = Number(g_appSettings.gridsquareDecayTime) == 0 @@ -1391,56 +1553,69 @@ function changeGridDecay() { : Number(g_appSettings.gridsquareDecayTime).toDHMS(); } -function changeMouseOverValue() { +function changeMouseOverValue() +{ g_mapSettings.mouseOver = mouseOverValue.checked; saveMapSettings(); } -function changeMergeOverlayValue() { +function changeMergeOverlayValue() +{ g_mapSettings.mergeOverlay = mergeOverlayValue.checked; saveMapSettings(); setTrophyOverlay(g_currentOverlay); } -function getPathColor() { - if (g_mapSettings.nightMapEnable && g_nightTime) { +function getPathColor() +{ + if (g_mapSettings.nightMapEnable && g_nightTime) + { if (g_mapSettings.nightPathColor == 0) return "#000"; if (g_mapSettings.nightPathColor == 361) return "#FFF"; return "hsl(" + g_mapSettings.nightPathColor + ", 100%, 50%)"; - } else { + } + else + { if (g_mapSettings.pathColor == 0) return "#000"; if (g_mapSettings.pathColor == 361) return "#FFF"; return "hsl(" + g_mapSettings.pathColor + ", 100%, 50%)"; } } -function getQrzPathColor() { - if (g_mapSettings.nightMapEnable && g_nightTime) { +function getQrzPathColor() +{ + if (g_mapSettings.nightMapEnable && g_nightTime) + { if (g_mapSettings.nightQrzPathColor == 0) return "#000"; if (g_mapSettings.nightQrzPathColor == 361) return "#FFF"; return "hsl(" + g_mapSettings.nightQrzPathColor + ", 100%, 50%)"; - } else { + } + else + { if (g_mapSettings.qrzPathColor == 0) return "#000"; if (g_mapSettings.qrzPathColor == 361) return "#FFF"; return "hsl(" + g_mapSettings.qrzPathColor + ", 100%, 50%)"; } } -function changeShadow() { +function changeShadow() +{ g_mapSettings.shadow = shadowValue.value; showDarknessTd.innerHTML = parseInt(shadowValue.value * 100) + "%"; saveMapSettings(); g_nightTime = dayNight.refresh(); } -function changePathWidth() { +function changePathWidth() +{ g_appSettings.pathWidthWeight = pathWidthValue.value; g_appSettings.qrzPathWidthWeight = qrzPathWidthValue.value; pathWidthTd.innerHTML = pathWidthValue.value; qrzPathWidthTd.innerHTML = qrzPathWidthValue.value; - for (var i = g_flightPaths.length - 1; i >= 0; i--) { + for (var i = g_flightPaths.length - 1; i >= 0; i--) + { var featureStyle = g_flightPaths[i].getStyle(); var featureStroke = featureStyle.getStroke(); @@ -1449,10 +1624,11 @@ function changePathWidth() { ? qrzPathWidthValue.value : pathWidthValue.value; - if (width == 0) { + if (width == 0) + { if (typeof g_flightPaths[i].Arrow != "undefined") - g_layerSources["flight"].removeFeature(g_flightPaths[i].Arrow); - g_layerSources["flight"].removeFeature(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; @@ -1467,44 +1643,49 @@ function changePathWidth() { featureStyle.setStroke(featureStroke); g_flightPaths[i].setStyle(featureStyle); - if (typeof g_flightPaths[i].Arrow != "undefined") { + if (typeof g_flightPaths[i].Arrow != "undefined") + { var stroke = new ol.style.Stroke({ color: color, - width: width, + width: width }); var thisStle = new ol.style.Style({ image: new ol.style.Circle({ stroke: stroke, - radius: 3, - }), + radius: 3 + }) }); g_flightPaths[i].Arrow.setStyle(thisStle); } } - if (g_transmitFlightPath != null) { + if (g_transmitFlightPath != null) + { var featureStyle = g_transmitFlightPath.getStyle(); var featureStroke = featureStyle.getStroke(); - if (qrzPathWidthValue.value == 0) { - g_layerSources["transmit"].clear(); - delete g_transmitFlightPath; + if (qrzPathWidthValue.value == 0) + { + g_layerSources.transmit.clear(); g_transmitFlightPath = null; - } else { + } + else + { featureStroke.setWidth(qrzPathWidthValue.value); featureStroke.setColor(getQrzPathColor()); featureStyle.setStroke(featureStroke); g_transmitFlightPath.setStyle(featureStyle); - if (typeof g_transmitFlightPath.Arrow != "undefined") { + if (typeof g_transmitFlightPath.Arrow != "undefined") + { var stroke = new ol.style.Stroke({ color: getQrzPathColor(), - width: qrzPathWidthValue.value, + width: qrzPathWidthValue.value }); var thisStle = new ol.style.Style({ image: new ol.style.Circle({ stroke: stroke, - radius: 3, - }), + radius: 3 + }) }); g_transmitFlightPath.Arrow.setStyle(thisStle); } @@ -1512,25 +1693,30 @@ function changePathWidth() { } } -function compareCallsignTime(a, b) { +function compareCallsignTime(a, b) +{ if (a.time < b.time) return -1; if (a.time > b.time) return 1; return 0; } -function createFlagTipTable(toolElement) { +function createFlagTipTable(toolElement) +{ var myFlagtip = document.getElementById("myFlagtip"); var worker = ""; - if (toolElement.size == 1) { + if (toolElement.size == 1) + { var key = toolElement.key; var dxcc = callsignToDxcc(g_gtFlagPins[key].call); var dxccName = g_dxccToAltName[dxcc]; var workColor = "cyan"; - if (g_gtFlagPins[key].call + myBand + myMode in g_tracker.worked.call) { + if (g_gtFlagPins[key].call + myBand + myMode in g_tracker.worked.call) + { workColor = "yellow"; } - if (g_gtFlagPins[key].call + myBand + myMode in g_tracker.confirmed.call) { + if (g_gtFlagPins[key].call + myBand + myMode in g_tracker.confirmed.call) + { workColor = "#00FF00"; } @@ -1596,7 +1782,9 @@ function createFlagTipTable(toolElement) { "°"; worker += ""; - } else if (toolElement.size == 73) { + } + else if (toolElement.size == 73) + { var props = toolElement.getProperties(); moment.locale(navigator.languages[0]); @@ -1629,37 +1817,47 @@ function createFlagTipTable(toolElement) { return 1; } -function remove_duplicates(arr) { +function remove_duplicates(arr) +{ var obj = {}; var ret_arr = []; - for (var i = 0; i < arr.length; i++) { + for (var i = 0; i < arr.length; i++) + { obj[arr[i]] = true; } - for (var key in obj) { + for (var key in obj) + { ret_arr.push(key); } return ret_arr; } -function splitNoParen(s) { +function splitNoParen(s) +{ var results = []; var next; var str = ""; var left = 0, right = 0; - function keepResult() { + function keepResult() + { results.push(str.trim()); str = ""; } - for (var i = 0; i < s.length; i++) { - switch (s[i]) { + for (var i = 0; i < s.length; i++) + { + switch (s[i]) + { case ",": - if (left === right) { + if (left === right) + { keepResult(); left = right = 0; - } else { + } + else + { str += s[i]; } break; @@ -1679,11 +1877,13 @@ function splitNoParen(s) { return results; } -function createSpotTipTable(toolElement) { +function createSpotTipTable(toolElement) +{ var now = timeNowSec(); var myTooltip = document.getElementById("myTooltip"); var worker = ""; - if (toolElement.spot in g_receptionReports.spots) { + if (toolElement.spot in g_receptionReports.spots) + { g_layerSources["psk-hop"].clear(); var report = g_receptionReports.spots[toolElement.spot]; @@ -1708,12 +1908,14 @@ function createSpotTipTable(toolElement) { ""; if (report.dxcc > 0) + { worker += "DXCC" + g_dxccToAltName[report.dxcc] + " (" + g_worldGeoData[g_dxccToGeoData[report.dxcc]].pp + ")"; + } worker += "Grid" + @@ -1777,7 +1979,7 @@ function createSpotTipTable(toolElement) { { weight: strokeWeight, color: getQrzPathColor(), - steps: 75, + steps: 75 }, "psk-hop", false @@ -1788,8 +1990,10 @@ function createSpotTipTable(toolElement) { return 10; } -function createTooltTipTable(toolElement) { - if (typeof toolElement.spot != "undefined") { +function createTooltTipTable(toolElement) +{ + if (typeof toolElement.spot != "undefined") + { return createSpotTipTable(toolElement); } var myTooltip = document.getElementById("myTooltip"); @@ -1805,25 +2009,30 @@ function createTooltTipTable(toolElement) { " style='color:cyan'>" + toolElement.qth + ""; - if (toolElement.qth in g_gridToDXCC) { + if (toolElement.qth in g_gridToDXCC) + { worker += ""; - for (var x = 0; x < g_gridToDXCC[toolElement.qth].length; x++) { + for (var x = 0; x < g_gridToDXCC[toolElement.qth].length; x++) + { worker += g_dxccToAltName[g_gridToDXCC[toolElement.qth][x]]; - if (toolElement.qth in g_gridToState) { + if (toolElement.qth in g_gridToState) + { worker += " ("; var added = false; - for (var y = 0; y < g_gridToState[toolElement.qth].length; y++) { + for (var y = 0; y < g_gridToState[toolElement.qth].length; y++) + { if ( g_gridToDXCC[toolElement.qth][x] == g_StateData[g_gridToState[toolElement.qth][y]].dxcc - ) { + ) + { worker += g_StateData[g_gridToState[toolElement.qth][y]].name + " / "; added = true; } } if (added == true) - worker = worker.substr(0, worker.length - " / ".length); + { worker = worker.substr(0, worker.length - " / ".length); } worker += ")"; } if (x + 1 < g_gridToDXCC[toolElement.qth].length) worker += ", "; @@ -1831,8 +2040,10 @@ function createTooltTipTable(toolElement) { worker += ""; } var newCallList = Array(); - if (toolElement.qso == true) { - if (Object.keys(toolElement.hashes).length > 0) { + if (toolElement.qso == true) + { + if (Object.keys(toolElement.hashes).length > 0) + { worker += "CallFreqSentRcvdStationModeBandQSLLast MsgDXCCTime"; @@ -1841,8 +2052,10 @@ function createTooltTipTable(toolElement) { if (g_callsignLookups.oqrsUseEnable == true) worker += "OQRS"; worker += ""; } - for (var KeyIsHash in toolElement.hashes) { - if (KeyIsHash in g_QSOhash) { + for (var KeyIsHash in toolElement.hashes) + { + if (KeyIsHash in g_QSOhash) + { newCallList.push(g_QSOhash[KeyIsHash]); } } @@ -1850,14 +2063,19 @@ function createTooltTipTable(toolElement) { toolElement.qth in g_liveGrids && g_liveGrids[toolElement.qth].rectangle != null && g_liveGrids[toolElement.qth].isTriangle == false - ) { - for (var KeyIsCall in g_liveGrids[toolElement.qth].rectangle.liveHash) { + ) + { + for (var KeyIsCall in g_liveGrids[toolElement.qth].rectangle.liveHash) + { if (KeyIsCall in g_liveCallsigns && g_appSettings.gridViewMode == 3) - newCallList.push(g_liveCallsigns[KeyIsCall]); + { newCallList.push(g_liveCallsigns[KeyIsCall]); } } } - } else { - if (Object.keys(toolElement.liveHash).length > 0) { + } + else + { + if (Object.keys(toolElement.liveHash).length > 0) + { worker += "CallFreqSentRcvdStationModeBandLast MsgDXCCTime"; @@ -1866,33 +2084,36 @@ function createTooltTipTable(toolElement) { if (g_callsignLookups.oqrsUseEnable == true) worker += "OQRS"; worker += ""; } - for (var KeyIsCall in toolElement.liveHash) { + for (var KeyIsCall in toolElement.liveHash) + { if (KeyIsCall in g_liveCallsigns) - newCallList.push(g_liveCallsigns[KeyIsCall]); + { newCallList.push(g_liveCallsigns[KeyIsCall]); } } } newCallList.sort(compareCallsignTime).reverse(); - for (var x = 0; x < newCallList.length; x++) { + for (var x = 0; x < newCallList.length; x++) + { var callsign = newCallList[x]; var bgDX = " style='font-weight:bold;color:cyan;' "; var bgDE = " style='font-weight:bold;color:yellow;' "; if (callsign.DXcall == myDEcall) - bgDX = " style='background-color:cyan;color:#000;font-weight:bold' "; + { bgDX = " style='background-color:cyan;color:#000;font-weight:bold' "; } if (callsign.DEcall == myDEcall) - bgDE = " style='background-color:#FFFF00;color:#000;font-weight:bold' "; + { bgDE = " style='background-color:#FFFF00;color:#000;font-weight:bold' "; } if (typeof callsign.msg == "undefined" || callsign.msg == "") - callsign.msg = "-"; + { callsign.msg = "-"; } var ageString = ""; if (timeNowSec() - callsign.time < 3601) - ageString = (timeNowSec() - callsign.time).toDHMS(); - else { + { ageString = (timeNowSec() - callsign.time).toDHMS(); } + else + { ageString = userTimeString(callsign.time * 1000); } worker += ""; worker += "
" + callsign.DEcall.formatCallsign() + @@ -1902,14 +2123,16 @@ function createTooltTipTable(toolElement) { worker += "" + callsign.RSTsent + ""; worker += "" + callsign.RSTrecv + "" + ""; if (callsign.DXcall.indexOf("CQ") == 0 || callsign.DXcall == "-") - worker += callsign.DXcall.formatCallsign(); + { worker += callsign.DXcall.formatCallsign(); } else + { worker += "
" + callsign.DXcall.formatCallsign() + "
"; + } worker += "" + "" + @@ -1918,7 +2141,8 @@ function createTooltTipTable(toolElement) { "" + callsign.band + ""; - if (toolElement.qso == true) { + if (toolElement.qso == true) + { worker += "" + (callsign.confirmed ? "✔" : "") + @@ -1936,20 +2160,26 @@ function createTooltTipTable(toolElement) { ageString + ""; if (g_callsignLookups.lotwUseEnable == true) + { worker += "" + (callsign.DEcall in g_lotwCallsigns ? "✔" : "") + ""; + } if (g_callsignLookups.eqslUseEnable == true) + { worker += "" + (callsign.DEcall in g_eqslCallsigns ? "✔" : "") + ""; + } if (g_callsignLookups.oqrsUseEnable == true) + { worker += "" + (callsign.DEcall in g_oqrsCallsigns ? "✔" : "") + ""; + } worker += ""; } worker += ""; @@ -1958,9 +2188,12 @@ function createTooltTipTable(toolElement) { return newCallList.length; } -function renderTooltipWindow(feature) { - if (g_popupWindowHandle != null) { - try { +function renderTooltipWindow(feature) +{ + if (g_popupWindowHandle != null) + { + try + { createTooltTipTable(feature); var adif = g_popupWindowHandle.window.document.getElementById( "adifTable" @@ -1973,34 +2206,42 @@ function renderTooltipWindow(feature) { g_popupWindowHandle.width = parseInt(positionInfo.width) + 20; g_popupWindowHandle.height = parseInt(positionInfo.height) + 50; - } catch (e) {} + } + catch (e) {} } } -function leftClickGtFlag(feature) { +function leftClickGtFlag(feature) +{ var e = window.event; - if ((e.which && e.which == 1) || (e.button && e.button == 1)) { + if ((e.which && e.which == 1) || (e.button && e.button == 1)) + { startLookup(g_gtFlagPins[feature.key].call, g_gtFlagPins[feature.key].grid); } return false; } -function openConditionsWindow() { - if (g_conditionsWindowHandle == null) { +function openConditionsWindow() +{ + if (g_conditionsWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( "gt_conditions.html", { show: false, - id: "GT-Conditions", + id: "GT-Conditions" }, - function (new_win) { + function (new_win) + { g_conditionsWindowHandle = new_win; - new_win.on("loaded", function () { + new_win.on("loaded", function () + { g_conditionsWindowHandle.setMinimumSize(490, 290); }); - new_win.on("close", function () { + new_win.on("close", function () + { g_conditionsWindowHandle.window.g_isShowing = false; g_conditionsWindowHandle.window.saveScreenSettings(); g_conditionsWindowHandle.hide(); @@ -2008,13 +2249,17 @@ function openConditionsWindow() { } ); lockNewWindows(); - } else { - try { + } + else + { + try + { g_conditionsWindowHandle.window.g_isShowing = true; g_conditionsWindowHandle.window.saveScreenSettings(); g_conditionsWindowHandle.show(); g_conditionsWindowHandle.focus(); - } catch (e) {} + } + catch (e) {} } } @@ -2026,19 +2271,23 @@ function insertMessageInRoster( msgDXcallsign, callObj, hash -) { +) +{ var now = timeNowSec(); - if (!(hash in g_callRoster)) { + if (!(hash in g_callRoster)) + { g_callRoster[hash] = {}; callObj.life = now; callObj.reset = false; } - if (callObj.reset) { + if (callObj.reset) + { callObj.life = now; callObj.reset = false; } - if (typeof callObj.life == "undefined") { + if (typeof callObj.life == "undefined") + { callObj.life = now; callObj.reset = false; } @@ -2050,8 +2299,10 @@ function insertMessageInRoster( goProcessRoster(true); } -function openCallRosterWindow(show = true) { - if (g_callRosterWindowHandle == null) { +function openCallRosterWindow(show = true) +{ + if (g_callRosterWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( @@ -2059,16 +2310,19 @@ function openCallRosterWindow(show = true) { { show: false, id: "GT-roster", - icon: "img/roster-icon.png", + icon: "img/roster-icon.png" }, - function (new_win) { + function (new_win) + { g_callRosterWindowHandle = new_win; - new_win.on("loaded", function () { + new_win.on("loaded", function () + { g_callRosterWindowHandle.setMinimumSize(390, 250); g_callRosterWindowHandle.setResizable(true); setRosterTop(); }); - new_win.on("close", function () { + new_win.on("close", function () + { g_callRosterWindowHandle.window.g_isShowing = false; g_callRosterWindowHandle.window.saveScreenSettings(); g_callRosterWindowHandle.hide(); @@ -2076,54 +2330,72 @@ function openCallRosterWindow(show = true) { } ); lockNewWindows(); - } else { - try { + } + else + { + try + { g_callRosterWindowHandle.show(); g_callRosterWindowHandle.window.g_isShowing = true; g_callRosterWindowHandle.window.saveScreenSettings(); g_callRosterWindowHandle.focus(); goProcessRoster(); - } catch (e) {} + } + catch (e) {} } } -function updateRosterWorked() { - if (g_callRosterWindowHandle) { - try { +function updateRosterWorked() +{ + if (g_callRosterWindowHandle) + { + try + { g_callRosterWindowHandle.window.updateWorked(); - } catch (e) {} + } + catch (e) {} } } -function updateRosterInstances() { - if (g_callRosterWindowHandle) { - try { +function updateRosterInstances() +{ + if (g_callRosterWindowHandle) + { + try + { g_callRosterWindowHandle.window.updateInstances(); - } catch (e) {} + } + catch (e) {} } } -function updateLogbook() { +function updateLogbook() +{ showWorkedBox(0, 0, true); } -function openStatsWindow(show = true) { - if (g_statsWindowHandle == null) { +function openStatsWindow(show = true) +{ + if (g_statsWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( "gt_stats.html", { show: false, - id: "GT-stats", + id: "GT-stats" }, - function (new_win) { + function (new_win) + { g_statsWindowHandle = new_win; - new_win.on("loaded", function () { + new_win.on("loaded", function () + { g_statsWindowHandle.setMinimumSize(620, 200); g_statsWindowHandle.setResizable(true); }); - new_win.on("close", function () { + new_win.on("close", function () + { g_statsWindowHandle.window.g_isShowing = false; g_statsWindowHandle.window.saveScreenSettings(); g_statsWindowHandle.hide(); @@ -2131,33 +2403,42 @@ function openStatsWindow(show = true) { } ); lockNewWindows(); - } else { - try { + } + else + { + try + { g_statsWindowHandle.show(); g_statsWindowHandle.window.g_isShowing = true; g_statsWindowHandle.window.saveScreenSettings(); g_statsWindowHandle.focus(); - } catch (e) {} + } + catch (e) {} } } -function showMessaging(show = true, cid) { - if (g_chatWindowHandle == null) { +function showMessaging(show = true, cid) +{ + if (g_chatWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( "gt_chat.html", { show: false, - id: "GT-chat", + id: "GT-chat" }, - function (new_win) { + function (new_win) + { g_chatWindowHandle = new_win; - g_chatWindowHandle.on("loaded", function () { + g_chatWindowHandle.on("loaded", function () + { g_chatWindowHandle.setMinimumSize(450, 140); g_chatWindowHandle.setResizable(true); }); - g_chatWindowHandle.on("close", function () { + g_chatWindowHandle.on("close", function () + { g_chatWindowHandle.window.closeMessageArea(); g_chatWindowHandle.window.g_isShowing = false; g_chatWindowHandle.window.saveScreenSettings(); @@ -2166,147 +2447,184 @@ function showMessaging(show = true, cid) { } ); lockNewWindows(); - } else { - try { + } + else + { + try + { g_chatWindowHandle.window.g_isShowing = true; g_chatWindowHandle.window.saveScreenSettings(); g_chatWindowHandle.show(); g_chatWindowHandle.focus(); if (typeof cid != "undefined") g_chatWindowHandle.window.openId(cid); - } catch (e) {} + } + catch (e) {} } } -function onRightClickGridSquare(feature) { +function onRightClickGridSquare(feature) +{ var e = window.event; if ( (e.which && e.button == 2 && event.shiftKey) || (e.button && e.button == 2 && event.shiftKey) - ) { + ) + { var myTooltip = document.getElementById("myTooltip"); createTooltTipTable(feature); selectElementContents(myTooltip); - } else if (e.button == 0 && g_mapSettings.mouseOver == false) { + } + else if (e.button == 0 && g_mapSettings.mouseOver == false) + { mouseOverDataItem(feature, false); - } else if ((e.which && e.which == 3) || (e.button && e.button == 2)) { - if (g_popupWindowHandle == null) { + } + else if ((e.which && e.which == 3) || (e.button && e.button == 2)) + { + if (g_popupWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( "gt_popup.html", { show: false, - id: "GT-popup", + id: "GT-popup" }, - function (new_win) { + function (new_win) + { g_popupWindowHandle = new_win; - new_win.on("loaded", function () { + new_win.on("loaded", function () + { g_popupWindowHandle.show(); renderTooltipWindow(feature); }); - new_win.on("close", function () { + new_win.on("close", function () + { g_popupWindowHandle.hide(); }); } ); lockNewWindows(); - } else { - try { + } + else + { + try + { renderTooltipWindow(feature); - } catch (e) {} + } + catch (e) {} } mouseOutOfDataItem(); - } else if ((e.which && e.which == 1) || (e.button && e.button == 0)) { - if (typeof feature.spot != "undefined") { + } + else if ((e.which && e.which == 1) || (e.button && e.button == 0)) + { + if (typeof feature.spot != "undefined") + { spotLookupAndSetCall(feature.spot); } } return false; } -function onMouseUpdate(e) { +function onMouseUpdate(e) +{ g_mouseX = e.pageX; g_mouseY = e.pageY; mouseMoveGrid(); } -function getMouseX() { +function getMouseX() +{ return g_mouseX; } -function getMouseY() { +function getMouseY() +{ return g_mouseY; } var g_tempGridBox = null; -function tempGridToBox(iQTH, oldGrid, borderColor, boxColor, layer) { +function tempGridToBox(iQTH, oldGrid, borderColor, boxColor, layer) +{ var borderWeight = 2; var newGridBox = null; var LL = squareToLatLong(iQTH.substr(0, 4)); - if (oldGrid) { - if (g_layerSources["temp"].hasFeature(oldGrid)) - g_layerSources["temp"].removeFeature(oldGrid); - delete oldGrid; + if (oldGrid) + { + if (g_layerSources.temp.hasFeature(oldGrid)) + { g_layerSources.temp.removeFeature(oldGrid); } } var bounds = [ [LL.lo1, LL.la1], - [LL.lo2, LL.la2], + [LL.lo2, LL.la2] ]; newGridBox = rectangle(bounds); newGridBox.setId(iQTH); const featureStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: boxColor, + color: boxColor }), stroke: new ol.style.Stroke({ color: borderColor, width: borderWeight, - lineJoin: "round", + lineJoin: "round" }), - zIndex: 60, + zIndex: 60 }); newGridBox.setStyle(featureStyle); newGridBox.grid = iQTH; newGridBox.size = 0; - g_layerSources["temp"].addFeature(newGridBox); + g_layerSources.temp.addFeature(newGridBox); return newGridBox; } var g_tempGrids = Array(); -function onMyKeyDown(event) { - if (g_MyGridIsUp == true && g_MyCurrentGrid.length == 4) { +function onMyKeyDown(event) +{ + if (g_MyGridIsUp == true && g_MyCurrentGrid.length == 4) + { var processedAlert = false; var mediaClip = ""; var failedToAdd = g_dirSeperator + "Balloon-deflating-1.mp3"; - if (event.code == "KeyM") { + if (event.code == "KeyM") + { mediaClip = g_dirSeperator + "Clicky-1.mp3"; var valid = addAlert(g_MyCurrentGrid, 2, 3, 2, "", ""); - if (!valid) { - mediaClip = failedToAdd; - } - processedAlert = true; - } else if (event.code == "KeyT") { - mediaClip = g_dirSeperator + "Ping-coin.mp3"; - var valid = addAlert(g_MyCurrentGrid, 2, 1, 2, "", ""); - if (!valid) { - mediaClip = failedToAdd; - } - processedAlert = true; - } else if (event.code == "KeyV") { - mediaClip = g_dirSeperator + "Slide-ping.mp3"; - var valid = addAlert(g_MyCurrentGrid, 2, 2, 2, "", ""); - if (!valid) { + if (!valid) + { mediaClip = failedToAdd; } processedAlert = true; } - if (processedAlert == true) { + else if (event.code == "KeyT") + { + mediaClip = g_dirSeperator + "Ping-coin.mp3"; + var valid = addAlert(g_MyCurrentGrid, 2, 1, 2, "", ""); + if (!valid) + { + mediaClip = failedToAdd; + } + processedAlert = true; + } + else if (event.code == "KeyV") + { + mediaClip = g_dirSeperator + "Slide-ping.mp3"; + var valid = addAlert(g_MyCurrentGrid, 2, 2, 2, "", ""); + if (!valid) + { + mediaClip = failedToAdd; + } + processedAlert = true; + } + if (processedAlert == true) + { playAlertMediaFile(mediaClip); } return; } - if (event.keyCode == 27) { + if (event.keyCode == 27) + { alertsPopDiv.style.display = "none"; rootSettingsDiv.style.display = "none"; @@ -2317,55 +2635,75 @@ function onMyKeyDown(event) { if ( alertsPopDiv.style.display == "none" && rootSettingsDiv.style.display == "none" - ) { - if (event.code in g_hotKeys) { - if (typeof g_hotKeys[event.code].param1 != "undefined") { + ) + { + if (event.code in g_hotKeys) + { + if (typeof g_hotKeys[event.code].param1 != "undefined") + { var param2 = null; - if (typeof g_hotKeys[event.code].param2 != "undefined") { + if (typeof g_hotKeys[event.code].param2 != "undefined") + { if (typeof event[g_hotKeys[event.code].param2] != "undefined") - param2 = event[g_hotKeys[event.code].param2]; + { param2 = event[g_hotKeys[event.code].param2]; } } g_hotKeys[event.code].func(g_hotKeys[event.code].param1, param2); - } else { + } + else + { if (event.ctrlKey == false) g_hotKeys[event.code].func(); } - } else if (event.key in g_hotKeys) { - if (typeof g_hotKeys[event.key].param1 != "undefined") { + } + else if (event.key in g_hotKeys) + { + if (typeof g_hotKeys[event.key].param1 != "undefined") + { var param2 = null; - if (typeof g_hotKeys[event.key].param2 != "undefined") { + if (typeof g_hotKeys[event.key].param2 != "undefined") + { if (typeof event[g_hotKeys[event.key].param2] != "undefined") - param2 = event[g_hotKeys[event.key].param2]; + { param2 = event[g_hotKeys[event.key].param2]; } } g_hotKeys[event.key].func(g_hotKeys[event.key].param1, param2); - } else { + } + else + { if (event.ctrlKey == false) g_hotKeys[event.key].func(); } } } } -function clearTempGrids() { - g_layerSources["temp"].clear(); +function clearTempGrids() +{ + g_layerSources.temp.clear(); g_tempGrids = Array(); } var g_currentShapes = {}; -function clearCurrentShapes() { - g_layerSources["award"].clear(); +function clearCurrentShapes() +{ + g_layerSources.award.clear(); g_currentShapes = {}; } -function mapMemory(x, save, exit = false) { - if (save == true) { +function mapMemory(x, save, exit = false) +{ + if (save == true) + { g_mapMemory[x].LoLa = g_mapView.getCenter(); g_mapMemory[x].zoom = g_mapView.getZoom(); localStorage.mapMemory = JSON.stringify(g_mapMemory); - if (exit == false) { + if (exit == false) + { playAlertMediaFile("Clicky-3.mp3"); } - } else { - if (g_mapMemory[x].zoom != -1) { + } + else + { + if (g_mapMemory[x].zoom != -1) + { g_mapView.setCenter(g_mapMemory[x].LoLa); g_mapView.setZoom(g_mapMemory[x].zoom); } @@ -2374,14 +2712,16 @@ function mapMemory(x, save, exit = false) { var g_hotKeys = {}; -function registerHotKey(key, func, param1, param2) { +function registerHotKey(key, func, param1, param2) +{ g_hotKeys[key] = {}; g_hotKeys[key].func = func; g_hotKeys[key].param1 = param1; g_hotKeys[key].param2 = param2; } -function registerHotKeys() { +function registerHotKeys() +{ registerHotKey("1", setTrophyOverlay, 0); registerHotKey("2", setTrophyOverlay, 1); registerHotKey("3", setTrophyOverlay, 2); @@ -2402,7 +2742,7 @@ function registerHotKeys() { registerHotKey("KeyG", toggleGtMap); registerHotKey("KeyH", toggleHeatSpots); registerHotKey("KeyI", showRootInfoBox); - //registerHotKey("KeyJ", setTrophyOverlay, 8); + // registerHotKey("KeyJ", setTrophyOverlay, 8); registerHotKey("KeyK", makeScreenshots); registerHotKey("KeyL", adifLoadDialog); registerHotKey("KeyM", toggleAlertMute); @@ -2433,85 +2773,103 @@ function registerHotKeys() { registerHotKey("Equal", cycleTrophyOverlay); } -function toggleMoon() { +function toggleMoon() +{ g_appSettings.moonTrack ^= 1; - if (g_appSettings.moonTrack == 1) { + if (g_appSettings.moonTrack == 1) + { moonLayer.show(); - } else { + } + else + { moonLayer.hide(); } } -function toggleMoonTrack() { +function toggleMoonTrack() +{ g_appSettings.moonPath ^= 1; moonLayer.refresh(); } -function toggleFullscreen() { - if (document.fullscreenElement == null) { +function toggleFullscreen() +{ + if (document.fullscreenElement == null) + { mainBody.requestFullscreen(); - } else { + } + else + { document.exitFullscreen(); } } -function toggleMenu() { +function toggleMenu() +{ if (g_menuShowing == false) collapseMenu(false); else collapseMenu(true); } g_helpShow = false; -function toggleHelp() { +function toggleHelp() +{ g_helpShow = !g_helpShow; - if (g_helpShow == true) { + if (g_helpShow == true) + { helpDiv.style.display = "block"; - } else helpDiv.style.display = "none"; + } + else helpDiv.style.display = "none"; } function onMyKeyUp(event) {} var g_currentOverlay = 0; -function cycleTrophyOverlay() { +function cycleTrophyOverlay() +{ g_currentOverlay++; g_currentOverlay %= 8; setTrophyOverlay(g_currentOverlay); } -function didWork(testObj) { +function didWork(testObj) +{ return testObj.worked; } -function didConfirm(testObj) { +function didConfirm(testObj) +{ return testObj.confirmed; } -function makeTitleInfo(mapWindow) { +function makeTitleInfo(mapWindow) +{ var band = g_appSettings.gtBandFilter.length == 0 ? "Mixed" : g_appSettings.gtBandFilter == "auto" - ? myBand - : g_appSettings.gtBandFilter; + ? myBand + : g_appSettings.gtBandFilter; var mode = g_appSettings.gtModeFilter.length == 0 ? "Mixed" : g_appSettings.gtModeFilter == "auto" - ? myMode - : g_appSettings.gtModeFilter; + ? myMode + : g_appSettings.gtModeFilter; var space = " "; var news = "GridTracker [Band: " + band + " Mode: " + mode; var end = "]"; - if (mapWindow) { + if (mapWindow) + { news += " Layer: " + g_viewInfo[g_currentOverlay][1]; } if (g_currentOverlay == 0 && g_appSettings.gridViewMode == 1) - return news + end; + { return news + end; } var workline = " - Worked " + @@ -2522,14 +2880,17 @@ function makeTitleInfo(mapWindow) { g_viewInfo[g_currentOverlay][2] <= g_viewInfo[g_currentOverlay][4] && g_viewInfo[g_currentOverlay][4] > 0 ) + { end = " Needed " + (g_viewInfo[g_currentOverlay][4] - g_viewInfo[g_currentOverlay][2]) + "]"; + } return news + workline + end; } -function setTrophyOverlay(which) { +function setTrophyOverlay(which) +{ g_currentOverlay = which; window.document.title = makeTitleInfo(true); trophyImg.src = g_trophyImageArray[which]; @@ -2538,75 +2899,102 @@ function setTrophyOverlay(which) { // set the scope of key var key = 0; - if (which == 0) { - for (key in g_layerVectors) { + if (which == 0) + { + for (key in g_layerVectors) + { g_layerVectors[key].setVisible(true); } if ( g_appSettings.gtFlagImgSrc > 0 && g_appSettings.gtShareEnable == true && g_mapSettings.offlineMode == false - ) { - g_layerVectors["gtflags"].setVisible(true); - } else { - g_layerVectors["gtflags"].setVisible(false); + ) + { + g_layerVectors.gtflags.setVisible(true); } - g_layerVectors["award"].setVisible(false); - if (g_showAllGrids == false) { + else + { + g_layerVectors.gtflags.setVisible(false); + } + g_layerVectors.award.setVisible(false); + if (g_showAllGrids == false) + { g_layerVectors["line-grids"].setVisible(false); g_layerVectors["big-grids"].setVisible(false); g_layerVectors["short-grids"].setVisible(false); g_layerVectors["long-grids"].setVisible(false); } - if (g_timezoneLayer) { - if (g_timezonesEnable == 1) { + if (g_timezoneLayer) + { + if (g_timezonesEnable == 1) + { g_timezoneLayer.setVisible(true); - } else { + } + else + { g_timezoneLayer.setVisible(false); } } - } else { - if (g_mapSettings.mergeOverlay == false) { - for (key in g_layerVectors) { + } + else + { + if (g_mapSettings.mergeOverlay == false) + { + for (key in g_layerVectors) + { g_layerVectors[key].setVisible(false); } - } else { - for (key in g_layerVectors) { + } + else + { + for (key in g_layerVectors) + { g_layerVectors[key].setVisible(true); } if ( g_appSettings.gtFlagImgSrc > 0 && g_appSettings.gtShareEnable == true && g_mapSettings.offlineMode == false - ) { - g_layerVectors["gtflags"].setVisible(true); - } else { - g_layerVectors["gtflags"].setVisible(false); + ) + { + g_layerVectors.gtflags.setVisible(true); } - if (g_showAllGrids == false) { + else + { + g_layerVectors.gtflags.setVisible(false); + } + if (g_showAllGrids == false) + { g_layerVectors["line-grids"].setVisible(false); g_layerVectors["big-grids"].setVisible(false); g_layerVectors["short-grids"].setVisible(false); g_layerVectors["long-grids"].setVisible(false); } } - g_layerVectors["award"].setVisible(true); - if (g_timezoneLayer) { + g_layerVectors.award.setVisible(true); + if (g_timezoneLayer) + { g_timezoneLayer.setVisible(false); } mapLoseFocus(); } - g_layerVectors["strikes"].setVisible(true); + g_layerVectors.strikes.setVisible(true); - if (which == 1) { - for (key in g_cqZones) { + if (which == 1) + { + for (key in g_cqZones) + { var boxColor = "#FF000015"; var borderColor = "#005500FF"; var borderWeight = 1; - if (didConfirm(g_cqZones[key])) { + if (didConfirm(g_cqZones[key])) + { boxColor = "#00FF0066"; - } else if (didWork(g_cqZones[key])) { + } + else if (didWork(g_cqZones[key])) + { boxColor = "#FFFF0066"; } @@ -2618,18 +3006,23 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[key]); + g_layerSources.award.addFeature(g_currentShapes[key]); } } - if (which == 2) { - for (key in g_ituZones) { + if (which == 2) + { + for (key in g_ituZones) + { var boxColor = "#FF000015"; var borderColor = "#800080FF"; var borderWeight = 1; - if (didConfirm(g_ituZones[key])) { + if (didConfirm(g_ituZones[key])) + { boxColor = "#00FF0066"; borderWeight = 1; - } else if (didWork(g_ituZones[key])) { + } + else if (didWork(g_ituZones[key])) + { boxColor = "#FFFF0066"; borderWeight = 1; } @@ -2642,18 +3035,23 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[key]); + g_layerSources.award.addFeature(g_currentShapes[key]); } } - if (which == 3) { - for (key in g_wacZones) { + if (which == 3) + { + for (key in g_wacZones) + { var boxColor = "#FF000015"; var borderColor = "#006666FF"; var borderWeight = 1; var originalKey = key; - if (didConfirm(g_wacZones[key])) { + if (didConfirm(g_wacZones[key])) + { boxColor = "#00FF0066"; - } else if (didWork(g_wacZones[key])) { + } + else if (didWork(g_wacZones[key])) + { boxColor = "#FFFF0066"; } @@ -2665,17 +3063,22 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[originalKey]); + g_layerSources.award.addFeature(g_currentShapes[originalKey]); } } - if (which == 4) { - for (key in g_wasZones) { + if (which == 4) + { + for (key in g_wasZones) + { var boxColor = "#FF000020"; var borderColor = "#0000FFFF"; var borderWeight = 1; - if (didConfirm(g_wasZones[key])) { + if (didConfirm(g_wasZones[key])) + { boxColor = "#00FF0066"; - } else if (didWork(g_wasZones[key])) { + } + else if (didWork(g_wasZones[key])) + { boxColor = "#FFFF0066"; } @@ -2687,21 +3090,27 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[key]); + g_layerSources.award.addFeature(g_currentShapes[key]); } } - if (which == 5) { - for (key in g_worldGeoData) { + if (which == 5) + { + for (key in g_worldGeoData) + { var boxColor = "#FF000015"; var borderColor = "#0000FFFF"; var borderWeight = 1; - if (didConfirm(g_worldGeoData[key])) { + if (didConfirm(g_worldGeoData[key])) + { boxColor = "#00FF0066"; - } else if (didWork(g_worldGeoData[key])) { + } + else if (didWork(g_worldGeoData[key])) + { boxColor = "#FFFF0066"; } - if (g_worldGeoData[key].geo != "deleted") { + if (g_worldGeoData[key].geo != "deleted") + { g_currentShapes[key] = shapeFeature( key, g_worldGeoData[key].geo, @@ -2710,19 +3119,24 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[key]); + g_layerSources.award.addFeature(g_currentShapes[key]); } } } - if (which == 6) { - for (key in g_countyData) { + if (which == 6) + { + for (key in g_countyData) + { var boxColor = "#00000000"; var borderColor = "#0000FFFF"; var borderWeight = 0.1; - if (didConfirm(g_countyData[key])) { + if (didConfirm(g_countyData[key])) + { boxColor = "#00FF0066"; borderWeight = 1; - } else if (didWork(g_countyData[key])) { + } + else if (didWork(g_countyData[key])) + { boxColor = "#FFFF0066"; borderWeight = 1; } @@ -2735,24 +3149,29 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[key]); + g_layerSources.award.addFeature(g_currentShapes[key]); } } - if (which == 7) { - for (key in g_us48Data) { + if (which == 7) + { + for (key in g_us48Data) + { var LL = squareToLatLong(key); var bounds = [ [LL.lo1, LL.la1], - [LL.lo2, LL.la2], + [LL.lo2, LL.la2] ]; var boxColor = "#FF000015"; var borderColor = "#0000FFFF"; var borderWeight = 0.1; - if (g_us48Data[key].confirmed) { + if (g_us48Data[key].confirmed) + { boxColor = "#00FF0066"; borderWeight = 0.2; - } else if (g_us48Data[key].worked) { + } + else if (g_us48Data[key].worked) + { boxColor = "#FFFF0066"; borderWeight = 0.2; } @@ -2765,7 +3184,7 @@ function setTrophyOverlay(which) { borderColor, borderWeight ); - g_layerSources["award"].addFeature(g_currentShapes[key]); + g_layerSources.award.addFeature(g_currentShapes[key]); } } @@ -2779,15 +3198,16 @@ function gridFeature( fillColor, borderColor, borderWidth -) { +) +{ var style = new ol.style.Style({ stroke: new ol.style.Stroke({ color: borderColor, - width: borderWidth, + width: borderWidth }), fill: new ol.style.Fill({ - color: fillColor, - }), + color: fillColor + }) }); objectData.setStyle(style); @@ -2799,7 +3219,8 @@ function gridFeature( var g_lastMoon = null; -function moonOver(feature) { +function moonOver(feature) +{ var data = subLunar(timeNowSec()); var object = doRAconvert(g_myLon, g_myLat, data.RA, data.Dec); @@ -2824,7 +3245,8 @@ function moonOver(feature) { myMoonTooltip.innerHTML = worker; - if (g_lastMoon) { + if (g_lastMoon) + { moonMove(); return; } @@ -2837,12 +3259,14 @@ function moonOver(feature) { myMoonTooltip.style.display = "block"; } -function moonOut() { +function moonOut() +{ g_lastMoon = null; myMoonTooltip.style.zIndex = -1; } -function moonMove() { +function moonMove() +{ var positionInfo = myMoonTooltip.getBoundingClientRect(); myMoonTooltip.style.left = getMouseX() - positionInfo.width / 2 + "px"; myMoonTooltip.style.top = getMouseY() + 22 + "px"; @@ -2850,8 +3274,10 @@ function moonMove() { var g_lastTrophy = null; -function trophyOver(feature) { - if (g_lastTrophy && g_lastTrophy == feature) { +function trophyOver(feature) +{ + if (g_lastTrophy && g_lastTrophy == feature) + { trophyMove(); return; } @@ -2864,26 +3290,31 @@ function trophyOver(feature) { var zone = null; var key = feature.get("prop"); - if (key == "cqzone") { + if (key == "cqzone") + { trophy = "CQ Zone"; infoObject = g_cqZones[name]; zone = name; name = g_cqZones[name].name; } - if (key == "ituzone") { + if (key == "ituzone") + { trophy = "ITU Zone"; infoObject = g_ituZones[name]; } - if (key == "wac" && name in g_wacZones) { + if (key == "wac" && name in g_wacZones) + { trophy = "Continent"; infoObject = g_wacZones[name]; } - if (key == "was" && name in g_wasZones) { + if (key == "was" && name in g_wasZones) + { trophy = "US State"; infoObject = g_wasZones[name]; } - if (key == "dxcc" && name in g_worldGeoData) { + if (key == "dxcc" && name in g_worldGeoData) + { trophy = "DXCC"; var ref = name; infoObject = g_worldGeoData[ref]; @@ -2893,26 +3324,33 @@ function trophyOver(feature) { g_worldGeoData[ref].pp + ")"; } - if (key == "usc") { + if (key == "usc") + { trophy = "US County"; infoObject = g_countyData[name]; name = infoObject.geo.properties.n + ", " + infoObject.geo.properties.st; } - if (key == "us48") { + if (key == "us48") + { trophy = "US Continental Grids"; infoObject = g_us48Data[feature.get("grid")]; name = feature.get("grid"); - if (name in g_gridToState) { + if (name in g_gridToState) + { zone = ""; - for (var x = 0; x < g_gridToDXCC[name].length; x++) { - if (name in g_gridToState) { - for (var y = 0; y < g_gridToState[name].length; y++) { + for (var x = 0; x < g_gridToDXCC[name].length; x++) + { + if (name in g_gridToState) + { + for (var y = 0; y < g_gridToState[name].length; y++) + { if ( g_gridToDXCC[name][x] == g_StateData[g_gridToState[name][y]].dxcc && g_gridToDXCC[name][x] == 291 - ) { + ) + { zone += g_StateData[g_gridToState[name][y]].name + ", "; } } @@ -2931,20 +3369,24 @@ function trophyOver(feature) { ""; if (zone) + { worker += " " + zone + ""; + } var wc1Table = ""; - if (infoObject.worked) { + if (infoObject.worked) + { wc1Table = ""; wc1Table += ""; wc1Table += ""; wc1Table += "
Worked
Band"; var keys = Object.keys(infoObject.worked_bands).sort(); - for (key in keys) { + for (key in keys) + { wc1Table += ""; wc1Table += ""; } var wcTable = ""; - if (infoObject.confirmed) { + if (infoObject.confirmed) + { wcTable = "
" + keys[key] + @@ -2959,7 +3401,8 @@ function trophyOver(feature) { wc1Table += "Mode"; keys = Object.keys(infoObject.worked_modes).sort(); - for (key in keys) { + for (key in keys) + { wc1Table += "
" + keys[key] + @@ -2974,14 +3417,16 @@ function trophyOver(feature) { wc1Table += "
"; wcTable += ""; wcTable += ""; wcTable += "
Confirmed
Band"; var keys = Object.keys(infoObject.confirmed_bands).sort(); - for (key in keys) { + for (key in keys) + { wcTable += ""; wcTable += ""; } if (!infoObject.worked && !infoObject.confirmed) + { worker += ""; - else { + } + else + { worker += "" + wc1Table + wcTable + ""; } @@ -3029,12 +3478,14 @@ function trophyOver(feature) { myTrophyTooltip.style.display = "block"; } -function trophyOut() { +function trophyOut() +{ g_lastTrophy = null; myTrophyTooltip.style.zIndex = -1; } -function trophyMove() { +function trophyMove() +{ var positionInfo = myTrophyTooltip.getBoundingClientRect(); myTrophyTooltip.style.left = getMouseX() - positionInfo.width / 2 + "px"; myTrophyTooltip.style.top = getMouseY() - positionInfo.height - 22 + "px"; @@ -3043,7 +3494,8 @@ function trophyMove() { var g_MyCurrentGrid = ""; var g_MyGridIsUp = false; -function mouseDownGrid(longlat, event) { +function mouseDownGrid(longlat, event) +{ var grid = ""; grid = latLonToGridSquare(longlat[1], longlat[0]); g_MyCurrentGrid = grid.substr(0, 4); @@ -3075,11 +3527,13 @@ function mouseDownGrid(longlat, event) { "
" + keys[key] + @@ -2996,7 +3441,8 @@ function trophyOver(feature) { wcTable += "Mode"; keys = Object.keys(infoObject.confirmed_modes).sort(); - for (key in keys) { + for (key in keys) + { wcTable += "
" + keys[key] + @@ -3010,9 +3456,12 @@ function trophyOver(feature) { wcTable += "
Needed
Long" + longlat[0].toFixed(3) + "
"; - if (grid in g_gridToDXCC) { + if (grid in g_gridToDXCC) + { worker += ""; worker += ""; - for (var x = 0; x < g_gridToDXCC[grid].length; x++) { + for (var x = 0; x < g_gridToDXCC[grid].length; x++) + { worker += ""; } - if (grid in g_gridToState) { + if (grid in g_gridToState) + { worker += ""; - for (var x = 0; x < g_gridToDXCC[grid].length; x++) { + for (var x = 0; x < g_gridToDXCC[grid].length; x++) + { worker += ""; Object.keys(List) .sort() - .forEach(function (key, i) { + .forEach(function (key, i) + { worker += ""; worker += "
" + g_dxccToAltName[g_gridToDXCC[grid][x]] + @@ -3087,15 +3541,20 @@ function mouseDownGrid(longlat, event) { g_worldGeoData[g_dxccToGeoData[g_gridToDXCC[grid][x]]].pp + ")
"; - if (grid in g_gridToState) { - for (var y = 0; y < g_gridToState[grid].length; y++) { + if (grid in g_gridToState) + { + for (var y = 0; y < g_gridToState[grid].length; y++) + { if ( g_gridToDXCC[grid][x] == g_StateData[g_gridToState[grid][y]].dxcc - ) { + ) + { worker += g_StateData[g_gridToState[grid][y]].name + "
"; } } @@ -3120,31 +3579,35 @@ function mouseDownGrid(longlat, event) { g_MyGridIsUp = true; } -function mouseMoveGrid() { - if (g_MyGridIsUp == true) { +function mouseMoveGrid() +{ + if (g_MyGridIsUp == true) + { var positionInfo = myGridTooltip.getBoundingClientRect(); myGridTooltip.style.left = getMouseX() - positionInfo.width / 2 + "px"; myGridTooltip.style.top = getMouseY() - positionInfo.height - 22 + "px"; } } -function mouseUpGrid() { +function mouseUpGrid() +{ g_MyGridIsUp = false; myGridTooltip.style.zIndex = -1; - if (g_tempGridBox) { - if (g_layerSources["temp"].hasFeature(g_tempGridBox)) - g_layerSources["temp"].removeFeature(g_tempGridBox); + if (g_tempGridBox) + { + if (g_layerSources.temp.hasFeature(g_tempGridBox)) + { g_layerSources.temp.removeFeature(g_tempGridBox); } } - delete g_tempGridBox; - g_tempGridBox = null; } var g_lastGtFlag = null; -function mouseOverGtFlag(feature) { - if (g_lastGtFlag && g_lastGtFlag == feature) { +function mouseOverGtFlag(feature) +{ + if (g_lastGtFlag && g_lastGtFlag == feature) + { gtFlagMove(); return; } @@ -3159,35 +3622,38 @@ function mouseOverGtFlag(feature) { myFlagtip.style.zIndex = 499; myFlagtip.style.display = "block"; - if (feature.size == 73 && feature != g_lasttimezone) { - if (g_lasttimezone != null) { + if (feature.size == 73 && feature != g_lasttimezone) + { + if (g_lasttimezone != null) + { g_lasttimezone.setStyle(null); } var style = new ol.style.Style({ fill: new ol.style.Fill({ - color: "#FFFF0088", - }), + color: "#FFFF0088" + }) }); feature.setStyle(style); g_lasttimezone = feature; } - - return; } -function mouseOutGtFlag(mouseEvent) { +function mouseOutGtFlag(mouseEvent) +{ g_lastGtFlag = null; myFlagtip.style.zIndex = -1; - if (g_lasttimezone != null) { + if (g_lasttimezone != null) + { g_lasttimezone.setStyle(null); g_lasttimezone = null; } } -function gtFlagMove() { +function gtFlagMove() +{ var positionInfo = myFlagtip.getBoundingClientRect(); myFlagtip.style.left = getMouseX() + 15 + "px"; myFlagtip.style.top = getMouseY() - positionInfo.height - 5 + "px"; @@ -3195,9 +3661,11 @@ function gtFlagMove() { var g_lastDataGridUp = null; -function mouseOverDataItem(mouseEvent, fromHover) { +function mouseOverDataItem(mouseEvent, fromHover) +{ if (g_MyGridIsUp) return; - if (g_lastDataGridUp && g_lastDataGridUp == mouseEvent) { + if (g_lastDataGridUp && g_lastDataGridUp == mouseEvent) + { mouseMoveDataItem(mouseEvent); return; } @@ -3221,18 +3689,21 @@ function mouseOverDataItem(mouseEvent, fromHover) { typeof mouseEvent.spot != "undefined" && g_receptionReports.spots[mouseEvent.spot].bearing > 180 ) - noRoomRight = true; + { noRoomRight = true; } myTooltip.style.left = getMouseX() + 15 + "px"; top = parseInt(getMouseY() - 20 - (callListLength / 2) * 25); - if (windowWidth - getMouseX() < positionInfo.width || noRoomRight == true) { + if (windowWidth - getMouseX() < positionInfo.width || noRoomRight == true) + { myTooltip.style.left = getMouseX() - (10 + positionInfo.width) + "px"; top = parseInt(getMouseY() - 20 - (callListLength / 2) * 25); noRoomRight = true; } - if (getMouseX() - positionInfo.width < 0) { + if (getMouseX() - positionInfo.width < 0) + { noRoomLeft = true; } - if (noRoomLeft == true && noRoomRight == true) { + if (noRoomLeft == true && noRoomRight == true) + { myTooltip.style.left = getMouseX() - positionInfo.width / 2 + "px"; top = getMouseY() + 30; } @@ -3242,7 +3713,8 @@ function mouseOverDataItem(mouseEvent, fromHover) { myTooltip.style.display = "block"; } -function mouseMoveDataItem(mouseEvent) { +function mouseMoveDataItem(mouseEvent) +{ var myTooltip = document.getElementById("myTooltip"); var positionInfo = myTooltip.getBoundingClientRect(); var windowWidth = window.innerWidth; @@ -3253,19 +3725,22 @@ function mouseMoveDataItem(mouseEvent) { typeof mouseEvent.spot != "undefined" && g_receptionReports.spots[mouseEvent.spot].bearing > 180 ) - noRoomRight = true; + { noRoomRight = true; } myTooltip.style.left = getMouseX() + 15 + "px"; top = Number(myTooltip.style.top); if (top > 20) top = getMouseY() - 20 + "px"; - if (windowWidth - getMouseX() < positionInfo.width || noRoomRight == true) { + if (windowWidth - getMouseX() < positionInfo.width || noRoomRight == true) + { myTooltip.style.left = getMouseX() - (10 + positionInfo.width) + "px"; if (top > 20) top = getMouseY() - 20 + "px"; noRoomRight = true; } - if (getMouseX() - positionInfo.width < 0) { + if (getMouseX() - positionInfo.width < 0) + { noRoomLeft = true; } - if (noRoomLeft == true && noRoomRight == true) { + if (noRoomLeft == true && noRoomRight == true) + { myTooltip.style.left = getMouseX() - positionInfo.width / 2 + "px"; top = getMouseY() + 30; } @@ -3273,7 +3748,8 @@ function mouseMoveDataItem(mouseEvent) { myTooltip.style.top = top + "px"; } -function mouseOutOfDataItem(mouseEvent) { +function mouseOutOfDataItem(mouseEvent) +{ var myTooltip = document.getElementById("myTooltip"); myTooltip.style.zIndex = -1; g_lastDataGridUp = null; @@ -3281,15 +3757,20 @@ function mouseOutOfDataItem(mouseEvent) { if (g_spotsEnabled == 1) g_layerSources["psk-hop"].clear(); } -function reloadInfo(bandOrMode) { - if (g_statsWindowHandle != null) { - try { +function reloadInfo(bandOrMode) +{ + if (g_statsWindowHandle != null) + { + try + { g_statsWindowHandle.window.reloadInfo(); - } catch (e) {} + } + catch (e) {} } } -function twoWideToLatLong(qth) { +function twoWideToLatLong(qth) +{ qth = qth.toUpperCase(); var a = qth.charCodeAt(0) - 65; var b = qth.charCodeAt(1) - 65; @@ -3311,7 +3792,8 @@ function twoWideToLatLong(qth) { return LatLong; } -function squareToLatLongAll(qth) { +function squareToLatLongAll(qth) +{ qth = qth.toUpperCase(); var a = qth.charCodeAt(0) - 65; var b = qth.charCodeAt(1) - 65; @@ -3322,11 +3804,14 @@ function squareToLatLongAll(qth) { var la2; var lo2; var LatLong = []; - if (qth.length == 4) { + if (qth.length == 4) + { la2 = la1 + 1; lo2 = lo1 + 2; LatLong.size = 4; - } else { + } + else + { var lo3; var la3; var e = qth.charCodeAt(4) - 65; @@ -3353,7 +3838,8 @@ function squareToLatLongAll(qth) { return LatLong; } -function squareToLatLong(qth) { +function squareToLatLong(qth) +{ qth = qth.toUpperCase(); var a = qth.charCodeAt(0) - 65; var b = qth.charCodeAt(1) - 65; @@ -3364,11 +3850,14 @@ function squareToLatLong(qth) { var la2; var lo2; var LatLong = []; - if (qth.length == 4 || g_appSettings.sixWideMode == 0) { + if (qth.length == 4 || g_appSettings.sixWideMode == 0) + { la2 = la1 + 1; lo2 = lo1 + 2; LatLong.size = 4; - } else { + } + else + { var lo3; var la3; var e = qth.charCodeAt(4) - 65; @@ -3394,15 +3883,16 @@ function squareToLatLong(qth) { return LatLong; } -function iconFeature(center, iconObj, zIndex) { +function iconFeature(center, iconObj, zIndex) +{ var feature = new ol.Feature({ geometry: new ol.geom.Point(center), - name: "pin", + name: "pin" }); var iconStyle = new ol.style.Style({ zIndex: zIndex, - image: iconObj, + image: iconObj }); feature.setStyle(iconStyle); @@ -3420,7 +3910,8 @@ function qthToQsoBox( confirmed, band, wspr -) { +) +{ if (g_appSettings.gridViewMode == 1) return null; var borderColor = "#222288FF"; @@ -3429,39 +3920,50 @@ function qthToQsoBox( var myDEzOffset = 10; var myDEbox = false; - if (worked) { + if (worked) + { boxColor = "#FFFF00" + g_gridAlpha; borderColor = g_qsoWorkedBorderColor; } - if (confirmed) { + if (confirmed) + { boxColor = "#FF0000" + g_gridAlpha; borderColor = g_qsoWorkedBorderColor; } - if (wspr != null) { + if (wspr != null) + { boxColor = "hsl(" + wspr + ",100%,50%)"; borderColor = "gray"; } var zIndex = 2; - var entityVisibility = Number(g_appSettings.gridViewMode) > 1 ? true : false; + var entityVisibility = Number(g_appSettings.gridViewMode) > 1; var returnRectangle = null; if (g_appSettings.sixWideMode == 0) iQTH = iQTH.substr(0, 4); else iQTH = iQTH.substr(0, 6); var rect = null; - if (iQTH == "") { - for (var key in g_qsoGrids) { - if (iHash in g_qsoGrids[key].rectangle.hashes) { + if (iQTH == "") + { + for (var key in g_qsoGrids) + { + if (iHash in g_qsoGrids[key].rectangle.hashes) + { rect = g_qsoGrids[key]; break; } } - } else { - if (iQTH in g_qsoGrids) { + } + else + { + if (iQTH in g_qsoGrids) + { rect = g_qsoGrids[iQTH]; } } - if (rect == null) { - if (iQTH != "") { + if (rect == null) + { + if (iQTH != "") + { // Valid QTH var triangleView = false; if ( @@ -3469,16 +3971,21 @@ function qthToQsoBox( iQTH in g_liveGrids && entityVisibility == true && g_pushPinMode == false - ) { - if (confirmed) { + ) + { + if (confirmed) + { hideLiveGrid(iQTH); - } else { + } + else + { liveTriangleGrid(iQTH); triangleView = true; } } LL = squareToLatLong(iQTH); - if (LL.size == 6) { + if (LL.size == 6) + { borderColor = "#000000FF"; zIndex = 50; } @@ -3488,7 +3995,7 @@ function qthToQsoBox( var bounds = [ [LL.lo1, LL.la1], - [LL.lo2, LL.la2], + [LL.lo2, LL.la2] ]; if (triangleView == true) newRect.rectangle = triangle(bounds, true); else newRect.rectangle = rectangle(bounds); @@ -3497,21 +4004,21 @@ function qthToQsoBox( const featureHoverStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: boxColor, + color: boxColor }), stroke: new ol.style.Stroke({ color: borderColor, width: borderWeight, - lineJoin: "round", + lineJoin: "round" }), - zIndex: zIndex, + zIndex: zIndex }); newRect.rectangle.setStyle(featureHoverStyle); newRect.rectangle.qth = iQTH; if (g_pushPinMode == false && entityVisibility == true) - g_layerSources["qso"].addFeature(newRect.rectangle); + { g_layerSources.qso.addFeature(newRect.rectangle); } var newPin = g_colorLeafletQPins.worked[band]; if (confirmed) newPin = g_colorLeafletQPins.confirmed[band]; @@ -3527,7 +4034,7 @@ function qthToQsoBox( newRect.rectangle.pin.size = LL.size; if (g_pushPinMode && entityVisibility == true) - g_layerSources["qso-pins"].addFeature(newRect.rectangle.pin); + { g_layerSources["qso-pins"].addFeature(newRect.rectangle.pin); } newRect.rectangle.locked = locked; newRect.rectangle.worked = worked; @@ -3541,22 +4048,27 @@ function qthToQsoBox( g_qsoGrids[iQTH] = newRect; returnRectangle = newRect.rectangle; } - } else { - if (!(iHash in rect.rectangle.hashes)) { + } + else + { + if (!(iHash in rect.rectangle.hashes)) + { rect.rectangle.hashes[iHash] = 1; rect.rectangle.pin.hashes[iHash] = 1; } - if (!confirmed && rect.rectangle.confirmed) { + if (!confirmed && rect.rectangle.confirmed) + { return rect.rectangle; } if (worked && !rect.rectangle.worked) rect.rectangle.worked = worked; if (confirmed && !rect.rectangle.confirmed) - rect.rectangle.confirmed = confirmed; + { rect.rectangle.confirmed = confirmed; } borderColor = g_qsoWorkedBorderColor; if (myDEbox) borderWeight = 1; zIndex = 2; - if (rect.rectangle.size == 6) { + if (rect.rectangle.size == 6) + { borderColor = "#000000FF"; zIndex = 50; } @@ -3564,14 +4076,14 @@ function qthToQsoBox( const featureHoverStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: boxColor, + color: boxColor }), stroke: new ol.style.Stroke({ color: borderColor, width: borderWeight, - lineJoin: "round", + lineJoin: "round" }), - zIndex: zIndex, + zIndex: zIndex }); rect.rectangle.setStyle(featureHoverStyle); returnRectangle = rect.rectangle; @@ -3579,7 +4091,8 @@ function qthToQsoBox( return returnRectangle; } -function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { +function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) +{ if (g_appSettings.gridViewMode == 2) return null; var borderColor = "#222288FF"; @@ -3588,54 +4101,69 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { var myDEzOffset = 0; var myDEbox = false; - if (iCQ && iNew) { + if (iCQ && iNew) + { borderColor = "#008888FF"; boxColor = "#00FF00" + g_gridAlpha; - } else if (iCQ && !iNew) { + } + else if (iCQ && !iNew) + { borderColor = "#FFFF00FF"; boxColor = "#FFFF00" + g_gridAlpha; } - if (DE == myDEcall) { + if (DE == myDEcall) + { borderColor = "#FF0000FF"; boxColor = "#FFFF00" + g_gridAlpha; borderWeight = 1.0; myDEzOffset = 20; myDEbox = true; } - if (DE.indexOf("CQ DX") > -1) { + if (DE.indexOf("CQ DX") > -1) + { borderColor = "#008888FF"; boxColor = "#00FFFF" + g_gridAlpha; } - if (locked) { + if (locked) + { boxColor = "#FFA500" + g_gridAlpha; borderColor = "#000000FF"; borderOpacity = 1; } - if (wspr != null) { + if (wspr != null) + { boxColor = "hsl(" + wspr + ",100%,50%)"; borderColor = "gray"; - //borderWeight = 1; + // borderWeight = 1; } var zIndex = 2; var returnRectangle = null; if (g_appSettings.sixWideMode == 0) iQTH = iQTH.substr(0, 4); else iQTH = iQTH.substr(0, 6); var rect = null; - if (iQTH == "") { - for (var key in g_liveGrids) { - if (hash in g_liveGrids[key].rectangle.liveHash) { + if (iQTH == "") + { + for (var key in g_liveGrids) + { + if (hash in g_liveGrids[key].rectangle.liveHash) + { rect = g_liveGrids[key]; break; } } - } else { - if (iQTH in g_liveGrids) { + } + else + { + if (iQTH in g_liveGrids) + { rect = g_liveGrids[iQTH]; } } - if (rect == null) { - if (iQTH != "") { + if (rect == null) + { + if (iQTH != "") + { // Valid QTH var entityVisibility = true; var triangleView = false; @@ -3643,20 +4171,24 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { Number(g_appSettings.gridViewMode) == 3 && iQTH in g_qsoGrids && g_pushPinMode == false - ) { + ) + { if ( g_mapSettings.splitQSL || g_qsoGrids[iQTH].rectangle.confirmed == false - ) { + ) + { qsoTriangleGrid(iQTH); triangleView = true; entityVisibility = true; - } else entityVisibility = false; + } + else entityVisibility = false; } LL = squareToLatLong(iQTH); - if (LL.size == 6) { + if (LL.size == 6) + { borderColor = "#000000FF"; - //borderWeight = 1.0; + // borderWeight = 1.0; zIndex = 50; } newRect = {}; @@ -3666,7 +4198,7 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { var bounds = [ [LL.lo1, LL.la1], - [LL.lo2, LL.la2], + [LL.lo2, LL.la2] ]; if (triangleView == true) newRect.rectangle = triangle(bounds, false); else newRect.rectangle = rectangle(bounds); @@ -3676,21 +4208,22 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { const featureHoverStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: boxColor, + color: boxColor }), stroke: new ol.style.Stroke({ color: borderColor, width: borderWeight, - lineJoin: "round", + lineJoin: "round" }), - zIndex: zIndex, + zIndex: zIndex }); newRect.rectangle.setStyle(featureHoverStyle); newRect.rectangle.qth = iQTH; - if (g_pushPinMode == false && entityVisibility) { - g_layerSources["live"].addFeature(newRect.rectangle); + if (g_pushPinMode == false && entityVisibility) + { + g_layerSources.live.addFeature(newRect.rectangle); } newRect.rectangle.pin = iconFeature( @@ -3704,7 +4237,7 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { newRect.rectangle.pin.size = LL.size; if (g_pushPinMode && entityVisibility == true) - g_layerSources["live-pins"].addFeature(newRect.rectangle.pin); + { g_layerSources["live-pins"].addFeature(newRect.rectangle.pin); } newRect.rectangle.locked = locked; newRect.rectangle.size = LL.size; @@ -3716,20 +4249,25 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { g_liveGrids[iQTH] = newRect; returnRectangle = newRect.rectangle; } - } else { - if (!(hash in rect.rectangle.liveHash)) { + } + else + { + if (!(hash in rect.rectangle.liveHash)) + { rect.rectangle.liveHash[hash] = 1; rect.rectangle.pin.liveHash[hash] = 1; } if (locked && !rect.rectangle.locked) rect.rectangle.locked = locked; - if (rect.rectangle.locked) { + if (rect.rectangle.locked) + { borderColor = "#000000FF"; } if (myDEbox) borderWeight = 1; - if (rect.rectangle.size == 6) { + if (rect.rectangle.size == 6) + { borderColor = "#000000FF"; - //borderWeight = 1.0; + // borderWeight = 1.0; zIndex = 50; } newRect.age = g_timeNow; @@ -3737,14 +4275,14 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { const featureHoverStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: boxColor, + color: boxColor }), stroke: new ol.style.Stroke({ color: borderColor, width: borderWeight, - lineJoin: "round", + lineJoin: "round" }), - zIndex: zIndex, + zIndex: zIndex }); rect.rectangle.setStyle(featureHoverStyle); @@ -3753,31 +4291,38 @@ function qthToBox(iQTH, iDEcallsign, iCQ, iNew, locked, DE, band, wspr, hash) { return returnRectangle; } -function alphaFrom(rgba) { +function alphaFrom(rgba) +{ var alphaInt = hexToA(rgba); var alphaFloat = alphaInt / 255.0; return alphaFloat; } -function alphaTo(rgba, alphaFloat) { +function alphaTo(rgba, alphaFloat) +{ var alphaInt = parseInt(alphaFloat * 255); var alphaHex = alphaInt.toString(16); - if (alphaHex.length == 1) { + if (alphaHex.length == 1) + { alphaHex = "0" + alphaHex; } return rgba.slice(0, -2) + alphaHex; } -function intAlphaToRGB(rgb, alphaInt) { +function intAlphaToRGB(rgb, alphaInt) +{ var alphaHex = alphaInt.toString(16); - if (alphaHex.length == 1) { + if (alphaHex.length == 1) + { alphaHex = "0" + alphaHex; } return rgb + alphaHex; } -function dimFunction(qthObj) { - if (qthObj.rectangle.locked == false) { +function dimFunction(qthObj) +{ + if (qthObj.rectangle.locked == false) + { var featureStyle = qthObj.rectangle.getStyle(); var featureFill = featureStyle.getFill(); var fillColor = featureFill.getColor(); @@ -3798,58 +4343,70 @@ function dimFunction(qthObj) { } } -function toggleTrafficDecode() { - trafficDecode.checked = trafficDecode.checked == true ? false : true; +function toggleTrafficDecode() +{ + trafficDecode.checked = trafficDecode.checked != true; changeTrafficDecode(); } -function changeTrafficDecode() { +function changeTrafficDecode() +{ g_mapSettings.trafficDecode = trafficDecode.checked; trafficDecodeView(); saveMapSettings(); } -function trafficDecodeView() { - if (g_mapSettings.trafficDecode == false) { +function trafficDecodeView() +{ + if (g_mapSettings.trafficDecode == false) + { trafficDiv.innerHTML = ""; g_lastTraffic = Array(); } } -function changeFitQRZvalue() { +function changeFitQRZvalue() +{ g_mapSettings.fitQRZ = fitQRZvalue.checked; saveMapSettings(); } -function changeQrzDxccFallbackValue() { +function changeQrzDxccFallbackValue() +{ g_mapSettings.qrzDxccFallback = qrzDxccFallbackValue.checked; saveMapSettings(); } -function changeCqHiliteValue(check) { +function changeCqHiliteValue(check) +{ g_mapSettings.CQhilite = check.checked; saveMapSettings(); if (check.checked == false) removePaths(); } -function changeFocusRigValue(check) { +function changeFocusRigValue(check) +{ g_mapSettings.focusRig = check.checked; saveMapSettings(); } -function changeHaltOntTxValue(check) { +function changeHaltOntTxValue(check) +{ g_mapSettings.haltAllOnTx = check.checked; saveMapSettings(); } -function changeStrikesAlert() { +function changeStrikesAlert() +{ g_mapSettings.strikesAlert = strikesAlert.value; saveMapSettings(); playStrikeAlert(); } -function playStrikeAlert() { - switch (g_mapSettings.strikesAlert) { +function playStrikeAlert() +{ + switch (g_mapSettings.strikesAlert) + { case 1: playAlertMediaFile("short-strike.wav", true); break; @@ -3865,68 +4422,88 @@ function playStrikeAlert() { } } -function setStrikesButton() { - if (g_mapSettings.strikes) { +function setStrikesButton() +{ + if (g_mapSettings.strikes) + { strikesImg.style.webkitFilter = ""; - } else { + } + else + { strikesImg.style.webkitFilter = "grayscale(1)"; } } -function toggleStrikesValue() { - if (g_mapSettings.strikesNotify == false && g_mapSettings.strikes == false) { +function toggleStrikesValue() +{ + if (g_mapSettings.strikesNotify == false && g_mapSettings.strikes == false) + { var confirmed = window.confirm( "Lighting Strike Detection is provided by Blitzortung.org\nWe are not responsible for missed strikes that could result in damage.\nBe sure to check your local weather providers for accurate data." ); - if (confirmed == false) { + if (confirmed == false) + { return; - } else { + } + else + { g_mapSettings.strikesNotify = true; } } - g_mapSettings.strikes = g_mapSettings.strikes == true ? false : true; + g_mapSettings.strikes = g_mapSettings.strikes != true; setStrikesButton(); saveMapSettings(); } -function changeSplitQSL() { +function changeSplitQSL() +{ g_mapSettings.splitQSL = splitQSLValue.checked; saveMapSettings(); redrawGrids(); } -function setAnimateView() { - if (animateValue.checked) { +function setAnimateView() +{ + if (animateValue.checked) + { animationSpeedTd.style.display = "inline-table"; - } else { + } + else + { animationSpeedTd.style.display = "none"; } } -function toggleAnimate() { - animateValue.checked = animateValue.checked == true ? false : true; +function toggleAnimate() +{ + animateValue.checked = animateValue.checked != true; changeAnimate(); } -function toggleAllGrids() { - g_showAllGrids = g_showAllGrids ? false : true; +function toggleAllGrids() +{ + g_showAllGrids = !g_showAllGrids; setTrophyOverlay(g_currentOverlay); } -function changeAnimate() { +function changeAnimate() +{ g_mapSettings.animate = animateValue.checked; saveMapSettings(); var dash = []; var dashOff = 0; - if (g_mapSettings.animate == true) { + if (g_mapSettings.animate == true) + { dash = g_flightPathLineDash; dashOff = g_flightPathTotal - g_flightPathOffset; } - for (var i = g_flightPaths.length - 1; i >= 0; i--) { - if (g_flightPaths[i].isShapeFlight == 0) { + for (var i = g_flightPaths.length - 1; i >= 0; i--) + { + if (g_flightPaths[i].isShapeFlight == 0) + { var featureStyle = g_flightPaths[i].getStyle(); var featureStroke = featureStyle.getStroke(); @@ -3937,7 +4514,8 @@ function changeAnimate() { g_flightPaths[i].setStyle(featureStyle); } } - if (g_transmitFlightPath != null) { + if (g_transmitFlightPath != null) + { var featureStyle = g_transmitFlightPath.getStyle(); var featureStroke = featureStyle.getStroke(); @@ -3950,7 +4528,8 @@ function changeAnimate() { setAnimateView(); } -function changeAnimateSpeedValue() { +function changeAnimateSpeedValue() +{ g_mapSettings.animateSpeed = 21 - animateSpeedValue.value; saveMapSettings(); } @@ -3959,7 +4538,8 @@ var g_animateFrame = 0; var g_nextDimTime = 0; var g_last = 0; -function animatePaths() { +function animatePaths() +{ requestAnimationFrame(animatePaths); g_last ^= g_last; @@ -3970,11 +4550,13 @@ function animatePaths() { if (g_animateFrame > 0) return; - for (var i = g_flightPaths.length - 1; i >= 0; i--) { - if (g_flightPaths[i].age < g_timeNow) { + for (var i = g_flightPaths.length - 1; i >= 0; i--) + { + if (g_flightPaths[i].age < g_timeNow) + { if (typeof g_flightPaths[i].Arrow != "undefined") - g_layerSources["flight"].removeFeature(g_flightPaths[i].Arrow); - g_layerSources["flight"].removeFeature(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; @@ -3982,7 +4564,8 @@ function animatePaths() { } } - if (g_timeNow > g_nextDimTime) { + if (g_timeNow > g_nextDimTime) + { dimGridsquare(); } @@ -3994,8 +4577,10 @@ function animatePaths() { var targetOffset = g_flightPathTotal - g_flightPathOffset; var featureStyle = null; var featureStroke = null; - for (var i = 0; i < g_flightPaths.length; i++) { - if (g_flightPaths[i].isShapeFlight == 0) { + for (var i = 0; i < g_flightPaths.length; i++) + { + if (g_flightPaths[i].isShapeFlight == 0) + { featureStyle = g_flightPaths[i].getStyle(); featureStroke = featureStyle.getStroke(); featureStroke.setLineDashOffset(targetOffset); @@ -4003,7 +4588,8 @@ function animatePaths() { } } - if (g_transmitFlightPath != null) { + if (g_transmitFlightPath != null) + { var featureStyle = g_transmitFlightPath.getStyle(); var featureStroke = featureStyle.getStroke(); @@ -4014,48 +4600,61 @@ function animatePaths() { } } -function removePaths() { - g_layerSources["flight"].clear(); +function removePaths() +{ + g_layerSources.flight.clear(); g_flightPaths = Array(); } -function fadePaths() { - if (pathWidthValue.value == 0) { +function fadePaths() +{ + if (pathWidthValue.value == 0) + { removePaths(); - return; } } -function dimGridsquare() { +function dimGridsquare() +{ if (gridDecay.value == 0) return; - for (var i in g_liveGrids) { + for (var i in g_liveGrids) + { dimFunction(g_liveGrids[i]); if ( g_timeNow - g_liveGrids[i].age >= gridDecay.value && g_liveGrids[i].rectangle.locked == false - ) { + ) + { // Walk the rectangles DEcall's and remove them from g_liveCallsigns - for (var CallIsKey in g_liveGrids[i].rectangle.liveHash) { - if (CallIsKey in g_liveCallsigns) { + for (var CallIsKey in g_liveGrids[i].rectangle.liveHash) + { + if (CallIsKey in g_liveCallsigns) + { g_liveCallsigns[CallIsKey].rect = null; delete g_liveCallsigns[CallIsKey]; } } - if (g_liveGrids[i].rectangle.pin != null) { + if (g_liveGrids[i].rectangle.pin != null) + { if ( g_layerSources["live-pins"].hasFeature(g_liveGrids[i].rectangle.pin) ) + { g_layerSources["live-pins"].removeFeature( g_liveGrids[i].rectangle.pin ); + } } - if (g_layerSources["live"].hasFeature(g_liveGrids[i].rectangle)) { - g_layerSources["live"].removeFeature(g_liveGrids[i].rectangle); + if (g_layerSources.live.hasFeature(g_liveGrids[i].rectangle)) + { + g_layerSources.live.removeFeature(g_liveGrids[i].rectangle); - if (Number(g_appSettings.gridViewMode) == 3 && i in g_qsoGrids) { - if (g_qsoGrids[i].isTriangle) { + if (Number(g_appSettings.gridViewMode) == 3 && i in g_qsoGrids) + { + if (g_qsoGrids[i].isTriangle) + { triangleToGrid(i, g_qsoGrids[i].rectangle); g_qsoGrids[i].isTriangle = false; } @@ -4069,7 +4668,8 @@ function dimGridsquare() { g_nextDimTime = g_timeNow + 7; } -function updateCountStats() { +function updateCountStats() +{ var count = Object.keys(g_liveCallsigns).length; if (myDEcall in g_liveCallsigns) count--; @@ -4081,22 +4681,28 @@ function updateCountStats() { countryCount.innerHTML = Object.keys(g_dxccCount).length; - if (Object.keys(g_QSOhash).length > 0) { + if (Object.keys(g_QSOhash).length > 0) + { clearOrLoadButton.innerHTML = "Clear Log"; g_loadQSOs = false; - } else { + } + else + { clearOrLoadButton.innerHTML = "Load Logs"; g_loadQSOs = true; } } -function clearGrids() { - g_layerSources["live"].clear(); +function clearGrids() +{ + g_layerSources.live.clear(); g_layerSources["live-pins"].clear(); - for (var i in g_liveGrids) { + for (var i in g_liveGrids) + { // Walk the rectangles DEcall's and remove the rect from the g_liveCallsigns - for (var CallIsKey in g_liveGrids[i].rectangle.liveHash) { + for (var CallIsKey in g_liveGrids[i].rectangle.liveHash) + { if (CallIsKey in g_liveCallsigns) g_liveCallsigns[CallIsKey].rect = null; } } @@ -4104,13 +4710,15 @@ function clearGrids() { g_liveGrids = {}; } -function clearQsoGrids() { - g_layerSources["qso"].clear(); +function clearQsoGrids() +{ + g_layerSources.qso.clear(); g_layerSources["qso-pins"].clear(); g_qsoGrids = {}; - for (var key in g_worldGeoData) { + for (var key in g_worldGeoData) + { g_worldGeoData[key].worked = false; g_worldGeoData[key].confirmed = false; g_worldGeoData[key].worked_bands = {}; @@ -4118,7 +4726,8 @@ function clearQsoGrids() { g_worldGeoData[key].worked_modes = {}; g_worldGeoData[key].confirmed_modes = {}; } - for (var key in g_cqZones) { + for (var key in g_cqZones) + { g_cqZones[key].worked = false; g_cqZones[key].confirmed = false; @@ -4127,7 +4736,8 @@ function clearQsoGrids() { g_cqZones[key].worked_modes = {}; g_cqZones[key].confirmed_modes = {}; } - for (var key in g_ituZones) { + for (var key in g_ituZones) + { g_ituZones[key].worked = false; g_ituZones[key].confirmed = false; @@ -4136,7 +4746,8 @@ function clearQsoGrids() { g_ituZones[key].worked_modes = {}; g_ituZones[key].confirmed_modes = {}; } - for (var key in g_wasZones) { + for (var key in g_wasZones) + { g_wasZones[key].worked = false; g_wasZones[key].confirmed = false; @@ -4145,7 +4756,8 @@ function clearQsoGrids() { g_wasZones[key].worked_modes = {}; g_wasZones[key].confirmed_modes = {}; } - for (var key in g_wacZones) { + for (var key in g_wacZones) + { g_wacZones[key].worked = false; g_wacZones[key].confirmed = false; g_wacZones[key].worked_bands = {}; @@ -4153,7 +4765,8 @@ function clearQsoGrids() { g_wacZones[key].worked_modes = {}; g_wacZones[key].confirmed_modes = {}; } - for (var key in g_countyData) { + for (var key in g_countyData) + { g_countyData[key].worked = false; g_countyData[key].confirmed = false; g_countyData[key].worked_bands = {}; @@ -4161,7 +4774,8 @@ function clearQsoGrids() { g_countyData[key].worked_modes = {}; g_countyData[key].confirmed_modes = {}; } - for (var key in g_us48Data) { + for (var key in g_us48Data) + { g_us48Data[key].worked = false; g_us48Data[key].confirmed = false; g_us48Data[key].worked_bands = {}; @@ -4171,15 +4785,18 @@ function clearQsoGrids() { } } -function clearCalls() { +function clearCalls() +{ removePaths(); - for (var i in g_liveCallsigns) { + for (var i in g_liveCallsigns) + { if ( typeof g_liveCallsigns[i].rect != "undefined" && g_liveCallsigns[i].rect != null - ) { + ) + { if (i in g_liveCallsigns[i].rect.liveHash) - delete g_liveCallsigns[i].rect.liveHash[i]; + { delete g_liveCallsigns[i].rect.liveHash[i]; } } } @@ -4188,7 +4805,8 @@ function clearCalls() { redrawGrids(); } -function clearLive() { +function clearLive() +{ g_Decodes = 0; g_lastMessages = Array(); @@ -4208,7 +4826,8 @@ function clearLive() { goProcessRoster(); } -function clearAll() { +function clearAll() +{ clearTempGrids(); clearCalls(); clearQSOs(); @@ -4225,15 +4844,20 @@ function clearAll() { goProcessRoster(); } -function clearOrLoadQSOs() { - if (g_loadQSOs == true) { +function clearOrLoadQSOs() +{ + if (g_loadQSOs == true) + { startupAdifLoadCheck(); - } else { + } + else + { clearQSOs(); } } -function clearAndLoadQSOs() { +function clearAndLoadQSOs() +{ initQSOdata(); g_QSOhash = {}; g_QSLcount = 0; @@ -4248,7 +4872,8 @@ function clearAndLoadQSOs() { startupAdifLoadCheck(); } -function clearQSOs() { +function clearQSOs() +{ initQSOdata(); g_QSOhash = {}; g_QSLcount = 0; @@ -4262,7 +4887,8 @@ function clearQSOs() { clearLogFilesAndCounts(); } -function clearLogFilesAndCounts() { +function clearLogFilesAndCounts() +{ tryToDeleteLog("lotw_QSL.adif"); tryToDeleteLog("lotw_QSO.adif"); tryToDeleteLog("lotw.adif"); @@ -4272,19 +4898,20 @@ function clearLogFilesAndCounts() { localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); } -function getCurrentBandModeHTML() { +function getCurrentBandModeHTML() +{ var band = g_appSettings.gtBandFilter == "auto" ? myBand + " (Auto)" : g_appSettings.gtBandFilter.length == 0 - ? "Mixed Bands" - : g_appSettings.gtBandFilter; + ? "Mixed Bands" + : g_appSettings.gtBandFilter; var mode = g_appSettings.gtModeFilter == "auto" ? myMode + " (Auto)" : g_appSettings.gtModeFilter.length == 0 - ? "Mixed Modes" - : g_appSettings.gtModeFilter; + ? "Mixed Modes" + : g_appSettings.gtModeFilter; return ( "
Viewing: " + band + @@ -4303,9 +4930,11 @@ var g_currentNightState = false; var g_timeNow = timeNowSec(); -function displayTime() { +function displayTime() +{ g_timeNow = timeNowSec(); - if (menuDiv.className == "menuDivStart" && g_menuShowing == true) { + if (menuDiv.className == "menuDivStart" && g_menuShowing == true) + { menuDiv.className = "menuDivEnd"; mapDiv.className = "mapDivEnd"; LegendDiv.className = "legendDivEnd"; @@ -4314,59 +4943,78 @@ function displayTime() { currentTime.innerHTML = "" + userTimeString(null) + ""; - if (g_lastTimeSinceMessageInSeconds > 0) { + if (g_lastTimeSinceMessageInSeconds > 0) + { var since = g_timeNow - g_lastTimeSinceMessageInSeconds; secondsAgoMsg.innerHTML = since.toDHMS(); - if (since > 17 && since < 122) { + if (since > 17 && since < 122) + { secondsAgoMsg.style.backgroundColor = "yellow"; secondsAgoMsg.style.color = "#000"; - } else if (since > 121) { + } + else if (since > 121) + { secondsAgoMsg.style.backgroundColor = "red"; secondsAgoMsg.style.color = "#000"; - } else { + } + else + { secondsAgoMsg.style.backgroundColor = "blue"; secondsAgoMsg.style.color = "#FF0"; } - } else secondsAgoMsg.innerHTML = "Never"; + } + else secondsAgoMsg.innerHTML = "Never"; checkWsjtxListener(); - if (g_timeNow % 22 == 0) { + if (g_timeNow % 22 == 0) + { g_nightTime = dayNight.refresh(); moonLayer.refresh(); } pskSpotCheck(g_timeNow); - if (g_mapSettings.strikes && g_mapSettings.offlineMode == false) { + if (g_mapSettings.strikes && g_mapSettings.offlineMode == false) + { if (g_strikeWebSocket == null) loadStrikes(); var now = Date.now(); - for (var time in g_bolts) { - if (now - time > 120000) { - if (g_layerSources["strikes"].hasFeature(g_bolts[time])) - g_layerSources["strikes"].removeFeature(g_bolts[time]); + for (var time in g_bolts) + { + if (now - time > 120000) + { + if (g_layerSources.strikes.hasFeature(g_bolts[time])) + { g_layerSources.strikes.removeFeature(g_bolts[time]); } delete g_bolts[time]; } } - } else { - g_layerSources["strikes"].clear(); - if (g_strikeWebSocket != null) { - try { + } + else + { + g_layerSources.strikes.clear(); + if (g_strikeWebSocket != null) + { + try + { g_strikeWebSocket.close(); - } catch (e) { + } + catch (e) + { g_strikeWebSocket = null; } } } - if (g_currentNightState != g_nightTime) { + if (g_currentNightState != g_nightTime) + { changeMapLayer(); g_currentNightState = g_nightTime; } } -function timeNowSec() { +function timeNowSec() +{ return parseInt(Date.now() / 1000); } @@ -4377,66 +5025,74 @@ var g_liveHoverInteraction = null; var g_gtFlagHoverInteraction = null; var g_trophyHoverInteraction = null; -function createGlobalHeatmapLayer(name, radius, blur) { +function createGlobalHeatmapLayer(name, radius, blur) +{ g_layerSources[name] = new ol.source.Vector({}); g_layerVectors[name] = new ol.layer.Heatmap({ source: g_layerSources[name], - zIndex: Object.keys(g_layerVectors).length + 1, + zIndex: Object.keys(g_layerVectors).length + 1 }); g_layerVectors[name].set("name", name); } -function createGlobalMapLayer(name, maxResolution, minResolution) { +function createGlobalMapLayer(name, maxResolution, minResolution) +{ g_layerSources[name] = new ol.source.Vector({}); if ( typeof maxResolution == "undefined" && typeof minResolution == "undefined" - ) { + ) + { var zIndex = Object.keys(g_layerVectors).length + 1; if (name == "strikes") zIndex = 2000; g_layerVectors[name] = new ol.layer.Vector({ source: g_layerSources[name], - zIndex: zIndex, + zIndex: zIndex }); - } else if (typeof minResolution == "undefined") { + } + else if (typeof minResolution == "undefined") + { g_layerVectors[name] = new ol.layer.Vector({ source: g_layerSources[name], maxResolution: maxResolution, - zIndex: Object.keys(g_layerVectors).length + 1, + zIndex: Object.keys(g_layerVectors).length + 1 }); - } else { + } + else + { g_layerVectors[name] = new ol.layer.Vector({ source: g_layerSources[name], maxResolution: maxResolution, minResolution: minResolution, - zIndex: Object.keys(g_layerVectors).length + 1, + zIndex: Object.keys(g_layerVectors).length + 1 }); } g_layerVectors[name].set("name", name); } -function createGeoJsonLayer(name, url, color, stroke) { +function createGeoJsonLayer(name, url, color, stroke) +{ var style = new ol.style.Style({ stroke: new ol.style.Stroke({ color: color, - width: stroke, + width: stroke }), fill: new ol.style.Fill({ - color: "#00000000", - }), + color: "#00000000" + }) }); var layerSource = new ol.source.Vector({ url: url, format: new ol.format.GeoJSON({ geometryName: name }), - overlaps: false, + overlaps: false }); var layerVector = new ol.layer.Vector({ source: layerSource, style: style, visible: true, - zIndex: 1, + zIndex: 1 }); layerVector.set("name", name); return layerVector; @@ -4446,22 +5102,23 @@ var g_gtFlagIcon = new ol.style.Icon({ src: "./img/flag_gt_user.png", anchorYUnits: "pixels", anchorXUnits: "pixels", - anchor: [12, 17], + anchor: [12, 17] }); var g_pushPinIconOff = new ol.style.Icon({ src: "./img/red-circle.png", anchorYUnits: "pixels", anchorXUnits: "pixels", - anchor: [5, 18], + anchor: [5, 18] }); -function panTo(location) { +function panTo(location) +{ var duration = 1000; g_mapView.animate({ center: location, - duration: duration, + duration: duration }); } @@ -4471,7 +5128,7 @@ var g_lightningBolt = new ol.style.Icon({ anchorXUnits: "pixels", size: [64, 64], anchor: [9, 58], - scale: 0.75, + scale: 0.75 }); var g_lightningGlobal = Array(); @@ -4481,7 +5138,7 @@ g_lightningGlobal[0] = new ol.style.Icon({ anchorYUnits: "pixels", anchorXUnits: "pixels", opacity: 0.2, - anchor: [2, 31], + anchor: [2, 31] }); g_lightningGlobal[1] = new ol.style.Icon({ @@ -4489,7 +5146,7 @@ g_lightningGlobal[1] = new ol.style.Icon({ anchorYUnits: "pixels", anchorXUnits: "pixels", opacity: 0.2, - anchor: [1, 34], + anchor: [1, 34] }); var g_bolts = {}; @@ -4497,9 +5154,10 @@ var g_strikeWebSocket = null; var g_strikeInterval = null; var g_strikeRange = 0.4; -function toggleStrikeGlobal() { +function toggleStrikeGlobal() +{ g_mapSettings.strikesGlobal = - g_mapSettings.strikesGlobal == false ? true : false; + g_mapSettings.strikesGlobal == false; saveMapSettings(); var msg = "Local Strikes"; @@ -4508,39 +5166,47 @@ function toggleStrikeGlobal() { var worker = "Strike Distance Changed
" + msg + "
"; if (g_mapSettings.strikes == false) - worker += "
Detection is not enabled!"; + { worker += "
Detection is not enabled!"; } addLastTraffic(worker); - g_layerSources["strikes"].clear(); + g_layerSources.strikes.clear(); } -function setStrikeDistance() { +function setStrikeDistance() +{ if ( g_mapSettings.offlineMode == true && g_strikeWebSocket != null && g_strikeWebSocket.readyState != 3 - ) { + ) + { g_strikeWebSocket.close(); return; } - if (g_strikeWebSocket != null) { + if (g_strikeWebSocket != null) + { var distance = g_strikeRange; if (g_mapSettings.strikesGlobal == true) distance = 1000; - var send = '{"west":-180,"east":180,"north":-90,"south":-90}'; + var send = "{\"west\":-180,\"east\":180,\"north\":-90,\"south\":-90}"; if (g_strikeInterval == null) - g_strikeInterval = setInterval(setStrikeDistance, 300000); + { g_strikeInterval = setInterval(setStrikeDistance, 300000); } - try { + try + { g_strikeWebSocket.send(send); - } catch (e) { - delete g_strikeWebSocket; + } + catch (e) + { g_strikeWebSocket = null; } - } else { - if (g_strikeInterval != null) { + } + else + { + if (g_strikeInterval != null) + { clearInterval(g_strikeInterval); g_strikeInterval = null; } @@ -4548,33 +5214,46 @@ function setStrikeDistance() { } var g_strikeCount = 0; -function loadStrikes() { +function loadStrikes() +{ if (g_strikeWebSocket) return; var rnd = parseInt(Math.random() * 4); var ws_server = ""; - if (rnd < 1) { + if (rnd < 1) + { ws_server = "ws7.blitzortung.org"; - } else if (rnd < 2) { + } + else if (rnd < 2) + { ws_server = "ws6.blitzortung.org"; - } else if (rnd < 3) { + } + else if (rnd < 3) + { ws_server = "ws5.blitzortung.org"; - } else { + } + else + { ws_server = "ws1.blitzortung.org"; } - try { + try + { g_strikeWebSocket = new WebSocket("wss:///" + ws_server + ":3000"); - } catch (e) { + } + catch (e) + { g_strikeWebSocket = null; return; } - g_strikeWebSocket.onopen = function () { + g_strikeWebSocket.onopen = function () + { setStrikeDistance(); }; - g_strikeWebSocket.onmessage = function (evt) { + g_strikeWebSocket.onmessage = function (evt) + { var Strikes = JSON.parse(evt.data); Strikes.sig = null; @@ -4583,7 +5262,8 @@ function loadStrikes() { "time" in Strikes && "lat" in Strikes && "lon" in Strikes - ) { + ) + { var index = Date.now(); while (index in g_bolts) index++; @@ -4596,17 +5276,19 @@ function loadStrikes() { if ( g_mapSettings.strikesGlobal || (g_mapSettings.strikesGlobal == false && inRange) - ) { + ) + { g_bolts[index] = iconFeature( ol.proj.fromLonLat([Strikes.lon, Strikes.lat]), inRange ? g_lightningBolt : g_lightningGlobal[0], 1 ); - g_layerSources["strikes"].addFeature(g_bolts[index]); + g_layerSources.strikes.addFeature(g_bolts[index]); } - if (inRange == true) { + if (inRange == true) + { playStrikeAlert(); var dist = @@ -4642,41 +5324,45 @@ function loadStrikes() { addLastTraffic(worker); } } - delete Strikes; delete evt.data; }; - g_strikeWebSocket.onerror = function () { - delete g_strikeWebSocket; + g_strikeWebSocket.onerror = function () + { g_strikeWebSocket = null; }; - g_strikeWebSocket.onclose = function () { - delete g_strikeWebSocket; + g_strikeWebSocket.onclose = function () + { g_strikeWebSocket = null; }; } -function toggleMouseTrack() { +function toggleMouseTrack() +{ g_appSettings.mouseTrack ^= 1; if (g_appSettings.mouseTrack == 0) mouseTrackDiv.style.display = "none"; } -function myGmapNameCompare(a, b) { +function myGmapNameCompare(a, b) +{ return g_maps[a].name.localeCompare(g_maps[b].name); } var g_Nexrad = null; -function initMap() { +function initMap() +{ document.getElementById("mapDiv").innerHTML = ""; g_maps = JSON.parse(fs.readFileSync(g_mapsFile)); - if (g_maps) { + if (g_maps) + { var entries = Object.keys(g_maps).sort(myGmapNameCompare); - for (var lmap in entries) { + for (var lmap in entries) + { var key = entries[lmap]; g_mapsLayer[key] = new ol.source.XYZ(g_maps[key]); var option = document.createElement("option"); @@ -4691,33 +5377,38 @@ function initMap() { } mapSelect.value = g_mapSettings.mapIndex; mapNightSelect.value = g_mapSettings.nightMapIndex; - } else g_mapsLayer[0] = new ol.source.OSM(); + } + else g_mapsLayer[0] = new ol.source.OSM(); g_offlineLayer = new ol.source.XYZ({ - url: "/map/sat/{z}/{x}/{y}.png", + url: "/map/sat/{z}/{x}/{y}.png" }); if (g_mapSettings.offlineMode) + { g_tileLayer = new ol.layer.Tile({ source: g_offlineLayer, loadTilesWhileInteracting: true, - loadTilesWhileAnimating: true, + loadTilesWhileAnimating: true }); + } else + { g_tileLayer = new ol.layer.Tile({ source: g_mapsLayer[mapSelect.value], loadTilesWhileInteracting: true, - loadTilesWhileAnimating: true, + loadTilesWhileAnimating: true }); + } g_scaleLine = new ol.control.ScaleLine({ - units: g_scaleUnits[g_appSettings.distanceUnit], + units: g_scaleUnits[g_appSettings.distanceUnit] }); var g_mapControl = [ g_scaleLine, new ol.control.Zoom(), - new ol.control.FullScreen({ source: "mainBody" }), + new ol.control.FullScreen({ source: "mainBody" }) ]; createGlobalMapLayer("award"); @@ -4745,7 +5436,7 @@ function initMap() { center: [g_myLon, g_myLat], zoomFactor: 1.25, zoom: g_mapSettings.zoom, - showFullExtent: true, + showFullExtent: true }); g_map = new ol.Map({ @@ -4753,11 +5444,11 @@ function initMap() { layers: [ g_tileLayer, - g_layerVectors["award"], + g_layerVectors.award, g_layerVectors["psk-heat"], - g_layerVectors["qso"], + g_layerVectors.qso, g_layerVectors["qso-pins"], - g_layerVectors["live"], + g_layerVectors.live, g_layerVectors["live-pins"], g_layerVectors["line-grids"], g_layerVectors["long-grids"], @@ -4766,27 +5457,30 @@ function initMap() { g_layerVectors["psk-flights"], g_layerVectors["psk-spots"], g_layerVectors["psk-hop"], - g_layerVectors["flight"], - g_layerVectors["transmit"], - g_layerVectors["gtflags"], - g_layerVectors["temp"], - g_layerVectors["tz"], - g_layerVectors["radar"], - g_layerVectors["strikes"], + g_layerVectors.flight, + g_layerVectors.transmit, + g_layerVectors.gtflags, + g_layerVectors.temp, + g_layerVectors.tz, + g_layerVectors.radar, + g_layerVectors.strikes ], controls: g_mapControl, loadTilesWhileInteracting: false, loadTilesWhileAnimating: false, - view: g_mapView, + view: g_mapView }); - mapDiv.addEventListener("mousemove", function (event) { + mapDiv.addEventListener("mousemove", function (event) + { onMouseUpdate(event); var mousePosition = g_map.getEventPixel(event); - if (g_appSettings.mouseTrack == 1) { + if (g_appSettings.mouseTrack == 1) + { var mouseLngLat = g_map.getEventCoordinate(event); - if (mouseLngLat) { + if (mouseLngLat) + { var LL = ol.proj.toLonLat(mouseLngLat); var dist = parseInt( @@ -4820,50 +5514,61 @@ function initMap() { var noMoon = true; var noTimeZone = true; - if (g_map.hasFeatureAtPixel(mousePosition)) { + if (g_map.hasFeatureAtPixel(mousePosition)) + { var features = g_map.getFeaturesAtPixel(mousePosition); - if (features != null) { + if (features != null) + { features = features.reverse(); var finalGridFeature = null; - for (var index in features) { - if (features[index].geometryName_ == "tz") { + for (var index in features) + { + if (features[index].geometryName_ == "tz") + { features[index].size = 73; } if (typeof features[index].size == "undefined") continue; - if (features[index].size == 99 && finalGridFeature == null) { + if (features[index].size == 99 && finalGridFeature == null) + { moonOver(features[index]); noMoon = false; break; } - if (features[index].size == 2 && g_currentOverlay != 0) { + if (features[index].size == 2 && g_currentOverlay != 0) + { trophyOver(features[index]); noAward = false; break; } - if (features[index].size == 1) { + if (features[index].size == 1) + { mouseOverGtFlag(features[index]); noFlag = false; noFeature = true; break; } - if (features[index].size == 6) { + if (features[index].size == 6) + { noFeature = false; finalGridFeature = features[index]; } - if (features[index].size == 4 && finalGridFeature == null) { + if (features[index].size == 4 && finalGridFeature == null) + { noFeature = false; finalGridFeature = features[index]; noFlag = true; } - if (features[index].size == 73 && finalGridFeature == null) { + if (features[index].size == 73 && finalGridFeature == null) + { mouseOverGtFlag(features[index]); noFlag = false; } } - if (finalGridFeature) { + if (finalGridFeature) + { mouseOverDataItem(finalGridFeature, true); } } @@ -4874,48 +5579,58 @@ function initMap() { if (noMoon) moonOut(); }); - //mapDiv.addEventListener('mouseout', mapLoseFocus, false); + // mapDiv.addEventListener('mouseout', mapLoseFocus, false); mapDiv.addEventListener("mouseleave", mapLoseFocus, false); - mapDiv.addEventListener("contextmenu", function (event) { + mapDiv.addEventListener("contextmenu", function (event) + { event.preventDefault(); }); - g_map.on("pointerdown", function (event) { + g_map.on("pointerdown", function (event) + { var shouldReturn = false; var features = g_map.getFeaturesAtPixel(event.pixel); - if (features != null) { + if (features != null) + { features = features.reverse(); var finalGridFeature = null; - for (var index in features) { + for (var index in features) + { if (typeof features[index].size == "undefined") continue; - if (features[index].size == 6) { + if (features[index].size == 6) + { noFeature = false; finalGridFeature = features[index]; } - if (features[index].size == 4 && finalGridFeature == null) { + if (features[index].size == 4 && finalGridFeature == null) + { noFeature = false; finalGridFeature = features[index]; } - if (features[index].size == 1) { + if (features[index].size == 1) + { leftClickGtFlag(features[index]); shouldReturn = true; } } - if (finalGridFeature) { + if (finalGridFeature) + { onRightClickGridSquare(finalGridFeature); shouldReturn = true; } } if (shouldReturn) return true; - if (event.pointerEvent.buttons == 2 && g_currentOverlay == 0) { + if (event.pointerEvent.buttons == 2 && g_currentOverlay == 0) + { mouseDownGrid(ol.proj.toLonLat(event.coordinate), event); return true; } }); - g_map.on("pointerup", function (event) { + g_map.on("pointerup", function (event) + { mouseUpGrid(); if (g_mapSettings.mouseOver == false) mouseOutOfDataItem(); }); @@ -4923,16 +5638,22 @@ function initMap() { document.getElementById("menuDiv").style.display = "block"; dayNight.init(g_map); - if (g_appSettings.earthImgSrc == 1) { + if (g_appSettings.earthImgSrc == 1) + { dayNight.hide(); - } else { + } + else + { g_nightTime = dayNight.show(); } moonLayer.init(g_map); - if (g_appSettings.moonTrack == 1) { + if (g_appSettings.moonTrack == 1) + { moonLayer.show(); - } else { + } + else + { moonLayer.hide(); } @@ -4944,13 +5665,17 @@ function initMap() { changeNightMapEnable(nightMapEnable); } -function changeNightMapEnable(check) { - if (check.checked) { +function changeNightMapEnable(check) +{ + if (check.checked) + { nightMapTd.style.display = "inline-table"; spotNightPathColorDiv.style.display = "inline-block"; g_mapSettings.nightMapEnable = true; g_nightTime = dayNight.refresh(); - } else { + } + else + { nightMapTd.style.display = "none"; spotNightPathColorDiv.style.display = "none"; g_mapSettings.nightMapEnable = false; @@ -4966,16 +5691,17 @@ var g_nexradInterval = null; var g_nexradEnable = 0; -function createNexRad() { +function createNexRad() +{ var layerSource = new ol.source.TileWMS({ url: "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0q.cgi", - params: { LAYERS: "nexrad-n0q" }, + params: { LAYERS: "nexrad-n0q" } }); var layerVector = new ol.layer.Tile({ source: layerSource, visible: true, - zIndex: 900, + zIndex: 900 }); layerVector.set("name", "radar"); @@ -4983,48 +5709,59 @@ function createNexRad() { return layerVector; } -function toggleNexrad() { +function toggleNexrad() +{ g_nexradEnable ^= 1; - if (g_nexradEnable == 1) { - if (g_Nexrad != null) { + if (g_nexradEnable == 1) + { + if (g_Nexrad != null) + { g_map.removeLayer(g_Nexrad); - delete g_Nexrad; } g_Nexrad = createNexRad(); g_map.addLayer(g_Nexrad); if (g_nexradInterval == null) - g_nexradInterval = setInterval(nexradRefresh, 600000); - } else { - if (g_nexradInterval != null) { + { g_nexradInterval = setInterval(nexradRefresh, 600000); } + } + else + { + if (g_nexradInterval != null) + { clearInterval(g_nexradInterval); g_nexradInterval = null; } - if (g_Nexrad) { + if (g_Nexrad) + { g_map.removeLayer(g_Nexrad); - delete g_Nexrad; g_Nexrad = null; } } - g_mapSettings.usNexrad = g_nexradEnable == 1 ? true : false; + g_mapSettings.usNexrad = g_nexradEnable == 1; } -function nexradRefresh() { - if (g_Nexrad != null) { +function nexradRefresh() +{ + if (g_Nexrad != null) + { g_Nexrad.getSource().refresh(); } } -function collapseMenu(shouldCollapse) { - if (shouldCollapse == true) { +function collapseMenu(shouldCollapse) +{ + if (shouldCollapse == true) + { g_menuShowing = false; mapDiv.className = "mapDivStart"; menuDiv.className = "menuDivStart"; LegendDiv.className = "legendDivStart"; chevronDiv.className = "chevronDivEnd"; - } else { + } + else + { g_menuShowing = true; chevronDiv.className = "chevronDivStart"; displayTime(); @@ -5032,7 +5769,8 @@ function collapseMenu(shouldCollapse) { g_map.updateSize(); } -function mapLoseFocus() { +function mapLoseFocus() +{ mouseOutOfDataItem(); trophyOut(); mouseUpGrid(); @@ -5040,65 +5778,72 @@ function mapLoseFocus() { mouseOutGtFlag(); } -function lineString(points) { +function lineString(points) +{ var thing = new ol.geom.LineString(points); var rect = new ol.Feature({ - geometry: thing, + geometry: thing }); return rect; } -function rectangle(bounds, options) { +function rectangle(bounds, options) +{ var thing = new ol.geom.Polygon([ [ ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), ol.proj.fromLonLat([bounds[0][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[1][1]]), - ol.proj.fromLonLat([bounds[1][0], bounds[0][1]]), - ], + ol.proj.fromLonLat([bounds[1][0], bounds[0][1]]) + ] ]); var rect = new ol.Feature({ name: "rect", - geometry: thing, + geometry: thing }); return rect; } -function triangle(bounds, topLeft) { +function triangle(bounds, topLeft) +{ var thing = null; - if (topLeft) { + if (topLeft) + { thing = new ol.geom.Polygon([ [ ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), ol.proj.fromLonLat([bounds[0][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[1][1]]), - ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), - ], + ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]) + ] ]); - } else { + } + else + { thing = new ol.geom.Polygon([ [ ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[0][1]]), - ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), - ], + ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]) + ] ]); } var rect = new ol.Feature({ name: "rect", - geometry: thing, + geometry: thing }); return rect; } -function triangleToGrid(iQTH, feature) { +function triangleToGrid(iQTH, feature) +{ var LL = squareToLatLong(iQTH); var bounds = [ [LL.lo1, LL.la1], - [LL.lo2, LL.la2], + [LL.lo2, LL.la2] ]; var thing = new ol.geom.Polygon([ @@ -5107,51 +5852,58 @@ function triangleToGrid(iQTH, feature) { ol.proj.fromLonLat([bounds[0][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[0][1]]), - ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), - ], + ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]) + ] ]); feature.setGeometry(thing); } -function gridToTriangle(iQTH, feature, topLeft) { +function gridToTriangle(iQTH, feature, topLeft) +{ var LL = squareToLatLong(iQTH); var bounds = [ [LL.lo1, LL.la1], - [LL.lo2, LL.la2], + [LL.lo2, LL.la2] ]; var thing = null; - if (topLeft) { + if (topLeft) + { thing = new ol.geom.Polygon([ [ ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), ol.proj.fromLonLat([bounds[0][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[1][1]]), - ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), - ], + ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]) + ] ]); - } else { + } + else + { thing = new ol.geom.Polygon([ [ ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[1][1]]), ol.proj.fromLonLat([bounds[1][0], bounds[0][1]]), - ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]), - ], + ol.proj.fromLonLat([bounds[0][0], bounds[0][1]]) + ] ]); } feature.setGeometry(thing); } -function liveHash(call, band, mode) { +function liveHash(call, band, mode) +{ return call + band + mode; } -function setHomeGridsquare() { +function setHomeGridsquare() +{ g_appSettings.centerGridsquare = myDEGrid; - if (g_appSettings.centerGridsquare.length > 0) { + if (g_appSettings.centerGridsquare.length > 0) + { homeQTHInput.value = g_appSettings.centerGridsquare; } var hash = myDEcall; @@ -5167,13 +5919,16 @@ function setHomeGridsquare() { null, hash ); - if (typeof rect != "undefined" && rect != null) { + if (typeof rect != "undefined" && rect != null) + { var push = false; - if (!(hash in g_liveCallsigns)) { + if (!(hash in g_liveCallsigns)) + { newCallsign = {}; push = true; - } else newCallsign = g_liveCallsigns[hash]; + } + else newCallsign = g_liveCallsigns[hash]; newCallsign.DEcall = myDEcall; newCallsign.grid = myDEGrid; newCallsign.wspr = null; @@ -5204,9 +5959,12 @@ function setHomeGridsquare() { var g_transmitFlightPath = null; -function haltAllTx(allTx = false) { - for (var instance in g_instances) { - if (instance != g_activeInstance || allTx == true) { +function haltAllTx(allTx = false) +{ + for (var instance in g_instances) + { + if (instance != g_activeInstance || allTx == true) + { var responseArray = Buffer.alloc(1024); var length = 0; @@ -5225,18 +5983,22 @@ function haltAllTx(allTx = false) { } } -function initiateQso(thisCall) { +function initiateQso(thisCall) +{ if ( thisCall in g_callRoster && g_callRoster[thisCall].message.instance in g_instances - ) { + ) + { if ( g_mapSettings.focusRig && g_activeInstance != g_callRoster[thisCall].message.instance - ) { + ) + { activeRig(g_callRoster[thisCall].message.instance); } - if (g_mapSettings.haltAllOnTx) { + if (g_mapSettings.haltAllOnTx) + { haltAllTx(); } @@ -5264,17 +6026,20 @@ function initiateQso(thisCall) { } } -function spotLookupAndSetCall(spot) { +function spotLookupAndSetCall(spot) +{ var call = g_receptionReports.spots[spot].call; var grid = g_receptionReports.spots[spot].grid; var band = g_receptionReports.spots[spot].band; var mode = g_receptionReports.spots[spot].mode; - for (var instance in g_instances) { + for (var instance in g_instances) + { if ( g_instances[instance].valid && g_instances[instance].status.Band == band && g_instances[instance].status.MO == mode - ) { + ) + { setCallAndGrid(call, grid, instance); return; } @@ -5282,24 +6047,32 @@ function spotLookupAndSetCall(spot) { setCallAndGrid(call, grid, null); } -function setCallAndGrid(callsign, grid, instance = null) { +function setCallAndGrid(callsign, grid, instance = null) +{ var thisInstance = null; var port; var address; - if (instance != null) { - if (instance in g_instances) { + if (instance != null) + { + if (instance in g_instances) + { thisInstance = g_instances[instance].status; port = g_instances[instance].remote.port; address = g_instances[instance].remote.address; - } else alert("major instance error"); - } else { - if (g_instances[g_activeInstance].valid) { + } + else alert("major instance error"); + } + else + { + if (g_instances[g_activeInstance].valid) + { thisInstance = g_instances[g_activeInstance].status; port = g_instances[g_activeInstance].remote.port; address = g_instances[g_activeInstance].remote.address; } } - if (thisInstance && thisInstance.TxEnabled == 0) { + if (thisInstance && thisInstance.TxEnabled == 0) + { var responseArray = Buffer.alloc(1024); var length = 0; length = encodeQUINT32(responseArray, length, thisInstance.magic_key); @@ -5316,7 +6089,7 @@ function setCallAndGrid(callsign, grid, instance = null) { var hash = liveHash(callsign, thisInstance.Band, thisInstance.MO); if (hash in g_liveCallsigns && g_liveCallsigns[hash].grid.length > 1) - grid = g_liveCallsigns[hash].grid; + { grid = g_liveCallsigns[hash].grid; } if (grid.length == 0) grid = " "; @@ -5327,7 +6100,8 @@ function setCallAndGrid(callsign, grid, instance = null) { wsjtUdpMessage(responseArray, responseArray.length, port, address); addLastTraffic("Generated Msgs"); } - if (thisInstance && thisInstance.TxEnabled == 1) { + if (thisInstance && thisInstance.TxEnabled == 1) + { addLastTraffic( "Transmit Enabled!
Generate Msgs Aborted" ); @@ -5347,26 +6121,31 @@ var g_wsjtHandlers = { 9: handleWsjtxNotSupported, 10: handleWsjtxWSPR, 11: handleWsjtxNotSupported, - 12: handleWsjtxADIF, + 12: handleWsjtxADIF }; var g_oldQSOTimer = null; -function handleWsjtxADIF(newMessage) { - if (g_oldQSOTimer) { +function handleWsjtxADIF(newMessage) +{ + if (g_oldQSOTimer) + { clearTimeout(g_oldQSOTimer); g_oldQSOTimer = null; } - if (g_ignoreMessages == 0) { + if (g_ignoreMessages == 0) + { onAdiLoadComplete(newMessage.ADIF); } sendToLogger(newMessage.ADIF); } -function handleWsjtxQSO(newMessage) { - if (g_oldQSOTimer) { +function handleWsjtxQSO(newMessage) +{ + if (g_oldQSOTimer) + { clearTimeout(g_oldQSOTimer); g_oldQSOTimer = null; } @@ -5390,13 +6169,17 @@ var g_localDXcall = ""; var g_countIndex = 0; var g_lastCountIndex = 0; -function rigChange(up) { +function rigChange(up) +{ if (g_activeInstance == "") return; var targetInstance = 0; - if (up) { + if (up) + { targetInstance = g_instances[g_activeInstance].intId + 1; - } else { + } + else + { targetInstance = g_instances[g_activeInstance].intId - 1; if (targetInstance < 0) targetInstance = g_instancesIndex.length - 1; } @@ -5406,9 +6189,12 @@ function rigChange(up) { setRig(targetInstance); } -function setRig(instanceId) { - if (g_instances[g_instancesIndex[instanceId]].valid) { - if (g_lastMapView != null) { +function setRig(instanceId) +{ + if (g_instances[g_instancesIndex[instanceId]].valid) + { + if (g_lastMapView != null) + { g_mapView.animate({ zoom: g_lastMapView.zoom, duration: 100 }); g_mapView.animate({ center: g_lastMapView.LoLa, duration: 100 }); g_lastMapView = null; @@ -5421,9 +6207,12 @@ function setRig(instanceId) { } } -function activeRig(instance) { - if (g_instances[instance].valid) { - if (g_lastMapView != null) { +function activeRig(instance) +{ + if (g_instances[instance].valid) + { + if (g_lastMapView != null) + { g_mapView.animate({ zoom: g_lastMapView.zoom, duration: 100 }); g_mapView.animate({ center: g_lastMapView.LoLa, duration: 100 }); g_lastMapView = null; @@ -5440,50 +6229,62 @@ var g_lastDecodeCallsign = ""; var g_lastTransmitCallsign = {}; var g_lastStatusCallsign = {}; -function handleWsjtxStatus(newMessage) { +function handleWsjtxStatus(newMessage) +{ if (g_ignoreMessages == 1) return; - if (g_callRosterWindowHandle) { - try { + if (g_callRosterWindowHandle) + { + try + { g_callRosterWindowHandle.window.processStatus(newMessage); - } catch (e) {} + } + catch (e) {} } - if (g_activeInstance == "") { + if (g_activeInstance == "") + { g_activeInstance = newMessage.instance; } - if (Object.keys(g_instances).length > 1) { + if (Object.keys(g_instances).length > 1) + { rigWrap.style.display = "block"; - } else { + } + else + { rigWrap.style.display = "none"; } var DXcall = newMessage.DXcall.trim(); - if (DXcall.length > 1) { + if (DXcall.length > 1) + { if (!(newMessage.instance in g_lastTransmitCallsign)) - g_lastTransmitCallsign[newMessage.instance] = ""; + { g_lastTransmitCallsign[newMessage.instance] = ""; } if (!(newMessage.instance in g_lastStatusCallsign)) - g_lastStatusCallsign[newMessage.instance] = ""; + { g_lastStatusCallsign[newMessage.instance] = ""; } if ( lookupOnTx.checked == true && newMessage.Transmitting == 1 && g_lastTransmitCallsign[newMessage.instance] != DXcall - ) { + ) + { openLookupWindow(true); g_lastTransmitCallsign[newMessage.instance] = DXcall; } - if (g_lastStatusCallsign[newMessage.instance] != DXcall) { + if (g_lastStatusCallsign[newMessage.instance] != DXcall) + { g_lastStatusCallsign[newMessage.instance] = DXcall; lookupCallsign(DXcall, newMessage.DXgrid.trim()); } } - if (g_activeInstance == newMessage.instance) { + if (g_activeInstance == newMessage.instance) + { var sp = newMessage.Id.split(" - "); rigDiv.innerHTML = sp[sp.length - 1].substring(0, 18); @@ -5494,25 +6295,30 @@ function handleWsjtxStatus(newMessage) { wsjtxMode.innerHTML = "" + newMessage.MO + ""; myMode = newMessage.MO; myBand = Number(newMessage.Frequency / 1000000).formatBand(); - if (g_lastBand != myBand) { + if (g_lastBand != myBand) + { g_lastBand = myBand; bandChange = true; - if (g_pskBandActivityTimerHandle != null) { + if (g_pskBandActivityTimerHandle != null) + { clearInterval(g_pskBandActivityTimerHandle); g_pskBandActivityTimerHandle = null; } removePaths(); } - if (g_lastMode != myMode) { + if (g_lastMode != myMode) + { g_lastMode = myMode; modeChange = true; - if (g_pskBandActivityTimerHandle != null) { + if (g_pskBandActivityTimerHandle != null) + { clearInterval(g_pskBandActivityTimerHandle); g_pskBandActivityTimerHandle = null; } } if (g_pskBandActivityTimerHandle == null) pskGetBandActivity(); - if (bandChange || modeChange) { + if (bandChange || modeChange) + { goProcessRoster(); redrawGrids(); redrawSpots(); @@ -5540,7 +6346,8 @@ function handleWsjtxStatus(newMessage) { var LL = squareToLatLongAll(myRawGrid); g_mapSettings.latitude = g_myLat = LL.la2 - (LL.la2 - LL.la1) / 2; g_mapSettings.longitude = g_myLon = LL.lo2 - (LL.lo2 - LL.lo1) / 2; - if (myRawGrid != g_lastRawGrid) { + if (myRawGrid != g_lastRawGrid) + { g_lastRawGrid = myRawGrid; } @@ -5548,33 +6355,40 @@ function handleWsjtxStatus(newMessage) { var hash = DXcall + myBand + myMode; - if (hash in g_tracker.worked.call) { + if (hash in g_tracker.worked.call) + { dxCallBoxDiv.className = "DXCallBoxWorked"; } - if (hash in g_tracker.confirmed.call) { + if (hash in g_tracker.confirmed.call) + { dxCallBoxDiv.className = "DXCallBoxConfirmed"; } g_localDXcall = DXcall; localDXcall.innerHTML = DXcall.formatCallsign(); - if (localDXcall.innerHTML.length == 0) { + if (localDXcall.innerHTML.length == 0) + { localDXcall.innerHTML = "-"; g_localDXcall = ""; } localDXGrid.innerHTML = myDXGrid = newMessage.DXgrid.trim(); - if (myDXGrid.length == 0 && hash in g_liveCallsigns) { + if (myDXGrid.length == 0 && hash in g_liveCallsigns) + { localDXGrid.innerHTML = myDXGrid = g_liveCallsigns[hash].grid.substr( 0, 4 ); } - if (localDXGrid.innerHTML.length == 0) { + if (localDXGrid.innerHTML.length == 0) + { localDXGrid.innerHTML = "-"; localDXDistance.innerHTML = " "; localDXAzimuth.innerHTML = " "; - } else { + } + else + { var LL = squareToLatLongAll(myDXGrid); localDXDistance.innerHTML = parseInt( @@ -5596,14 +6410,17 @@ function handleWsjtxStatus(newMessage) { ) ) + "°"; } - if (localDXcall.innerHTML != "-") { + if (localDXcall.innerHTML != "-") + { localDXReport.innerHTML = Number( newMessage.Report.trim() ).formatSignalReport(); if (DXcall.length > 0) - localDXCountry.innerHTML = g_dxccToAltName[callsignToDxcc(DXcall)]; + { localDXCountry.innerHTML = g_dxccToAltName[callsignToDxcc(DXcall)]; } else localDXCountry.innerHTML = " "; - } else { + } + else + { localDXReport.innerHTML = localDXCountry.innerHTML = ""; } myDEcall = newMessage.DEcall; @@ -5611,7 +6428,8 @@ function handleWsjtxStatus(newMessage) { if (myDEGrid.length > 0) setHomeGridsquare(); if (myDEGrid.length > 0) g_appSettings.centerGridsquare = myDEGrid; - if (newMessage.Decoding == 1) { + if (newMessage.Decoding == 1) + { // Decoding dimGridsquare(); fadePaths(); @@ -5620,18 +6438,23 @@ function handleWsjtxStatus(newMessage) { txrxdec.innerHTML = "DECODE"; g_countIndex++; g_weAreDecoding = true; - } else { + } + else + { g_weAreDecoding = false; - if (g_countIndex != g_lastCountIndex) { + if (g_countIndex != g_lastCountIndex) + { g_lastCountIndex = g_countIndex; updateCountStats(); - if (g_appSettings.gtShareEnable == "true") { + if (g_appSettings.gtShareEnable == "true") + { g_gtLiveStatusUpdate = true; g_gtShareCount++; - } else g_gtShareCount = 0; + } + else g_gtShareCount = 0; if (bandChange || modeChange) reloadInfo(bandChange || modeChange); var worker = ""; @@ -5659,7 +6482,8 @@ function handleWsjtxStatus(newMessage) { if ( g_appSettings.gtShareEnable === true && Object.keys(g_spotCollector).length > 0 - ) { + ) + { gtChatSendSpots(g_spotCollector); g_spotCollector = {}; } @@ -5670,23 +6494,29 @@ function handleWsjtxStatus(newMessage) { txrxdec.innerHTML = "RECEIVE"; } - if (newMessage.TxEnabled) { + if (newMessage.TxEnabled) + { if ( g_mapSettings.fitQRZ && (!g_spotsEnabled || g_receptionSettings.mergeSpots) - ) { - if (g_lastMapView == null) { + ) + { + if (g_lastMapView == null) + { g_lastMapView = {}; g_lastMapView.LoLa = g_mapView.getCenter(); g_lastMapView.zoom = g_mapView.getZoom(); } - if (myDXGrid.length > 0) { + if (myDXGrid.length > 0) + { fitViewBetweenPoints([getPoint(myRawGrid), getPoint(myDXGrid)]); - } else if ( + } + else if ( g_mapSettings.qrzDxccFallback && DXcall.length > 0 && callsignToDxcc(DXcall) > 0 - ) { + ) + { var dxcc = callsignToDxcc(DXcall); var Lat = g_worldGeoData[g_dxccToGeoData[dxcc]].lat; var Lon = g_worldGeoData[g_dxccToGeoData[dxcc]].lon; @@ -5696,29 +6526,36 @@ function handleWsjtxStatus(newMessage) { ); } } - } else { - if (g_lastMapView != null) { + } + else + { + if (g_lastMapView != null) + { g_mapView.animate({ zoom: g_lastMapView.zoom, duration: 1200 }); g_mapView.animate({ center: g_lastMapView.LoLa, duration: 1200 }); g_lastMapView = null; } } - if (newMessage.Transmitting == 0) { + if (newMessage.Transmitting == 0) + { // Not Transmitting - g_layerSources["transmit"].clear(); + g_layerSources.transmit.clear(); g_transmitFlightPath = null; - } else { + } + else + { txrxdec.style.backgroundColor = "Red"; txrxdec.style.borderColor = "Orange"; txrxdec.innerHTML = "TRANSMIT"; - g_layerSources["transmit"].clear(); + g_layerSources.transmit.clear(); g_transmitFlightPath = null; if ( qrzPathWidthValue.value != 0 && g_appSettings.gridViewMode != 2 && validateGridFromString(myRawGrid) - ) { + ) + { var strokeColor = getQrzPathColor(); var strokeWeight = qrzPathWidthValue.value; var LL = squareToLatLongAll(myRawGrid); @@ -5727,17 +6564,20 @@ function handleWsjtxStatus(newMessage) { var fromPoint = ol.proj.fromLonLat([Lon, Lat]); var toPoint = null; - if (validateGridFromString(myDXGrid)) { + if (validateGridFromString(myDXGrid)) + { LL = squareToLatLongAll(myDXGrid); Lat = LL.la2 - (LL.la2 - LL.la1) / 2; Lon = LL.lo2 - (LL.lo2 - LL.lo1) / 2; toPoint = ol.proj.fromLonLat([Lon, Lat]); - } else if ( + } + else if ( g_mapSettings.qrzDxccFallback && DXcall.length > 0 && callsignToDxcc(DXcall) > 0 - ) { + ) + { var dxcc = callsignToDxcc(DXcall); Lat = g_worldGeoData[g_dxccToGeoData[dxcc]].lat; Lon = g_worldGeoData[g_dxccToGeoData[dxcc]].lon; @@ -5747,7 +6587,8 @@ function handleWsjtxStatus(newMessage) { var locality = g_worldGeoData[g_dxccToGeoData[dxcc]].geo; if (locality == "deleted") locality = null; - if (locality != null) { + if (locality != null) + { var feature = shapeFeature( "qrz", locality, @@ -5756,18 +6597,19 @@ function handleWsjtxStatus(newMessage) { "#FF0000FF", 1.0 ); - g_layerSources["transmit"].addFeature(feature); + g_layerSources.transmit.addFeature(feature); } } - if (toPoint) { + if (toPoint) + { g_transmitFlightPath = flightFeature( [fromPoint, toPoint], { weight: strokeWeight, color: strokeColor, steps: 75, - zIndex: 90, + zIndex: 90 }, "transmit", true @@ -5786,7 +6628,8 @@ function handleWsjtxStatus(newMessage) { g_appSettings.myRawGrid = myRawGrid; } - if (newMessage.Decoding == 0) { + if (newMessage.Decoding == 0) + { goProcessRoster(); processClassicAlerts(); } @@ -5794,22 +6637,28 @@ function handleWsjtxStatus(newMessage) { var g_lastMapView = null; -function drawTraffic() { +function drawTraffic() +{ while (g_lastTraffic.length > 60) g_lastTraffic.pop(); var worker = g_lastTraffic.join("
"); worker = worker.split("80%'>
").join("80%'>"); if (g_localDXcall.length > 1) + { worker = worker .split(g_localDXcall) .join("" + g_localDXcall + ""); + } if (myRawCall.length > 1) + { worker = worker .split(myRawCall) .join("" + myRawCall + ""); + } trafficDiv.innerHTML = worker; } -function getPoint(grid) { +function getPoint(grid) +{ var LL = squareToLatLongAll(grid); var Lat = LL.la2 - (LL.la2 - LL.la1) / 2; var Lon = LL.lo2 - (LL.lo2 - LL.lo1) / 2; @@ -5817,15 +6666,20 @@ function getPoint(grid) { } var g_showCQRU = true; -function fitViewBetweenPoints(points, maxZoom = 20) { +function fitViewBetweenPoints(points, maxZoom = 20) +{ var start = ol.proj.toLonLat(points[0]); var end = ol.proj.toLonLat(points[1]); - if (Math.abs(start[0] - end[0]) > 180) { + if (Math.abs(start[0] - end[0]) > 180) + { // Wrapped - if (end[0] < start[0]) { + if (end[0] < start[0]) + { start[0] -= 360; - } else { + } + else + { end[0] -= 360; } } @@ -5839,16 +6693,14 @@ function fitViewBetweenPoints(points, maxZoom = 20) { g_mapView.fit(extent, { duration: 500, maxZoom: maxZoom, - padding: [75, 75, 75, 75], + padding: [75, 75, 75, 75] }); - - delete feature; - delete line; } var g_spotCollector = {}; -function handleWsjtxDecode(newMessage) { +function handleWsjtxDecode(newMessage) +{ if (g_ignoreMessages == 1 || g_map == null) return; var didAlert = false; var didCustomAlert = false; @@ -5860,9 +6712,12 @@ function handleWsjtxDecode(newMessage) { var theirQTH = ""; var countryName = ""; var newF; - if (newMessage.OF > 0) { + if (newMessage.OF > 0) + { newF = Number((newMessage.OF + newMessage.DF) / 1000).formatMhz(3, 3); - } else { + } + else + { newF = newMessage.DF; } theTimeStamp = @@ -5874,9 +6729,12 @@ function handleWsjtxDecode(newMessage) { var decodeWords = newMessage.Msg.split(" ").slice(0, 5); while (decodeWords[decodeWords.length - 1] == "") decodeWords.pop(); - if (decodeWords.length > 1 && newMessage.Msg.indexOf("<...>") == -1) { - if (newMessage.Msg.indexOf("<") != -1) { - for (var i in decodeWords) { + if (decodeWords.length > 1 && newMessage.Msg.indexOf("<...>") == -1) + { + if (newMessage.Msg.indexOf("<") != -1) + { + for (var i in decodeWords) + { decodeWords[i] = decodeWords[i].replace("<", "").replace(">", ""); } } @@ -5884,14 +6742,19 @@ function handleWsjtxDecode(newMessage) { var rect = null; // Grab the last word in the decoded message var qth = decodeWords[decodeWords.length - 1].trim(); - if (qth.length == 4) { + if (qth.length == 4) + { var LETTERS = qth.substr(0, 2); var NUMBERS = qth.substr(2, 2); - if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) { + if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) + { theirQTH = LETTERS + NUMBERS; - if (theirQTH != "RR73") { + if (theirQTH != "RR73") + { validQTH = true; - } else { + } + else + { theirQTH = ""; validQTH = false; } @@ -5900,26 +6763,31 @@ function handleWsjtxDecode(newMessage) { if (validQTH) msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); if (validQTH == false && decodeWords.length == 3) - msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); + { msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); } if (validQTH == false && decodeWords.length == 2) - msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); - if (decodeWords[0] == "CQ") { + { msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); } + if (decodeWords[0] == "CQ") + { CQ = true; msgDXcallsign = "CQ"; } - if (decodeWords.length == 4 && CQ == true) { + if (decodeWords.length == 4 && CQ == true) + { msgDXcallsign += " " + decodeWords[1]; } - if (decodeWords.length == 3 && CQ == false) { + if (decodeWords.length == 3 && CQ == false) + { msgDXcallsign = decodeWords[0]; } - if (decodeWords.length >= 3 && CQ == true && validQTH == false) { + if (decodeWords.length >= 3 && CQ == true && validQTH == false) + { if (validateNumAndLetter(decodeWords[decodeWords.length - 1].trim())) - msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); + { msgDEcallsign = decodeWords[decodeWords.length - 1].trim(); } else msgDEcallsign = decodeWords[decodeWords.length - 2].trim(); } - if (decodeWords.length >= 4 && CQ == false) { + if (decodeWords.length >= 4 && CQ == false) + { msgDXcallsign = decodeWords[0]; msgDEcallsign = decodeWords[1]; } @@ -5929,9 +6797,10 @@ function handleWsjtxDecode(newMessage) { var hash = msgDEcallsign + newMessage.OB + newMessage.OM; if (hash in g_liveCallsigns) callsign = g_liveCallsigns[hash]; - if (validQTH == "" && msgDEcallsign in g_gtCallsigns) { + if (validQTH == "" && msgDEcallsign in g_gtCallsigns) + { if (g_gtFlagPins[g_gtCallsigns[msgDEcallsign]].grid.length > 0) - validQTH = g_gtFlagPins[g_gtCallsigns[msgDEcallsign]].grid; + { validQTH = g_gtFlagPins[g_gtCallsigns[msgDEcallsign]].grid; } } var canPath = false; @@ -5943,7 +6812,8 @@ function handleWsjtxDecode(newMessage) { (g_appSettings.gtModeFilter == "auto" && newMessage.OM == myMode) || newMessage.OM == g_appSettings.gtModeFilter || g_appSettings.gtModeFilter == "Digital") - ) { + ) + { rect = qthToBox( theirQTH, msgDEcallsign, @@ -5959,15 +6829,18 @@ function handleWsjtxDecode(newMessage) { canPath = true; } - if (rect != null && theirQTH == "") { + if (rect != null && theirQTH == "") + { theirQTH = rect.qth; } - if (rect) { + if (rect) + { g_liveGrids[theirQTH].age = g_timeNow; } - if (callsign == null) { + if (callsign == null) + { newCallsign = {}; newCallsign.DEcall = msgDEcallsign; newCallsign.grid = theirQTH; @@ -5995,17 +6868,20 @@ function handleWsjtxDecode(newMessage) { newCallsign.phone = false; newCallsign.IOTA = ""; newCallsign.satName = ""; - if (newCallsign.dxcc != -1) { + if (newCallsign.dxcc != -1) + { newCallsign.px = getWpx(newCallsign.DEcall); if (newCallsign.px) + { newCallsign.zone = Number( newCallsign.px.charAt(newCallsign.px.length - 1) ); + } newCallsign.cont = g_worldGeoData[g_dxccToGeoData[newCallsign.dxcc]].continent; if (newCallsign.dxcc == 390 && newCallsign.zone == 1) - details.cont = "EU"; + { details.cont = "EU"; } } newCallsign.ituza = Array(); @@ -6021,7 +6897,8 @@ function handleWsjtxDecode(newMessage) { if ( g_callsignLookups.ulsUseEnable == true && isKnownCallsignDXCC(newCallsign.dxcc) - ) { + ) + { lookupUsCallsign(newCallsign, false); } @@ -6032,11 +6909,15 @@ function handleWsjtxDecode(newMessage) { newCallsign.shouldAlert = false; g_liveCallsigns[hash] = newCallsign; callsign = newCallsign; - } else { - if (validQTH) { + } + else + { + if (validQTH) + { callsign.grid = theirQTH; - if (rect != null && callsign.grid != rect.qth) { + if (rect != null && callsign.grid != rect.qth) + { if ( (g_appSettings.gtBandFilter.length == 0 || (g_appSettings.gtBandFilter == "auto" && @@ -6047,7 +6928,8 @@ function handleWsjtxDecode(newMessage) { newMessage.OM == myMode) || newMessage.OM == g_appSettings.gtModeFilter || g_appSettings.gtModeFilter == "Digital") - ) { + ) + { rect = qthToBox( theirQTH, msgDEcallsign, @@ -6083,7 +6965,8 @@ function handleWsjtxDecode(newMessage) { if (msgDXcallsign == myDEcall) callsign.qrz = true; else callsign.qrz = false; - if (callsign.grid.length > 0 && callsign.distance == 0) { + if (callsign.grid.length > 0 && callsign.distance == 0) + { var LL = squareToLatLongAll(callsign.grid); callsign.distance = MyCircle.distance( g_myLat, @@ -6099,15 +6982,18 @@ function handleWsjtxDecode(newMessage) { LL.lo2 - (LL.lo2 - LL.lo1) / 2 ); - if (callsign.grid in g_gridToITUZone) { + if (callsign.grid in g_gridToITUZone) + { callsign.ituza = g_gridToITUZone[callsign.grid]; } - if (callsign.grid in g_gridToCQZone) { + if (callsign.grid in g_gridToCQZone) + { callsign.cqza = g_gridToCQZone[callsign.grid]; } } - if (newMessage.NW) { + if (newMessage.NW) + { didCustomAlert = processAlertMessage( decodeWords, newMessage.Msg.substr(0, 30).trim(), @@ -6128,12 +7014,15 @@ function handleWsjtxDecode(newMessage) { if ( g_mapSettings.trafficDecode && (didAlert == true || didCustomAlert == true) - ) { + ) + { var traffic = htmlEntities(newMessage.Msg); - if (didAlert == true) { + if (didAlert == true) + { traffic = "⚠️ " + traffic; } - if (didCustomAlert == true) { + if (didCustomAlert == true) + { traffic = traffic + " 🚩"; } @@ -6150,48 +7039,58 @@ function handleWsjtxDecode(newMessage) { g_appSettings.gtSpotEnable === true && g_appSettings.gtSpotEnable === true && callsign.DEcall in g_gtCallsigns - ) { + ) + { if ( g_gtCallsigns[callsign.DEcall] in g_gtFlagPins && g_gtFlagPins[g_gtCallsigns[callsign.DEcall]].o == 1 ) - g_spotCollector[g_gtCallsigns[callsign.DEcall]] = callsign.RSTsent; + { g_spotCollector[g_gtCallsigns[callsign.DEcall]] = callsign.RSTsent; } } } if (callsign.dxcc != -1) countryName = g_dxccToAltName[callsign.dxcc]; - if (canPath == true) { + if (canPath == true) + { if ( callsign.DXcall.indexOf("CQ") < 0 && g_appSettings.gridViewMode != 2 - ) { + ) + { // Nothing special, we know the callers grid - if (callsign.grid != "") { + if (callsign.grid != "") + { // Our msgDEcallsign is not sending a CQ. // Let's see if we can locate who he's talking to in our known list var DEcallsign = null; if ( callsign.DXcall + newMessage.OB + newMessage.OM in g_liveCallsigns - ) { + ) + { DEcallsign = g_liveCallsigns[callsign.DXcall + newMessage.OB + newMessage.OM]; - } else if (callsign.DXcall in g_liveCallsigns) { + } + else if (callsign.DXcall in g_liveCallsigns) + { DEcallsign = g_liveCallsigns[callsign.DXcall]; } - if (DEcallsign != null && DEcallsign.grid != "") { + if (DEcallsign != null && DEcallsign.grid != "") + { var strokeColor = getPathColor(); var strokeWeight = pathWidthValue.value; var flightPath = null; var isQRZ = false; - if (msgDXcallsign == myDEcall) { + if (msgDXcallsign == myDEcall) + { strokeColor = getQrzPathColor(); strokeWeight = qrzPathWidthValue.value; isQRZ = true; } - if (strokeWeight != 0) { + if (strokeWeight != 0) + { var fromPoint = getPoint(callsign.grid); var toPoint = getPoint(DEcallsign.grid); @@ -6201,7 +7100,7 @@ function handleWsjtxDecode(newMessage) { weight: strokeWeight, color: strokeColor, steps: 75, - zIndex: 90, + zIndex: 90 }, "flight", true @@ -6214,11 +7113,13 @@ function handleWsjtxDecode(newMessage) { g_flightPaths.push(flightPath); } } - } else if ( + } + else if ( g_mapSettings.qrzDxccFallback && msgDXcallsign == myDEcall && callsign.dxcc > 0 - ) { + ) + { // the caller is calling us, but they don't have a grid, so lookup the DXCC and show it var strokeColor = getQrzPathColor(); var strokeWeight = qrzPathWidthValue.value; @@ -6226,7 +7127,8 @@ function handleWsjtxDecode(newMessage) { var isQRZ = true; var DEcallsign = g_liveCallsigns[myDEcall]; - if (strokeWeight != 0) { + if (strokeWeight != 0) + { var toPoint = getPoint(DEcallsign.grid); var Lat = g_worldGeoData[g_dxccToGeoData[callsign.dxcc]].lat; @@ -6239,7 +7141,7 @@ function handleWsjtxDecode(newMessage) { weight: strokeWeight, color: strokeColor, steps: 75, - zIndex: 90, + zIndex: 90 }, "flight", true @@ -6262,42 +7164,50 @@ function handleWsjtxDecode(newMessage) { feature.age = g_timeNow + g_flightDuration; feature.isShapeFlight = 1; feature.isQRZ = isQRZ; - g_layerSources["flight"].addFeature(feature); + g_layerSources.flight.addFeature(feature); g_flightPaths.push(feature); } } - } else if ( + } + else if ( g_mapSettings.CQhilite && msgDXcallsign.indexOf("CQ ") == 0 && callsign.grid != "" && g_appSettings.gridViewMode != 2 && pathWidthValue.value != 0 - ) { + ) + { var CCd = msgDXcallsign.replace("CQ ", "").split(" ")[0]; - if (CCd.length < 5 && !(CCd in g_pathIgnore)) { + if (CCd.length < 5 && !(CCd in g_pathIgnore)) + { var locality = null; // Direct lookup US states, Continents, possibly if (CCd in g_replaceCQ) CCd = g_replaceCQ[CCd]; - if (CCd.length == 2 && CCd in g_shapeData) { + if (CCd.length == 2 && CCd in g_shapeData) + { locality = g_shapeData[CCd]; - } else if (CCd.length == 3) { + } + else if (CCd.length == 3) + { // maybe it's DEL, or WYO. check the first two letters if (CCd.substr(0, 2) in g_shapeData) - locality = g_shapeData[CCd.substr(0, 2)]; + { locality = g_shapeData[CCd.substr(0, 2)]; } } - if (locality == null) { + if (locality == null) + { // Check the prefix for dxcc direct var dxcc = callsignToDxcc(CCd); - if (dxcc != -1) { + if (dxcc != -1) + { locality = g_worldGeoData[g_dxccToGeoData[dxcc]].geo; if (locality == "deleted") locality = null; - } else { } } - if (locality != null) { + if (locality != null) + { var strokeColor = getPathColor(); var strokeWeight = pathWidthValue.value; var flightPath = null; @@ -6314,7 +7224,7 @@ function handleWsjtxDecode(newMessage) { feature.age = g_timeNow + g_flightDuration; feature.isShapeFlight = 1; feature.isQRZ = false; - g_layerSources["flight"].addFeature(feature); + g_layerSources.flight.addFeature(feature); g_flightPaths.push(feature); var fromPoint = getPoint(callsign.grid); @@ -6326,7 +7236,7 @@ function handleWsjtxDecode(newMessage) { weight: strokeWeight, color: strokeColor, steps: 75, - zIndex: 90, + zIndex: 90 }, "flight", true @@ -6370,7 +7280,8 @@ function handleWsjtxDecode(newMessage) { while (g_lastMessages.length > 100) g_lastMessages.pop(); } -function addLastTraffic(traffic) { +function addLastTraffic(traffic) +{ g_lastTraffic.unshift(traffic); g_lastTraffic.unshift( "
" @@ -6378,7 +7289,8 @@ function addLastTraffic(traffic) { drawTraffic(); } -function htmlEntities(str) { +function htmlEntities(str) +{ return String(str) .replace(/&/g, "&") .replace(/ 300) { + for (var call in g_callRoster) + { + if (now - g_callRoster[call].callObj.age > 300) + { g_callRoster[call].callObj.alerted = false; g_callRoster[call].callObj.shouldAlert = false; delete g_callRoster[call]; continue; } } - if (g_callRosterWindowHandle) { - try { - if (isRealtime == true) { + if (g_callRosterWindowHandle) + { + try + { + if (isRealtime == true) + { if (g_callRosterWindowHandle.window.g_rosterSettings.realtime == false) - return; + { return; } } g_callRosterWindowHandle.window.processRoster(g_callRoster); - } catch (e) {} + } + catch (e) {} } } -function handleClosed(newMessage) { +function handleClosed(newMessage) +{ if ( g_activeInstance == newMessage.Id && g_instances[newMessage.Id].open == false - ) { + ) + { txrxdec.style.backgroundColor = "Purple"; txrxdec.style.borderColor = "Purple"; var name = newMessage.Id.toUpperCase().split(" - "); @@ -6469,14 +7394,16 @@ function handleClosed(newMessage) { } } -function handleWsjtxClose(newMessage) { +function handleWsjtxClose(newMessage) +{ updateCountStats(); g_instances[newMessage.Id].open = false; handleClosed(newMessage); updateRosterInstances(); } -function handleWsjtxWSPR(newMessage) { +function handleWsjtxWSPR(newMessage) +{ if (g_ignoreMessages == 1) return; addDeDx( @@ -6514,43 +7441,50 @@ function handleWsjtxWSPR(newMessage) { updateCountStats(); } -function centerOn(grid) { - if (grid.length >= 4) { +function centerOn(grid) +{ + if (grid.length >= 4) + { var LL = squareToLatLong(grid); g_map .getView() .setCenter( ol.proj.fromLonLat([ LL.lo2 - (LL.lo2 - LL.lo1) / 2, - LL.la2 - (LL.la2 - LL.la1) / 2, + LL.la2 - (LL.la2 - LL.la1) / 2 ]) ); } } -function setCenterQTH() { - if (homeQTHInput.value.length >= 4) { +function setCenterQTH() +{ + if (homeQTHInput.value.length >= 4) + { g_appSettings.centerGridsquare = homeQTHInput.value; // Grab home QTH Gridsquare from Center QTH var LL = squareToLatLong(homeQTHInput.value); - //panTo(ol.proj.fromLonLat([LL.lo2 - (LL.lo2 - LL.lo1) / 2, LL.la2 - ((LL.la2 - LL.la1) / 2)])); + // panTo(ol.proj.fromLonLat([LL.lo2 - (LL.lo2 - LL.lo1) / 2, LL.la2 - ((LL.la2 - LL.la1) / 2)])); g_map .getView() .setCenter( ol.proj.fromLonLat([ LL.lo2 - (LL.lo2 - LL.lo1) / 2, - LL.la2 - (LL.la2 - LL.la1) / 2, + LL.la2 - (LL.la2 - LL.la1) / 2 ]) ); - } else { + } + else + { homeQTHInput.value = ""; - return; } } -function setCenterGridsquare() { - if (g_mapMemory[6].zoom != -1) { +function setCenterGridsquare() +{ + if (g_mapMemory[6].zoom != -1) + { mapMemory(6, false); return; } @@ -6558,22 +7492,28 @@ function setCenterGridsquare() { setCenterQTH(); } -function changeLookupMerge() { +function changeLookupMerge() +{ g_appSettings.lookupMerge = lookupMerge.checked; g_appSettings.lookupMissingGrid = lookupMissingGrid.checked; - if (g_appSettings.lookupMerge == true) { + if (g_appSettings.lookupMerge == true) + { lookupMissingGridDiv.style.display = "inline-block"; - } else { + } + else + { lookupMissingGridDiv.style.display = "none"; } } -function changelookupOnTx() { +function changelookupOnTx() +{ g_appSettings.lookupOnTx = lookupOnTx.checked; g_appSettings.lookupCloseLog = lookupCloseLog.checked; } -function exportSettings() { +function exportSettings() +{ var filename = g_appData + g_dirSeperator + "gt_settings.json"; var toWrite = JSON.stringify(localStorage); @@ -6582,40 +7522,53 @@ function exportSettings() { checkForSettings(); } -function checkForSettings() { +function checkForSettings() +{ var filename = g_appData + g_dirSeperator + "gt_settings.json"; - if (fs.existsSync(filename)) { + if (fs.existsSync(filename)) + { importSettingsButton.style.display = "inline-block"; importSettingsFile.style.display = "inline-block"; importSettingsFile.innerHTML = filename; - } else { + } + else + { importSettingsButton.style.display = "none"; importSettingsFile.style.display = "none"; } } -function importSettings() { +function importSettings() +{ checkForSettings(); var filename = g_appData + g_dirSeperator + "gt_settings.json"; - if (fs.existsSync(filename)) { + if (fs.existsSync(filename)) + { var data = fs.readFileSync(filename); data = JSON.parse(data); if ( typeof data.appSettings != "undefined" && data.currentVersion == localStorage.currentVersion - ) { + ) + { localStorage.clear(); - for (var key in data) { + for (var key in data) + { localStorage[key] = data[key]; } fs.unlinkSync(filename); chrome.runtime.reload(); - } else { - if (typeof data.appSettings == "undefined") { + } + else + { + if (typeof data.appSettings == "undefined") + { importSettingsFile.innerHTML = "Settings File Corrupt!"; - } else if (data.currentVersion != localStorage.currentVersion) { + } + else if (data.currentVersion != localStorage.currentVersion) + { importSettingsFile.innerHTML = "Settings Version Mismatch!"; } @@ -6623,29 +7576,34 @@ function importSettings() { } } -function showCallsignBox(redraw) { +function showCallsignBox(redraw) +{ var worker = "
Callsigns and DXCC Heard

"; g_newCallsignCount = Object.keys(g_liveCallsigns).length; - if (g_newCallsignCount > 0) { + if (g_newCallsignCount > 0) + { var newCallList = Array(); worker += "
"; //"; + "px;'>
CallsignGridDXCCCQITUFlagQSOQSLWhenITUzCQzISO
"; // "; if (g_callsignLookups.lotwUseEnable == true) worker += ""; if (g_callsignLookups.eqslUseEnable == true) worker += ""; if (g_callsignLookups.oqrsUseEnable == true) worker += ""; g_lastCallsignCount = g_newCallsignCount; - for (var x in g_liveCallsigns) { - if (g_liveCallsigns[x].dxcc != -1) { + for (var x in g_liveCallsigns) + { + if (g_liveCallsigns[x].dxcc != -1) + { newCallList.push(g_liveCallsigns[x]); } } newCallList.sort(compareCallsignTime).reverse(); - for (var x in newCallList) { + for (var x in newCallList) + { if (newCallList[x].DEcall == myRawCall) continue; var grid = newCallList[x].rect ? newCallList[x].rect.qth : "-"; var cqzone = @@ -6657,7 +7615,7 @@ function showCallsignBox(redraw) { worker += ""; var ageString = ""; if (timeNowSec() - newCallList[x].time < 3601) - ageString = (timeNowSec() - newCallList[x].time).toDHMS(); - else { + { ageString = (timeNowSec() - newCallList[x].time).toDHMS(); } + else + { ageString = userTimeString(newCallList[x].time * 1000); } worker += ""; if (g_callsignLookups.lotwUseEnable == true) + { worker += ""; + } if (g_callsignLookups.eqslUseEnable == true) + { worker += ""; + } if (g_callsignLookups.oqrsUseEnable == true) + { worker += ""; + } worker += ""; } worker += "
CallsignGridDXCCCQITUFlagQSOQSLWhenITUzCQzISOLoTWeQSLOQRS
" + thisCall + @@ -6681,26 +7639,33 @@ function showCallsignBox(redraw) { "" + ageString + "" + (thisCall in g_lotwCallsigns ? "✔" : "") + "" + (thisCall in g_eqslCallsigns ? "✔" : "") + "" + (thisCall in g_oqrsCallsigns ? "✔" : "") + "
"; @@ -6708,9 +7673,12 @@ function showCallsignBox(redraw) { var heard = 0; var List = {}; - if (Object.keys(g_dxccCount).length > 0) { - for (var key in g_dxccCount) { - if (key != -1) { + if (Object.keys(g_dxccCount).length > 0) + { + for (var key in g_dxccCount) + { + if (key != -1) + { var item = {}; item.total = g_dxccCount[key]; item.confirmed = g_worldGeoData[g_dxccToGeoData[key]].confirmed; @@ -6732,7 +7700,8 @@ function showCallsignBox(redraw) { ")
NameFlagCalls
" + key + "⇦ "; - 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"); + 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) { + } + catch (e) + { console.log(e); } } -function statsValidateCallByElement(elementString) { +function statsValidateCallByElement(elementString) +{ if ( g_statsWindowHandle != null && typeof g_statsWindowHandle.window.validateCallByElement !== "undefined" - ) { + ) + { g_statsWindowHandle.window.validateCallByElement(elementString); } } -function statsFocus(selection) { +function statsFocus(selection) +{ if ( g_statsWindowHandle != null && typeof g_statsWindowHandle.window.statsFocus !== "undefined" - ) { + ) + { g_statsWindowHandle.window.statsFocus(selection); } } -function lookupValidateCallByElement(elementString) { +function lookupValidateCallByElement(elementString) +{ if ( g_lookupWindowHandle != null && typeof g_statsWindowHandle.window.validateCallByElement !== "undefined" - ) { + ) + { g_lookupWindowHandle.window.validateCallByElement(elementString); } } -function lookupFocus(selection) { +function lookupFocus(selection) +{ if ( g_lookupWindowHandle != null && typeof g_statsWindowHandle.window.statsFocus !== "undefined" - ) { + ) + { g_lookupWindowHandle.window.statsFocus(selection); } } -function statsAppendChild(elementString, object, onInputString, defaultValue) { +function statsAppendChild(elementString, object, onInputString, defaultValue) +{ if ( g_statsWindowHandle != null && typeof g_statsWindowHandle.window.appendToChild !== "undefined" - ) { + ) + { g_statsWindowHandle.window.appendToChild( elementString, object, @@ -7359,135 +8419,146 @@ function statsAppendChild(elementString, object, onInputString, defaultValue) { ); } } -function showDXCCsBox() { +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) { - 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; + 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() { +function showCQzoneBox() +{ var worker = getCurrentBandModeHTML(); worker += @@ -7498,7 +8569,8 @@ function showCQzoneBox() { setStatsDiv("cqzoneListDiv", worker); } -function showITUzoneBox() { +function showITUzoneBox() +{ var worker = getCurrentBandModeHTML(); worker += @@ -7509,7 +8581,8 @@ function showITUzoneBox() { setStatsDiv("ituzoneListDiv", worker); } -function showWASWACzoneBox() { +function showWASWACzoneBox() +{ var worker = getCurrentBandModeHTML(); worker += @@ -7525,18 +8598,23 @@ function showWASWACzoneBox() { setStatsDiv("waswacListDiv", worker); } -function displayItemList(table, color) { +function displayItemList(table, color) +{ var worked = 0; var needed = 0; var confirmed = 0; - for (var key in table) { - if (table[key].worked == true) { + for (var key in table) + { + if (table[key].worked == true) + { worked++; } - if (table[key].confirmed == true) { + if (table[key].confirmed == true) + { confirmed++; } - if (table[key].confirmed == false && table[key].worked == false) { + if (table[key].confirmed == false && table[key].worked == false) + { needed++; } } @@ -7563,13 +8641,19 @@ function displayItemList(table, color) { Object.keys(table) .sort() - .forEach(function (key, i) { + .forEach(function (key, i) + { var style; - if (table[key].confirmed == true) { + if (table[key].confirmed == true) + { style = "color:" + color + ";" + confirmed; - } else if (table[key].worked == true) { + } + else if (table[key].worked == true) + { style = "color:" + color + ";" + unconf; - } else { + } + else + { // needed style = "color:#000000;background-color:" + color + ";" + bold; } @@ -7580,20 +8664,21 @@ function displayItemList(table, color) { return worker; } -function showWPXBox() { +function showWPXBox() +{ var worker = getCurrentBandModeHTML(); var band = g_appSettings.gtBandFilter == "auto" ? myBand : g_appSettings.gtBandFilter.length == 0 - ? "" - : g_appSettings.gtBandFilter; + ? "" + : g_appSettings.gtBandFilter; var mode = g_appSettings.gtModeFilter == "auto" ? myMode : g_appSettings.gtModeFilter.length == 0 - ? "" - : g_appSettings.gtModeFilter; + ? "" + : g_appSettings.gtModeFilter; if (mode == "Digital") mode = "dg"; if (mode == "Phone") mode = "ph"; @@ -7604,20 +8689,24 @@ function showWPXBox() { var List = {}; var ListConfirmed = {}; - for (var key in g_tracker.worked.px) { + for (var key in g_tracker.worked.px) + { if ( typeof g_tracker.worked.px[key] == "string" && key + modifier in g_tracker.worked.px - ) { + ) + { List[key] = key; } } - for (var key in g_tracker.confirmed.px) { + for (var key in g_tracker.confirmed.px) + { if ( typeof g_tracker.confirmed.px[key] == "string" && key + modifier in g_tracker.confirmed.px - ) { + ) + { ListConfirmed[key] = key; } } @@ -7625,7 +8714,8 @@ function showWPXBox() { worked = Object.keys(List).length; confirmed = Object.keys(ListConfirmed).length; - if (worked > 0) { + if (worked > 0) + { worker += "
Worked Prefixes (" + worked + @@ -7636,7 +8726,8 @@ function showWPXBox() { "px;'>"; Object.keys(List) .sort() - .forEach(function (key, i) { + .forEach(function (key, i) + { worker += ""; + if (Object.keys(g_blockedDxcc).length > 0) + { + clearString = + ""; + } + worker += + "
" + key.formatCallsign() + @@ -7649,7 +8740,8 @@ function showWPXBox() { worker += ""; } - if (confirmed > 0) { + if (confirmed > 0) + { worker += "
Confirmed Prefixes (" + confirmed + @@ -7660,7 +8752,8 @@ function showWPXBox() { "px;'>"; Object.keys(ListConfirmed) .sort() - .forEach(function (key, i) { + .forEach(function (key, i) + { worker += ""; - for (var key in AwardNames) { + for (var key in AwardNames) + { scoreSection = "Award " + AwardNames[key][1]; var infoObject = output[AwardNames[key][0]]; worker += ""; @@ -8412,7 +9626,8 @@ function renderStatsBox() { infoObject.worked_high + ")"; - if (infoObject.confirmed_high_key) { + if (infoObject.confirmed_high_key) + { worker += ""; - } else worker += ""; + } + else worker += ""; worker += ""; } @@ -8443,7 +9659,8 @@ function renderStatsBox() { g_QSOhash[long_distance.worked_hash].grid + ""; - if (long_distance.confirmed_hash && long_distance.confirmed_unit > 0) { + if (long_distance.confirmed_hash && long_distance.confirmed_unit > 0) + { worker += ""; - } else worker += ""; + } + else worker += ""; scoreSection = "Short Distance"; @@ -8476,7 +9694,8 @@ function renderStatsBox() { g_QSOhash[short_distance.worked_hash].grid + ""; - if (short_distance.confirmed_hash && short_distance.confirmed_unit > 0) { + if (short_distance.confirmed_hash && short_distance.confirmed_unit > 0) + { worker += ""; - } else worker += ""; + } + else worker += ""; worker += ""; worker += "
" + key.formatCallsign() + @@ -7676,36 +8769,44 @@ function showWPXBox() { setStatsDiv("wpxListDiv", worker); } -function showRootInfoBox() { +function showRootInfoBox() +{ openStatsWindow(); - return; } -function showSettingsBox() { - { - updateRunningProcesses(); - helpDiv.style.display = "none"; - g_helpShow = false; - rootSettingsDiv.style.display = "inline-block"; - } +function showSettingsBox() +{ + updateRunningProcesses(); + helpDiv.style.display = "none"; + g_helpShow = false; + rootSettingsDiv.style.display = "inline-block"; } -function toggleBaWindow(event) { +function toggleBaWindow(event) +{ event.preventDefault(); - if (g_baWindowHandle == null) { + if (g_baWindowHandle == null) + { openBaWindow(true); - } else { - if (g_baWindowHandle.window.g_isShowing == true) { + } + else + { + if (g_baWindowHandle.window.g_isShowing == true) + { openBaWindow(false); - } else { + } + else + { openBaWindow(true); } } } -function openBaWindow(show = true) { - if (g_baWindowHandle == null) { +function openBaWindow(show = true) +{ + if (g_baWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( @@ -7715,14 +8816,17 @@ function openBaWindow(show = true) { id: "GT-baac", frame: false, resizable: true, - always_on_top: true, + always_on_top: true }, - function (new_win) { + function (new_win) + { g_baWindowHandle = new_win; - new_win.on("loaded", function () { + new_win.on("loaded", function () + { g_baWindowHandle.setMinimumSize(198, 52); }); - new_win.on("close", function () { + new_win.on("close", function () + { g_baWindowHandle.window.g_isShowing = false; g_baWindowHandle.window.saveScreenSettings(); g_baWindowHandle.hide(); @@ -7730,23 +8834,32 @@ function openBaWindow(show = true) { } ); lockNewWindows(); - } else { - try { - if (show == true) { + } + else + { + try + { + if (show == true) + { g_baWindowHandle.show(); g_baWindowHandle.window.g_isShowing = true; g_baWindowHandle.window.saveScreenSettings(); - } else { + } + else + { g_baWindowHandle.window.g_isShowing = false; g_baWindowHandle.window.saveScreenSettings(); g_baWindowHandle.hide(); } - } catch (e) {} + } + catch (e) {} } } -function openLookupWindow(show = false) { - if (g_lookupWindowHandle == null) { +function openLookupWindow(show = false) +{ + if (g_lookupWindowHandle == null) + { popupNewWindows(); var gui = require("nw.gui"); gui.Window.open( @@ -7754,15 +8867,18 @@ function openLookupWindow(show = false) { { show: false, id: "GT-lookups", - icon: "img/lookup-icon.png", + icon: "img/lookup-icon.png" }, - function (new_win) { + function (new_win) + { g_lookupWindowHandle = new_win; - new_win.on("loaded", function () { + new_win.on("loaded", function () + { g_lookupWindowHandle.setMinimumSize(680, 200); g_lookupWindowHandle.setResizable(true); }); - new_win.on("close", function () { + new_win.on("close", function () + { g_lookupWindowHandle.window.g_isShowing = false; g_lookupWindowHandle.window.saveScreenSettings(); g_lookupWindowHandle.hide(); @@ -7770,39 +8886,50 @@ function openLookupWindow(show = false) { } ); lockNewWindows(); - } else { - try { - if (show) { + } + else + { + try + { + if (show) + { g_lookupWindowHandle.show(); g_lookupWindowHandle.window.g_isShowing = true; g_lookupWindowHandle.window.saveScreenSettings(); - } else { + } + else + { g_lookupWindowHandle.hide(); g_lookupWindowHandle.window.g_isShowing = false; g_lookupWindowHandle.window.saveScreenSettings(); } - } catch (e) {} + } + catch (e) {} } } -function openInfoTab(evt, tabName, callFunc, callObj) { +function openInfoTab(evt, tabName, callFunc, callObj) +{ openStatsWindow(); - if (g_statsWindowHandle != null) { + if (g_statsWindowHandle != null) + { // Declare all variables var i, infoTabcontent, infoTablinks; // Get all elements with class="infoTabcontent" and hide them infoTabcontent = g_statsWindowHandle.window.document.getElementsByClassName( "infoTabcontent" ); - for (i = 0; i < infoTabcontent.length; i++) { + for (i = 0; i < infoTabcontent.length; i++) + { infoTabcontent[i].style.display = "none"; } // Get all elements with class="infoTablinks" and remove the class "active" infoTablinks = g_statsWindowHandle.window.document.getElementsByClassName( "infoTablinks" ); - for (i = 0; i < infoTablinks.length; i++) { + for (i = 0; i < infoTablinks.length; i++) + { infoTablinks[i].className = infoTablinks[i].className.replace( " active", "" @@ -7813,33 +8940,39 @@ function openInfoTab(evt, tabName, callFunc, callObj) { g_statsWindowHandle.window.document.getElementById(tabName).style.display = "block"; - if (evt) { + if (evt) + { evt = g_statsWindowHandle.window.document.getElementById(evt); } - if (evt) { + if (evt) + { if (typeof evt.currentTarget != "undefined") - evt.currentTarget.className += " active"; + { evt.currentTarget.className += " active"; } else evt.className += " active"; } - if (callFunc) { + if (callFunc) + { if (callObj) callFunc(callObj); else callFunc(); } } } -function openSettingsTab(evt, tabName) { +function openSettingsTab(evt, tabName) +{ // Declare all variables var i, settingsTabcontent, settingsTablinks; // Get all elements with class="settingsTabcontent" and hide them settingsTabcontent = document.getElementsByClassName("settingsTabcontent"); - for (i = 0; i < settingsTabcontent.length; i++) { + for (i = 0; i < settingsTabcontent.length; i++) + { settingsTabcontent[i].style.display = "none"; } // Get all elements with class="settingsTablinks" and remove the class "active" settingsTablinks = document.getElementsByClassName("settingsTablinks"); - for (i = 0; i < settingsTablinks.length; i++) { + for (i = 0; i < settingsTablinks.length; i++) + { settingsTablinks[i].className = settingsTablinks[i].className.replace( " active", "" @@ -7849,25 +8982,28 @@ function openSettingsTab(evt, tabName) { // Show the current tab, and add an "active" class to the button that opened the tab document.getElementById(tabName).style.display = "block"; if (typeof evt.currentTarget != "undefined") - evt.currentTarget.className += " active"; + { evt.currentTarget.className += " active"; } else evt.className += " active"; } -function setGridMode(mode) { +function setGridMode(mode) +{ g_appSettings.sixWideMode = mode; modeImg.src = g_maidenheadModeImageArray[g_appSettings.sixWideMode]; clearTempGrids(); redrawGrids(); } -function toggleGridMode() { +function toggleGridMode() +{ g_appSettings.sixWideMode ^= 1; modeImg.src = g_maidenheadModeImageArray[g_appSettings.sixWideMode]; clearTempGrids(); redrawGrids(); } -function newStatObject() { +function newStatObject() +{ var statObject = {}; statObject.worked = 0; statObject.confirmed = 0; @@ -7880,7 +9016,8 @@ function newStatObject() { return statObject; } -function newStatCountObject() { +function newStatCountObject() +{ var statCountObject = {}; statCountObject.worked = 0; @@ -7900,7 +9037,8 @@ function newStatCountObject() { return statCountObject; } -function newDistanceObject(start = 0) { +function newDistanceObject(start = 0) +{ var distance = {}; distance.worked_unit = start; distance.worked_hash = ""; @@ -7909,7 +9047,8 @@ function newDistanceObject(start = 0) { return distance; } -function newModeType() { +function newModeType() +{ var modeType = {}; modeType.worked = 0; modeType.confirmed = 0; @@ -7919,24 +9058,29 @@ function newModeType() { var g_statBoxTimer = null; -function showStatBox(resize) { +function showStatBox(resize) +{ var count = Object.keys(g_QSOhash).length; - if (typeof resize != "undefined" && resize) { + if (typeof resize != "undefined" && resize) + { setStatsDivHeight("statViewDiv", getStatsWindowHeight() + 29 + "px"); return; } if (g_statBoxTimer) clearTimeout(g_statBoxTimer); - if (count > 0) { + if (count > 0) + { setStatsDiv( "statViewDiv", " 
...Parsing Log Entries...
 " ); setStatsDivHeight("statViewDiv", "auto"); g_statBoxTimer = setTimeout(renderStatsBox, 250); - } else { + } + else + { setStatsDiv( "statViewDiv", " 
No log entries available, load one or more ADIF logs
 " @@ -7945,8 +9089,10 @@ function showStatBox(resize) { } } -function getTypeFromMode(mode) { - if (mode in g_modes) { +function getTypeFromMode(mode) +{ + if (mode in g_modes) + { if (g_modes[mode] == true) return "Digital"; else if (g_modes_phone[mode] == true) return "Phone"; else if (mode == "CW") return "CW"; @@ -7954,34 +9100,40 @@ function getTypeFromMode(mode) { return "Other"; } -function workObject(obj, count, band, mode, type, didConfirm) { +function workObject(obj, count, band, mode, type, didConfirm) +{ obj.worked++; obj.worked_bands[band] = ~~obj.worked_bands[band] + 1; obj.worked_modes[mode] = ~~obj.worked_modes[mode] + 1; - if (!count) { - obj.worked_types["Mixed"] = ~~obj.worked_modes["Mixed"] + 1; + if (!count) + { + obj.worked_types.Mixed = ~~obj.worked_modes.Mixed + 1; if (type) obj.worked_types[type] = ~~obj.worked_modes[type] + 1; } - if (didConfirm) { + if (didConfirm) + { obj.confirmed++; obj.confirmed_bands[band] = ~~obj.confirmed_bands[band] + 1; obj.confirmed_modes[mode] = ~~obj.confirmed_modes[mode] + 1; - if (!count) { - obj.confirmed_types["Mixed"] = ~~obj.confirmed_types["Mixed"] + 1; + if (!count) + { + obj.confirmed_types.Mixed = ~~obj.confirmed_types.Mixed + 1; if (type) obj.confirmed_types[type] = ~~obj.confirmed_types[type] + 1; } } return obj; } -function renderStatsBox() { +function renderStatsBox() +{ var worker = ""; var scoreSection = "Initial"; - try { + try + { var worldGeoData = {}; var cqZones = {}; var ituZones = {}; @@ -8017,7 +9169,8 @@ function renderStatsBox() { scoreSection = "QSO"; - for (var i in g_QSOhash) { + for (var i in g_QSOhash) + { var finalGrid = g_QSOhash[i].grid; var didConfirm = g_QSOhash[i].confirmed; var band = g_QSOhash[i].band; @@ -8040,29 +9193,40 @@ function renderStatsBox() { details.callsigns[call] = ~~details.callsigns[call] + 1; if (g_QSOhash[i].time < details.oldest) - details.oldest = g_QSOhash[i].time; + { details.oldest = g_QSOhash[i].time; } if (g_QSOhash[i].time > details.newest) - details.newest = g_QSOhash[i].time; + { details.newest = g_QSOhash[i].time; } workObject(modet.Mixed, true, band, mode, type, didConfirm); - if (mode in g_modes) { - if (g_modes[mode] == true) { + if (mode in g_modes) + { + if (g_modes[mode] == true) + { workObject(modet.Digital, true, band, mode, type, didConfirm); - } else if (g_modes_phone[mode] == true) { + } + else if (g_modes_phone[mode] == true) + { workObject(modet.Phone, true, band, mode, type, didConfirm); - } else if (mode == "CW") { + } + else if (mode == "CW") + { workObject(modet.CW, true, band, mode, type, didConfirm); - } else workObject(modet.Other, true, band, mode, type, didConfirm); - } else workObject(modet.Other, true, band, mode, type, didConfirm); + } + else workObject(modet.Other, true, band, mode, type, didConfirm); + } + else workObject(modet.Other, true, band, mode, type, didConfirm); - if (state != null && isKnownCallsignUS(finalDxcc)) { + if (state != null && isKnownCallsignUS(finalDxcc)) + { if (state.substr(0, 2) != "US") state = "US-" + state; - if (state in g_StateData) { + if (state in g_StateData) + { var name = g_StateData[state].name; - if (name in g_wasZones) { + if (name in g_wasZones) + { if (!(name in wasZones)) wasZones[name] = newStatObject(); workObject(wasZones[name], false, band, mode, type, didConfirm); @@ -8070,29 +9234,36 @@ function renderStatsBox() { } } - if (wpx != null) { + if (wpx != null) + { if (!(wpx in wpxData)) wpxData[wpx] = newStatObject(); workObject(wpxData[wpx], false, band, mode, type, didConfirm); } - if (who in g_gtCallsigns) { + if (who in g_gtCallsigns) + { if (!(i in gtData)) gtData[i] = newStatObject(); gtData[i] = true; } - if (cnty != null) { - if (cnty in g_cntyToCounty) { + if (cnty != null) + { + if (cnty in g_cntyToCounty) + { if (!(cnty in countyData)) countyData[cnty] = newStatObject(); workObject(countyData[cnty], false, band, mode, type, didConfirm); } } - if (cont != null) { - if (cont in g_shapeData) { + if (cont != null) + { + if (cont in g_shapeData) + { var name = g_shapeData[cont].properties.name; - if (name in g_wacZones) { + if (name in g_wacZones) + { if (!(name in wacZones)) wacZones[name] = newStatObject(); workObject(wacZones[name], false, band, mode, type, didConfirm); @@ -8100,7 +9271,8 @@ function renderStatsBox() { } } - if (finalGrid.length > 0) { + if (finalGrid.length > 0) + { LL = squareToLatLongAll(finalGrid); unit = parseInt( MyCircle.distance( @@ -8112,91 +9284,110 @@ function renderStatsBox() { ) * MyCircle.validateRadius(distanceUnit.value) ); - if (unit > long_distance.worked_unit) { + if (unit > long_distance.worked_unit) + { long_distance.worked_unit = unit; long_distance.worked_hash = i; } if (!(band in long_distance.band)) - long_distance.band[band] = newDistanceObject(); + { long_distance.band[band] = newDistanceObject(); } if (!(mode in long_distance.mode)) - long_distance.mode[mode] = newDistanceObject(); + { long_distance.mode[mode] = newDistanceObject(); } if (!(type in long_distance.type)) - long_distance.type[type] = newDistanceObject(); + { long_distance.type[type] = newDistanceObject(); } - if (unit > long_distance.mode[mode].worked_unit) { + if (unit > long_distance.mode[mode].worked_unit) + { long_distance.mode[mode].worked_unit = unit; long_distance.mode[mode].worked_hash = i; } - if (unit > long_distance.band[band].worked_unit) { + if (unit > long_distance.band[band].worked_unit) + { long_distance.band[band].worked_unit = unit; long_distance.band[band].worked_hash = i; } - if (unit > long_distance.type[type].worked_unit) { + if (unit > long_distance.type[type].worked_unit) + { long_distance.type[type].worked_unit = unit; long_distance.type[type].worked_hash = i; } - if (didConfirm) { - if (unit > long_distance.confirmed_unit) { + if (didConfirm) + { + if (unit > long_distance.confirmed_unit) + { long_distance.confirmed_unit = unit; long_distance.confirmed_hash = i; } - if (unit > long_distance.mode[mode].confirmed_unit) { + if (unit > long_distance.mode[mode].confirmed_unit) + { long_distance.mode[mode].confirmed_unit = unit; long_distance.mode[mode].confirmed_hash = i; } - if (unit > long_distance.band[band].confirmed_unit) { + if (unit > long_distance.band[band].confirmed_unit) + { long_distance.band[band].confirmed_unit = unit; long_distance.band[band].confirmed_hash = i; } - if (unit > long_distance.type[type].confirmed_unit) { + if (unit > long_distance.type[type].confirmed_unit) + { long_distance.type[type].confirmed_unit = unit; long_distance.type[type].confirmed_hash = i; } } - if (unit > 0) { - if (unit < short_distance.worked_unit) { + if (unit > 0) + { + if (unit < short_distance.worked_unit) + { short_distance.worked_unit = unit; short_distance.worked_hash = i; } if (!(band in short_distance.band)) - short_distance.band[band] = newDistanceObject(100000); + { short_distance.band[band] = newDistanceObject(100000); } if (!(mode in short_distance.mode)) - short_distance.mode[mode] = newDistanceObject(100000); + { short_distance.mode[mode] = newDistanceObject(100000); } if (!(type in short_distance.type)) - short_distance.type[type] = newDistanceObject(100000); + { short_distance.type[type] = newDistanceObject(100000); } - if (unit < short_distance.mode[mode].worked_unit) { + if (unit < short_distance.mode[mode].worked_unit) + { short_distance.mode[mode].worked_unit = unit; short_distance.mode[mode].worked_hash = i; } - if (unit < short_distance.band[band].worked_unit) { + if (unit < short_distance.band[band].worked_unit) + { short_distance.band[band].worked_unit = unit; short_distance.band[band].worked_hash = i; } - if (unit < short_distance.type[type].worked_unit) { + if (unit < short_distance.type[type].worked_unit) + { short_distance.type[type].worked_unit = unit; short_distance.type[type].worked_hash = i; } - if (didConfirm) { - if (unit < short_distance.confirmed_unit) { + if (didConfirm) + { + if (unit < short_distance.confirmed_unit) + { short_distance.confirmed_unit = unit; short_distance.confirmed_hash = i; } - if (unit < short_distance.mode[mode].confirmed_unit) { + if (unit < short_distance.mode[mode].confirmed_unit) + { short_distance.mode[mode].confirmed_unit = unit; short_distance.mode[mode].confirmed_hash = i; } - if (unit < short_distance.band[band].confirmed_unit) { + if (unit < short_distance.band[band].confirmed_unit) + { short_distance.band[band].confirmed_unit = unit; short_distance.band[band].confirmed_hash = i; } - if (unit < short_distance.type[type].confirmed_unit) { + if (unit < short_distance.type[type].confirmed_unit) + { short_distance.type[type].confirmed_unit = unit; short_distance.type[type].confirmed_hash = i; } @@ -8205,7 +9396,7 @@ function renderStatsBox() { } if (!(g_dxccToAltName[finalDxcc] in worldGeoData)) - worldGeoData[g_dxccToAltName[finalDxcc]] = newStatObject(); + { worldGeoData[g_dxccToAltName[finalDxcc]] = newStatObject(); } workObject( worldGeoData[g_dxccToAltName[finalDxcc]], @@ -8216,16 +9407,21 @@ function renderStatsBox() { didConfirm ); - if (finalGrid.length > 0) { + if (finalGrid.length > 0) + { var gridCheck = finalGrid.substr(0, 4); - if (cqz.length > 0) { + if (cqz.length > 0) + { var name = g_cqZones[cqz].name; if (!(name in cqZones)) cqZones[name] = newStatObject(); workObject(cqZones[name], false, band, mode, type, didConfirm); - } else if (gridCheck in g_gridToCQZone) { - if (g_gridToCQZone[gridCheck].length == 1) { + } + else if (gridCheck in g_gridToCQZone) + { + if (g_gridToCQZone[gridCheck].length == 1) + { var name = g_cqZones[g_gridToCQZone[gridCheck][0]].name; if (!(name in cqZones)) cqZones[name] = newStatObject(); @@ -8233,14 +9429,18 @@ function renderStatsBox() { } } - if (ituz.length > 0) { + if (ituz.length > 0) + { if (!(ituz in ituZones)) ituZones[ituz] = newStatObject(); workObject(ituZones[ituz], false, band, mode, type, didConfirm); - } else if (gridCheck in g_gridToITUZone) { - if (g_gridToITUZone[gridCheck].length == 1) { + } + else if (gridCheck in g_gridToITUZone) + { + if (g_gridToITUZone[gridCheck].length == 1) + { if (!(g_gridToITUZone[gridCheck][0] in ituZones)) - ituZones[g_gridToITUZone[gridCheck][0]] = newStatObject(); + { ituZones[g_gridToITUZone[gridCheck][0]] = newStatObject(); } workObject( ituZones[g_gridToITUZone[gridCheck][0]], @@ -8265,58 +9465,70 @@ function renderStatsBox() { var output = {}; worldGeoData.order = 1; - stats["DXCC"] = worldGeoData; - stats["GRID"] = gridData; - stats["CQ"] = cqZones; - stats["ITU"] = ituZones; - stats["WAC"] = wacZones; - stats["WAS"] = wasZones; - stats["USC"] = countyData; - stats["WPX"] = wpxData; - stats["WRFA"] = callData; + stats.DXCC = worldGeoData; + stats.GRID = gridData; + stats.CQ = cqZones; + stats.ITU = ituZones; + stats.WAC = wacZones; + stats.WAS = wasZones; + stats.USC = countyData; + stats.WPX = wpxData; + stats.WRFA = callData; - for (i in stats) { + for (i in stats) + { output[i] = newStatCountObject(); - for (var key in stats[i]) { - if (stats[i][key].worked) { + for (var key in stats[i]) + { + if (stats[i][key].worked) + { output[i].worked++; - if (stats[i][key].worked > output[i].worked_high) { + if (stats[i][key].worked > output[i].worked_high) + { output[i].worked_high = stats[i][key].worked; output[i].worked_high_key = key; } } - if (stats[i][key].confirmed) { + if (stats[i][key].confirmed) + { output[i].confirmed++; - if (stats[i][key].confirmed > output[i].confirmed_high) { + if (stats[i][key].confirmed > output[i].confirmed_high) + { output[i].confirmed_high = stats[i][key].confirmed; output[i].confirmed_high_key = key; } } - for (var band in stats[i][key].worked_bands) { + for (var band in stats[i][key].worked_bands) + { output[i].worked_bands[band] = ~~output[i].worked_bands[band] + 1; } - for (var band in stats[i][key].confirmed_bands) { + for (var band in stats[i][key].confirmed_bands) + { output[i].confirmed_bands[band] = ~~output[i].confirmed_bands[band] + 1; } - for (var mode in stats[i][key].worked_modes) { + for (var mode in stats[i][key].worked_modes) + { output[i].worked_modes[mode] = ~~output[i].worked_modes[mode] + 1; } - for (var mode in stats[i][key].confirmed_modes) { + for (var mode in stats[i][key].confirmed_modes) + { output[i].confirmed_modes[mode] = ~~output[i].confirmed_modes[mode] + 1; } - for (var type in stats[i][key].worked_types) { + for (var type in stats[i][key].worked_types) + { output[i].worked_types[type] = ~~output[i].worked_types[type] + 1; } - for (var type in stats[i][key].confirmed_types) { + for (var type in stats[i][key].confirmed_types) + { output[i].confirmed_types[type] = ~~output[i].confirmed_types[type] + 1; } @@ -8327,13 +9539,14 @@ function renderStatsBox() { scoreSection = "Modes"; - output["MIXED"] = modet.Mixed; - output["DIGITAL"] = modet.Digital; - output["PHONE"] = modet.Phone; - output["CW"] = modet.CW; - output["Other"] = modet.Other; + output.MIXED = modet.Mixed; + output.DIGITAL = modet.Digital; + output.PHONE = modet.Phone; + output.CW = modet.CW; + output.Other = modet.Other; - for (var i in output) { + for (var i in output) + { output[i].worked_band_count = Object.keys(output[i].worked_bands).length; output[i].confirmed_band_count = Object.keys( output[i].confirmed_bands @@ -8353,7 +9566,7 @@ function renderStatsBox() { 1: ["DIGITAL", "Digital", ""], 2: ["PHONE", "Phone", ""], 3: ["CW", "CW", ""], - 4: ["Other", "Other", ""], + 4: ["Other", "Other", ""] }; var AwardNames = { @@ -8365,7 +9578,7 @@ function renderStatsBox() { 5: ["WAC", "Continents", "WAC", "cyan"], 6: ["WAS", "US States", "WAS", "lightblue"], 7: ["USC", "US Counties", "USA-CA", "orange"], - 8: ["WPX", "Prefixes", "WPX", "yellow"], + 8: ["WPX", "Prefixes", "WPX", "yellow"] }; worker = ""; @@ -8399,7 +9612,8 @@ function renderStatsBox() { worker += "
Top ScoreWorkedConfirmed
" + AwardNames[key][1] + " (" + infoObject.confirmed_high + ")
" + long_distance.confirmed_unit + @@ -8457,7 +9674,8 @@ function renderStatsBox() { " " + g_QSOhash[long_distance.confirmed_hash].grid + "" + short_distance.confirmed_unit + @@ -8490,7 +9709,8 @@ function renderStatsBox() { " " + g_QSOhash[short_distance.confirmed_hash].grid + "
"; @@ -8499,11 +9719,13 @@ function renderStatsBox() { scoreSection = "Award Types"; for (var key in AwardNames) + { worker += createStatTable( AwardNames[key][1], output[AwardNames[key][0]], AwardNames[key][2] ); + } worker += "
"; @@ -8511,11 +9733,13 @@ function renderStatsBox() { worker += "

Mode Types

"; for (var key in TypeNames) + { worker += createStatTable( TypeNames[key][1], output[TypeNames[key][0]], TypeNames[key][2] ); + } worker += "
"; @@ -8525,7 +9749,8 @@ function renderStatsBox() { worker += createDistanceTable(short_distance, "Shortest Distance"); worker += "
"; - if (g_appSettings.gtShareEnable == true) { + if (g_appSettings.gtShareEnable == true) + { scoreSection = "GT Users"; worker += "

Worked GridTracker Stations
Online Now

"; worker += "
"; @@ -8535,7 +9760,9 @@ function renderStatsBox() { worker += ""; } worker += ""; - } catch (e) { + } + catch (e) + { worker += "
In Section: " + scoreSection + @@ -8546,37 +9773,41 @@ function renderStatsBox() { setStatsDivHeight("statViewDiv", getStatsWindowHeight() + 29 + "px"); } -function hashNameSort(a, b) { +function hashNameSort(a, b) +{ if (g_QSOhash[a].DEcall > g_QSOhash[b].DEcall) return 1; if (g_QSOhash[b].DEcall > g_QSOhash[a].DEcall) return -1; return 0; } -function createGtStationsTable(obj) { +function createGtStationsTable(obj) +{ var worker = ""; worker += ""; var keys = Object.keys(obj).sort(hashNameSort); - for (var key in keys) { + for (var key in keys) + { var callsign = g_QSOhash[keys[key]]; var bgDX = " style='font-weight:bold;color:cyan;' "; var bgDE = " style='font-weight:bold;color:yellow;' "; if (typeof callsign.msg == "undefined" || callsign.msg == "") - callsign.msg = "-"; + { callsign.msg = "-"; } var ageString = ""; if (timeNowSec() - callsign.time < 3601) - ageString = (timeNowSec() - callsign.time).toDHMS(); - else { + { ageString = (timeNowSec() - callsign.time).toDHMS(); } + else + { ageString = userTimeString(callsign.time * 1000); } worker += ""; worker += "
" + callsign.DEcall.formatCallsign() + @@ -8615,7 +9846,8 @@ function createGtStationsTable(obj) { return worker; } -function createDistanceTable(obj, name) { +function createDistanceTable(obj, name) +{ var worker = "
CallGridSentRcvdModeBandQSLCommentDXCCTime
"; worker += @@ -8627,7 +9859,8 @@ function createDistanceTable(obj, name) { worker += ""; worker += ""; worker += ""; @@ -8681,7 +9917,8 @@ function createDistanceTable(obj, name) { worker += ""; worker += ""; worker += ""; worker += ""; worker += ""; worker += ""; worker += ""; worker += ""; @@ -8788,16 +10032,19 @@ function createDistanceTable(obj, name) { return worker; } -function numberSort(a, b) { +function numberSort(a, b) +{ if (parseInt(a) > parseInt(b)) return 1; if (parseInt(b) > parseInt(a)) return -1; return 0; } -function createStatTable(title, infoObject, awardName) { +function createStatTable(title, infoObject, awardName) +{ var wc1Table = ""; - if (infoObject.worked) { + if (infoObject.worked) + { wc1Table = "
Bands"; var keys = Object.keys(obj.band).sort(numberSort); - for (var key in keys) { + for (var key in keys) + { var grid = g_QSOhash[obj.band[keys[key]].worked_hash].grid; var call = g_QSOhash[obj.band[keys[key]].worked_hash].DEcall; worker += @@ -8641,7 +9874,7 @@ function createDistanceTable(obj, name) { worker += "
" + call + @@ -8651,8 +9884,10 @@ function createDistanceTable(obj, name) { } worker += "
"; - for (var key in keys) { - if (keys[key] in obj.band && obj.band[keys[key]].confirmed_hash) { + for (var key in keys) + { + if (keys[key] in obj.band && obj.band[keys[key]].confirmed_hash) + { var grid = g_QSOhash[obj.band[keys[key]].confirmed_hash].grid; var call = g_QSOhash[obj.band[keys[key]].confirmed_hash].DEcall; worker += @@ -8666,14 +9901,15 @@ function createDistanceTable(obj, name) { worker += ""; worker += ""; worker += ""; - } else worker += ""; + } + else worker += ""; } worker += "
" + call + "" + grid + "
 
 
Modes"; keys = Object.keys(obj.mode).sort(); - for (var key in keys) { + for (var key in keys) + { var grid = g_QSOhash[obj.mode[keys[key]].worked_hash].grid; var call = g_QSOhash[obj.mode[keys[key]].worked_hash].DEcall; worker += @@ -8695,7 +9932,7 @@ function createDistanceTable(obj, name) { worker += "
" + call + @@ -8705,8 +9942,10 @@ function createDistanceTable(obj, name) { } worker += "
"; - for (var key in keys) { - if (keys[key] in obj.mode && obj.mode[keys[key]].confirmed_hash) { + for (var key in keys) + { + if (keys[key] in obj.mode && obj.mode[keys[key]].confirmed_hash) + { var grid = g_QSOhash[obj.mode[keys[key]].confirmed_hash].grid; var call = g_QSOhash[obj.mode[keys[key]].confirmed_hash].DEcall; worker += @@ -8720,21 +9959,23 @@ function createDistanceTable(obj, name) { worker += ""; worker += ""; worker += ""; - } else worker += ""; + } + else worker += ""; } worker += "
" + call + "" + grid + "
 
 
Types"; keys = Object.keys(obj.type).sort(); - for (var key in keys) { + for (var key in keys) + { var grid = g_QSOhash[obj.type[keys[key]].worked_hash].grid; var call = g_QSOhash[obj.type[keys[key]].worked_hash].DEcall; worker += @@ -8748,7 +9989,7 @@ function createDistanceTable(obj, name) { worker += "
" + call + @@ -8758,8 +9999,10 @@ function createDistanceTable(obj, name) { } worker += "
"; - for (var key in keys) { - if (keys[key] in obj.type && obj.type[keys[key]].confirmed_hash) { + for (var key in keys) + { + if (keys[key] in obj.type && obj.type[keys[key]].confirmed_hash) + { var grid = g_QSOhash[obj.type[keys[key]].confirmed_hash].grid; var call = g_QSOhash[obj.type[keys[key]].confirmed_hash].DEcall; worker += @@ -8773,14 +10016,15 @@ function createDistanceTable(obj, name) { worker += ""; worker += ""; worker += ""; - } else worker += ""; + } + else worker += ""; } worker += "
" + call + "" + grid + "
 
 
"; wc1Table += @@ -8820,7 +10067,8 @@ function createStatTable(title, infoObject, awardName) { wc1Table += ""; wc1Table += ""; wc1Table += ""; @@ -8849,7 +10100,8 @@ function createStatTable(title, infoObject, awardName) { wc1Table += ""; wc1Table += ""; } + worker += + "
"; var keys = Object.keys(infoObject.worked_bands).sort(numberSort); - for (var key in keys) { + for (var key in keys) + { wc1Table += "
" + keys[key] + @@ -8832,15 +10080,18 @@ function createStatTable(title, infoObject, awardName) { wc1Table += "
"; - for (var key in keys) { - if (keys[key] in infoObject.confirmed_bands) { + for (var key in keys) + { + if (keys[key] in infoObject.confirmed_bands) + { wc1Table += ""; - } else wc1Table += ""; + } + else wc1Table += ""; } wc1Table += "
" + keys[key] + " (" + infoObject.confirmed_bands[keys[key]] + ")
 
 
Modes"; keys = Object.keys(infoObject.worked_modes).sort(); - for (var key in keys) { + for (var key in keys) + { wc1Table += ""; wc1Table += ""; - if (infoObject.worked_type_count > 0) { + if (infoObject.worked_type_count > 0) + { wc1Table += ""; wc1Table += ""; wc1Table += ""; + if (Object.keys(g_blockedCQ).length > 0) { - clearString = ""; - if (Object.keys(g_blockedDxcc).length > 0) - clearString = - ""; - worker += - "
" + keys[key] + @@ -8862,26 +10114,31 @@ function createStatTable(title, infoObject, awardName) { wc1Table += ""; - for (var key in keys) { - if (keys[key] in infoObject.confirmed_modes) { + for (var key in keys) + { + if (keys[key] in infoObject.confirmed_modes) + { wc1Table += ""; - } else wc1Table += ""; + } + else wc1Table += ""; } wc1Table += "
" + keys[key] + " (" + infoObject.confirmed_modes[keys[key]] + ")
 
 
Types"; var keys = Object.keys(infoObject.worked_types).sort(); - for (var key in keys) { + for (var key in keys) + { wc1Table += ""; @@ -8917,22 +10177,26 @@ function createStatTable(title, infoObject, awardName) { return wc1Table; } -function validatePropMode(propMode) { +function validatePropMode(propMode) +{ if (g_appSettings.gtPropFilter == "mixed") return true; return g_appSettings.gtPropFilter == propMode; } -function validateMapMode(mode) { +function validateMapMode(mode) +{ if (g_appSettings.gtModeFilter.length == 0) return true; if (g_appSettings.gtModeFilter == "auto") return myMode == mode; - if (g_appSettings.gtModeFilter == "Digital") { + if (g_appSettings.gtModeFilter == "Digital") + { if (mode in g_modes && g_modes[mode]) return true; return false; } - if (g_appSettings.gtModeFilter == "Phone") { + if (g_appSettings.gtModeFilter == "Phone") + { if (mode in g_modes_phone && g_modes_phone[mode]) return true; return false; } @@ -8942,7 +10206,8 @@ function validateMapMode(mode) { return g_appSettings.gtModeFilter == mode; } -function redrawGrids() { +function redrawGrids() +{ if (g_appSettings.gridViewMode == 2) removePaths(); clearGrids(); clearQsoGrids(); @@ -8950,7 +10215,8 @@ function redrawGrids() { g_QSLcount = 0; g_QSOcount = 0; - for (var i in g_QSOhash) { + for (var i in g_QSOhash) + { var finalGrid = g_QSOhash[i].grid; var worked = g_QSOhash[i].worked; var didConfirm = g_QSOhash[i].confirmed; @@ -8966,8 +10232,10 @@ function redrawGrids() { : g_appSettings.gtBandFilter == g_QSOhash[i].band)) && validateMapMode(g_QSOhash[i].mode) && validatePropMode(g_QSOhash[i].propMode) - ) { - if (g_appSettings.gridViewMode > 1) { + ) + { + if (g_appSettings.gridViewMode > 1) + { g_QSOhash[i].rect = qthToQsoBox( g_QSOhash[i].grid, i, @@ -8980,7 +10248,8 @@ function redrawGrids() { g_QSOhash[i].band, g_QSOhash[i].wspr ); - for (var vucc in g_QSOhash[i].vucc_grids) { + for (var vucc in g_QSOhash[i].vucc_grids) + { qthToQsoBox( g_QSOhash[i].vucc_grids[vucc], i, @@ -9003,26 +10272,33 @@ function redrawGrids() { var ituz = g_QSOhash[i].ituz; var cqz = g_QSOhash[i].cqz; - if (state != null && isKnownCallsignUS(finalDxcc)) { + if (state != null && isKnownCallsignUS(finalDxcc)) + { if (state.substr(0, 2) != "US") state = "US-" + state; - if (state in g_StateData) { + if (state in g_StateData) + { var name = g_StateData[state].name; - if (name in g_wasZones) { - if (g_wasZones[name].worked == false) { + if (name in g_wasZones) + { + if (g_wasZones[name].worked == false) + { g_wasZones[name].worked = worked; } - if (worked) { + if (worked) + { g_wasZones[name].worked_bands[band] = ~~g_wasZones[name].worked_bands[band] + 1; g_wasZones[name].worked_modes[mode] = ~~g_wasZones[name].worked_modes[mode] + 1; } - if (g_wasZones[name].confirmed == false) { + if (g_wasZones[name].confirmed == false) + { g_wasZones[name].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_wasZones[name].confirmed_bands[band] = ~~g_wasZones[name].confirmed_bands[band] + 1; g_wasZones[name].confirmed_modes[mode] = @@ -9032,21 +10308,27 @@ function redrawGrids() { } } - if (cnty != null) { - if (cnty in g_cntyToCounty) { - if (g_countyData[cnty].worked == false) { + if (cnty != null) + { + if (cnty in g_cntyToCounty) + { + if (g_countyData[cnty].worked == false) + { g_countyData[cnty].worked = worked; } - if (worked) { + if (worked) + { g_countyData[cnty].worked_bands[band] = ~~g_countyData[cnty].worked_bands[band] + 1; g_countyData[cnty].worked_modes[mode] = ~~g_countyData[cnty].worked_modes[mode] + 1; } - if (g_countyData[cnty].confirmed == false) { + if (g_countyData[cnty].confirmed == false) + { g_countyData[cnty].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_countyData[cnty].confirmed_bands[band] = ~~g_countyData[cnty].confirmed_bands[band] + 1; g_countyData[cnty].confirmed_modes[mode] = @@ -9054,24 +10336,31 @@ function redrawGrids() { } } } - if (cont != null) { - if (cont in g_shapeData) { + if (cont != null) + { + if (cont in g_shapeData) + { var name = g_shapeData[cont].properties.name; - if (name in g_wacZones) { - if (g_wacZones[name].worked == false) { + if (name in g_wacZones) + { + if (g_wacZones[name].worked == false) + { g_wacZones[name].worked = worked; } - if (worked) { + if (worked) + { g_wacZones[name].worked_bands[band] = ~~g_wacZones[name].worked_bands[band] + 1; g_wacZones[name].worked_modes[mode] = ~~g_wacZones[name].worked_modes[mode] + 1; } - if (g_wacZones[name].confirmed == false) { + if (g_wacZones[name].confirmed == false) + { g_wacZones[name].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_wacZones[name].confirmed_bands[band] = ~~g_wacZones[name].confirmed_bands[band] + 1; g_wacZones[name].confirmed_modes[mode] = @@ -9081,19 +10370,23 @@ function redrawGrids() { } } - if (g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked == false) { + if (g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked == false) + { g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked = worked; } - if (worked) { + if (worked) + { g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked_bands[band] = ~~g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked_bands[band] + 1; g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked_modes[mode] = ~~g_worldGeoData[g_dxccToGeoData[finalDxcc]].worked_modes[mode] + 1; } - if (g_worldGeoData[g_dxccToGeoData[finalDxcc]].confirmed == false) { + if (g_worldGeoData[g_dxccToGeoData[finalDxcc]].confirmed == false) + { g_worldGeoData[g_dxccToGeoData[finalDxcc]].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_worldGeoData[g_dxccToGeoData[finalDxcc]].confirmed_bands[band] = ~~g_worldGeoData[g_dxccToGeoData[finalDxcc]].confirmed_bands[band] + 1; @@ -9101,23 +10394,29 @@ function redrawGrids() { ~~g_worldGeoData[g_dxccToGeoData[finalDxcc]].confirmed_modes[mode] + 1; } - if (finalGrid.length > 0) { + if (finalGrid.length > 0) + { var gridCheck = finalGrid.substr(0, 4); - if (gridCheck in g_us48Data) { - if (g_us48Data[gridCheck].worked == false) { + if (gridCheck in g_us48Data) + { + if (g_us48Data[gridCheck].worked == false) + { g_us48Data[gridCheck].worked = worked; } - if (worked) { + if (worked) + { g_us48Data[gridCheck].worked_bands[band] = ~~g_us48Data[gridCheck].worked_bands[band] + 1; g_us48Data[gridCheck].worked_modes[mode] = ~~g_us48Data[gridCheck].worked_modes[mode] + 1; } - if (g_us48Data[gridCheck].confirmed == false) { + if (g_us48Data[gridCheck].confirmed == false) + { g_us48Data[gridCheck].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_us48Data[gridCheck].confirmed_bands[band] = ~~g_us48Data[gridCheck].confirmed_bands[band] + 1; g_us48Data[gridCheck].confirmed_modes[mode] = @@ -9125,31 +10424,41 @@ function redrawGrids() { } } - if (cqz.length > 0) { - if (g_cqZones[cqz].worked == false) { + if (cqz.length > 0) + { + if (g_cqZones[cqz].worked == false) + { g_cqZones[cqz].worked = worked; } - if (worked) { + if (worked) + { g_cqZones[cqz].worked_bands[band] = ~~g_cqZones[cqz].worked_bands[band] + 1; g_cqZones[cqz].worked_modes[mode] = ~~g_cqZones[cqz].worked_modes[mode] + 1; } - if (g_cqZones[cqz].confirmed == false) { + if (g_cqZones[cqz].confirmed == false) + { g_cqZones[cqz].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_cqZones[cqz].confirmed_bands[band] = ~~g_cqZones[cqz].confirmed_bands[band] + 1; g_cqZones[cqz].confirmed_modes[mode] = ~~g_cqZones[cqz].confirmed_modes[mode] + 1; } - } else if (gridCheck in g_gridToCQZone) { - if (g_gridToCQZone[gridCheck].length == 1) { - if (g_cqZones[g_gridToCQZone[gridCheck][0]].worked == false) { + } + else if (gridCheck in g_gridToCQZone) + { + if (g_gridToCQZone[gridCheck].length == 1) + { + if (g_cqZones[g_gridToCQZone[gridCheck][0]].worked == false) + { g_cqZones[g_gridToCQZone[gridCheck][0]].worked = worked; } - if (worked) { + if (worked) + { g_cqZones[g_gridToCQZone[gridCheck][0]].worked_bands[band] = ~~g_cqZones[g_gridToCQZone[gridCheck][0]].worked_bands[band] + 1; @@ -9157,10 +10466,12 @@ function redrawGrids() { ~~g_cqZones[g_gridToCQZone[gridCheck][0]].worked_modes[mode] + 1; } - if (g_cqZones[g_gridToCQZone[gridCheck][0]].confirmed == false) { + if (g_cqZones[g_gridToCQZone[gridCheck][0]].confirmed == false) + { g_cqZones[g_gridToCQZone[gridCheck][0]].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_cqZones[g_gridToCQZone[gridCheck][0]].confirmed_bands[band] = ~~g_cqZones[g_gridToCQZone[gridCheck][0]].confirmed_bands[ band @@ -9173,31 +10484,41 @@ function redrawGrids() { } } - if (ituz.length > 0) { - if (g_ituZones[ituz].worked == false) { + if (ituz.length > 0) + { + if (g_ituZones[ituz].worked == false) + { g_ituZones[ituz].worked = worked; } - if (worked) { + if (worked) + { g_ituZones[ituz].worked_bands[band] = ~~g_ituZones[ituz].worked_bands[band] + 1; g_ituZones[ituz].worked_modes[mode] = ~~g_ituZones[ituz].worked_modes[mode] + 1; } - if (g_ituZones[ituz].confirmed == false) { + if (g_ituZones[ituz].confirmed == false) + { g_ituZones[ituz].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_ituZones[ituz].confirmed_bands[band] = ~~g_ituZones[ituz].confirmed_bands[band] + 1; g_ituZones[ituz].confirmed_modes[mode] = ~~g_ituZones[ituz].confirmed_modes[mode] + 1; } - } else if (gridCheck in g_gridToITUZone) { - if (g_gridToITUZone[gridCheck].length == 1) { - if (g_ituZones[g_gridToITUZone[gridCheck][0]].worked == false) { + } + else if (gridCheck in g_gridToITUZone) + { + if (g_gridToITUZone[gridCheck].length == 1) + { + if (g_ituZones[g_gridToITUZone[gridCheck][0]].worked == false) + { g_ituZones[g_gridToITUZone[gridCheck][0]].worked = worked; } - if (worked) { + if (worked) + { g_ituZones[g_gridToITUZone[gridCheck][0]].worked_bands[band] = ~~g_ituZones[g_gridToITUZone[gridCheck][0]].worked_bands[band] + 1; @@ -9205,10 +10526,12 @@ function redrawGrids() { ~~g_ituZones[g_gridToITUZone[gridCheck][0]].worked_modes[mode] + 1; } - if (g_ituZones[g_gridToITUZone[gridCheck][0]].confirmed == false) { + if (g_ituZones[g_gridToITUZone[gridCheck][0]].confirmed == false) + { g_ituZones[g_gridToITUZone[gridCheck][0]].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_ituZones[g_gridToITUZone[gridCheck][0]].confirmed_bands[band] = ~~g_ituZones[g_gridToITUZone[gridCheck][0]].confirmed_bands[ band @@ -9222,22 +10545,28 @@ function redrawGrids() { } } - for (var key in g_QSOhash[i].vucc_grids) { + for (var key in g_QSOhash[i].vucc_grids) + { var grid = g_QSOhash[i].vucc_grids[key].substr(0, 4); - if (grid in g_us48Data) { - if (g_us48Data[grid].worked == false) { + if (grid in g_us48Data) + { + if (g_us48Data[grid].worked == false) + { g_us48Data[grid].worked = worked; } - if (worked) { + if (worked) + { g_us48Data[grid].worked_bands[band] = ~~g_us48Data[grid].worked_bands[band] + 1; g_us48Data[grid].worked_modes[mode] = ~~g_us48Data[grid].worked_modes[mode] + 1; } - if (g_us48Data[grid].confirmed == false) { + if (g_us48Data[grid].confirmed == false) + { g_us48Data[grid].confirmed = didConfirm; } - if (didConfirm) { + if (didConfirm) + { g_us48Data[grid].confirmed_bands[band] = ~~g_us48Data[grid].confirmed_bands[band] + 1; g_us48Data[grid].confirmed_modes[mode] = @@ -9248,28 +10577,38 @@ function redrawGrids() { } } - for (var layer in g_viewInfo) { + for (var layer in g_viewInfo) + { var search = window[g_viewInfo[layer][0]]; var worked = (confirmed = 0); - if (layer == 0) { - for (var key in search) { + if (layer == 0) + { + for (var key in search) + { if (search[key].rectangle.worked) worked++; if (search[key].rectangle.confirmed) confirmed++; } g_viewInfo[layer][2] = worked; g_viewInfo[layer][3] = confirmed; - } else if (layer == 5) { - for (var key in search) { - if (search[key].geo != "deleted") { + } + else if (layer == 5) + { + for (var key in search) + { + if (search[key].geo != "deleted") + { if (search[key].worked) worked++; if (search[key].confirmed) confirmed++; } } g_viewInfo[layer][2] = worked; g_viewInfo[layer][3] = confirmed; - } else { - for (var key in search) { + } + else + { + for (var key in search) + { if (search[key].worked) worked++; if (search[key].confirmed) confirmed++; } @@ -9278,7 +10617,8 @@ function redrawGrids() { } } - for (var i in g_liveCallsigns) { + for (var i in g_liveCallsigns) + { if ( g_appSettings.gridViewMode != 2 && (g_appSettings.gtBandFilter.length == 0 || @@ -9286,8 +10626,10 @@ function redrawGrids() { ? myBand == g_liveCallsigns[i].band : g_appSettings.gtBandFilter == g_liveCallsigns[i].band)) && validateMapMode(g_liveCallsigns[i].mode) - ) { - if (g_appSettings.gridViewMode == 1 || g_appSettings.gridViewMode == 3) { + ) + { + if (g_appSettings.gridViewMode == 1 || g_appSettings.gridViewMode == 3) + { g_liveCallsigns[i].rect = qthToBox( g_liveCallsigns[i].grid, g_liveCallsigns[i].DEcall, @@ -9309,15 +10651,18 @@ function redrawGrids() { updateCountStats(); } -function toggleAlertMute() { +function toggleAlertMute() +{ g_appSettings.alertMute ^= 1; alertMuteImg.src = g_alertImageArray[g_appSettings.alertMute]; - if (g_appSettings.alertMute == 1) { + if (g_appSettings.alertMute == 1) + { chrome.tts.stop(); } } -function togglePushPinMode() { +function togglePushPinMode() +{ if (g_pushPinMode == false) g_pushPinMode = true; else g_pushPinMode = false; g_appSettings.pushPinMode = g_pushPinMode; @@ -9326,44 +10671,58 @@ function togglePushPinMode() { redrawGrids(); } -function stopAsking(checkbox) { +function stopAsking(checkbox) +{ g_appSettings.stopAskingVersion = checkbox.checked; } -function toggleGtShareEnable() { - if (g_appSettings.gtShareEnable == true) { +function toggleGtShareEnable() +{ + if (g_appSettings.gtShareEnable == true) + { g_appSettings.gtShareEnable = false; - } else g_appSettings.gtShareEnable = true; + } + else g_appSettings.gtShareEnable = true; setGtShareButtons(); } -function setGtShareButtons() { +function setGtShareButtons() +{ if ( g_appSettings.gtShareEnable == true && g_mapSettings.offlineMode == false - ) { + ) + { if (g_appSettings.gtMsgEnable == true) - msgButton.style.display = "inline-block"; + { msgButton.style.display = "inline-block"; } else msgButton.style.display = "none"; gtFlagButton.style.display = "inline-block"; - if (g_appSettings.gtFlagImgSrc > 0) { - g_layerVectors["gtflags"].setVisible(true); - } else { - g_layerVectors["gtflags"].setVisible(false); + if (g_appSettings.gtFlagImgSrc > 0) + { + g_layerVectors.gtflags.setVisible(true); } - } else { + else + { + g_layerVectors.gtflags.setVisible(false); + } + } + else + { msgButton.style.display = "none"; gtFlagButton.style.display = "none"; - g_layerVectors["gtflags"].setVisible(false); + g_layerVectors.gtflags.setVisible(false); clearGtFlags(); // Clear list g_gtFlagPins = {}; - if (g_chatWindowHandle != null) { - try { + if (g_chatWindowHandle != null) + { + try + { g_chatWindowHandle.hide(); - } catch (e) {} + } + catch (e) {} } } @@ -9371,27 +10730,37 @@ function setGtShareButtons() { g_gtShareFlagImageArray[g_appSettings.gtShareEnable == false ? 0 : 1]; } -function setMulticastIp() { +function setMulticastIp() +{ g_appSettings.wsjtIP = multicastIpInput.value; } -function setMulticastEnable(checkbox) { - if (checkbox.checked == true) { +function setMulticastEnable(checkbox) +{ + if (checkbox.checked == true) + { multicastTD.style.display = "block"; - if (ValidateMulticast(multicastIpInput)) { + if (ValidateMulticast(multicastIpInput)) + { g_appSettings.wsjtIP = multicastIpInput.value; - } else { + } + else + { g_appSettings.wsjtIP = ""; } - } else { + } + else + { multicastTD.style.display = "none"; g_appSettings.wsjtIP = ""; } g_appSettings.multicast = checkbox.checked; } -function setUdpForwardEnable(checkbox) { - if (checkbox.checked) { +function setUdpForwardEnable(checkbox) +{ + if (checkbox.checked) + { if ( ValidatePort( udpForwardPortInput, @@ -9399,7 +10768,8 @@ function setUdpForwardEnable(checkbox) { CheckForwardPortIsNotReceivePort ) && ValidateIPaddress(udpForwardIpInput, null) - ) { + ) + { g_appSettings.wsjtForwardUdpEnable = checkbox.checked; return; } @@ -9408,20 +10778,25 @@ function setUdpForwardEnable(checkbox) { g_appSettings.wsjtForwardUdpEnable = checkbox.checked; } -function setGTspotEnable(checkbox) { +function setGTspotEnable(checkbox) +{ g_appSettings.gtSpotEnable = checkbox.checked; g_gtLiveStatusUpdate = true; } -function setMsgEnable(checkbox) { +function setMsgEnable(checkbox) +{ g_appSettings.gtMsgEnable = checkbox.checked; - if (g_appSettings.gtShareEnable == true) { + if (g_appSettings.gtShareEnable == true) + { if (g_appSettings.gtMsgEnable == true) - msgButton.style.display = "inline-block"; - else { + { msgButton.style.display = "inline-block"; } + else + { msgButton.style.display = "none"; - if (g_chatWindowHandle != null) { + if (g_chatWindowHandle != null) + { g_chatWindowHandle.hide(); } } @@ -9430,16 +10805,20 @@ function setMsgEnable(checkbox) { setMsgSettingsView(); } -function newMessageSetting(whichSetting) { - if (whichSetting.id in g_msgSettings) { +function newMessageSetting(whichSetting) +{ + if (whichSetting.id in g_msgSettings) + { g_msgSettings[whichSetting.id] = whichSetting.value; localStorage.msgSettings = JSON.stringify(g_msgSettings); setMsgSettingsView(); } } -function checkForNewVersion(showUptoDate) { +function checkForNewVersion(showUptoDate) +{ if (typeof nw != "undefined") + { getBuffer( "http://app.gridtracker.org/version.txt?lang=" + g_localeString, versionCheck, @@ -9447,11 +10826,14 @@ function checkForNewVersion(showUptoDate) { "http", 80 ); + } } -function renderBandActivity() { +function renderBandActivity() +{ var buffer = ""; - if (typeof g_bandActivity.lines[myMode] != "undefined") { + if (typeof g_bandActivity.lines[myMode] != "undefined") + { var lines = g_bandActivity.lines[myMode]; var bands = [ @@ -9468,9 +10850,10 @@ function renderBandActivity() { "10m", "6m", "4m", - "2m", + "2m" ]; if (g_myDXCC in g_callsignDatabaseUSplus) + { bands = [ "630m", "160m", @@ -9484,11 +10867,13 @@ function renderBandActivity() { "12m", "10m", "6m", - "2m", + "2m" ]; + } var bandData = {}; var maxValue = 0; - for (var i = 0; i < bands.length; i++) { + for (var i = 0; i < bands.length; i++) + { bandData[bands[i]] = {}; bandData[bands[i]].score = 0; @@ -9496,14 +10881,17 @@ function renderBandActivity() { bandData[bands[i]].tx = 0; bandData[bands[i]].rx = 0; } - for (var x = 0; x < lines.length; x++) { + for (var x = 0; x < lines.length; x++) + { var firstChar = lines[x].charCodeAt(0); - if (firstChar != 35 && lines[x].length > 1) { + if (firstChar != 35 && lines[x].length > 1) + { // doesn't begins with # and has something var values = lines[x].trim().split(" "); var band = Number(Number(values[0]) / 1000000).formatBand(); - if (band in bandData) { + if (band in bandData) + { var place = bandData[band]; place.score += Number(values[1]); @@ -9517,56 +10905,61 @@ function renderBandActivity() { } var scaleFactor = 1.0; - if (maxValue > 26) { + if (maxValue > 26) + { scaleFactor = 26 / maxValue; } - for (var band in bandData) { + for (var band in bandData) + { 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 { + } + else + { buffer = "..no data yet.."; } graphDiv.innerHTML = buffer; - if (g_baWindowHandle) { + if (g_baWindowHandle) + { g_baWindowHandle.window.graphDiv.innerHTML = buffer; } } -function pskBandActivityCallback(buffer, flag) { +function pskBandActivityCallback(buffer, flag) +{ var result = String(buffer); - if (result.indexOf("frequency score") > -1) { + if (result.indexOf("frequency score") > -1) + { // looks good so far g_bandActivity.lines[myMode] = result.split("\n"); g_bandActivity.lastUpdate[myMode] = g_timeNow + 600; @@ -9576,9 +10969,11 @@ function pskBandActivityCallback(buffer, flag) { renderBandActivity(); } -function pskGetBandActivity() { +function pskGetBandActivity() +{ if (g_mapSettings.offlineMode == true) return; - if (typeof g_bandActivity.lastUpdate[myMode] == "undefined") { + if (typeof g_bandActivity.lastUpdate[myMode] == "undefined") + { g_bandActivity.lastUpdate[myMode] = 0; } @@ -9586,7 +10981,8 @@ function pskGetBandActivity() { myMode.length > 0 && myDEGrid.length > 0 && g_timeNow > g_bandActivity.lastUpdate[myMode] - ) { + ) + { getBuffer( "https://pskreporter.info/cgi-bin/psk-freq.pl?mode=" + myMode + @@ -9601,16 +10997,19 @@ function pskGetBandActivity() { renderBandActivity(); - if (g_pskBandActivityTimerHandle != null) { + if (g_pskBandActivityTimerHandle != null) + { clearInterval(g_pskBandActivityTimerHandle); } - g_pskBandActivityTimerHandle = setInterval(function () { + g_pskBandActivityTimerHandle = setInterval(function () + { pskGetBandActivity(); }, 601000); // every 20 minutes, 1 second } -function getIniFromApp(appName) { +function getIniFromApp(appName) +{ var result = Array(); result.port = -1; result.ip = ""; @@ -9626,64 +11025,81 @@ function getIniFromApp(appName) { var wsjtxCfgPath = ""; var data = String(nw.App.dataPath); var end = 0; - if (g_platform == "windows") { + if (g_platform == "windows") + { end = data.indexOf("GridTracker\\User Data\\Default"); - if (end > -1) { + if (end > -1) + { wsjtxCfgPath = data.substr(0, end) + appName + "\\" + appName + ".ini"; } - } else if (g_platform == "mac") { + } + else if (g_platform == "mac") + { wsjtxCfgPath = process.env.HOME + "/Library/Preferences/WSJT-X.ini"; - } else { + } + else + { wsjtxCfgPath = process.env.HOME + "/.config/" + appName + ".ini"; } - if (fs.existsSync(wsjtxCfgPath)) { + if (fs.existsSync(wsjtxCfgPath)) + { var fileBuf = fs.readFileSync(wsjtxCfgPath, "ascii"); var fileArray = fileBuf.split("\n"); for (var key in fileArray) fileArray[key] = fileArray[key].trim(); result.IniPath = data.substr(0, end) + appName + "\\"; - for (var x = 0; x < fileArray.length; x++) { + for (var x = 0; x < fileArray.length; x++) + { var indexOfPort = fileArray[x].indexOf("UDPServerPort="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.port = portSplit[1]; } indexOfPort = fileArray[x].indexOf("UDPServer="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.ip = portSplit[1]; } indexOfPort = fileArray[x].indexOf("MyCall="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.MyCall = portSplit[1]; } indexOfPort = fileArray[x].indexOf("MyGrid="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.MyGrid = portSplit[1].substr(0, 6); } indexOfPort = fileArray[x].indexOf("Mode="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.MyMode = portSplit[1]; } indexOfPort = fileArray[x].indexOf("DialFreq="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.MyBand = Number(portSplit[1] / 1000000).formatBand(); } indexOfPort = fileArray[x].indexOf("N1MMServerPort="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.N1MMServerPort = portSplit[1]; } indexOfPort = fileArray[x].indexOf("N1MMServer="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.N1MMServer = portSplit[1]; } indexOfPort = fileArray[x].indexOf("BroadcastToN1MM="); - if (indexOfPort == 0) { + if (indexOfPort == 0) + { var portSplit = fileArray[x].split("="); result.BroadcastToN1MM = portSplit[1] == "true"; } @@ -9692,7 +11108,8 @@ function getIniFromApp(appName) { return result; } -function checkRunningProcesses() { +function checkRunningProcesses() +{ var child_process = require("child_process"); var list = g_platform == "windows" @@ -9703,10 +11120,14 @@ function checkRunningProcesses() { g_jtdxProcessRunning = list.indexOf("jtdx") > -1; } -function updateRunningProcesses() { - try { +function updateRunningProcesses() +{ + try + { checkRunningProcesses(); - } catch (e) { + } + catch (e) + { g_wsjtxProcessRunning = false; g_jtdxProcessRunning = false; } @@ -9714,52 +11135,65 @@ function updateRunningProcesses() { if (g_wsjtxProcessRunning == true) runningAppsDiv.innerHTML += " - up - "; else runningAppsDiv.innerHTML += " - ? - "; g_wsjtxIni = getIniFromApp("WSJT-X"); - if (g_wsjtxIni.port > -1) { + if (g_wsjtxIni.port > -1) + { runningAppsDiv.innerHTML += "(" + g_wsjtxIni.ip + " / " + g_wsjtxIni.port + ") "; - } else runningAppsDiv.innerHTML += "(?) "; - if (g_platform != "mac") { + } + else runningAppsDiv.innerHTML += "(?) "; + if (g_platform != "mac") + { runningAppsDiv.innerHTML += " / JTDX "; if (g_jtdxProcessRunning == true) runningAppsDiv.innerHTML += " - up - "; else runningAppsDiv.innerHTML += " - ? - "; g_jtdxIni = getIniFromApp("JTDX"); - if (g_jtdxIni.port > -1) { + if (g_jtdxIni.port > -1) + { runningAppsDiv.innerHTML += "(" + g_jtdxIni.ip + " / " + g_jtdxIni.port + ") "; - } else runningAppsDiv.innerHTML += "(?) "; + } + else runningAppsDiv.innerHTML += "(?) "; } } -function updateBasedOnIni() { +function updateBasedOnIni() +{ var which = null; var count = 0; if (g_wsjtxProcessRunning) count++; if (g_jtdxProcessRunning) count++; // UdpPortNotSet - if (g_appSettings.wsjtUdpPort == 0 && count == 1) { + if (g_appSettings.wsjtUdpPort == 0 && count == 1) + { if (g_wsjtxProcessRunning) which = g_wsjtxIni; else if (g_jtdxProcessRunning) which = g_jtdxIni; - if (which != null && which.port > -1) { + if (which != null && which.port > -1) + { g_appSettings.wsjtUdpPort = which.port; g_appSettings.wsjtIP = which.ip; } - if (which == null) { + if (which == null) + { g_appSettings.wsjtUdpPort = 2237; g_appSettings.wsjtIP = ""; } if ( ipToInt(g_appSettings.wsjtIP) >= ipToInt("224.0.0.0") && ipToInt(g_appSettings.wsjtIP) < ipToInt("240.0.0.0") - ) { + ) + { g_appSettings.multicast = true; - } else g_appSettings.multicast = false; + } + else g_appSettings.multicast = false; } // Which INI do we load? - if (g_appSettings.wsjtUdpPort) { + if (g_appSettings.wsjtUdpPort) + { which = null; if (g_wsjtxIni.port == g_appSettings.wsjtUdpPort) which = g_wsjtxIni; else if (g_jtdxIni.port == g_appSettings.wsjtUdpPort) which = g_jtdxIni; - if (which != null) { + if (which != null) + { myDEcall = which.MyCall; myDEGrid = which.MyGrid; g_lastBand = myBand; @@ -9770,11 +11204,13 @@ function updateBasedOnIni() { which != null && which.BroadcastToN1MM == true && g_N1MMSettings.enable == true - ) { + ) + { if ( which.N1MMServer == g_N1MMSettings.ip && which.N1MMServerPort == g_N1MMSettings.port - ) { + ) + { buttonN1MMCheckBox.checked = g_N1MMSettings.enable = false; localStorage.N1MMSettings = JSON.stringify(g_N1MMSettings); alert( @@ -9783,15 +11219,19 @@ function updateBasedOnIni() { ); } } - if (which != null) { - if (g_appSettings.wsjtIP == "") { + if (which != null) + { + if (g_appSettings.wsjtIP == "") + { g_appSettings.wsjtIP = which.ip; } } } if (myDEGrid.length > 0) setHomeGridsquare(); - else { - if (typeof nw != "undefined") { + else + { + if (typeof nw != "undefined") + { // lets see if we can find our location the hard way getBuffer( "https://api.ipstack.com/check?access_key=8c9233ec1c09861a707951ab3718a7f6&format=1", @@ -9804,113 +11244,143 @@ function updateBasedOnIni() { } } -function CheckReceivePortIsNotForwardPort(value) { +function CheckReceivePortIsNotForwardPort(value) +{ if ( udpForwardIpInput.value == "127.0.0.1" && udpForwardPortInput.value == value && g_appSettings.wsjtIP == "" && udpForwardEnable.checked - ) { + ) + { return false; } return true; } -function CheckForwardPortIsNotReceivePort(value) { +function CheckForwardPortIsNotReceivePort(value) +{ if ( udpForwardIpInput.value == "127.0.0.1" && udpPortInput.value == value && g_appSettings.wsjtIP == "" ) - return false; + { return false; } return true; } -function setForwardIp() { +function setForwardIp() +{ g_appSettings.wsjtForwardUdpIp = udpForwardIpInput.value; - if (ValidatePort(udpPortInput, null, CheckReceivePortIsNotForwardPort)) { + if (ValidatePort(udpPortInput, null, CheckReceivePortIsNotForwardPort)) + { setUdpPort(); } ValidatePort(udpForwardPortInput, null, CheckForwardPortIsNotReceivePort); } -function setForwardPort() { +function setForwardPort() +{ g_appSettings.wsjtForwardUdpPort = udpForwardPortInput.value; ValidateIPaddress(udpForwardIpInput, null); - if (ValidatePort(udpPortInput, null, CheckReceivePortIsNotForwardPort)) { + if (ValidatePort(udpPortInput, null, CheckReceivePortIsNotForwardPort)) + { setUdpPort(); } } -function validIpKeys(value) { +function validIpKeys(value) +{ if (value == 46) return true; return value >= 48 && value <= 57; } -function validNumberKeys(value) { +function validNumberKeys(value) +{ return value >= 48 && value <= 57; } -function validateNumAndLetter(input) { +function validateNumAndLetter(input) +{ if (/\d/.test(input) && /[A-Z]/.test(input)) return true; else return false; } -function validCallsignsKeys(value) { +function validCallsignsKeys(value) +{ if (value == 44) return true; if (value >= 47 && value <= 57) return true; if (value >= 65 && value <= 90) return true; return value >= 97 && value <= 122; } -function ValidateCallsigns(inputText, validDiv) { +function ValidateCallsigns(inputText, validDiv) +{ inputText.value = inputText.value.toUpperCase(); var callsigns = inputText.value.split(","); var passed = false; - for (var call in callsigns) { - if (callsigns[call].length > 0) { - if (/\d/.test(callsigns[call]) && /[A-Z]/.test(callsigns[call])) { + for (var call in callsigns) + { + if (callsigns[call].length > 0) + { + if (/\d/.test(callsigns[call]) && /[A-Z]/.test(callsigns[call])) + { passed = true; - } else { + } + else + { passed = false; break; } - } else { + } + else + { passed = false; break; } } - if (passed) { + if (passed) + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; - } else { + } + else + { inputText.style.color = "#000"; inputText.style.backgroundColor = "yellow"; } return passed; } -function ValidateCallsign(inputText, validDiv) { +function ValidateCallsign(inputText, validDiv) +{ addError.innerHTML = ""; - if (inputText.value.length > 0) { + if (inputText.value.length > 0) + { var passed = false; inputText.value = inputText.value.toUpperCase(); - if (/\d/.test(inputText.value) || /[A-Z]/.test(inputText.value)) { + if (/\d/.test(inputText.value) || /[A-Z]/.test(inputText.value)) + { passed = true; } - if (passed) { + if (passed) + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; if (validDiv) validDiv.innerHTML = "Valid!"; return true; - } else { + } + else + { inputText.style.color = "#000"; inputText.style.backgroundColor = "yellow"; if (validDiv) validDiv.innerHTML = "Invalid!"; return false; } - } else { + } + else + { inputText.style.color = "#000"; inputText.style.backgroundColor = "yellow"; if (validDiv) validDiv.innerHTML = "Invalid!"; @@ -9918,28 +11388,36 @@ function ValidateCallsign(inputText, validDiv) { } } -function ValidateGridsquareOnly4(inputText, validDiv) { +function ValidateGridsquareOnly4(inputText, validDiv) +{ addError.innerHTML = ""; - if (inputText.value.length == 4) { + if (inputText.value.length == 4) + { var gridSquare = ""; var LETTERS = inputText.value.substr(0, 2).toUpperCase(); var NUMBERS = inputText.value.substr(2, 2).toUpperCase(); - if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) { + if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) + { gridSquare = LETTERS + NUMBERS; } - if (gridSquare != "") { + if (gridSquare != "") + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; inputText.value = gridSquare; if (validDiv) validDiv.innerHTML = "Valid!"; return true; - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (validDiv) validDiv.innerHTML = "Invalid!"; return false; } - } else { + } + else + { inputText.style.color = "#000"; inputText.style.backgroundColor = "yellow"; if (validDiv) validDiv.innerHTML = "Valid!"; @@ -9947,67 +11425,87 @@ function ValidateGridsquareOnly4(inputText, validDiv) { } } -function validateGridFromString(inputText) { - if (inputText.length == 4 || inputText.length == 6) { +function validateGridFromString(inputText) +{ + if (inputText.length == 4 || inputText.length == 6) + { var gridSquare = ""; var LETTERS = inputText.substr(0, 2).toUpperCase(); var NUMBERS = inputText.substr(2, 2).toUpperCase(); - if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) { + if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) + { gridSquare = LETTERS + NUMBERS; } - if (inputText.length > 4) { + if (inputText.length > 4) + { var LETTERS_SUB = inputText.substr(4, 2).toUpperCase(); gridSquare = ""; if ( /^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS) && /^[A-Xa-x]+$/.test(LETTERS_SUB) - ) { + ) + { gridSquare = LETTERS + NUMBERS + LETTERS_SUB; } } - if (gridSquare != "") { + if (gridSquare != "") + { return true; - } else { + } + else + { return false; } - } else { + } + else + { return false; } } -function ValidateGridsquare(inputText, validDiv) { - if (inputText.value.length == 4 || inputText.value.length == 6) { +function ValidateGridsquare(inputText, validDiv) +{ + if (inputText.value.length == 4 || inputText.value.length == 6) + { var gridSquare = ""; var LETTERS = inputText.value.substr(0, 2).toUpperCase(); var NUMBERS = inputText.value.substr(2, 2).toUpperCase(); - if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) { + if (/^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS)) + { gridSquare = LETTERS + NUMBERS; } - if (inputText.value.length > 4) { + if (inputText.value.length > 4) + { var LETTERS_SUB = inputText.value.substr(4, 2); gridSquare = ""; if ( /^[A-R]+$/.test(LETTERS) && /^[0-9]+$/.test(NUMBERS) && /^[A-Xa-x]+$/.test(LETTERS_SUB) - ) { + ) + { gridSquare = LETTERS + NUMBERS + LETTERS_SUB; } } - if (gridSquare != "") { + if (gridSquare != "") + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; inputText.value = gridSquare; if (validDiv) validDiv.innerHTML = "Valid!"; return true; - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (validDiv) validDiv.innerHTML = "Invalid!"; return false; } - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (validDiv) validDiv.innerHTML = "Invalid!"; @@ -10015,62 +11513,85 @@ function ValidateGridsquare(inputText, validDiv) { } } -function ipToInt(ip) { +function ipToInt(ip) +{ return ip .split(".") - .map((octet, index, array) => { + .map((octet, index, array) => + { return parseInt(octet) * Math.pow(256, array.length - index - 1); }) - .reduce((prev, curr) => { + .reduce((prev, curr) => + { return prev + curr; }); } -function ValidateMulticast(inputText) { +function ValidateMulticast(inputText) +{ var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; - if (inputText.value.match(ipformat)) { - if (inputText.value != "0.0.0.0" && inputText.value != "255.255.255.255") { + if (inputText.value.match(ipformat)) + { + if (inputText.value != "0.0.0.0" && inputText.value != "255.255.255.255") + { var ipInt = ipToInt(inputText.value); - if (ipInt >= ipToInt("224.0.0.0") && ipInt < ipToInt("240.0.0.0")) { - if (ipInt > ipToInt("224.0.0.255")) { + if (ipInt >= ipToInt("224.0.0.0") && ipInt < ipToInt("240.0.0.0")) + { + if (ipInt > ipToInt("224.0.0.255")) + { inputText.style.color = "black"; inputText.style.backgroundColor = "yellow"; - } else { + } + else + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; } return true; - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; return false; } - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; return false; } - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; return false; } } -function ValidateIPaddress(inputText, checkBox) { +function ValidateIPaddress(inputText, checkBox) +{ var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; - if (inputText.value.match(ipformat)) { - if (inputText.value != "0.0.0.0" && inputText.value != "255.255.255.255") { + if (inputText.value.match(ipformat)) + { + if (inputText.value != "0.0.0.0" && inputText.value != "255.255.255.255") + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; return true; - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (checkBox) checkBox.checked = false; return false; } - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (checkBox) checkBox.checked = false; @@ -10078,20 +11599,27 @@ function ValidateIPaddress(inputText, checkBox) { } } -function ValidatePort(inputText, checkBox, callBackCheck) { +function ValidatePort(inputText, checkBox, callBackCheck) +{ var value = Number(inputText.value); - if (value > 1023 && value < 65536) { - if (callBackCheck && !callBackCheck(value)) { + if (value > 1023 && value < 65536) + { + if (callBackCheck && !callBackCheck(value)) + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (checkBox) checkBox.checked = false; return false; - } else { + } + else + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; return true; } - } else { + } + else + { inputText.style.color = "#FFF"; inputText.style.backgroundColor = "red"; if (checkBox) checkBox.checked = false; @@ -10099,17 +11627,20 @@ function ValidatePort(inputText, checkBox, callBackCheck) { } } -function workingCallsignEnableChanged(ele) { +function workingCallsignEnableChanged(ele) +{ g_appSettings.workingCallsignEnable = ele.checked; applyCallsignsAndDateDiv.style.display = ""; } -function workingDateEnableChanged(ele) { +function workingDateEnableChanged(ele) +{ g_appSettings.workingDateEnable = ele.checked; applyCallsignsAndDateDiv.style.display = ""; } -function workingDateChanged() { +function workingDateChanged() +{ var fields = workingDateValue.value.split("-"); var date = new Date( Date.UTC( @@ -10134,35 +11665,43 @@ function workingDateChanged() { applyCallsignsAndDateDiv.style.display = ""; } -function displayWorkingDate() { +function displayWorkingDate() +{ var date = new Date(g_appSettings.workingDate * 1000); workingDateString.innerHTML = dateToString(date); } var g_tempWorkingCallsigns = {}; -function workingCallsignsChanged(ele) { +function workingCallsignsChanged(ele) +{ g_tempWorkingCallsigns = {}; var callsigns = ele.value.split(","); - for (var call in callsigns) { + for (var call in callsigns) + { g_tempWorkingCallsigns[callsigns[call]] = true; } - if (callsigns.length > 0) { + if (callsigns.length > 0) + { g_appSettings.workingCallsigns = Object.assign({}, g_tempWorkingCallsigns); if (g_appSettings.workingCallsignEnable) - applyCallsignsAndDateDiv.style.display = ""; - } else applyCallsignsAndDateDiv.style.display = "none"; + { applyCallsignsAndDateDiv.style.display = ""; } + } + else applyCallsignsAndDateDiv.style.display = "none"; } -function applyCallsignsAndDates() { +function applyCallsignsAndDates() +{ clearAndLoadQSOs(); applyCallsignsAndDateDiv.style.display = "none"; } -function selectElementContents(el) { +function selectElementContents(el) +{ var body = document.body, range, sel; - if (document.createRange && window.getSelection) { + if (document.createRange && window.getSelection) + { range = document.createRange(); sel = window.getSelection(); sel.removeAllRanges(); @@ -10180,27 +11719,33 @@ function selectElementContents(el) { } } -function ipLocation(buffer, flag) { +function ipLocation(buffer, flag) +{ var obj = JSON.parse(buffer); if ( typeof obj != "undefined" && obj != null && typeof obj.latitude != "undefined" - ) { + ) + { g_appSettings.centerGridsquare = latLonToGridSquare( obj.latitude, obj.longitude ).substr(0, 6); - if (g_appSettings.centerGridsquare.length > 0) { + if (g_appSettings.centerGridsquare.length > 0) + { homeQTHInput.value = g_appSettings.centerGridsquare; if (ValidateGridsquare(homeQTHInput, null)) setCenterGridsquare(); } } } -function popupNewWindows() { - if (typeof nw != "undefined") { - win.on("new-win-policy", function (frame, url, policy) { +function popupNewWindows() +{ + if (typeof nw != "undefined") + { + win.on("new-win-policy", function (frame, url, policy) + { policy.forceNewPopup(); g_lastUrl = ""; }); @@ -10208,10 +11753,14 @@ function popupNewWindows() { } var g_lastUrl = ""; -function lockNewWindows() { - if (typeof nw != "undefined") { - win.on("new-win-policy", function (frame, url, policy) { - if (url != g_lastUrl) { +function lockNewWindows() +{ + if (typeof nw != "undefined") + { + win.on("new-win-policy", function (frame, url, policy) + { + if (url != g_lastUrl) + { nw.Shell.openExternal(url); g_lastUrl = url; } @@ -10220,7 +11769,8 @@ function lockNewWindows() { } } -function byName(a, b) { +function byName(a, b) +{ if (g_enums[a] < g_enums[b]) return -1; if (g_enums[a] > g_enums[b]) return 1; return 0; @@ -10228,53 +11778,69 @@ function byName(a, b) { var ancPrefixes = ["P", "M", "MM", "AM", "A", "NWS"]; -function callsignToDxcc(insign) { +function callsignToDxcc(insign) +{ var callsign = insign; - if (!/\d/.test(callsign) || !/[a-zA-Z]/.test(callsign)) { + if (!/\d/.test(callsign) || !/[a-zA-Z]/.test(callsign)) + { return -1; } if (callsign in g_directCallToDXCC) - return Number(g_directCallToDXCC[callsign]); + { return Number(g_directCallToDXCC[callsign]); } - if (callsign.includes("/")) { + if (callsign.includes("/")) + { var parts = callsign.split("/"); var end = parts.length - 1; - if (ancPrefixes.includes(parts[end])) { + if (ancPrefixes.includes(parts[end])) + { parts.pop(); end = parts.length - 1; } - if (end) { - if (isNaN(parts[end])) { - if (parts[1].length > parts[0].length) { + if (end) + { + if (isNaN(parts[end])) + { + if (parts[1].length > parts[0].length) + { callsign = parts[0]; - } else { + } + else + { if (callsignToDxcc(parts[1]) != -1) callsign = parts[1]; else callsign = parts[0]; } - } else callsign = parts[0]; - } else callsign = parts[0]; + } + else callsign = parts[0]; + } + else callsign = parts[0]; if (callsign in g_directCallToDXCC) - return Number(g_directCallToDXCC[callsign]); + { return Number(g_directCallToDXCC[callsign]); } } - for (var x = callsign.length; x > 0; x--) { - if (callsign.substr(0, x) in g_prefixToMap) { + for (var x = callsign.length; x > 0; x--) + { + if (callsign.substr(0, x) in g_prefixToMap) + { return Number(g_worldGeoData[g_prefixToMap[callsign.substr(0, x)]].dxcc); } } return -1; } -function loadMaidenHeadData() { +function loadMaidenHeadData() +{ var file = "./data/mh-root-prefixed.json"; - if (fs.existsSync(file)) { + if (fs.existsSync(file)) + { var fileBuf = fs.readFileSync(file, "UTF-8"); g_worldGeoData = JSON.parse(fileBuf); - for (var key in g_worldGeoData) { + for (var key in g_worldGeoData) + { g_worldGeoData[key].geo = "deleted"; g_worldGeoData[key].worked_bands = {}; g_worldGeoData[key].confirmed_bands = {}; @@ -10284,16 +11850,20 @@ function loadMaidenHeadData() { g_dxccToADIFName[g_worldGeoData[key].dxcc] = g_worldGeoData[key].aname; g_dxccToGeoData[g_worldGeoData[key].dxcc] = key; - for (var x = 0; x < g_worldGeoData[key].prefix.length; x++) { + for (var x = 0; x < g_worldGeoData[key].prefix.length; x++) + { if (g_worldGeoData[key].prefix[x].charAt(0) == "=") + { g_directCallToDXCC[g_worldGeoData[key].prefix[x].substr(1)] = g_worldGeoData[key].dxcc; + } else g_prefixToMap[g_worldGeoData[key].prefix[x]] = key; } delete g_worldGeoData[key].prefix; - for (var x = 0; x < g_worldGeoData[key].mh.length; x++) { + for (var x = 0; x < g_worldGeoData[key].mh.length; x++) + { if (!(g_worldGeoData[key].mh[x] in g_gridToDXCC)) - g_gridToDXCC[g_worldGeoData[key].mh[x]] = Array(); + { g_gridToDXCC[g_worldGeoData[key].mh[x]] = Array(); } g_gridToDXCC[g_worldGeoData[key].mh[x]].push(g_worldGeoData[key].dxcc); } @@ -10302,25 +11872,26 @@ function loadMaidenHeadData() { g_worldGeoData[key].dxcc != 110 && g_worldGeoData[key].dxcc != 6 ) - delete g_worldGeoData[key].mh; + { delete g_worldGeoData[key].mh; } } file = "./data/dxcc.json"; var files = fs.readFileSync(file); var dxccGeo = JSON.parse(files); - for (var key in dxccGeo.features) { + for (var key in dxccGeo.features) + { 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); - for (var id in countyData) { + for (var id in countyData) + { if (!(countyData[id].properties.st in g_stateToCounty)) - g_stateToCounty[countyData[id].properties.st] = Array(); + { g_stateToCounty[countyData[id].properties.st] = Array(); } g_stateToCounty[countyData[id].properties.st].push(id); var cnty = @@ -10328,7 +11899,7 @@ function loadMaidenHeadData() { "," + countyData[id].properties.n.toUpperCase().replaceAll(" ", ""); if (!(cnty in g_cntyToCounty)) - g_cntyToCounty[cnty] = countyData[id].properties.n.toProperCase(); + { g_cntyToCounty[cnty] = countyData[id].properties.n.toProperCase(); } g_countyData[cnty] = {}; g_countyData[cnty].geo = countyData[id]; @@ -10340,9 +11911,11 @@ function loadMaidenHeadData() { g_countyData[cnty].worked_modes = {}; g_countyData[cnty].confirmed_modes = {}; - for (var x in countyData[id].properties.z) { + for (var x in countyData[id].properties.z) + { var zipS = String(countyData[id].properties.z[x]); - if (!(zipS in g_zipToCounty)) { + if (!(zipS in g_zipToCounty)) + { g_zipToCounty[zipS] = Array(); } g_zipToCounty[zipS].push(cnty); @@ -10352,74 +11925,77 @@ function loadMaidenHeadData() { countyData = null; g_shapeData = JSON.parse(fs.readFileSync(g_shapeFile)); - for (var key in g_shapeData) { + for (var key in g_shapeData) + { if (g_shapeData[key].properties.alias == key) - g_shapeData[key].properties.alias = null; + { g_shapeData[key].properties.alias = null; } else if ( g_shapeData[key].properties.alias && g_shapeData[key].properties.alias.length > 2 && (g_shapeData[key].properties.alias.indexOf("US") == 0 || g_shapeData[key].properties.alias.indexOf("CA") == 0) ) - g_shapeData[key].properties.alias = null; + { g_shapeData[key].properties.alias = null; } if ( g_shapeData[key].properties.alias && g_shapeData[key].properties.alias.length < 2 ) - g_shapeData[key].properties.alias = null; - if (g_shapeData[key].properties.alias != null) { - if (key.indexOf("CN-") == 0) { + { g_shapeData[key].properties.alias = null; } + if (g_shapeData[key].properties.alias != null) + { + if (key.indexOf("CN-") == 0) + { if (g_shapeData[key].properties.alias == key.replace("CN-", "")) - g_shapeData[key].properties.alias = null; + { g_shapeData[key].properties.alias = null; } } } if ( g_shapeData[key].properties.alias != null && g_shapeData[key].properties.alias.length != 2 ) - g_shapeData[key].properties.alias = null; + { g_shapeData[key].properties.alias = null; } } - //finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6 + // finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6 // Create "US" shape from US Dxcc geos var x = g_worldGeoData[g_dxccToGeoData[291]].geo.geometry; - var y = g_shapeData["AK"].geometry; - var z = g_shapeData["HI"].geometry; + var y = g_shapeData.AK.geometry; + var z = g_shapeData.HI.geometry; var feature = { type: "Feature", geometry: { type: "GeometryCollection", - geometries: [x, y, z], + geometries: [x, y, z] }, properties: { name: "United States", center: g_worldGeoData[g_dxccToGeoData[291]].geo.properties.center, postal: "US", - type: "Country", - }, + type: "Country" + } }; - g_shapeData["US"] = feature; + g_shapeData.US = feature; - y = g_shapeData["OC"].geometry; - z = g_shapeData["AU"].geometry; - q = g_shapeData["AN"].geometry; + y = g_shapeData.OC.geometry; + z = g_shapeData.AU.geometry; + q = g_shapeData.AN.geometry; feature = { type: "Feature", geometry: { type: "GeometryCollection", - geometries: [y, z, q], + geometries: [y, z, q] }, properties: { name: "Oceania", center: [167.97602, -29.037824], postal: "OC", - type: "Continent", - }, + type: "Continent" + } }; - g_shapeData["OC"] = feature; - g_shapeData["AU"].properties.type = "Country"; + g_shapeData.OC = feature; + g_shapeData.AU.properties.type = "Country"; g_StateData = JSON.parse(fs.readFileSync("./data/state.json")); @@ -10435,10 +12011,12 @@ function loadMaidenHeadData() { g_StateData["US-HI"].mh = g_worldGeoData[100].mh; g_StateData["US-HI"].dxcc = 110; - for (var key in g_StateData) { - for (var x = 0; x < g_StateData[key].mh.length; x++) { + for (var key in g_StateData) + { + for (var x = 0; x < g_StateData[key].mh.length; x++) + { if (!(g_StateData[key].mh[x] in g_gridToState)) - g_gridToState[g_StateData[key].mh[x]] = Array(); + { g_gridToState[g_StateData[key].mh[x]] = Array(); } g_gridToState[g_StateData[key].mh[x]].push(g_StateData[key].postal); } g_StateData[key].worked_bands = {}; @@ -10453,16 +12031,20 @@ function loadMaidenHeadData() { fileBuf = fs.readFileSync(file, "UTF-8"); g_enums = JSON.parse(fileBuf); - for (var key in g_worldGeoData) { + for (var key in g_worldGeoData) + { if ( g_worldGeoData[key].pp != "" && g_worldGeoData[key].geo != "deleted" - ) { + ) + { g_enums[g_worldGeoData[key].dxcc] = g_worldGeoData[key].name; } - if (key == 270) { + if (key == 270) + { // US Mainland - for (var mh in g_worldGeoData[key].mh) { + for (var mh in g_worldGeoData[key].mh) + { var sqr = g_worldGeoData[key].mh[mh]; g_us48Data[sqr] = {}; @@ -10480,10 +12062,12 @@ function loadMaidenHeadData() { fileBuf = fs.readFileSync("./data/cqzone.json"); g_cqZones = JSON.parse(fileBuf); - for (var key in g_cqZones) { - for (var x = 0; x < g_cqZones[key].mh.length; x++) { + for (var key in g_cqZones) + { + for (var x = 0; x < g_cqZones[key].mh.length; x++) + { if (!(g_cqZones[key].mh[x] in g_gridToCQZone)) - g_gridToCQZone[g_cqZones[key].mh[x]] = Array(); + { g_gridToCQZone[g_cqZones[key].mh[x]] = Array(); } g_gridToCQZone[g_cqZones[key].mh[x]].push(String(key)); } delete g_cqZones[key].mh; @@ -10492,21 +12076,26 @@ function loadMaidenHeadData() { fileBuf = fs.readFileSync("./data/ituzone.json"); g_ituZones = JSON.parse(fileBuf); - for (var key in g_ituZones) { - for (var x = 0; x < g_ituZones[key].mh.length; x++) { + for (var key in g_ituZones) + { + for (var x = 0; x < g_ituZones[key].mh.length; x++) + { if (!(g_ituZones[key].mh[x] in g_gridToITUZone)) - g_gridToITUZone[g_ituZones[key].mh[x]] = Array(); + { g_gridToITUZone[g_ituZones[key].mh[x]] = Array(); } g_gridToITUZone[g_ituZones[key].mh[x]].push(String(key)); } delete g_ituZones[key].mh; } - for (var key in g_StateData) { - if (key.substr(0, 3) == "US-") { + for (var key in g_StateData) + { + if (key.substr(0, 3) == "US-") + { var shapeKey = key.substr(3, 2); var name = g_StateData[key].name; - if (shapeKey in g_shapeData) { + if (shapeKey in g_shapeData) + { g_wasZones[name] = {}; g_wasZones[name].geo = g_shapeData[shapeKey]; g_wasZones[name].worked = false; @@ -10545,8 +12134,10 @@ function loadMaidenHeadData() { g_wasZones[name].worked_modes = {}; g_wasZones[name].confirmed_modes = {}; - for (var key in g_shapeData) { - if (g_shapeData[key].properties.type == "Continent") { + for (var key in g_shapeData) + { + if (g_shapeData[key].properties.type == "Continent") + { var name = g_shapeData[key].properties.name; g_wacZones[name] = {}; g_wacZones[name].geo = g_shapeData[key]; @@ -10560,15 +12151,14 @@ function loadMaidenHeadData() { g_wacZones[name].confirmed_modes = {}; } } - - delete fileBuf; } } var g_timezonesEnable = 0; var g_timezoneLayer = null; -function createZoneLayer() { +function createZoneLayer() +{ g_timezoneLayer = createGeoJsonLayer( "tz", "./data/combined-with-oceans.json", @@ -10579,32 +12169,39 @@ function createZoneLayer() { g_timezoneLayer.setVisible(false); } -function toggleTimezones() { +function toggleTimezones() +{ if (g_currentOverlay != 0) return; g_timezonesEnable ^= 1; mouseOutGtFlag(); - if (g_timezonesEnable == 1) { - if (g_timezoneLayer == null) { + if (g_timezonesEnable == 1) + { + if (g_timezoneLayer == null) + { createZoneLayer(); } g_timezoneLayer.setVisible(true); - } else { - if (g_timezoneLayer != null) { + } + else + { + if (g_timezoneLayer != null) + { g_map.removeLayer(g_timezoneLayer); - delete g_timezoneLayer; g_timezoneLayer = null; } } } -function drawAllGrids() { +function drawAllGrids() +{ var borderColor = "#000"; var borderWeight = 0.5; - for (var x = -178; x < 181; x += 2) { + for (var x = -178; x < 181; x += 2) + { var fromPoint = ol.proj.fromLonLat([x, -90]); var toPoint = ol.proj.fromLonLat([x, 90]); @@ -10618,15 +12215,16 @@ function drawAllGrids() { var featureStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: borderColor, - width: borderWeight, - }), + width: borderWeight + }) }); newGridBox.setStyle(featureStyle); g_layerSources["line-grids"].addFeature(newGridBox); } - for (var x = -90; x < 91; x++) { + for (var x = -90; x < 91; x++) + { var fromPoint = ol.proj.fromLonLat([-180, x]); var toPoint = ol.proj.fromLonLat([180, x]); @@ -10640,8 +12238,8 @@ function drawAllGrids() { var featureStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: borderColor, - width: borderWeight, - }), + width: borderWeight + }) }); newGridBox.setStyle(featureStyle); @@ -10649,9 +12247,13 @@ function drawAllGrids() { } for (var x = 65; x < 83; x++) - for (var y = 65; y < 83; y++) { + { + for (var y = 65; y < 83; y++) + { for (var a = 0; a < 10; a++) - for (var b = 0; b < 10; b++) { + { + for (var b = 0; b < 10; b++) + { var LL = squareToLatLong( String.fromCharCode(x) + String.fromCharCode(y) + @@ -10663,7 +12265,7 @@ function drawAllGrids() { var point = ol.proj.fromLonLat([Lon, Lat]); var feature = new ol.Feature({ geometry: new ol.geom.Point(point), - name: String(a) + String(b), + name: String(a) + String(b) }); var featureStyle = new ol.style.Style({ @@ -10672,18 +12274,18 @@ function drawAllGrids() { font: "normal 16px sans-serif", stroke: new ol.style.Stroke({ color: "#88888888", - width: 1, + width: 1 }), text: String(a) + String(b), - offsetY: 1, - }), + offsetY: 1 + }) }); feature.setStyle(featureStyle); g_layerSources["short-grids"].addFeature(feature); feature = new ol.Feature({ geometry: new ol.geom.Point(point), - name: String(a) + String(b), + name: String(a) + String(b) }); featureStyle = new ol.style.Style({ @@ -10692,19 +12294,20 @@ function drawAllGrids() { font: "normal 16px sans-serif", stroke: new ol.style.Stroke({ color: "#88888888", - width: 1, + width: 1 }), text: String.fromCharCode(x) + String.fromCharCode(y) + String(a) + String(b), - offsetY: 1, - }), + offsetY: 1 + }) }); feature.setStyle(featureStyle); g_layerSources["long-grids"].addFeature(feature); } + } var LL = twoWideToLatLong( String.fromCharCode(x) + String.fromCharCode(y) @@ -10720,27 +12323,32 @@ function drawAllGrids() { font: "normal 24px sans-serif", stroke: new ol.style.Stroke({ color: "#88888888", - width: 1, + width: 1 }), - text: String.fromCharCode(x) + String.fromCharCode(y), - }), + text: String.fromCharCode(x) + String.fromCharCode(y) + }) }); feature.setStyle(featureStyle); g_layerSources["big-grids"].addFeature(feature); } + } } -function versionCheck(buffer, flag) { +function versionCheck(buffer, flag) +{ var version = String(buffer); - if (version.indexOf("gridtracker") == 0) { + if (version.indexOf("gridtracker") == 0) + { // good, we're looking at our version string var versionArray = version.split(":"); - if (versionArray.length == 3) { + if (versionArray.length == 3) + { // Good, there are 3 parts var stableVersion = Number(versionArray[1]); var betaVersion = Number(versionArray[2]); - if (gtVersion < stableVersion) { + if (gtVersion < stableVersion) + { var verString = String(stableVersion); main.style.display = "none"; newVersionMustDownloadDiv.innerHTML = @@ -10752,9 +12360,13 @@ function versionCheck(buffer, flag) { verString.substr(3) + " available for download.
Go there now?

"; versionDiv.style.display = "block"; - } else { - if (flag) { - if (gtVersion < betaVersion) { + } + else + { + if (flag) + { + if (gtVersion < betaVersion) + { var verString = String(betaVersion); main.style.display = "none"; newVersionMustDownloadDiv.innerHTML = @@ -10766,7 +12378,9 @@ function versionCheck(buffer, flag) { verString.substr(3) + " available for download.
Go there now?

"; versionDiv.style.display = "block"; - } else { + } + else + { main.style.display = "none"; upToDateDiv.style.display = "block"; } @@ -10776,59 +12390,70 @@ function versionCheck(buffer, flag) { } } -function onExitAppToGoWebsite() { +function onExitAppToGoWebsite() +{ require("nw.gui").Shell.openExternal("https://gridtracker.org/"); saveAndCloseApp(); } -function mailThem(address) { +function mailThem(address) +{ require("nw.gui").Shell.openExternal("mailto:" + address); } -function openSite(address) { +function openSite(address) +{ require("nw.gui").Shell.openExternal(address); } -function closeUpdateToDateDiv() { +function closeUpdateToDateDiv() +{ upToDateDiv.style.display = "none"; main.style.display = "block"; } -function cancelVersion() { +function cancelVersion() +{ main.style.display = "block"; versionDiv.style.display = "none"; } -function getBuffer(file_url, callback, flag, mode, port, cache = null) { +function getBuffer(file_url, callback, flag, mode, port, cache = null) +{ var url = require("url"); var http = require(mode); var fileBuffer = 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) { + http.get(options, function (res) + { var fsize = res.headers["content-length"]; 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) { + .on("data", function (data) + { if (fileBuffer == null) fileBuffer = data; else fileBuffer += data; }) - .on("end", function () { - if (typeof callback === "function") { + .on("end", function () + { + if (typeof callback === "function") + { // Call it, since we have confirmed it is callable callback(fileBuffer, flag, cache); } }) - .on("error", function (e) { + .on("error", function (e) + { console.error("getBuffer " + file_url + " error: " + e.message); }); }); @@ -10844,53 +12469,65 @@ function getPostBuffer( timeoutMs, timeoutCallback, who -) { +) +{ var querystring = require("querystring"); var postData = querystring.stringify(theData); var url = require("url"); 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", - "Content-Length": postData.length, - }, + "Content-Length": postData.length + } }; - var req = http.request(options, function (res) { + var req = http.request(options, function (res) + { var fsize = res.headers["content-length"]; 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) { + .on("data", function (data) + { if (fileBuffer == null) fileBuffer = data; else fileBuffer += data; }) - .on("end", function () { - if (typeof callback === "function") { + .on("end", function () + { + if (typeof callback === "function") + { // Call it, since we have confirmed it is callable callback(fileBuffer, flag, cookies); } }) - .on("error", function () { - if (typeof errorCallback === "function") { + .on("error", function () + { + if (typeof errorCallback === "function") + { errorCallback(); } }); }); - if (typeof timeoutMs == "number" && timeoutMs > 0) { - req.on("socket", function (socket) { + if (typeof timeoutMs == "number" && timeoutMs > 0) + { + req.on("socket", function (socket) + { socket.setTimeout(timeoutMs); - socket.on("timeout", function () { + socket.on("timeout", function () + { 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, callback, @@ -10902,14 +12539,17 @@ function getPostBuffer( timeoutCallback, who ); + } }); } req.write(postData); req.end(); } -function colorToHex(color) { - if (color.substr(0, 1) === "#") { +function colorToHex(color) +{ + if (color.substr(0, 1) === "#") + { return color; } var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color); @@ -10922,12 +12562,14 @@ function colorToHex(color) { return "#" + rgb; } -function setHueColor() { +function setHueColor() +{ g_mapHue = colorToHex(hueDiv.style.backgroundColor); if (g_mapHue == "#000000") g_mapHue = 0; } -function loadMapSettings() { +function loadMapSettings() +{ shadowValue.value = g_mapSettings.shadow; showDarknessTd.innerHTML = parseInt(shadowValue.value * 100) + "%"; pathWidthTd.innerHTML = pathWidthValue.value = g_appSettings.pathWidthWeight; @@ -10979,12 +12621,15 @@ function loadMapSettings() { pathColorValue.value == 0 ? "#000" : pathColorValue.value == 361 - ? "#FFF" - : "hsl(" + pathColorValue.value + ", 100%, 50%)"; - if (pathColorValue.value != 0) { + ? "#FFF" + : "hsl(" + pathColorValue.value + ", 100%, 50%)"; + if (pathColorValue.value != 0) + { pathColorDiv.style.color = "#000"; pathColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { pathColorDiv.style.color = "#FFF"; pathColorDiv.style.backgroundColor = pathColor; } @@ -10993,12 +12638,15 @@ function loadMapSettings() { qrzPathColorValue.value == 0 ? "#000" : qrzPathColorValue.value == 361 - ? "#FFF" - : "hsl(" + qrzPathColorValue.value + ", 100%, 50%)"; - if (qrzPathColorValue.value != 0) { + ? "#FFF" + : "hsl(" + qrzPathColorValue.value + ", 100%, 50%)"; + if (qrzPathColorValue.value != 0) + { qrzPathColorDiv.style.color = "#000"; qrzPathColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { qrzPathColorDiv.style.color = "#FFF"; qrzPathColorDiv.style.backgroundColor = pathColor; } @@ -11008,13 +12656,15 @@ function loadMapSettings() { displayLegend(); } -function changeDistanceUnit() { +function changeDistanceUnit() +{ g_appSettings.distanceUnit = distanceUnit.value; g_scaleLine.setUnits(g_scaleUnits[g_appSettings.distanceUnit]); goProcessRoster(); } -function changeMapNightValues() { +function changeMapNightValues() +{ g_mapSettings.nightPathColor = nightPathColorValue.value; g_mapSettings.nightQrzPathColor = nightQrzPathColorValue.value; g_mapSettings.nightMapIndex = mapNightSelect.value; @@ -11025,18 +12675,22 @@ function changeMapNightValues() { changeMapLayer(); } -function setNightHtml() { +function setNightHtml() +{ var pathColor = g_mapSettings.nightPathColor == 0 ? "#000" : g_mapSettings.nightPathColor == 361 - ? "#FFF" - : "hsl(" + g_mapSettings.nightPathColor + ", 100%, 50%)"; + ? "#FFF" + : "hsl(" + g_mapSettings.nightPathColor + ", 100%, 50%)"; - if (g_mapSettings.nightPathColor != 0) { + if (g_mapSettings.nightPathColor != 0) + { pathNightColorDiv.style.color = "#000"; pathNightColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { pathNightColorDiv.style.color = "#FFF"; pathNightColorDiv.style.backgroundColor = pathColor; } @@ -11045,18 +12699,22 @@ function setNightHtml() { g_mapSettings.nightQrzPathColor == 0 ? "#000" : g_mapSettings.nightQrzPathColor == 361 - ? "#FFF" - : "hsl(" + g_mapSettings.nightQrzPathColor + ", 100%, 50%)"; - if (g_mapSettings.nightQrzPathColor != 0) { + ? "#FFF" + : "hsl(" + g_mapSettings.nightQrzPathColor + ", 100%, 50%)"; + if (g_mapSettings.nightQrzPathColor != 0) + { pathNightQrzColorDiv.style.color = "#000"; pathNightQrzColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { pathNightQrzColorDiv.style.color = "#FFF"; pathNightQrzColorDiv.style.backgroundColor = pathColor; } } -function changeMapValues() { +function changeMapValues() +{ g_mapSettings.pathColor = pathColorValue.value; g_mapSettings.qrzPathColor = qrzPathColorValue.value; g_mapSettings.loudness = brightnessValue.value; @@ -11067,8 +12725,8 @@ function changeMapValues() { g_mapSettings.offlineMode == false && g_appSettings.gtShareEnable == true ) - g_layerVectors["gtflags"].setVisible(true); - else g_layerVectors["gtflags"].setVisible(false); + { g_layerVectors.gtflags.setVisible(true); } + else g_layerVectors.gtflags.setVisible(false); saveMapSettings(); @@ -11078,13 +12736,16 @@ function changeMapValues() { g_mapSettings.pathColor == 0 ? "#000" : g_mapSettings.pathColor == 361 - ? "#FFF" - : "hsl(" + g_mapSettings.pathColor + ", 100%, 50%)"; + ? "#FFF" + : "hsl(" + g_mapSettings.pathColor + ", 100%, 50%)"; - if (g_mapSettings.pathColor != 0) { + if (g_mapSettings.pathColor != 0) + { pathColorDiv.style.color = "#000"; pathColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { pathColorDiv.style.color = "#FFF"; pathColorDiv.style.backgroundColor = pathColor; } @@ -11093,12 +12754,15 @@ function changeMapValues() { g_mapSettings.qrzPathColor == 0 ? "#000" : g_mapSettings.qrzPathColor == 361 - ? "#FFF" - : "hsl(" + g_mapSettings.qrzPathColor + ", 100%, 50%)"; - if (g_mapSettings.qrzPathColor != 0) { + ? "#FFF" + : "hsl(" + g_mapSettings.qrzPathColor + ", 100%, 50%)"; + if (g_mapSettings.qrzPathColor != 0) + { qrzPathColorDiv.style.color = "#000"; qrzPathColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { qrzPathColorDiv.style.color = "#FFF"; qrzPathColorDiv.style.backgroundColor = pathColor; } @@ -11107,7 +12771,8 @@ function changeMapValues() { displayLegend(); } -function toggleLegend() { +function toggleLegend() +{ if (g_mapSettings.legend == true) g_mapSettings.legend = false; else g_mapSettings.legend = true; @@ -11116,25 +12781,32 @@ function toggleLegend() { displayLegend(); } -function hideLegend() { +function hideLegend() +{ LegendDiv.style.display = "none"; } -function displayLegend() { - if (g_mapSettings.legend == true) { +function displayLegend() +{ + if (g_mapSettings.legend == true) + { LegendDiv.style.display = "block"; legendImg.style.webkitFilter = ""; - } else { + } + else + { LegendDiv.style.display = "none"; legendImg.style.webkitFilter = "grayscale(1) brightness(50%)"; } } -function rgbToHex(R, G, B) { +function rgbToHex(R, G, B) +{ return toHex(R) + toHex(G) + toHex(B); } -function toHex(n) { +function toHex(n) +{ n = parseInt(n, 10); if (isNaN(n)) return "00"; n = Math.max(0, Math.min(n, 255)); @@ -11144,35 +12816,47 @@ function toHex(n) { ); } -function hexToR(h) { +function hexToR(h) +{ return parseInt(cutHex(h).substring(0, 2), 16); } -function hexToG(h) { +function hexToG(h) +{ return parseInt(cutHex(h).substring(2, 4), 16); } -function hexToB(h) { +function hexToB(h) +{ return parseInt(cutHex(h).substring(4, 6), 16); } -function hexToA(h) { +function hexToA(h) +{ return parseInt(cutHex(h).substring(6, 8), 16); } -function cutHex(h) { +function cutHex(h) +{ return h.charAt(0) == "#" ? h.substring(1, 9) : h; } -function changeMapLayer() { - if (g_mapSettings.offlineMode) { +function changeMapLayer() +{ + if (g_mapSettings.offlineMode) + { g_tileLayer.setSource(g_offlineLayer); g_tileLayer.setOpacity(Number(g_mapSettings.loudness)); - } else { - if (g_mapSettings.nightMapEnable && g_nightTime) { + } + else + { + if (g_mapSettings.nightMapEnable && g_nightTime) + { g_tileLayer.setSource(g_mapsLayer[g_mapSettings.nightMapIndex]); g_tileLayer.setOpacity(Number(g_mapSettings.nightLoudness)); - } else { + } + else + { g_tileLayer.setSource(g_mapsLayer[g_mapSettings.mapIndex]); g_tileLayer.setOpacity(Number(g_mapSettings.loudness)); } @@ -11182,23 +12866,28 @@ function changeMapLayer() { redrawSpots(); } -function voiceChangedValue() { +function voiceChangedValue() +{ g_speechSettings.voice = Number(alertVoiceInput.value) + 1; changeSpeechValues(); } -function timedGetVoices() { +function timedGetVoices() +{ g_voices = window.speechSynthesis.getVoices(); - if (g_voices.length > 0) { + if (g_voices.length > 0) + { var newSelect = document.createElement("select"); newSelect.id = "alertVoiceInput"; newSelect.title = "Select Voice"; - for (var i = 0; i < g_voices.length; i++) { + for (var i = 0; i < g_voices.length; i++) + { var option = document.createElement("option"); option.value = i; newstring = g_voices[i].name.replace(/ /g, ""); option.text = newstring; - if (g_voices[i].default) { + if (g_voices[i].default) + { option.selected = true; } newSelect.appendChild(option); @@ -11210,8 +12899,10 @@ function timedGetVoices() { loadAlerts(); } -function initSpeech() { - window.speechSynthesis.onvoiceschanged = function () { +function initSpeech() +{ + window.speechSynthesis.onvoiceschanged = function () + { setTimeout(timedGetVoices, 500); }; var msg = new SpeechSynthesisUtterance("."); @@ -11219,7 +12910,8 @@ function initSpeech() { window.speechSynthesis.speak(msg); } -function initSoundCards() { +function initSoundCards() +{ navigator.mediaDevices .enumerateDevices() .then(gotAudioDevices) @@ -11227,15 +12919,18 @@ function initSoundCards() { } function errorCallback(e) {} -function gotAudioDevices(deviceInfos) { +function gotAudioDevices(deviceInfos) +{ soundCardDiv.innerHTML = ""; var newSelect = document.createElement("select"); newSelect.id = "soundCardInput"; newSelect.title = "Select Sound Card"; - for (var i = 0; i !== deviceInfos.length; ++i) { + for (var i = 0; i !== deviceInfos.length; ++i) + { var deviceInfo = deviceInfos[i]; - if (deviceInfo.kind === "audiooutput") { + if (deviceInfo.kind === "audiooutput") + { var option = document.createElement("option"); option.value = deviceInfo.deviceId; option.text = deviceInfo.label || "Speaker " + (newSelect.length + 1); @@ -11248,42 +12943,46 @@ function gotAudioDevices(deviceInfos) { soundCardInput.value = g_soundCard; } -function soundCardChangedValue() { +function soundCardChangedValue() +{ g_appSettings.soundCard = g_soundCard = soundCardInput.value; playTestFile(); } -function setPins() { +function setPins() +{ g_colorLeafletPins = {}; g_colorLeafleteQPins = {}; g_colorLeafletQPins.worked = {}; g_colorLeafletQPins.confirmed = {}; - for (var i = 0; i < g_colorBands.length; i++) { + for (var i = 0; i < g_colorBands.length; i++) + { var pin = new ol.style.Icon({ src: "./img/pin/" + g_colorBands[i] + ".png", anchorYUnits: "pixels", anchorXUnits: "pixels", - anchor: [5, 18], + anchor: [5, 18] }); g_colorLeafletPins[g_colorBands[i]] = pin; pin = new ol.style.Icon({ src: "./img/pin/" + g_colorBands[i] + "w.png", anchorYUnits: "pixels", anchorXUnits: "pixels", - anchor: [5, 18], + anchor: [5, 18] }); g_colorLeafletQPins.worked[g_colorBands[i]] = pin; pin = new ol.style.Icon({ src: "./img/pin/" + g_colorBands[i] + "q.png", anchorYUnits: "pixels", anchorXUnits: "pixels", - anchor: [5, 18], + anchor: [5, 18] }); g_colorLeafletQPins.confirmed[g_colorBands[i]] = pin; } } -function loadViewSettings() { +function loadViewSettings() +{ gtBandFilter.value = g_appSettings.gtBandFilter; gtModeFilter.value = g_appSettings.gtModeFilter; gtPropFilter.value = g_appSettings.gtPropFilter; @@ -11336,15 +13035,21 @@ function loadViewSettings() { lookupMerge.checked = g_appSettings.lookupMerge; lookupMissingGrid.checked = g_appSettings.lookupMissingGrid; - if (g_appSettings.lookupMerge == true) { + if (g_appSettings.lookupMerge == true) + { lookupMissingGridDiv.style.display = "inline-block"; - } else { + } + else + { lookupMissingGridDiv.style.display = "none"; } - if (g_receptionSettings.viewPaths) { + if (g_receptionSettings.viewPaths) + { spotPathWidthDiv.style.display = "inline-block"; - } else { + } + else + { spotPathWidthDiv.style.display = "none"; } @@ -11352,46 +13057,55 @@ function loadViewSettings() { setRosterTimeView(); } -function loadMsgSettings() { +function loadMsgSettings() +{ msgEnable.checked = g_appSettings.gtMsgEnable; GTspotEnable.checked = g_appSettings.gtSpotEnable; pskSpotsImg.style.filter = g_spotsEnabled == 1 ? "" : "grayscale(1)"; - for (var key in g_msgSettings) { + for (var key in g_msgSettings) + { document.getElementById(key).value = g_msgSettings[key]; } ValidateText(msgAwayText); setMsgSettingsView(); } -function setMsgSettingsView() { +function setMsgSettingsView() +{ if (msgEnable.checked) msgSettingsDiv.style.display = "inline-block"; else msgSettingsDiv.style.display = "none"; - if (g_msgSettings.msgAlertSelect > 0) { + if (g_msgSettings.msgAlertSelect > 0) + { msgFrequencySelectDiv.style.display = "inline-block"; - if (g_msgSettings.msgAlertSelect == 1) { + if (g_msgSettings.msgAlertSelect == 1) + { msgAlertWord.style.display = "inline-block"; msgAlertMedia.style.display = "none"; ValidateText(msgAlertWord); } - if (g_msgSettings.msgAlertSelect == 2) { + if (g_msgSettings.msgAlertSelect == 2) + { msgAlertWord.style.display = "none"; msgAlertMedia.style.display = "inline-block"; } - } else { + } + else + { msgFrequencySelectDiv.style.display = "none"; msgAlertWord.style.display = "none"; msgAlertMedia.style.display = "none"; } if (g_msgSettings.msgAwaySelect > 0) - msgAwayTextDiv.style.display = "inline-block"; + { msgAwayTextDiv.style.display = "inline-block"; } else msgAwayTextDiv.style.display = "none"; } -function loadAdifSettings() { +function loadAdifSettings() +{ workingCallsignEnable.checked = g_appSettings.workingCallsignEnable; workingCallsignsValue.value = Object.keys( g_appSettings.workingCallsigns @@ -11402,68 +13116,94 @@ function loadAdifSettings() { workingDateEnable.checked = g_appSettings.workingDateEnable; displayWorkingDate(); - if (g_platform == "mac") { + if (g_platform == "mac") + { selectTQSLButton.style.display = "none"; } - for (var key in g_adifLogSettings.menu) { + for (var key in g_adifLogSettings.menu) + { var value = g_adifLogSettings.menu[key]; var where = key + "Div"; - if (document.getElementById(key) != null) { + if (document.getElementById(key) != null) + { document.getElementById(key).checked = value; - if (value == true) { + if (value == true) + { document.getElementById(where).style.display = "inline-block"; - } else { + } + else + { document.getElementById(where).style.display = "none"; } } } - for (var key in g_adifLogSettings.startup) { + for (var key in g_adifLogSettings.startup) + { if (document.getElementById(key) != null) - document.getElementById(key).checked = g_adifLogSettings.startup[key]; + { document.getElementById(key).checked = g_adifLogSettings.startup[key]; } } - for (var key in g_adifLogSettings.nickname) { - if (document.getElementById(key) != null) { + for (var key in g_adifLogSettings.nickname) + { + if (document.getElementById(key) != null) + { document.getElementById(key).checked = g_adifLogSettings.nickname[key]; - if (key == "nicknameeQSLCheckBox") { - if (document.getElementById(key).checked == true) { + if (key == "nicknameeQSLCheckBox") + { + if (document.getElementById(key).checked == true) + { eQSLNickname.style.display = "inline-block"; - } else { + } + else + { eQSLNickname.style.display = "none"; } } } } - for (var key in g_adifLogSettings.text) { - if (document.getElementById(key) != null) { + for (var key in g_adifLogSettings.text) + { + if (document.getElementById(key) != null) + { document.getElementById(key).value = g_adifLogSettings.text[key]; ValidateText(document.getElementById(key)); } } - for (var key in g_adifLogSettings.qsolog) { - if (document.getElementById(key) != null) { + for (var key in g_adifLogSettings.qsolog) + { + if (document.getElementById(key) != null) + { document.getElementById(key).checked = g_adifLogSettings.qsolog[key]; - if (key == "logLOTWqsoCheckBox") { - if (document.getElementById(key).checked == true) { + if (key == "logLOTWqsoCheckBox") + { + if (document.getElementById(key).checked == true) + { lotwUpload.style.display = "inline-block"; trustedTestButton.style.display = "inline-block"; - } else { + } + else + { lotwUpload.style.display = "none"; trustedTestButton.style.display = "none"; } } } } - if (clubCall.value == "" && myRawCall != "NOCALL") { + if (clubCall.value == "" && myRawCall != "NOCALL") + { clubCall.value = myRawCall; ValidateText(clubCall); localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); } - try { + try + { findTrustedQSLPaths(); - } catch (e) { - if (logLOTWqsoCheckBox.checked == true) { + } + catch (e) + { + if (logLOTWqsoCheckBox.checked == true) + { alert( "Unable to access LoTW TrustedQSL (TQSL) due to OS permissions\nLogging to LoTW disabled for this session\nRun as administrator or allow file access to GridTracker if problem persists" ); @@ -11474,25 +13214,32 @@ function loadAdifSettings() { ValidateQrzApi(qrzApiKey); } -function startupVersionInit() { - if (!g_developerMode) { - document.body.addEventListener("contextmenu", function (ev) { +function startupVersionInit() +{ + if (!g_developerMode) + { + document.body.addEventListener("contextmenu", function (ev) + { ev.preventDefault(); }); } imSureCheck.checked = false; stopAskingCheckbox.checked = g_appSettings.stopAskingVersion; - if (stopAskingCheckbox.checked == false) { + if (stopAskingCheckbox.checked == false) + { checkForNewVersion(false); - setInterval(function () { + setInterval(function () + { checkForNewVersion(false); }, 86400000); } } -function startupButtonsAndInputs() { - try { +function startupButtonsAndInputs() +{ + try + { g_pushPinMode = !(g_appSettings.pushPinMode == true); togglePushPinMode(); udpForwardEnable.checked = g_appSettings.wsjtForwardUdpEnable; @@ -11509,13 +13256,15 @@ function startupButtonsAndInputs() { rosterAlwaysOnTop.checked = g_appSettings.rosterAlwaysOnTop; - if (g_appSettings.centerGridsquare.length > 0) { + if (g_appSettings.centerGridsquare.length > 0) + { homeQTHInput.value = g_appSettings.centerGridsquare.substr(0, 6); if (ValidateGridsquare(homeQTHInput, null)) setCenterGridsquare(); } ValidateCallsign(alertValueInput, null); - if (g_mapSettings.offlineMode == true) { + if (g_mapSettings.offlineMode == true) + { conditionsButton.style.display = "none"; buttonPsk24CheckBoxDiv.style.display = "none"; buttonQRZCheckBoxDiv.style.display = "none"; @@ -11531,17 +13280,20 @@ function startupButtonsAndInputs() { } setGtShareButtons(); - } catch (e) {} + } + catch (e) {} } -function startupEventsAndTimers() { +function startupEventsAndTimers() +{ document.addEventListener("keydown", onMyKeyDown, true); document.addEventListener("keyup", onMyKeyUp, false); displayTimeInterval = setInterval(displayTime, 1000); } var g_finishedLoading = false; -function postInit() { +function postInit() +{ redrawSpots(); checkForSettings(); updateForwardListener(); @@ -11550,16 +13302,18 @@ function postInit() { g_nexradEnable = g_mapSettings.usNexrad ? 0 : 1; toggleNexrad(); - if (String(gtVersion) != String(g_startVersion)) { - //generalbut.className = "settingsTablinks"; + if (String(gtVersion) != String(g_startVersion)) + { + // generalbut.className = "settingsTablinks"; showSettingsBox(); openSettingsTab(updatebut, "updateSettingsDiv"); } g_finishedLoading = true; - //tagme + // tagme var x = document.querySelectorAll("input[type='range']"); - for (var i = 0; i < x.length; i++) { + for (var i = 0; i < x.length; i++) + { if (x[i].title.length > 0) x[i].title += "\n"; x[i].title += "(Use Arrow Keys For Smaller Increments)"; } @@ -11571,11 +13325,13 @@ function postInit() { showMessaging(false); } -document.addEventListener("dragover", function (event) { +document.addEventListener("dragover", function (event) +{ event.preventDefault(); }); -document.addEventListener("drop", function (event) { +document.addEventListener("drop", function (event) +{ event.preventDefault(); if (g_finishedLoading == true) dropHandler(event); }); @@ -11604,18 +13360,22 @@ var g_startupTable = [ [startupEventsAndTimers, "Set Events and Timers"], [registerHotKeys, "Registered Hotkeys"], [gtChatSystemInit, "User System Initialized"], - [postInit, "Finalizing System"], + [postInit, "Finalizing System"] ]; -function init() { +function init() +{ startupVersionDiv.innerHTML = gtVersionString; aboutVersionDiv.innerHTML = gtVersionString; g_currentDay = parseInt(timeNowSec() / 86400); - if (mediaCheck() == false) { + if (mediaCheck() == false) + { startupDiv.style.display = "none"; documentsDiv.style.display = "block"; searchedDocFolder.innerHTML = g_appData; - } else { + } + else + { documentsDiv.style.display = "none"; startupDiv.style.display = "block"; startupStatusDiv.innerHTML = "Starting..."; @@ -11623,13 +13383,17 @@ function init() { } } -function startupEngine() { - if (g_startupTable.length > 0) { +function startupEngine() +{ + if (g_startupTable.length > 0) + { var funcInfo = g_startupTable.shift(); funcInfo[0](); startupStatusDiv.innerHTML = funcInfo[1]; setTimeout(startupEngine, 10); - } else { + } + else + { startupStatusDiv.innerHTML = "Completed"; setTimeout(endStartup, 2000); startupAdifLoadCheck(); @@ -11637,18 +13401,21 @@ function startupEngine() { } } -function directoryInput(what) { +function directoryInput(what) +{ g_appSettings.savedAppData = what.files[0].path; init(); } -function endStartup() { +function endStartup() +{ startupDiv.style.display = "none"; main.style.display = "block"; g_map.updateSize(); } -function loadPortSettings() { +function loadPortSettings() +{ multicastEnable.checked = g_appSettings.multicast; multicastIpInput.value = g_appSettings.wsjtIP; setMulticastEnable(multicastEnable); @@ -11668,56 +13435,68 @@ var g_wsjtUdpSocketReady = false; var g_wsjtUdpSocketError = false; var g_qtToSplice = 0; -function decodeQUINT8(byteArray) { +function decodeQUINT8(byteArray) +{ g_qtToSplice = 1; return byteArray[0]; } -function encodeQBOOL(byteArray, offset, value) { +function encodeQBOOL(byteArray, offset, value) +{ return byteArray.writeUInt8(value, offset); } -function decodeQUINT32(byteArray) { +function decodeQUINT32(byteArray) +{ g_qtToSplice = 4; return byteArray.readUInt32BE(0); } -function encodeQUINT32(byteArray, offset, value) { +function encodeQUINT32(byteArray, offset, value) +{ if (value == -1) value = 4294967295; return byteArray.writeUInt32BE(value, offset); } -function decodeQINT32(byteArray) { +function decodeQINT32(byteArray) +{ g_qtToSplice = 4; return byteArray.readInt32BE(0); } -function encodeQINT32(byteArray, offset, value) { +function encodeQINT32(byteArray, offset, value) +{ return byteArray.writeInt32BE(value, offset); } -function decodeQUINT64(byteArray) { +function decodeQUINT64(byteArray) +{ var value = 0; - for (var i = 0; i < 8; i++) { + for (var i = 0; i < 8; i++) + { value = value * 256 + byteArray[i]; } g_qtToSplice = 8; return value; } -function encodeQUINT64(byteArray, offset, value) { +function encodeQUINT64(byteArray, offset, value) +{ var breakOut = Array(); - for (var i = 0; i < 8; i++) { + for (var i = 0; i < 8; i++) + { breakOut[i] = value & 0xff; value >>= 8; } - for (var i = 0; i < 8; i++) { + for (var i = 0; i < 8; i++) + { offset = encodeQBOOL(byteArray, offset, breakOut[7 - i]); } return offset; } -function decodeQUTF8(byteArray) { +function decodeQUTF8(byteArray) +{ var utf8_len = decodeQUINT32(byteArray); var result = ""; byteArray = byteArray.slice(g_qtToSplice); @@ -11727,25 +13506,30 @@ function decodeQUTF8(byteArray) { return result.toString(); } -function encodeQUTF8(byteArray, offset, value) { +function encodeQUTF8(byteArray, offset, value) +{ offset = encodeQUINT32(byteArray, offset, value.length); var wrote = byteArray.write(value, offset, value.length); return wrote + offset; } -function decodeQDOUBLE(byteArray) { +function decodeQDOUBLE(byteArray) +{ g_qtToSplice = 8; return byteArray.readDoubleBE(0); } -function encodeQDOUBLE(byteArray, offset, value) { +function encodeQDOUBLE(byteArray, offset, value) +{ return byteArray.writeDoubleBE(value, offset); } var g_forwardUdpServer = null; -function updateForwardListener() { - if (g_forwardUdpServer != null) { +function updateForwardListener() +{ + if (g_forwardUdpServer != null) + { g_forwardUdpServer.close(); } if (g_closing == true) return; @@ -11753,21 +13537,24 @@ function updateForwardListener() { var dgram = require("dgram"); g_forwardUdpServer = dgram.createSocket({ type: "udp4", - reuseAddr: true, + reuseAddr: true }); g_forwardUdpServer.on("listening", function () {}); - g_forwardUdpServer.on("error", function () { + g_forwardUdpServer.on("error", function () + { g_forwardUdpServer.close(); g_forwardUdpServer = null; }); - g_forwardUdpServer.on("message", function (originalMessage, remote) { + g_forwardUdpServer.on("message", function (originalMessage, remote) + { // Decode enough to get the rig-name, so we know who to send to var message = Object.assign({}, originalMessage); var newMessage = {}; newMessage.magic_key = decodeQUINT32(message); message = message.slice(g_qtToSplice); - if (newMessage.magic_key == 0xadbccbda) { + if (newMessage.magic_key == 0xadbccbda) + { newMessage.schema_number = decodeQUINT32(message); message = message.slice(g_qtToSplice); newMessage.type = decodeQUINT32(message); @@ -11776,7 +13563,8 @@ function updateForwardListener() { message = message.slice(g_qtToSplice); var instanceId = newMessage.Id; - if (instanceId in g_instances) { + if (instanceId in g_instances) + { wsjtUdpMessage( originalMessage, originalMessage.length, @@ -11789,23 +13577,29 @@ function updateForwardListener() { g_forwardUdpServer.bind(0); } -function sendForwardUdpMessage(msg, length, port, address) { - if (g_forwardUdpServer) { +function sendForwardUdpMessage(msg, length, port, address) +{ + if (g_forwardUdpServer) + { g_forwardUdpServer.send(msg, 0, length, port, address); } } -function wsjtUdpMessage(msg, length, port, address) { - if (g_wsjtUdpServer) { +function wsjtUdpMessage(msg, length, port, address) +{ + if (g_wsjtUdpServer) + { g_wsjtUdpServer.send(msg, 0, length, port, address); } } -function checkWsjtxListener() { +function checkWsjtxListener() +{ if ( g_wsjtUdpServer == null || (g_wsjtUdpSocketReady == false && g_wsjtUdpSocketError == true) - ) { + ) + { g_wsjtCurrentPort = -1; g_wsjtCurrentIP = "none"; } @@ -11820,14 +13614,19 @@ var g_activeIndex = 0; var g_currentID = null; -function updateWsjtxListener(port) { +function updateWsjtxListener(port) +{ if (port == g_wsjtCurrentPort && g_appSettings.wsjtIP == g_wsjtCurrentIP) - return; - if (g_wsjtUdpServer != null) { - if (multicastEnable.checked == true && g_appSettings.wsjtIP != "") { - try { + { return; } + if (g_wsjtUdpServer != null) + { + if (multicastEnable.checked == true && g_appSettings.wsjtIP != "") + { + try + { g_wsjtUdpServer.dropMembership(g_appSettings.wsjtIP); - } catch (e) {} + } + catch (e) {} } g_wsjtUdpServer.close(); g_wsjtUdpServer = null; @@ -11838,36 +13637,45 @@ function updateWsjtxListener(port) { var dgram = require("dgram"); g_wsjtUdpServer = dgram.createSocket({ type: "udp4", - reuseAddr: true, + reuseAddr: true }); - if (multicastEnable.checked == true && g_appSettings.wsjtIP != "") { - g_wsjtUdpServer.on("listening", function () { + if (multicastEnable.checked == true && g_appSettings.wsjtIP != "") + { + g_wsjtUdpServer.on("listening", function () + { var address = g_wsjtUdpServer.address(); g_wsjtUdpServer.setBroadcast(true); g_wsjtUdpServer.setMulticastTTL(128); g_wsjtUdpServer.addMembership(g_appSettings.wsjtIP); g_wsjtUdpSocketReady = true; }); - } else { + } + else + { g_appSettings.multicast = false; g_wsjtCurrentIP = g_appSettings.wsjtIP = ""; - g_wsjtUdpServer.on("listening", function () { + g_wsjtUdpServer.on("listening", function () + { g_wsjtUdpServer.setBroadcast(true); g_wsjtUdpSocketReady = true; }); } - g_wsjtUdpServer.on("error", function () { + g_wsjtUdpServer.on("error", function () + { g_wsjtUdpServer.close(); g_wsjtUdpServer = null; g_wsjtUdpSocketReady = false; g_wsjtUdpSocketError = true; }); - g_wsjtUdpServer.on("message", function (message, remote) { - if (g_closing == true) true; + g_wsjtUdpServer.on("message", function (message, remote) + { + // if (g_closing == true) true; + if ( typeof udpForwardEnable != "undefined" && udpForwardEnable.checked == true - ) { + ) + { sendForwardUdpMessage( message, message.length, @@ -11879,7 +13687,8 @@ function updateWsjtxListener(port) { var newMessage = {}; newMessage.magic_key = decodeQUINT32(message); message = message.slice(g_qtToSplice); - if (newMessage.magic_key == 0xadbccbda) { + if (newMessage.magic_key == 0xadbccbda) + { newMessage.schema_number = decodeQUINT32(message); message = message.slice(g_qtToSplice); newMessage.type = decodeQUINT32(message); @@ -11888,13 +13697,15 @@ function updateWsjtxListener(port) { message = message.slice(g_qtToSplice); var instanceId = newMessage.Id; - if (!(instanceId in g_instances)) { + if (!(instanceId in g_instances)) + { g_instances[instanceId] = {}; g_instances[instanceId].valid = false; g_instancesIndex.push(instanceId); g_instances[instanceId].intId = g_instancesIndex.length - 1; g_instances[instanceId].crEnable = true; - if (g_instancesIndex.length > 1) { + if (g_instancesIndex.length > 1) + { multiRigCRDiv.style.display = "inline-block"; haltTXDiv.style.display = "inline-block"; } @@ -11907,7 +13718,8 @@ function updateWsjtxListener(port) { if (notify) updateRosterInstances(); - if (newMessage.type == 1) { + if (newMessage.type == 1) + { newMessage.event = "Status"; newMessage.Frequency = decodeQUINT64(message); newMessage.Band = Number(newMessage.Frequency / 1000000).formatBand(); @@ -11943,36 +13755,50 @@ function updateWsjtxListener(port) { newMessage.Fastmode = decodeQUINT8(message); message = message.slice(g_qtToSplice); - if (message.length > 0) { + if (message.length > 0) + { newMessage.SopMode = decodeQUINT8(message); message = message.slice(g_qtToSplice); - } else { + } + else + { newMessage.SopMode = -1; } - if (message.length > 0) { + if (message.length > 0) + { newMessage.FreqTol = decodeQINT32(message); message = message.slice(g_qtToSplice); - } else { + } + else + { newMessage.FreqTol = -1; } - if (message.length > 0) { + if (message.length > 0) + { newMessage.TRP = decodeQINT32(message); message = message.slice(g_qtToSplice); - } else { + } + else + { newMessage.TRP = -1; } - if (message.length > 0) { + if (message.length > 0) + { newMessage.ConfName = decodeQUTF8(message); message = message.slice(g_qtToSplice); - } else { + } + else + { newMessage.ConfName = null; } g_instances[instanceId].status = newMessage; g_instances[instanceId].valid = true; } - if (g_instances[instanceId].valid == true) { - if (newMessage.type == 2) { + if (g_instances[instanceId].valid == true) + { + if (newMessage.type == 2) + { newMessage.event = "Decode"; newMessage.NW = decodeQUINT8(message); message = message.slice(g_qtToSplice); @@ -11998,10 +13824,12 @@ function updateWsjtxListener(port) { newMessage.OM = g_instances[instanceId].status.MO; newMessage.OB = g_instances[instanceId].status.Band; } - if (newMessage.type == 3) { + if (newMessage.type == 3) + { newMessage.event = "Clear"; } - if (newMessage.type == 5) { + if (newMessage.type == 5) + { newMessage.event = "QSO Logged"; newMessage.DateOff = decodeQUINT64(message); message = message.slice(g_qtToSplice); @@ -12009,7 +13837,8 @@ function updateWsjtxListener(port) { message = message.slice(g_qtToSplice); newMessage.timespecOff = decodeQUINT8(message); message = message.slice(g_qtToSplice); - if (newMessage.timespecOff == 2) { + if (newMessage.timespecOff == 2) + { newMessage.offsetOff = decodeQINT32(message); message = message.slice(g_qtToSplice); } @@ -12037,39 +13866,52 @@ function updateWsjtxListener(port) { message = message.slice(g_qtToSplice); newMessage.timespecOn = decodeQUINT8(message); message = message.slice(g_qtToSplice); - if (newMessage.timespecOn == 2) { + if (newMessage.timespecOn == 2) + { newMessage.offsetOn = decodeQINT32(message); message = message.slice(g_qtToSplice); } - if (message.length > 0) { + if (message.length > 0) + { newMessage.Operatorcall = decodeQUTF8(message); message = message.slice(g_qtToSplice); - } else newMessage.Operatorcall = ""; + } + else newMessage.Operatorcall = ""; - if (message.length > 0) { + if (message.length > 0) + { newMessage.Mycall = decodeQUTF8(message); message = message.slice(g_qtToSplice); - } else newMessage.Mycall = ""; + } + else newMessage.Mycall = ""; - if (message.length > 0) { + if (message.length > 0) + { newMessage.Mygrid = decodeQUTF8(message); message = message.slice(g_qtToSplice); - } else newMessage.Mygrid = ""; + } + else newMessage.Mygrid = ""; - if (message.length > 0) { + if (message.length > 0) + { newMessage.ExchangeSent = decodeQUTF8(message); message = message.slice(g_qtToSplice); - } else newMessage.ExchangeSent = ""; + } + else newMessage.ExchangeSent = ""; - if (message.length > 0) { + if (message.length > 0) + { newMessage.ExchangeReceived = decodeQUTF8(message); message = message.slice(g_qtToSplice); - } else newMessage.ExchangeReceived = ""; + } + else newMessage.ExchangeReceived = ""; } - if (newMessage.type == 6) { + if (newMessage.type == 6) + { newMessage.event = "Close"; } - if (newMessage.type == 10) { + if (newMessage.type == 10) + { newMessage.event = "WSPRDecode"; newMessage.NW = decodeQUINT8(message); message = message.slice(g_qtToSplice); @@ -12097,13 +13939,15 @@ function updateWsjtxListener(port) { newMessage.OM = g_instances[instanceId].status.MO; newMessage.OB = g_instances[instanceId].status.Band; } - if (newMessage.type == 12) { + if (newMessage.type == 12) + { newMessage.event = "ADIF"; newMessage.ADIF = decodeQUTF8(message); message = message.slice(g_qtToSplice); } - if (newMessage.type in g_wsjtHandlers) { + if (newMessage.type in g_wsjtHandlers) + { newMessage.remote = remote; newMessage.instance = instanceId; @@ -12120,39 +13964,48 @@ function updateWsjtxListener(port) { g_wsjtCurrentIP = g_appSettings.wsjtIP; } -function loadLookupDetails() { +function loadLookupDetails() +{ lookupService.value = g_appSettings.lookupService; - if (lookupService.value == "QRZ") { + if (lookupService.value == "QRZ") + { lookupLogin.value = g_appSettings.lookupLoginQrz; lookupPassword.value = g_appSettings.lookupPasswordQrz; } - if (lookupService.value == "QRZCQ") { + if (lookupService.value == "QRZCQ") + { lookupLogin.value = g_appSettings.lookupLoginCq; lookupPassword.value = g_appSettings.lookupPasswordCq; } - if (lookupService.value == "HAMQTH") { + if (lookupService.value == "HAMQTH") + { lookupLogin.value = g_appSettings.lookupLoginQth; lookupPassword.value = g_appSettings.lookupPasswordQth; } ValidateText(lookupLogin); ValidateText(lookupPassword); if (lookupService.value == "CALLOOK") - lookupCredentials.style.display = "none"; + { lookupCredentials.style.display = "none"; } else lookupCredentials.style.display = "block"; } -function lookupValueChanged(what) { - if (g_appSettings.lookupService != lookupService.value) { +function lookupValueChanged(what) +{ + if (g_appSettings.lookupService != lookupService.value) + { g_lastLookupCallsign = ""; - if (lookupService.value == "QRZ") { + if (lookupService.value == "QRZ") + { lookupLogin.value = g_appSettings.lookupLoginQrz; lookupPassword.value = g_appSettings.lookupPasswordQrz; } - if (lookupService.value == "QRZCQ") { + if (lookupService.value == "QRZCQ") + { lookupLogin.value = g_appSettings.lookupLoginCq; lookupPassword.value = g_appSettings.lookupPasswordCq; } - if (lookupService.value == "HAMQTH") { + if (lookupService.value == "HAMQTH") + { lookupLogin.value = g_appSettings.lookupLoginQth; lookupPassword.value = g_appSettings.lookupPasswordQth; } @@ -12161,18 +14014,22 @@ function lookupValueChanged(what) { lookupQrzTestResult.innerHTML = ""; g_qrzLookupSessionId = null; if (lookupService.value == "CALLOOK") - lookupCredentials.style.display = "none"; + { lookupCredentials.style.display = "none"; } else lookupCredentials.style.display = "block"; - if (ValidateText(lookupLogin) && ValidateText(lookupPassword)) { - if (lookupService.value == "QRZ") { + if (ValidateText(lookupLogin) && ValidateText(lookupPassword)) + { + if (lookupService.value == "QRZ") + { g_appSettings.lookupLoginQrz = lookupLogin.value; g_appSettings.lookupPasswordQrz = lookupPassword.value; } - if (lookupService.value == "QRZCQ") { + if (lookupService.value == "QRZCQ") + { g_appSettings.lookupLoginCq = lookupLogin.value; g_appSettings.lookupPasswordCq = lookupPassword.value; } - if (lookupService.value == "HAMQTH") { + if (lookupService.value == "HAMQTH") + { g_appSettings.lookupLoginQth = lookupLogin.value; g_appSettings.lookupPasswordQth = lookupPassword.value; } @@ -12181,58 +14038,73 @@ function lookupValueChanged(what) { var g_lastLookupCallsign = ""; var g_lookupTimeout = null; -function lookupCallsign(callsign, gridPass, useCache = true) { +function lookupCallsign(callsign, gridPass, useCache = true) +{ if (g_mapSettings.offlineMode == true && useCache == false) return; g_lastLookupCallsign = callsign; - if (g_lookupWindowHandle) { + if (g_lookupWindowHandle) + { g_lookupWindowHandle.window.lookupCallsignInput.value = callsign; lookupValidateCallByElement("lookupCallsignInput"); } - if (g_lookupTimeout != null) { + if (g_lookupTimeout != null) + { window.clearTimeout(g_lookupTimeout); g_lookupTimeout = null; } g_lookupTimeout = setTimeout(searchLogForCallsign, 500, callsign); if (useCache) + { getLookupCachedObject( callsign, gridPass, cacheLookupObject, continueWithLookup ); + } else continueWithLookup(callsign, gridPass); } -function continueWithLookup(callsign, gridPass) { +function continueWithLookup(callsign, gridPass) +{ setLookupDiv( "lookupInfoDiv", "Looking up " + callsign + ", please wait..." ); - if (g_appSettings.lookupService != "CALLOOK") { + if (g_appSettings.lookupService != "CALLOOK") + { g_qrzLookupCallsign = callsign; g_qrzLookupGrid = gridPass; if ( g_qrzLookupSessionId == null || timeNowSec() - g_sinceLastLookup > 3600 - ) { + ) + { g_qrzLookupSessionId = null; g_sinceLastLookup = timeNowSec(); GetSessionID(null, true); - } else { + } + else + { g_sinceLastLookup = timeNowSec(); GetLookup(true); } - } else { + } + else + { var dxcc = callsignToDxcc(callsign); var where; var ccode = 0; - if (dxcc in g_dxccToAltName) { + if (dxcc in g_dxccToAltName) + { where = g_dxccToAltName[dxcc]; ccode = g_worldGeoData[g_dxccToGeoData[dxcc]].ccode; - } else where = "Unknown"; - if (ccode == 840) { + } + else where = "Unknown"; + if (ccode == 840) + { getBuffer( "https://callook.info/" + callsign + "/json", callookResults, @@ -12241,7 +14113,9 @@ function continueWithLookup(callsign, gridPass) { 443, true ); - } else { + } + else + { var worker = "
C A L L O O K
NO-NONSENSE AMATEUR RADIO U.S.A. CALLSIGN LOOKUPS
are limited to United States and United States Territories Only
"; worker += @@ -12259,58 +14133,68 @@ function continueWithLookup(callsign, gridPass) { } } } -function callookResults(buffer, gridPass) { +function callookResults(buffer, gridPass) +{ var results = JSON.parse(buffer); - if (typeof results.status != undefined) { - if (results.status == "VALID") { + if (typeof results.status != "undefined") + { + if (results.status == "VALID") + { var callObject = {}; var dxcc = callsignToDxcc(results.current.callsign); - if (dxcc in g_dxccToAltName) callObject["land"] = g_dxccToAltName[dxcc]; - callObject["type"] = results.type; - callObject["call"] = results.current.callsign; - callObject["dxcc"] = dxcc; - callObject["email"] = ""; - callObject["class"] = results.current.operClass; - callObject["aliases"] = results.previous.callsign; - callObject["trustee"] = + if (dxcc in g_dxccToAltName) callObject.land = g_dxccToAltName[dxcc]; + callObject.type = results.type; + callObject.call = results.current.callsign; + callObject.dxcc = dxcc; + callObject.email = ""; + callObject.class = results.current.operClass; + callObject.aliases = results.previous.callsign; + callObject.trustee = results.trustee.callsign + (results.trustee.name.length > 0 ? "; " + results.trustee.name : ""); - callObject["name"] = results.name; - callObject["fname"] = ""; - callObject["addr1"] = results.address.line1; - callObject["addr2"] = results.address.line2; - callObject["addrAttn"] = results.address.attn; - callObject["lat"] = results.location.latitude; - callObject["lon"] = results.location.longitude; - callObject["grid"] = results.location.gridsquare; - callObject["efdate"] = results.otherInfo.grantDate; - callObject["expdate"] = results.otherInfo.expiryDate; - callObject["frn"] = results.otherInfo.frn; - callObject["bio"] = 0; - callObject["image"] = ""; - callObject["country"] = "United States"; - if (gridPass) callObject["gtGrid"] = gridPass; - callObject["source"] = + callObject.name = results.name; + callObject.fname = ""; + callObject.addr1 = results.address.line1; + callObject.addr2 = results.address.line2; + callObject.addrAttn = results.address.attn; + callObject.lat = results.location.latitude; + callObject.lon = results.location.longitude; + callObject.grid = results.location.gridsquare; + callObject.efdate = results.otherInfo.grantDate; + callObject.expdate = results.otherInfo.expiryDate; + callObject.frn = results.otherInfo.frn; + callObject.bio = 0; + callObject.image = ""; + callObject.country = "United States"; + if (gridPass) callObject.gtGrid = gridPass; + callObject.source = "
"; cacheLookupObject(callObject, gridPass, true); - } else if (results.status == "INVALID") { + } + else if (results.status == "INVALID") + { setLookupDiv("lookupInfoDiv", "Invalid Lookup"); - } else { + } + else + { setLookupDiv("lookupInfoDiv", "Server is down for maintenance"); } - } else setLookupDiv("lookupInfoDiv", "Unknown Lookup Error"); + } + else setLookupDiv("lookupInfoDiv", "Unknown Lookup Error"); } var g_qrzLookupSessionId = null; var g_qrzLookupCallsign = ""; var g_qrzLookupGrid = ""; var g_sinceLastLookup = 0; -function GetSessionID(resultTd, useCache) { +function GetSessionID(resultTd, useCache) +{ if (g_mapSettings.offlineMode == true) return; if (resultTd != null) resultTd.innerHTML = "Testing"; if (g_appSettings.lookupService == "QRZCQ") + { getBuffer( "https://ssl.qrzcq.com/xml?username=" + g_appSettings.lookupLoginCq + @@ -12323,7 +14207,9 @@ function GetSessionID(resultTd, useCache) { 443, useCache ); + } else if (g_appSettings.lookupService == "QRZ") + { getBuffer( "https://xmldata.qrz.com/xml/current/?username=" + g_appSettings.lookupLoginQrz + @@ -12335,7 +14221,9 @@ function GetSessionID(resultTd, useCache) { 443, useCache ); + } else + { getBuffer( "https://www.hamqth.com/xml.php?u=" + g_appSettings.lookupLoginQth + @@ -12347,78 +14235,110 @@ function GetSessionID(resultTd, useCache) { 443, useCache ); + } } -function hamQthGetSessionCallback(buffer, resultTd) { +function hamQthGetSessionCallback(buffer, resultTd) +{ var oParser = new DOMParser(); var oDOM = oParser.parseFromString(buffer, "text/xml"); var result = ""; - if (oDOM != null) { + if (oDOM != null) + { var json = XML2jsobj(oDOM.documentElement); - if (json.hasOwnProperty("session")) { - if (json.session.hasOwnProperty("session_id")) { + if (json.hasOwnProperty("session")) + { + if (json.session.hasOwnProperty("session_id")) + { result = "Valid"; g_qrzLookupSessionId = json.session.session_id; - } else { + } + else + { result = "" + json.session.error + ""; g_qrzLookupSessionId = null; } - } else { + } + else + { result = "Invalid Response"; g_qrzLookupSessionId = null; } - } else { + } + else + { result = "Unknown Error"; g_qrzLookupSessionId = null; } - if (resultTd == null) { + if (resultTd == null) + { // It's a true session Request SessionResponse(g_qrzLookupSessionId, result); - } else { + } + else + { g_qrzLookupSessionId = null; resultTd.innerHTML = result; } } -function qrzGetSessionCallback(buffer, resultTd, useCache) { +function qrzGetSessionCallback(buffer, resultTd, useCache) +{ var oParser = new DOMParser(); var oDOM = oParser.parseFromString(buffer, "text/xml"); var result = ""; - if (oDOM != null) { + if (oDOM != null) + { var json = XML2jsobj(oDOM.documentElement); - if (json.hasOwnProperty("Session")) { - if (json.Session.hasOwnProperty("Key")) { + if (json.hasOwnProperty("Session")) + { + if (json.Session.hasOwnProperty("Key")) + { result = "Valid"; g_qrzLookupSessionId = json.Session.Key; - } else { + } + else + { result = "" + json.Session.Error + ""; g_qrzLookupSessionId = null; } - } else { + } + else + { result = "Invalid Response"; g_qrzLookupSessionId = null; } - } else { + } + else + { result = "Unknown Error"; g_qrzLookupSessionId = null; } - if (resultTd == null) { + if (resultTd == null) + { // It's a true session Request SessionResponse(g_qrzLookupSessionId, result, useCache); - } else resultTd.innerHTML = result; + } + else resultTd.innerHTML = result; } -function SessionResponse(newKey, result, useCache) { +function SessionResponse(newKey, result, useCache) +{ // for QRZCQ.com as well - if (newKey == null) { + if (newKey == null) + { setLookupDiv("lookupInfoDiv", result, useCache); - } else { + } + else + { GetLookup(useCache); } } -function GetLookup(useCache) { +function GetLookup(useCache) +{ if (g_appSettings.lookupService == "QRZCQ") + { getBuffer( "https://ssl.qrzcq.com/xml?s=" + g_qrzLookupSessionId + @@ -12431,7 +14351,9 @@ function GetLookup(useCache) { 443, useCache ); + } else if (g_appSettings.lookupService == "QRZ") + { getBuffer( "http://xmldata.qrz.com/xml/current/?s=" + g_qrzLookupSessionId + @@ -12443,7 +14365,9 @@ function GetLookup(useCache) { 80, useCache ); + } else + { getBuffer( "https://www.hamqth.com/xml.php?id=" + g_qrzLookupSessionId + @@ -12456,15 +14380,19 @@ function GetLookup(useCache) { 443, useCache ); + } } -function qthHamLookupResults(buffer, gridPass, useCache) { +function qthHamLookupResults(buffer, gridPass, useCache) +{ var oParser = new DOMParser(); var oDOM = oParser.parseFromString(buffer, "text/xml"); var result = ""; - if (oDOM != null) { + if (oDOM != null) + { var json = XML2jsobj(oDOM.documentElement); - if (json.hasOwnProperty("search")) { + if (json.hasOwnProperty("search")) + { if (gridPass) json.search.gtGrid = gridPass; json.search.source = ""; cacheLookupObject(json.search, gridPass, true); - } else { + } + else + { g_qrzLookupSessionId = null; setLookupDiv( "lookupInfoDiv", "
No result for callsign

" ); } - } else { + } + else + { setLookupDiv("lookupInfoDiv", buffer); g_qrzLookupSessionId = null; } } -function qrzLookupResults(buffer, gridPass, useCache) { +function qrzLookupResults(buffer, gridPass, useCache) +{ var oParser = new DOMParser(); var oDOM = oParser.parseFromString(buffer, "text/xml"); var result = ""; - if (oDOM != null) { + if (oDOM != null) + { var json = XML2jsobj(oDOM.documentElement); - if (json.hasOwnProperty("Callsign")) { + if (json.hasOwnProperty("Callsign")) + { var call = ""; - if (json.Callsign.hasOwnProperty("callsign")) { + if (json.Callsign.hasOwnProperty("callsign")) + { json.Callsign.call = lookup.callsign; delete json.Callsign.callsign; } if (json.Callsign.hasOwnProperty("call")) call = json.Callsign.call; if (g_appSettings.lookupService == "QRZ") + { json.Callsign.source = ""; + } else + { json.Callsign.source = ""; + } if (gridPass) json.Callsign.gtGrid = gridPass; cacheLookupObject(json.Callsign, gridPass, true); - } else { + } + else + { setLookupDiv( "lookupInfoDiv", "
No result for callsign

" ); g_qrzLookupSessionId = null; } - } else { + } + else + { setLookupDiv("lookupInfoDiv", buffer); g_qrzLookupSessionId = null; } @@ -12528,10 +14472,12 @@ var g_lastLookupAddress = null; var g_Idb = null; var g_Irequest = null; -function initialDatabases() { +function initialDatabases() +{ g_Irequest = window.indexedDB.open("GridTracker", 1); - g_Irequest.onerror = function (event) { + g_Irequest.onerror = function (event) + { alert( "Database error: " + event.target.errorCode + @@ -12539,30 +14485,36 @@ function initialDatabases() { ); }; - g_Irequest.onsuccess = function (event) { + g_Irequest.onsuccess = function (event) + { g_Idb = g_Irequest.result; - if (!g_Idb.objectStoreNames.contains("lookups")) { + if (!g_Idb.objectStoreNames.contains("lookups")) + { g_Idb.createObjectStore("lookups", { keyPath: "call" }); } init(); }; - g_Irequest.onupgradeneeded = function (event) { + g_Irequest.onupgradeneeded = function (event) + { g_Idb = g_Irequest.result; - if (!g_Idb.objectStoreNames.contains("lookups")) { + if (!g_Idb.objectStoreNames.contains("lookups")) + { g_Idb.createObjectStore("lookups", { keyPath: "call" }); } init(); }; } -function addLookupObjectToIndexedDB(lookupObject) { +function addLookupObjectToIndexedDB(lookupObject) +{ var request = g_Idb .transaction(["lookups"], "readwrite") .objectStore("lookups") .put(lookupObject); - request.onerror = function (event) { + request.onerror = function (event) + { addLastTraffic("Lookup Write Issue"); }; } @@ -12573,17 +14525,20 @@ function getLookupCachedObject( resultFunction = null, noResultFunction = null, callObject = null -) { +) +{ var request = g_Idb .transaction(["lookups"], "readwrite") .objectStore("lookups") .get(call); - request.onsuccess = function (event) { + request.onsuccess = function (event) + { if ( request.result && parseInt(request.result.cached) + 604800 > timeNowSec() - ) { + ) + { // 7 days, should an option Tag! I know right?! delete request.result; request.result = null; @@ -12592,12 +14547,15 @@ function getLookupCachedObject( .objectStore("lookups") .delete(call); } - if (callObject != null) { - if (request.result != null) { + if (callObject != null) + { + if (request.result != null) + { callObject.cnty = request.result.cnty; if (callObject.cnty in g_countyData) callObject.qual = true; - else { + else + { callObject.cnty = null; callObject.qual = false; } @@ -12605,156 +14563,193 @@ function getLookupCachedObject( return; } if (request.result != null && resultFunction) - resultFunction(request.result, gridPass, false); + { resultFunction(request.result, gridPass, false); } else if (noResultFunction) noResultFunction(call, gridPass); }; - request.onerror = function (event) { + request.onerror = function (event) + { if (noResultFunction) noResultFunction(call, gridPass); }; } -function cacheLookupObject(lookup, gridPass, cacheable = false) { +function cacheLookupObject(lookup, gridPass, cacheable = false) +{ if (!("cnty" in lookup)) lookup.cnty = null; - if (lookup.hasOwnProperty("callsign")) { + if (lookup.hasOwnProperty("callsign")) + { lookup.call = lookup.callsign; delete lookup.callsign; } lookup.call = lookup.call.toUpperCase(); - if (lookup.hasOwnProperty("latitude")) { + if (lookup.hasOwnProperty("latitude")) + { lookup.lat = lookup.latitude; delete lookup.latitude; } - if (lookup.hasOwnProperty("longitude")) { + if (lookup.hasOwnProperty("longitude")) + { lookup.lon = lookup.longitude; delete lookup.longitude; } - if (lookup.hasOwnProperty("locator")) { + if (lookup.hasOwnProperty("locator")) + { lookup.grid = lookup.locator; delete lookup.locator; } - if (lookup.hasOwnProperty("website")) { + if (lookup.hasOwnProperty("website")) + { lookup.url = lookup.website; delete lookup.website; } - if (lookup.hasOwnProperty("web")) { + if (lookup.hasOwnProperty("web")) + { lookup.url = lookup.web; delete lookup.web; } - if (lookup.hasOwnProperty("qslpic")) { + if (lookup.hasOwnProperty("qslpic")) + { lookup.image = lookup.qslpic; delete lookup.qslpic; } - if (lookup.hasOwnProperty("picture")) { + if (lookup.hasOwnProperty("picture")) + { lookup.image = lookup.picture; delete lookup.picture; } - if (lookup.hasOwnProperty("address")) { + if (lookup.hasOwnProperty("address")) + { lookup.addr1 = lookup.address; delete lookup.address; } - if (lookup.hasOwnProperty("adr_city")) { + if (lookup.hasOwnProperty("adr_city")) + { lookup.addr2 = lookup.adr_city; delete lookup.adr_city; } - if (lookup.hasOwnProperty("city")) { + if (lookup.hasOwnProperty("city")) + { lookup.addr2 = lookup.city; delete lookup.city; } - if (lookup.hasOwnProperty("itu")) { + if (lookup.hasOwnProperty("itu")) + { lookup.ituzone = lookup.itu; delete lookup.itu; } - if (lookup.hasOwnProperty("cq")) { + if (lookup.hasOwnProperty("cq")) + { lookup.cqzone = lookup.cq; delete lookup.cq; } - if (lookup.hasOwnProperty("adif")) { + if (lookup.hasOwnProperty("adif")) + { lookup.dxcc = lookup.adif; delete lookup.adif; } - if (!lookup.hasOwnProperty("dxcc")) { + if (!lookup.hasOwnProperty("dxcc")) + { lookup.dxcc = callsignToDxcc(lookup.call.toUpperCase()); } - if (lookup.hasOwnProperty("adr_name")) { + if (lookup.hasOwnProperty("adr_name")) + { lookup.name = lookup.adr_name; delete lookup.adr_name; } - if (lookup.hasOwnProperty("adr_street1")) { + if (lookup.hasOwnProperty("adr_street1")) + { lookup.addr1 = lookup.adr_street1; delete lookup.adr_street1; } - if (lookup.hasOwnProperty("us_state")) { + if (lookup.hasOwnProperty("us_state")) + { lookup.state = lookup.us_state; delete lookup.us_state; } - if (lookup.hasOwnProperty("oblast")) { + if (lookup.hasOwnProperty("oblast")) + { lookup.state = lookup.oblast; delete lookup.oblast; } - if (lookup.hasOwnProperty("district")) { + if (lookup.hasOwnProperty("district")) + { lookup.state = lookup.district; delete lookup.district; } - if (lookup.hasOwnProperty("adr_zip")) { + if (lookup.hasOwnProperty("adr_zip")) + { lookup.zip = lookup.adr_zip; delete lookup.adr_zip; } - if (lookup.hasOwnProperty("adr_country")) { + if (lookup.hasOwnProperty("adr_country")) + { lookup.country = lookup.adr_country; delete lookup.adr_country; } - if (lookup.hasOwnProperty("us_county")) { + if (lookup.hasOwnProperty("us_county")) + { lookup.county = lookup.us_county; delete lookup.us_county; } - if (lookup.hasOwnProperty("qsldirect")) { + if (lookup.hasOwnProperty("qsldirect")) + { lookup.mqsl = lookup.qsldirect; delete lookup.qsldirect; } - if (lookup.hasOwnProperty("qsl")) { + if (lookup.hasOwnProperty("qsl")) + { lookup.bqsl = lookup.qsl; delete lookup.qsl; } - if (lookup.hasOwnProperty("utc_offset")) { + if (lookup.hasOwnProperty("utc_offset")) + { lookup.GMTOffset = lookup.utc_offset; delete lookup.utc_offset; } - if (lookup.hasOwnProperty("land")) { + if (lookup.hasOwnProperty("land")) + { lookup.country = lookup.land; delete lookup.land; } if ("grid" in lookup) lookup.grid = lookup.grid.toUpperCase(); - if (lookup.hasOwnProperty("state") && lookup.hasOwnProperty("county")) { + if (lookup.hasOwnProperty("state") && lookup.hasOwnProperty("county")) + { var foundCounty = false; - if (lookup.cnty == null) { + if (lookup.cnty == null) + { lookup.county = lookup.state + ", " + lookup.county; lookup.cnty = lookup.county.toUpperCase().replaceAll(" ", ""); } - if (lookup.cnty in g_countyData) { - for (var hash in g_liveCallsigns) { + if (lookup.cnty in g_countyData) + { + for (var hash in g_liveCallsigns) + { if ( g_liveCallsigns[hash].DEcall == lookup.call && g_liveCallsigns[hash].state == "US-" + lookup.state - ) { + ) + { g_liveCallsigns[hash].cnty = lookup.cnty; g_liveCallsigns[hash].qual = true; foundCounty = true; } } - if (foundCounty) { + if (foundCounty) + { goProcessRoster(); } - } else { - //console.log( "bad county: " + lookup.cnty); + } + else + { + // console.log( "bad county: " + lookup.cnty); lookup.cnty = null; } } @@ -12765,7 +14760,8 @@ function cacheLookupObject(lookup, gridPass, cacheable = false) { ); lookup.fname = ""; - if (cacheable) { + if (cacheable) + { lookup.cached = timeNowSec(); addLookupObjectToIndexedDB(lookup); } @@ -12773,7 +14769,8 @@ function cacheLookupObject(lookup, gridPass, cacheable = false) { displayLookupObject(lookup, gridPass, cacheable); } -function displayLookupObject(lookup, gridPass, fromCache = false) { +function displayLookupObject(lookup, gridPass, fromCache = false) +{ var worker = ""; var thisCall = getLookProp(lookup, "call").toUpperCase(); @@ -12786,23 +14783,28 @@ function displayLookupObject(lookup, gridPass, fromCache = false) { worker += ""; worker += ""; worker += ""; worker += ""; g_lastLookupAddress = ""; - if (getLookProp(lookup, "addrAttn").length > 0) { + if (getLookProp(lookup, "addrAttn").length > 0) + { worker += ""; worker += ""; worker += ""; - if (getLookProp(lookup, "url").length > 0) { + if (getLookProp(lookup, "url").length > 0) + { worker += ""; worker += ""; worker += ""; worker += ""; } - if (Number(getLookProp(lookup, "bio")) > 0) { + if (Number(getLookProp(lookup, "bio")) > 0) + { worker += ""; worker += ""; worker += ""; } var Aliases = joinCommaIf( getLookProp(lookup, "aliases"), getLookProp(lookup, "p_call") ); - if (Aliases.length > 0) { + if (Aliases.length > 0) + { worker += ""; if (test == "N") return ""; @@ -13054,10 +15072,13 @@ function makeYesNoRow(first, object, key) { return ""; } -function makeRow(first, object, key, clip = false) { +function makeRow(first, object, key, clip = false) +{ var value = getLookProp(object, key); - if (value.length > 0) { - if (clip) { + if (value.length > 0) + { + if (clip) + { return ( "" ); - } else { + } + else + { return ( ""; } + worker += + "
" + keys[key] + @@ -8895,8 +10152,10 @@ function createStatTable(title, infoObject, awardName) { wc1Table += ""; - for (var key in keys) { - if (keys[key] in infoObject.confirmed_types) { + for (var key in keys) + { + if (keys[key] in infoObject.confirmed_types) + { wc1Table += ""; - } else wc1Table += ""; + } + else wc1Table += ""; } wc1Table += "
" + keys[key] + @@ -8904,7 +10163,8 @@ function createStatTable(title, infoObject, awardName) { infoObject.confirmed_types[keys[key]] + ") " + "
 
 
Source
C A L L O O K
Source
HamQTH
Source
QRZ.com
Source
QRZCQ.com
"; if (lookup.dxcc > 0 && lookup.dxcc in g_dxccToGeoData) + { worker += ""; + } worker += ""; var image = getLookProp(lookup, "image"); if (image.length > 0) + { worker += ""; + } worker += "
"; worker += getLookProp(lookup, "addrAttn"); @@ -12846,7 +14848,8 @@ function displayLookupObject(lookup, gridPass, fromCache = false) { worker += "
"; var email = getLookProp(lookup, "email"); - if (email.length > 0) { + if (email.length > 0) + { worker += "
"; worker += "
Details
Website"; @@ -12877,7 +14881,8 @@ function displayLookupObject(lookup, gridPass, fromCache = false) { worker += "
Biography"; @@ -12896,14 +14901,16 @@ function displayLookupObject(lookup, gridPass, fromCache = false) { getLookProp(lookup, "efdate"), getLookProp(lookup, "expdate") ); - if (dates.length > 0) { + if (dates.length > 0) + { worker += "
Effective Dates" + dates + "
Clear
Clear
0 && country != getLookProp(lookup, "land") ) - country = getLookProp(lookup, "land"); + { country = getLookProp(lookup, "land"); } if (country == "United States") country = ""; tryToWriteAdifToDocFolder( @@ -13036,9 +15052,11 @@ function saveToCsv(lookup) { ); } -function makeYesNoRow(first, object, key) { +function makeYesNoRow(first, object, key) +{ var value = getLookProp(object, key); - if (value.length > 0) { + if (value.length > 0) + { var test = value.toUpperCase(); if (test == "Y") return "
" + first + "Yes
" + first + "No
" + first + @@ -13067,7 +15088,9 @@ function makeRow(first, object, key, clip = false) { object[key].substr(0, 45) + "
" + first + @@ -13080,19 +15103,23 @@ function makeRow(first, object, key, clip = false) { return ""; } -function getLookProp(object, key) { +function getLookProp(object, key) +{ return object.hasOwnProperty(key) ? object[key] : ""; } -function joinSpaceIf(camera1, camera2) { +function joinSpaceIf(camera1, camera2) +{ if (camera1.length > 0 && camera2.length > 0) return camera1 + " " + camera2; if (camera1.length > 0) return camera1; if (camera2.length > 0) return camera2; return ""; } -function joinCommaIf(camera1, camera2) { - if (camera1.length > 0 && camera2.length > 0) { +function joinCommaIf(camera1, camera2) +{ + if (camera1.length > 0 && camera2.length > 0) + { if (camera1.indexOf(",") > -1) return camera1 + " " + camera2; else return camera1 + ", " + camera2; } @@ -13101,13 +15128,15 @@ function joinCommaIf(camera1, camera2) { return ""; } -function joinIfBothWithDash(camera1, camera2) { +function joinIfBothWithDash(camera1, camera2) +{ if (camera1.length > 0 && camera2.length > 0) - return camera1 + " / " + camera2; + { return camera1 + " / " + camera2; } return ""; } -function startLookup(call, grid) { +function startLookup(call, grid) +{ if (call == "-") return; if (grid == "-") grid = ""; @@ -13116,51 +15145,63 @@ function startLookup(call, grid) { lookupCallsign(call, grid); } -function searchLogForCallsign(call) { +function searchLogForCallsign(call) +{ setLookupDiv("lookupLocalDiv", ""); var list = Object.values(g_QSOhash) - .filter(function (value) { + .filter(function (value) + { return value.DEcall == call; }) .sort(myBandCompare); - if (list.length > 0) { + if (list.length > 0) + { var work = {}; var conf = {}; var lastTime = 0; var lastRow = null; var dxcc = list[0].dxcc; - for (row in list) { + for (row in list) + { var what = list[row].band + "," + list[row].mode; - if (list[row].time > lastTime) { + if (list[row].time > lastTime) + { lastRow = row; lastTime = list[row].time; } - if (list[row].confirmed) { + if (list[row].confirmed) + { conf[what] = g_pskColors[list[row].band]; if (what in work) delete work[what]; - } else if (!(what in conf)) work[what] = g_pskColors[list[row].band]; + } + else if (!(what in conf)) work[what] = g_pskColors[list[row].band]; } var worker = "
"; - if (Object.keys(work).length > 0) { + if (Object.keys(work).length > 0) + { worker += ""; } - if (Object.keys(conf).length > 0) { + if (Object.keys(conf).length > 0) + { worker += ""; } - if (lastRow) { + if (lastRow) + { worker += ""; - if (Object.keys(g_blockedCQ).length > 0) - clearString = - ""; - worker += - "
Worked"; var k = Object.keys(work).sort(); - for (var key in k) { + for (var key in k) + { worker += "" + k[key] + " "; } worker += "
Confirmed"; var k = Object.keys(conf).sort(); - for (var key in k) { + for (var key in k) + { worker += "" + k[key] + " "; } worker += "
Last QSO"; worker += " { - if (systemFiles.includes(filename)) { + userFiles.forEach((filename) => + { + if (systemFiles.includes(filename)) + { var userPath = path.join(userDir, filename); var systemPath = path.join(systemDir, filename); console.log(userPath + " -- " + systemPath); - if (fs.statSync(userPath).size == fs.statSync(systemPath).size) { + if (fs.statSync(userPath).size == fs.statSync(systemPath).size) + { console.log("removing duplicate user media " + filename); - try { + try + { fs.unlinkSync(userPath); - } catch (e) { + } + catch (e) + { console.log(e); } } @@ -13246,18 +15300,23 @@ function purgeUserFiles(userDir, systemDir) { }); } -function mediaCheck() { +function mediaCheck() +{ var homeDir = g_platform == "windows" ? process.env.USERPROFILE : process.env.HOME; g_appData = path.join(homeDir, "Dokumente"); - if (!is_dir(g_appData)) { + if (!is_dir(g_appData)) + { g_appData = path.join(homeDir, "Documents"); - if (!is_dir(g_appData)) { - if (g_appSettings.savedAppData != null) { + if (!is_dir(g_appData)) + { + if (g_appSettings.savedAppData != null) + { g_appData = g_appSettings.savedAppData; if (!is_dir(g_appData)) return false; - } else return false; + } + else return false; } } @@ -13269,20 +15328,25 @@ function mediaCheck() { g_NWappData = path.join(nw.App.dataPath, "Ginternal"); - try { + try + { var userdirs = [ g_appData, g_NWappData, g_screenshotDir, g_scriptDir, - g_userMediaDir, + g_userMediaDir ]; - for (var dir of userdirs) { - if (!fs.existsSync(dir)) { + for (var dir of userdirs) + { + if (!fs.existsSync(dir)) + { fs.mkdirSync(dir); } } - } catch (e) { + } + catch (e) + { alert( "Unable to create or access " + g_appData + @@ -13318,7 +15382,8 @@ function mediaCheck() { fs.readdirSync(g_userMediaDir), fs.readdirSync(g_gtMediaDir) ); - mediaFiles.forEach((filename) => { + mediaFiles.forEach((filename) => + { var noExt = path.parse(filename).name; logEventMedia.appendChild(newOption(filename, noExt)); alertMediaSelect.appendChild(newOption(filename, noExt)); @@ -13334,7 +15399,8 @@ function mediaCheck() { var modeData = fs.readFileSync("./data/modes.json"); g_modes = JSON.parse(modeData); - for (var key in g_modes) { + for (var key in g_modes) + { gtModeFilter.appendChild(newOption(key)); } @@ -13349,46 +15415,55 @@ function mediaCheck() { // Old log filename, no longer referenced tryToDeleteLog("lotw.adif"); - try { - if (fs.existsSync(g_NWappData + "internal_qso.json")) { + try + { + if (fs.existsSync(g_NWappData + "internal_qso.json")) + { var data = JSON.parse(fs.readFileSync(g_NWappData + "internal_qso.json")); - if (typeof data.version != "undefined" && data.version == gtVersion) { + if (typeof data.version != "undefined" && data.version == gtVersion) + { g_tracker = data.tracker; - if (typeof g_tracker.worked.px == "undefined") { + if (typeof g_tracker.worked.px == "undefined") + { g_tracker.worked.px = {}; g_tracker.confirmed.px = {}; } g_QSOhash = data.g_QSOhash; - for (var i in g_QSOhash) { + for (var i in g_QSOhash) + { if ( typeof g_QSOhash[i].px == "undefined" || g_QSOhash[i].px == null - ) { + ) + { if (g_QSOhash[i].dxcc != -1) - g_QSOhash[i].px = getWpx(g_QSOhash[i].DEcall); + { g_QSOhash[i].px = getWpx(g_QSOhash[i].DEcall); } else g_QSOhash[i].px = null; } g_QSOcount++; if (g_QSOhash[i].confirmed) g_QSLcount++; } - } else { + } + else + { clearLogFilesAndCounts(); } - delete data; fs.unlinkSync(g_NWappData + "internal_qso.json"); } loadReceptionReports(); - } catch (e) {} + } + catch (e) {} return true; } -function newOption(value, text) { +function newOption(value, text) +{ if (typeof text == "undefined") text = value; var option = document.createElement("option"); option.value = value; @@ -13397,47 +15472,58 @@ function newOption(value, text) { } var g_rosterSpot = false; -function setRosterSpot(enabled) { +function setRosterSpot(enabled) +{ g_rosterSpot = enabled; } -function saveReceptionReports() { - try { +function saveReceptionReports() +{ + try + { fs.writeFileSync( g_NWappData + "spots.json", JSON.stringify(g_receptionReports) ); - } catch (e) {} + } + catch (e) {} } -function loadReceptionReports() { - try { +function loadReceptionReports() +{ + try + { var clear = true; - if (fs.existsSync(g_NWappData + "spots.json")) { + if (fs.existsSync(g_NWappData + "spots.json")) + { g_receptionReports = JSON.parse( fs.readFileSync(g_NWappData + "spots.json") ); if (timeNowSec() - g_receptionReports.lastDownloadTimeSec <= 86400) - clear = false; + { clear = false; } } - if (clear == true) { + if (clear == true) + { g_receptionReports = { lastDownloadTimeSec: 0, lastSequenceNumber: "0", - spots: {}, + spots: {} }; } - } catch (e) { + } + catch (e) + { g_receptionReports = { lastDownloadTimeSec: 0, lastSequenceNumber: "0", - spots: {}, + spots: {} }; } } -function pskSpotCheck(timeSec) { +function pskSpotCheck(timeSec) +{ if (g_mapSettings.offlineMode == true) return; if (myDEcall == null || myDEcall == "NOCALL" || myDEcall == "") return; @@ -13445,7 +15531,8 @@ function pskSpotCheck(timeSec) { if ( timeSec - g_receptionReports.lastDownloadTimeSec > 120 && (g_spotsEnabled == 1 || g_rosterSpot) - ) { + ) + { g_receptionReports.lastDownloadTimeSec = timeSec; localStorage.receptionSettings = JSON.stringify(g_receptionSettings); spotRefreshDiv.innerHTML = "..refreshing.."; @@ -13461,28 +15548,36 @@ function pskSpotCheck(timeSec) { "https", 443 ); - } else if (g_spotsEnabled == 1) { + } + else if (g_spotsEnabled == 1) + { spotRefreshDiv.innerHTML = "Refresh: " + Number(120 - (timeSec - g_receptionReports.lastDownloadTimeSec)).toDHMS(); } } -function pskSpotResults(buffer, flag) { +function pskSpotResults(buffer, flag) +{ var oParser = new DOMParser(); var oDOM = oParser.parseFromString(buffer, "text/xml"); var result = ""; - if (oDOM != null) { + if (oDOM != null) + { var json = XML2jsobj(oDOM.documentElement); - if (typeof json.lastSequenceNumber != "undefined") { + if (typeof json.lastSequenceNumber != "undefined") + { g_receptionReports.lastSequenceNumber = json.lastSequenceNumber.value; - if (typeof json.receptionReport != "undefined") { - for (var key in json.receptionReport) { + if (typeof json.receptionReport != "undefined") + { + for (var key in json.receptionReport) + { if ( typeof json.receptionReport[key].frequency != "undefined" && typeof json.receptionReport[key].sNR != "undefined" - ) { + ) + { var report; var call = json.receptionReport[key].receiverCallsign; var mode = json.receptionReport[key].mode; @@ -13492,14 +15587,17 @@ function pskSpotResults(buffer, flag) { ).formatBand(); var hash = call + mode + band + grid.substr(0, 4); - if (hash in g_receptionReports.spots) { + if (hash in g_receptionReports.spots) + { report = g_receptionReports.spots[hash]; if ( parseInt(json.receptionReport[key].flowStartSeconds) < report.when ) - continue; - } else { + { continue; } + } + else + { report = g_receptionReports.spots[hash] = {}; report.call = call; report.band = band; @@ -13509,9 +15607,11 @@ function pskSpotResults(buffer, flag) { if ( typeof json.receptionReport[key].receiverCallsign != "undefined" ) + { report.dxcc = callsignToDxcc( json.receptionReport[key].receiverCallsign ); + } else report.dxcc = -1; report.when = parseInt(json.receptionReport[key].flowStartSeconds); report.snr = json.receptionReport[key].sNR; @@ -13537,9 +15637,12 @@ function pskSpotResults(buffer, flag) { var g_oamsSpotTimeout = null; -function addNewOAMSSpot(cid, db) { - if (cid in g_gtFlagPins) { - if (g_oamsSpotTimeout !== null) { +function addNewOAMSSpot(cid, db) +{ + if (cid in g_gtFlagPins) + { + if (g_oamsSpotTimeout !== null) + { clearTimeout(g_oamsSpotTimeout); g_oamsSpotTimeout = null; } @@ -13550,9 +15653,12 @@ function addNewOAMSSpot(cid, db) { var band = g_gtFlagPins[cid].band; var hash = call + mode + band + grid.substr(0, 4); - if (hash in g_receptionReports.spots) { + if (hash in g_receptionReports.spots) + { report = g_receptionReports.spots[hash]; - } else { + } + else + { report = g_receptionReports.spots[hash] = {}; report.call = call; report.band = band; @@ -13574,7 +15680,8 @@ function addNewOAMSSpot(cid, db) { } } -function spotFeature(center) { +function spotFeature(center) +{ return new ol.Feature( ol.geom.Polygon.circular(center, 30000, 63).transform( "EPSG:4326", @@ -13585,7 +15692,8 @@ function spotFeature(center) { var g_spotTotalCount = 0; -function createSpot(report, key, fromPoint, addToLayer = true) { +function createSpot(report, key, fromPoint, addToLayer = true) +{ var LL = squareToLatLongAll(report.grid); var Lat = LL.la2 - (LL.la2 - LL.la1) / 2; @@ -13602,26 +15710,27 @@ function createSpot(report, key, fromPoint, addToLayer = true) { ? g_receptionSettings.pathNightColor : g_receptionSettings.pathColor; - if (workingColor != -1) { + if (workingColor != -1) + { var testColor = workingColor < 1 ? "#0000000" : workingColor == 361 - ? "#FFFFFF" - : "hsla(" + workingColor + ", 100%, 50%," + report.color / 255 + ")"; + ? "#FFFFFF" + : "hsla(" + workingColor + ", 100%, 50%," + report.color / 255 + ")"; if (workingColor < 1 || workingColor == 361) - spotColor = intAlphaToRGB(testColor.substr(0, 7), report.color); + { spotColor = intAlphaToRGB(testColor.substr(0, 7), report.color); } else spotColor = testColor; } featureStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: spotColor, + color: spotColor }), stroke: new ol.style.Stroke({ color: "#000000FF", - width: 0.25, - }), + width: 0.25 + }) }); spot.setStyle(featureStyle); spot.spot = key; @@ -13634,34 +15743,36 @@ function createSpot(report, key, fromPoint, addToLayer = true) { var pointFeature = new ol.Feature({ geometry: lonLat, - weight: report.color / 255, // e.g. temperature + weight: report.color / 255 // e.g. temperature }); g_layerSources["psk-heat"].addFeature(pointFeature); - if (g_receptionSettings.viewPaths && g_receptionSettings.spotWidth > 0) { + if (g_receptionSettings.viewPaths && g_receptionSettings.spotWidth > 0) + { var strokeWeight = g_receptionSettings.spotWidth; var flightColor = workingColor == -1 ? colorNoAlpha + "BB" : g_mapSettings.nightMapEnable && g_nightTime - ? g_spotNightFlightColor - : g_spotFlightColor; + ? g_spotNightFlightColor + : g_spotFlightColor; var feature = flightFeature( [fromPoint, toPoint], { weight: strokeWeight, color: flightColor, - steps: 75, + steps: 75 }, "psk-flights", false ); } } -function redrawSpots() { +function redrawSpots() +{ var shouldSave = false; var now = timeNowSec(); g_spotTotalCount = 0; @@ -13672,17 +15783,20 @@ function redrawSpots() { var fromPoint = getPoint(myRawGrid); - if (g_receptionSettings.mergeSpots == false) { + if (g_receptionSettings.mergeSpots == false) + { var spot = iconFeature(fromPoint, g_gtFlagIcon, 100); g_layerSources["psk-spots"].addFeature(spot); g_layerSources["psk-heat"].addFeature(spot); } - for (var key in g_receptionReports.spots) { + for (var key in g_receptionReports.spots) + { report = g_receptionReports.spots[key]; - if (now - report.when > 86400) { + if (now - report.when > 86400) + { delete g_receptionReports.spots[key]; shouldSave = true; continue; @@ -13694,37 +15808,45 @@ function redrawSpots() { ? myBand == report.band : g_appSettings.gtBandFilter == report.band)) && validateMapMode(report.mode) - ) { - if (now - report.when <= g_receptionSettings.viewHistoryTimeSec) { + ) + { + if (now - report.when <= g_receptionSettings.viewHistoryTimeSec) + { createSpot(report, key, fromPoint); g_spotTotalCount++; } } } - if (shouldSave) { + if (shouldSave) + { saveReceptionReports(); } updateSpotCountDiv(); } -function updateSpotCountDiv() { +function updateSpotCountDiv() +{ spotCountDiv.innerHTML = "Spots: " + g_spotTotalCount; } var g_spotFlightColor = "#FFFFFFBB"; var g_spotNightFlightColor = "#FFFFFFBB"; -function changeSpotValues() { +function changeSpotValues() +{ g_receptionSettings.viewHistoryTimeSec = parseInt(spotHistoryTimeValue.value) * 60; spotHistoryTimeTd.innerHTML = "Max Age: " + Number(g_receptionSettings.viewHistoryTimeSec).toDHM(); g_receptionSettings.viewPaths = spotPathsValue.checked; - if (g_receptionSettings.viewPaths) { + if (g_receptionSettings.viewPaths) + { spotPathWidthDiv.style.display = "inline-block"; - } else { + } + else + { spotPathWidthDiv.style.display = "none"; } @@ -13736,7 +15858,8 @@ function changeSpotValues() { if (g_rosterSpot) goProcessRoster(); } -function mapTransChange() { +function mapTransChange() +{ g_mapSettings.mapTrans = mapTransValue.value; mapTransTd.innerHTML = @@ -13745,95 +15868,110 @@ function mapTransChange() { "rgba(0,0,0, " + g_mapSettings.mapTrans + ")"; } -function spotPathChange() { +function spotPathChange() +{ g_receptionSettings.pathColor = spotPathColorValue.value; var pathColor = g_receptionSettings.pathColor < 1 ? "#000" : g_receptionSettings.pathColor == 361 - ? "#FFF" - : "hsl(" + g_receptionSettings.pathColor + ", 100%, 50%)"; - if (g_receptionSettings.pathColor > 0) { + ? "#FFF" + : "hsl(" + g_receptionSettings.pathColor + ", 100%, 50%)"; + if (g_receptionSettings.pathColor > 0) + { spotPathColorDiv.style.color = "#000"; spotPathColorDiv.style.backgroundColor = pathColor; - } else { + } + else + { spotPathColorDiv.style.color = "#FFF"; spotPathColorDiv.style.backgroundColor = pathColor; } if (g_receptionSettings.pathColor == -1) - spotPathInfoTd.innerHTML = "PSK-Reporter Palette"; + { spotPathInfoTd.innerHTML = "PSK-Reporter Palette"; } else spotPathInfoTd.innerHTML = ""; g_spotFlightColor = g_receptionSettings.pathColor < 1 ? "#0000000BB" : g_receptionSettings.pathColor == 361 - ? "#FFFFFFBB" - : "hsla(" + g_receptionSettings.pathColor + ", 100%, 50%,0.73)"; + ? "#FFFFFFBB" + : "hsla(" + g_receptionSettings.pathColor + ", 100%, 50%,0.73)"; g_receptionSettings.pathNightColor = spotNightPathColorValue.value; var pathNightColor = g_receptionSettings.pathNightColor < 1 ? "#000" : g_receptionSettings.pathNightColor == 361 - ? "#FFF" - : "hsl(" + g_receptionSettings.pathNightColor + ", 100%, 50%)"; - if (g_receptionSettings.pathNightColor > 0) { + ? "#FFF" + : "hsl(" + g_receptionSettings.pathNightColor + ", 100%, 50%)"; + if (g_receptionSettings.pathNightColor > 0) + { spotNightPathColorDiv.style.color = "#000"; spotNightPathColorDiv.style.backgroundColor = pathNightColor; - } else { + } + else + { spotNightPathColorDiv.style.color = "#FFF"; spotNightPathColorDiv.style.backgroundColor = pathNightColor; } if (g_receptionSettings.pathNightColor == -1) - spotNightPathInfoTd.innerHTML = "PSK-Reporter Palette"; + { spotNightPathInfoTd.innerHTML = "PSK-Reporter Palette"; } else spotNightPathInfoTd.innerHTML = ""; g_spotNightFlightColor = g_receptionSettings.pathNightColor < 1 ? "#0000000BB" : g_receptionSettings.pathNightColor == 361 - ? "#FFFFFFBB" - : "hsla(" + g_receptionSettings.pathNightColor + ", 100%, 50%,0.73)"; + ? "#FFFFFFBB" + : "hsla(" + g_receptionSettings.pathNightColor + ", 100%, 50%,0.73)"; spotWidthTd.innerHTML = g_receptionSettings.spotWidth = spotWidthValue.value; localStorage.receptionSettings = JSON.stringify(g_receptionSettings); } -function toggleSpotOverGrids() { - spotMergeValue.checked = spotMergeValue.checked == true ? false : true; +function toggleSpotOverGrids() +{ + spotMergeValue.checked = spotMergeValue.checked != true; changeSpotValues(); redrawSpots(); } -function toggleMergeOverlay() { - mergeOverlayValue.checked = mergeOverlayValue.checked == true ? false : true; +function toggleMergeOverlay() +{ + mergeOverlayValue.checked = mergeOverlayValue.checked != true; changeMergeOverlayValue(); } -function toggleSpotPaths() { +function toggleSpotPaths() +{ var spotPaths = spotPathsValue.checked == true ? 1 : 0; spotPaths ^= 1; - spotPathsValue.checked = spotPaths == 1 ? true : false; + spotPathsValue.checked = spotPaths == 1; g_receptionSettings.viewPaths = spotPathsValue.checked; localStorage.receptionSettings = JSON.stringify(g_receptionSettings); - if (g_receptionSettings.viewPaths) { + if (g_receptionSettings.viewPaths) + { spotPathWidthDiv.style.display = "inline-block"; - } else { + } + else + { spotPathWidthDiv.style.display = "none"; } redrawSpots(); } -function toggleHeatSpots() { +function toggleHeatSpots() +{ g_heatEnabled ^= 1; g_appSettings.heatEnabled = g_heatEnabled; updateSpotView(); } -function togglePskSpots() { +function togglePskSpots() +{ g_spotsEnabled ^= 1; g_appSettings.spotsEnabled = g_spotsEnabled; pskSpotsImg.style.filter = g_spotsEnabled == 1 ? "" : "grayscale(1)"; @@ -13841,33 +15979,45 @@ function togglePskSpots() { updateSpotView(); } -function toggleCRScript() { +function toggleCRScript() +{ g_crScript ^= 1; g_appSettings.crScript = g_crScript; if (g_crScript == 1) + { addLastTraffic( "Call Roster Script Enabled" ); + } else + { addLastTraffic( "Call Roster Script Disabled" ); + } goProcessRoster(); } -function updateSpotView(leaveCount = true) { - if (g_spotsEnabled == 1) { - if (g_receptionSettings.mergeSpots == false) { - for (var key in g_layerVectors) { +function updateSpotView(leaveCount = true) +{ + if (g_spotsEnabled == 1) + { + if (g_receptionSettings.mergeSpots == false) + { + for (var key in g_layerVectors) + { g_layerVectors[key].setVisible(false); } } - if (g_heatEnabled == 0) { + if (g_heatEnabled == 0) + { g_layerVectors["psk-spots"].setVisible(true); g_layerVectors["psk-flights"].setVisible(true); g_layerVectors["psk-hop"].setVisible(true); g_layerVectors["psk-heat"].setVisible(false); - } else { + } + else + { g_layerVectors["psk-spots"].setVisible(false); g_layerVectors["psk-flights"].setVisible(false); g_layerVectors["psk-hop"].setVisible(false); @@ -13876,7 +16026,9 @@ function updateSpotView(leaveCount = true) { SpotsDiv.style.display = "block"; if (leaveCount == false) spotRefreshDiv.innerHTML = " "; - } else { + } + else + { g_layerVectors["psk-spots"].setVisible(false); g_layerVectors["psk-flights"].setVisible(false); g_layerVectors["psk-hop"].setVisible(false); @@ -13884,53 +16036,66 @@ function updateSpotView(leaveCount = true) { SpotsDiv.style.display = "none"; spotRefreshDiv.innerHTML = " "; } - g_layerVectors["strikes"].setVisible(true); + g_layerVectors.strikes.setVisible(true); } -function gotoDonate() { +function gotoDonate() +{ var gui = require("nw.gui"); gui.Shell.openExternal("https://gridtracker.org/donations/"); } -function changeRosterTime() { +function changeRosterTime() +{ g_mapSettings.rosterTime = rosterTime.value; setRosterTimeView(); saveMapSettings(); goProcessRoster(); } -function changeRosterTop(butt) { +function changeRosterTop(butt) +{ g_appSettings.rosterAlwaysOnTop = butt.checked; setRosterTop(); } -function setRosterTop() { - if (g_callRosterWindowHandle) { - try { +function setRosterTop() +{ + if (g_callRosterWindowHandle) + { + try + { g_callRosterWindowHandle.setAlwaysOnTop(g_appSettings.rosterAlwaysOnTop); - } catch (e) {} + } + catch (e) {} } } -function setRosterTimeView() { +function setRosterTimeView() +{ rosterTime.value = g_mapSettings.rosterTime; rosterTimeTd.innerHTML = Number(rosterTime.value).toDHMS(); } -function getSpotTime(hash) { - if (hash in g_receptionReports.spots) { +function getSpotTime(hash) +{ + if (hash in g_receptionReports.spots) + { return g_receptionReports.spots[hash]; - } else return null; + } + else return null; } -function setGridOpacity() { +function setGridOpacity() +{ opacityValue.value = g_mapSettings.gridAlpha; showOpacityTd.innerHTML = parseInt((g_mapSettings.gridAlpha / 255) * 100) + "%"; g_gridAlpha = parseInt(g_mapSettings.gridAlpha).toString(16); } -function changeGridOpacity() { +function changeGridOpacity() +{ g_mapSettings.gridAlpha = opacityValue.value; showOpacityTd.innerHTML = parseInt((g_mapSettings.gridAlpha / 255) * 100) + "%"; @@ -13938,7 +16103,8 @@ function changeGridOpacity() { saveMapSettings(); } -function currentTimeStampString() { +function currentTimeStampString() +{ var now = new Date(); return ( now.getFullYear() + @@ -13955,15 +16121,18 @@ function currentTimeStampString() { ); } -function showNativeFolder(fn) { +function showNativeFolder(fn) +{ nw.Shell.showItemInFolder(decodeURI(fn)); } -function makeScreenshots() { +function makeScreenshots() +{ var win = gui.Window.get(); win.capturePage( - function (buffer) { + function (buffer) + { var clipboard = nw.Clipboard.get(); clipboard.set(buffer, "png", true); }, @@ -13971,8 +16140,10 @@ function makeScreenshots() { ); win.capturePage( - function (buffer) { - try { + function (buffer) + { + try + { var fn = g_screenshotDir + "Screenshot " + currentTimeStampString() + ".png"; fs.writeFileSync(fn, buffer); @@ -13981,7 +16152,9 @@ function makeScreenshots() { encodeURI(fn).trim() + "\");''>Saved Screenshot" ); - } catch (e) { + } + catch (e) + { addLastTraffic( "Screenshot write failed" ); @@ -13991,10 +16164,11 @@ function makeScreenshots() { ); } -window.addEventListener("load", function () { +window.addEventListener("load", function () +{ picker.attach({ target: "workingDateValue", container: "pick-inline", - fire: "workingDateChanged", + fire: "workingDateChanged" }); }); diff --git a/package.nw/lib/gtws.js b/package.nw/lib/gtws.js index 8dd55c7d..4fbca48d 100644 --- a/package.nw/lib/gtws.js +++ b/package.nw/lib/gtws.js @@ -9,7 +9,7 @@ var g_chatRecvFunctions = { info: gtChatUpdateCall, drop: gtChatRemoveCall, mesg: gtChatMessage, - o: gtSpotMessage, + o: gtSpotMessage }; var ChatState = Object(); @@ -30,7 +30,7 @@ var g_gtStateToFunction = { 3: gtChatSendUUID, 4: gtStatusCheck, 5: gtInError, - 6: gtClosedSocket, + 6: gtClosedSocket }; var g_gtChatSocket = null; @@ -55,69 +55,84 @@ var myRoom = 0; var g_gtChatlistChangeCount = 0; var g_gtCurrentMessageCount = 0; -function gtConnectChat() { - if (g_gtChatSocket != null) { +function gtConnectChat() +{ + if (g_gtChatSocket != null) + { // we should start over g_gtState = ChatState.error; return; } var rnd = parseInt(Math.random() * 10) + 18260; - try { + try + { g_gtState = ChatState.connecting; g_gtChatSocket = new WebSocket("wss://tagloomis.com:" + rnd); - } catch (e) { + } + catch (e) + { g_gtState = ChatState.error; return; } - g_gtChatSocket.onopen = function () { + g_gtChatSocket.onopen = function () + { g_gtState = ChatState.connected; }; - g_gtChatSocket.onmessage = function (evt) { - if (g_appSettings.gtShareEnable == true) { + g_gtChatSocket.onmessage = function (evt) + { + if (g_appSettings.gtShareEnable == true) + { var jsmesg = false; - try { + try + { jsmesg = JSON.parse(evt.data); - } catch (err) { + } + catch (err) + { // bad message, dumping client g_gtState = ChatState.error; return; } - if (typeof jsmesg.type == "undefined") { + if (typeof jsmesg.type == "undefined") + { g_gtState = ChatState.error; - delete jsmesg; return; } - if (jsmesg.type in g_chatRecvFunctions) { + if (jsmesg.type in g_chatRecvFunctions) + { g_chatRecvFunctions[jsmesg.type](jsmesg); - delete jsmesg; - } else { + } + else + { g_gtState = ChatState.error; - delete jsmesg; - return; } } }; - g_gtChatSocket.onerror = function () { + g_gtChatSocket.onerror = function () + { g_gtState = ChatState.error; }; - g_gtChatSocket.onclose = function () { + g_gtChatSocket.onclose = function () + { g_gtState = ChatState.closed; }; } function gtConnecting() {} -function gtInError() { +function gtInError() +{ closeGtSocket(); } -function gtChatSendClose() { +function gtChatSendClose() +{ msg = Object(); msg.type = "close"; msg.uuid = g_appSettings.chatUUID; @@ -125,71 +140,91 @@ function gtChatSendClose() { sendGtJson(JSON.stringify(msg)); } -function closeGtSocket() { - if (g_gtChatSocket != null) { +function closeGtSocket() +{ + if (g_gtChatSocket != null) + { gtChatSendClose(); if (g_gtChatSocket.readyState != WebSocket.CLOSED) g_gtChatSocket.close(); - if (g_gtChatSocket.readyState === WebSocket.CLOSED) { - delete g_gtChatSocket; + if (g_gtChatSocket.readyState === WebSocket.CLOSED) + { g_gtChatSocket = null; g_gtState = ChatState.none; } - } else g_gtState = ChatState.none; + } + else g_gtState = ChatState.none; } -function gtClosedSocket() { - delete g_gtChatSocket; +function gtClosedSocket() +{ g_gtChatSocket = null; g_gtState = ChatState.none; } -function gtCanConnect() { +function gtCanConnect() +{ g_gtState = ChatState.connect; } -function gtSetIdle() { +function gtSetIdle() +{ g_gtStatusCount = 0; g_gtNeedUsersList = true; g_gtState = ChatState.idle; g_lastGtStatus = ""; } -function gtStatusCheck() { - if (g_gtStatusCount > 0) { +function gtStatusCheck() +{ + if (g_gtStatusCount > 0) + { g_gtStatusCount--; } - if (g_gtStatusCount == 0 || g_gtLiveStatusUpdate == true) { - if (g_gtLiveStatusUpdate == true) { + if (g_gtStatusCount == 0 || g_gtLiveStatusUpdate == true) + { + if (g_gtLiveStatusUpdate == true) + { g_gtLiveStatusUpdate = false; - } else { + } + else + { g_lastGtStatus = ""; g_gtStatusCount = g_gtStatusTime; } gtChatSendStatus(); } - if (g_gtNeedUsersList == true) { + if (g_gtNeedUsersList == true) + { g_gtNeedUsersList = false; gtChatGetList(); } } -function sendGtJson(json) { - if (g_gtChatSocket != null) { - if (g_gtChatSocket.readyState === WebSocket.OPEN) { +function sendGtJson(json) +{ + if (g_gtChatSocket != null) + { + if (g_gtChatSocket.readyState === WebSocket.OPEN) + { g_gtChatSocket.send(json); - } else { - if (g_gtChatSocket.readyState === WebSocket.CLOSED) { + } + else + { + if (g_gtChatSocket.readyState === WebSocket.CLOSED) + { g_gtState = ChatState.closed; } } - } else g_gtState = ChatState.closed; + } + else g_gtState = ChatState.closed; } var g_lastGtStatus = ""; -function gtChatSendStatus() { +function gtChatSendStatus() +{ var msg = Object(); msg.type = "status"; msg.uuid = g_appSettings.chatUUID; @@ -203,13 +238,15 @@ function gtChatSendStatus() { msg.o = g_appSettings.gtSpotEnable == true ? 1 : 0; msg = JSON.stringify(msg); - if (msg != g_lastGtStatus) { + if (msg != g_lastGtStatus) + { sendGtJson(msg); g_lastGtStatus = msg; } } -function gtChatSendSpots(spotsObject) { +function gtChatSendSpots(spotsObject) +{ var msg = Object(); msg.type = "o"; msg.uuid = g_appSettings.chatUUID; @@ -218,23 +255,29 @@ function gtChatSendSpots(spotsObject) { sendGtJson(msg); } -function gtChatRemoveCall(jsmesg) { +function gtChatRemoveCall(jsmesg) +{ var id = jsmesg.id; - if (id in g_gtIdToCid) { + if (id in g_gtIdToCid) + { var cid = g_gtIdToCid[id]; - if (cid in g_gtFlagPins) { + if (cid in g_gtFlagPins) + { delete g_gtFlagPins[cid].ids[id]; - if (Object.keys(g_gtFlagPins[cid].ids).length == 0) { - if (g_gtFlagPins[cid].pin != null) { + if (Object.keys(g_gtFlagPins[cid].ids).length == 0) + { + if (g_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); + 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; } g_gtFlagPins[cid].live = false; notifyNoChat(cid); - if (!(cid in g_gtMessages)) { + if (!(cid in g_gtMessages)) + { delete g_gtCallsigns[g_gtFlagPins[cid].call]; delete g_gtFlagPins[cid]; } @@ -246,21 +289,26 @@ function gtChatRemoveCall(jsmesg) { } } -function gtChatUpdateCall(jsmesg) { +function gtChatUpdateCall(jsmesg) +{ var id = jsmesg.id; var cid = jsmesg.cid; - if (cid in g_gtFlagPins) { + if (cid in g_gtFlagPins) + { g_gtFlagPins[cid].ids[id] = true; // Did they move grid location? - if (g_gtFlagPins[cid].pin != null) { + if (g_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); + 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; } - } else { + } + else + { g_gtFlagPins[cid] = Object(); g_gtFlagPins[cid].pin = null; @@ -280,17 +328,19 @@ function gtChatUpdateCall(jsmesg) { g_gtFlagPins[cid].dxcc = callsignToDxcc(jsmesg.call); g_gtFlagPins[cid].live = true; // Make a pin here - if (g_gtFlagPins[cid].pin == null) { + if (g_gtFlagPins[cid].pin == null) + { makeGtPin(g_gtFlagPins[cid]); if (g_gtFlagPins[cid].pin != null) - g_layerSources["gtflags"].addFeature(g_gtFlagPins[cid].pin); + { g_layerSources.gtflags.addFeature(g_gtFlagPins[cid].pin); } } g_gtChatlistChangeCount++; g_gtCallsigns[g_gtFlagPins[cid].call] = cid; updateChatWindow(); } -function gtChatGetList() { +function gtChatGetList() +{ msg = Object(); msg.type = "list"; msg.uuid = g_appSettings.chatUUID; @@ -298,10 +348,13 @@ function gtChatGetList() { sendGtJson(JSON.stringify(msg)); } -function redrawPins() { +function redrawPins() +{ clearGtFlags(); - for (cid in g_gtFlagPins) { - if (g_gtFlagPins[cid].pin != null) { + for (cid in g_gtFlagPins) + { + if (g_gtFlagPins[cid].pin != null) + { delete g_gtFlagPins[cid].pin; g_gtFlagPins[cid].pin = null; } @@ -309,15 +362,18 @@ function redrawPins() { makeGtPin(g_gtFlagPins[cid]); if (g_gtFlagPins[cid].pin != null) - g_layerSources["gtflags"].addFeature(g_gtFlagPins[cid].pin); + { g_layerSources.gtflags.addFeature(g_gtFlagPins[cid].pin); } } } -function makeGtPin(obj) { - try { - if (obj.pin) { - if (g_layerSources["gtflags"].hasFeature(obj.pin)) - g_layerSources["gtflags"].removeFeature(obj.pin); +function makeGtPin(obj) +{ + try + { + if (obj.pin) + { + if (g_layerSources.gtflags.hasFeature(obj.pin)) + { g_layerSources.gtflags.removeFeature(obj.pin); } delete obj.pin; obj.pin = null; } @@ -332,38 +388,47 @@ function makeGtPin(obj) { g_appSettings.gtFlagImgSrc == 2 && (obj.mode != myMode || obj.band != myBand) ) - return; + { return; } var LL = squareToLatLongAll(obj.grid); var myLonLat = [ LL.lo2 - (LL.lo2 - LL.lo1) / 2, - LL.la2 - (LL.la2 - LL.la1) / 2, + LL.la2 - (LL.la2 - LL.la1) / 2 ]; obj.pin = iconFeature(ol.proj.fromLonLat(myLonLat), g_gtFlagIcon, 100); obj.pin.key = obj.cid; obj.pin.isGtFlag = true; obj.pin.size = 1; - } catch (e) {} + } + catch (e) {} } -function gtChatNewList(jsmesg) { +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)) { + 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) { - if (cid in g_gtFlagPins) { + if (id != myChatId) + { + if (cid in g_gtFlagPins) + { g_gtFlagPins[cid].ids[id] = true; - } else { + } + else + { g_gtFlagPins[cid] = Object(); g_gtFlagPins[cid].ids = Object(); g_gtFlagPins[cid].ids[id] = true; @@ -384,7 +449,7 @@ function gtChatNewList(jsmesg) { g_gtCallsigns[g_gtFlagPins[cid].call] = cid; makeGtPin(g_gtFlagPins[cid]); if (g_gtFlagPins[cid].pin != null) - g_layerSources["gtflags"].addFeature(g_gtFlagPins[cid].pin); + { g_layerSources.gtflags.addFeature(g_gtFlagPins[cid].pin); } } } g_gtChatlistChangeCount++; @@ -392,19 +457,23 @@ function gtChatNewList(jsmesg) { updateChatWindow(); } -function appendToHistory(cid, jsmesg) { - if (!(cid in g_gtMessages)) { +function appendToHistory(cid, jsmesg) +{ + if (!(cid in g_gtMessages)) + { g_gtMessages[cid] = Object(); g_gtMessages[cid].history = Array(); } g_gtMessages[cid].history.push(jsmesg); - while (g_gtMessages[cid].history.length > g_gtMaxChatMessages) { + while (g_gtMessages[cid].history.length > g_gtMaxChatMessages) + { g_gtMessages[cid].history.shift(); } } -function htmlEntities(str) { +function htmlEntities(str) +{ return String(str) .replace(/&/g, "&") .replace(/ 0 && now % 2 == 0) { + if (Object.keys(g_gtUnread).length > 0 && now % 2 == 0) + { msgImg.style.webkitFilter = "invert(1)"; - } else msgImg.style.webkitFilter = ""; + } + else msgImg.style.webkitFilter = ""; if ( g_msgSettings.msgFrequencySelect > 0 && Object.keys(g_gtUnread).length > 0 - ) { - if (now - g_lastChatMsgAlert > g_msgSettings.msgFrequencySelect * 60) { + ) + { + if (now - g_lastChatMsgAlert > g_msgSettings.msgFrequencySelect * 60) + { alertChatMessage(); } } - } else { + } + else + { closeGtSocket(); g_gtChatlistChangeCount = 0; g_lastGtStatus = ""; } } -function gtSpotMessage(jsmesg) { +function gtSpotMessage(jsmesg) +{ addNewOAMSSpot(jsmesg.cid, jsmesg.db); } -function gtChatSystemInit() { +function gtChatSystemInit() +{ g_gtEngineInterval = setInterval(gtChatStateMachine, 1000); } -function showGtFlags() { - if (g_appSettings.gtFlagImgSrc > 0) { - if (g_mapSettings.offlineMode == false) { +function showGtFlags() +{ + if (g_appSettings.gtFlagImgSrc > 0) + { + if (g_mapSettings.offlineMode == false) + { redrawPins(); - g_layerVectors["gtflags"].setVisible(true); - } else { - g_layerVectors["gtflags"].setVisible(false); + g_layerVectors.gtflags.setVisible(true); } - } else g_layerVectors["gtflags"].setVisible(false); + else + { + g_layerVectors.gtflags.setVisible(false); + } + } + else g_layerVectors.gtflags.setVisible(false); } -function clearGtFlags() { - g_layerSources["gtflags"].clear(); +function clearGtFlags() +{ + g_layerSources.gtflags.clear(); } -function toggleGtMap() { +function toggleGtMap() +{ g_appSettings.gtFlagImgSrc += 1; g_appSettings.gtFlagImgSrc %= 3; gtFlagImg.src = g_gtFlagImageArray[g_appSettings.gtFlagImgSrc]; if (g_spotsEnabled == 1 && g_receptionSettings.mergeSpots == false) return; - if (g_appSettings.gtFlagImgSrc > 0) { + if (g_appSettings.gtFlagImgSrc > 0) + { redrawPins(); - g_layerVectors["gtflags"].setVisible(true); - } else { - g_layerVectors["gtflags"].setVisible(false); + g_layerVectors.gtflags.setVisible(true); + } + else + { + g_layerVectors.gtflags.setVisible(false); } } -function notifyNoChat(id) { - if (g_chatWindowHandle != null) { - try { +function notifyNoChat(id) +{ + if (g_chatWindowHandle != null) + { + try + { g_chatWindowHandle.window.notifyNoChat(id); - } catch (e) {} + } + catch (e) {} } } -function updateChatWindow() { - if (g_chatWindowHandle != null) { - try { +function updateChatWindow() +{ + if (g_chatWindowHandle != null) + { + try + { g_chatWindowHandle.window.updateEverything(); - } catch (e) {} + } + catch (e) {} } } -function newChatMessage(id, jsmesg) { +function newChatMessage(id, jsmesg) +{ var hasFocus = false; if (g_msgSettings.msgActionSelect == 1) showMessaging(); - if (g_chatWindowHandle != null) { - try { + if (g_chatWindowHandle != null) + { + try + { hasFocus = g_chatWindowHandle.window.newChatMessage(id, jsmesg); - } catch (e) {} + } + catch (e) {} updateChatWindow(); } return hasFocus; @@ -566,16 +678,17 @@ function newChatMessage(id, jsmesg) { var g_lastChatMsgAlert = 0; -function alertChatMessage() { +function alertChatMessage() +{ + if (g_msgSettings.msgAlertSelect == 1) { - 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(); + // 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/moment-timezone-with-data.js b/package.nw/lib/moment-timezone-with-data.js index a7f777c7..df8febdb 100644 --- a/package.nw/lib/moment-timezone-with-data.js +++ b/package.nw/lib/moment-timezone-with-data.js @@ -1,3 +1,5 @@ +/* eslint-disable */ + //! moment-timezone.js //! version : 0.5.31 //! Copyright (c) JS Foundation and other contributors diff --git a/package.nw/lib/moment-with-locales.js b/package.nw/lib/moment-with-locales.js index b977ad6f..f6a0b67a 100644 --- a/package.nw/lib/moment-with-locales.js +++ b/package.nw/lib/moment-with-locales.js @@ -1,3 +1,5 @@ +/* eslint-disable */ + ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : diff --git a/package.nw/lib/ol.js b/package.nw/lib/ol.js index cfa2feb7..4d86cfa4 100644 --- a/package.nw/lib/ol.js +++ b/package.nw/lib/ol.js @@ -1,2 +1,4 @@ +/* eslint-disable */ + !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(t,e,r){t.exports=function(){"use strict";function t(t,n,i,o,a){!function t(r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(s-h)/s)*(u-s/2<0?-1:1),p=Math.max(i,Math.floor(n-u*h/s+c)),f=Math.min(o,Math.floor(n+(s-u)*h/s+c));t(r,n,p,f,a)}var d=r[n],_=i,g=o;for(e(r,i,n),a(r[o],d)>0&&e(r,i,o);_0;)g--}0===a(r[i],d)?e(r,i,g):(g++,e(r,g,o)),g<=n&&(i=g+1),n<=g&&(o=g-1)}}(t,n,i||0,o||t.length-1,a||r)}function e(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function r(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(e,r,n,i,o){for(var a=[r,n];a.length;)if(!((n=a.pop())-(r=a.pop())<=i)){var s=r+Math.ceil((n-r)/i/2)*i;t(e,s,r,n,o),a.push(r,s,s,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,r=[];if(!f(t,e))return r;for(var n=this.toBBox,i=[];e;){for(var o=0;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)},n.prototype._split=function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var a=this._chooseSplitIndex(r,i,n),s=d(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,o(r,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},n.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,r){for(var n,i,o,s,u,l,c,p=1/0,f=1/0,d=e;d<=r-e;d++){var _=a(t,0,d,this.toBBox),g=a(t,d,r,this.toBBox),y=(i=_,o=g,s=void 0,u=void 0,l=void 0,c=void 0,s=Math.max(i.minX,o.minX),u=Math.max(i.minY,o.minY),l=Math.min(i.maxX,o.maxX),c=Math.min(i.maxY,o.maxY),Math.max(0,l-s)*Math.max(0,c-u)),v=h(_)+h(g);y=e;f--){var d=t.children[f];s(u,t.leaf?i(d):d),l+=c(u)}return l},n.prototype._adjustParentBBoxes=function(t,e,r){for(var n=r;n>=0;n--)s(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,r=void 0;e>=0;e--)0===t[e].children.length?e>0?(r=t[e-1].children).splice(r.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},n}()},function(t,e){var r=null,n=null;function i(t,e,r){t.addEventListener(e,(function(t){var i=new MouseEvent(r,t);i.pointerId=1,i.isPrimary=!0,i.pointerType="mouse",i.width=1,i.height=1,i.tiltX=0,i.tiltY=0,"buttons"in t&&0!==t.buttons?i.pressure=.5:i.pressure=0;var o=t.target;null!==n&&(o=n,"mouseup"===e&&(n=null)),o.dispatchEvent(i),i.defaultPrevented&&t.preventDefault()}))}function o(t,e,n){t.addEventListener(e,(function(t){for(var i=t.changedTouches,o=i.length,a=0;a>>0):4294967296*(e>>>0)+(t>>>0)}function u(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function l(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function x(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}i.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=v(this.buf,this.pos)+4294967296*v(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=v(this.buf,this.pos)+4294967296*x(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return s(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&o?function(t,e,r){return o.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){var n="",i=e;for(;i239?4:u>223?3:u>191?2:1;if(i+h>r)break;1===h?u<128&&(l=u):2===h?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===h?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((l=(15&u)<<12|(63&o)<<6|63&a)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=h}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==i.Bytes)return t.push(this.readVarint(e));var r=a(this);for(t=t||[];this.pos127;);else if(e===i.Bytes)this.pos=this.readVarint()+this.pos;else if(e===i.Fixed32)this.pos+=4;else{if(e!==i.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&u(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&u(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,i.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,_,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writeBytesField:function(t,e){this.writeTag(t,i.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,i.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,i.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,i.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e,r){var n=r(5);e.Processor=n},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,p=r?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-h)-1,f>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=p,h-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*u-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,l-=8);t[r+f-d]|=128*_}},function(t,e,r){var n=r(6).newImageData;function i(t){var e=!0;try{new ImageData(10,10)}catch(t){e=!1}function r(t,r,n){return e?new ImageData(t,r,n):{data:t,width:r,height:n}}return function(e){var n,i,o=e.buffers,a=e.meta,s=e.imageOps,u=e.width,l=e.height,h=o.length,c=o[0].byteLength;if(s){var p=new Array(h);for(i=0;ithis._maxQueueLength;)this._queue.shift().callback(null,null)},a.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._job=this._queue.shift(),e=t.inputs[0].width,r=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),i=this._workers.length;if(this._running=i,1===i)this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:r},n);else for(var o=t.inputs[0].data.length,a=4*Math.ceil(o/4/i),s=0;se?1:t=0}function S(t,e,r){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var i=void 0;if(r>0){for(i=1;i>>0,i=0;i0},e.prototype.removeEventListener=function(t,e){var r=this.listeners_[t];if(r){var n=r.indexOf(e);-1!==n&&(t in this.pendingRemovals_?(r[n]=I,++this.pendingRemovals_[t]):(r.splice(n,1),0===r.length&&delete this.listeners_[t]))}},e}(m),N="change",G="error",j="contextmenu",D="click",k="dblclick",U="dragenter",z="dragover",B="drop",Y="keydown",V="keypress",X="load",W="resize",Z="touchmove",K="wheel",q=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var H=function(t){function e(){var e=t.call(this)||this;return e.revision_=0,e}return q(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(N)},e.prototype.getRevision=function(){return this.revision_},e.prototype.on=function(t,e){if(Array.isArray(t)){for(var r=t.length,n=new Array(r),i=0;i0;)this.pop()},e.prototype.extend=function(t){for(var e=0,r=t.length;ei&&(u|=yt),so&&(u|=gt),u===dt&&(u=_t),u}function Rt(){return[1/0,1/0,-1/0,-1/0]}function Ot(t,e,r,n,i){return i?(i[0]=t,i[1]=e,i[2]=r,i[3]=n,i):[t,e,r,n]}function It(t){return Ot(1/0,1/0,-1/0,-1/0,t)}function Lt(t,e){var r=t[0],n=t[1];return Ot(r,n,r,n,e)}function Ft(t,e,r,n,i){return jt(It(i),t,e,r,n)}function Mt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function At(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Nt(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function Gt(t,e){for(var r=0,n=e.length;re[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Qt(t){return t[2]1)for(var o=t[2]-t[0],a=t[3]-t[1],s=0;s=r[2])){var i=Ht(r),o=Math.floor((n[0]-r[0])/i)*i;t[0]-=o,t[2]-=o}return t}var re="XY",ne="XYZ",ie="XYM",oe="XYZM",ae={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};function se(t,e,r,n,i,o){for(var a=o||[],s=0,u=e;u1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return fe(t,e,r,n)}function fe(t,e,r,n){var i=r-t,o=n-e;return i*i+o*o}function de(t){return 180*t/Math.PI}function _e(t){return t*Math.PI/180}function ge(t,e){var r=t%e;return r*e<0?r+e:r}function ye(t,e,r){return t+r*(e-t)}function ve(t,e,r){var n=r||6371008.8,i=_e(t[1]),o=_e(e[1]),a=(o-i)/2,s=_e(e[0]-t[0])/2,u=Math.sin(a)*Math.sin(a)+Math.sin(s)*Math.sin(s)*Math.cos(i)*Math.cos(o);return 2*n*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))}function me(t,e){for(var r=0,n=0,i=t.length;n1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=Pe,s=0;sa?u=a:u<-a&&(u=-a),o[s+1]=u}return o}function Me(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;a=2;--l)a[s+l]=e[s+l]}return a}}function Je(t,e,r,n){var i=We(t),o=We(e);Ue(i,o,He(r)),Ue(o,i,He(n))}function Qe(t,e){if(t===e)return!0;var r=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||$e(t,e)===Ye)&&r}function $e(t,e){var r=ze(t.getCode(),e.getCode());return r||(r=Ve),r}function tr(t,e){return $e(We(t),We(e))}function er(t,e,r){return tr(e,r)(t,void 0,t.length)}function rr(t,e,r,n){return te(t,tr(e,r),void 0,n)}var nr,ir,or,ar=null;function sr(){return ar}function ur(t,e){return ar?er(t,e,ar):t}function lr(t,e){return ar?er(t,ar,e):t}function hr(t,e){return ar?rr(t,e,ar):t}function cr(t,e){return ar?rr(t,ar,e):t}Ke(Le),Ke(De),nr=Le,ir=Fe,or=Me,De.forEach((function(t){nr.forEach((function(e){Ue(t,e,ir),Ue(e,t,or)}))}));var pr=new Array(6);function fr(t){return _r(t,1,0,0,1,0,0)}function dr(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=e[0],l=e[1],h=e[2],c=e[3],p=e[4],f=e[5];return t[0]=r*u+i*l,t[1]=n*u+o*l,t[2]=r*h+i*c,t[3]=n*h+o*c,t[4]=r*p+i*f+a,t[5]=n*p+o*f+s,t}function _r(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t}function gr(t,e){var r=e[0],n=e[1];return e[0]=t[0]*r+t[2]*n+t[4],e[1]=t[1]*r+t[3]*n+t[5],e}function yr(t,e,r){return dr(t,_r(pr,e,0,0,r,0,0))}function vr(t,e,r,n,i,o,a,s){var u=Math.sin(o),l=Math.cos(o);return t[0]=n*l,t[1]=i*u,t[2]=-n*u,t[3]=i*l,t[4]=a*n*l-s*n*u+e,t[5]=a*i*u+s*i*l+r,t}function mr(t,e){var r,n=(r=e)[0]*r[3]-r[1]*r[2];st(0!==n,32);var i=e[0],o=e[1],a=e[2],s=e[3],u=e[4],l=e[5];return t[0]=s/n,t[1]=-o/n,t[2]=-a/n,t[3]=i/n,t[4]=(a*l-s*u)/n,t[5]=-(i*l-o*u)/n,t}function xr(t){return"matrix("+t.join(", ")+")"}var wr=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Sr=[1,0,0,1,0,0],Er=function(t){function e(){var e,r,n,i,o,a=t.call(this)||this;return a.extent_=[1/0,1/0,-1/0,-1/0],a.extentRevision_=-1,a.simplifiedGeometryMaxMinSquaredTolerance=0,a.simplifiedGeometryRevision=0,a.simplifyTransformedInternal=(e=function(t,e,r){if(!r)return this.getSimplifiedGeometry(e);var n=this.clone();return n.applyTransform(r),n.getSimplifiedGeometry(e)},o=!1,function(){var t=Array.prototype.slice.call(arguments);return o&&this===i&&b(t,n)||(o=!0,i=this,n=t,r=e.apply(this,arguments)),r}),a}return wr(e,t),e.prototype.simplifyTransformed=function(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)},e.prototype.clone=function(){return n()},e.prototype.closestPointXY=function(t,e,r,i){return n()},e.prototype.containsXY=function(t,e){var r=this.getClosestPoint([t,e]);return r[0]===t&&r[1]===e},e.prototype.getClosestPoint=function(t,e){var r=e||[NaN,NaN];return this.closestPointXY(t[0],t[1],r,1/0),r},e.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},e.prototype.computeExtent=function(t){return n()},e.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)},e.prototype.rotate=function(t,e){n()},e.prototype.scale=function(t,e,r){n()},e.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},e.prototype.getSimplifiedGeometry=function(t){return n()},e.prototype.getType=function(){return n()},e.prototype.applyTransform=function(t){n()},e.prototype.intersectsExtent=function(t){return n()},e.prototype.translate=function(t,e){n()},e.prototype.transform=function(t,e){var r=We(t),n=r.getUnits()==Te.TILE_PIXELS?function(t,n,i){var o=r.getExtent(),a=r.getWorldExtent(),s=Wt(a)/Wt(o);return vr(Sr,a[0],a[3],s,-s,0,0,0),se(t,0,t.length,i,Sr,n),tr(r,e)(t,n,i)}:tr(r,e);return this.applyTransform(n),this},e}(rt),Tr=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Cr(t){var e;return t==re?e=2:t==ne||t==ie?e=3:t==oe&&(e=4),e}var br=function(t){function e(){var e=t.call(this)||this;return e.layout=re,e.stride=2,e.flatCoordinates=null,e}return Tr(e,t),e.prototype.computeExtent=function(t){return Ft(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.getCoordinates=function(){return n()},e.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.getFlatCoordinates=function(){return this.flatCoordinates},e.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},e.prototype.getLayout=function(){return this.layout},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)s=r;else{if(p>0){for(var f=0;fi&&(i=l),o=s,a=u}return i}function Lr(t,e,r,n,i){for(var o=0,a=r.length;o0;){for(var c=l.pop(),p=l.pop(),f=0,d=t[p],_=t[p+1],g=t[c],y=t[c+1],v=p+n;vf&&(h=v,f=m)}f>i&&(u[(h-e)/n]=1,p+n0&&_>f)&&(d<0&&g0&&g>d)?(s=c,u=p):(o[a++]=s,o[a++]=u,l=s,h=u,s=c,u=p)}}return o[a++]=s,o[a++]=u,a}function Vr(t,e,r,n,i,o,a,s){for(var u=0,l=r.length;uo&&(l-s)*(o-u)-(i-s)*(h-u)>0&&a++:h<=o&&(l-s)*(o-u)-(i-s)*(h-u)<0&&a--,s=l,u=h}return 0!==a}function Jr(t,e,r,n,i,o){if(0===r.length)return!1;if(!Hr(t,e,r[0],n,i,o))return!1;for(var a=1,s=r.length;aw&&Jr(t,e,r,n,l=(h+c)/2,d)&&(m=l,w=S),h=c}return isNaN(m)&&(m=i[o]),a?(a.push(m,d,w),a):[m,d,w]}function $r(t,e,r,n,i){for(var o=[],a=0,s=r.length;a=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||tn(t,e,r,n,(function(t,e){return function(t,e,r){var n=!1,i=Pt(t,e),o=Pt(t,r);if(i===_t||o===_t)n=!0;else{var a=t[0],s=t[1],u=t[2],l=t[3],h=e[0],c=e[1],p=r[0],f=r[1],d=(f-c)/(p-h),_=void 0,g=void 0;o>&&!(i>)&&(n=(_=p-(f-l)/d)>=a&&_<=u),n||!(o&yt)||i&yt||(n=(g=f-(p-u)*d)>=s&&g<=l),n||!(o&vt)||i&vt||(n=(_=p-(f-s)/d)>=a&&_<=u),n||!(o&mt)||i&mt||(n=(g=f-(p-a)*d)>=s&&g<=l)}return n}(i,t,e)})))))}function rn(t,e,r,n,i){if(!function(t,e,r,n,i){return!!en(t,e,r,n,i)||(!!Hr(t,e,r,n,i[0],i[1])||(!!Hr(t,e,r,n,i[0],i[3])||(!!Hr(t,e,r,n,i[2],i[1])||!!Hr(t,e,r,n,i[2],i[3]))))}(t,e,r[0],n,i))return!1;if(1===r.length)return!0;for(var o=1,a=r.length;o0}function an(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;a0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),In=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ln=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.map=r,i.frameState=void 0!==n?n:null,i}return In(e,t),e}(F),Fn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mn=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,o)||this;return a.originalEvent=n,a.pixel_=null,a.coordinate_=null,a.dragging=void 0!==i&&i,a}return Fn(e,t),Object.defineProperty(e.prototype,"pixel",{get:function(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_},set:function(t){this.pixel_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"coordinate",{get:function(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_},set:function(t){this.coordinate_=t},enumerable:!0,configurable:!0}),e.prototype.preventDefault=function(){t.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},e.prototype.stopPropagation=function(){t.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},e}(Ln),An=(r(1),"undefined"!=typeof navigator?navigator.userAgent.toLowerCase():""),Nn=-1!==An.indexOf("firefox"),Gn=(-1!==An.indexOf("safari")&&An.indexOf("chrom"),-1!==An.indexOf("webkit")&&-1==An.indexOf("edge")),jn=-1!==An.indexOf("macintosh"),Dn="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,kn="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,Un="undefined"!=typeof Image&&Image.prototype.decode,zn=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}(),Bn={SINGLECLICK:"singleclick",CLICK:D,DBLCLICK:k,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Yn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vn=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,n,i,o)||this;return a.pointerEvent=n,a}return Yn(e,t),e}(Mn),Xn="pointermove",Wn="pointerdown",Zn="pointerup",Kn="pointerout",qn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hn=function(t){function e(e,r){var n=t.call(this,e)||this;n.map_=e,n.clickTimeoutId_,n.dragging_=!1,n.dragListenerKeys_=[],n.moveTolerance_=r?r*Dn:Dn,n.down_=null;var i=n.map_.getViewport();return n.activePointers_=0,n.trackedTouches_={},n.element_=i,n.pointerdownListenerKey_=g(i,Wn,n.handlePointerDown_,n),n.originalPointerMoveEvent_,n.relayedListenerKey_=g(i,Xn,n.relayEvent_,n),n.boundHandleTouchMove_=n.handleTouchMove_.bind(n),n.element_.addEventListener(Z,n.boundHandleTouchMove_,!!zn&&{passive:!1}),n}return qn(e,t),e.prototype.emulateClick_=function(t){var e=new Vn(Bn.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Vn(Bn.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;var e=new Vn(Bn.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),250)},e.prototype.updateActivePointers_=function(t){var e=t;e.type==Bn.POINTERUP||e.type==Bn.POINTERCANCEL?delete this.trackedTouches_[e.pointerId]:e.type==Bn.POINTERDOWN&&(this.trackedTouches_[e.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},e.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new Vn(Bn.POINTERUP,this.map_,t);this.dispatchEvent(e),e.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),0===this.activePointers_&&(this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)},e.prototype.isMouseActionButton_=function(t){return 0===t.button},e.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new Vn(Bn.POINTERDOWN,this.map_,t);this.dispatchEvent(e),this.down_=t,0===this.dragListenerKeys_.length&&this.dragListenerKeys_.push(g(document,Bn.POINTERMOVE,this.handlePointerMove_,this),g(document,Bn.POINTERUP,this.handlePointerUp_,this),g(this.element_,Bn.POINTERCANCEL,this.handlePointerUp_,this))},e.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var e=new Vn(Bn.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}},e.prototype.relayEvent_=function(t){this.originalPointerMoveEvent_=t;var e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Vn(t.type,this.map_,t,e))},e.prototype.handleTouchMove_=function(t){this.originalPointerMoveEvent_&&!this.originalPointerMoveEvent_.defaultPrevented||t.preventDefault()},e.prototype.isMoving_=function(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(v(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Z,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(v(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(A),Jn="postrender",Qn="movestart",$n="moveend",ti="layergroup",ei="size",ri="target",ni="view",ii="prerender",oi="postrender",ai="precompose",si="postcompose",ui="rendercomplete",li=0,hi=1,ci=2,pi=3,fi=4,di=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,f(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){st(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),u=this.getRightChildIndex_(t),l=ut;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;r[e]=r[a],n[e]=n[a],e=a}r[e]=i,n[e]=o},t.prototype.reprioritize=function(){var t,e,r,n=this.priorityFunction_,i=this.elements_,o=this.priorities_,a=0,s=i.length;for(e=0;e0;)n=(r=this.dequeue()[0]).getKey(),r.getState()!==li||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++i,r.load())},e}(di);function yi(t,e,r){return function(n,i,o,a){if(n){var s=e?0:o[0]*i,u=e?0:o[1]*i,l=t[0]+s/2,h=t[2]-s/2,c=t[1]+u/2,p=t[3]-u/2;l>h&&(h=l=(h+l)/2),c>p&&(p=c=(p+c)/2);var f=he(n[0],l,h),d=he(n[1],c,p),_=30*i;return a&&r&&(f+=-_*Math.log(1+Math.max(0,l-n[0])/_)+_*Math.log(1+Math.max(0,n[0]-h)/_),d+=-_*Math.log(1+Math.max(0,c-n[1])/_)+_*Math.log(1+Math.max(0,n[1]-p)/_)),[f,d]}}}function vi(t){return t}function mi(t,e,r,n){var i=Ht(e)/r[0],o=Wt(e)/r[1];return n?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function xi(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),he(n,r/2,2*e)}function wi(t,e,r,n,i){return function(o,a,s,u){if(void 0!==o){var l=n?mi(t,n,s,i):t;return(void 0===r||r)&&u?xi(o,l,e):he(o,e,l)}}}function Si(t){return void 0!==t?0:void 0}function Ei(t){return void 0!==t?t:void 0}var Ti=0,Ci=1,bi="center",Pi="resolution",Ri="rotation";function Oi(t,e,r){var n=void 0!==r?t.toFixed(r):""+t,i=n.indexOf(".");return(i=-1===i?n.length:i)>e?n:new Array(1+e-i).join("0")+n}function Ii(t,e){for(var r=(""+t).split("."),n=(""+e).split("."),i=0;ia)return 1;if(a>o)return-1}return 0}function Li(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Fi(t,e){var r,n,i=t[0],o=t[1],a=e[0],s=e[1],u=a[0],l=a[1],h=s[0],c=s[1],p=h-u,f=c-l,d=0===p&&0===f?0:(p*(i-u)+f*(o-l))/(p*p+f*f||0);return d<=0?(r=u,n=l):d>=1?(r=h,n=c):(r=u+d*p,n=l+d*f),[r,n]}function Mi(t,e,r){var n=ge(e+180,360)-180,i=Math.abs(3600*n),o=r||0,a=Math.pow(10,o),s=Math.floor(i/3600),u=Math.floor((i-3600*s)/60),l=i-3600*s-60*u;return(l=Math.ceil(l*a)/a)>=60&&(l=0,u+=1),u>=60&&(u=0,s+=1),s+"° "+Oi(u,2)+"′ "+Oi(l,2,o)+"″"+(0==n?"":" "+t.charAt(n<0?1:0))}function Ai(t,e,r){return t?e.replace("{x}",t[0].toFixed(r)).replace("{y}",t[1].toFixed(r)):""}function Ni(t,e){for(var r=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){r=!1;break}return r}function Gi(t,e){var r=Math.cos(e),n=Math.sin(e),i=t[0]*r-t[1]*n,o=t[1]*r+t[0]*n;return t[0]=i,t[1]=o,t}function ji(t,e){return t[0]*=e,t[1]*=e,t}function Di(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function ki(t,e){return Math.sqrt(Di(t,e))}function Ui(t,e){return Di(t,Fi(t,e))}function zi(t,e){return Ai(t,"{x}, {y}",e)}function Bi(t,e){var r=e.getExtent();if(e.canWrapX()&&(t[0]=r[2])){var n=Ht(r),i=Math.floor((t[0]-r[0])/n);t[0]-=i*n}return t}function Yi(t){return Math.pow(t,3)}function Vi(t){return 1-Yi(1-t)}function Xi(t){return 3*t*t-2*t*t*t}function Wi(t){return t}var Zi=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ki(t,e){setTimeout((function(){t(e)}),0)}function qi(t){return!(t.sourceCenter&&t.targetCenter&&!Ni(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}var Hi=function(t){function e(e){var r=t.call(this)||this,n=p({},e);return r.hints_=[0,0],r.animations_=[],r.updateAnimationKey_,r.projection_=qe(n.projection,"EPSG:3857"),r.viewportSize_=[100,100],r.targetCenter_=null,r.targetResolution_,r.targetRotation_,r.cancelAnchor_=void 0,n.center&&(n.center=lr(n.center,r.projection_)),n.extent&&(n.extent=cr(n.extent,r.projection_)),r.applyOptions_(n),r}return Zi(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,r,n,i=void 0!==t.minZoom?t.minZoom:0,o=void 0!==t.maxZoom?t.maxZoom:28,a=void 0!==t.zoomFactor?t.zoomFactor:2,s=void 0!==t.multiWorld&&t.multiWorld,u=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,l=void 0!==t.showFullExtent&&t.showFullExtent,h=qe(t.projection,"EPSG:3857"),c=h.getExtent(),p=t.constrainOnlyCenter,f=t.extent;s||f||!h.isGlobal()||(p=!1,f=c);if(void 0!==t.resolutions){var d=t.resolutions;r=d[i],n=void 0!==d[o]?d[o]:d[d.length-1],e=t.constrainResolution?function(t,e,r,n){return function(i,o,a,s){if(void 0!==i){var u=t[0],l=t[t.length-1],h=r?mi(u,r,a,n):u;if(s)return void 0===e||e?xi(i,h,l):he(i,l,h);var c=Math.min(h,i),p=Math.floor(S(t,c,o));return t[p]>h&&p1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&Ki(e,!0))}for(var i=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,s=this.targetRotation_,u=[],l=0;l0},e.prototype.getInteracting=function(){return this.hints_[Ci]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(Ti,-this.hints_[Ti]);for(var e=0,r=this.animations_.length;e=0;--r){for(var n=this.animations_[r],i=!0,o=0,a=n.length;o0?u/s.duration:1;l>=1?(s.complete=!0,l=1):i=!1;var h=s.easing(l);if(s.sourceCenter){var c=s.sourceCenter[0],p=s.sourceCenter[1],f=c+h*(s.targetCenter[0]-c),d=p+h*(s.targetCenter[1]-p);this.targetCenter_=[f,d]}if(s.sourceResolution&&s.targetResolution){var _=1===h?s.targetResolution:s.sourceResolution+h*(s.targetResolution-s.sourceResolution);if(s.anchor){var g=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(_,0,g,!0);this.targetCenter_=this.calculateCenterZoom(y,s.anchor)}this.targetResolution_=_,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var v=1===h?ge(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+h*(s.targetRotation-s.sourceRotation);if(s.anchor){var m=this.constraints_.rotation(v,!0);this.targetCenter_=this.calculateCenterRotate(m,s.anchor)}this.targetRotation_=v}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(i){this.animations_[r]=null,this.setHint(Ti,-1);var x=n[0].callback;x&&Ki(x,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var r,n=this.getCenterInternal();return void 0!==n&&(Gi(r=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),Li(r,e)),r},e.prototype.calculateCenterZoom=function(t,e){var r,n=this.getCenterInternal(),i=this.getResolution();void 0!==n&&void 0!==i&&(r=[e[0]-t*(e[0]-n[0])/i,e[1]-t*(e[1]-n[1])/i]);return r},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var r=e[0],n=e[1];return[Math.abs(r*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(r*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?ur(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(bi)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return hr(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),r=this.getCenterInternal();st(r,1);var n=this.getResolution();st(void 0!==n,2);var i=this.getRotation();return st(void 0!==i,3),Xt(r,n,i,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(Pi)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(cr(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var r=e||this.getViewportSize_(),n=Ht(t)/r[0],i=Wt(t)/r[1];return Math.max(n,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return r/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(Ri)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/e;return function(t){return Math.log(r/t)/e/i}},e.prototype.getState=function(){var t=this.getCenterInternal(),e=this.getProjection(),r=this.getResolution(),n=this.getRotation();return{center:t.slice(0),projection:void 0!==e?e:null,resolution:r,rotation:n,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,r,n=this.minZoom_||0;if(this.resolutions_){var i=S(this.resolutions_,t,1);n=i,e=this.resolutions_[i],r=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(e/t)/Math.log(r)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=he(Math.floor(t),0,this.resolutions_.length-2),r=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(r,he(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var r,n=p({size:this.getViewportSize_()},e||{});if(st(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))st(!Qt(t),25),r=fn(i=cr(t,this.getProjection()));else if(t.getType()===ae.CIRCLE){var i;(r=fn(i=cr(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),Yt(i))}else{var o=sr();r=o?t.clone().transform(o,this.getProjection()):t}this.fitInternal(r,n)},e.prototype.fitInternal=function(t,e){var r=e||{},n=r.size;n||(n=this.getViewportSize_());var i,o=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0!==r.nearest&&r.nearest;i=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.getResolutionForZoom(r.maxZoom):0;for(var s=t.getFlatCoordinates(),u=this.getRotation(),l=Math.cos(-u),h=Math.sin(-u),c=1/0,p=1/0,f=-1/0,d=-1/0,_=t.getStride(),g=0,y=s.length;g=0;n--){var i=r[n];if(i.getActive())if(!i.handleEvent(t))break}}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var r=this.maxTilesLoading_,n=r;if(t){var i=t.viewHints;if(i[Ti]||i[Ci]){var o=!Un&&Date.now()-t.time>8;r=o?0:8,n=o?0:2}}e.getTilesLoading()0&&t[1]>0}(e)&&r&&r.isDef()){var o=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=r.getState();i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterItems:n?n.declutterItems:[],extent:Xt(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{}}}if(this.frameState_=i,this.renderer_.renderFrame(i),i){if(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),n)(!this.previousExtent_||!Qt(this.previousExtent_)&&!Mt(i.extent,this.previousExtent_))&&(this.dispatchEvent(new Ln(Qn,this,n)),this.previousExtent_=It(this.previousExtent_));this.previousExtent_&&!i.viewHints[Ti]&&!i.viewHints[Ci]&&!Mt(i.extent,this.previousExtent_)&&(this.dispatchEvent(new Ln($n,this,i)),St(i.extent,this.previousExtent_))}this.dispatchEvent(new Ln(Jn,this,i)),this.postRenderTimeoutHandle_=setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(ti,t)},e.prototype.setSize=function(t){this.set(ei,t)},e.prototype.setTarget=function(t){this.set(ri,t)},e.prototype.setView=function(t){this.set(ni,t)},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)])}else this.setSize(void 0);this.updateViewportSize_()},e.prototype.updateViewportSize_=function(){var t=this.getView();if(t){var e=void 0,r=getComputedStyle(this.viewport_);r.width&&r.height&&(e=[parseInt(r.width,10),parseInt(r.height,10)]),t.setViewportSize(e)}},e}(rt),Po=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ro=function(t){function e(e){var r=t.call(this)||this;return r.element=e.element?e.element:null,r.target_=null,r.map_=null,r.listenerKeys=[],r.render_=e.render?e.render:I,e.target&&r.setTarget(e.target),r}return Po(e,t),e.prototype.disposeInternal=function(){eo(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&eo(this.element);for(var e=0,r=this.listenerKeys.length;e=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Ao=function(t){function e(e){var r=this,n=p({},e);delete n.source,(r=t.call(this,n)||this).mapPrecomposeKey_=null,r.mapRenderKey_=null,r.sourceChangeKey_=null,r.renderer_=null,e.render&&(r.render=e.render),e.map&&r.setMap(e.map),r.addEventListener(et(co),r.handleSourcePropertyChange_);var i=e.source?e.source:null;return r.setSource(i),r}return Fo(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(co)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():_o},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(v(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=g(t,N,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var r=this.getRenderer();if(r.prepareFrame(t))return r.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(v(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(v(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=g(t,ai,(function(t){var e=t.frameState.layerStatesArray,r=this.getLayerState(!1);st(!e.some((function(t){return t.layer===r.layer})),67),e.push(r)}),this),this.mapRenderKey_=g(this,N,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(co,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(fo),No=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Go(t){this.updateElement_(t.frameState)}var jo=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||Go,target:n.target})||this).ulElement_=document.createElement("ul"),r.collapsed_=void 0===n.collapsed||n.collapsed,r.overrideCollapsible_=void 0!==n.collapsible,r.collapsible_=void 0===n.collapsible||n.collapsible,r.collapsible_||(r.collapsed_=!1);var i=void 0!==n.className?n.className:"ol-attribution",o=void 0!==n.tipLabel?n.tipLabel:"Attributions",a=void 0!==n.collapseLabel?n.collapseLabel:"»";"string"==typeof a?(r.collapseLabel_=document.createElement("span"),r.collapseLabel_.textContent=a):r.collapseLabel_=a;var s=void 0!==n.label?n.label:"i";"string"==typeof s?(r.label_=document.createElement("span"),r.label_.textContent=s):r.label_=s;var u=r.collapsible_&&!r.collapsed_?r.collapseLabel_:r.label_,l=document.createElement("button");l.setAttribute("type","button"),l.title=o,l.appendChild(u),l.addEventListener(D,r.handleClick_.bind(r),!1);var h=i+" ol-unselectable ol-control"+(r.collapsed_&&r.collapsible_?" ol-collapsed":"")+(r.collapsible_?"":" ol-uncollapsible"),c=r.element;return c.className=h,c.appendChild(r.ulElement_),c.appendChild(l),r.renderedAttributions_=[],r.renderedVisible_=!0,r}return No(e,t),e.prototype.collectSourceAttributions_=function(t){for(var e={},r=[],n=t.layerStatesArray,i=0,o=n.length;i0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!b(e,this.renderedAttributions_)){ro(this.ulElement_);for(var n=0,i=e.length;n0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Vi}):t.setRotation(0))}},e}(Ro),zo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bo=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),target:n.target})||this;var i=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInLabel?n.zoomInLabel:"+",s=void 0!==n.zoomOutLabel?n.zoomOutLabel:"−",u=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",l=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=i+"-in",h.setAttribute("type","button"),h.title=u,h.appendChild("string"==typeof a?document.createTextNode(a):a),h.addEventListener(D,r.handleClick_.bind(r,o),!1);var c=document.createElement("button");c.className=i+"-out",c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(D,r.handleClick_.bind(r,-o),!1);var p=i+" ol-unselectable ol-control",f=r.element;return f.className=p,f.appendChild(h),f.appendChild(c),r.duration_=void 0!==n.duration?n.duration:250,r}return zo(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var r=e.getZoom();if(void 0!==r){var n=e.getConstrainedZoom(r+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:Vi})):e.setZoom(n)}}},e}(Ro);function Yo(t){var e=t||{},r=new at;return(void 0===e.zoom||e.zoom)&&r.push(new Bo(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&r.push(new Uo(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&r.push(new jo(e.attributionOptions)),r}var Vo="active",Xo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Wo(t,e,r,n){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:r,duration:void 0!==n?n:250,easing:Vi})}}var Zo=function(t){function e(e){var r=t.call(this)||this;return e.handleEvent&&(r.handleEvent=e.handleEvent),r.map_=null,r.setActive(!0),r}return Xo(e,t),e.prototype.getActive=function(){return this.get(Vo)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Vo,t)},e.prototype.setMap=function(t){this.map_=t},e}(rt),Ko=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function qo(t){var e=!1;if(t.type==Bn.DBLCLICK){var r=t.originalEvent,n=t.map,i=t.coordinate,o=r.shiftKey?-this.delta_:this.delta_;Wo(n.getView(),o,i,this.duration_),t.preventDefault(),e=!0}return!e}var Ho=function(t){function e(e){var r=t.call(this,{handleEvent:qo})||this,n=e||{};return r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:250,r}return Ko(e,t),e}(Zo),Jo=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Qo=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},$o=function(t){return t.target.getTargetElement()===document.activeElement},ta=R,ea=function(t){var e=t.originalEvent;return 0==e.button&&!(Gn&&jn&&e.ctrlKey)},ra=O,na=function(t){return t.type==Bn.SINGLECLICK},ia=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},oa=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},aa=function(t){var e=t.originalEvent.target.tagName;return"INPUT"!==e&&"SELECT"!==e&&"TEXTAREA"!==e},sa=function(t){var e=t.pointerEvent;return st(void 0!==e,56),"mouse"==e.pointerType},ua=function(t){var e=t.pointerEvent;return st(void 0!==e,56),e.isPrimary&&0===e.button},la=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ha(t){for(var e=t.length,r=0,n=0,i=0;i0}}else if(t.type==Bn.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Bn.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Bn.POINTERDOWN||e===Bn.POINTERDRAG||e===Bn.POINTERUP}(t)){var e=t.pointerEvent,r=e.pointerId.toString();t.type==Bn.POINTERUP?delete this.trackedPointers_[r]:(t.type==Bn.POINTERDOWN||r in this.trackedPointers_)&&(this.trackedPointers_[r]=e),this.targetPointers=d(this.trackedPointers_)}},e}(Zo),pa=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function fa(t){return ia(t)&&ua(t)}var da=function(t){function e(e){var r=t.call(this,{stopDown:O})||this,n=e||{};return r.kinetic_=n.kinetic,r.lastCentroid=null,r.lastPointersCount_,r.panning_=!1,r.condition_=n.condition?n.condition:fa,r.noKinetic_=!1,r}return pa(e,t),e.prototype.conditionInternal_=function(t){var e=!0;return t.map.getTargetElement().hasAttribute("tabindex")&&(e=$o(t)),e&&this.condition_(t)},e.prototype.handleDragEvent=function(t){this.panning_||(this.panning_=!0,this.getMap().getView().beginInteraction());var e=this.targetPointers,r=ha(e);if(e.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){var n=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],i=t.map.getView();ji(n,i.getResolution()),Gi(n,i.getRotation()),i.adjustCenterInternal(n)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=e.length,t.originalEvent.preventDefault()},e.prototype.handleUpEvent=function(t){var e=t.map,r=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var n=this.kinetic_.getDistance(),i=this.kinetic_.getAngle(),o=r.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),s=e.getCoordinateFromPixelInternal([a[0]-n*Math.cos(i),a[1]-n*Math.sin(i)]);r.animateInternal({center:r.getConstrainedCenter(s),duration:500,easing:Vi})}return this.panning_&&(this.panning_=!1,r.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>0&&this.conditionInternal_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(ca),_a=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ga=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{stopDown:O})||this).condition_=n.condition?n.condition:Qo,r.lastAngle_=void 0,r.duration_=void 0!==n.duration?n.duration:250,r}return _a(e,t),e.prototype.handleDragEvent=function(t){if(sa(t)){var e=t.map,r=e.getView();if(r.getConstraints().rotation!==Si){var n=e.getSize(),i=t.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;r.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!sa(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!sa(t)&&(!(!ea(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(ca),ya=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),va=function(t){function e(e){var r=t.call(this)||this;return r.geometry_=null,r.element_=document.createElement("div"),r.element_.style.position="absolute",r.element_.className="ol-box "+e,r.map_=null,r.startPixel_=null,r.endPixel_=null,r}return ya(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,r=this.element_.style;r.left=Math.min(t[0],e[0])+"px",r.top=Math.min(t[1],e[1])+"px",r.width=Math.abs(e[0]-t[0])+"px",r.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new cn([r])},e.prototype.getGeometry=function(){return this.geometry_},e}(m),ma=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xa="boxstart",wa="boxdrag",Sa="boxend",Ea=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.coordinate=r,i.mapBrowserEvent=n,i}return ma(e,t),e}(F),Ta=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.box_=new va(n.className||"ol-dragbox"),r.minArea_=void 0!==n.minArea?n.minArea:64,r.onBoxEnd_=n.onBoxEnd?n.onBoxEnd:I,r.startPixel_=null,r.condition_=n.condition?n.condition:ea,r.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:r.defaultBoxEndCondition,r}return ma(e,t),e.prototype.defaultBoxEndCondition=function(t,e,r){var n=r[0]-e[0],i=r[1]-e[1];return n*n+i*i>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Ea(wa,t.coordinate,t))},e.prototype.handleUpEvent=function(t){return this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd_(t),this.dispatchEvent(new Ea(Sa,t.coordinate,t))),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ea(xa,t.coordinate,t)),!0)},e}(ca),Ca=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ba(){var t,e,r=this.getMap(),n=r.getView(),i=r.getSize(),o=this.getGeometry().getExtent();if(this.out_){var a=n.calculateExtentInternal(i),s=(t=[r.getPixelFromCoordinateInternal(zt(o)),r.getPixelFromCoordinateInternal(qt(o))],Gt(It(e),t));$t(a,1/n.getResolutionForExtentInternal(s,i)),o=a}var u=n.getConstrainedResolution(n.getResolutionForExtentInternal(o,i)),l=n.getConstrainedCenter(Yt(o),u);n.animateInternal({resolution:u,center:l,duration:this.duration_,easing:Vi})}var Pa=function(t){function e(e){var r=this,n=e||{},i=n.condition?n.condition:oa;return(r=t.call(this,{condition:i,className:n.className||"ol-dragzoom",minArea:n.minArea,onBoxEnd:ba})||this).duration_=void 0!==n.duration?n.duration:200,r.out_=void 0!==n.out&&n.out,r}return Ca(e,t),e}(Ta),Ra=37,Oa=38,Ia=39,La=40,Fa=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ma(t){var e=!1;if(t.type==Y){var r=t.originalEvent.keyCode;if(this.condition_(t)&&(r==La||r==Ra||r==Ia||r==Oa)){var n=t.map.getView(),i=n.getResolution()*this.pixelDelta_,o=0,a=0;r==La?a=-i:r==Ra?o=-i:r==Ia?o=i:a=i;var s=[o,a];Gi(s,n.getRotation()),function(t,e,r){var n=t.getCenterInternal();if(n){var i=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==r?r:250,easing:Wi,center:t.getConstrainedCenter(i)})}}(n,s,this.duration_),t.preventDefault(),e=!0}}return!e}var Aa=function(t){function e(e){var r=t.call(this,{handleEvent:Ma})||this,n=e||{};return r.defaultCondition_=function(t){return ia(t)&&aa(t)},r.condition_=void 0!==n.condition?n.condition:r.defaultCondition_,r.duration_=void 0!==n.duration?n.duration:100,r.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,r}return Fa(e,t),e}(Zo),Na=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ga(t){var e=!1;if(t.type==Y||t.type==V){var r=t.originalEvent.charCode;if(this.condition_(t)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){var n=t.map,i=r=="+".charCodeAt(0)?this.delta_:-this.delta_;Wo(n.getView(),i,void 0,this.duration_),t.preventDefault(),e=!0}}return!e}var ja=function(t){function e(e){var r=t.call(this,{handleEvent:Ga})||this,n=e||{};return r.condition_=n.condition?n.condition:aa,r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:100,r}return Na(e,t),e}(Zo),Da=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ka="trackpad",Ua="wheel",za=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).totalDelta_=0,r.lastDelta_=0,r.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,r.duration_=void 0!==n.duration?n.duration:250,r.timeout_=void 0!==n.timeout?n.timeout:80,r.useAnchor_=void 0===n.useAnchor||n.useAnchor,r.condition_=n.condition?n.condition:ta,r.lastAnchor_=null,r.startTime_=void 0,r.timeoutId_,r.mode_=void 0,r.trackpadEventGap_=400,r.trackpadTimeoutId_,r.deltaPerZoom_=300,r}return Da(e,t),e.prototype.conditionInternal_=function(t){var e=!0;return t.map.getTargetElement().hasAttribute("tabindex")&&(e=$o(t)),e&&this.condition_(t)},e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.conditionInternal_(t))return!0;if(t.type!==K)return!0;t.preventDefault();var e,r=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==K&&(e=n.deltaY,Nn&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Dn),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?ka:Ua);var o=r.getView();if(this.mode_===ka&&!o.getConstrainResolution())return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=i,!1;this.totalDelta_+=e;var a=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var r=-he(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;e.getConstrainResolution()&&(r=r?r>0?1:-1:0),Wo(e,r,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(Zo),Ba=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ya=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=O),(r=t.call(this,i)||this).anchor_=null,r.lastAngle_=void 0,r.rotating_=!1,r.rotationDelta_=0,r.threshold_=void 0!==n.threshold?n.threshold:.3,r.duration_=void 0!==n.duration?n.duration:250,r}return Ba(e,t),e.prototype.handleDragEvent=function(t){var e=0,r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==Si){var u=a.getViewport().getBoundingClientRect(),l=ha(this.targetPointers);l[0]-=u.left,l[1]-=u.top,this.anchor_=a.getCoordinateFromPixelInternal(l),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(ca),Va=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xa=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=O),(r=t.call(this,i)||this).anchor_=null,r.duration_=void 0!==n.duration?n.duration:400,r.lastDistance_=void 0,r.lastScaleDelta_=1,r}return Va(e,t),e.prototype.handleDragEvent=function(t){var e=1,r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,u=s.getView();1!=e&&(this.lastScaleDelta_=e);var l=s.getViewport().getBoundingClientRect(),h=ha(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=s.getCoordinateFromPixelInternal(h),s.render(),u.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(ca);function Wa(t){var e=t||{},r=new at,n=new On(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&r.push(new ga),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&r.push(new Ho({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&r.push(new da({condition:e.onFocusOnly?$o:void 0,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&r.push(new Ya),(void 0===e.pinchZoom||e.pinchZoom)&&r.push(new Xa({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(r.push(new Aa),r.push(new ja({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&r.push(new za({condition:e.onFocusOnly?$o:void 0,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&r.push(new Pa({duration:e.zoomDuration})),r}var Za=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ka=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.inversePixelTransform=r,o.frameState=n,o.context=i,o}return Za(e,t),e}(F),qa=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Ha=/^([a-z]*)$|^hsla?\(.*\)$/i;function Ja(t){return"string"==typeof t?t:is(t)}function Qa(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var r=getComputedStyle(e).color;return document.body.removeChild(e),r}return""}var $a,ts,es=($a={},ts=0,function(t){var e;if($a.hasOwnProperty(t))e=$a[t];else{if(ts>=1024){var r=0;for(var n in $a)0==(3&r++)&&(delete $a[n],--ts)}e=function(t){var e,r,n,i,o;if(Ha.exec(t)&&(t=Qa(t)),qa.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var u=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),r=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),i=u?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,r=(r<<4)+r,n=(n<<4)+n,u&&(i=(i<<4)+i)),o=[e,r,n,i/255]}else 0==t.indexOf("rgba(")?ns(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),ns(o)):st(!1,14);return o}(t),$a[t]=e,++ts}return e});function rs(t){return Array.isArray(t)?t:es(t)}function ns(t){return t[0]=he(t[0]+.5|0,0,255),t[1]=he(t[1]+.5|0,0,255),t[2]=he(t[2]+.5|0,0,255),t[3]=he(t[3],0,1),t}function is(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var r=t[1];r!=(0|r)&&(r=r+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+r+","+n+","+(void 0===t[3]?1:t[3])+")"}var os=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var r=this.cache_[e];0!=(3&t++)||r.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,r){var n=as(t,e,r);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,r,n){var i=as(t,e,r);this.cache_[i]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function as(t,e,r){return e+":"+t+":"+(r?Ja(r):"null")}var ss=new os;function us(t){return Array.isArray(t)?is(t):t}var ls=function(){function t(){}return t.prototype.drawCustom=function(t,e,r){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),hs=[],cs=[0,0,0,0],ps=new rt,fs=new A;fs.setSize=function(){console.warn("labelCache is deprecated.")};var ds,_s,gs,ys=null,vs={},ms=function(){var t,e,r=["monospace","serif"],n=r.length,i="wmytzilWMYTZIL@#/&?$%10";function o(t,o,a){for(var s=!0,u=0;u=0;--n)for(var i=r[n],o=i.items,a=0,s=o.length;a=0;--x){var w=g[x],S=w.layer;if(S.hasRenderer()&&Mo(w,l)&&a.call(s,S)){var E=S.getRenderer(),T=S.getSource();if(E&&T){var C=T.getWrapX()?p:t,b=h.bind(null,w.managed);v[0]=C[0]+f[m][0],v[1]=C[1]+f[m][1],u=E.forEachFeatureAtCoordinate(v,e,r,b,_)}if(u)return u}}},e.prototype.forEachLayerAtPixel=function(t,e,r,i,o){return n()},e.prototype.hasFeatureAtCoordinate=function(t,e,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,r,n,R,this,i,o)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){this.declutterTree_=Zs(t,this.declutterTree_)},e.prototype.scheduleExpireIconCache=function(t){ss.canExpireCache()&&t.postRenderFunctions.push(qs)},e}(m),Js=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qs=function(t){function e(e){var r=t.call(this,e)||this;r.fontChangeListenerKey_=g(ps,c,e.redrawText.bind(e)),r.element_=document.createElement("div");var n=r.element_.style;n.position="absolute",n.width="100%",n.height="100%",n.zIndex="0",r.element_.className="ol-unselectable ol-layers";var i=e.getViewport();return i.insertBefore(r.element_,i.firstChild||null),r.children_=[],r.renderedVisible_=!0,r}return Js(e,t),e.prototype.dispatchRenderEvent=function(t,e){var r=this.getMap();if(r.hasListener(t)){var n=new Ka(t,void 0,e);r.dispatchEvent(n)}},e.prototype.disposeInternal=function(){v(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),t.prototype.disposeInternal.call(this)},e.prototype.renderFrame=function(e){if(e){this.calculateMatrices2D(e),this.dispatchRenderEvent(ai,e);var r=e.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),n=e.viewState;this.children_.length=0;for(var i=null,o=0,a=r.length;o=0;--s){var u=a[s],l=u.layer;if(l.hasRenderer()&&Mo(u,o)&&i(l)){var h=l.getRenderer().getDataAtPixel(t,e,r);if(h){var c=n(l,h);if(c)return c}}}},e}(Hs),$s=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tu=function(t){function e(e){return(e=p({},e)).controls||(e.controls=Yo()),e.interactions||(e.interactions=Wa()),t.call(this,e)||this}return $s(e,t),e.prototype.createRenderer=function(){return new Qs(this)},e}(bo),eu="bottom-left",ru="bottom-center",nu="bottom-right",iu="center-left",ou="center-center",au="center-right",su="top-left",uu="top-center",lu="top-right",hu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cu="element",pu="map",fu="offset",du="position",_u="positioning",gu=function(t){function e(e){var r=t.call(this)||this;r.options=e,r.id=e.id,r.insertFirst=void 0===e.insertFirst||e.insertFirst,r.stopEvent=void 0===e.stopEvent||e.stopEvent,r.element=document.createElement("div"),r.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",r.element.style.position="absolute";var n=e.autoPan;return n&&"object"!=typeof n&&(n={animation:e.autoPanAnimation,margin:e.autoPanMargin}),r.autoPan=n||!1,r.rendered={transform_:"",visible:!0},r.mapPostrenderListenerKey=null,r.addEventListener(et(cu),r.handleElementChanged),r.addEventListener(et(pu),r.handleMapChanged),r.addEventListener(et(fu),r.handleOffsetChanged),r.addEventListener(et(du),r.handlePositionChanged),r.addEventListener(et(_u),r.handlePositioningChanged),void 0!==e.element&&r.setElement(e.element),r.setOffset(void 0!==e.offset?e.offset:[0,0]),r.setPositioning(void 0!==e.positioning?e.positioning:su),void 0!==e.position&&r.setPosition(e.position),r}return hu(e,t),e.prototype.getElement=function(){return this.get(cu)},e.prototype.getId=function(){return this.id},e.prototype.getMap=function(){return this.get(pu)},e.prototype.getOffset=function(){return this.get(fu)},e.prototype.getPosition=function(){return this.get(du)},e.prototype.getPositioning=function(){return this.get(_u)},e.prototype.handleElementChanged=function(){ro(this.element);var t=this.getElement();t&&this.element.appendChild(t)},e.prototype.handleMapChanged=function(){this.mapPostrenderListenerKey&&(eo(this.element),v(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=g(t,Jn,this.render,this),this.updatePixelPosition();var e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}},e.prototype.render=function(){this.updatePixelPosition()},e.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},e.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.performAutoPan()},e.prototype.handlePositioningChanged=function(){this.updatePixelPosition()},e.prototype.setElement=function(t){this.set(cu,t)},e.prototype.setMap=function(t){this.set(pu,t)},e.prototype.setOffset=function(t){this.set(fu,t)},e.prototype.setPosition=function(t){this.set(du,t)},e.prototype.performAutoPan=function(){this.autoPan&&this.panIntoView(this.autoPan)},e.prototype.panIntoView=function(t){var e=this.getMap();if(e&&e.getTargetElement()&&this.get(du)){var r=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),i=this.getRect(n,[Qi(n),$i(n)]),o=void 0===t.margin?20:t.margin;if(!Ct(r,i)){var a=i[0]-r[0],s=r[2]-i[2],u=i[1]-r[1],l=r[3]-i[3],h=[0,0];if(a<0?h[0]=a-o:s<0&&(h[0]=Math.abs(s)+o),u<0?h[1]=u-o:l<0&&(h[1]=Math.abs(l)+o),0!==h[0]||0!==h[1]){var c=e.getView().getCenterInternal(),p=e.getPixelFromCoordinateInternal(c),f=[p[0]+h[0],p[1]+h[1]],d=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(f),duration:d.duration,easing:d.easing})}}}},e.prototype.getRect=function(t,e){var r=t.getBoundingClientRect(),n=r.left+window.pageXOffset,i=r.top+window.pageYOffset;return[n,i,n+e[0],i+e[1]]},e.prototype.setPositioning=function(t){this.set(_u,t)},e.prototype.setVisible=function(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)},e.prototype.updatePixelPosition=function(){var t=this.getMap(),e=this.getPosition();if(t&&t.isRendered()&&e){var r=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(r,n)}else this.setVisible(!1)},e.prototype.updateRenderedPosition=function(t,e){var r=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);var o=Math.round(t[0]+n[0])+"px",a=Math.round(t[1]+n[1])+"px",s="0%",u="0%";i==nu||i==au||i==lu?s="-100%":i!=ru&&i!=ou&&i!=uu||(s="-50%"),i==eu||i==ru||i==nu?u="-100%":i!=iu&&i!=ou&&i!=au||(u="-50%");var l="translate("+s+", "+u+") translate("+o+", "+a+")";this.rendered.transform_!=l&&(this.rendered.transform_=l,r.transform=l,r.msTransform=l)},e.prototype.getOptions=function(){return this.options},e}(rt),yu="arraybuffer",vu="json",mu="text",xu="xml",wu=!1;function Su(t,e,r,n){return function(i,o,a){var s=new XMLHttpRequest;s.open("GET","function"==typeof t?t(i,o,a):t,!0),e.getType()==yu&&(s.responseType="arraybuffer"),s.withCredentials=wu,s.onload=function(t){if(!s.status||s.status>=200&&s.status<300){var o=e.getType(),u=void 0;o==vu||o==mu?u=s.responseText:o==xu?(u=s.responseXML)||(u=(new DOMParser).parseFromString(s.responseText,"application/xml")):o==yu&&(u=s.response),u?r.call(this,e.readFeatures(u,{extent:i,featureProjection:a}),e.readProjection(u)):n.call(this)}else n.call(this)}.bind(this),s.onerror=function(){n.call(this)}.bind(this),s.send()}}function Eu(t,e){return Su(t,e,(function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)}),I)}function Tu(t,e){return[[-1/0,-1/0,1/0,1/0]]}var Cu=function(){function t(t,e,r,n){this.minX=t,this.maxX=e,this.minY=r,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function bu(t,e,r,n,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=r,i.maxY=n,i):new Cu(t,e,r,n)}var Pu=Cu;function Ru(t,e,r,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=r,n):[t,e,r]}function Ou(t,e,r){return t+"/"+e+"/"+r}function Iu(t){return Ou(t[0],t[1],t[2])}function Lu(t){return t.split("/").map(Number)}function Fu(t){return(t[1]<0||r&&0===o)}))),17),!t.origins)for(var o=0,a=this.resolutions_.length-1;o=this.minZoom;){if(e(s,2===this.zoomFactor_?bu(i=Math.floor(i/2),i,o=Math.floor(o/2),o,r):this.getTileRangeForExtentAndZ(a,s,r)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,r){if(t[0]0?n:Math.max(a/s[0],o/s[1]),l=i+1,h=new Array(l),c=0;c=0;o--)this.postProcessPasses_[o].init(t);e.bindTexture(e.TEXTURE_2D,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,r){var n=this.getGL(),i=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,i[0],i[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,r?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var r=this.getGL(),n=r.UNSIGNED_INT,i=e-t,o=4*t;r.drawElements(r.TRIANGLES,i,n,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return Il[0]=0,Il[1]=0,Il[2]=0,Il[3]=0,Il;this.readAll();var r=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return Il[0]=this.data_[4*r],Il[1]=this.data_[4*r+1],Il[2]=this.data_[4*r+2],Il[3]=this.data_[4*r+3],Il},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}(),Fl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ml=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return Fl(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(Au),Al=Ml;function Nl(t,e,r){var n=[],i=[],o=[],a=[],s=[],u=void 0!==r?r:[],l=t.SupportedCRS,h=We(l.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||We(l),c=h.getMetersPerUnit(),p="ne"==h.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,e){return e.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(e){if(!(u.length>0)||C(u,(function(r){return e.Identifier==r.TileMatrix||-1===e.Identifier.indexOf(":")&&t.Identifier+":"+e.Identifier===r.TileMatrix}))){i.push(e.Identifier);var r=28e-5*e.ScaleDenominator/c,l=e.TileWidth,h=e.TileHeight;p?o.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):o.push(e.TopLeftCorner),n.push(r),a.push(l==h?l:[l,h]),s.push([e.MatrixWidth,e.MatrixHeight])}})),new Ml({extent:e,origins:o,resolutions:n,matrixIds:i,tileSizes:a,sizes:s})}var Gl=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.displacement_=t.displacement}return t.prototype.clone=function(){return new t({opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return n()},t.prototype.getImage=function(t){return n()},t.prototype.getHitDetectionImage=function(t){return n()},t.prototype.getImageState=function(){return n()},t.prototype.getImageSize=function(){return n()},t.prototype.getHitDetectionImageSize=function(){return n()},t.prototype.getOrigin=function(){return n()},t.prototype.getSize=function(){return n()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.listenImageChange=function(t){n()},t.prototype.load=function(){n()},t.prototype.unlistenImageChange=function(t){n()},t}(),jl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Dl=function(t){function e(e){var r=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(r=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0]})||this).canvas_=null,r.hitDetectionCanvas_=null,r.fill_=void 0!==e.fill?e.fill:null,r.origin_=[0,0],r.points_=e.points,r.radius_=void 0!==e.radius?e.radius:e.radius1,r.radius2_=e.radius2,r.angle_=void 0!==e.angle?e.angle:0,r.stroke_=void 0!==e.stroke?e.stroke:null,r.anchor_=null,r.size_=null,r.imageSize_=null,r.hitDetectionImageSize_=null,r.render(),r}return jl(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_},e.prototype.getImage=function(t){return this.canvas_},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return Fs},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.render=function(){var t,e="round",r="round",n=0,i=null,o=0,a=0;this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=us(t),void 0===(a=this.stroke_.getWidth())&&(a=1),i=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),void 0===(r=this.stroke_.getLineJoin())&&(r="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10));var s=2*(this.radius_+a)+1,u={strokeStyle:t,strokeWidth:a,size:s,lineCap:e,lineDash:i,lineDashOffset:o,lineJoin:r,miterLimit:n},l=Ji(s,s);this.canvas_=l.canvas;var h=s=this.canvas_.width,c=this.getDisplacement();this.draw_(u,l,0,0),this.createHitDetectionCanvas_(u),this.anchor_=[s/2-c[0],s/2+c[1]],this.size_=[s,s],this.imageSize_=[h,h]},e.prototype.draw_=function(t,e,r,n){var i,o,a;e.setTransform(1,0,0,1,0,0),e.translate(r,n),e.beginPath();var s=this.points_;if(s===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var u=void 0!==this.radius2_?this.radius2_:this.radius_;for(u!==this.radius_&&(s*=2),i=0;i<=s;i++)o=2*i*Math.PI/s-Math.PI/2+this.angle_,a=i%2==0?this.radius_:u,e.lineTo(t.size/2+a*Math.cos(o),t.size/2+a*Math.sin(o))}if(this.fill_){var l=this.fill_.getColor();null===l&&(l="#000"),e.fillStyle=us(l),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.hitDetectionCanvas_=this.canvas_,this.fill_){var e=this.fill_.getColor(),r=0;if("string"==typeof e&&(e=rs(e)),null===e?r=1:Array.isArray(e)&&(r=4===e.length?e[3]:1),0===r){var n=Ji(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,r,n){e.setTransform(1,0,0,1,0,0),e.translate(r,n),e.beginPath();var i=this.points_;if(i===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o=void 0!==this.radius2_?this.radius2_:this.radius_;o!==this.radius_&&(i*=2);var a=void 0,s=void 0,u=void 0;for(a=0;a<=i;a++)u=2*a*Math.PI/i-Math.PI/2+this.angle_,s=a%2==0?this.radius_:o,e.lineTo(t.size/2+s*Math.cos(u),t.size/2+s*Math.sin(u))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(Gl),kl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ul=function(t){function e(e){var r=e||{};return t.call(this,{points:1/0,fill:r.fill,radius:r.radius,stroke:r.stroke,displacement:void 0!==r.displacement?r.displacement:[0,0]})||this}return kl(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(Dl),zl=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),Bl="fraction",Yl="pixels",Vl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xl=function(t){function e(e,r,n,i){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=r,o.state=i,o}return Vl(e,t),e.prototype.changed=function(){this.dispatchEvent(N)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return n()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){n()},e}(A),Wl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Zl(t,e,r){var n=t;if(n.src&&Un){var i=n.decode(),o=!0;return i.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():r())})),function(){o=!1}}var a=[y(n,X,e),y(n,G,r)];return function(){a.forEach(v)}}var Kl=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,n,Is)||this;return s.src_=i,s.image_=new Image,null!==o&&(s.image_.crossOrigin=o),s.unlisten_=null,s.state=Is,s.imageLoadFunction_=a,s}return Wl(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=Ms,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Wt(this.extent)/this.image_.height),this.state=Fs,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Is&&this.state!=Ms||(this.state=Ls,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=Zl(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(Xl),ql=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hl=function(t){function e(e,r,n,i,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==i&&(s.image_.crossOrigin=i),s.canvas_=a?document.createElement("canvas"):null,s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=r,s.tainted_,s}return ql(e,t),e.prototype.isTainted_=function(t){if(void 0===this.tainted_&&this.imageState_===Fs){t||(t=Ji(1,1)).drawImage(this.image_,0,0);try{t.getImageData(0,0,1,1),this.tainted_=!1}catch(t){this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(N)},e.prototype.handleImageError_=function(){this.imageState_=Ms,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Fs,this.size_&&(this.image_.width=this.size_[0],this.image_.height=this.size_[1]),this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.replaceColor_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.canvas_?this.canvas_:this.image_},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_)if(this.isTainted_()){var e=this.size_[0],r=this.size_[1],n=Ji(e,r);n.fillRect(0,0,e,r),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Is){this.imageState_=Ls;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=Zl(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(){if(this.color_){this.canvas_.width=this.image_.width,this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");if(t.drawImage(this.image_,0,0),this.isTainted_(t)){var e=this.color_;return t.globalCompositeOperation="multiply",t.fillStyle="rgb("+e[0]+","+e[1]+","+e[2]+")",t.fillRect(0,0,this.image_.width,this.image_.height),t.globalCompositeOperation="destination-in",void t.drawImage(this.image_,0,0)}for(var r=t.getImageData(0,0,this.image_.width,this.image_.height),n=r.data,i=this.color_[0]/255,o=this.color_[1]/255,a=this.color_[2]/255,s=0,u=n.length;s0,6);var p=void 0!==n.src?Is:Fs;return r.color_=void 0!==n.color?rs(n.color):null,r.iconImage_=function(t,e,r,n,i,o){var a=ss.get(e,n,o);return a||(a=new Hl(t,e,r,n,i,o),ss.set(e,n,o,a)),a}(l,c,h,r.crossOrigin_,p,r.color_),r.offset_=void 0!==n.offset?n.offset:[0,0],r.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:$l,r.origin_=null,r.size_=void 0!==n.size?n.size:null,r}return eh(e,t),e.prototype.clone=function(){return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==Bl||this.anchorYUnits_==Bl){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==Bl&&(t[0]*=e[0]),this.anchorYUnits_==Bl&&(t[1]*=e[1])}if(this.anchorOrigin_!=$l){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=th&&this.anchorOrigin_!=Ql||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Jl&&this.anchorOrigin_!=Ql||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=$l){var r=this.getSize(),n=this.iconImage_.getSize();if(!r||!n)return null;t=t.slice(),this.offsetOrigin_!=th&&this.offsetOrigin_!=Ql||(t[0]=n[0]-r[0]-t[0]),this.offsetOrigin_!=Jl&&this.offsetOrigin_!=Ql||(t[1]=n[1]-r[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(N,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(N,t)},e}(Gl),nh=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),ih=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=uh,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=uh,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();var oh=null;function ah(t,e){if(!oh){var r=new zl({color:"rgba(255,255,255,0.4)"}),n=new nh({color:"#3399CC",width:1.25});oh=[new ih({image:new Ul({fill:r,stroke:n,radius:5}),fill:r,stroke:n})]}return oh}function sh(){var t={},e=[255,255,255,1],r=[0,153,255,1];return t[ae.POLYGON]=[new ih({fill:new zl({color:[255,255,255,.5]})})],t[ae.MULTI_POLYGON]=t[ae.POLYGON],t[ae.LINE_STRING]=[new ih({stroke:new nh({color:e,width:5})}),new ih({stroke:new nh({color:r,width:3})})],t[ae.MULTI_LINE_STRING]=t[ae.LINE_STRING],t[ae.CIRCLE]=t[ae.POLYGON].concat(t[ae.LINE_STRING]),t[ae.POINT]=[new ih({image:new Ul({radius:6,fill:new zl({color:r}),stroke:new nh({color:e,width:1.5})}),zIndex:1/0})],t[ae.MULTI_POINT]=t[ae.POINT],t[ae.GEOMETRY_COLLECTION]=t[ae.POLYGON].concat(t[ae.LINE_STRING],t[ae.POINT]),t}function uh(t){return t.getGeometry()}var lh=ih,hh="point",ch="line",ph=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new zl({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:hh,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:this.getScale(),text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}();function fh(t,e){var r=/\{z\}/g,n=/\{x\}/g,i=/\{y\}/g,o=/\{-y\}/g;return function(a,s,u){return a?t.replace(r,a[0].toString()).replace(n,a[1].toString()).replace(i,a[2].toString()).replace(o,(function(){var t=a[0],r=e.getFullTileRange(t);return st(r,55),(r.getHeight()-a[2]-1).toString()})):void 0}}function dh(t,e){for(var r=t.length,n=new Array(r),i=0;it)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){n()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var r=this.transitionStarts_[t];if(r){if(-1===r)return 1}else r=e,this.transitionStarts_[t]=r;var n=e-r+1e3/60;return n>=this.transition_?1:Yi(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(A),wh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Sh=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.crossOrigin_=i,s.src_=n,s.image_=new Image,null!==i&&(s.image_.crossOrigin=i),s.unlisten_=null,s.tileLoadFunction_=o,s}return wh(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){var t;this.state=pi,this.unlistenImage_(),this.image_=((t=Ji(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=ci:this.state=fi,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==pi&&(this.state=li,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==li&&(this.state=hi,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Zl(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(xh),Eh=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var r=this.entries_[t];return st(void 0!==r,15),r===this.newest_||(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r),r.value_},t.prototype.remove=function(t){var e=this.entries_[t];return st(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){st(!(t in this.entries_),16);var r={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[t]=r,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}(),Th=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ch=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Th(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=Lu(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(Iu(e.tileCoord)),e.release())}.bind(this))}},e}(Eh);function bh(t,e,r,n){var i=er(r,e,t),o=Ze(e,n,r),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var u=t.getExtent();if(!u||Tt(u,i)){var l=Ze(t,o,i)/o;isFinite(l)&&l>0&&(o/=l)}return o}function Ph(t,e,r,n){var i=r-t,o=n-e,a=Math.sqrt(i*i+o*o);return[Math.round(r+i/a),Math.round(n+o/a)]}function Rh(t,e,r,n,i,o,a,s,u,l,h){var c=Ji(Math.round(r*t),Math.round(r*e));if(0===u.length)return c.canvas;c.scale(r,r);var p=[1/0,1/0,-1/0,-1/0];u.forEach((function(t,e,r){At(p,t.extent)}));var f=Ht(p),d=Wt(p),_=Ji(Math.round(r*f/n),Math.round(r*d/n)),g=r/n;u.forEach((function(t,e,r){var n=t.extent[0]-p[0],i=-(t.extent[3]-p[3]),o=Ht(t.extent),a=Wt(t.extent);_.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,n*g,i*g,o*g,a*g)}));var y=Kt(a);return s.getTriangles().forEach((function(t,e,i){var a=t.source,s=t.target,u=a[0][0],l=a[0][1],h=a[1][0],f=a[1][1],d=a[2][0],g=a[2][1],v=(s[0][0]-y[0])/o,m=-(s[0][1]-y[1])/o,x=(s[1][0]-y[0])/o,w=-(s[1][1]-y[1])/o,S=(s[2][0]-y[0])/o,E=-(s[2][1]-y[1])/o,T=u,C=l;u=0,l=0;var b=function(t){for(var e=t.length,r=0;ri&&(i=a,n=o)}if(0===i)return null;var s=t[n];t[n]=t[r],t[r]=s;for(var u=r+1;u=0;p--){c[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*c[p]}return c}([[h-=T,f-=C,0,0,x-v],[d-=T,g-=C,0,0,S-v],[0,0,h,f,w-m],[0,0,d,g,E-m]]);if(b){c.save(),c.beginPath();var P=(v+x+S)/3,R=(m+w+E)/3,O=Ph(P,R,v,m),I=Ph(P,R,x,w),L=Ph(P,R,S,E);c.moveTo(I[0],I[1]),c.lineTo(O[0],O[1]),c.lineTo(L[0],L[1]),c.clip(),c.transform(b[0],b[2],b[1],b[3],v,m),c.translate(p[0]-T,p[3]-C),c.scale(n/r,-n/r),c.drawImage(_.canvas,0,0),c.restore()}})),h&&(c.save(),c.strokeStyle="black",c.lineWidth=1,s.getTriangles().forEach((function(t,e,r){var n=t.target,i=(n[0][0]-y[0])/o,a=-(n[0][1]-y[1])/o,s=(n[1][0]-y[0])/o,u=-(n[1][1]-y[1])/o,l=(n[2][0]-y[0])/o,h=-(n[2][1]-y[1])/o;c.beginPath(),c.moveTo(s,u),c.lineTo(i,a),c.lineTo(l,h),c.closePath(),c.stroke()})),c.restore()),c.canvas}var Oh=function(){function t(t,e,r,n,i,o){this.sourceProj_=t,this.targetProj_=e;var a={},s=tr(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return a[e]||(a[e]=s(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Ht(n)==Ht(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ht(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ht(this.targetProj_.getExtent()):null;var u=Kt(r),l=qt(r),h=Bt(r),c=zt(r),p=this.transformInv_(u),f=this.transformInv_(l),d=this.transformInv_(h),_=this.transformInv_(c),g=10+(o?Math.max(0,Math.ceil(Math.log2(Ut(r)/(o*o*256*256)))):0);if(this.addQuad_(u,l,h,c,p,f,d,_,g),this.wrapsXInSource_){var y=1/0;this.triangles_.forEach((function(t,e,r){y=Math.min(y,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-y>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var r=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-r.5&&h<1,f=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=Ht(xt([t,e,r,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&h&&(f=h>.25||f)}if(f||!this.maxSourceExtent_||Jt(l,this.maxSourceExtent_)){if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1]))){if(!(u>0))return;f=!0}if(u>0){if(!f){var d=[(t[0]+r[0])/2,(t[1]+r[1])/2],_=this.transformInv_(d),g=void 0;if(p)g=(ge(i[0],c)+ge(a[0],c))/2-ge(_[0],c);else g=(i[0]+a[0])/2-_[0];var y=(i[1]+a[1])/2-_[1];f=g*g+y*y>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-r[0])<=Math.abs(t[1]-r[1])){var v=[(e[0]+r[0])/2,(e[1]+r[1])/2],m=this.transformInv_(v),x=[(n[0]+t[0])/2,(n[1]+t[1])/2],w=this.transformInv_(x);this.addQuad_(t,e,v,x,i,o,m,w,u-1),this.addQuad_(x,v,r,n,w,m,a,s,u-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(S),T=[(r[0]+n[0])/2,(r[1]+n[1])/2],C=this.transformInv_(T);this.addQuad_(t,S,T,n,i,E,C,s,u-1),this.addQuad_(S,e,r,T,E,o,a,C,u-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,r,n,i,a,s),this.addTriangle_(t,e,r,i,o,a)}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,r,n){var i=e.source;Nt(t,i[0]),Nt(t,i[1]),Nt(t,i[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Ih=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lh=function(t){function e(e,r,n,i,o,a,s,u,l,h,c){var p=t.call(this,o,li)||this;p.renderEdges_=void 0!==c&&c,p.pixelRatio_=s,p.gutter_=u,p.canvas_=null,p.sourceTileGrid_=r,p.targetTileGrid_=i,p.wrappedTileCoord_=a||o,p.sourceTiles_=[],p.sourcesListenerKeys_=null,p.sourceZ_=0;var f=i.getTileCoordExtent(p.wrappedTileCoord_),d=p.targetTileGrid_.getExtent(),_=p.sourceTileGrid_.getExtent(),g=d?Zt(f,d):f;if(0===Ut(g))return p.state=fi,p;var y=e.getExtent();y&&(_=_?Zt(_,y):y);var v=i.getResolution(p.wrappedTileCoord_[0]),m=bh(e,n,Yt(g),v);if(!isFinite(m)||m<=0)return p.state=fi,p;var x=void 0!==h?h:.5;if(p.triangulation_=new Oh(e,n,g,_,m*x,v),0===p.triangulation_.getTriangles().length)return p.state=fi,p;p.sourceZ_=r.getZForResolution(m);var w=p.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(w[1]=he(w[1],_[1],_[3]),w[3]=he(w[3],_[1],_[3])):w=Zt(w,_)),Ut(w)){for(var S=r.getTileRangeForExtentAndZ(w,p.sourceZ_),E=S.minX;E<=S.maxX;E++)for(var T=S.minY;T<=S.maxY;T++){var C=l(p.sourceZ_,E,T,s);C&&p.sourceTiles_.push(C)}0===p.sourceTiles_.length&&(p.state=fi)}else p.state=fi;return p}return Ih(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,r,n){e&&e.getState()==ci&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=pi;else{var e=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(e),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Rh(n,i,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=ci}this.changed()},e.prototype.load=function(){if(this.state==li){this.state=hi,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,r,n){var i=e.getState();if(i==li||i==hi){t++;var o=g(e,N,(function(r){var n=e.getState();n!=ci&&n!=pi&&n!=fi||(v(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,r){t.getState()==li&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(v),this.sourcesListenerKeys_=null},e}(xh),Fh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Mh(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var Ah=function(t){function e(e){var r=t.call(this)||this;return r.projection_=We(e.projection),r.attributions_=Mh(e.attributions),r.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,r.loading=!1,r.state_=void 0!==e.state?e.state:yo,r.wrapX_=void 0!==e.wrapX&&e.wrapX,r}return Fh(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolutions=function(){return n()},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=Mh(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(rt),Nh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gh=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX})||this;r.opaque_=void 0!==e.opaque&&e.opaque,r.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,r.tileGrid=void 0!==e.tileGrid?e.tileGrid:null;var n=[256,256],i=e.tileGrid;i&&To(i.getTileSize(i.getMinZoom()),n);var o="undefined"!=typeof screen,a=o?screen.availWidth||screen.width:1920,s=o?screen.availHeight||screen.height:1080,u=4*Math.ceil(a/n[0])*Math.ceil(s/n[1]);return r.tileCache=new Ch(Math.max(u,e.cacheSize||0)),r.tmpSize=[0,0],r.key_=e.key||"",r.tileOptions={transition:e.transition},r.zDirection=e.zDirection?e.zDirection:0,r}return Nh(e,t),e.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);r&&r.expireCache(e)},e.prototype.forEachLoadedTile=function(t,e,r,n){var i=this.getTileCacheForProjection(t);if(!i)return!1;for(var o,a,s,u=!0,l=r.minX;l<=r.maxX;++l)for(var h=r.minY;h<=r.maxY;++h)a=Ou(e,l,h),s=!1,i.containsKey(a)&&(s=(o=i.get(a)).getState()===ci)&&(s=!1!==n(o)),s||(u=!1);return u},e.prototype.getGutterForProjection=function(t){return 0},e.prototype.getKey=function(){return this.key_},e.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},e.prototype.getOpaque=function(t){return this.opaque_},e.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},e.prototype.getTile=function(t,e,r,i,o){return n()},e.prototype.getTileGrid=function(){return this.tileGrid},e.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:Nu(t)},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();return e&&!Qe(e,t)?null:this.tileCache},e.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_},e.prototype.getTilePixelSize=function(t,e,r){var n=this.getTileGridForProjection(r),i=this.getTilePixelRatio(e),o=To(n.getTileSize(t),this.tmpSize);return 1==i?o:Eo(o,i,this.tmpSize)},e.prototype.getTileCoordForTileUrlFunction=function(t,e){var r=void 0!==e?e:this.getProjection(),n=this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(t=function(t,e,r){var n=e[0],i=t.getTileCoordCenter(e),o=ku(r);if(Tt(o,i))return e;var a=Ht(o),s=Math.ceil((o[0]-i[0])/a);return i[0]+=a*s,t.getTileCoordForCoordAndZ(i,n)}(n,t,r)),function(t,e){var r=t[0],n=t[1],i=t[2];if(e.getMinZoom()>r||r>e.getMaxZoom())return!1;var o,a=e.getExtent();return!(o=a?e.getTileRangeForExtentAndZ(a,r):e.getFullTileRange(r))||o.containsXY(n,i)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.useTile=function(t,e,r,n){},e}(Ah),jh=function(t){function e(e,r){var n=t.call(this,e)||this;return n.tile=r,n}return Nh(e,t),e}(F),Dh=Gh,kh="tileloadstart",Uh="tileloadend",zh="tileloaderror",Bh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yh=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.generateTileUrlFunction_=!e.tileUrlFunction,r.tileLoadFunction=e.tileLoadFunction,r.tileUrlFunction=e.tileUrlFunction?e.tileUrlFunction.bind(r):gh,r.urls=null,e.urls?r.setUrls(e.urls):e.url&&r.setUrl(e.url),r.tileLoadingKeys_={},r}return Bh(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,r=t.target,n=o(r),i=r.getState();i==hi?(this.tileLoadingKeys_[n]=!0,e=kh):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==pi?zh:i==ci?Uh:void 0),null!=e&&this.dispatchEvent(new jh(e,r))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=yh(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(dh(t,this.tileGrid),e):this.setKey(e)},e.prototype.useTile=function(t,e,r){var n=Ou(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(Dh),Vh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Xh(t,e){t.getImage().src=e}var Wh=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Xh,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,r.tileClass=void 0!==e.tileClass?e.tileClass:Sh,r.tileCacheForProjection={},r.tileGridForProjection={},r.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,r.renderReprojectionEdges_=!1,r}return Vh(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==r?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[n];i.expireCache(i==r?e:{})}},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Qe(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Qe(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Qe(e,t)){var r=o(t);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=Nu(t)),this.tileGridForProjection[r]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Qe(e,t))return this.tileCache;var r=o(t);return r in this.tileCacheForProjection||(this.tileCacheForProjection[r]=new Ch(this.tileCache.highWaterMark)),this.tileCacheForProjection[r]},e.prototype.createTile_=function(t,e,r,n,i,o){var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),u=s?this.tileUrlFunction(s,n,i):void 0,l=new this.tileClass(a,void 0!==u?li:fi,void 0!==u?u:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=o,l.addEventListener(N,this.handleTileChange.bind(this)),l},e.prototype.getTile=function(t,e,r,n,i){var o=this.getProjection();if(o&&i&&!Qe(o,i)){var a=this.getTileCacheForProjection(i),s=[t,e,r],u=void 0,l=Iu(s);a.containsKey(l)&&(u=a.get(l));var h=this.getKey();if(u&&u.key==h)return u;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(s,i),d=new Lh(o,c,i,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,r,n){return this.getTileInternal(t,e,r,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return d.key=h,u?(d.interimTile=u,d.refreshInterimChain(),a.replace(l,d)):a.set(l,d),d}return this.getTileInternal(t,e,r,n,o||i)},e.prototype.getTileInternal=function(t,e,r,n,i){var o=null,a=Ou(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var u=o;o=this.createTile_(t,e,r,n,i,s),u.getState()==li?o.interimTile=u.interimTile:o.interimTile=u,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,r,n,i,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var r=We(t);if(r){var n=o(r);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(Yh),Zh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Kh=function(t){function e(e){var r=this,n=void 0!==e.hidpi&&e.hidpi;return(r=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",opaque:!0,projection:We("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:go,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:n?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=n,r.culture_=void 0!==e.culture?e.culture:"en-us",r.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,r.apiKey_=e.key,r.imagerySet_=e.imagerySet,vh("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+r.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+r.apiKey_+"&c="+r.culture_,r.handleImageryMetadataResponse.bind(r),void 0,"jsonp"),r}return Zh(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],r=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=ku(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],a=Gu({extent:n,minZoom:e.zoomMin,maxZoom:r,tileSize:o});this.tileGrid=a;var s=this.culture_,u=this.hidpi_;if(this.tileUrlFunction=_h(e.imageUrlSubdomains.map((function(t){var r=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){Ru(t[0],t[1],t[2],r);var o=n;return u&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,r,n=t[0],i=new Array(n),o=1<>=1;return i.join("")}(r))}}}))),e.imageryProviders){var l=$e(We("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var r=[],n=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(n.resolution,this.zDirection),a=i.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map((function(e){for(var n=!1,i=e.coverageAreas,o=0,s=i.length;o=u.zoomMin&&a<=u.zoomMax){var h=u.bbox;if(Jt(te([h[1],h[0],h[3],h[2]],l),t.extent)){n=!0;break}}}n&&r.push(e.attribution)})),r.push('Terms of Use'),r}.bind(this))}this.setState(yo)}else this.setState(vo)},e}(Wh),qh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hh=function(t){function e(e){var r=e||{},n=void 0!==r.projection?r.projection:"EPSG:3857",i=void 0!==r.tileGrid?r.tileGrid:Gu({extent:ku(n),maxResolution:r.maxResolution,maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,opaque:r.opaque,projection:n,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return qh(e,t),e}(Wh),Jh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qh=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,wrapX:e.wrapX})||this;return r.account_=e.account,r.mapId_=e.map||"",r.config_=e.config||{},r.templateCache_={},r.initializeMap_(),r}return Jh(e,t),e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){p(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);var r=new XMLHttpRequest;r.addEventListener("load",this.handleInitResponse_.bind(this,t)),r.addEventListener("error",this.handleInitError_.bind(this)),r.open("POST",e),r.setRequestHeader("Content-type","application/json"),r.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var r=e.target;if(!r.status||r.status>=200&&r.status<300){var n=void 0;try{n=JSON.parse(r.responseText)}catch(t){return void this.setState(vo)}this.applyTemplate_(n),this.templateCache_[t]=n,this.setState(yo)}else this.setState(vo)},e.prototype.handleInitError_=function(t){this.setState(vo)},e.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},e}(Hh),$h="addfeature",tc="changefeature",ec="clear",rc="removefeature",nc=r(0),ic=r.n(nc),oc=function(){function t(t){this.rbush_=new ic.a(t),this.items_={}}return t.prototype.insert=function(t,e){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(r),this.items_[o(e)]=r},t.prototype.load=function(t,e){for(var r=new Array(e.length),n=0,i=e.length;n=0;--r){var n=this.geometryFunction(t[r]);n?Li(e,n.getCoordinates()):t.splice(r,1)}ji(e,1/t.length);var i=new lt(new Kr(e));return i.set("features",t),i},e}(uc),cc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pc="default",fc="truncated",dc=function(t){function e(e,r,n,i,o,a,s){var u=t.call(this,r,n,i,o,a,s)||this;return u.zoomifyImage_=null,u.tileSize_=e,u}return cc(e,t),e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==ci){var r=this.tileSize_;if(e.width==r[0]&&e.height==r[1])return this.zoomifyImage_=e,e;var n=Ji(r[0],r[1]);return n.drawImage(e,0,0),this.zoomifyImage_=n.canvas,n.canvas}return e},e}(Sh),_c=function(t){function e(e){var r=this,n=e,i=n.size,o=void 0!==n.tierSizeCalculation?n.tierSizeCalculation:pc,a=n.tilePixelRatio||1,s=i[0],u=i[1],l=[],h=n.tileSize||256,c=h*a;switch(o){case pc:for(;s>c||u>c;)l.push([Math.ceil(s/c),Math.ceil(u/c)]),c+=c;break;case fc:for(var p=s,f=u;p>c||f>c;)l.push([Math.ceil(p/c),Math.ceil(f/c)]),p>>=1,f>>=1;break;default:st(!1,53)}l.push([1,1]),l.reverse();for(var d=[a],_=[0],g=1,y=l.length;g1,n=r&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],i=r&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],o=r&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(info.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:e.supports.concat(n),formats:e.formats.concat(i),qualities:e.qualities.concat(o)}},Ec[vc]=function(t){var e=t.getComplianceLevelSupportedFeatures(),r=void 0===t.imageInfo.extraFormats?e.formats:e.formats.concat(t.imageInfo.extraFormats),n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&r.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:e.supports.concat(t.imageInfo.extraFeatures),formats:r,qualities:void 0===t.imageInfo.extraQualities?e.qualities:e.qualities.concat(t.imageInfo.extraQualities),preferredFormat:n}};var Tc=function(){function t(t){this.setImageInfo(t)}return t.prototype.setImageInfo=function(t){this.imageInfo="string"==typeof t?JSON.parse(t):t},t.prototype.getImageApiVersion=function(){if(void 0!==this.imageInfo){var t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(var e=0;e0&&"string"==typeof this.imageInfo.profile[0]&&wc.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}},t.prototype.getComplianceLevelFromProfile=function(t){var e=this.getComplianceLevelEntryFromProfile(t);if(void 0!==e){var r=e.match(/level[0-2](\.json)?$/g);return Array.isArray(r)?r[0].replace(".json",""):void 0}},t.prototype.getComplianceLevelSupportedFeatures=function(){if(void 0!==this.imageInfo){var t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?mc.none.none:mc[t][e]}},t.prototype.getTileSourceOptions=function(t){var e=t||{},r=this.getImageApiVersion();if(void 0!==r){var n=void 0===r?void 0:Ec[r](this);if(void 0!==n)return{url:n.url,version:r,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}}},t}(),Cc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function bc(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var Pc=function(t){function e(e){var r=this,n=e||{},i=n.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";var o=n.version||yc,a=n.sizes||[],s=n.size;st(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,60);var u,l,h,c=s[0],p=s[1],f=n.tileSize,d=n.tilePixelRatio||1,_=n.format||"jpg",g=n.quality||(n.version==gc?"native":"default"),y=n.resolutions||[],v=n.supports||[],m=n.extent||[0,-p,c,0],x=null!=a&&Array.isArray(a)&&a.length>0,w=void 0!==f&&("number"==typeof f&&Number.isInteger(f)&&f>0||Array.isArray(f)&&f.length>0),S=null!=v&&Array.isArray(v)&&(v.includes("regionByPx")||v.includes("regionByPct"))&&(v.includes("sizeByWh")||v.includes("sizeByH")||v.includes("sizeByW")||v.includes("sizeByPct"));if(y.sort((function(t,e){return e-t})),w||S)if(null!=f&&("number"==typeof f&&Number.isInteger(f)&&f>0?(u=f,l=f):Array.isArray(f)&&f.length>0&&((1==f.length||null==f[1]&&Number.isInteger(f[0]))&&(u=f[0],l=f[0]),2==f.length&&(Number.isInteger(f[0])&&Number.isInteger(f[1])?(u=f[0],l=f[1]):null==f[0]&&Number.isInteger(f[1])&&(u=f[1],l=f[1])))),void 0!==u&&void 0!==l||(u=256,l=256),0==y.length)for(var E=h=Math.max(Math.ceil(Math.log(c/u)/Math.LN2),Math.ceil(Math.log(p/l)/Math.LN2));E>=0;E--)y.push(Math.pow(2,E));else{var T=Math.max.apply(Math,y);h=Math.round(Math.log(T)/Math.LN2)}else if(u=c,l=p,y=[],x){a.sort((function(t,e){return t[0]-e[0]})),h=-1;var C=[];for(E=0;E0&&y[y.length-1]==b?C.push(E):(y.push(b),h++)}if(C.length>0)for(E=0;Eh)){var d=t[1],m=t[2],E=y[f];if(!(void 0===d||void 0===m||void 0===E||d<0||Math.ceil(c/E/u)<=d||m<0||Math.ceil(p/E/l)<=m)){if(S||w){var T=d*u*E,C=m*l*E,b=u*E,P=l*E,R=u,O=l;if(T+b>c&&(b=c-T),C+P>p&&(P=p-C),T+u*E>c&&(R=Math.floor((c-T+E-1)/E)),C+l*E>p&&(O=Math.floor((p-C+E-1)/E)),0==T&&b==c&&0==C&&P==p)n="full";else if(!S||v.includes("regionByPx"))n=T+","+C+","+b+","+P;else if(v.includes("regionByPct")){n="pct:"+bc(T/c*100)+","+bc(C/p*100)+","+bc(b/c*100)+","+bc(P/p*100)}o!=vc||S&&!v.includes("sizeByWh")?!S||v.includes("sizeByW")?s=R+",":v.includes("sizeByH")?s=","+O:v.includes("sizeByWh")?s=R+","+O:v.includes("sizeByPct")&&(s="pct:"+bc(100/E)):s=R+","+O}else if(n="full",x){var I=a[f][0],L=a[f][1];s=o==vc?I==c&&L==p?"max":I+","+L:I==c?"full":I+","}else s=o==vc?"max":"full";return i+n+"/"+s+"/0/"+g+"."+_}}},transition:n.transition})||this).zDirection=n.zDirection,r}return Cc(e,t),e}(Wh),Rc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Oc=function(t){function e(e,r,n,i,o,a){var s=this,u=e.getExtent(),l=r.getExtent(),h=l?Zt(n,l):n,c=bh(e,r,Yt(h),i),p=new Oh(e,r,h,u,.5*c,i),f=a(p.calculateSourceExtent(),c,o),d=f?Is:As,_=f?f.getPixelRatio():1;return(s=t.call(this,n,i,_,d)||this).targetProj_=r,s.maxSourceExtent_=u,s.triangulation_=p,s.targetResolution_=i,s.targetExtent_=n,s.sourceImage_=f,s.sourcePixelRatio_=_,s.canvas_=null,s.sourceListenerKey_=null,s}return Rc(e,t),e.prototype.disposeInternal=function(){this.state==Ls&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Fs){var e=Ht(this.targetExtent_)/this.targetResolution_,r=Wt(this.targetExtent_)/this.targetResolution_;this.canvas_=Rh(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Is){this.state=Ls,this.changed();var t=this.sourceImage_.getState();t==Fs||t==Ms?this.reproject_():(this.sourceListenerKey_=g(this.sourceImage_,N,(function(t){var e=this.sourceImage_.getState();e!=Fs&&e!=Ms||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){v(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(Xl),Ic=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lc="imageloadstart",Fc="imageloadend",Mc="imageloaderror",Ac=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return Ic(e,t),e}(F);function Nc(t,e){t.getImage().src=e}var Gc=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return Ic(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=S(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!Qe(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Qe(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&Mt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Oc(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this)),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,i){return n()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case Ls:this.loading=!0,this.dispatchEvent(new Ac(Lc,e));break;case Fs:this.loading=!1,this.dispatchEvent(new Ac(Fc,e));break;case Ms:this.loading=!1,this.dispatchEvent(new Ac(Mc,e))}},e}(Ah);function jc(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var Dc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kc=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Nc,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Dc(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Ct(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};p(o,this.params_);var a=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2;if(1!=this.ratio_){var u=this.ratio_*Ht(t)/2,l=this.ratio_*Wt(t)/2;t[0]=a-u,t[1]=s-l,t[2]=a+u,t[3]=s+l}var h=e/r,c=Math.ceil(Ht(t)/h),f=Math.ceil(Wt(t)/h);t[0]=a-h*c/2,t[2]=a+h*c/2,t[1]=s-h*f/2,t[3]=s+h*f/2,this.imageSize_[0]=c,this.imageSize_[1]=f;var d=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Kl(t,e,r,d,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(N,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(":").pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var a=this.url_,s=a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return s==a&&st(!1,50),jc(s,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){p(this.params_,t),this.image_=null,this.changed()},e}(Gc),Uc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zc=function(t){function e(e,r,n,i,o){var a=this,s=void 0!==o?Is:Fs;return(a=t.call(this,e,r,n,s)||this).loader_=void 0!==o?o:null,a.canvas_=i,a.error_=null,a}return Uc(e,t),e.prototype.getError=function(){return this.error_},e.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=Ms):this.state=Fs,this.changed()},e.prototype.load=function(){this.state==Is&&(this.state=Ls,this.changed(),this.loader_(this.handleLoad_.bind(this)))},e.prototype.getImage=function(){return this.canvas_},e}(Xl),Bc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yc=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Bc(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Ct(i.getExtent(),t))return i;$t(t=t.slice(),this.ratio_);var o=[Ht(t)/e*r,Wt(t)/e*r],a=this.canvasFunction_.call(this,t,e,r,o,n);return a&&(i=new zc(t,e,r,a)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(Gc),Vc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Xc=function(t){function e(e){var r=t.call(this,{projection:e.projection,resolutions:e.resolutions})||this;return r.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,r.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,r.params_=e.params||{},r.url_=e.url,r.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:Nc,r.hidpi_=void 0===e.hidpi||e.hidpi,r.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,r.ratio_=void 0!==e.ratio?e.ratio:1,r.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,r.image_=null,r.renderedRevision_=0,r}return Vc(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Ct(i.getExtent(),t))return i;1!=this.ratio_&&$t(t=t.slice(),this.ratio_);var o=[Ht(t)/e*r,Wt(t)/e*r];if(void 0!==this.url_){var a=this.getUrl(this.url_,this.params_,t,o,n);(i=new Kl(t,e,r,a,this.crossOrigin_,this.imageLoadFunction_)).addEventListener(N,this.handleImageChange.bind(this))}else i=null;return this.image_=i,this.renderedRevision_=this.getRevision(),i},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){p(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,r,n,i){var o=function(t,e,r,n){var i=Ht(t),o=Wt(t),a=e[0],s=e[1],u=.0254/n;return s*i>a*o?i*r/(a*u):o*r/(s*u)}(r,n,this.metersPerUnit_,this.displayDpi_),a=Yt(r),s={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:o,SETVIEWCENTERX:a[0],SETVIEWCENTERY:a[1]};return p(s,e),jc(t,s)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(Gc),Wc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zc=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:Nc;return(r=t.call(this,{attributions:e.attributions,projection:We(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Kl(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(N,r.handleImageChange.bind(r)),r}return Wc(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return Jt(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==Fs){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var a=Wt(r)/o,s=Math.ceil(Ht(r)/a);if(s!=i){var u=Ji(s,o),l=u.canvas;u.drawImage(n,0,0,i,o,0,0,l.width,l.height),this.image_.setImage(l)}}t.prototype.handleImageChange.call(this,e)},e}(Gc),Kc="carmentaserver",qc="geoserver",Hc="mapserver",Jc="qgis",Qc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$c=[101,101],tp=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Nc,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Qc(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=We(r),o=this.getProjection();o&&o!==i&&(e=bh(o,i,t,e),t=er(t,i,o));var a=Xt(t,e,0,$c),s={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};p(s,this.params_,n);var u=Math.floor((t[0]-a[0])/e),l=Math.floor((a[3]-t[1])/e);return s[this.v13_?"I":"X"]=u,s[this.v13_?"J":"Y"]=l,this.getRequestUrl_(a,$c,1,o||i,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i*39.37*(25.4/.28)}return p(r,e),jc(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=Yt(t),a=Xt(o,i,0,[Math.ceil(Ht(t)/i),Math.ceil(Wt(t)/i)]),s=Xt(o,i,0,[Math.ceil(this.ratio_*Ht(t)/i),Math.ceil(this.ratio_*Wt(t)/i)]),u=this.image_;if(u&&this.renderedRevision_==this.getRevision()&&u.getResolution()==e&&u.getPixelRatio()==r&&Ct(u.getExtent(),a))return u;var l={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};p(l,this.params_),this.imageSize_[0]=Math.round(Ht(s)/i),this.imageSize_[1]=Math.round(Wt(s)/i);var h=this.getRequestUrl_(s,this.imageSize_,r,n,l);return this.image_=new Kl(s,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(N,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(st(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case qc:var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case Hc:i.MAP_RESOLUTION=90*r;break;case Kc:case Jc:i.DPI=90*r;break;default:st(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=a.join(","),jc(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){p(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=Ii(t,"1.3")>=0},e}(Gc),ep=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rp='© OpenStreetMap contributors.',np=function(t){function e(e){var r,n=e||{};r=void 0!==n.attributions?n.attributions:[rp];var i=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",o=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:r,cacheSize:n.cacheSize,crossOrigin:i,opaque:void 0===n.opaque||n.opaque,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,url:o,wrapX:n.wrapX,attributionsCollapsible:!1})||this}return ep(e,t),e}(Hh),ip=r(3),op=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ap=function(t){function e(e){var r=e||{};return t.call(this,r)||this}return op(e,t),e}(Ao),sp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),up=function(t){function e(e){var r=t.call(this)||this;return r.boundHandleImageChange_=r.handleImageChange_.bind(r),r.layer_=e,r}return sp(e,t),e.prototype.getFeatures=function(t){return n()},e.prototype.prepareFrame=function(t){return n()},e.prototype.renderFrame=function(t,e){return n()},e.prototype.loadedTileCallback=function(t,e,r){t[e]||(t[e]={}),t[e][r.tileCoord.toString()]=r},e.prototype.createLoadedTileFinder=function(t,e,r){return function(n,i){var o=this.loadedTileCallback.bind(this,r,n);return t.forEachLoadedTile(e,n,i,o)}.bind(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){},e.prototype.getDataAtPixel=function(t,e,r){return n()},e.prototype.getLayer=function(){return this.layer_},e.prototype.handleFontsChanged=function(){},e.prototype.handleImageChange_=function(t){t.target.getState()===Fs&&this.renderIfReadyAndVisible()},e.prototype.loadImage=function(t){var e=t.getState();return e!=Fs&&e!=Ms&&t.addEventListener(N,this.boundHandleImageChange_),e==Is&&(t.load(),e=t.getState()),e==Fs},e.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&t.getSourceState()==yo&&t.changed()},e}(H),lp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hp=function(t){function e(e){var r=t.call(this,e)||this;return r.container=null,r.renderedResolution,r.tempTransform_=[1,0,0,1,0,0],r.pixelTransform=[1,0,0,1,0,0],r.inversePixelTransform=[1,0,0,1,0,0],r.context=null,r.containerReused=!1,r}return lp(e,t),e.prototype.useContainer=function(t,e,r){var n,i,o=this.getLayer().getClassName();t&&""===t.style.opacity&&t.className===o&&((s=t.firstElementChild)instanceof HTMLCanvasElement&&(i=s.getContext("2d")));if(i&&i.canvas.style.transform===e?(this.container=t,this.context=i,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){(n=document.createElement("div")).className=o;var a=n.style;a.position="absolute",a.width="100%",a.height="100%";var s=(i=Ji()).canvas;n.appendChild(s),(a=s.style).position="absolute",a.left="0",a.transformOrigin="top left",this.container=n,this.context=i}},e.prototype.clip=function(t,e,r){var n=e.pixelRatio,i=e.size[0]*n/2,o=e.size[1]*n/2,a=e.viewState.rotation,s=Kt(r),u=qt(r),l=Bt(r),h=zt(r);gr(e.coordinateToPixelTransform,s),gr(e.coordinateToPixelTransform,u),gr(e.coordinateToPixelTransform,l),gr(e.coordinateToPixelTransform,h),t.save(),Ts(t,-a,i,o),t.beginPath(),t.moveTo(s[0]*n,s[1]*n),t.lineTo(u[0]*n,u[1]*n),t.lineTo(l[0]*n,l[1]*n),t.lineTo(h[0]*n,h[1]*n),t.clip(),Ts(t,a,i,o)},e.prototype.clipUnrotated=function(t,e,r){var n=Kt(r),i=qt(r),o=Bt(r),a=zt(r);gr(e.coordinateToPixelTransform,n),gr(e.coordinateToPixelTransform,i),gr(e.coordinateToPixelTransform,o),gr(e.coordinateToPixelTransform,a);var s=this.inversePixelTransform;gr(s,n),gr(s,i),gr(s,o),gr(s,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()},e.prototype.dispatchRenderEvent_=function(t,e,r){var n=this.getLayer();if(n.hasListener(t)){var i=new Ka(t,this.inversePixelTransform,r,e);n.dispatchEvent(i)}},e.prototype.preRender=function(t,e){this.dispatchRenderEvent_(ii,t,e)},e.prototype.postRender=function(t,e){this.dispatchRenderEvent_(oi,t,e)},e.prototype.getRenderTransform=function(t,e,r,n,i,o,a){var s=i/2,u=o/2,l=n/e,h=-l,c=-t[0]+a,p=-t[1];return vr(this.tempTransform_,s,u,l,h,-r,c,p)},e.prototype.getDataAtPixel=function(t,e,r){var n,i=gr(this.inversePixelTransform,t.slice()),o=this.context;try{n=o.getImageData(Math.round(i[0]),Math.round(i[1]),1,1).data}catch(t){return"SecurityError"===t.name?new Uint8Array:n}return 0===n[3]?null:n},e}(up),cp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pp=function(t){function e(e){var r=t.call(this,e)||this;return r.image_=null,r}return cp(e,t),e.prototype.getImage=function(){return this.image_?this.image_.getImage():null},e.prototype.prepareFrame=function(t){var e=t.layerStatesArray[t.layerIndex],r=t.pixelRatio,n=t.viewState,i=n.resolution,o=this.getLayer().getSource(),a=t.viewHints,s=t.extent;if(void 0!==e.extent&&(s=Zt(s,cr(e.extent,n.projection))),!a[Ti]&&!a[Ci]&&!Qt(s))if(o){var u=n.projection,l=o.getImage(s,i,r,u);l&&this.loadImage(l)&&(this.image_=l)}else this.image_=null;return!!this.image_},e.prototype.renderFrame=function(t,e){var r=this.image_,n=r.getExtent(),i=r.getResolution(),o=r.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],s=t.pixelRatio,u=t.viewState,l=u.center,h=u.resolution,c=t.size,p=s*i/(h*o),f=Math.round(c[0]*s),d=Math.round(c[1]*s),_=u.rotation;if(_){var g=Math.round(Math.sqrt(f*f+d*d));f=g,d=g}vr(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,_,-f/2,-d/2),mr(this.inversePixelTransform,this.pixelTransform);var y=Ps(this.pixelTransform);this.useContainer(e,y,a.opacity);var v=this.context,m=v.canvas;m.width!=f||m.height!=d?(m.width=f,m.height=d):this.containerReused||v.clearRect(0,0,f,d);var x=!1;if(a.extent){var w=cr(a.extent,u.projection);(x=!Ct(w,t.extent)&&Jt(w,t.extent))&&this.clipUnrotated(v,t,w)}var S=r.getImage(),E=vr(this.tempTransform_,f/2,d/2,p,p,0,o*(n[0]-l[0])/i,o*(l[1]-n[3])/i);this.renderedResolution=i*s/o;var T=E[4],C=E[5],b=S.width*E[0],P=S.height*E[3];if(this.preRender(v,t),b>=.5&&P>=.5){var R=a.opacity,O=void 0;1!==R&&(O=this.context.globalAlpha,this.context.globalAlpha=R),this.context.drawImage(S,0,0,+S.width,+S.height,Math.round(T),Math.round(C),Math.round(b),Math.round(P)),1!==R&&(this.context.globalAlpha=O)}return this.postRender(v,t),x&&v.restore(),y!==m.style.transform&&(m.style.transform=y),this.container},e}(hp),fp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dp=function(t){function e(e){return t.call(this,e)||this}return fp(e,t),e.prototype.createRenderer=function(){return new pp(this)},e}(ap),_p="preload",gp="useInterimTilesOnError",yp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vp=function(t){function e(e){var r=this,n=e||{},i=p({},n);return delete i.preload,delete i.useInterimTilesOnError,(r=t.call(this,i)||this).setPreload(void 0!==n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return yp(e,t),e.prototype.getPreload=function(){return this.get(_p)},e.prototype.setPreload=function(t){this.set(_p,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(gp)},e.prototype.setUseInterimTilesOnError=function(t){this.set(gp,t)},e}(Ao),mp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xp=function(t){function e(e){var r=t.call(this,e)||this;return r.extentChanged=!0,r.renderedExtent_=null,r.renderedPixelRatio,r.renderedProjection=null,r.renderedRevision,r.renderedTiles=[],r.newTiles_=!1,r.tmpExtent=[1/0,1/0,-1/0,-1/0],r.tmpTileRange_=new Pu(0,0,0,0),r}return mp(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),r=t.getState(),n=e.getUseInterimTilesOnError();return r==ci||r==fi||r==pi&&!n},e.prototype.getTile=function(t,e,r,n){var i=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,r,i,o);return s.getState()==pi&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(ci)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,r,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,r,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var r=t.layerStatesArray[t.layerIndex],n=t.viewState,i=n.projection,a=n.resolution,s=n.center,u=n.rotation,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),p=c.getRevision(),f=c.getTileGridForProjection(i),d=f.getZForResolution(a,c.zDirection),_=f.getResolution(d),g=t.extent,y=r.extent&&cr(r.extent,i);y&&(g=Zt(g,cr(r.extent,i)));var v=c.getTilePixelRatio(l),m=Math.round(t.size[0]*v),w=Math.round(t.size[1]*v);if(u){var S=Math.round(Math.sqrt(m*m+w*w));m=S,w=S}var E=_*m/2/v,T=_*w/2/v,C=[s[0]-E,s[1]-T,s[0]+E,s[1]+T],b=f.getTileRangeForExtentAndZ(g,d),P={};P[d]={};var R=this.createLoadedTileFinder(c,i,P),O=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var L=b.minX;L<=b.maxX;++L)for(var F=b.minY;F<=b.maxY;++F){var M=this.getTile(d,L,F,t);if(this.isDrawableTile(M)){var A=o(this);if(M.getState()==ci){P[d][M.tileCoord.toString()]=M;var N=M.inTransition(A);this.newTiles_||!N&&-1!==this.renderedTiles.indexOf(M)||(this.newTiles_=!0)}if(1===M.getAlpha(A,t.time))continue}var G=f.getTileCoordChildTileRange(M.tileCoord,I,O),j=!1;G&&(j=R(d+1,G)),j||f.forEachTileCoordParentTileRange(M.tileCoord,R,I,O)}var D=_/a;vr(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/v,1/v,u,-m/2,-w/2);var k=Ps(this.pixelTransform);this.useContainer(e,k,r.opacity);var U=this.context,z=U.canvas;mr(this.inversePixelTransform,this.pixelTransform),vr(this.tempTransform_,m/2,w/2,D,D,0,-m/2,-w/2),z.width!=m||z.height!=w?(z.width=m,z.height=w):this.containerReused||U.clearRect(0,0,m,w),y&&this.clipUnrotated(U,t,y),this.preRender(U,t),this.renderedTiles.length=0;var B,Y,V,X=Object.keys(P).map(Number);X.sort(x),1!==r.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(B=[],Y=[]):X=X.reverse();for(var W=X.length-1;W>=0;--W){var Z=X[W],K=c.getTilePixelSize(Z,l,i),q=f.getResolution(Z)/_,H=K[0]*q*D,J=K[1]*q*D,Q=f.getTileCoordForCoordAndZ(Kt(C),Z),$=f.getTileCoordExtent(Q),tt=gr(this.tempTransform_,[v*($[0]-C[0])/_,v*(C[3]-$[3])/_]),et=v*c.getGutterForProjection(i),rt=P[Z];for(var nt in rt){var it=(M=rt[nt]).tileCoord,ot=tt[0]-(Q[1]-it[1])*H,at=Math.round(ot+H),st=tt[1]-(Q[2]-it[2])*J,ut=Math.round(st+J),lt=at-(L=Math.round(ot)),ht=ut-(F=Math.round(st)),ct=d===Z;if(!(N=ct&&1!==M.getAlpha(o(this),t.time)))if(B){U.save(),V=[L,F,L+lt,F,L+lt,F+ht,L,F+ht];for(var pt=0,ft=B.length;ptStamen Design, under CC BY 3.0.',rp],jp={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},Dp={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}},kp=function(t){function e(e){var r=e.layer.indexOf("-"),n=-1==r?e.layer:e.layer.slice(0,r),i=Dp[n],o=jp[e.layer],a=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;return t.call(this,{attributions:Gp,cacheSize:e.cacheSize,crossOrigin:"anonymous",maxZoom:null!=e.maxZoom?e.maxZoom:i.maxZoom,minZoom:null!=e.minZoom?e.minZoom:i.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:a,wrapX:e.wrapX})||this}return Np(e,t),e}(Hh),Up=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function zp(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_||(e=1);var i=n.getTileCoordExtent(t,this.tmpExtent_),o=To(n.getTileSize(t[0]),this.tmpSize);1!=e&&(o=Eo(o,e,this.tmpSize));var a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return p(a,this.params_),this.getRequestUrl_(t,o,i,e,r,a)}}var Bp=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,tileUrlFunction:zp,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).params_=n.params||{},r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.setKey(r.getKeyForParams_()),r}return Up(e,t),e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){var s,u=i.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=r.join(","),o.BBOXSR=u,o.IMAGESR=u,o.DPI=Math.round(o.DPI?o.DPI*n:90*n),1==a.length)s=a[0];else s=a[ge(Fu(t),a.length)];return jc(s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_?t:1},e.prototype.updateParams=function(t){p(this.params_,t),this.setKey(this.getKeyForParams_())},e}(Wh),Yp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vp=function(t){function e(e,r,n){var i=t.call(this,e,ci)||this;return i.tileSize_=r,i.text_=n,i.canvas_=null,i}return Yp(e,t),e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=Ji(t[0],t[1]);return e.strokeStyle="grey",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="grey",e.strokeStyle="white",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.lineWidth=4,e.strokeText(this.text_,t[0]/2,t[1]/2,t[0]),e.fillText(this.text_,t[0]/2,t[1]/2,t[0]),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(xh),Xp=function(t){function e(e){var r=e||{};return t.call(this,{opaque:!1,projection:r.projection,tileGrid:r.tileGrid,wrapX:void 0===r.wrapX||r.wrapX,zDirection:r.zDirection})||this}return Yp(e,t),e.prototype.getTile=function(t,e,r){var n=Ou(t,e,r);if(this.tileCache.containsKey(n))return this.tileCache.get(n);var i=To(this.tileGrid.getTileSize(t)),o=[t,e,r],a=this.getTileCoordForTileUrlFunction(o),s=void 0;s=a?"z:"+a[0]+" x:"+a[1]+" y:"+a[2]:"none";var u=new Vp(o,i,s);return this.tileCache.set(n,u),u},e}(Hh),Wp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zp=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:We("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:go,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this;if(r.tileJSON_=null,r.tileSize_=e.tileSize,e.url)if(e.jsonp)vh(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):st(!1,51);return r}return Wp(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,r=We("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=$e(r,n);e=te(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=Gu({extent:ku(n),maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=s,this.tileUrlFunction=dh(t.tiles,s),void 0!==t.attribution&&!this.getAttributions()){var u=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Jt(u,e.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState(yo)},e.prototype.handleTileJSONError=function(){this.setState(vo)},e}(Wh),Kp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function qp(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=To(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=So(a,s,this.tmpSize),o=wt(o,i*s,o)),1!=e&&(a=Eo(a,e,this.tmpSize));var u={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return p(u,this.params_),this.getRequestUrl_(t,a,o,e,r,u)}}var Hp=function(t){function e(e){var r=this,n=e||{},i=n.params||{},o=!("TRANSPARENT"in i)||i.TRANSPARENT;return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,opaque:!o,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,tileUrlFunction:qp,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).gutter_=void 0!==n.gutter?n.gutter:0,r.params_=i,r.v13_=!0,r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.updateV13_(),r.setKey(r.getKeyForParams_()),r}return Kp(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){var i=We(r),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(i));var s=a.getZForResolution(e,this.zDirection),u=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=u[0])){var l=a.getResolution(u[0]),h=a.getTileCoordExtent(u,this.tmpExtent_),c=To(a.getTileSize(u[0]),this.tmpSize),f=this.gutter_;0!==f&&(c=So(c,f,this.tmpSize),h=wt(h,l*f,h)),o&&o!==i&&(l=bh(o,i,t,l),h=rr(h,i,o),t=er(t,i,o));var d={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};p(d,this.params_,n);var _=Math.floor((t[0]-h[0])/l),g=Math.floor((h[3]-t[1])/l);return d[this.v13_?"I":"X"]=_,d[this.v13_?"J":"Y"]=g,this.getRequestUrl_(u,c,h,1,o||i,d)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i*39.37*(25.4/.28)}return p(r,e),jc(this.urls[0],r)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case qc:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case Hc:o.MAP_RESOLUTION=90*n;break;case Kc:case Jc:o.DPI=90*n;break;default:st(!1,52)}var u,l=i.getAxisOrientation(),h=r;if(this.v13_&&"ne"==l.substr(0,2)){var c=void 0;c=r[0],h[0]=r[1],h[1]=c,c=r[2],h[2]=r[3],h[3]=c}if(o.BBOX=h.join(","),1==a.length)u=a[0];else u=a[ge(Fu(t),a.length)];return jc(u,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.updateParams=function(t){p(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=Ii(t,"1.3")>=0},e}(Wh),Jp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qp=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r)||this;return s.src_=n,s.extent_=i,s.preemptive_=o,s.grid_=null,s.keys_=null,s.data_=null,s.jsonp_=a,s}return Jp(e,t),e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),r=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-r)*this.grid_.length)];if("string"!=typeof n)return null;var i=n.charCodeAt(Math.floor(e*n.length));i>=93&&i--,i>=35&&i--;var o=null;if((i-=32)in this.keys_){var a=this.keys_[i];o=this.data_&&a in this.data_?this.data_[a]:a}return o},e.prototype.forDataAtCoordinate=function(t,e,r){this.state==fi&&!0===r?(this.state=li,y(this,N,(function(r){e(this.getData(t))}),this),this.loadInternal_()):!0===r?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=pi,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=ci,this.changed()},e.prototype.loadInternal_=function(){if(this.state==li)if(this.state=hi,this.jsonp_)vh(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{var t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(r)}else this.handleError_()},e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_?this.loadInternal_():this.setState(fi)},e}(xh),$p=function(t){function e(e){var r=t.call(this,{projection:We("EPSG:3857"),state:go})||this;if(r.preemptive_=void 0===e.preemptive||e.preemptive,r.tileUrlFunction_=gh,r.template_=void 0,r.jsonp_=e.jsonp||!1,e.url)if(r.jsonp_)vh(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):st(!1,51);return r}return Jp(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,r,n){if(this.tileGrid){var i=this.tileGrid.getZForResolution(e,this.zDirection),o=this.tileGrid.getTileCoordForCoordAndZ(t,i);this.getTile(o[0],o[1],o[2],1,this.getProjection()).forDataAtCoordinate(t,r,n)}else!0===n?setTimeout((function(){r(null)}),0):r(null)},e.prototype.handleTileJSONError=function(){this.setState(vo)},e.prototype.handleTileJSONResponse=function(t){var e,r=We("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=$e(r,n);e=te(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=Gu({extent:ku(n),maxZoom:a,minZoom:o});this.tileGrid=s,this.template_=t.template;var u=t.grids;if(u){if(this.tileUrlFunction_=dh(u,s),void 0!==t.attribution){var l=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Jt(l,e.extent)?[t.attribution]:null}))}this.setState(yo)}else this.setState(vo)},e.prototype.getTile=function(t,e,r,n,i){var o=Ou(t,e,r);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),u=this.tileUrlFunction_(s,n,i),l=new Qp(a,void 0!==u?li:fi,void 0!==u?u:"",this.tileGrid.getTileCoordExtent(a),this.preemptive_,this.jsonp_);return this.tileCache.set(o,l),l},e.prototype.useTile=function(t,e,r){var n=Ou(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(Dh),tf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ef=[],rf=function(t){function e(e,r,n,i){var o=t.call(this,e,r,{transition:0})||this;return o.context_={},o.executorGroups={},o.loadingSourceTiles=0,o.errorSourceTileKeys={},o.hitDetectionImageData={},o.replayState_={},o.sourceTiles=null,o.wantedResolution,o.getSourceTiles=i.bind(void 0,o),o.sourceZ=-1,o.hifi=!1,o.wrappedTileCoord=n,o}return tf(e,t),e.prototype.getContext=function(t){var e=o(t);return e in this.context_||(this.context_[e]=Ji(1,1,ef)),this.context_[e]},e.prototype.hasContext=function(t){return o(t)in this.context_},e.prototype.getImage=function(t){return this.hasContext(t)?this.getContext(t).canvas:null},e.prototype.getReplayState=function(t){var e=o(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedZ:-1,renderedTileZ:-1}),this.replayState_[e]},e.prototype.load=function(){this.getSourceTiles()},e.prototype.release=function(){for(var e in this.context_)ef.push(this.context_[e].canvas);t.prototype.release.call(this)},e}(xh),nf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),of=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.extent=null,s.format_=i,s.features_=null,s.loader_,s.projection=null,s.resolution,s.tileLoadFunction_=o,s.url_=n,s}return nf(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.getKey=function(){return this.url_},e.prototype.load=function(){this.state==li&&(this.setState(hi),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(pi)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(ci)},e.prototype.setLoader=function(t){this.loader_=t},e}(xh),af=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sf=function(t){function e(e){var r=this,n=e.projection||"EPSG:3857",i=e.extent||ku(n),o=e.tileGrid||Gu({extent:i,maxResolution:e.maxResolution,maxZoom:void 0!==e.maxZoom?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});return(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,opaque:!1,projection:n,state:e.state,tileGrid:o,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:uf,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:void 0===e.zDirection?1:e.zDirection})||this).format_=e.format?e.format:null,r.loadingTiles_={},r.sourceTileCache=new Ch(r.tileCache.highWaterMark),r.overlaps_=null==e.overlaps||e.overlaps,r.tileClass=e.tileClass?e.tileClass:of,r.tileGrids_={},r}return af(e,t),e.prototype.getFeaturesInExtent=function(t){var e=[],r=this.tileCache;if(0===r.getCount())return e;var n=Lu(r.peekFirstKey())[0],i=this.tileGrid;return r.forEach((function(r){if(r.tileCoord[0]===n&&r.getState()===ci)for(var o=r.getSourceTiles(),a=0,s=o.length;a0&&_[0].tileCoord[0]===f)h=_,c=!0,p=f;else{h=[],p=f+1;do{--p,c=!0,u.forEachTileCoord(o,p,function(n){var i,o=this.tileUrlFunction(n,t,e);if(void 0!==o)if(this.sourceTileCache.containsKey(o)){var a=(i=this.sourceTileCache.get(o)).getState();if(a===ci||a===pi||a===fi)return void h.push(i)}else p===f&&((i=new this.tileClass(n,li,o,this.format_,this.tileLoadFunction)).extent=u.getTileCoordExtent(n),i.projection=e,i.resolution=u.getResolution(n[0]),this.sourceTileCache.set(o,i),i.addEventListener(N,this.handleTileChange.bind(this)),i.load());c=c&&i&&i.getState()===ci,i&&i.getState()!==fi&&r.getState()===li&&(r.loadingSourceTiles++,i.addEventListener(N,(function t(){var e=i.getState(),n=i.getKey();if(e===ci||e===pi){e===ci?(i.removeEventListener(N,t),r.loadingSourceTiles--,delete r.errorSourceTileKeys[n]):e===pi&&(r.errorSourceTileKeys[n]=!0);var o=Object.keys(r.errorSourceTileKeys).length;r.loadingSourceTiles-o==0&&(r.hifi=0===o,r.sourceZ=f,r.setState(ci))}})))}.bind(this)),c||(h.length=0)}while(!c&&p>d)}return r.getState()===li&&r.setState(hi),c&&(r.hifi=f===p,r.sourceZ=p,r.getState()0&&(r.tileUrlFunction=_h(o.map(ff.bind(r)))),r}return cf(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(_h(t.map(ff.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){p(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e}(Wh);function ff(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==lf&&p(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==lf?jc(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,a){if(r){var s={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};p(s,i);var u=t;return u=e==lf?jc(u,s):u.replace(/\{(\w+?)\}/g,(function(t,e){return s[e]}))}}}var df=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_f="GENERATE_BUFFERS",gf=function(t){function e(e,r){var n=t.call(this,e)||this,i=r||{};return n.helper=new Ol({postProcesses:i.postProcesses,uniforms:i.uniforms}),n}return df(e,t),e.prototype.disposeInternal=function(){this.helper.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getShaderCompileErrors=function(){return this.helper.getShaderCompileErrors()},e}(up);var yf=gf,vf=new Blob(['var e="function"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,o=arguments.length;rthis.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,r=[If.SET_FILL_STYLE,e];return"string"!=typeof e&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[If.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var r=t.strokeStyle,n=t.lineCap,i=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,u=t.miterLimit;(t.currentStrokeStyle!=r||t.currentLineCap!=n||i!=t.currentLineDash&&!b(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=u)&&(void 0!==r&&e.call(this,t),t.currentStrokeStyle=r,t.currentLineCap=n,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=u)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[If.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=St(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;wt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(ls),Mf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Af=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.declutterGroups_=null,o.hitDetectionImage_=null,o.image_=null,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o}return Mf(e,t),e.prototype.drawCoordinates_=function(t,e,r,n){return this.appendFlatCoordinates(t,e,r,n,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.drawCoordinates_(r,0,r.length,n);this.instructions.push([If.DRAW_IMAGE,i,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([If.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.drawCoordinates_(r,0,r.length,n);this.instructions.push([If.DRAW_IMAGE,i,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([If.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var r=t.getAnchor(),n=t.getSize(),i=t.getHitDetectionImage(1),o=t.getImage(1),a=t.getOrigin();this.anchorX_=r[0],this.anchorY_=r[1],this.declutterGroups_=e,this.hitDetectionImage_=i,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0],this.originY_=a[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScale(),this.width_=n[0]},e}(Ff),Nf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gf=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return Nf(e,t),e.prototype.drawFlatCoordinates_=function(t,e,r,n){var i=this.coordinates.length,o=this.appendFlatCoordinates(t,e,r,n,!1,!1),a=[If.MOVE_TO_LINE_TO,i,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),r},e.prototype.drawLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([If.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],Rf);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Pf),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([If.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],Rf);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),u=0,l=0,h=o.length;lt&&(y>g&&(g=y,d=v,_=o),y=0,v=o-i)),a=s,h=p,c=f),u=m,l=x}return(y+=s)>g?[v,o]:[d,_]}var Uf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zf={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Bf={Circle:Df,Default:Ff,Image:Af,LineString:Gf,Polygon:Df,Text:function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.declutterGroups_,o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o}return Uf(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var r=this.textFillState_,n=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(r||n)){var o,a,s=this.coordinates.length,u=t.getType(),l=null,h=2,c=2;if(i.placement===ch){if(!Jt(this.getBufferedMaxExtent(),t.getExtent()))return;var p=void 0;if(l=t.getFlatCoordinates(),c=t.getStride(),u==ae.LINE_STRING)p=[l.length];else if(u==ae.MULTI_LINE_STRING)p=t.getEnds();else if(u==ae.POLYGON)p=t.getEnds().slice(0,1);else if(u==ae.MULTI_POLYGON){var f=t.getEndss();for(p=[],o=0,a=f.length;ot[r-n],_=i.length,g=t[e],y=t[e+1],v=t[e+=n],m=t[e+1],x=0,w=Math.sqrt(Math.pow(v-g,2)+Math.pow(m-y,2)),S=!1,E=0;E<_;++E){for(var T=i[c=d?_-E-1:E],C=s*u(l,T,h),b=o+C/2;e0?-Math.PI:Math.PI),void 0!==p){var O=R-p;if(S=S||0!==O,O+=O>Math.PI?-2*Math.PI:O<-Math.PI?2*Math.PI:0,Math.abs(O)>a)return null}p=R;var I=P/w,L=ye(g,v,I),F=ye(y,m,I);f[c]=[L,F,C/2,R,T],o+=C}return S?f:[[f[0][0],f[0][1],f[0][2],f[0][3],i]]}var Wf=[1/0,1/0,-1/0,-1/0],Zf=[1,0,0,1,0,0],Kf=[],qf=[],Hf=[],Jf=[],Qf=function(){function t(t,e,r,n){this.overlaps=r,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.declutterItems=[],this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}return t.prototype.createLabel=function(t,e,r,n){var i=t+e+r+n;if(this.labels_[i])return this.labels_[i];var o=n?this.strokeStates[n]:null,a=r?this.fillStates[r]:null,s=this.textStates[e],u=this.pixelRatio,l=s.scale*u,h=zf[s.textAlign||"center"],c=n&&o.lineWidth?o.lineWidth:0,p=t.split("\n"),f=p.length,d=[],_=function(t,e,r){for(var n=e.length,i=0,o=0;on.width?n.width-l:d,x=s+h>n.height?n.height-h:s,w=_[3]+m*p+_[1],S=_[0]+x*p+_[2],E=e-_[3],T=r-_[0];(v||0!==c)&&(Kf[0]=E,Jf[0]=E,Kf[1]=T,qf[1]=T,qf[0]=E+w,Hf[0]=qf[0],Hf[1]=T+S,Jf[1]=Hf[1]);var C=null;if(0!==c){var b=e+i,P=r+o;C=vr(Zf,b,P,1,1,c,-b,-P),gr(Zf,Kf),gr(Zf,qf),gr(Zf,Hf),gr(Zf,Jf),Ot(Math.min(Kf[0],qf[0],Hf[0],Jf[0]),Math.min(Kf[1],qf[1],Hf[1],Jf[1]),Math.max(Kf[0],qf[0],Hf[0],Jf[0]),Math.max(Kf[1],qf[1],Hf[1],Jf[1]),Wf)}else Ot(E,T,E+w,T+S,Wf);var R=t.canvas,O=y?y[2]*p/2:0,I=Wf[0]-O<=R.width&&Wf[2]+O>=0&&Wf[1]-O<=R.height&&Wf[3]+O>=0;if(f&&(e=Math.round(e),r=Math.round(r)),a){if(!I&&1==a[4])return;At(a,Wf);var L=I?[t,C?C.slice(0):null,u,n,l,h,m,x,e,r,p]:null;L&&(v&&L.push(g,y,Kf.slice(0),qf.slice(0),Hf.slice(0),Jf.slice(0)),a.push(L))}else I&&(v&&this.replayTextBackground_(t,Kf,qf,Hf,Jf,g,y),Cs(t,C,u,n,l,h,m,x,e,r,p))},t.prototype.fill_=function(t){if(this.alignFill_){var e=gr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(e[0]%r,e[1]%r),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.renderDeclutter=function(t,e,r,n){if(t&&t.length>5){var i=t[4];if(1==i||i==t.length-5){var o={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};if(n||(n=new ic.a(9)),!n.collides(o)){n.insert(o);for(var a=5,s=t.length;a11&&this.replayTextBackground_(u[0],u[13],u[14],u[15],u[16],u[11],u[12]),Cs.apply(void 0,u),h!==r&&(l.globalAlpha=h)}}t.length=5,It(t)}}return n},t.prototype.drawLabelWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.createLabel(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,u=zf[i.textAlign||"center"],l=zf[i.textBaseline||"middle"],h=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:u*(o.width/s-2*i.scale)+2*(.5-u)*h,anchorY:l*o.height/s+2*(.5-l)*h}},t.prototype.execute_=function(t,e,r,n,i,o){var a,s,u;this.declutterItems.length=0,this.pixelCoordinates_&&b(e,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=se(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_),s=this.renderedTransform_,u=e,s[0]=u[0],s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5]);for(var l,h,c,p,f,d,_,g,y,v,m,x,w,S,E,T,C,P=0,R=r.length,O=0,I=0,L=0,F=null,M=null,A=this.coordinateCache_,N=this.viewRotation_,G=Math.round(1e12*Math.atan2(-e[1],e[0]))/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:N},D=this.instructions!=r||this.overlaps?0:200;PD&&(this.fill_(t),I=0),L>D&&(t.stroke(),L=0),I||L||(t.beginPath(),p=NaN,f=NaN),++P;break;case If.CIRCLE:var U=a[O=k[1]],z=a[O+1],B=a[O+2]-U,Y=a[O+3]-z,V=Math.sqrt(B*B+Y*Y);t.moveTo(U+V,z),t.arc(U,z,V,0,2*Math.PI,!0),++P;break;case If.CLOSE_PATH:t.closePath(),++P;break;case If.CUSTOM:O=k[1],l=k[2];var X=k[3],W=k[4],Z=6==k.length?k[5]:void 0;j.geometry=X,j.feature=E,P in A||(A[P]=[]);var K=A[P];Z?Z(a,O,l,2,K):(K[0]=a[O],K[1]=a[O+1],K.length=2),W(K,j),++P;break;case If.DRAW_IMAGE:O=k[1],l=k[2],v=k[3],h=k[4],c=k[5],y=i?null:k[6];var q=k[7],H=k[8],J=k[9],Q=k[10],$=k[11],tt=k[12],et=k[13],rt=k[14];if(!v&&k.length>=19){m=k[18],x=k[19],w=k[20],S=k[21];var nt=this.drawLabelWithPointPlacement_(m,x,w,S);v=nt.label,k[3]=v;var it=k[22];h=(nt.anchorX-it)*this.pixelRatio,k[4]=h;var ot=k[23];c=(nt.anchorY-ot)*this.pixelRatio,k[5]=c,q=v.height,k[7]=q,rt=v.width,k[14]=rt}var at=void 0;k.length>24&&(at=k[24]);var st=void 0,ut=void 0,lt=void 0;k.length>16?(st=k[15],ut=k[16],lt=k[17]):(st=cs,ut=!1,lt=!1),$&&G?tt+=N:$||G||(tt-=N);for(var ht=0,ct=0;O=o;)rd(r,t+i,t+o),rd(r,t+o,t+i),rd(r,t-o,t+i),rd(r,t-i,t+o),rd(r,t-i,t-o),rd(r,t-o,t-i),rd(r,t+o,t-i),rd(r,t+i,t-o),o++,2*((a+=1+2*o)-i)+1>0&&(a+=1-2*(i-=1));return ed[t]=r,r}(n);function p(t){for(var e=l.getImageData(0,0,a,a).data,r=0;r0){var s=void 0;return(!o||h!=js&&h!=Us||-1!==o.indexOf(t))&&(s=i(t)),s||void l.clearRect(0,0,a,a)}}var f,d,_,g,y,v=Object.keys(this.executorsByZIndex_).map(Number);for(v.sort(x),f=v.length-1;f>=0;--f){var m=v[f].toString();for(_=this.executorsByZIndex_[m],d=$f.length-1;d>=0;--d)if(void 0!==(g=_[h=$f[d]])&&(y=g.executeHitDetection(l,s,r,p,u)))return y}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var r=e[0],n=e[1],i=e[2],o=e[3],a=[r,n,r,o,i,o,i,n];return se(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return _(this.executorsByZIndex_)},t.prototype.execute=function(t,e,r,n,i,o){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(x),this.maxExtent_&&(t.save(),this.clip(t,e));var s,u,l,h,c,p,f=i||$f;for(s=0,u=a.length;s=i)for(n=i;n0&&(a.width=0),this.container;var u=Math.round(t.size[0]*r),l=Math.round(t.size[1]*r);a.width!=u||a.height!=l?(a.width=u,a.height=l,a.style.transform!==i&&(a.style.transform=i)):this.containerReused||o.clearRect(0,0,u,l),this.preRender(o,t);var h=t.extent,c=t.viewState,p=c.center,f=c.resolution,d=c.projection,_=c.rotation,g=d.getExtent(),y=this.getLayer().getSource(),v=!1;if(n.extent){var m=cr(n.extent,d);(v=!Ct(m,t.extent)&&Jt(m,t.extent))&&this.clip(o,t,m)}var x=t.viewHints,w=!(x[Ti]||x[Ci]),S=this.getRenderTransform(p,f,_,r,u,l,0),E=this.getLayer().getDeclutter()?{}:null;if(s.execute(o,S,_,w,void 0,E),y.getWrapX()&&d.canWrapX()&&!Ct(g,h)){for(var T=h[0],C=Ht(g),b=0,P=void 0;Tg[2];){P=C*++b;var O=this.getRenderTransform(p,f,_,r,u,l,P);s.execute(o,O,_,w,void 0,E),T-=C}}if(E){var I=t.viewHints;nd(E,o,_,1,!(I[Ti]||I[Ci]),t.declutterItems)}v&&o.restore(),this.postRender(o,t);var L=n.opacity,F=this.container;return L!==parseFloat(F.style.opacity)&&(F.style.opacity=1===L?"":L),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e,r){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var n=[this.context.canvas.width,this.context.canvas.height];gr(this.pixelTransform,n);var i=this.renderedCenter_,o=this.renderedResolution_,a=this.renderedRotation_,s=this.renderedProjection_,u=this.renderedExtent_,l=this.getLayer(),h=[],c=n[0]/2,p=n[1]/2;h.push(this.getRenderTransform(i,o,a,.5,c,p,0).slice());var f=l.getSource(),d=s.getExtent();if(f.getWrapX()&&s.canWrapX()&&!Ct(d,u)){for(var _=u[0],g=Ht(d),y=0,v=void 0;_d[2];)v=g*++y,h.push(this.getRenderTransform(i,o,a,.5,c,p,v).slice()),_-=g}this.hitDetectionImageData_=od(n,h,this.renderedFeatures_,l.getStyleFunction(),u,o,a)}e(ad(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){if(this.replayGroup_){var a=e.viewState.resolution,s=e.viewState.rotation,u=this.getLayer(),l={};return this.replayGroup_.forEachFeatureAtCoordinate(t,a,s,r,(function(t){var e=o(t);if(!(e in l))return l[e]=!0,n(t,u)}),u.getDeclutter()?i:null)}},e.prototype.handleFontsChanged=function(){var t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.prepareFrame=function(t){var e=this.getLayer(),r=e.getSource();if(!r)return!1;var n=t.viewHints[Ti],i=t.viewHints[Ci],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(!this.dirty_&&!o&&n||!a&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var s=t.extent,u=t.viewState,l=u.projection,h=u.resolution,c=t.pixelRatio,p=e.getRevision(),f=e.getRenderBuffer(),d=e.getRenderOrder();void 0===d&&(d=Bs);var _=u.center.slice(),g=wt(s,f*h),y=[g.slice()],v=l.getExtent();if(r.getWrapX()&&l.canWrapX()&&!Ct(v,t.extent)){var m=Ht(v),x=Math.max(Ht(g)/2,m);g[0]=v[0]-x,g[2]=v[2]+x,Bi(_,l);var w=ee(y[0],l);w[0]v[0]&&w[2]>v[2]&&y.push([w[0]-m,w[1],w[2]-m,w[3]])}if(!this.dirty_&&this.renderedResolution_==h&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&Ct(this.renderedExtent_,g))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var S,E=new Yf(Vs(h,c),g,h,c,e.getDeclutter()),T=sr();if(T){for(var C=0,b=y.length;C0)e([]);else{var y=Kt(c.getTileCoordExtent(n.wrappedTileCoord)),v=[(p[0]-y[0])/h,(y[1]-p[1])/h],m=n.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),x=n.hitDetectionImageData[a];if(!x&&!this.animatingOrInteracting_){var w=To(c.getTileSize(c.getZForResolution(h))),S=[w[0]/2,w[1]/2],E=this.renderedRotation_;x=od(w,[this.getRenderTransform(c.getTileCoordCenter(n.wrappedTileCoord),h,0,.5,S[0],S[1],0)],m,i.getStyleFunction(),c.getTileCoordExtent(n.wrappedTileCoord),n.getReplayState(i).renderedResolution,E),n.hitDetectionImageData[a]=x}e(ad(v,m,x))}}.bind(this))},e.prototype.handleFontsChanged=function(){f(this.renderTileImageQueue_);var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.renderFrame=function(e,r){var n=e.viewHints,i=!(n[Ti]||n[Ci]);this.renderQueuedTileImages_(i,e),t.prototype.renderFrame.call(this,e,r),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var a=this.getLayer(),s=a.getRenderMode();if(s===cd)return this.container;var u=a.getSource(),l=e.usedTiles[o(u)];for(var h in this.renderTileImageQueue_)l&&h in l||delete this.renderTileImageQueue_[h];for(var c=this.context,p=a.getDeclutter()?{}:null,f=gd[s],d=e.pixelRatio,_=e.viewState,g=_.center,y=_.resolution,v=_.rotation,m=e.size,x=Math.round(m[0]*d),w=Math.round(m[1]*d),S=this.renderedTiles,E=u.getTileGridForProjection(e.viewState.projection),T=[],C=[],b=S.length-1;b>=0;--b)for(var P=S[b],R=P.tileCoord,O=E.getTileCoordExtent(P.wrappedTileCoord),I=E.getTileCoordExtent(R,this.tmpExtent)[0]-O[0],L=dr(yr(this.inversePixelTransform.slice(),1/d,1/d),this.getRenderTransform(g,y,v,d,x,w,I)),F=P.executorGroups[o(a)],M=!1,A=0,N=F.length;A8){e.animate=!0;break}var n=this.renderTileImageQueue_[r];delete this.renderTileImageQueue_[r],this.renderTileImage_(n,e)}},e.prototype.renderFeature=function(t,e,r,n){if(!r)return!1;var i=!1;if(Array.isArray(r))for(var o=0,a=r.length;o>1)],e))<0?a=n+1:(s=n,u=!i);return u?a:~a}(p,g);if(y<0){var v=(g-p[-y-2])/(p[-y-1]-p[-y-2]),m=e+(-y-2)*n;a=ye(t[m],t[m+n],v),s=ye(t[m+1],t[m+n+1],v)}else a=t[e+y*n],s=t[e+y*n+1]}return o?(o[0]=a,o[1]=s,o):[a,s]}function wd(t,e,r,n,i,o){if(r==e)return null;var a;if(i>1;i0&&g.length>0;)o=g.pop(),h=d.pop(),p=_.pop(),(u=o.toString())in y||(l.push(p[0],p[1]),y[u]=!0),a=g.pop(),c=d.pop(),f=_.pop(),pe((i=e(n=t(s=(o+a)/2)))[0],i[1],p[0],p[1],f[0],f[1])this.featurePool_.length;)s=new lt,this.featurePool_.push(s);var l=n.getFeaturesCollection();l.clear();var h,c,p=0;for(h=0,c=this.meridians_.length;hMath.PI/2);for(var g=Ws(t),y=c;y<=p;++y){var v=this.meridians_.length+this.parallels_.length,m=void 0,x=void 0,w=void 0,S=void 0;if(this.meridiansLabels_)for(x=0,w=this.meridiansLabels_.length;x=s?(t[0]=a[0],t[2]=a[2]):o=!0);var u=[he(e[0],this.minX_,this.maxX_),he(e[1],this.minY_,this.maxY_)],l=this.toLonLatTransform_(u);isNaN(l[1])&&(l[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);var h,c,p,f,d=he(l[0],this.minLon_,this.maxLon_),_=he(l[1],this.minLat_,this.maxLat_),g=this.maxLines_,y=t;o||(y=[he(t[0],this.minX_,this.maxX_),he(t[1],this.minY_,this.maxY_),he(t[2],this.minX_,this.maxX_),he(t[3],this.minY_,this.maxY_)]);var v=te(y,this.toLonLatTransform_,void 0,8),m=v[3],x=v[2],w=v[1],S=v[0];if(o||(Tt(y,this.bottomLeft_)&&(S=this.minLon_,w=this.minLat_),Tt(y,this.bottomRight_)&&(x=this.maxLon_,w=this.minLat_),Tt(y,this.topLeft_)&&(S=this.minLon_,m=this.maxLat_),Tt(y,this.topRight_)&&(x=this.maxLon_,m=this.maxLat_),m=he(m,_,this.maxLat_),x=he(x,d,this.maxLon_),w=he(w,this.minLat_,_),S=he(S,this.minLon_,d)),f=he(d=Math.floor(d/i)*i,this.minLon_,this.maxLon_),c=this.addMeridian_(f,w,m,n,t,0),h=0,o)for(;(f-=i)>=S&&h++n[o]&&(i=o,o=1);var a=Math.max(e[1],n[i]),s=Math.min(e[3],n[o]),u=he(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,a,s),l=[n[i-1]+(n[o-1]-n[i-1])*(u-n[i])/(n[o]-n[i]),u],h=this.meridiansLabels_[r].geom;return h.setCoordinates(l),h},e.prototype.getMeridians=function(){return this.meridians_},e.prototype.getParallel_=function(t,e,r,n,i){var o=function(t,e,r,n,i){return Td((function(n){return[e+(r-e)*n,t]}),tr(We("EPSG:4326"),n),i)}(t,e,r,this.projection_,n),a=this.parallels_[i];return a?(a.setFlatCoordinates(re,o),a.changed()):a=new Ed(o,re),a},e.prototype.getParallelPoint_=function(t,e,r){var n=t.getFlatCoordinates(),i=0,o=n.length-2;n[i]>n[o]&&(i=o,o=0);var a=Math.max(e[0],n[i]),s=Math.min(e[2],n[o]),u=he(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,a,s),l=[u,n[i+1]+(n[o+1]-n[i+1])*(u-n[i])/(n[o]-n[i])],h=this.parallelsLabels_[r].geom;return h.setCoordinates(l),h},e.prototype.getParallels=function(){return this.parallels_},e.prototype.updateProjectionInfo_=function(t){var e=We("EPSG:4326"),r=t.getWorldExtent();this.maxLat_=r[3],this.maxLon_=r[2],this.minLat_=r[1],this.minLon_=r[0];var n=tr(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t},e}(md),Od=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Id="blur",Ld="gradient",Fd="radius",Md=["#00f","#0ff","#0f0","#ff0","#f00"];var Ad=function(t){function e(e){var r=this,n=e||{},i=p({},n);delete i.gradient,delete i.radius,delete i.blur,delete i.weight,(r=t.call(this,i)||this).gradient_=null,r.addEventListener(et(Ld),r.handleGradientChanged_),r.setGradient(n.gradient?n.gradient:Md),r.setBlur(void 0!==n.blur?n.blur:15),r.setRadius(void 0!==n.radius?n.radius:8);var o=n.weight?n.weight:"weight";return r.weightFunction_="string"==typeof o?function(t){return t.get(o)}:o,r.setRenderOrder(null),r}return Od(e,t),e.prototype.getBlur=function(){return this.get(Id)},e.prototype.getGradient=function(){return this.get(Ld)},e.prototype.getRadius=function(){return this.get(Fd)},e.prototype.handleGradientChanged_=function(){this.gradient_=function(t){for(var e=Ji(1,256),r=e.createLinearGradient(0,0,1,256),n=1/(t.length-1),i=0,o=t.length;i0)break}this.source_&&(this.source_.clear(),this.source_.addFeatures(a)),this.dispatchEvent(new zd(Ud,t,a,i))},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[g(e,B,Bd,this),g(e,U,Yd,this),g(e,z,Yd,this),g(e,B,Yd,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,r){try{return t.readFeatures(e,r)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(v),this.dropListenKeys_=null)},e}(Zo),Xd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wd=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).condition_=n.condition?n.condition:oa,r.lastAngle_=void 0,r.lastMagnitude_=void 0,r.lastScaleDelta_=0,r.duration_=void 0!==n.duration?n.duration:400,r}return Xd(e,t),e.prototype.handleDragEvent=function(t){if(sa(t)){var e=t.map,r=e.getSize(),n=t.pixel,i=n[0]-r[0]/2,o=r[1]/2-n[1],a=Math.atan2(o,i),s=Math.sqrt(i*i+o*o),u=e.getView();if(void 0!==this.lastAngle_){var l=this.lastAngle_-a;u.adjustRotationInternal(l)}this.lastAngle_=a,void 0!==this.lastMagnitude_&&u.adjustResolutionInternal(this.lastMagnitude_/s),void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/s),this.lastMagnitude_=s}},e.prototype.handleUpEvent=function(t){if(!sa(t))return!0;var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!sa(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(ca),Zd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kd=function(t){function e(e,r,n){var i=t.call(this)||this;if(void 0!==n&&void 0===r)i.setFlatCoordinates(n,e);else{var o=r||0;i.setCenterAndRadius(e,o,n)}return i}return Zd(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=t-i[0],a=e-i[1],s=o*o+a*a;if(s=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||kt(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,r=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+r;for(var i=1;i=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,r=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Bn.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Bn.POINTERDOWN?n=!1:r?(n=e.type===Bn.POINTERMOVE)&&this.freehand_?n=this.handlePointerMove_(e):("mouse"==e.pointerEvent.pointerType||e.type===Bn.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Bn.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Vn(Bn.POINTERMOVE,t.map,t.pointerEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var r=this.mode_===s_;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||r?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate):(this.startDrawing_(t),this.mode_===i_&&this.finishDrawing()),e=!1):this.freehand_&&this.abortDrawing(),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,r=t.pixel,n=e[0]-r[0],i=e[1]-r[1],o=n*n+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return!0}return this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t),!0},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_];if(this.mode_===o_)r=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===a_){var i=this.sketchCoords_;r=i[0].length>this.minPoints_,n=[i[0][0],i[0][i[0].length-2]]}if(r)for(var o=t.map,a=0,s=n.length;a=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):this.mode_===a_&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,n,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();this.mode_===o_?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,r),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===a_&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)),0===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===o_?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===a_&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===ae.MULTI_POINT?t.setGeometry(new $d([e])):this.type_===ae.MULTI_LINE_STRING?t.setGeometry(new Jd([e])):this.type_===ae.MULTI_POLYGON&&t.setGeometry(new r_([e])),this.dispatchEvent(new c_(l_,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new c_(h_,t))},e.prototype.appendCoordinates=function(t){var e=this.mode_,r=[];e===o_?r=this.sketchCoords_:e===a_&&(r=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var n=r.pop(),i=0;ic?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,r=t.map,n=this.snapToVertex_(e,r);n||(n=r.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(fn(t)):e.setGeometry(void 0):(e=new lt(t?fn(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new lt(new Kr(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(e.type!=Bn.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,r=t.map,n=this.getExtentInternal(),i=this.snapToVertex_(e,r),o=function(t){var e=null,r=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?r=n[3]:t[1]==n[3]&&(r=n[1]),null!==e&&null!==r?[e,r]:null};if(i&&n){var a=i[0]==n[0]||i[0]==n[2]?i[0]:null,s=i[1]==n[1]||i[1]==n[3]?i[1]:null;null!==a&&null!==s?this.pointerHandler_=y_(o(i)):null!==a?this.pointerHandler_=v_(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=v_(o([n[0],s]),o([n[2],s])))}else i=r.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=y_(i);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}return!0},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==Ut(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return hr(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new __(this.extent_))},e}(ca),x_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),w_=[0,0,0,0],S_=[],E_="modifystart",T_="modifyend",C_=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return x_(e,t),e}(F);function b_(t,e){return t.index-e.index}function P_(t,e,r){var n=e.geometry;if(n.getType()===ae.CIRCLE){var i=n;if(1===e.index){var o=sr();o&&(i=i.clone().transform(o,r));var a=Di(i.getCenter(),lr(t,r)),s=Math.sqrt(a)-i.getRadius();return s*s}}var u=lr(t,r);return S_[0]=lr(e.segment[0],r),S_[1]=lr(e.segment[1],r),Ui(u,S_)}function R_(t,e,r){var n=e.geometry;if(n.getType()===ae.CIRCLE&&1===e.index){var i=n,o=sr();return o&&(i=i.clone().transform(o,r)),ur(i.getClosestPoint(lr(t,r)),r)}var a=lr(t,r);return S_[0]=lr(e.segment[0],r),S_[1]=lr(e.segment[1],r),ur(Fi(a,S_),r)}var O_=function(t){function e(e){var r,n,i=t.call(this,e)||this;if(i.boundHandleFeatureChange_=i.handleFeatureChange_.bind(i),i.condition_=e.condition?e.condition:ua,i.defaultDeleteCondition_=function(t){return Jo(t)&&na(t)},i.deleteCondition_=e.deleteCondition?e.deleteCondition:i.defaultDeleteCondition_,i.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:ta,i.vertexFeature_=null,i.vertexSegments_=null,i.lastPixel_=[0,0],i.ignoreNextSingleClick_=!1,i.modified_=!1,i.rBush_=new oc,i.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,i.snappedToVertex_=!1,i.changingFeature_=!1,i.dragSegments_=[],i.overlay_=new md({source:new uc({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(r=sh(),function(t,e){return r[ae.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),i.SEGMENT_WRITERS_={Point:i.writePointGeometry_.bind(i),LineString:i.writeLineStringGeometry_.bind(i),LinearRing:i.writeLineStringGeometry_.bind(i),Polygon:i.writePolygonGeometry_.bind(i),MultiPoint:i.writeMultiPointGeometry_.bind(i),MultiLineString:i.writeMultiLineStringGeometry_.bind(i),MultiPolygon:i.writeMultiPolygonGeometry_.bind(i),Circle:i.writeCircleGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i)},i.source_=null,e.source?(i.source_=e.source,n=new at(i.source_.getFeatures()),i.source_.addEventListener($h,i.handleSourceAdd_.bind(i)),i.source_.addEventListener(rc,i.handleSourceRemove_.bind(i))):n=e.features,!n)throw new Error("The modify interaction requires features or a source");return i.features_=n,i.features_.forEach(i.addFeature_.bind(i)),i.features_.addEventListener(l,i.handleFeatureAdd_.bind(i)),i.features_.addEventListener(h,i.handleFeatureRemove_.bind(i)),i.lastPointerEvent_=null,i}return x_(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var r=this.SEGMENT_WRITERS_[e.getType()];r&&r(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(N,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new C_(E_,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(N,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,r=[];e.forEach((function(e){t===e.feature&&r.push(e)}));for(var n=r.length-1;n>=0;--n){for(var i=r[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,geometry:e,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n=0;--g)this.insertVertex_.apply(this,i[g])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var r=this.dragSegments_[e][0],n=r.geometry;if(n.getType()===ae.CIRCLE){var i=n.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=i,o.segment[1]=i,a.segment[0]=i,a.segment[1]=i,this.rBush_.update(Lt(i),o);var s=n,u=sr();if(u){var l=t.map.getView().getProjection();s=dn(s=s.clone().transform(u,l)).transform(l,u)}this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(xt(r.segment),r)}return this.modified_&&(this.dispatchEvent(new C_(T_,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,r){var n=r||e.getCoordinateFromPixel(t),i=e.getView().getProjection(),a=hr(wt(cr(Lt(n,w_),i),e.getView().getResolution()*this.pixelTolerance_,w_),i),s=this.rBush_.getInExtent(a);if(s.length>0){s.sort((function(t,e){return P_(n,t,i)-P_(n,e,i)}));var u=s[0],l=u.segment,h=R_(n,u,i),c=e.getPixelFromCoordinate(h),p=ki(t,c);if(p<=this.pixelTolerance_){var f={};if(u.geometry.getType()===ae.CIRCLE&&1===u.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var d=e.getPixelFromCoordinate(l[0]),_=e.getPixelFromCoordinate(l[1]),g=Di(c,d),y=Di(c,_);p=Math.sqrt(Math.min(g,y)),this.snappedToVertex_=p<=this.pixelTolerance_,this.snappedToVertex_&&(h=g>y?l[1]:l[0]),this.createOrUpdateVertexFeature_(h);for(var v=1,m=s.length;v=0;--i)c=o((h=(r=p[i])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in f||(f[c]={}),0===r[1]?(f[c].right=h,f[c].index=h.index):1==r[1]&&(f[c].left=h,f[c].index=h.index+1);for(c in f){switch(l=f[c].right,s=f[c].left,(u=(a=f[c].index)-1)<0&&(u=0),t=e=(n=(h=void 0!==s?s:l).geometry).getCoordinates(),d=!1,n.getType()){case ae.MULTI_LINE_STRING:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(a,1),d=!0);break;case ae.LINE_STRING:e.length>2&&(e.splice(a,1),d=!0);break;case ae.MULTI_POLYGON:t=t[h.depth[1]];case ae.POLYGON:(t=t[h.depth[0]]).length>4&&(a==t.length-1&&(a=0),t.splice(a,1),d=!0,0===a&&(t.pop(),t.push(t[0]),u=t.length-1))}if(d){this.setGeometryCoordinates_(n,e);var _=[];if(void 0!==s&&(this.rBush_.remove(s),_.push(s.segment[0])),void 0!==l&&(this.rBush_.remove(l),_.push(l.segment[1])),void 0!==s&&void 0!==l){var g={depth:h.depth,feature:h.feature,geometry:h.geometry,index:u,segment:_};this.rBush_.insert(xt(g.segment),g)}this.updateSegmentIndices_(n,a,h.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),p.length=0}}return d},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,r,n){this.rBush_.forEachInExtent(t.getExtent(),(function(i){i.geometry===t&&(void 0===r||void 0===i.depth||b(i.depth,r))&&i.index>e&&(i.index+=n)}))},e}(ca),I_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),L_="select",F_=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.selected=r,o.deselected=n,o.mapBrowserEvent=i,o}return I_(e,t),e}(F),M_={};function A_(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),r=this.removeCondition_(t),n=this.toggleCondition_(t),i=!e&&!r&&!n,o=t.map,a=this.getFeatures(),s=[],u=[];if(i){f(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return u.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var l=a.getLength()-1;l>=0;--l){var h=a.item(l),c=u.indexOf(h);c>-1?u.splice(c,1):(a.remove(h),s.push(h))}0!==u.length&&a.extend(u)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||w(a.getArray(),t)?(r||n)&&w(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(u.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var p=s.length-1;p>=0;--p)a.remove(s[p]);a.extend(u)}return(u.length>0||s.length>0)&&this.dispatchEvent(new F_(L_,u,s,t)),!0}var N_=function(t){function e(e){var r,n,i=t.call(this,{handleEvent:A_})||this,o=e||{};if(i.boundAddFeature_=i.addFeature_.bind(i),i.boundRemoveFeature_=i.removeFeature_.bind(i),i.condition_=o.condition?o.condition:na,i.addCondition_=o.addCondition?o.addCondition:ra,i.removeCondition_=o.removeCondition?o.removeCondition:ra,i.toggleCondition_=o.toggleCondition?o.toggleCondition:oa,i.multi_=!!o.multi&&o.multi,i.filter_=o.filter?o.filter:R,i.hitTolerance_=o.hitTolerance?o.hitTolerance:0,i.style_=void 0!==o.style?o.style:(T((r=sh())[ae.POLYGON],r[ae.LINE_STRING]),T(r[ae.GEOMETRY_COLLECTION],r[ae.LINE_STRING]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),i.features_=o.features||new at,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return w(a,t)}}else n=R;return i.layerFilter_=n,i.featureLayerAssociation_={},i}return I_(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(l,this.boundAddFeature_),this.features_.addEventListener(h,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(l,this.boundAddFeature_),this.features_.removeEventListener(h,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=o(t);e in M_||(M_[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){var r=o(t),n=this.getMap().getInteractions().getArray().filter((function(r){return r instanceof e&&r.getStyle()&&-1!==r.getFeatures().getArray().indexOf(t)}));n.length>0?t.setStyle(n[n.length-1].getStyle()):(t.setStyle(M_[r]),delete M_[r])},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e}(Zo),G_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function j_(t){return t.feature?t.feature:t.element?t.element:void 0}var D_=[],k_=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=R),i.stopDown||(i.stopDown=O),(r=t.call(this,i)||this).source_=n.source?n.source:null,r.vertex_=void 0===n.vertex||n.vertex,r.edge_=void 0===n.edge||n.edge,r.features_=n.features?n.features:null,r.featuresListenerKeys_=[],r.featureChangeListenerKeys_={},r.indexedFeaturesExtents_={},r.pendingFeatures_={},r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.rBush_=new oc,r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r)},r}return G_(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,n=o(t),i=t.getGeometry();if(i){var a=this.SEGMENT_WRITERS_[i.getType()];a&&(this.indexedFeaturesExtents_[n]=i.getExtent([1/0,1/0,-1/0,-1/0]),a(t,i))}r&&(this.featureChangeListenerKeys_[n]=g(t,N,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var r=this.snapTo(e.pixel,e.coordinate,e.map);return r.snapped&&(e.coordinate=r.vertex.slice(0,2),e.pixel=r.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=j_(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=j_(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=o(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=d(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var r=void 0===e||e,n=o(t),i=this.indexedFeaturesExtents_[n];if(i){var a=this.rBush_,s=[];a.forEachInExtent(i,(function(e){t===e.feature&&s.push(e)}));for(var u=s.length-1;u>=0;--u)a.remove(s[u])}r&&(v(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(v),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(g(this.features_,l,this.handleFeatureAdd_,this),g(this.features_,h,this.handleFeatureRemove_,this)):this.source_&&n.push(g(this.source_,$h,this.handleFeatureAdd_,this),g(this.source_,rc,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=xt([r.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),r.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(i=i.filter((function(t){return t.feature.getGeometry().getType()!==ae.CIRCLE})));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};for(var u,l=r.getView().getProjection(),h=lr(e,l),c=1/0,p=0;pm?_[1]:_[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var x=u.feature.getGeometry().getType()===ae.CIRCLE;if(x){var w=u.feature.getGeometry(),S=sr();S&&(w=w.clone().transform(S,l)),a=ur(function(t,e){var r=e.getRadius(),n=e.getCenter(),i=n[0],o=n[1],a=t[0]-i,s=t[1]-o;0===a&&0===s&&(a=1);var u=Math.sqrt(a*a+s*s);return[i+r*a/u,o+r*s/u]}(h,w),l)}else D_[0]=lr(_[0],l),D_[1]=lr(_[1],l),a=ur(Fi(h,D_),l);if(ki(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!x)){g=r.getPixelFromCoordinate(_[0]),y=r.getPixelFromCoordinate(_[1]),v=Di(s,g),m=Di(s,y);Math.sqrt(Math.min(v,m))<=this.pixelTolerance_&&(a=v>m?_[1]:_[0],s=r.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var r=this.getMap().getView().getProjection(),n=e,i=sr();i&&(n=n.clone().transform(i,r));var o=dn(n);i&&o.transform(r,i);for(var a=o.getCoordinates()[0],s=0,u=a.length-1;s=0;r--){var l=o[r][0];if(Ct(new Wr(l).getExtent(),new Wr(s).getExtent())){o[r].push(s),u=!0;break}}u||o.push([s.reverse()])}return o}(o.rings,a);1===s.length?(i=ae.POLYGON,t=Object.assign({},t,((r={}).rings=s[0],r))):(i=ae.MULTI_POLYGON,t=Object.assign({},t,((n={}).rings=s,n)))}return H_((0,rg[i])(t),!1,e)}function og(t){var e=re;return!0===t.hasZ&&!0===t.hasM?e=oe:!0===t.hasZ?e=ne:!0===t.hasM&&(e=ie),e}function ag(t){var e=t.getLayout();return{hasZ:e===ne||e===oe,hasM:e===ie||e===oe}}function sg(t,e){return(0,ng[t.getType()])(H_(t,!0,e),e)}ng[ae.POINT]=function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();i===ne?r={x:n[0],y:n[1],z:n[2]}:i===ie?r={x:n[0],y:n[1],m:n[2]}:i===oe?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===re?r={x:n[0],y:n[1]}:st(!1,34);return r},ng[ae.LINE_STRING]=function(t,e){var r=ag(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},ng[ae.POLYGON]=function(t,e){var r=ag(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},ng[ae.MULTI_POINT]=function(t,e){var r=ag(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},ng[ae.MULTI_LINE_STRING]=function(t,e){var r=ag(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},ng[ae.MULTI_POLYGON]=function(t,e){for(var r=ag(t),n=t.getCoordinates(!1),i=[],o=0;o=0;a--)i.push(n[o][a]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}};var ug=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return eg(e,t),e.prototype.readFeatureFromObject=function(t,e){var r=t,n=ig(r.geometry,e),i=new lt;return this.geometryName_&&i.setGeometryName(this.geometryName_),i.setGeometry(n),e&&e.idField&&r.attributes[e.idField]&&i.setId(r.attributes[e.idField]),r.attributes&&i.setProperties(r.attributes,!0),i},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){var n=[],i=t.features;r.idField=t.objectIdFieldName;for(var o=0,a=i.length;o0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=Zu(t);return this.readFeaturesFromDocument(r,e)}return Wu(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&T(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=Zu(t);return this.readGeometryFromDocument(r,e)}return Wu(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Zu(t);return this.readProjectionFromDocument(e)}return Wu(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(q_),cg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pg="http://www.opengis.net/gml",fg=/^[\s\xa0]*$/,dg=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:qu(r.readFeaturesInternal),featureMembers:Hu(r.readFeaturesInternal)},r}return cg(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=al([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r){var i=e[0],o=i.featureType,a=i.featureNS;if(!o&&t.childNodes){o=[],a={};for(var s=0,u=t.childNodes.length;s0){i[s]={_content_:i[s]};for(var l=0;l0:c===ae.POINT||c===ae.MULTI_POINT}}s&&(u=o.get("name"),(s=s&&!!u)&&u.search(/&[^&]+;/)>-1&&(lv||(lv=document.createElement("textarea")),lv.innerHTML=u,u=lv.value));var p=r;if(t?p=t:e&&(p=function t(e,r,n){return Array.isArray(e)?e:"string"==typeof e?(!(e in n)&&"#"+e in n&&(e="#"+e),t(n[e],r,n)):r}(e,r,n)),s){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getImageSize();if(null===o&&(o=My),2==o.length){var a=i.getScale();r[0]=a*o[0]/2,r[1]=-a*o[1]/2,n="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||sv.getFont()),s.setScale(s.getScale()||sv.getScale()),s.setFill(s.getFill()||sv.getFill()),s.setStroke(s.getStroke()||ov)):s=sv.clone();return s.setText(e),s.setOffsetX(r[0]),s.setOffsetY(r[1]),s.setTextAlign(n),new lh({image:i,text:s})}(p[0],u);return l.length>0?(f.setGeometry(new K_(l)),[f,new lh({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(r.Style,r.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(s)}return delete r.Style,n.setProperties(r,!0),n}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=kv.call(this,t,e);if(n){var i=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=yv.call(this,t,e);if(n){var i,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){if(!w(Ky,t.namespaceURI))return null;var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){if(!w(Ky,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&T(r,a)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Zu(t);return this.readNameFromDocument(e)}return Wu(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(w(Ky,e.namespaceURI)&&"name"==e.localName)return Eg(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(w(Ky,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=Zu(t);T(e,this.readNetworkLinksFromDocument(r))}else Wu(t)?T(e,this.readNetworkLinksFromDocument(t)):T(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&T(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(w(Ky,r.namespaceURI)&&"NetworkLink"==r.localName){var n=al({},Jy,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!w(Ky,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||T(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=Zu(t);T(e,this.readRegionFromDocument(r))}else Wu(t)?T(e,this.readRegionFromDocument(t)):T(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&T(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(w(Ky,r.namespaceURI)&&"Region"==r.localName){var n=al({},$y,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!w(Ky,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||T(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Vu(Ky[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",Zy[0]),r.setAttributeNS(n,"xmlns:xsi",Yu),r.setAttributeNS(Yu,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=tv[r.namespaceURI],s=nl(o,a);return ul(i,ev,rl,s,[e],a,this),r},e}(hg);function pv(t){var e=Xu(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function fv(t){for(var e,r=Xu(t,!1),n=[],i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=i.exec(r);){var o=parseFloat(e[1]),a=parseFloat(e[2]),s=e[3]?parseFloat(e[3]):0;n.push(o,a,s),r=r.substr(e[0].length)}if(""===r)return n}function dv(t){var e=Xu(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function _v(t){return mg(t)}var gv=il(Ky,{Pair:function(t,e){var r=al({},Xv,t,e,this);if(!r)return;var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}});function yv(t,e){return al(void 0,gv,t,e,this)}var vv=il(Ky,{Icon:Qu((function(t,e){var r=al({},Pv,t,e);return r||null})),color:Qu(pv),heading:Qu(mg),hotSpot:Qu((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?Jl:$l:"insetPixels"!==n?Ql:th,{x:parseFloat(t.getAttribute("x")),xunits:qy[r],y:parseFloat(t.getAttribute("y")),yunits:qy[n],origin:e}})),scale:Qu(_v)});var mv=il(Ky,{color:Qu(pv),scale:Qu(_v)});var xv=il(Ky,{color:Qu(pv),width:Qu(mg)});var wv=il(Ky,{color:Qu(pv),fill:Qu(gg),outline:Qu(gg)});var Sv=il(Ky,{coordinates:Hu(fv)});function Ev(t,e){return al(null,Sv,t,e)}var Tv=il(Zy,{Track:qu(bv)});var Cv=il(Ky,{when:function(t,e){var r=e[e.length-1].whens,n=Xu(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},il(Zy,{coord:function(t,e){var r=e[e.length-1].flatCoordinates,n=Xu(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),a=parseFloat(i[2]),s=parseFloat(i[3]);r.push(o,a,s,0)}else r.push(0,0,0,0)}}));function bv(t,e){var r=al({flatCoordinates:[],whens:[]},Cv,t,e);if(r){for(var n=r.flatCoordinates,i=r.whens,o=0,a=Math.min(n.length,i.length);o0,h=u.href;h?n=h:l&&(n=Ay);var c,p=Jl,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===Ay?(i=Iy,o=Ly,a=Fy):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(i=[.5,0],o=Bl,a=Bl);var d,_=u.x,g=u.y;void 0!==_&&void 0!==g&&(c=[_,g]);var y,v=u.w,m=u.h;void 0!==v&&void 0!==m&&(d=[v,m]);var x=r.heading;void 0!==x&&(y=_e(x));var w=r.scale,S=r.color;if(l){n==Ay&&(d=My,void 0===w&&(w=Ny));var E=new rh({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:Jl,rotation:y,scale:w,size:d,src:n,color:S});s.imageStyle=E}else s.imageStyle=nv}},LabelStyle:function(t,e){var r=al({},mv,t,e);if(r){var n=e[e.length-1],i=new ph({fill:new zl({color:"color"in r?r.color:Oy}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=al({},xv,t,e);if(r){var n=e[e.length-1],i=new nh({color:"color"in r?r.color:Oy,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=al({},wv,t,e);if(r){var n=e[e.length-1],i=new zl({color:"color"in r?r.color:Oy});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function kv(t,e){var r=al({},Dv,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:rv,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=nv&&(n=r.imageStyle):n=iv;var a="textStyle"in r?r.textStyle:sv,s="strokeStyle"in r?r.strokeStyle:av,u=r.outline;return void 0===u||u?[new lh({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]:[new lh({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===ae.GEOMETRY_COLLECTION?new K_(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==ae.POLYGON&&e!==ae.MULTI_POLYGON}))):r!==ae.POLYGON&&r!==ae.MULTI_POLYGON?e:void 0},fill:i,image:n,stroke:s,text:a,zIndex:void 0}),new lh({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===ae.GEOMETRY_COLLECTION?new K_(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===ae.POLYGON||e===ae.MULTI_POLYGON}))):r===ae.POLYGON||r===ae.MULTI_POLYGON?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function Uv(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),u=new Array(e.length);r=!1,n=!1,i=!1;for(var l=0;l0){var y=nl(i,a);ul(n,wm,Em,[{names:a,values:y}],r)}var v=r[0],m=e.getGeometry();m&&(m=H_(m,!0,v)),ul(n,wm,pm,[m],r)}var Cm=il(Ky,["extrude","tessellate","altitudeMode","coordinates"]),bm=il(Ky,{extrude:$u(Tg),tessellate:$u(Tg),altitudeMode:$u(Pg),coordinates:$u((function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==re||o==ie?n=2:o==ne||o==oe?n=3:st(!1,34);var s=e.length,u="";if(s>0){u+=e[0];for(var l=1;l>3)?r.readString():2===t?r.readFloat():3===t?r.readDouble():4===t?r.readVarint64():5===t?r.readVarint():6===t?r.readSVarint():7===t?r.readBoolean():null;e.values.push(n)}}function Wm(t,e,r){if(1==t)e.id=r.readVarint();else if(2==t)for(var n=r.readVarint()+r.pos;r.pos>3}a--,1===o||2===o?(s+=t.readSVarint(),u+=t.readSVarint(),1===o&&l>h&&(n.push(l),h=l),r.push(s,u),l+=2):7===o?l>h&&(r.push(r[h],r[h+1]),l+=2):st(!1,59)}l>h&&(n.push(l),h=l)},e.prototype.createFeature_=function(t,e,r){var n,i=e.type;if(0===i)return null;var o,a=e.properties;this.idProperty_?(o=a[this.idProperty_],delete a[this.idProperty_]):o=e.id,a[this.layerName_]=e.layer.name;var s=[],u=[];this.readRawGeometry_(t,e,s,u);var l=function(t,e){var r;1===t?r=1===e?ae.POINT:ae.MULTI_POINT:2===t?r=1===e?ae.LINE_STRING:ae.MULTI_LINE_STRING:3===t&&(r=ae.POLYGON);return r}(i,u.length);if(this.featureClass_===Bm)(n=new this.featureClass_(l,s,u,a,o)).transform(r.dataProjection,r.featureProjection);else{var h=void 0;if(l==ae.POLYGON){for(var c=[],p=0,f=0,d=0,_=u.length;d<_;++d){var g=u[d];on(s,p,g,2)||(c.push(u.slice(f,d)),f=d),p=g}h=c.length>1?new r_(s,re,c):new cn(s,re,u)}else h=l===ae.POINT?new Kr(s,re):l===ae.LINE_STRING?new Ed(s,re):l===ae.POLYGON?new cn(s,re,u):l===ae.MULTI_POINT?new $d(s,re):l===ae.MULTI_LINE_STRING?new Jd(s,re,u):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var y=H_(h,!1,r);n.setGeometry(y),n.setId(o),n.setProperties(a,!0)}return n},e.prototype.getType=function(){return yu},e.prototype.readFeatures=function(t,e){var r=this.layers_,n=this.adaptOptions(e),i=We(n.dataProjection);i.setWorldExtent(n.extent),n.dataProjection=i;var o=new km.a(t),a=o.readFields(Vm,{}),s=[];for(var u in a)if(!r||-1!=r.indexOf(u)){var l=a[u],h=l?[0,0,l.extent,l.extent]:null;i.setExtent(h);for(var c=0,p=l.length;c>1):i>>1}return e}(t),i=0,o=n.length;i=32;)e=63+(32|31&t),r+=String.fromCharCode(e),t>>=5;return e=t+63,r+=String.fromCharCode(e)}var hx=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.dataProjection=We("EPSG:4326"),r.factor_=n.factor?n.factor:1e5,r.geometryLayout_=n.geometryLayout?n.geometryLayout:re,r}return ix(e,t),e.prototype.readFeatureFromText=function(t,e){var r=this.readGeometryFromText(t,e);return new lt(r)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var r=Cr(this.geometryLayout_),n=ax(t,r,this.factor_);nx(n,0,n.length,r,n);var i=jr(n,0,n.length,r);return H_(new Ed(i,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var r=t.getGeometry();return r?this.writeGeometryText(r,e):(st(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var r=(t=H_(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return nx(r,0,r.length,n,r),ox(r,n,this.factor_)},e}(Gy),cx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),px=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.layerName_=n.layerName,r.layers_=n.layers?n.layers:null,r.dataProjection=We(n.dataProjection?n.dataProjection:"EPSG:4326"),r}return cx(e,t),e.prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var r=t,n=void 0,i=null,o=null;r.transform&&(i=(n=r.transform).scale,o=n.translate);var a=r.arcs;n&&function(t,e,r){for(var n=0,i=t.length;n0&&i.pop(),n=r>=0?e[r]:e[~r].slice().reverse(),i.push.apply(i,n);for(var s=0,u=i.length;s=2,57),n}return wx(e,t),e}(xx),Ex=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tx=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return Ex(e,t),e}(Sx),Cx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bx=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return Cx(e,t),e}(xx),Px=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Rx=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.geometryName=r||"the_geom",o.geometry=n,o.srsName=i,o}return Px(e,t),e}(xx),Ox=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ix=function(t){function e(e,r,n){return t.call(this,"Contains",e,r,n)||this}return Ox(e,t),e}(Rx),Lx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fx=function(t){function e(e,r){var n=t.call(this,e)||this;return n.propertyName=r,n}return Lx(e,t),e}(xx),Mx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ax=function(t){function e(e,r,n){var i=t.call(this,"During",e)||this;return i.begin=r,i.end=n,i}return Mx(e,t),e}(Fx),Nx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gx=function(t){function e(e,r,n,i){var o=t.call(this,e,r)||this;return o.expression=n,o.matchCase=i,o}return Nx(e,t),e}(Fx),jx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Dx=function(t){function e(e,r,n){return t.call(this,"PropertyIsEqualTo",e,r,n)||this}return jx(e,t),e}(Gx),kx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ux=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThan",e,r)||this}return kx(e,t),e}(Gx),zx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bx=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThanOrEqualTo",e,r)||this}return zx(e,t),e}(Gx),Yx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vx=function(t){function e(e,r,n){return t.call(this,"Intersects",e,r,n)||this}return Yx(e,t),e}(Rx),Xx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wx=function(t){function e(e,r,n){var i=t.call(this,"PropertyIsBetween",e)||this;return i.lowerBoundary=r,i.upperBoundary=n,i}return Xx(e,t),e}(Fx),Zx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kx=function(t){function e(e,r,n,i,o,a){var s=t.call(this,"PropertyIsLike",e)||this;return s.pattern=r,s.wildCard=void 0!==n?n:"*",s.singleChar=void 0!==i?i:".",s.escapeChar=void 0!==o?o:"!",s.matchCase=a,s}return Zx(e,t),e}(Fx),qx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hx=function(t){function e(e){return t.call(this,"PropertyIsNull",e)||this}return qx(e,t),e}(Fx),Jx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qx=function(t){function e(e,r){return t.call(this,"PropertyIsLessThan",e,r)||this}return Jx(e,t),e}(Gx),$x=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tw=function(t){function e(e,r){return t.call(this,"PropertyIsLessThanOrEqualTo",e,r)||this}return $x(e,t),e}(Gx),ew=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rw=function(t){function e(e){var r=t.call(this,"Not")||this;return r.condition=e,r}return ew(e,t),e}(xx),nw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),iw=function(t){function e(e,r,n){return t.call(this,"PropertyIsNotEqualTo",e,r,n)||this}return nw(e,t),e}(Gx),ow=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),aw=function(t){function e(e){return t.call(this,"Or",Array.prototype.slice.call(arguments))||this}return ow(e,t),e}(Sx),sw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),uw=function(t){function e(e,r,n){return t.call(this,"Within",e,r,n)||this}return sw(e,t),e}(Rx);function lw(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(Tx,e))}function hw(t,e,r){return new bx(t,e,r)}var cw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pw={"http://www.opengis.net/gml":{boundedBy:Qu(_g.prototype.readGeometryElement,"bounds")}},fw={"http://www.opengis.net/wfs":{totalInserted:Qu(wg),totalUpdated:Qu(wg),totalDeleted:Qu(wg)}},dw={"http://www.opengis.net/wfs":{TransactionSummary:Qu((function(t,e){return al({},fw,t,e)}),"transactionSummary"),InsertResults:Qu((function(t,e){return al([],Ew,t,e)}),"insertIds")}},_w={"http://www.opengis.net/wfs":{PropertyName:$u(Pg)}},gw={"http://www.opengis.net/wfs":{Insert:$u((function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a=n.gmlVersion,s=Vu(o,i);t.appendChild(s),2===a?jg.prototype.writeFeatureElement(s,e,r):Lg.prototype.writeFeatureElement(s,e,r)})),Update:$u((function(t,e,r){var n=r[r.length-1];st(void 0!==e.getId(),27);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=Cw(o,i),u=e.getGeometryName();t.setAttribute("typeName",s),t.setAttributeNS(yw,"xmlns:"+o,a);var l=e.getId();if(void 0!==l){for(var h=e.getKeys(),c=[],p=0,f=h.length;p="a"&&t<="z"||t>="A"&&t<="Z"},t.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},t.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},t.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},t.prototype.nextToken=function(){var t,e=this.nextChar_(),r=this.index_,n=e;if("("==e)t=Dw;else if(","==e)t=zw;else if(")"==e)t=kw;else if(this.isNumeric_(e)||"-"==e)t=Uw,n=this.readNumber_();else if(this.isAlpha_(e))t=jw,n=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=Bw}return{position:r,value:n,type:t}},t.prototype.readNumber_=function(){var t,e=this.index_,r=!1,n=!1;do{"."==t?r=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,r)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},t.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()},t}(),Ww=function(){function t(t){this.lexer_=t,this.token_,this.layout_=re}return t.prototype.consume_=function(){this.token_=this.lexer_.nextToken()},t.prototype.isTokenType=function(t){return this.token_.type==t},t.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},t.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},t.prototype.parseGeometryLayout_=function(){var t=re,e=this.token_;if(this.isTokenType(jw)){var r=e.value;"Z"===r?t=ne:"M"===r?t=ie:"ZM"===r&&(t=oe),t!==re&&this.consume_()}return t},t.prototype.parseGeometryCollectionText_=function(){if(this.match(Dw)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(zw));if(this.match(kw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePointText_=function(){if(this.match(Dw)){var t=this.parsePoint_();if(this.match(kw))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())},t.prototype.parseLineStringText_=function(){if(this.match(Dw)){var t=this.parsePointList_();if(this.match(kw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePolygonText_=function(){if(this.match(Dw)){var t=this.parseLineStringTextList_();if(this.match(kw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPointText_=function(){if(this.match(Dw)){var t=void 0;if(t=this.token_.type==Dw?this.parsePointTextList_():this.parsePointList_(),this.match(kw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiLineStringText_=function(){if(this.match(Dw)){var t=this.parseLineStringTextList_();if(this.match(kw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPolygonText_=function(){if(this.match(Dw)){var t=this.parsePolygonTextList_();if(this.match(kw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePoint_=function(){for(var t=[],e=this.layout_.length,r=0;r0&&(e+=" "+n)}return 0===r.length?e+" EMPTY":e+"("+r+")"}var $w=Zw;function tS(t){return t.getAttributeNS("http://www.w3.org/1999/xlink","href")}var eS=function(){function t(){}return t.prototype.read=function(t){if(t){if("string"==typeof t){var e=Zu(t);return this.readFromDocument(e)}return Wu(t)?this.readFromDocument(t):this.readFromNode(t)}return null},t.prototype.readFromDocument=function(t){},t.prototype.readFromNode=function(t){},t}(),rS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nS=[null,"http://www.opengis.net/wms"],iS=il(nS,{Service:Qu((function(t,e){return al({},sS,t,e)})),Capability:Qu((function(t,e){return al({},oS,t,e)}))}),oS=il(nS,{Request:Qu((function(t,e){return al({},_S,t,e)})),Exception:Qu((function(t,e){return al([],cS,t,e)})),Layer:Qu((function(t,e){return al({},pS,t,e)}))}),aS=function(t){function e(){var e=t.call(this)||this;return e.version=void 0,e}return rS(e,t),e.prototype.readFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null},e.prototype.readFromNode=function(t){this.version=t.getAttribute("version").trim();var e=al({version:this.version},iS,t,[]);return e||null},e}(eS),sS=il(nS,{Name:Qu(Eg),Title:Qu(Eg),Abstract:Qu(Eg),KeywordList:Qu(CS),OnlineResource:Qu(tS),ContactInformation:Qu((function(t,e){return al({},uS,t,e)})),Fees:Qu(Eg),AccessConstraints:Qu(Eg),LayerLimit:Qu(wg),MaxWidth:Qu(wg),MaxHeight:Qu(wg)}),uS=il(nS,{ContactPersonPrimary:Qu((function(t,e){return al({},lS,t,e)})),ContactPosition:Qu(Eg),ContactAddress:Qu((function(t,e){return al({},hS,t,e)})),ContactVoiceTelephone:Qu(Eg),ContactFacsimileTelephone:Qu(Eg),ContactElectronicMailAddress:Qu(Eg)}),lS=il(nS,{ContactPerson:Qu(Eg),ContactOrganization:Qu(Eg)}),hS=il(nS,{AddressType:Qu(Eg),Address:Qu(Eg),City:Qu(Eg),StateOrProvince:Qu(Eg),PostCode:Qu(Eg),Country:Qu(Eg)}),cS=il(nS,{Format:qu(Eg)}),pS=il(nS,{Name:Qu(Eg),Title:Qu(Eg),Abstract:Qu(Eg),KeywordList:Qu(CS),CRS:Ju(Eg),EX_GeographicBoundingBox:Qu((function(t,e){var r=al({},dS,t,e);if(!r)return;var n=r.westBoundLongitude,i=r.southBoundLatitude,o=r.eastBoundLongitude,a=r.northBoundLatitude;if(void 0===n||void 0===i||void 0===o||void 0===a)return;return[n,i,o,a]})),BoundingBox:Ju((function(t,e){var r=[xg(t.getAttribute("minx")),xg(t.getAttribute("miny")),xg(t.getAttribute("maxx")),xg(t.getAttribute("maxy"))],n=[xg(t.getAttribute("resx")),xg(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:r,res:n}})),Dimension:Ju((function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:yg(t.getAttribute("multipleValues")),nearestValue:yg(t.getAttribute("nearestValue")),current:yg(t.getAttribute("current")),values:Eg(t)}})),Attribution:Qu((function(t,e){return al({},fS,t,e)})),AuthorityURL:Ju((function(t,e){var r=SS(t,e);if(r)return r.name=t.getAttribute("name"),r;return})),Identifier:Ju(Eg),MetadataURL:Ju((function(t,e){var r=SS(t,e);if(r)return r.type=t.getAttribute("type"),r;return})),DataURL:Ju(SS),FeatureListURL:Ju(SS),Style:Ju((function(t,e){return al({},mS,t,e)})),MinScaleDenominator:Qu(mg),MaxScaleDenominator:Qu(mg),Layer:Ju((function(t,e){var r=e[e.length-1],n=al({},pS,t,e);if(!n)return;var i=yg(t.getAttribute("queryable"));void 0===i&&(i=r.queryable);n.queryable=void 0!==i&&i;var o=Sg(t.getAttribute("cascaded"));void 0===o&&(o=r.cascaded);n.cascaded=o;var a=yg(t.getAttribute("opaque"));void 0===a&&(a=r.opaque);n.opaque=void 0!==a&&a;var s=yg(t.getAttribute("noSubsets"));void 0===s&&(s=r.noSubsets);n.noSubsets=void 0!==s&&s;var u=xg(t.getAttribute("fixedWidth"));u||(u=r.fixedWidth);n.fixedWidth=u;var l=xg(t.getAttribute("fixedHeight"));l||(l=r.fixedHeight);n.fixedHeight=l,["Style","CRS","AuthorityURL"].forEach((function(t){if(t in r){var e=n[t]||[];n[t]=e.concat(r[t])}}));return["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach((function(t){if(!(t in n)){var e=r[t];n[t]=e}})),n}))}),fS=il(nS,{Title:Qu(Eg),OnlineResource:Qu(tS),LogoURL:Qu(TS)}),dS=il(nS,{westBoundLongitude:Qu(mg),eastBoundLongitude:Qu(mg),southBoundLatitude:Qu(mg),northBoundLatitude:Qu(mg)}),_S=il(nS,{GetCapabilities:Qu(ES),GetMap:Qu(ES),GetFeatureInfo:Qu(ES)}),gS=il(nS,{Format:Ju(Eg),DCPType:Ju((function(t,e){return al({},yS,t,e)}))}),yS=il(nS,{HTTP:Qu((function(t,e){return al({},vS,t,e)}))}),vS=il(nS,{Get:Qu(SS),Post:Qu(SS)}),mS=il(nS,{Name:Qu(Eg),Title:Qu(Eg),Abstract:Qu(Eg),LegendURL:Ju(TS),StyleSheetURL:Qu(SS),StyleURL:Qu(SS)}),xS=il(nS,{Format:Qu(Eg),OnlineResource:Qu(tS)}),wS=il(nS,{Keyword:qu(Eg)});function SS(t,e){return al({},xS,t,e)}function ES(t,e){return al({},gS,t,e)}function TS(t,e){var r=SS(t,e);if(r){var n=[Sg(t.getAttribute("width")),Sg(t.getAttribute("height"))];return r.size=n,r}}function CS(t,e){return al([],wS,t,e)}var bS=aS,PS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),RS=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureNS_="http://mapserver.gis.umn.edu/mapserver",r.gmlFormat_=new jg,r.layers_=n.layers?n.layers:null,r}return PS(e,t),e.prototype.getLayers=function(){return this.layers_},e.prototype.setLayers=function(t){this.layers_=t},e.prototype.readFeatures_=function(t,e){t.setAttribute("namespaceURI",this.featureNS_);var r=t.localName,n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==r)for(var i=0,o=t.childNodes.length;i.75*h||l>.75*c?this.resetExtent_():Ct(o,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getSize(),n=t.getView().calculateExtentInternal(r),i=e.getView(),o=Math.log(7.5)/Math.LN2;$t(n,1/(.1*Math.pow(2,o/2))),i.fitInternal(fn(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getView();e.getView().setCenterInternal(r.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView(),i=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,s=this.boxOverlay_.getElement(),u=n.getCenterInternal(),l=n.getResolution(),h=i.getResolution(),c=r[0]*l/h,p=r[1]*l/h;if(a.setPosition(u),s){s.style.width=c+"px",s.style.height=p+"px";var f="rotate("+o+"rad)";s.style.transform=f}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?to(this.collapseLabel_,this.label_):to(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),y(t,Jn,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e}(Ro),CE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bE="degrees",PE="imperial",RE="nautical",OE="metric",IE="us",LE=[1,2,5];function FE(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}var ME=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(r=t.call(this,{element:document.createElement("div"),render:n.render||FE,target:n.target})||this).innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" ol-unselectable",r.element.appendChild(r.innerElement_),r.viewState_=null,r.minWidth_=void 0!==n.minWidth?n.minWidth:64,r.renderedVisible_=!1,r.renderedWidth_=void 0,r.renderedHTML_="",r.addEventListener(et("units"),r.handleUnitsChanged_),r.setUnits(n.units||OE),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r}return CE(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,r=t.projection,n=this.getUnits(),i=n==bE?Te.DEGREES:Te.METERS,o=Ze(r,t.resolution,e,i),a=this.minWidth_*o,s="";if(n==bE){var u=Ee[Te.DEGREES];(a*=u)=this.minWidth_)break;++f}p=this.scaleBar_?this.createScaleBar(h,l,s):l.toFixed(c<0?-c:0)+" "+s,this.renderedHTML_!=p&&(this.innerElement_.innerHTML=p,this.renderedHTML_=p),this.renderedWidth_!=h&&(this.innerElement_.style.width=h+"px",this.renderedWidth_=h),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,r){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s
'+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,r):"")+""),s===this.scaleBarSteps_-1&&i.push(this.createStepText(s+1,t,!0,e,r)),a="#ffffff"===a?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+n+"
":"")+i.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,r,n,i){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return'
'+o+"
"},e.prototype.getScaleForResolution=function(){var t=this.getMap().getView().getResolution(),e=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*e*39.37*(25.4/.28)},e}(Ro),AE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),NE=0,GE=1;function jE(t){if(t.frameState){this.sliderInitialized_||this.initSlider_();var e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}var DE=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||jE})||this).dragListenerKeys_=[],r.currentResolution_=void 0,r.direction_=NE,r.dragging_,r.heightLimit_=0,r.widthLimit_=0,r.startX_,r.startY_,r.thumbSize_=null,r.sliderInitialized_=!1,r.duration_=void 0!==n.duration?n.duration:200;var i=void 0!==n.className?n.className:"ol-zoomslider",o=document.createElement("button");o.setAttribute("type","button"),o.className=i+"-thumb ol-unselectable";var a=r.element;return a.className=i+" ol-unselectable ol-control",a.appendChild(o),a.addEventListener(Wn,r.handleDraggerStart_.bind(r),!1),a.addEventListener(Xn,r.handleDraggerDrag_.bind(r),!1),a.addEventListener(Zn,r.handleDraggerEnd_.bind(r),!1),a.addEventListener(D,r.handleContainerClick_.bind(r),!1),o.addEventListener(D,L,!1),r}return AE(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,r=t.offsetHeight,n=t.firstElementChild,i=getComputedStyle(n),o=n.offsetWidth+parseFloat(i.marginRight)+parseFloat(i.marginLeft),a=n.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom);this.thumbSize_=[o,a],e>r?(this.direction_=GE,this.widthLimit_=e-o):(this.direction_=NE,this.heightLimit_=r-a),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),r=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(r),i=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:i,duration:this.duration_,easing:Vi})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.target===this.element.firstElementChild){var e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){var r=this.handleDraggerDrag_,n=this.handleDraggerEnd_;this.dragListenerKeys_.push(g(document,Xn,r,this),g(document,Zn,n,this))}}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=t.clientX-this.startX_,r=t.clientY-this.startY_,n=this.getRelativePosition_(e,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}},e.prototype.handleDraggerEnd_=function(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0)},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),r=this.element.firstElementChild;this.direction_==GE?r.style.left=this.widthLimit_*e+"px":r.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return he(this.direction_===GE?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return he(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)},e}(Ro),kE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),UE=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).extent=n.extent?n.extent:null;var i=void 0!==n.className?n.className:"ol-zoom-extent",o=void 0!==n.label?n.label:"E",a=void 0!==n.tipLabel?n.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=a,s.appendChild("string"==typeof o?document.createTextNode(o):o),s.addEventListener(D,r.handleClick_.bind(r),!1);var u=i+" ol-unselectable ol-control",l=r.element;return l.className=u,l.appendChild(s),r}return kE(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(fn(e))},e}(Ro),zE={array:{},color:{},colorlike:{},control:{},coordinate:{},easing:{},events:{}};zE.events.condition={},zE.extent={},zE.featureloader={},zE.format={},zE.format.filter={},zE.geom={},zE.has={},zE.interaction={},zE.layer={},zE.loadingstrategy={},zE.proj={},zE.proj.Units={},zE.proj.proj4={},zE.render={},zE.render.canvas={},zE.renderer={},zE.renderer.canvas={},zE.renderer.webgl={},zE.size={},zE.source={},zE.sphere={},zE.style={},zE.style.IconImageCache={},zE.tilegrid={},zE.transform={},zE.util={},zE.webgl={},zE.xml={},zE.Collection=at,zE.Feature=lt,zE.Geolocation=Rn,zE.Kinetic=On,zE.Map=tu,zE.Object=rt,zE.Observable=H,zE.Observable.unByKey=function(t){if(Array.isArray(t))for(var e=0,r=t.length;e180)&&(r[0]=ge(n+180,360)-180),r},zE.proj.transform=er,zE.proj.transformExtent=rr,zE.render.VectorContext=ls,zE.render.canvas.labelCache=fs,zE.render.getRenderPixel=function(t,e){var r=e.slice(0);return gr(t.inversePixelTransform.slice(),r),r},zE.render.getVectorContext=Ws,zE.render.toContext=function(t,e){var r=t.canvas,n=e||{},i=n.pixelRatio||Dn,o=n.size;o&&(r.width=o[0]*i,r.height=o[1]*i,r.style.width=o[0]+"px",r.style.height=o[1]+"px");var a=[0,0,r.width,r.height],s=yr([1,0,0,1,0,0],i,i);return new Os(t,i,a,s,0)},zE.renderer.Composite=Qs,zE.renderer.canvas.ImageLayer=pp,zE.renderer.canvas.TileLayer=wp,zE.renderer.canvas.VectorImageLayer=hd,zE.renderer.canvas.VectorLayer=ud,zE.renderer.canvas.VectorTileLayer=yd,zE.renderer.webgl.PointsLayer=Tf,zE.size.toSize=To,zE.source.BingMaps=Kh,zE.source.CartoDB=Qh,zE.source.Cluster=hc,zE.source.IIIF=Pc,zE.source.Image=Gc,zE.source.ImageArcGISRest=kc,zE.source.ImageCanvas=Yc,zE.source.ImageMapGuide=Xc,zE.source.ImageStatic=Zc,zE.source.ImageWMS=tp,zE.source.OSM=np,zE.source.OSM.ATTRIBUTION=rp,zE.source.Raster=Ap,zE.source.Source=Ah,zE.source.Stamen=kp,zE.source.Tile=Dh,zE.source.TileArcGISRest=Bp,zE.source.TileDebug=Xp,zE.source.TileImage=Wh,zE.source.TileJSON=Zp,zE.source.TileWMS=Hp,zE.source.UTFGrid=$p,zE.source.Vector=uc,zE.source.VectorTile=sf,zE.source.WMTS=pf,zE.source.WMTS.optionsFromCapabilities=function(t,e){var r=C(t.Contents.Layer,(function(t,r,n){return t.Identifier==e.layer}));if(null===r)return null;var n,i=t.Contents.TileMatrixSet;(n=r.TileMatrixSetLink.length>1?P(r.TileMatrixSetLink,"projection"in e?function(t,r,n){var o=C(i,(function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,a=We(o.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||We(o),s=We(e.projection);return a&&s?Qe(a,s):o==e.projection}:function(t,r,n){return t.TileMatrixSet==e.matrixSet}):0)<0&&(n=0);var o=r.TileMatrixSetLink[n].TileMatrixSet,a=r.TileMatrixSetLink[n].TileMatrixSetLimits,s=r.Format[0];"format"in e&&(s=e.format),(n=P(r.Style,(function(t,r,n){return"style"in e?t.Title==e.style:t.isDefault})))<0&&(n=0);var u=r.Style[n].Identifier,l={};"Dimension"in r&&r.Dimension.forEach((function(t,e,r){var n=t.Identifier,i=t.Default;void 0===i&&(i=t.Value[0]),l[n]=i}));var h,c=C(t.Contents.TileMatrixSet,(function(t,e,r){return t.Identifier==o})),p=c.SupportedCRS;if(p&&(h=We(p.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||We(p)),"projection"in e){var f=We(e.projection);f&&(h&&!Qe(f,h)||(h=f))}var d=c.TileMatrix[0],_=28e-5*d.ScaleDenominator,g=h===We("EPSG:4326")?[d.TopLeftCorner[1],d.TopLeftCorner[0]]:d.TopLeftCorner,y=d.TileWidth*_,v=d.TileHeight*_,m=[g[0],g[1]-v*d.MatrixHeight,g[0]+y*d.MatrixWidth,g[1]];null===h.getExtent()&&h.setExtent(m);var x=Nl(c,m,a),S=[],E=e.requestEncoding;if(E=void 0!==E?E:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var T=t.OperationsMetadata.GetTile.DCP.HTTP.Get,b=0,R=T.length;b 0 ? "\\." : "$") + ")"; return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, "g"), "$&."); }; -Number.prototype.formatSignalReport = function () { +Number.prototype.formatSignalReport = function () +{ var val = this; var report = String(); @@ -101,12 +104,14 @@ Number.prototype.formatSignalReport = function () { return report; }; -String.prototype.formatCallsign = function () { +String.prototype.formatCallsign = function () +{ var re = new RegExp("0", "g"); return this.replace(re, "Ø"); }; -Number.prototype.toDHMS = function () { +Number.prototype.toDHMS = function () +{ var seconds = this; var days = Math.floor(seconds / (3600 * 24)); seconds -= days * 3600 * 24; @@ -124,7 +129,8 @@ Number.prototype.toDHMS = function () { return val; }; -Number.prototype.toDHM = function () { +Number.prototype.toDHM = function () +{ var seconds = this; var days = Math.floor(seconds / (3600 * 24)); seconds -= days * 3600 * 24; @@ -140,7 +146,8 @@ Number.prototype.toDHM = function () { return val; }; -Number.prototype.toYM = function () { +Number.prototype.toYM = function () +{ var months = this; var years = parseInt(Math.floor(months / 12)); months -= years * 12; @@ -151,7 +158,8 @@ Number.prototype.toYM = function () { return total == "" ? "any" : total; }; -Number.prototype.toHMS = function () { +Number.prototype.toHMS = function () +{ var seconds = this; var days = Math.floor(seconds / (3600 * 24)); seconds -= days * 3600 * 24; @@ -167,20 +175,25 @@ Number.prototype.toHMS = function () { return val; }; -String.prototype.toProperCase = function () { - return this.replace(/\w\S*/g, function (txt) { +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) { +Number.prototype.pad = function (size) +{ var s = String(this); - while (s.length < (size || 2)) { + while (s.length < (size || 2)) + { s = "0" + s; } return s; }; -String.prototype.replaceAll = function (str1, str2) { +String.prototype.replaceAll = function (str1, str2) +{ return this.split(str1).join(str2); }; diff --git a/package.nw/lib/roster.js b/package.nw/lib/roster.js index 5f59efef..1049b06c 100644 --- a/package.nw/lib/roster.js +++ b/package.nw/lib/roster.js @@ -47,13 +47,13 @@ var g_callsignDatabaseUSplus = {}; var g_developerMode = process.versions["nw-flavor"] == "sdk"; var g_modeColors = {}; -g_modeColors["FT4"] = "1111FF"; -g_modeColors["FT8"] = "11FF11"; -g_modeColors["JT4"] = "EE1111"; -g_modeColors["JT9"] = "7CFC00"; -g_modeColors["JT65"] = "E550E5"; -g_modeColors["QRA64"] = "FF00FF"; -g_modeColors["MSK144"] = "4949FF"; +g_modeColors.FT4 = "1111FF"; +g_modeColors.FT8 = "11FF11"; +g_modeColors.JT4 = "EE1111"; +g_modeColors.JT9 = "7CFC00"; +g_modeColors.JT65 = "E550E5"; +g_modeColors.QRA64 = "FF00FF"; +g_modeColors.MSK144 = "4949FF"; var g_defaultSettings = { callsign: "all", @@ -95,7 +95,7 @@ var g_defaultSettings = { huntCont: false, huntPX: false, huntQRZ: true, - huntOAMS: false, + huntOAMS: false }, columns: { Band: false, @@ -121,7 +121,7 @@ var g_defaultSettings = { Spot: false, Life: false, OAMS: true, - Age: true, + Age: true }, reference: 0, controls: true, @@ -129,24 +129,28 @@ var g_defaultSettings = { compact: false, settingProfiles: false, lastSortIndex: 6, - lastSortReverse: 1, + lastSortReverse: 1 }; -document.addEventListener("dragover", function (event) { +document.addEventListener("dragover", function (event) +{ event.preventDefault(); }); -document.addEventListener("drop", function (event) { +document.addEventListener("drop", function (event) +{ event.preventDefault(); }); window.addEventListener("message", receiveMessage, false); -if (typeof localStorage.blockedCQ == "undefined") { +if (typeof localStorage.blockedCQ == "undefined") +{ localStorage.blockedCQ = "{}"; } -if (typeof localStorage.awardTracker == "undefined") { +if (typeof localStorage.awardTracker == "undefined") +{ localStorage.awardTracker = "{}"; g_rosterSettings = {}; writeRosterSettings(); @@ -154,25 +158,30 @@ if (typeof localStorage.awardTracker == "undefined") { g_awardTracker = JSON.parse(localStorage.awardTracker); -if (typeof localStorage.blockedCalls != "undefined") { +if (typeof localStorage.blockedCalls != "undefined") +{ g_blockedCalls = JSON.parse(localStorage.blockedCalls); g_blockedCQ = JSON.parse(localStorage.blockedCQ); g_blockedDxcc = JSON.parse(localStorage.blockedDxcc); } -function storeBlocks() { +function storeBlocks() +{ localStorage.blockedCalls = JSON.stringify(g_blockedCalls); localStorage.blockedCQ = JSON.stringify(g_blockedCQ); localStorage.blockedDxcc = JSON.stringify(g_blockedDxcc); } -function storeAwardTracker() { +function storeAwardTracker() +{ localStorage.awardTracker = JSON.stringify(g_awardTracker); } -function loadSettings() { +function loadSettings() +{ var readSettings = {}; - if (typeof localStorage.rosterSettings != "undefined") { + if (typeof localStorage.rosterSettings != "undefined") + { readSettings = JSON.parse(localStorage.rosterSettings); } g_rosterSettings = deepmerge(g_defaultSettings, readSettings); @@ -182,45 +191,55 @@ function loadSettings() { writeRosterSettings(); } -function writeRosterSettings() { +function writeRosterSettings() +{ localStorage.rosterSettings = JSON.stringify(g_rosterSettings); } -function isKnownCallsignDXCC(dxcc) { +function isKnownCallsignDXCC(dxcc) +{ if (dxcc in g_callsignDatabaseDXCC) return true; return false; } -function isKnownCallsignUS(dxcc) { +function isKnownCallsignUS(dxcc) +{ if (dxcc in g_callsignDatabaseUS) return true; return false; } -function isKnownCallsignUSplus(dxcc) { +function isKnownCallsignUSplus(dxcc) +{ if (dxcc in g_callsignDatabaseUSplus) return true; return false; } -function timeNowSec() { +function timeNowSec() +{ return parseInt(Date.now() / 1000); } -function lockNewWindows() { - if (typeof nw != "undefined") { +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) { + win.on("new-win-policy", function (frame, url, policy) + { gui.Shell.openExternal(url); policy.ignore(); }); } } -function myCallCompare(a, b) { +function myCallCompare(a, b) +{ return a.DEcall.localeCompare(b.DEcall); } -function myGridCompare(a, b) { +function myGridCompare(a, b) +{ var gridA = a.grid ? a.grid : "0"; var gridB = b.grid ? b.grid : "0"; @@ -229,59 +248,69 @@ function myGridCompare(a, b) { return 0; } -function myDxccCompare(a, b) { +function myDxccCompare(a, b) +{ return window.opener.myDxccCompare(a, b); } -function myTimeCompare(a, b) { +function myTimeCompare(a, b) +{ if (a.age > b.age) return 1; if (a.age < b.age) return -1; return 0; } -function myLifeCompare(a, b) { +function myLifeCompare(a, b) +{ if (a.life > b.life) return 1; if (a.life < b.life) return -1; return 0; } -function mySpotCompare(a, b) { +function mySpotCompare(a, b) +{ if (a.spot.when > b.spot.when) return 1; if (a.spot.when < b.spot.when) return -1; return 0; } -function myDbCompare(a, b) { +function myDbCompare(a, b) +{ if (a.RSTsent > b.RSTsent) return 1; if (a.RSTsent < b.RSTsent) return -1; return 0; } -function myFreqCompare(a, b) { +function myFreqCompare(a, b) +{ if (a.delta > b.delta) return 1; if (a.delta < b.delta) return -1; return 0; } -function myDTCompare(a, b) { +function myDTCompare(a, b) +{ if (a.dt > b.dt) return 1; if (a.dt < b.dt) return -1; return 0; } -function myDistanceCompare(a, b) { +function myDistanceCompare(a, b) +{ if (a.distance > b.distance) return 1; if (a.distance < b.distance) return -1; return 0; } -function myHeadingCompare(a, b) { +function myHeadingCompare(a, b) +{ if (a.heading > b.heading) return 1; if (a.heading < b.heading) return -1; return 0; } -function myStateCompare(a, b) { +function myStateCompare(a, b) +{ if (a.state == null) return 1; if (b.state == null) return -1; if (a.state > b.state) return 1; @@ -289,11 +318,13 @@ function myStateCompare(a, b) { return 0; } -function myCQCompare(a, b) { +function myCQCompare(a, b) +{ return a.DXcall.localeCompare(b.DXcall); } -function myWPXCompare(a, b) { +function myWPXCompare(a, b) +{ if (a.px == null) return 1; if (b.px == null) return -1; if (a.px > b.px) return 1; @@ -301,7 +332,8 @@ function myWPXCompare(a, b) { return 0; } -function myCntyCompare(a, b) { +function myCntyCompare(a, b) +{ if (a.cnty == null) return 1; if (b.cnty == null) return -1; if (a.cnty.substr(3) > b.cnty.substr(3)) return 1; @@ -309,14 +341,16 @@ function myCntyCompare(a, b) { return 0; } -function myContCompare(a, b) { +function myContCompare(a, b) +{ if (a.cont == null) return 1; if (b.cont == null) return -1; if (a.cont > b.cont) return 1; if (a.cont < b.cont) return -1; return 0; } -function myGTCompare(a, b) { +function myGTCompare(a, b) +{ if (a.style.gt != 0 && b.style.gt == 0) return 1; if (a.style.gt == 0 && b.style.gt != 0) return -1; return 0; @@ -339,14 +373,18 @@ var r_sortFunction = [ mySpotCompare, myGTCompare, myCntyCompare, - myContCompare, + myContCompare ]; -function showRosterBox(sortIndex) { - if (g_rosterSettings.lastSortIndex != sortIndex) { +function showRosterBox(sortIndex) +{ + if (g_rosterSettings.lastSortIndex != sortIndex) + { g_rosterSettings.lastSortIndex = sortIndex; g_rosterSettings.lastSortReverse = 0; - } else { + } + else + { g_rosterSettings.lastSortReverse ^= 1; } @@ -355,33 +393,36 @@ function showRosterBox(sortIndex) { window.opener.goProcessRoster(); } -function hashMaker(band, mode) { - //"Current Band & Mode" +function hashMaker(band, mode) +{ + // "Current Band & Mode" if (g_rosterSettings.reference == 0 || g_rosterSettings.reference == 6) - return band + mode; + { return band + mode; } - //"Current Band, Any Mode" + // "Current Band, Any Mode" if (g_rosterSettings.reference == 1) return band; - //"Current Band, Any Digi Mode" + // "Current Band, Any Digi Mode" if (g_rosterSettings.reference == 2) return band + "dg"; - //"Current Mode, Any Band" + // "Current Mode, Any Band" if (g_rosterSettings.reference == 3) return mode; - //"Any Band, Any Mode" + // "Any Band, Any Mode" if (g_rosterSettings.reference == 4) return ""; - //"Any Band, Any Digi Mode" + // "Any Band, Any Digi Mode" if (g_rosterSettings.reference == 5) return "dg"; } -function processRoster(roster) { +function processRoster(roster) +{ callRoster = roster; viewRoster(); } -function viewRoster() { +function viewRoster() +{ var bands = Object(); var modes = Object(); @@ -391,11 +432,13 @@ function viewRoster() { document.title = window.opener.makeTitleInfo(false); - if (callMode == "hits") { + if (callMode == "hits") + { callMode = "all"; onlyHits = true; } - if (referenceNeed.value == 6) { + if (referenceNeed.value == 6) + { callMode = "all"; onlyHits = false; isAwardTracker = true; @@ -407,38 +450,45 @@ function viewRoster() { window.opener.g_appSettings.gtShareEnable == "true" && window.opener.g_appSettings.gtMsgEnable == "true"; - if (window.opener.g_callsignLookups.lotwUseEnable == true) { + if (window.opener.g_callsignLookups.lotwUseEnable == true) + { usesLoTWDiv.style.display = "inline-block"; - if (g_rosterSettings.usesLoTW == true) { + if (g_rosterSettings.usesLoTW == true) + { maxLoTW.style.display = "inline-block"; maxLoTWView.style.display = "inline-block"; - } else { + } + else + { maxLoTW.style.display = "none"; maxLoTWView.style.display = "none"; } - } else { + } + else + { usesLoTWDiv.style.display = "none"; maxLoTW.style.display = "none"; maxLoTWView.style.display = "none"; } if (window.opener.g_callsignLookups.eqslUseEnable == true) - useseQSLDiv.style.display = "block"; + { useseQSLDiv.style.display = "block"; } else useseQSLDiv.style.display = "none"; if (window.opener.g_callsignLookups.oqrsUseEnable == true) - usesOQRSDiv.style.display = "block"; + { usesOQRSDiv.style.display = "block"; } else usesOQRSDiv.style.display = "none"; if (g_rosterSettings.columns.Spot == true) - onlySpotDiv.style.display = "block"; + { onlySpotDiv.style.display = "block"; } else onlySpotDiv.style.display = "none"; if (callMode == "all") allOnlyNewDiv.style.display = "block"; 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; @@ -449,7 +499,8 @@ function viewRoster() { if ( now - callRoster[callHash].callObj.age > window.opener.g_mapSettings.rosterTime - ) { + ) + { callRoster[callHash].tx = false; callRoster[callHash].alerted = false; callRoster[callHash].callObj.qrz = false; @@ -459,11 +510,13 @@ function viewRoster() { if ( window.opener.g_instances[callRoster[callHash].callObj.instance] .crEnable == false - ) { + ) + { callRoster[callHash].tx = false; continue; } - if (call in g_blockedCalls) { + if (call in g_blockedCalls) + { callRoster[callHash].tx = false; continue; } @@ -473,96 +526,121 @@ function viewRoster() { " from " + window.opener.g_dxccToAltName[callRoster[callHash].callObj.dxcc] in g_blockedCQ - ) { + ) + { callRoster[callHash].tx = false; continue; } - if (callRoster[callHash].callObj.dxcc in g_blockedDxcc) { + if (callRoster[callHash].callObj.dxcc in g_blockedDxcc) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.cqOnly == true && callRoster[callHash].callObj.CQ == false - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.useRegex && g_rosterSettings.callsignRegex.length > 0 - ) { - try { - if (!call.match(g_rosterSettings.callsignRegex)) { + ) + { + try + { + if (!call.match(g_rosterSettings.callsignRegex)) + { callRoster[callHash].tx = false; continue; } - } catch (e) {} + } + catch (e) {} } if ( g_rosterSettings.requireGrid == true && callRoster[callHash].callObj.grid.length != 4 - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.wantMinDB == true && callRoster[callHash].message.SR < g_rosterSettings.minDb - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.wantMaxDT == true && Math.abs(callRoster[callHash].message.DT) > g_rosterSettings.maxDT - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.wantMinFreq == true && callRoster[callHash].message.DF < g_rosterSettings.minFreq - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.wantMaxFreq == true && callRoster[callHash].message.DF > g_rosterSettings.maxFreq - ) { + ) + { callRoster[callHash].tx = false; continue; } - if (g_rosterSettings.noMsg == true) { - try { + if (g_rosterSettings.noMsg == true) + { + try + { if ( callRoster[callHash].callObj.msg.match(g_rosterSettings.noMsgValue) - ) { + ) + { callRoster[callHash].tx = false; continue; } - } catch (e) {} + } + catch (e) {} } - if (g_rosterSettings.onlyMsg == true) { - try { + if (g_rosterSettings.onlyMsg == true) + { + try + { if ( !callRoster[callHash].callObj.msg.match(g_rosterSettings.onlyMsgValue) - ) { + ) + { callRoster[callHash].tx = false; continue; } - } catch (e) {} + } + catch (e) {} } - if (callRoster[callHash].callObj.dxcc == window.opener.g_myDXCC) { - if (g_rosterSettings.noMyDxcc == true) { + if (callRoster[callHash].callObj.dxcc == window.opener.g_myDXCC) + { + if (g_rosterSettings.noMyDxcc == true) + { callRoster[callHash].tx = false; continue; } - } else { - if (g_rosterSettings.onlyMyDxcc == true) { + } + else + { + if (g_rosterSettings.onlyMyDxcc == true) + { callRoster[callHash].tx = false; continue; } @@ -571,14 +649,18 @@ function viewRoster() { if ( window.opener.g_callsignLookups.lotwUseEnable == true && g_rosterSettings.usesLoTW == true - ) { - if (!(call in window.opener.g_lotwCallsigns)) { + ) + { + if (!(call in window.opener.g_lotwCallsigns)) + { callRoster[callHash].tx = false; continue; } - if (g_rosterSettings.maxLoTW < 27) { + if (g_rosterSettings.maxLoTW < 27) + { var months = (g_day - window.opener.g_lotwCallsigns[call]) / 30; - if (months > g_rosterSettings.maxLoTW) { + if (months > g_rosterSettings.maxLoTW) + { callRoster[callHash].tx = false; continue; } @@ -588,8 +670,10 @@ function viewRoster() { if ( window.opener.g_callsignLookups.eqslUseEnable == true && g_rosterSettings.useseQSL == true - ) { - if (!(call in window.opener.g_eqslCallsigns)) { + ) + { + if (!(call in window.opener.g_eqslCallsigns)) + { callRoster[callHash].tx = false; continue; } @@ -598,63 +682,73 @@ function viewRoster() { if ( window.opener.g_callsignLookups.oqrsUseEnable == true && g_rosterSettings.usesOQRS == true - ) { - if (!(call in window.opener.g_oqrsCallsigns)) { + ) + { + if (!(call in window.opener.g_oqrsCallsigns)) + { callRoster[callHash].tx = false; continue; } } - if (callMode != "all") { + if (callMode != "all") + { if ( callRoster[callHash].DXcall == "CQ DX" && callRoster[callHash].callObj.dxcc == window.opener.g_myDXCC - ) { + ) + { 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) { - 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; - } + callRoster[callHash].tx = false; + continue; } - if (g_rosterSettings.hunting == "grid") { + 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) + hashMaker( callRoster[callHash].callObj.band, callRoster[callHash].callObj.mode ); - if (g_rosterSettings.huntNeed == "worked" && hash in g_worked.grid) { + if (g_rosterSettings.huntNeed == "worked" && hash in g_worked.grid) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_confirmed.grid - ) { + ) + { callRoster[callHash].tx = false; continue; } - if (callRoster[callHash].callObj.grid.length == 0) { + if (callRoster[callHash].callObj.grid.length == 0) + { callRoster[callHash].tx = false; continue; } continue; } - if (g_rosterSettings.hunting == "dxcc") { + if (g_rosterSettings.hunting == "dxcc") + { var hash = String(callRoster[callHash].callObj.dxcc) + hashMaker( @@ -662,7 +756,8 @@ function viewRoster() { callRoster[callHash].callObj.mode ); - if ((g_rosterSettings.huntNeed == "worked") & (hash in g_worked.dxcc)) { + if ((g_rosterSettings.huntNeed == "worked") & (hash in g_worked.dxcc)) + { callRoster[callHash].tx = false; continue; } @@ -670,7 +765,8 @@ function viewRoster() { if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_confirmed.dxcc - ) { + ) + { callRoster[callHash].tx = false; continue; } @@ -678,15 +774,19 @@ function viewRoster() { continue; } - if (g_rosterSettings.hunting == "dxccs" && r_currentDXCCs != -1) { - if (callRoster[callHash].callObj.dxcc != r_currentDXCCs) { + if (g_rosterSettings.hunting == "dxccs" && r_currentDXCCs != -1) + { + if (callRoster[callHash].callObj.dxcc != r_currentDXCCs) + { callRoster[callHash].tx = false; continue; } } - if (g_rosterSettings.hunting == "wpx") { - if (String(callRoster[callHash].callObj.px) == null) { + if (g_rosterSettings.hunting == "wpx") + { + if (String(callRoster[callHash].callObj.px) == null) + { callRoster[callHash].tx = false; continue; } @@ -697,7 +797,8 @@ function viewRoster() { callRoster[callHash].callObj.mode ); - if ((g_rosterSettings.huntNeed == "worked") & (hash in g_worked.px)) { + if ((g_rosterSettings.huntNeed == "worked") & (hash in g_worked.px)) + { callRoster[callHash].tx = false; continue; } @@ -705,7 +806,8 @@ function viewRoster() { if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_confirmed.px - ) { + ) + { callRoster[callHash].tx = false; continue; } @@ -713,15 +815,18 @@ function viewRoster() { continue; } - if (g_rosterSettings.hunting == "cq") { + if (g_rosterSettings.hunting == "cq") + { var workedTotal = (confirmedTotal = callRoster[callHash].callObj.cqza.length); - if (workedTotal == 0) { + if (workedTotal == 0) + { callRoster[callHash].tx = false; continue; } var workedFound = (confirmedFound = 0); - for (index in callRoster[callHash].callObj.cqza) { + for (index in callRoster[callHash].callObj.cqza) + { var hash = callRoster[callHash].callObj.cqza[index] + hashMaker( @@ -735,14 +840,16 @@ function viewRoster() { if ( g_rosterSettings.huntNeed == "worked" && workedFound == workedTotal - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.huntNeed == "confirmed" && confirmedFound == confirmedTotal - ) { + ) + { callRoster[callHash].tx = false; continue; } @@ -750,15 +857,18 @@ function viewRoster() { continue; } - if (g_rosterSettings.hunting == "itu") { + if (g_rosterSettings.hunting == "itu") + { var workedTotal = (confirmedTotal = callRoster[callHash].callObj.ituza.length); - if (workedTotal == 0) { + if (workedTotal == 0) + { callRoster[callHash].tx = false; continue; } var workedFound = (confirmedFound = 0); - for (index in callRoster[callHash].callObj.ituza) { + for (index in callRoster[callHash].callObj.ituza) + { var hash = callRoster[callHash].callObj.ituza[index] + hashMaker( @@ -772,18 +882,21 @@ function viewRoster() { if ( g_rosterSettings.huntNeed == "worked" && workedFound == workedTotal - ) { + ) + { callRoster[callHash].tx = false; continue; } if ( g_rosterSettings.huntNeed == "confirmed" && confirmedFound == confirmedTotal - ) { + ) + { callRoster[callHash].tx = false; continue; } - if (callRoster[callHash].callObj.grid.length == 0) { + if (callRoster[callHash].callObj.grid.length == 0) + { callRoster[callHash].tx = false; continue; } @@ -793,11 +906,14 @@ function viewRoster() { if ( g_rosterSettings.hunting == "usstates" && window.opener.g_callsignLookups.ulsUseEnable == true - ) { + ) + { var state = callRoster[callHash].callObj.state; var finalDxcc = callRoster[callHash].callObj.dxcc; - if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6) { - if (state in window.opener.g_StateData) { + if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6) + { + if (state in window.opener.g_StateData) + { var hash = state + hashMaker( @@ -808,7 +924,8 @@ function viewRoster() { if ( g_rosterSettings.huntNeed == "worked" && hash in g_worked.state - ) { + ) + { callRoster[callHash].tx = false; continue; } @@ -816,35 +933,47 @@ function viewRoster() { if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_confirmed.state - ) { + ) + { callRoster[callHash].tx = false; continue; } - } else callRoster[callHash].tx = false; - } else callRoster[callHash].tx = false; + } + else callRoster[callHash].tx = false; + } + else callRoster[callHash].tx = false; continue; } - if (g_rosterSettings.hunting == "usstate" && g_currentUSCallsigns) { - if (call in g_currentUSCallsigns) { - } else { + if (g_rosterSettings.hunting == "usstate" && g_currentUSCallsigns) + { + if (call in g_currentUSCallsigns) + { + // Do Nothing + } + else + { callRoster[callHash].tx = false; continue; } continue; } } - if (isAwardTracker) { + if (isAwardTracker) + { var tx = false; var baseHash = hashMaker( callRoster[callHash].callObj.band, callRoster[callHash].callObj.mode ); - for (var award in g_awardTracker) { - if (g_awardTracker[award].enable) { + for (var award in g_awardTracker) + { + if (g_awardTracker[award].enable) + { tx = testAward(award, callRoster[callHash].callObj, baseHash); - if (tx) { + if (tx) + { var x = g_awardTracker[award]; callRoster[callHash].callObj.awardReason = g_awards[x.sponsor].awards[x.name].tooltip + @@ -867,17 +996,20 @@ function viewRoster() { var row = "#000000"; var bold = "#000000;text-shadow: 0px 0px 1px black;"; var unconf = "background-clip:content-box;box-shadow: 0 0 8px 3px inset "; - for (var callHash in callRoster) { + for (var callHash in callRoster) + { // Special case check for called station if ( callRoster[callHash].callObj.qrz == true && callRoster[callHash].tx == false - ) { + ) + { // The instance has to be enabled if ( window.opener.g_instances[callRoster[callHash].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, var it through @@ -886,7 +1018,8 @@ function viewRoster() { !(callRoster[callHash].callObj.dxcc in g_blockedDxcc)) || window.opener.g_instances[callRoster[callHash].callObj.instance] .status.DXcall == callRoster[callHash].DEcall - ) { + ) + { callRoster[callHash].tx = true; } } @@ -895,7 +1028,8 @@ function viewRoster() { if ( callRoster[callHash].callObj.dxcc != -1 && callRoster[callHash].tx == true - ) { + ) + { var workHash = hashMaker( callRoster[callHash].callObj.band, callRoster[callHash].callObj.mode @@ -921,7 +1055,7 @@ function viewRoster() { var wpx = "#FFFF00"; hasGtPin = false; - shouldAlert = false; + var shouldAlert = false; var callsignBg, gridBg, callingBg, @@ -949,11 +1083,13 @@ function viewRoster() { callConf = gridConf = callingConf = dxccConf = stateConf = cntyConf = contConf = cqzConf = ituzConf = wpxConf = ""; - if (testHash in g_worked.call) { + if (testHash in g_worked.call) + { didWork = true; callConf = unconf + callsign + inversionAlpha + ";"; - if (testHash in g_confirmed.call) { + if (testHash in g_confirmed.call) + { callPointer = "text-decoration: line-through; "; callConf = ""; } @@ -964,24 +1100,30 @@ function viewRoster() { window.opener.g_gtCallsigns[call] in window.opener.g_gtFlagPins && window.opener.g_gtFlagPins[window.opener.g_gtCallsigns[call]].canmsg == true - ) { + ) + { // grab the CID colorObject.gt = window.opener.g_gtCallsigns[call]; hasGtPin = true; - } else colorObject.gt = 0; + } + else colorObject.gt = 0; - if (callMode == "all") { + if (callMode == "all") + { if ( allOnlyNew.checked == true && didWork && callRoster[callHash].callObj.qrz == false - ) { + ) + { callRoster[callHash].tx = false; continue; } - if (huntCallsign.checked == true) { - if (g_rosterSettings.huntNeed == "worked" && didWork) { + if (huntCallsign.checked == true) + { + if (g_rosterSettings.huntNeed == "worked" && didWork) + { callRoster[callHash].callObj.reason.push("call"); callConf = unconf + callsign + inversionAlpha + ";"; } @@ -989,17 +1131,22 @@ function viewRoster() { didWork && g_rosterSettings.huntNeed == "confirmed" && !(testHash in g_confirmed.call) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("call"); callConf = unconf + callsign + inversionAlpha + ";"; - } else if ( + } + else if ( didWork && g_rosterSettings.huntNeed == "confirmed" && testHash in g_confirmed.call - ) { + ) + { callConf = ""; - } else if (!didWork) { + } + else if (!didWork) + { shouldAlert = true; callConf = ""; callsignBg = callsign + inversionAlpha; @@ -1010,12 +1157,14 @@ function viewRoster() { if ( huntQRZ.checked == true && callRoster[callHash].callObj.qrz == true - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("qrz"); } - if (huntOAMS.checked == true && hasGtPin == true) { + if (huntOAMS.checked == true && hasGtPin == true) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("oams"); } @@ -1023,45 +1172,55 @@ function viewRoster() { if ( huntGrid.checked == true && callRoster[callHash].callObj.grid.length > 1 - ) { + ) + { var hash = callRoster[callHash].callObj.grid.substr(0, 4) + workHash; if ( (g_rosterSettings.huntNeed == "worked" && !(hash in g_worked.grid)) || (g_rosterSettings.huntNeed == "confirmed" && !(hash in g_confirmed.grid)) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("grid"); if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_worked.grid - ) { + ) + { gridConf = unconf + grid + inversionAlpha + ";"; - } else { + } + else + { gridBg = grid + inversionAlpha; grid = bold; } } } - if (huntDXCC.checked == true) { + if (huntDXCC.checked == true) + { var hash = String(callRoster[callHash].callObj.dxcc) + workHash; if ( (g_rosterSettings.huntNeed == "worked" && !(hash in g_worked.dxcc)) || (g_rosterSettings.huntNeed == "confirmed" && !(hash in g_confirmed.dxcc)) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("dxcc"); if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_worked.dxcc - ) { + ) + { dxccConf = unconf + dxcc + inversionAlpha + ";"; - } else { + } + else + { dxccBg = dxcc + inversionAlpha; dxcc = bold; } @@ -1070,27 +1229,34 @@ function viewRoster() { if ( huntState.checked == true && window.opener.g_callsignLookups.ulsUseEnable == true - ) { + ) + { var stateSearch = callRoster[callHash].callObj.state; var finalDxcc = callRoster[callHash].callObj.dxcc; - if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6) { - if (stateSearch in window.opener.g_StateData) { + if (finalDxcc == 291 || finalDxcc == 110 || finalDxcc == 6) + { + if (stateSearch in window.opener.g_StateData) + { var hash = stateSearch + workHash; if ( (g_rosterSettings.huntNeed == "worked" && !(hash in g_worked.state)) || (g_rosterSettings.huntNeed == "confirmed" && !(hash in g_confirmed.state)) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("usstates"); if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_worked.state - ) { + ) + { stateConf = unconf + state + inversionAlpha + ";"; - } else { + } + else + { stateBg = state + inversionAlpha; state = bold; } @@ -1101,7 +1267,8 @@ function viewRoster() { if ( huntCounty.checked == true && window.opener.g_callsignLookups.ulsUseEnable == true - ) { + ) + { var finalDxcc = callRoster[callHash].callObj.dxcc; if ( callRoster[callHash].callObj.cnty && @@ -1110,7 +1277,8 @@ function viewRoster() { finalDxcc == 6 || finalDxcc == 202) && callRoster[callHash].callObj.cnty.length > 0 - ) { + ) + { var hash = callRoster[callHash].callObj.cnty + workHash; if ( @@ -1119,45 +1287,56 @@ function viewRoster() { (g_rosterSettings.huntNeed == "confirmed" && !(hash in g_confirmed.cnty)) || callRoster[callHash].callObj.qual == false - ) { - if (callRoster[callHash].callObj.qual == false) { + ) + { + if (callRoster[callHash].callObj.qual == false) + { var counties = window.opener.g_zipToCounty[ callRoster[callHash].callObj.zipcode ]; var foundHit = false; - for (var cnt in counties) { + for (var cnt in counties) + { var hh = counties[cnt] + workHash; callRoster[callHash].callObj.cnty = counties[cnt]; if ( g_rosterSettings.huntNeed == "worked" && !(hh in g_worked.cnty) - ) { + ) + { foundHit = true; break; } if ( g_rosterSettings.huntNeed == "confirmed" && !(hh in g_confirmed.cnty) - ) { + ) + { foundHit = true; break; } } if (foundHit) shouldAlert = true; - } else { + } + else + { shouldAlert = true; } - if (shouldAlert) { + if (shouldAlert) + { callRoster[callHash].callObj.reason.push("uscnty"); if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_worked.cnty - ) { + ) + { cntyConf = unconf + cnty + inversionAlpha + ";"; - } else { + } + else + { cntyBg = cnty + inversionAlpha; cnty = bold; } @@ -1165,11 +1344,13 @@ function viewRoster() { } } } - if (huntCQz.checked == true) { + if (huntCQz.checked == true) + { var workedTotal = (confirmedTotal = callRoster[callHash].callObj.cqza.length); var workedFound = (confirmedFound = 0); - for (index in callRoster[callHash].callObj.cqza) { + for (index in callRoster[callHash].callObj.cqza) + { var hash = callRoster[callHash].callObj.cqza[index] + workHash; if (hash in g_worked.cqz) workedFound++; @@ -1180,26 +1361,32 @@ function viewRoster() { workedFound != workedTotal) || (g_rosterSettings.huntNeed == "confirmed" && confirmedFound != confirmedTotal) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("cq"); if ( g_rosterSettings.huntNeed == "confirmed" && workedFound == workedTotal - ) { + ) + { cqzConf = unconf + cqz + inversionAlpha + ";"; - } else { + } + else + { cqzBg = cqz + inversionAlpha; cqz = bold; } } } - if (huntITUz.checked == true) { + if (huntITUz.checked == true) + { var workedTotal = (confirmedTotal = callRoster[callHash].callObj.ituza.length); var workedFound = (confirmedFound = 0); - for (index in callRoster[callHash].callObj.ituza) { + for (index in callRoster[callHash].callObj.ituza) + { var hash = callRoster[callHash].callObj.ituza[index] + workHash; if (hash in g_worked.ituz) workedFound++; @@ -1210,56 +1397,70 @@ function viewRoster() { workedFound != workedTotal) || (g_rosterSettings.huntNeed == "confirmed" && confirmedFound != confirmedTotal) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("itu"); if ( g_rosterSettings.huntNeed == "confirmed" && workedFound == workedTotal - ) { + ) + { ituzConf = unconf + ituz + inversionAlpha + ";"; - } else { + } + else + { ituzBg = ituz + inversionAlpha; ituz = bold; } } } - if (huntPX.checked == true && callRoster[callHash].callObj.px) { + if (huntPX.checked == true && callRoster[callHash].callObj.px) + { var hash = String(callRoster[callHash].callObj.px) + workHash; if ( (g_rosterSettings.huntNeed == "worked" && !(hash in g_worked.px)) || (g_rosterSettings.huntNeed == "confirmed" && !(hash in g_confirmed.px)) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("wpx"); if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_worked.px - ) { + ) + { wpxConf = unconf + wpx + inversionAlpha + ";"; - } else { + } + else + { wpxBg = wpx + inversionAlpha; wpx = bold; } } } - if (huntCont.checked == true && callRoster[callHash].callObj.cont) { + if (huntCont.checked == true && callRoster[callHash].callObj.cont) + { var hash = String(callRoster[callHash].callObj.cont) + workHash; if ( (g_rosterSettings.huntNeed == "worked" && !(hash in g_worked.cont)) || (g_rosterSettings.huntNeed == "confirmed" && !(hash in g_confirmed.cont)) - ) { + ) + { shouldAlert = true; callRoster[callHash].callObj.reason.push("cont"); if ( g_rosterSettings.huntNeed == "confirmed" && hash in g_worked.cont - ) { + ) + { contConf = unconf + cont + inversionAlpha + ";"; - } else { + } + else + { contBg = cont + inversionAlpha; cont = bold; } @@ -1267,13 +1468,16 @@ function viewRoster() { } } - if (callRoster[callHash].callObj.DXcall == window.opener.myDEcall) { + if (callRoster[callHash].callObj.DXcall == window.opener.myDEcall) + { callingBg = "#0000FF" + inversionAlpha; calling = "#FFFF00;text-shadow: 0px 0px 2px #FFFF00"; - } else if ( + } + else if ( callRoster[callHash].callObj.CQ == true && g_rosterSettings.cqOnly == false - ) { + ) + { callingBg = calling + inversionAlpha; calling = bold; } @@ -1366,17 +1570,20 @@ function viewRoster() { callRoster[callHash].callObj.style = colorObject; - if (g_rosterSettings.columns.Spot) { + if (g_rosterSettings.columns.Spot) + { callRoster[callHash].callObj.spot = window.opener.getSpotTime( callRoster[callHash].callObj.DEcall + callRoster[callHash].callObj.mode + callRoster[callHash].callObj.band + callRoster[callHash].callObj.grid ); - if (callRoster[callHash].callObj.spot == null) { + if (callRoster[callHash].callObj.spot == null) + { callRoster[callHash].callObj.spot = { when: 0, snr: 0 }; } - } else callRoster[callHash].callObj.spot = { when: 0, snr: 0 }; + } + else callRoster[callHash].callObj.spot = { when: 0, snr: 0 }; modes[callRoster[callHash].callObj.mode] = true; bands[callRoster[callHash].callObj.band] = true; @@ -1385,130 +1592,173 @@ function viewRoster() { } } - if (g_rosterSettings.compact == false) { + if (g_rosterSettings.compact == false) + { newCallList.sort(r_sortFunction[g_rosterSettings.lastSortIndex]); - if (g_rosterSettings.lastSortReverse == 1) { + if (g_rosterSettings.lastSortReverse == 1) + { newCallList.reverse(); } - } else { + } + else + { // Age sort for now... make this happen Tag newCallList.sort(r_sortFunction[6]).reverse(); } var showBands = - (Object.keys(bands).length > 1 ? true : false) || + (Object.keys(bands).length > 1) || g_rosterSettings.columns.Band; var showModes = - (Object.keys(modes).length > 1 ? true : false) || + (Object.keys(modes).length > 1) || g_rosterSettings.columns.Mode; var worker = ""; - if (g_rosterSettings.compact == false) { + if (g_rosterSettings.compact == false) + { worker = ""; worker += ""; - if (showBands) { + if (showBands) + { worker += ""; } - if (showModes) { + if (showModes) + { worker += ""; } worker += ""; if (g_rosterSettings.columns.Calling) + { worker += ""; + } if (g_rosterSettings.columns.Msg) worker += ""; if (g_rosterSettings.columns.DXCC) + { worker += ""; + } if (g_rosterSettings.columns.Flag) + { worker += ""; + } if (g_rosterSettings.columns.State) + { worker += ""; + } if (g_rosterSettings.columns.County) + { worker += ""; + } if (g_rosterSettings.columns.Cont) + { worker += ""; + } if (g_rosterSettings.columns.dB) + { worker += ""; + } if (g_rosterSettings.columns.Freq) + { worker += ""; + } if (g_rosterSettings.columns.DT) + { worker += ""; + } if (g_rosterSettings.columns.Dist) + { worker += ""; + } if (g_rosterSettings.columns.Azim) + { worker += ""; + } if (g_rosterSettings.columns.CQz) worker += ""; if (g_rosterSettings.columns.ITUz) worker += ""; if (g_rosterSettings.columns.PX) + { worker += ""; + } if ( window.opener.g_callsignLookups.lotwUseEnable == true && g_rosterSettings.columns.LoTW ) - worker += ""; + { worker += ""; } if ( window.opener.g_callsignLookups.eqslUseEnable == true && g_rosterSettings.columns.eQSL ) - worker += ""; + { worker += ""; } if ( window.opener.g_callsignLookups.oqrsUseEnable == true && g_rosterSettings.columns.OQRS ) - worker += ""; + { worker += ""; } if (g_rosterSettings.columns.Spot) + { worker += ""; + } if (g_rosterSettings.columns.Life) + { worker += ""; + } if (g_rosterSettings.columns.OAMS) + { worker += ""; + } if (g_rosterSettings.columns.Age) + { worker += ""; - } else { + } + } + else + { worker = - '
'; + "
"; } var shouldAlert = 0; - for (var x in newCallList) { + for (var x in newCallList) + { if ( newCallList[x].shouldAlert == false && onlyHits == true && newCallList[x].qrz == false ) - continue; + { continue; } var spotString = ""; - if (g_rosterSettings.columns.Spot && newCallList[x].qrz == false) { + if (g_rosterSettings.columns.Spot && newCallList[x].qrz == false) + { spotString = getSpotString(newCallList[x]); if (g_rosterSettings.onlySpot && spotString == "") continue; } @@ -1530,21 +1780,26 @@ function viewRoster() { var thisCall = newCallList[x].DEcall; if (thisCall.match("^[A-Z][0-9][A-Z](/w+)?$")) - newCallList[x].style.callsign = "class='oneByOne'"; + { newCallList[x].style.callsign = "class='oneByOne'"; } if ( thisCall == window.opener.g_instances[newCallList[x].instance].status.DXcall - ) { + ) + { if ( window.opener.g_instances[newCallList[x].instance].status.TxEnabled == 1 - ) { + ) + { newCallList[x].style.callsign = "class='dxCalling'"; - } else { + } + else + { newCallList[x].style.callsign = "class='dxCaller'"; } } - if (g_rosterSettings.compact == false) { + if (g_rosterSettings.compact == false) + { var thisHash = thisCall + newCallList[x].band + newCallList[x].mode; worker += "
"; @@ -1561,7 +1816,8 @@ function viewRoster() { thisCall.formatCallsign() + ""; - if (showBands) { + if (showBands) + { worker += ""; } @@ -1585,7 +1842,8 @@ function viewRoster() { "\")' >" + grid + ""; - if (g_rosterSettings.columns.Calling) { + if (g_rosterSettings.columns.Calling) + { var lookString = newCallList[x].CQ ? "name='CQ'" : "name='Calling'"; worker += ""; + { worker += ""; } if (g_rosterSettings.columns.DXCC) + { worker += ""; + } if (g_rosterSettings.columns.State) + { worker += ""; + } if (g_rosterSettings.columns.County) + { worker += ""; + } if (g_rosterSettings.columns.dB) + { worker += ""; + } if (g_rosterSettings.columns.Freq) - worker += ""; + { worker += ""; } if (g_rosterSettings.columns.DT) - worker += ""; + { worker += ""; } if (g_rosterSettings.columns.Dist) + { worker += ""; + } if (g_rosterSettings.columns.Azim) + { worker += ""; + } if (g_rosterSettings.columns.CQz) + { worker += ""; + } if (g_rosterSettings.columns.ITUz) + { worker += ""; + } if (g_rosterSettings.columns.PX) + { worker += ""; + } if ( window.opener.g_callsignLookups.lotwUseEnable == true && g_rosterSettings.columns.LoTW - ) { - if (thisCall in window.opener.g_lotwCallsigns) { - if (g_rosterSettings.maxLoTW < 27) { + ) + { + if (thisCall in window.opener.g_lotwCallsigns) + { + if (g_rosterSettings.maxLoTW < 27) + { var months = (g_day - window.opener.g_lotwCallsigns[thisCall]) / 30; if (months > g_rosterSettings.maxLoTW) + { worker += ""; + } else + { worker += ""; - } else + } + } + else + { worker += ""; - } else worker += ""; + } + } + else worker += ""; } if ( window.opener.g_callsignLookups.eqslUseEnable == true && g_rosterSettings.columns.eQSL ) + { worker += ""; + } if ( window.opener.g_callsignLookups.oqrsUseEnable == true && g_rosterSettings.columns.OQRS ) + { worker += ""; + } if (g_rosterSettings.columns.Spot) + { worker += ""; + } if (g_rosterSettings.columns.Life) + { worker += ""; + } - if (g_rosterSettings.columns.OAMS) { - if (newCallList[x].style.gt != 0) { - if (newCallList[x].reason.includes("oams")) { + if (g_rosterSettings.columns.OAMS) + { + if (newCallList[x].style.gt != 0) + { + if (newCallList[x].reason.includes("oams")) + { worker += ""; - } else { + } + else + { worker += ""; } - } else worker += ""; + } + else worker += ""; } if (g_rosterSettings.columns.Age) + { worker += ""; + } worker += ""; - } else { + } + else + { var tt = newCallList[x].RSTsent + "㏈, " + @@ -1832,7 +2141,8 @@ function viewRoster() { worker += ""; } - if (g_rosterSettings.realtime == false) { + if (g_rosterSettings.realtime == false) + { var call = newCallList[x].DEcall; g_scriptReport[call] = Object.assign({}, newCallList[x]); g_scriptReport[call].dxccName = @@ -1850,7 +2160,8 @@ function viewRoster() { delete g_scriptReport[call].qso; delete g_scriptReport[call].instance; - if (callMode != "all") { + if (callMode != "all") + { g_scriptReport[call].shouldAlert = true; g_scriptReport[call].reason.push(g_rosterSettings.hunting); } @@ -1860,10 +2171,13 @@ function viewRoster() { newCallList[x].alerted == false && callMode == "all" && newCallList[x].shouldAlert == true - ) { + ) + { newCallList[x].alerted = true; shouldAlert++; - } else if (newCallList[x].alerted == false && callMode != "all") { + } + else if (newCallList[x].alerted == false && callMode != "all") + { newCallList[x].alerted = true; shouldAlert++; } @@ -1871,11 +2185,14 @@ function viewRoster() { newCallList[x].shouldAlert = false; } - if (g_rosterSettings.compact == false) { + if (g_rosterSettings.compact == false) + { worker += "
CallsignBandModeGridCallingMsgDXCCFlagStateCountyContdBFreqDTDist(" + window.opener.distanceUnit.value.toLowerCase() + ")AzimCQzITUzPXLoTWLoTWeQSLeQSLOQRSOQRSSpotLifeOAMAge
" + newCallList[x].mode + ""; } if (g_rosterSettings.columns.Msg) - worker += "" + newCallList[x].msg + "" + newCallList[x].msg + "" + (newCallList[x].state ? newCallList[x].state.substr(3) : "") + ""; + } if (g_rosterSettings.columns.Cont) + { worker += "" + (newCallList[x].cont ? newCallList[x].cont : "") + "" + newCallList[x].RSTsent + "" + newCallList[x].delta + "" + newCallList[x].delta + "" + newCallList[x].dt + "" + newCallList[x].dt + "" + parseInt( @@ -1670,81 +1941,106 @@ function viewRoster() { MyCircle.validateRadius(window.opener.distanceUnit.value) ) + "" + parseInt(newCallList[x].heading) + "" + newCallList[x].cqza.join(",") + "" + newCallList[x].ituza.join(",") + "" + (newCallList[x].px ? newCallList[x].px : "") + "?" + (thisCall in window.opener.g_eqslCallsigns ? "✔" : "") + "" + (thisCall in window.opener.g_oqrsCallsigns ? "✔" : "") + "" + spotString + "" + (timeNowSec() - newCallList[x].life).toDHMS() + "" + (timeNowSec() - newCallList[x].age).toDHMS() + "
"; RosterTable.innerHTML = worker; callTable.style.width = parseInt(window.innerWidth) - 6 + "px"; - } else { + } + else + { RosterTable.innerHTML = worker + ""; buttonsDiv.style.width = parseInt(window.innerWidth) - 6 + "px"; } @@ -1884,15 +2201,19 @@ function viewRoster() { var scriptExists = false; var script = "cr-alert.sh"; - try { - if (fs.existsSync(dirPath)) { - if (window.opener.g_platform == "windows") { + try + { + if (fs.existsSync(dirPath)) + { + if (window.opener.g_platform == "windows") + { script = "cr-alert.bat"; } if ( fs.existsSync(dirPath + script) && g_rosterSettings.realtime == false - ) { + ) + { scriptExists = true; scriptIcon.innerHTML = "
" + @@ -1901,19 +2222,27 @@ function viewRoster() { : "Script Disabled") + "
"; scriptIcon.style.display = "block"; - } else { + } + else + { scriptIcon.style.display = "none"; } } - } catch (e) {} + } + catch (e) {} - if (shouldAlert > 0) { - if (window.opener.g_classicAlerts.huntRoster == true) { + if (shouldAlert > 0) + { + if (window.opener.g_classicAlerts.huntRoster == true) + { var notify = window.opener.huntRosterNotify.value; - if (notify == "0") { + if (notify == "0") + { var media = window.opener.huntRosterNotifyMedia.value; if (media != "none") window.opener.playAlertMediaFile(media); - } else if (notify == "1") { + } + else if (notify == "1") + { window.opener.speakAlertString( window.opener.huntRosterNotifyWord.value ); @@ -1924,8 +2253,10 @@ function viewRoster() { g_rosterSettings.realtime == false && scriptExists && window.opener.g_crScript == 1 - ) { - try { + ) + { + try + { fs.writeFileSync( dirPath + "cr-alert.json", JSON.stringify(g_scriptReport, null, 2) @@ -1936,45 +2267,57 @@ function viewRoster() { var child = cp.spawn(thisProc, [], { detached: true, cwd: dirPath.slice(0, -1), - stdio: ["ignore", "ignore", "ignore"], + stdio: ["ignore", "ignore", "ignore"] }); child.unref(); - } catch (e) { + } + catch (e) + { conosle.log(e); } g_scriptReport = Object(); - } else g_scriptReport = Object(); + } + else g_scriptReport = Object(); } } -function realtimeRoster() { +function realtimeRoster() +{ var now = timeNowSec(); g_day = now / 86400; if (g_rosterSettings.realtime == false) return; var timeCols = document.getElementsByClassName("timeCol"); - for (var x in timeCols) { - if (typeof timeCols[x].id != "undefined") { + for (var x in timeCols) + { + if (typeof timeCols[x].id != "undefined") + { var when = now - callRoster[timeCols[x].id.substr(2)].callObj.age; timeCols[x].innerHTML = when.toDHMS(); } } var lifeCols = document.getElementsByClassName("lifeCol"); - for (var x in lifeCols) { - if (typeof lifeCols[x].id != "undefined") { + for (var x in lifeCols) + { + if (typeof lifeCols[x].id != "undefined") + { var when = now - callRoster[lifeCols[x].id.substr(2)].callObj.life; lifeCols[x].innerHTML = when.toDHMS(); } } - if (g_rosterSettings.columns.Spot) { + if (g_rosterSettings.columns.Spot) + { var spotCols = document.getElementsByClassName("spotCol"); - for (var x in spotCols) { - if (typeof spotCols[x].id != "undefined") { + for (var x in spotCols) + { + if (typeof spotCols[x].id != "undefined") + { spotCols[x].innerHTML = getSpotString( callRoster[spotCols[x].id.substr(2)].callObj ); - if (g_rosterSettings.onlySpot && spotCols[x].innerHTML == "") { + if (g_rosterSettings.onlySpot && spotCols[x].innerHTML == "") + { viewRoster(); return; } @@ -1983,74 +2326,88 @@ function realtimeRoster() { } } -function getSpotString(callObj) { +function getSpotString(callObj) +{ var result = ""; - if (callObj.spot && callObj.spot.when > 0) { + if (callObj.spot && callObj.spot.when > 0) + { when = timeNowSec() - callObj.spot.when; if (when <= window.opener.g_receptionSettings.viewHistoryTimeSec) - result = parseInt(when).toDHMS(); + { result = parseInt(when).toDHMS(); } } if (result) result += " / " + callObj.spot.snr; return result; } -function openChatToCid(cid) { +function openChatToCid(cid) +{ window.opener.showMessaging(true, cid); } -function initiateQso(thisHash) { +function initiateQso(thisHash) +{ window.opener.initiateQso(thisHash); } -function callLookup(thisHash, grid) { +function callLookup(thisHash, grid) +{ window.opener.startLookup( callRoster[thisHash].DEcall, callRoster[thisHash].grid ); } -function callingLookup(thisHash, grid) { +function callingLookup(thisHash, grid) +{ var thisCall = callRoster[thisHash].DXcall; window.opener.startLookup(thisCall, grid); } -function callGenMessage(thisHash, grid) { +function callGenMessage(thisHash, grid) +{ var thisCall = callRoster[thisHash].DEcall; var instance = callRoster[thisHash].callObj.instance; window.opener.startGenMessages(thisCall, grid, instance); } -function callingGenMessage(thisHash, grid) { +function callingGenMessage(thisHash, grid) +{ var thisCall = callRoster[thisHash].DXcall; var instance = callRoster[thisHash].callObj.instance; window.opener.startGenMessages(thisCall, grid, instance); } -function centerOn(grid) { +function centerOn(grid) +{ window.opener.centerOn(grid); } -function instanceChange(what) { +function instanceChange(what) +{ window.opener.g_instances[what.id].crEnable = what.checked; window.opener.goProcessRoster(); } -function updateInstances() { - if (window.opener.g_instancesIndex.length > 1) { +function updateInstances() +{ + if (window.opener.g_instancesIndex.length > 1) + { var instances = window.opener.g_instances; var worker = ""; var keys = Object.keys(instances).sort(); - for (var key in keys) { + for (var key in keys) + { var inst = keys[key]; var sp = inst.split(" - "); var shortInst = sp[sp.length - 1].substring(0, 18); var color = "blue"; - if (instances[inst].open == false) { + if (instances[inst].open == false) + { color = "purple"; } worker += @@ -2066,36 +2423,47 @@ function updateInstances() { } instancesDiv.innerHTML = worker; instancesDiv.style.display = "block"; - } else instancesDiv.style.display = "none"; + } + else instancesDiv.style.display = "none"; } -function processStatus(newMessage) { - if (newMessage.Transmitting == 0) { +function processStatus(newMessage) +{ + if (newMessage.Transmitting == 0) + { // Not Transmitting - if (newMessage.Decoding == 1) { + if (newMessage.Decoding == 1) + { // Decoding txrxdec.style.backgroundColor = "Blue"; txrxdec.style.borderColor = "Cyan"; txrxdec.innerHTML = "DECODE"; - } else { + } + else + { txrxdec.style.backgroundColor = "Green"; txrxdec.style.borderColor = "GreenYellow"; txrxdec.innerHTML = "RECEIVE"; } - } else { + } + else + { txrxdec.style.backgroundColor = "Red"; txrxdec.style.borderColor = "Orange"; txrxdec.innerHTML = "TRANSMIT"; } } -function toTitleCase(str) { - return str.replace(/\w\S*/g, function (txt) { +function toTitleCase(str) +{ + return str.replace(/\w\S*/g, function (txt) + { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); } -function newOption(value, text) { +function newOption(value, text) +{ if (typeof text == "undefined") text = value; var option = document.createElement("option"); option.value = value; @@ -2110,7 +2478,8 @@ function createSelectOptions( altName = null, defaultValue = null, checkSponsor = null -) { +) +{ var selector = document.getElementById(selectElementString); selector.innerHTML = ""; @@ -2123,22 +2492,25 @@ function createSelectOptions( selector.appendChild(option); var obj = null; - if (forObject) { + if (forObject) + { obj = Object.keys(forObject).sort(); } - for (var k in obj) { + for (var k in obj) + { var opt = obj[k]; var option = document.createElement("option"); option.value = opt; option.text = altName ? forObject[opt][altName] : opt; if (checkSponsor && opt + "-" + checkSponsor in g_awardTracker) - option.disabled = true; + { option.disabled = true; } selector.appendChild(option); } } -function awardSponsorChanged() { +function awardSponsorChanged() +{ awardName.style.display = ""; createSelectOptions( "awardName", @@ -2150,7 +2522,8 @@ function awardSponsorChanged() { ); } -function awardNameChanged() { +function awardNameChanged() +{ var awardToAdd = newAwardTrackerObject( awardSponsor.value, awardName.value, @@ -2158,7 +2531,8 @@ function awardNameChanged() { ); var hash = awardToAdd.name + "-" + awardToAdd.sponsor; - if (!(hash in g_awardTracker)) { + if (!(hash in g_awardTracker)) + { g_awardTracker[hash] = awardToAdd; storeAwardTracker(); processAward(hash); @@ -2175,9 +2549,10 @@ function awardNameChanged() { ); } -function updateAwardList(target = null) { +function updateAwardList(target = null) +{ var worker = - ''; + "
"; worker += ""; worker += ""; - { - if (Object.keys(g_blockedCalls).length > 0) - clearString = - ""; - worker += - "
"; worker += "Name"; @@ -2199,7 +2574,8 @@ function updateAwardList(target = null) { var keys = Object.keys(g_awardTracker).sort(); - for (var key in keys) { + for (var key in keys) + { var award = g_awardTracker[keys[key]]; var rule = g_awards[award.sponsor].awards[award.name].rule; var row = awardTable.insertRow(); @@ -2217,16 +2593,19 @@ function updateAwardList(target = null) { g_awards[award.sponsor].sponsor + ")\n"; tooltip += toTitleCase(award.test.qsl_req) + " QSO\n"; - for (var mode in award.comp.counts) { + for (var mode in award.comp.counts) + { tooltip += mode + "\n"; - for (var count in award.comp.counts[mode]) { + for (var count in award.comp.counts[mode]) + { endorseTotal++; - if (award.comp.counts[mode][count].per == 100) { + if (award.comp.counts[mode][count].per == 100) + { baseAward = true; endorseCount++; } if (award.comp.counts[mode][count].num > baseCount) - baseCount = award.comp.counts[mode][count].num; + { baseCount = award.comp.counts[mode][count].num; } tooltip += "\t" + @@ -2237,16 +2616,20 @@ function updateAwardList(target = null) { award.comp.counts[mode][count].per + "%)\n"; var wrk = ""; - if (Object.keys(award.comp.endorse).length > 0) { - for (var band in award.comp.endorse[mode]) { + if (Object.keys(award.comp.endorse).length > 0) + { + for (var band in award.comp.endorse[mode]) + { endorseTotal++; - if (award.comp.endorse[mode][band][count] == true) { + if (award.comp.endorse[mode][band][count] == true) + { endorseCount++; wrk += band + " "; } } } - if (wrk.length > 0) { + if (wrk.length > 0) + { tooltip += "\t\t" + wrk + "\n"; } } @@ -2266,10 +2649,10 @@ function updateAwardList(target = null) { (allEndorse ? "" : baseAward - ? "" - : baseCount > 0 - ? "" - : ""), + ? "" + : baseCount > 0 + ? "" + : ""), tooltip ); createCell( @@ -2287,7 +2670,8 @@ function updateAwardList(target = null) { } } -function deleteAwardTracker(sender) { +function deleteAwardTracker(sender) +{ var id = sender.parentNode.parentNode.id; delete g_awardTracker[id]; storeAwardTracker(); @@ -2296,7 +2680,8 @@ function deleteAwardTracker(sender) { window.opener.goProcessRoster(); } -function awardCheckboxChanged(sender) { +function awardCheckboxChanged(sender) +{ var awardId = sender.target.parentNode.parentNode.id; g_awardTracker[sender.target.parentNode.parentNode.id][sender.target.name] = sender.target.checked; @@ -2304,7 +2689,8 @@ function awardCheckboxChanged(sender) { window.opener.goProcessRoster(); } -function awardValueChanged(sender) { +function awardValueChanged(sender) +{ var awardId = sender.target.parentNode.parentNode.id; g_awardTracker[sender.target.parentNode.parentNode.id][sender.target.name] = sender.target.value; @@ -2319,24 +2705,29 @@ function createCell( data = null, title = null, checkbox = false -) { +) +{ var cell = row.insertCell(); if (data == null) cell.innerHTML = value; if (title) cell.title = title; - if (checkbox) { + if (checkbox) + { var x = document.createElement("INPUT"); x.setAttribute("type", "checkbox"); x.checked = value; x.name = target; x.addEventListener("change", awardCheckboxChanged); cell.appendChild(x); - } else if (data) { + } + else if (data) + { cell.appendChild(createAwardSelector(cell, target, value, data)); } return cell; } -function createCellHtml(row, html, title = null) { +function createCellHtml(row, html, title = null) +{ var cell = row.insertCell(); cell.innerHTML = html; if (title) cell.title = title; @@ -2344,16 +2735,18 @@ function createCellHtml(row, html, title = null) { return cell; } -function createAwardSelector(cell, target, value, forObject) { +function createAwardSelector(cell, target, value, forObject) +{ var selector = document.createElement("select"); selector.name = target; selector.value = value; - selector.disabled = forObject.length == 1 ? true : false; + selector.disabled = forObject.length == 1; selector.style.margin = "0px"; selector.style.padding = "1px"; if (selector.disabled) selector.style.cursor = "auto"; selector.addEventListener("change", awardValueChanged); - for (var opt in forObject) { + for (var opt in forObject) + { var option = document.createElement("option"); option.value = forObject[opt]; if (option.value == "Phone" || option.value == "CW") option.disabled = true; @@ -2363,74 +2756,92 @@ function createAwardSelector(cell, target, value, forObject) { return selector; } -function resetAwardAdd() { +function resetAwardAdd() +{ awardName.style.display = "none"; createSelectOptions("awardName", "Select Award", null); createSelectOptions("awardSponsor", "Select Sponsor", g_awards, "sponsor"); } -function openAwardPopup() { +function openAwardPopup() +{ awardHunterDiv.style.zIndex = 100; resetAwardAdd(); } -function closeAwardPopup() { +function closeAwardPopup() +{ awardHunterDiv.style.zIndex = -1; resetAwardAdd(); } -function toggleMoreControls() { +function toggleMoreControls() +{ g_rosterSettings.controlsExtended = !g_rosterSettings.controlsExtended; localStorage.rosterSettings = JSON.stringify(g_rosterSettings); setVisual(); } -function setVisual() { +function setVisual() +{ HuntNeedControls.style.display = "none"; HuntStateControls.style.display = "none"; HuntDXCCsControls.style.display = "none"; - if (g_rosterSettings.controls) { - if (g_rosterSettings.controlsExtended) { + if (g_rosterSettings.controls) + { + if (g_rosterSettings.controlsExtended) + { RosterControls.className = "extended"; - } else { + } + else + { RosterControls.className = "normal"; } - } else { + } + else + { RosterControls.className = "hidden"; } // 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; - }*/ + 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; + } */ HuntingControls.style.display = "none"; CallsignsControls.style.display = "none"; AwardTrackerControls.style.display = ""; huntingMatrixDiv.style.display = ""; updateAwardList(); - } else { - for (key in g_rosterSettings.wanted) { + } + else + { + for (var key in g_rosterSettings.wanted) + { if (document.getElementById(key)) - document.getElementById(key).checked = g_rosterSettings.wanted[key]; + { document.getElementById(key).checked = g_rosterSettings.wanted[key]; } } AwardTrackerControls.style.display = "none"; HuntingControls.style.display = ""; CallsignsControls.style.display = ""; closeAwardPopup(); - if (callsignNeed.value == "all" || callsignNeed.value == "hits") { + if (callsignNeed.value == "all" || callsignNeed.value == "hits") + { huntingMatrixDiv.style.display = ""; HuntNeedControls.style.display = "block"; HuntModeControls.style.display = "none"; - } else { + } + else + { huntingMatrixDiv.style.display = "none"; HuntModeControls.style.display = "block"; @@ -2438,104 +2849,133 @@ function setVisual() { huntMode.value != "callsign" && huntMode.value != "usstate" && huntMode.value != "dxccs" - ) { + ) + { HuntNeedControls.style.display = "block"; } - if (huntMode.value == "usstate") { + if (huntMode.value == "usstate") + { HuntStateControls.style.display = "block"; } - if (huntMode.value == "usstates") { + if (huntMode.value == "usstates") + { HuntNeedControls.style.display = "block"; } - if (huntMode.value == "dxccs") { + if (huntMode.value == "dxccs") + { HuntDXCCsControls.style.display = "block"; } } } - if (wantMaxDT.checked == true) { + if (wantMaxDT.checked == true) + { maxDT.style.display = "block"; maxDTView.style.display = "block"; - } else { + } + else + { maxDT.style.display = "none"; maxDTView.style.display = "none"; } - if (wantMinDB.checked == true) { + if (wantMinDB.checked == true) + { minDb.style.display = "block"; minDbView.style.display = "block"; - } else { + } + else + { minDb.style.display = "none"; minDbView.style.display = "none"; } - if (wantMinFreq.checked == true) { + if (wantMinFreq.checked == true) + { minFreq.style.display = "block"; minFreqView.style.display = "block"; - } else { + } + else + { minFreq.style.display = "none"; minFreqView.style.display = "none"; } - if (wantMaxFreq.checked == true) { + if (wantMaxFreq.checked == true) + { maxFreq.style.display = "block"; maxFreqView.style.display = "block"; - } else { + } + else + { maxFreq.style.display = "none"; maxFreqView.style.display = "none"; } - if (useRegex.checked == true) { + if (useRegex.checked == true) + { callsignRegex.style.display = "inline-block"; - } else { + } + else + { callsignRegex.style.display = "none"; } - if (window.opener.g_callsignLookups.lotwUseEnable == true) { + if (window.opener.g_callsignLookups.lotwUseEnable == true) + { usesLoTWDiv.style.display = "inline-block"; - if (g_rosterSettings.usesLoTW == true) { + if (g_rosterSettings.usesLoTW == true) + { maxLoTW.style.display = "inline-block"; maxLoTWView.style.display = "inline-block"; - } else { + } + else + { maxLoTW.style.display = "none"; maxLoTWView.style.display = "none"; } - } else { + } + else + { usesLoTWDiv.style.display = "none"; maxLoTW.style.display = "none"; maxLoTWView.style.display = "none"; } if (window.opener.g_callsignLookups.eqslUseEnable == true) - useseQSLDiv.style.display = "block"; + { useseQSLDiv.style.display = "block"; } else useseQSLDiv.style.display = "none"; if (window.opener.g_callsignLookups.oqrsUseEnable == true) - usesOQRSDiv.style.display = "block"; + { usesOQRSDiv.style.display = "block"; } else usesOQRSDiv.style.display = "none"; if (g_rosterSettings.columns.Spot == true) - onlySpotDiv.style.display = "block"; + { onlySpotDiv.style.display = "block"; } else onlySpotDiv.style.display = "none"; if (g_rosterSettings.callsign == "all" || g_rosterSettings.callsign == "hits") - allOnlyNewDiv.style.display = "block"; + { allOnlyNewDiv.style.display = "block"; } else allOnlyNewDiv.style.display = "none"; resize(); } -function wantedChanged(element) { +function wantedChanged(element) +{ g_rosterSettings.wanted[element.id] = element.checked; - if (element.checked == true) { + if (element.checked == true) + { var t = element.id.replace("hunt", ""); - if (t in g_rosterSettings.columns) { + if (t in g_rosterSettings.columns) + { g_rosterSettings.columns[t] = true; - for (var i = 0; i < g_menu.items.length; ++i) { + for (var i = 0; i < g_menu.items.length; ++i) + { if ( typeof g_menu.items[i].checked != "undefined" && g_menu.items[i].label == t ) - g_menu.items[i].checked = true; + { g_menu.items[i].checked = true; } } } } @@ -2543,13 +2983,15 @@ function wantedChanged(element) { writeRosterSettings(); g_scriptReport = Object(); - for (var callHash in window.opener.g_callRoster) { + for (var callHash in window.opener.g_callRoster) + { window.opener.g_callRoster[callHash].callObj.alerted = false; } window.opener.goProcessRoster(); } -function valuesChanged() { +function valuesChanged() +{ setVisual(); g_rosterSettings.callsign = callsignNeed.value; @@ -2579,7 +3021,8 @@ function valuesChanged() { noMsg.checked && onlyMsg.checked && noMsgValue.value == onlyMsgValue.value - ) { + ) + { if (g_rosterSettings.noMsg) noMsg.checked = false; else onlyMsg.checked = false; } @@ -2600,43 +3043,51 @@ function valuesChanged() { g_scriptReport = Object(); for (var callHash in window.opener.g_callRoster) - window.opener.g_callRoster[callHash].callObj.alerted = false; + { window.opener.g_callRoster[callHash].callObj.alerted = false; } window.opener.goProcessRoster(); } -function getBuffer(file_url, callback, flag, mode, port, cookie) { +function getBuffer(file_url, callback, flag, mode, port, cookie) +{ var url = require("url"); var http = require(mode); var fileBuffer = null; var options = null; - if (cookie != 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, - port: port, - path: url.parse(file_url).path, + Cookie: cookie + } }; } - http.get(options, function (res) { + else + { + 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 + }; + } + http.get(options, function (res) + { var fsize = res.headers["content-length"]; 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) { + .on("data", function (data) + { if (fileBuffer == null) fileBuffer = data; else fileBuffer += data; }) - .on("end", function () { - if (typeof callback === "function") { + .on("end", function () + { + if (typeof callback === "function") + { // Call it, since we have confirmed it is callable callback(fileBuffer, flag, cookies); } @@ -2645,21 +3096,25 @@ function getBuffer(file_url, callback, flag, mode, port, cookie) { }); } -function callsignResult(buffer, flag) { +function callsignResult(buffer, flag) +{ var rawData = JSON.parse(buffer); 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(); } -function stateChangedValue(what) { - if (r_currentUSState != stateSelect.value && stateSelect.value != "") { +function stateChangedValue(what) +{ + if (r_currentUSState != stateSelect.value && stateSelect.value != "") + { r_currentUSState = stateSelect.value; - if (window.opener.g_mapSettings.offlineMode == false) { + if (window.opener.g_mapSettings.offlineMode == false) + { var callState = r_currentUSState.replace("CN-", ""); getBuffer( "http://app.gridtracker.org/callsigns/" + callState + ".callsigns.json", @@ -2668,7 +3123,9 @@ function stateChangedValue(what) { "http", 80 ); - } else { + } + else + { window.opener.goProcessRoster(); r_currentUSState = ""; g_currentUSCallsigns = null; @@ -2678,7 +3135,8 @@ function stateChangedValue(what) { } } - if (stateSelect.value == "") { + if (stateSelect.value == "") + { r_currentUSState = ""; g_currentUSCallsigns = null; @@ -2686,26 +3144,31 @@ function stateChangedValue(what) { } } -function DXCCsChangedValue(what) { +function DXCCsChangedValue(what) +{ r_currentDXCCs = DXCCsSelect.value; window.opener.goProcessRoster(); } -function initDXCCSelector() { - var items = Object.keys(window.opener.g_dxccToAltName).sort(function (a, b) { +function initDXCCSelector() +{ + var items = Object.keys(window.opener.g_dxccToAltName).sort(function (a, b) + { return window.opener.g_dxccToAltName[a].localeCompare( window.opener.g_dxccToAltName[b] ); }); var newSelect = document.getElementById("DXCCsSelect"); - for (var i in items) { + for (var i in items) + { var key = items[i]; if ( window.opener.g_worldGeoData[window.opener.g_dxccToGeoData[key]].geo != "deleted" - ) { + ) + { var option = document.createElement("option"); option.value = key; option.text = @@ -2720,16 +3183,21 @@ function initDXCCSelector() { newSelect.oninput = DXCCsChangedValue; } -function manifestResult(buffer, flag) { +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]) { + if (window.opener.g_enums[key]) + { option.value = key; option.text = window.opener.g_enums[key]; - } else { + } + else + { option.value = "CN-" + key; option.text = window.opener.g_enums["CN-" + key]; } @@ -2742,7 +3210,8 @@ function receiveMessage(event) {} var g_tracker = {}; -function updateWorked() { +function updateWorked() +{ g_worked = window.opener.g_tracker.worked; g_confirmed = window.opener.g_tracker.confirmed; g_modes = window.opener.g_modes; @@ -2752,152 +3221,171 @@ function updateWorked() { processAllAwardTrackers(); } -function deleteCallsignIgnore(key) { +function deleteCallsignIgnore(key) +{ delete g_blockedCalls[key]; storeBlocks(); openIgnoreEdit(); window.opener.goProcessRoster(); } -function deleteDxccIgnore(key) { +function deleteDxccIgnore(key) +{ delete g_blockedDxcc[key]; storeBlocks(); openIgnoreEdit(); window.opener.goProcessRoster(); } -function deleteCQIgnore(key) { +function deleteCQIgnore(key) +{ delete g_blockedCQ[key]; storeBlocks(); openIgnoreEdit(); window.opener.goProcessRoster(); } -function clearAllCallsignIgnores() { +function clearAllCallsignIgnores() +{ g_blockedCalls = Object(); storeBlocks(); openIgnoreEdit(); window.opener.goProcessRoster(); } -function clearAllDxccIgnores() { +function clearAllDxccIgnores() +{ g_blockedDxcc = Object(); storeBlocks(); openIgnoreEdit(); window.opener.goProcessRoster(); } -function clearAllCQIgnores() { +function clearAllCQIgnores() +{ g_blockedCQ = Object(); storeBlocks(); openIgnoreEdit(); window.opener.goProcessRoster(); } -function closeEditIgnores() { +function closeEditIgnores() +{ mainCallRoster.style.display = "block"; editView.style.display = "none"; } -function openIgnoreEdit() { +function openIgnoreEdit() +{ mainCallRoster.style.display = "none"; editView.style.display = "inline-block"; var worker = ""; var clearString = "noneClear All
" + - clearString + - ""; - Object.keys(g_blockedCalls) - .sort() - .forEach(function (key, i) { - worker += - ""; - }); - worker += "
Callsigns
" + - key + - "
"; - } + if (Object.keys(g_blockedCalls).length > 0) { - clearString = "
noneClear All
" + - clearString + - ""; - Object.keys(g_blockedCQ) - .sort() - .forEach(function (key, i) { - worker += - ""; - }); - worker += "
CQ
" + - key + - "
"; + clearString = + "
Clear All
" + + clearString + + ""; + Object.keys(g_blockedCalls) + .sort() + .forEach(function (key, i) + { + worker += + ""; + }); + worker += "
Callsigns
" + + key + + "
"; + clearString = "
nonenoneClear All
" + - 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 = + "
Clear All
" + + clearString + + ""; + Object.keys(g_blockedCQ) + .sort() + .forEach(function (key, i) + { + worker += + ""; + }); + worker += "
CQ
" + + key + + "
"; + + clearString = "
noneClear All
" + + 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; } -function onMyKeyDown(event) { - if (!g_regFocus) { +function onMyKeyDown(event) +{ + if (!g_regFocus) + { window.opener.onMyKeyDown(event); } } -function checkForEnter(ele) { - if (event.key === "Enter") { +function checkForEnter(ele) +{ + if (event.key === "Enter") + { ele.blur(); } } -function resize() { +function resize() +{ if (editView.style.display == "inline-block") openIgnoreEdit(); window.opener.goProcessRoster(); } -function init() { +function init() +{ g_callsignDatabaseDXCC = window.opener.g_callsignDatabaseDXCC; g_callsignDatabaseUS = window.opener.g_callsignDatabaseUS; g_callsignDatabaseUSplus = window.opener.g_callsignDatabaseUSplus; @@ -2906,13 +3394,14 @@ function init() { updateWorked(); - //addAllAwards(); + // addAllAwards(); window.addEventListener("message", receiveMessage, false); lockNewWindows(); if (window.opener.g_mapSettings.offlineMode == false) + { getBuffer( "http://app.gridtracker.org/callsigns/manifest.json", manifestResult, @@ -2920,14 +3409,16 @@ function init() { "http", 80 ); + } loadSettings(); 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]; + { document.getElementById(key).checked = g_rosterSettings.wanted[key]; } } g_menu = new nw.Menu(); @@ -2936,11 +3427,15 @@ function init() { var item = new nw.MenuItem({ type: "normal", label: g_rosterSettings.controls ? "Hide Controls" : "Show Controls", - click: function () { - if (this.label == "Hide Controls") { + click: function () + { + if (this.label == "Hide Controls") + { this.label = "Show Controls"; g_rosterSettings.controls = false; - } else { + } + else + { this.label = "Hide Controls"; g_rosterSettings.controls = true; } @@ -2949,18 +3444,22 @@ function init() { : "Show Controls"; localStorage.rosterSettings = JSON.stringify(g_rosterSettings); setVisual(); - }, + } }); g_menu.append(item); item = new nw.MenuItem({ type: "normal", label: g_rosterSettings.controls ? "Hide Controls" : "Show Controls", - click: function () { - if (this.label == "Hide Controls") { + click: function () + { + if (this.label == "Hide Controls") + { this.label = "Show Controls"; g_rosterSettings.controls = false; - } else { + } + else + { this.label = "Hide Controls"; g_rosterSettings.controls = true; } @@ -2969,29 +3468,31 @@ function init() { : "Show Controls"; localStorage.rosterSettings = JSON.stringify(g_rosterSettings); setVisual(); - }, + } }); g_compactMenu.append(item); item = new nw.MenuItem({ type: "normal", label: "Compact Mode", - click: function () { + click: function () + { g_rosterSettings.compact = true; localStorage.rosterSettings = JSON.stringify(g_rosterSettings); resize(); - }, + } }); g_menu.append(item); item = new nw.MenuItem({ type: "normal", label: "Roster Mode", - click: function () { + click: function () + { g_rosterSettings.compact = false; localStorage.rosterSettings = JSON.stringify(g_rosterSettings); resize(); - }, + } }); g_compactMenu.append(item); @@ -3000,9 +3501,10 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Lookup", - click: function () { + click: function () + { callLookup(g_targetHash, ""); - }, + } }); g_callMenu.append(item); @@ -3010,9 +3512,10 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Gen Msgs", - click: function () { + click: function () + { callGenMessage(g_targetHash, ""); - }, + } }); g_callMenu.append(item); @@ -3024,12 +3527,13 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Ignore Call", - click: function () { + click: function () + { var thisCall = callRoster[g_targetHash].DEcall; g_blockedCalls[thisCall] = true; storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_callMenu.append(item); @@ -3039,9 +3543,10 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Lookup", - click: function () { + click: function () + { callingLookup(g_targetHash, ""); - }, + } }); g_callingMenu.append(item); @@ -3049,9 +3554,10 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Gen Msgs", - click: function () { + click: function () + { callingGenMessage(g_targetHash, ""); - }, + } }); g_callingMenu.append(item); @@ -3063,30 +3569,33 @@ function init() { type: "checkbox", label: "Realtime", checked: g_rosterSettings.realtime, - click: function () { + click: function () + { g_rosterSettings.realtime = this.checked; writeRosterSettings(); window.opener.goProcessRoster(); - }, + } }); g_menu.append(item); item = new nw.MenuItem({ type: "separator" }); g_menu.append(item); - for (var key in g_rosterSettings.columns) { + for (var key in g_rosterSettings.columns) + { var itemx = new nw.MenuItem({ type: "checkbox", label: key, checked: g_rosterSettings.columns[key], - click: function () { + click: function () + { g_rosterSettings.columns[this.label] = this.checked; if (this.label == "Spot") - window.opener.setRosterSpot(g_rosterSettings.columns.Spot); + { window.opener.setRosterSpot(g_rosterSettings.columns.Spot); } writeRosterSettings(); window.opener.goProcessRoster(); resize(); - }, + } }); g_menu.append(itemx); @@ -3099,11 +3608,12 @@ function init() { type: "normal", label: "Clear Call Ignore", enabled: false, - click: function () { + click: function () + { g_blockedCalls = Object(); storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_menu.append(g_clearIgnores); @@ -3111,11 +3621,12 @@ function init() { type: "normal", label: "Clear Ignore", enabled: false, - click: function () { + click: function () + { g_blockedCalls = Object(); storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_callMenu.append(g_clearIgnoresCall); @@ -3124,7 +3635,8 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Ignore CQ from DXCC", - click: function () { + click: function () + { g_blockedCQ[ callRoster[g_targetCQ].DXcall + " from " + @@ -3132,7 +3644,7 @@ function init() { ] = true; storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_CQMenu.append(item); @@ -3140,11 +3652,12 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Ignore CQ from All", - click: function () { + click: function () + { g_blockedCQ[callRoster[g_targetCQ].DXcall + " from All"] = true; storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_CQMenu.append(item); @@ -3153,11 +3666,12 @@ function init() { type: "normal", label: "Clear CQ Ignore", enabled: false, - click: function () { + click: function () + { g_blockedCQ = Object(); storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_menu.append(g_clearCQIgnoreMainMenu); @@ -3165,11 +3679,12 @@ function init() { type: "normal", label: "Clear Ignore", enabled: false, - click: function () { + click: function () + { g_blockedCQ = Object(); storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_CQMenu.append(g_clearCQIgnore); @@ -3177,9 +3692,10 @@ function init() { type: "normal", label: "Edit Ignores", enabled: true, - click: function () { + click: function () + { openIgnoreEdit(); - }, + } }); g_CQMenu.append(item); @@ -3188,11 +3704,12 @@ function init() { item = new nw.MenuItem({ type: "normal", label: "Ignore DXCC", - click: function () { + click: function () + { g_blockedDxcc[g_targetDxcc] = true; storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_dxccMenu.append(item); @@ -3201,11 +3718,12 @@ function init() { type: "normal", label: "Clear DXCC Ignore", enabled: false, - click: function () { + click: function () + { g_blockedDxcc = Object(); storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_menu.append(g_clearDxccIgnoreMainMenu); @@ -3213,11 +3731,12 @@ function init() { type: "normal", label: "Clear Ignore", enabled: false, - click: function () { + click: function () + { g_blockedDxcc = Object(); storeBlocks(); window.opener.goProcessRoster(); - }, + } }); g_dxccMenu.append(g_clearDxccIgnore); @@ -3225,9 +3744,10 @@ function init() { type: "normal", label: "Edit Ignores", enabled: true, - click: function () { + click: function () + { openIgnoreEdit(); - }, + } }); g_menu.append(item); @@ -3235,9 +3755,10 @@ function init() { type: "normal", label: "Edit Ignores", enabled: true, - click: function () { + click: function () + { openIgnoreEdit(); - }, + } }); g_callMenu.append(item); @@ -3245,9 +3766,10 @@ function init() { type: "normal", label: "Edit Ignores", enabled: true, - click: function () { + click: function () + { openIgnoreEdit(); - }, + } }); g_dxccMenu.append(item); @@ -3299,143 +3821,176 @@ function init() { updateInstances(); } -function handleContextMenu(ev) { +function handleContextMenu(ev) +{ if (editView.style.display == "inline-block") return false; var mouseX = Math.round(ev.x); var mouseY = Math.round(ev.y); var len = Object.keys(g_blockedCalls).length; - if (len > 0) { + if (len > 0) + { g_clearIgnores.enabled = true; g_clearIgnores.label = "Clear Call Ignore" + (len > 1 ? "s (" + len + ")" : ""); g_clearIgnoresCall.enabled = true; g_clearIgnoresCall.label = "Clear Ignore" + (len > 1 ? "s (" + len + ")" : ""); - } else { + } + else + { g_clearIgnores.label = "Clear Call Ignore"; g_clearIgnores.enabled = false; g_clearIgnoresCall.label = "Clear Ignore"; g_clearIgnoresCall.enabled = false; } len = Object.keys(g_blockedDxcc).length; - if (len > 0) { + if (len > 0) + { g_clearDxccIgnoreMainMenu.enabled = true; g_clearDxccIgnoreMainMenu.label = "Clear DXCC Ignore" + (len > 1 ? "s (" + len + ")" : ""); g_clearDxccIgnore.enabled = true; g_clearDxccIgnore.label = "Clear Ignore" + (len > 1 ? "s (" + len + ")" : ""); - } else { + } + else + { g_clearDxccIgnoreMainMenu.label = "Clear DXCC Ignore"; g_clearDxccIgnoreMainMenu.enabled = false; g_clearDxccIgnore.label = "Clear Ignore"; g_clearDxccIgnore.enabled = false; } len = Object.keys(g_blockedCQ).length; - if (len > 0) { + if (len > 0) + { g_clearCQIgnoreMainMenu.enabled = true; g_clearCQIgnoreMainMenu.label = "Clear CQ Ignore" + (len > 1 ? "s (" + len + ")" : ""); g_clearCQIgnore.enabled = true; g_clearCQIgnore.label = "Clear Ignore" + (len > 1 ? "s (" + len + ")" : ""); - } else { + } + else + { g_clearCQIgnoreMainMenu.label = "Clear CQ Ignore"; g_clearCQIgnoreMainMenu.enabled = false; g_clearCQIgnore.label = "Clear Ignore"; g_clearCQIgnore.enabled = false; } - if (typeof ev.target != "undefined") { + if (typeof ev.target != "undefined") + { var name = ev.target.getAttribute("name"); - if (name == "Callsign") { + if (name == "Callsign") + { g_targetHash = ev.target.parentNode.id; g_callMenu.popup(mouseX, mouseY); - } else if (name == "Calling") { + } + else if (name == "Calling") + { g_targetHash = ev.target.parentNode.id; g_callingMenu.popup(mouseX, mouseY); - } else if (name == "CQ") { - if (callRoster[ev.target.parentNode.id].DXcall != "CQ") { + } + else if (name == "CQ") + { + if (callRoster[ev.target.parentNode.id].DXcall != "CQ") + { g_targetCQ = ev.target.parentNode.id; g_CQMenu.popup(mouseX, mouseY); } - } else if (name && name.startsWith("DXCC")) { + } + else if (name && name.startsWith("DXCC")) + { var dxcca = name.split("("); var dxcc = parseInt(dxcca[1]); g_targetDxcc = dxcc; g_dxccMenu.popup(mouseX, mouseY); - } else { - if (g_rosterSettings.compact == false) { + } + else + { + if (g_rosterSettings.compact == false) + { g_menu.popup(mouseX, mouseY); - } else { + } + else + { g_compactMenu.popup(mouseX, mouseY); } } - } else { - if (g_rosterSettings.compact == false) { + } + else + { + if (g_rosterSettings.compact == false) + { g_menu.popup(mouseX, mouseY); - } else { + } + else + { g_compactMenu.popup(mouseX, mouseY); } } - if (!g_developerMode) { + if (!g_developerMode) + { ev.preventDefault(); } return false; } -function getTypeFromMode(mode) { - if (mode in g_modes) { +function getTypeFromMode(mode) +{ + if (mode in g_modes) + { if (g_modes[mode] == true) return "Digital"; else if (g_modes_phone[mode] == true) return "Phone"; } return ""; } -function testAward(awardName, obj, baseHash) { +function testAward(awardName, obj, baseHash) +{ if ( g_awardTracker[awardName].test.dxcc && g_awardTracker[awardName].rule.dxcc.indexOf(obj.dxcc) == -1 ) - return false; + { return false; } if ( g_awardTracker[awardName].test.mode && g_awardTracker[awardName].rule.mode.indexOf(obj.mode) == -1 ) - return false; + { return false; } if ( g_awardTracker[awardName].test.band && g_awardTracker[awardName].rule.band.indexOf(obj.band) == -1 ) - return false; + { return false; } if ( g_awardTracker[awardName].test.DEcall && g_awardTracker[awardName].rule.call.indexOf(obj.DEcall) == -1 ) - return false; + { return false; } if ( g_awardTracker[awardName].test.cont && g_awardTracker[awardName].rule.cont.indexOf(obj.cont) == -1 ) - return false; + { return false; } if ( g_awardTracker[awardName].test.prop && g_awardTracker[awardName].rule.propMode != obj.propMode ) - return false; + { return false; } if ( g_awardTracker[awardName].test.sat && g_awardTracker[awardName].rule.satName.indexOf(obj.satName) == -1 ) - return false; + { return false; } return g_awardTypes[g_awardTracker[awardName].rule.type].test( g_awardTracker[awardName], @@ -3444,7 +3999,8 @@ function testAward(awardName, obj, baseHash) { ); } -function processAward(awardName) { +function processAward(awardName) +{ var award = g_awards[g_awardTracker[awardName].sponsor].awards[ g_awardTracker[awardName].name @@ -3495,7 +4051,8 @@ function processAward(awardName) { g_awardTracker[awardName].stat = {}; - for (var i in window.opener.g_QSOhash) { + for (var i in window.opener.g_QSOhash) + { var obj = window.opener.g_QSOhash[i]; if (test.confirmed && !obj.confirmed) continue; @@ -3526,36 +4083,41 @@ function processAward(awardName) { g_awardTracker[awardName].stat = {}; } -function newAwardCountObject() { +function newAwardCountObject() +{ var statCountObject = {}; statCountObject.bands = {}; - statCountObject.bands["Mixed"] = {}; - statCountObject.bands["Digital"] = {}; - statCountObject.bands["Phone"] = {}; + statCountObject.bands.Mixed = {}; + statCountObject.bands.Digital = {}; + statCountObject.bands.Phone = {}; statCountObject.modes = {}; - statCountObject.modes["Mixed"] = {}; - statCountObject.modes["Digital"] = {}; - statCountObject.modes["Phone"] = {}; + statCountObject.modes.Mixed = {}; + statCountObject.modes.Digital = {}; + statCountObject.modes.Phone = {}; statCountObject.unique = null; return statCountObject; } -function workAwardObject(obj, band, mode, isDigital, isPhone, unique = null) { - obj.bands["Mixed"][band] = ~~obj.bands["Mixed"][band] + 1; +function workAwardObject(obj, band, mode, isDigital, isPhone, unique = null) +{ + obj.bands.Mixed[band] = ~~obj.bands.Mixed[band] + 1; if (!(mode in obj.bands)) obj.bands[mode] = {}; obj.bands[mode][band] = ~~obj.bands[mode][band] + 1; - obj.modes["Mixed"][mode] = ~~obj.modes["Mixed"][mode] + 1; + obj.modes.Mixed[mode] = ~~obj.modes.Mixed[mode] + 1; - if (isDigital) { - obj.bands["Digital"][band] = ~~obj.bands["Digital"][band] + 1; - obj.modes["Digital"][mode] = ~~obj.modes["Digital"][mode] + 1; + if (isDigital) + { + obj.bands.Digital[band] = ~~obj.bands.Digital[band] + 1; + obj.modes.Digital[mode] = ~~obj.modes.Digital[mode] + 1; } - if (isPhone) { - obj.bands["Phone"][band] = ~~obj.bands["Phone"][band] + 1; - obj.modes["Phone"][mode] = ~~obj.modes["Phone"][mode] + 1; + if (isPhone) + { + obj.bands.Phone[band] = ~~obj.bands.Phone[band] + 1; + obj.modes.Phone[mode] = ~~obj.modes.Phone[mode] + 1; } - if (unique) { + if (unique) + { if (obj.unique == null) obj.unique = {}; if (!(unique in obj.unique)) obj.unique[unique] = newAwardCountObject(); workAwardObject(obj.unique[unique], band, mode, isDigital, isPhone); @@ -3563,7 +4125,8 @@ function workAwardObject(obj, band, mode, isDigital, isPhone, unique = null) { return true; } -function buildAwardTypeHandlers() { +function buildAwardTypeHandlers() +{ g_awardTypes = { IOTA: { name: "Islands On The Air" }, call: { name: "Callsign" }, @@ -3585,80 +4148,82 @@ function buildAwardTypeHandlers() { cont2band: { name: "Continents per Band" }, calls2band: { name: "Stations per Band" }, dxcc2band: { name: "DXCC per Band" }, - states2band: { name: "States per Band" }, + states2band: { name: "States per Band" } }; - g_awardTypes["IOTA"].score = scoreAIOTA; - g_awardTypes["call"].score = scoreAcall; - g_awardTypes["callarea"].score = scoreAcallarea; - g_awardTypes["calls2dxcc"].score = scoreAcalls2dxcc; - g_awardTypes["cnty"].score = scoreAcnty; - g_awardTypes["cont"].score = scoreAcont; - g_awardTypes["cont5"].score = scoreAcont5; - g_awardTypes["cont52band"].score = scoreAcont52band; - g_awardTypes["cqz"].score = scoreAcqz; - g_awardTypes["dxcc"].score = scoreAdxcc; - g_awardTypes["grids"].score = scoreAgrids; - g_awardTypes["numsfx"].score = scoreAnumsfx; - g_awardTypes["px"].score = scoreApx; - g_awardTypes["pxa"].score = scoreApxa; - g_awardTypes["pxplus"].score = scoreApxplus; - g_awardTypes["sfx"].score = scoreAsfx; - g_awardTypes["states"].score = scoreAstates; - g_awardTypes["cont2band"].score = scoreAcont2band; - g_awardTypes["calls2band"].score = scoreAcalls2band; - g_awardTypes["dxcc2band"].score = scoreAdxcc2band; - g_awardTypes["states2band"].score = scoreAstates2band; + g_awardTypes.IOTA.score = scoreAIOTA; + g_awardTypes.call.score = scoreAcall; + g_awardTypes.callarea.score = scoreAcallarea; + g_awardTypes.calls2dxcc.score = scoreAcalls2dxcc; + g_awardTypes.cnty.score = scoreAcnty; + g_awardTypes.cont.score = scoreAcont; + g_awardTypes.cont5.score = scoreAcont5; + g_awardTypes.cont52band.score = scoreAcont52band; + g_awardTypes.cqz.score = scoreAcqz; + g_awardTypes.dxcc.score = scoreAdxcc; + g_awardTypes.grids.score = scoreAgrids; + g_awardTypes.numsfx.score = scoreAnumsfx; + g_awardTypes.px.score = scoreApx; + g_awardTypes.pxa.score = scoreApxa; + g_awardTypes.pxplus.score = scoreApxplus; + g_awardTypes.sfx.score = scoreAsfx; + g_awardTypes.states.score = scoreAstates; + g_awardTypes.cont2band.score = scoreAcont2band; + g_awardTypes.calls2band.score = scoreAcalls2band; + g_awardTypes.dxcc2band.score = scoreAdxcc2band; + g_awardTypes.states2band.score = scoreAstates2band; - g_awardTypes["IOTA"].test = testAIOTA; - g_awardTypes["call"].test = testAcall; - g_awardTypes["callarea"].test = testAcallarea; - g_awardTypes["calls2dxcc"].test = testAcalls2dxcc; - g_awardTypes["cnty"].test = testAcnty; - g_awardTypes["cont"].test = testAcont; - g_awardTypes["cont5"].test = testAcont5; - g_awardTypes["cont52band"].test = testAcont52band; - g_awardTypes["cqz"].test = testAcqz; - g_awardTypes["dxcc"].test = testAdxcc; - g_awardTypes["grids"].test = testAgrids; - g_awardTypes["numsfx"].test = testAnumsfx; - g_awardTypes["px"].test = testApx; - g_awardTypes["pxa"].test = testApxa; - g_awardTypes["pxplus"].test = testApxplus; - g_awardTypes["sfx"].test = testAsfx; - g_awardTypes["states"].test = testAstates; - g_awardTypes["cont2band"].test = testAcont2band; - g_awardTypes["calls2band"].test = testAcalls2band; - g_awardTypes["dxcc2band"].test = testAdxcc2band; - g_awardTypes["states2band"].test = testAstates2band; + g_awardTypes.IOTA.test = testAIOTA; + g_awardTypes.call.test = testAcall; + g_awardTypes.callarea.test = testAcallarea; + g_awardTypes.calls2dxcc.test = testAcalls2dxcc; + g_awardTypes.cnty.test = testAcnty; + g_awardTypes.cont.test = testAcont; + g_awardTypes.cont5.test = testAcont5; + g_awardTypes.cont52band.test = testAcont52band; + g_awardTypes.cqz.test = testAcqz; + g_awardTypes.dxcc.test = testAdxcc; + g_awardTypes.grids.test = testAgrids; + g_awardTypes.numsfx.test = testAnumsfx; + g_awardTypes.px.test = testApx; + g_awardTypes.pxa.test = testApxa; + g_awardTypes.pxplus.test = testApxplus; + g_awardTypes.sfx.test = testAsfx; + g_awardTypes.states.test = testAstates; + g_awardTypes.cont2band.test = testAcont2band; + g_awardTypes.calls2band.test = testAcalls2band; + g_awardTypes.dxcc2band.test = testAdxcc2band; + g_awardTypes.states2band.test = testAstates2band; - g_awardTypes["IOTA"].compile = singleCompile; - g_awardTypes["call"].compile = singleCompile; - g_awardTypes["callarea"].compile = singleCompile; - g_awardTypes["calls2dxcc"].compile = doubleCompile; - g_awardTypes["cnty"].compile = singleCompile; - g_awardTypes["cont"].compile = singleCompile; - g_awardTypes["cont5"].compile = singleCompile; - g_awardTypes["cont52band"].compile = doubleCompile; - g_awardTypes["cqz"].compile = singleCompile; - g_awardTypes["dxcc"].compile = singleCompile; - g_awardTypes["grids"].compile = singleCompile; - g_awardTypes["numsfx"].compile = singleCompile; - g_awardTypes["px"].compile = singleCompile; - g_awardTypes["pxa"].compile = singleCompile; - g_awardTypes["pxplus"].compile = singleCompile; - g_awardTypes["sfx"].compile = singleCompile; - g_awardTypes["states"].compile = singleCompile; - g_awardTypes["cont2band"].compile = doubleCompile; - g_awardTypes["calls2band"].compile = doubleCompile; - g_awardTypes["dxcc2band"].compile = doubleCompile; - g_awardTypes["states2band"].compile = doubleCompile; + g_awardTypes.IOTA.compile = singleCompile; + g_awardTypes.call.compile = singleCompile; + g_awardTypes.callarea.compile = singleCompile; + g_awardTypes.calls2dxcc.compile = doubleCompile; + g_awardTypes.cnty.compile = singleCompile; + g_awardTypes.cont.compile = singleCompile; + g_awardTypes.cont5.compile = singleCompile; + g_awardTypes.cont52band.compile = doubleCompile; + g_awardTypes.cqz.compile = singleCompile; + g_awardTypes.dxcc.compile = singleCompile; + g_awardTypes.grids.compile = singleCompile; + g_awardTypes.numsfx.compile = singleCompile; + g_awardTypes.px.compile = singleCompile; + g_awardTypes.pxa.compile = singleCompile; + g_awardTypes.pxplus.compile = singleCompile; + g_awardTypes.sfx.compile = singleCompile; + g_awardTypes.states.compile = singleCompile; + g_awardTypes.cont2band.compile = doubleCompile; + g_awardTypes.calls2band.compile = doubleCompile; + g_awardTypes.dxcc2band.compile = doubleCompile; + g_awardTypes.states2band.compile = doubleCompile; } -function scoreAstates(award, obj) { - if (obj.state) { +function scoreAstates(award, obj) +{ + if (obj.state) + { if (!(obj.state in award.stat)) - award.stat[obj.state] = newAwardCountObject(); + { award.stat[obj.state] = newAwardCountObject(); } return workAwardObject( award.stat[obj.state], obj.band, @@ -3670,15 +4235,19 @@ function scoreAstates(award, obj) { return false; } -function testAstates(award, obj, baseHash) { - if (obj.state && obj.state + baseHash in g_tracker[award.test.look].state) { +function testAstates(award, obj, baseHash) +{ + if (obj.state && obj.state + baseHash in g_tracker[award.test.look].state) + { return false; } return true; } -function scoreAstates2band(award, obj) { - if (obj.state) { +function scoreAstates2band(award, obj) +{ + if (obj.state) + { if (!(obj.band in award.stat)) award.stat[obj.band] = newAwardCountObject(); return workAwardObject( award.stat[obj.band], @@ -3692,14 +4261,17 @@ function scoreAstates2band(award, obj) { return false; } -function testAstates2band(award, obj, baseHash) { - if (obj.state && obj.state + baseHash in g_tracker[award.test.look].state) { +function testAstates2band(award, obj, baseHash) +{ + if (obj.state && obj.state + baseHash in g_tracker[award.test.look].state) + { return false; } return true; } -function scoreAdxcc(award, obj) { +function scoreAdxcc(award, obj) +{ if (!(obj.dxcc in award.stat)) award.stat[obj.dxcc] = newAwardCountObject(); return workAwardObject( award.stat[obj.dxcc], @@ -3710,15 +4282,19 @@ function scoreAdxcc(award, obj) { ); } -function testAdxcc(award, obj, baseHash) { - if (String(obj.dxcc) + baseHash in g_tracker[award.test.look].dxcc) { +function testAdxcc(award, obj, baseHash) +{ + if (String(obj.dxcc) + baseHash in g_tracker[award.test.look].dxcc) + { return false; } return true; } -function scoreAcont(award, obj) { - if (obj.cont) { +function scoreAcont(award, obj) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "AN") cont = "OC"; if (!(cont in award.stat)) award.stat[cont] = newAwardCountObject(); @@ -3733,20 +4309,25 @@ function scoreAcont(award, obj) { return false; } -function testAcont(award, obj, baseHash) { - if (obj.cont) { +function testAcont(award, obj, baseHash) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "AN") cont = "OC"; - if (cont + baseHash in g_tracker[award.test.look].cont) { + if (cont + baseHash in g_tracker[award.test.look].cont) + { return false; } } return true; } -function scoreAcont5(award, obj, baseHash) { - if (obj.cont) { +function scoreAcont5(award, obj, baseHash) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "NA" || cont == "SA") cont = "AM"; if (cont == "AN") cont = "OC"; @@ -3763,20 +4344,24 @@ function scoreAcont5(award, obj, baseHash) { return false; } -function testAcont5(award, obj, baseHash) { - if (obj.cont) { +function testAcont5(award, obj, baseHash) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "NA" || cont == "SA") cont = "AM"; if (cont == "AN") cont = "OC"; - if (cont + baseHash in g_tracker[award.test.look].cont) { + if (cont + baseHash in g_tracker[award.test.look].cont) + { return false; } } return true; } -function scoreAcont2band(award, obj) { +function scoreAcont2band(award, obj) +{ if (!(obj.band in award.stat)) award.stat[obj.band] = newAwardCountObject(); return workAwardObject( @@ -3789,20 +4374,25 @@ function scoreAcont2band(award, obj) { ); } -function testAcont2band(award, obj, baseHash) { - if (obj.cont) { +function testAcont2band(award, obj, baseHash) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "AN") cont = "OC"; - if (cont + baseHash in g_tracker[award.test.look].cont) { + if (cont + baseHash in g_tracker[award.test.look].cont) + { return false; } } return true; } -function scoreAcont52band(award, obj) { - if (obj.cont) { +function scoreAcont52band(award, obj) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "NA" || cont == "SA") cont = "AM"; if (cont == "AN") cont = "OC"; @@ -3820,21 +4410,26 @@ function scoreAcont52band(award, obj) { return false; } -function testAcont52band(award, obj, baseHash) { - if (obj.cont) { +function testAcont52band(award, obj, baseHash) +{ + if (obj.cont) + { var cont = obj.cont; if (cont == "NA" || cont == "SA") cont = "AM"; if (cont == "AN") cont = "OC"; - if (cont + baseHash in g_tracker[award.test.look].cont) { + if (cont + baseHash in g_tracker[award.test.look].cont) + { return false; } } return true; } -function scoreAgrids(award, obj) { - if (obj.grid) { +function scoreAgrids(award, obj) +{ + if (obj.grid) + { var grid = obj.grid.substr(0, 4); if (!(grid in award.stat)) award.stat[grid] = newAwardCountObject(); @@ -3849,15 +4444,19 @@ function scoreAgrids(award, obj) { return false; } -function testAgrids(award, obj, baseHash) { - if (obj.grid && obj.grid + baseHash in g_tracker[award.test.look].grid) { +function testAgrids(award, obj, baseHash) +{ + if (obj.grid && obj.grid + baseHash in g_tracker[award.test.look].grid) + { return false; } return true; } -function scoreAcnty(award, obj) { - if (obj.cnty) { +function scoreAcnty(award, obj) +{ + if (obj.cnty) + { if (!(obj.cnty in award.stat)) award.stat[obj.cnty] = newAwardCountObject(); return workAwardObject( award.stat[obj.cnty], @@ -3870,17 +4469,21 @@ function scoreAcnty(award, obj) { return false; } -function testAcnty(award, obj, baseHash) { - if (obj.cnty && obj.cnty + baseHash in g_tracker[award.test.look].cnty) { +function testAcnty(award, obj, baseHash) +{ + if (obj.cnty && obj.cnty + baseHash in g_tracker[award.test.look].cnty) + { return false; } return true; } -function scoreAcall(award, obj) { +function scoreAcall(award, obj) +{ var call = obj.DEcall; - if (call.indexOf("/") > -1) { + if (call.indexOf("/") > -1) + { if (call.endsWith("/MM")) return false; call = call.replace("/P", "").replace("/R", "").replace("/QRP"); } @@ -3895,21 +4498,25 @@ function scoreAcall(award, obj) { ); } -function testAcall(award, obj, baseHash) { +function testAcall(award, obj, baseHash) +{ if (obj.DEcall.indexOf("/") > -1 && obj.DEcall.endsWith("/MM")) return false; - if (obj.DEcall + baseHash in g_tracker[award.test.look].call) { + if (obj.DEcall + baseHash in g_tracker[award.test.look].call) + { return false; } return true; } -function scoreAIOTA(award, obj) { - if (obj.IOTA) { +function scoreAIOTA(award, obj) +{ + if (obj.IOTA) + { var test = g_awards[award.sponsor].awards[award.name]; if ("IOTA" in test.rule && test.rule.IOTA.indexOf(obj.IOTA) == -1) - return false; + { return false; } if (!(obj.IOTA in award.stat)) award.stat[obj.IOTA] = newAwardCountObject(); return workAwardObject( @@ -3924,25 +4531,28 @@ function scoreAIOTA(award, obj) { } // NO IOTA YET -function testAIOTA(award, obj, baseHash) { - /*if ( obj.IOTA ) - { - var test = g_awards[award.sponsor].awards[award.name]; +function testAIOTA(award, obj, baseHash) +{ + /* if ( obj.IOTA ) + { + 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; } -function scoreAcallarea(award, obj) { - if (obj.zone != null) { +function scoreAcallarea(award, obj) +{ + if (obj.zone != null) + { var test = g_awards[award.sponsor].awards[award.name]; if ("zone" in test.rule && test.rule.zone.indexOf(obj.zone) == -1) - return false; + { return false; } if (!(obj.zone in award.stat)) award.stat[obj.zone] = newAwardCountObject(); return workAwardObject( @@ -3956,21 +4566,26 @@ function scoreAcallarea(award, obj) { return false; } -function testAcallarea(award, obj, baseHash) { - if (obj.zone != null) { +function testAcallarea(award, obj, baseHash) +{ + if (obj.zone != null) + { var test = g_awards[award.sponsor].awards[award.name]; if ("zone" in test.rule && test.rule.zone.indexOf(obj.zone) == -1) - return false; + { return false; } } return true; } -function scoreApx(award, obj) { - if (obj.px) { +function scoreApx(award, obj) +{ + if (obj.px) + { var test = g_awards[award.sponsor].awards[award.name]; var px = obj.px; - if ("px" in test.rule) { + if ("px" in test.rule) + { px = px.substr(0, test.rule.px[0].length); if (test.rule.px.indexOf(px) == -1) return false; } @@ -3987,27 +4602,35 @@ function scoreApx(award, obj) { return false; } -function testApx(award, obj, baseHash) { - if (obj.px) { +function testApx(award, obj, baseHash) +{ + if (obj.px) + { var test = g_awards[award.sponsor].awards[award.name]; var px = obj.px; - if ("px" in test.rule) { + if ("px" in test.rule) + { px = px.substr(0, test.rule.px[0].length); if (test.rule.px.indexOf(px) == -1) return false; } - if (String(obj.px) + baseHash in g_tracker[award.test.look].px) { + if (String(obj.px) + baseHash in g_tracker[award.test.look].px) + { return false; } } return true; } -function scoreApxa(award, obj) { - if (obj.px) { +function scoreApxa(award, obj) +{ + if (obj.px) + { var test = g_awards[award.sponsor].awards[award.name]; - for (var i in test.rule.pxa) { - if (test.rule.pxa[i].indexOf(obj.px) > -1) { + for (var i in test.rule.pxa) + { + if (test.rule.pxa[i].indexOf(obj.px) > -1) + { if (!(i in award.stat)) award.stat[i] = newAwardCountObject(); return workAwardObject( award.stat[i], @@ -4022,14 +4645,21 @@ function scoreApxa(award, obj) { return false; } -function testApxa(award, obj, baseHash) { - if (obj.px) { +function testApxa(award, obj, baseHash) +{ + if (obj.px) + { var test = g_awards[award.sponsor].awards[award.name]; - for (var i in test.rule.pxa) { - if (test.rule.pxa[i].indexOf(obj.px) > -1) { - if (String(obj.px) + baseHash in g_tracker[award.test.look].px) { + for (var i in test.rule.pxa) + { + if (test.rule.pxa[i].indexOf(obj.px) > -1) + { + if (String(obj.px) + baseHash in g_tracker[award.test.look].px) + { return false; - } else { + } + else + { return true; } } @@ -4038,12 +4668,16 @@ function testApxa(award, obj, baseHash) { return false; } -function scoreAsfx(award, obj) { +function scoreAsfx(award, obj) +{ var test = g_awards[award.sponsor].awards[award.name]; var suf = obj.DEcall.replace(obj.px, ""); - for (var i in test.rule.sfx) { - for (var s in test.rule.sfx[i]) { - if (suf.indexOf(test.rule.sfx[i][s]) == 0) { + for (var i in test.rule.sfx) + { + for (var s in test.rule.sfx[i]) + { + if (suf.indexOf(test.rule.sfx[i][s]) == 0) + { if (!(i in award.stat)) award.stat[i] = newAwardCountObject(); return workAwardObject( award.stat[i], @@ -4059,12 +4693,16 @@ function scoreAsfx(award, obj) { return false; } -function testAsfx(award, obj, baseHash) { +function testAsfx(award, obj, baseHash) +{ var test = g_awards[award.sponsor].awards[award.name]; var suf = obj.DEcall.replace(obj.px, ""); - for (var i in test.rule.sfx) { - for (var s in test.rule.sfx[i]) { - if (suf.indexOf(test.rule.sfx[i][s]) == 0) { + for (var i in test.rule.sfx) + { + for (var s in test.rule.sfx[i]) + { + if (suf.indexOf(test.rule.sfx[i][s]) == 0) + { return false; } } @@ -4073,7 +4711,8 @@ function testAsfx(award, obj, baseHash) { return true; } -function scoreAcalls2dxcc(award, obj) { +function scoreAcalls2dxcc(award, obj) +{ if (!(obj.dxcc in award.stat)) award.stat[obj.dxcc] = newAwardCountObject(); return workAwardObject( @@ -4086,14 +4725,17 @@ function scoreAcalls2dxcc(award, obj) { ); } -function testAcalls2dxcc(award, obj, baseHash) { - if (obj.DEcall + baseHash in g_tracker[award.test.look].call) { +function testAcalls2dxcc(award, obj, baseHash) +{ + if (obj.DEcall + baseHash in g_tracker[award.test.look].call) + { return false; } return true; } -function scoreAcalls2band(award, obj) { +function scoreAcalls2band(award, obj) +{ if (!(obj.band in award.stat)) award.stat[obj.band] = newAwardCountObject(); return workAwardObject( @@ -4106,14 +4748,17 @@ function scoreAcalls2band(award, obj) { ); } -function testAcalls2band(award, obj, baseHash) { - if (obj.DEcall + baseHash in g_tracker[award.test.look].call) { +function testAcalls2band(award, obj, baseHash) +{ + if (obj.DEcall + baseHash in g_tracker[award.test.look].call) + { return false; } return true; } -function scoreAdxcc2band(award, obj) { +function scoreAdxcc2band(award, obj) +{ if (!(obj.band in award.stat)) award.stat[obj.band] = newAwardCountObject(); return workAwardObject( @@ -4126,15 +4771,19 @@ function scoreAdxcc2band(award, obj) { ); } -function testAdxcc2band(award, obj, baseHash) { - if (String(obj.dxcc) + baseHash in g_tracker[award.test.look].dxcc) { +function testAdxcc2band(award, obj, baseHash) +{ + if (String(obj.dxcc) + baseHash in g_tracker[award.test.look].dxcc) + { return false; } return true; } -function scoreAcqz(award, obj) { - if (obj.cqz) { +function scoreAcqz(award, obj) +{ + if (obj.cqz) + { if (!(obj.cqz in award.stat)) award.stat[obj.cqz] = newAwardCountObject(); return workAwardObject( @@ -4148,10 +4797,13 @@ function scoreAcqz(award, obj) { return false; } -function testAcqz(award, obj, baseHash) { - if (obj.cqza) { +function testAcqz(award, obj, baseHash) +{ + if (obj.cqza) + { var x = 0; - for (var z in obj.cqza) { + for (var z in obj.cqza) + { if (obj.cqza[z] + baseHash in g_tracker[award.test.look].cqz) x++; } if (obj.cqza.length == x) return false; @@ -4159,14 +4811,18 @@ function testAcqz(award, obj, baseHash) { return true; } -function scoreAnumsfx(award, obj) { +function scoreAnumsfx(award, obj) +{ var test = g_awards[award.sponsor].awards[award.name]; var px = obj.px.substr(0, obj.px.length - 1); var suf = obj.DEcall.replace(px, ""); suf = suf.substr(0, test.rule.numsfx[0][0].length); - for (var i in test.rule.numsfx) { - for (var s in test.rule.numsfx[i]) { - if (suf.indexOf(test.rule.numsfx[i][s]) == 0) { + for (var i in test.rule.numsfx) + { + for (var s in test.rule.numsfx[i]) + { + if (suf.indexOf(test.rule.numsfx[i][s]) == 0) + { if (!(i in award.stat)) award.stat[i] = newAwardCountObject(); return workAwardObject( award.stat[i], @@ -4182,14 +4838,18 @@ function scoreAnumsfx(award, obj) { return false; } -function testAnumsfx(award, obj) { +function testAnumsfx(award, obj) +{ var test = g_awards[award.sponsor].awards[award.name]; var px = obj.px.substr(0, obj.px.length - 1); var suf = obj.DEcall.replace(px, ""); suf = suf.substr(0, test.rule.numsfx[0][0].length); - for (var i in test.rule.numsfx) { - for (var s in test.rule.numsfx[i]) { - if (suf.indexOf(test.rule.numsfx[i][s]) == 0) { + for (var i in test.rule.numsfx) + { + for (var s in test.rule.numsfx[i]) + { + if (suf.indexOf(test.rule.numsfx[i][s]) == 0) + { return false; } } @@ -4198,12 +4858,16 @@ function testAnumsfx(award, obj) { return true; } -function scoreApxplus(award, obj) { +function scoreApxplus(award, obj) +{ var test = g_awards[award.sponsor].awards[award.name]; - if (test.rule.pxplus) { - for (var i in test.rule.pxplus) { - if (obj.DEcall.indexOf(test.rule.pxplus[i]) == 0) { + if (test.rule.pxplus) + { + for (var i in test.rule.pxplus) + { + if (obj.DEcall.indexOf(test.rule.pxplus[i]) == 0) + { if (!(i in award.stat)) award.stat[i] = newAwardCountObject(); return workAwardObject( award.stat[i], @@ -4218,12 +4882,16 @@ function scoreApxplus(award, obj) { return false; } -function testApxplus(award, obj) { +function testApxplus(award, obj) +{ var test = g_awards[award.sponsor].awards[award.name]; - if (test.rule.pxplus) { - for (var i in test.rule.pxplus) { - if (obj.DEcall.indexOf(test.rule.pxplus[i]) == 0) { + if (test.rule.pxplus) + { + for (var i in test.rule.pxplus) + { + if (obj.DEcall.indexOf(test.rule.pxplus[i]) == 0) + { return false; } } @@ -4231,36 +4899,46 @@ function testApxplus(award, obj) { return true; } -function loadAwardJson() { +function loadAwardJson() +{ g_awards = {}; var fs = require("fs"); - if (fs.existsSync("./data/awards.json")) { + if (fs.existsSync("./data/awards.json")) + { fileBuf = fs.readFileSync("./data/awards.json"); - try { + try + { g_awards = JSON.parse(fileBuf); - //fs.writeFileSync("./data/awards.json", JSON.stringify(g_awards,null,2)); + // fs.writeFileSync("./data/awards.json", JSON.stringify(g_awards,null,2)); - for (var sp in g_awards) { - for (var aw in g_awards[sp].awards) { + for (var sp in g_awards) + { + for (var aw in g_awards[sp].awards) + { if (!("unique" in g_awards[sp].awards[aw].rule)) - g_awards[sp].awards[aw].rule.unique = 1; + { g_awards[sp].awards[aw].rule.unique = 1; } - if (g_awards[sp].awards[aw].rule.band[0] == "Mixed") { + if (g_awards[sp].awards[aw].rule.band[0] == "Mixed") + { g_awards[sp].awards[aw].rule.band.shift(); } - if (g_awards[sp].awards[aw].rule.band.length == 0) { + if (g_awards[sp].awards[aw].rule.band.length == 0) + { g_awards[sp].awards[aw].rule.band = []; - for (var key in g_awards[sp].mixed) { + for (var key in g_awards[sp].mixed) + { g_awards[sp].awards[aw].rule.band.push(g_awards[sp].mixed[key]); } } if ( g_awards[sp].awards[aw].rule.endorse.length == 1 && g_awards[sp].awards[aw].rule.endorse[0] == "Mixed" - ) { + ) + { g_awards[sp].awards[aw].rule.endorse = []; - for (var key in g_awards[sp].mixed) { + for (var key in g_awards[sp].mixed) + { g_awards[sp].awards[aw].rule.endorse.push( g_awards[sp].mixed[key] ); @@ -4270,17 +4948,22 @@ function loadAwardJson() { } buildAwardTypeHandlers(); - } catch (e) { + } + catch (e) + { alert("Core awards.json : " + e); g_awards = {}; } - delete filebuf; - } else alert("Missing core awards.json"); + } + else alert("Missing core awards.json"); } -function processAllAwardTrackers() { - for (var tracker in g_awardTracker) { - if (!(g_awardTracker[tracker].sponsor in g_awards)) { +function processAllAwardTrackers() +{ + for (var tracker in g_awardTracker) + { + if (!(g_awardTracker[tracker].sponsor in g_awards)) + { delete g_awardTracker[tracker]; continue; } @@ -4289,7 +4972,8 @@ function processAllAwardTrackers() { g_awardTracker[tracker].name in g_awards[g_awardTracker[tracker].sponsor].awards ) - ) { + ) + { delete g_awardTracker[tracker]; continue; } @@ -4298,27 +4982,32 @@ function processAllAwardTrackers() { updateAwardList(); } -function newAwardTrackerObject(sponsor, award, enable) { +function newAwardTrackerObject(sponsor, award, enable) +{ var newAward = {}; newAward.sponsor = sponsor; newAward.name = award; 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; } -function addAllAwards() { - for (var sponsor in g_awards) { - for (var award in g_awards[sponsor].awards) { +function addAllAwards() +{ + for (var sponsor in g_awards) + { + for (var award in g_awards[sponsor].awards) + { var awardToAdd = newAwardTrackerObject(sponsor, award, true); var hash = awardToAdd.name + "-" + awardToAdd.sponsor; - if (!(hash in g_awardTracker)) { + if (!(hash in g_awardTracker)) + { g_awardTracker[hash] = awardToAdd; processAward(hash); storeAwardTracker(); @@ -4329,14 +5018,16 @@ function addAllAwards() { window.opener.goProcessRoster(); } -function delAllAwards() { +function delAllAwards() +{ g_awardTracker = {}; storeAwardTracker(); updateAwardList(); window.opener.goProcessRoster(); } -function newCompileCountObject() { +function newCompileCountObject() +{ var compileCountObject = {}; compileCountObject.bands = {}; compileCountObject.modes = {}; @@ -4345,47 +5036,57 @@ function newCompileCountObject() { return compileCountObject; } -function singleCompile(award, obj) { +function singleCompile(award, obj) +{ var test = g_awards[award.sponsor].awards[award.name]; var rule = test.rule; var comp = newCompileCountObject(); - for (var mode in rule.mode) { + for (var mode in rule.mode) + { comp.modes[rule.mode[mode]] = 0; comp.bands[rule.mode[mode]] = {}; - for (var band in rule.band) { + for (var band in rule.band) + { comp.bands[rule.mode[mode]][rule.band[band]] = 0; } - for (var key in obj) { + for (var key in obj) + { if ( rule.mode[mode] in obj[key].bands && Object.keys(obj[key].bands[rule.mode[mode]]).length - ) { + ) + { comp.modes[rule.mode[mode]] += 1; - for (var band in rule.band) { + for (var band in rule.band) + { if (rule.band[band] in obj[key].bands[rule.mode[mode]]) - comp.bands[rule.mode[mode]][rule.band[band]] += 1; + { comp.bands[rule.mode[mode]][rule.band[band]] += 1; } } } } } - for (var mode in comp.modes) { + for (var mode in comp.modes) + { comp.endorse[mode] = {}; comp.counts[mode] = {}; - for (var cnts in rule.count) { + for (var cnts in rule.count) + { comp.counts[mode][rule.count[cnts]] = { num: comp.modes[mode], per: parseInt( Math.min(100, (comp.modes[mode] / rule.count[cnts]) * 100.0) - ), + ) }; } - for (var endorse in rule.endorse) { + for (var endorse in rule.endorse) + { comp.endorse[mode][rule.endorse[endorse]] = {}; - for (var cnts in rule.count) { + for (var cnts in rule.count) + { comp.endorse[mode][rule.endorse[endorse]][rule.count[cnts]] = comp.bands[mode][rule.endorse[endorse]] >= rule.count[cnts]; } @@ -4395,34 +5096,43 @@ function singleCompile(award, obj) { return comp; } -function doubleCompile(award, firstLevel) { +function doubleCompile(award, firstLevel) +{ var test = g_awards[award.sponsor].awards[award.name]; var rule = test.rule; - for (var k in firstLevel) { + for (var k in firstLevel) + { firstLevel[k].bands = {}; - //firstLevel[k].modes = {}; + // firstLevel[k].modes = {}; var obj = singleCompile(award, firstLevel[k].unique); - for (var mode in obj.bands) { - for (var cnt in test.rule.count) { + for (var mode in obj.bands) + { + for (var cnt in test.rule.count) + { if (obj.counts[mode][test.rule.count[cnt]].num >= test.rule.unique) - for (var band in obj.bands[mode]) { + { + for (var band in obj.bands[mode]) + { if (!(mode in firstLevel[k].bands)) firstLevel[k].bands[mode] = {}; if (obj.bands[mode][band] > 0) + { firstLevel[k].bands[mode][band] = ~~firstLevel[k].bands[mode][band] + 1; + } } + } } } - /*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; - }*/ + /* 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; + } */ delete firstLevel[k].unique; firstLevel[k].unique = null; diff --git a/package.nw/lib/screens.js b/package.nw/lib/screens.js index e7d92c2d..2a842819 100644 --- a/package.nw/lib/screens.js +++ b/package.nw/lib/screens.js @@ -8,7 +8,8 @@ var g_screenLost = false; var g_windowInfo = {}; var g_initialScreenCount = nw.Screen.screens.length; -function setWindowInfo() { +function setWindowInfo() +{ // if we've lost a screen, stop saving our info if (g_screenLost) return; var win = nw.Window.get(); @@ -20,24 +21,29 @@ function setWindowInfo() { g_windowInfo = windowInfo; } -function clearAllScreenTimers() { - if (g_windowMoveTimer != null) { +function clearAllScreenTimers() +{ + if (g_windowMoveTimer != null) + { clearTimeout(g_windowMoveTimer); g_windowMoveTimer = null; } - if (g_windowResizeTimer != null) { + if (g_windowResizeTimer != null) + { clearTimeout(g_windowResizeTimer); g_windowResizeTimer = null; } } var screenCB = { - onDisplayAdded: function (screen) { + onDisplayAdded: function (screen) + { clearAllScreenTimers(); if ( g_screenLost == true && g_initialScreenCount == nw.Screen.screens.length - ) { + ) + { // Lets restore the position now var win = nw.Window.get(); win.x = g_windowInfo.x; @@ -48,15 +54,18 @@ var screenCB = { } }, - onDisplayRemoved: function (screen) { + onDisplayRemoved: function (screen) + { clearAllScreenTimers(); - if (g_initialScreenCount != nw.Screen.screens.length) { + if (g_initialScreenCount != nw.Screen.screens.length) + { g_screenLost = true; } - }, + } }; -function saveScreenSettings() { +function saveScreenSettings() +{ var setting = { showing: g_isShowing, zoomLevel: s_zoomLevel }; s_screenSettings = JSON.parse(localStorage.screenSettings); @@ -71,18 +80,22 @@ nw.Screen.on("displayRemoved", screenCB.onDisplayRemoved); var g_isShowing = false; -nw.Window.get().on("loaded", function () { +nw.Window.get().on("loaded", function () +{ s_title = document.title.substr(0, 16).trim(); g_isShowing = false; - if (typeof localStorage.screenSettings == "undefined") { + if (typeof localStorage.screenSettings == "undefined") + { localStorage.screenSettings = "{}"; } s_screenSettings = JSON.parse(localStorage.screenSettings); - if (!(s_title in s_screenSettings)) { + if (!(s_title in s_screenSettings)) + { saveScreenSettings(); } - if (!("zoomLevel" in s_screenSettings[s_title])) { + if (!("zoomLevel" in s_screenSettings[s_title])) + { saveScreenSettings(); } g_isShowing = s_screenSettings[s_title].showing; @@ -98,16 +111,20 @@ nw.Window.get().on("loaded", function () { }); var g_windowMoveTimer = null; -nw.Window.get().on("move", function (x, y) { - if (g_windowMoveTimer != null) { +nw.Window.get().on("move", function (x, y) +{ + if (g_windowMoveTimer != null) + { clearTimeout(g_windowMoveTimer); } g_windowMoveTimer = setTimeout(setWindowInfo, 1000); }); var g_windowResizeTimer = null; -nw.Window.get().on("resize", function (w, h) { - if (g_windowResizeTimer != null) { +nw.Window.get().on("resize", function (w, h) +{ + if (g_windowResizeTimer != null) + { clearTimeout(g_windowResizeTimer); } g_windowResizeTimer = setTimeout(setWindowInfo, 1000); @@ -119,31 +136,37 @@ var g_zoomKeys = { NumpadAdd: increaseZoom, Equal: increaseZoom, Numpad0: resetZoom, - Digit0: resetZoom, + Digit0: resetZoom }; -function onZoomControlDown(event) { - if (event.ctrlKey) { - if (event.code in g_zoomKeys) { +function onZoomControlDown(event) +{ + if (event.ctrlKey) + { + if (event.code in g_zoomKeys) + { g_zoomKeys[event.code](); } } } -function reduceZoom() { +function reduceZoom() +{ s_zoomLevel -= 0.2; nw.Window.get().zoomLevel = s_zoomLevel; saveScreenSettings(); } -function increaseZoom() { +function increaseZoom() +{ s_zoomLevel += 0.2; nw.Window.get().zoomLevel = s_zoomLevel; saveScreenSettings(); } -function resetZoom() { +function resetZoom() +{ s_zoomLevel = 0; nw.Window.get().zoomLevel = s_zoomLevel; saveScreenSettings(); diff --git a/package.nw/lib/shadow.js b/package.nw/lib/shadow.js index eb2019e5..8c37cd31 100644 --- a/package.nw/lib/shadow.js +++ b/package.nw/lib/shadow.js @@ -1,23 +1,27 @@ /** **/ -(function (global, factory) { +(function (global, factory) +{ typeof exports === "object" && typeof module !== "undefined" ? (module.exports = factory()) : typeof define === "function" && define.amd - ? define(factory) - : (global.GeoJSONTerminator = factory()); -})(this, function () { + ? define(factory) + : (global.GeoJSONTerminator = factory()); +})(this, function () +{ "use strict"; - function julian(date) { + function julian(date) + { /* Calculate the present UTC Julian Date. Function is valid after * the beginning of the UNIX epoch 1970-01-01 and ignores leap * seconds. */ return date / 86400000 + 2440587.5; } - function GMST(julianDay) { + function GMST(julianDay) + { /* Calculate Greenwich Mean Sidereal Time according to http://aa.usno.navy.mil/faq/docs/GAST.php */ var d = julianDay - 2451545.0; @@ -25,25 +29,29 @@ return (18.697374558 + 24.06570982441908 * d) % 24; } - class Terminator { - constructor(options = { resolution: 1 }) { + class Terminator + { + constructor(options = { resolution: 1 }) + { this.options = options; this.version = "0.1.0"; this._R2D = 180 / Math.PI; this._D2R = Math.PI / 180; - //this.options.resolution = options.resolution || this.options.resolution; + // this.options.resolution = options.resolution || this.options.resolution; // this.options.time = options.time; var latLngs = this._compute(this.options.time); return this._toGeoJSON(latLngs); } - setTime(date) { + setTime(date) + { this.options.time = date; var latLngs = this._compute(date); return this._toGeoJSON(latLngs); } - _toGeoJSON(latLngs) { + _toGeoJSON(latLngs) + { /* Return 'pseudo' GeoJSON representation of the coordinates Why 'pseudo'? Coordinates longitude range go from -360 to 360 @@ -61,19 +69,21 @@ type: "Polygon", coordinates: [ [ - ...latLngs.map((latLng) => { + ...latLngs.map((latLng) => + { return [latLng[1], latLng[0]]; }), - [latLngs[0][1], latLngs[0][0]], + [latLngs[0][1], latLngs[0][0]] ] .slice() - .reverse(), - ], - }, + .reverse() + ] + } }; } - _sunEclipticPosition(julianDay) { + _sunEclipticPosition(julianDay) + { /* Compute the position of the Sun in ecliptic coordinates at julianDay. Following http://en.wikipedia.org/wiki/Position_of_the_Sun */ @@ -94,7 +104,8 @@ return { lambda: lambda }; } - _eclipticObliquity(julianDay) { + _eclipticObliquity(julianDay) + { // Following the short term expression in // http://en.wikipedia.org/wiki/Axial_tilt#Obliquity_of_the_ecliptic_.28Earth.27s_axial_tilt.29 var n = julianDay - 2451545.0; @@ -111,10 +122,14 @@ T * (0.576e-6 / 3600 - (T * 4.34e-8) / 3600)))); return epsilon; } - _jday(date) { + + _jday(date) + { return date.getTime() / 86400000.0 + 2440587.5; } - _calculatePositionOfSun(date) { + + _calculatePositionOfSun(date) + { date = date instanceof Date ? date : new Date(); var rad = 0.017453292519943295; @@ -175,7 +190,8 @@ return [lng, lat]; } - _sunEquatorialPosition(sunEclLng, eclObliq) { + _sunEquatorialPosition(sunEclLng, eclObliq) + { /* Compute the Sun's equatorial position from its ecliptic * position. Inputs are expected in degrees. Outputs are in * degrees as well. */ @@ -195,14 +211,16 @@ return { alpha: alpha, delta: delta }; } - _hourAngle(lng, sunPos, gst) { + _hourAngle(lng, sunPos, gst) + { /* Compute the hour angle of the sun for a longitude on * Earth. Return the hour angle in degrees. */ var lst = gst + lng / 15; return lst * 15 - sunPos.alpha; } - _latitude(ha, sunPos) { + _latitude(ha, sunPos) + { /* For a given hour angle and sun position, compute the * latitude of the terminator in degrees. */ var lat = @@ -212,7 +230,8 @@ return lat; } - _compute(time) { + _compute(time) + { var today = time ? new Date(time) : new Date(); var julianDay = julian(today); var gst = GMST(julianDay); @@ -222,22 +241,27 @@ var sunEclPos = this._sunEclipticPosition(julianDay); var eclObliq = this._eclipticObliquity(julianDay); var sunEqPos = this._sunEquatorialPosition(sunEclPos.lambda, eclObliq); - for (var i = 0; i <= 720 * this.options.resolution; i++) { + for (var i = 0; i <= 720 * this.options.resolution; i++) + { var lng = startMinus + i / this.options.resolution; var ha = this._hourAngle(lng, sunEqPos, gst); latLng[i + 1] = [this._latitude(ha, sunEqPos), lng]; } - if (sunEqPos.delta < 0) { + if (sunEqPos.delta < 0) + { latLng[0] = [90, startMinus]; latLng[latLng.length] = [90, 360]; - } else { + } + else + { latLng[0] = [-90, startMinus]; latLng[latLng.length] = [-90, 360]; } return latLng; } } - function terminator(options) { + function terminator(options) + { return new Terminator(options); } @@ -248,35 +272,37 @@ var dayNight = { map: null, vectorLayer: null, - init: function (map) { + init: function (map) + { this.map = map; var geoJSON = new GeoJSONTerminator(); this.vectorSource = new ol.source.Vector({ features: new ol.format.GeoJSON().readFeatures(geoJSON, { - featureProjection: "EPSG:3857", - }), + featureProjection: "EPSG:3857" + }) }); this.vectorLayer = new ol.layer.Vector({ source: this.vectorSource, style: new ol.style.Style({ fill: new ol.style.Fill({ - color: "rgb(0,0,0)", + color: "rgb(0,0,0)" }), - stroke: null, + stroke: null }), opacity: Number(g_mapSettings.shadow), - zIndex: 0, + zIndex: 0 }); this.map.getLayers().insertAt(1, this.vectorLayer); }, - refresh: function () { + refresh: function () + { var circleStyle = new ol.style.Style({ fill: new ol.style.Fill({ - color: "rgb(0,0,0)", - }), + color: "rgb(0,0,0)" + }) }); this.vectorLayer.setStyle(circleStyle); this.vectorLayer.setOpacity(Number(g_mapSettings.shadow)); @@ -284,24 +310,27 @@ var dayNight = { this.vectorSource.addFeature( new ol.format.GeoJSON().readFeature(new GeoJSONTerminator(), { - featureProjection: "EPSG:3857", + featureProjection: "EPSG:3857" }) ); var point = ol.proj.fromLonLat([g_myLon, g_myLat]); var arr = this.vectorSource.getFeaturesAtCoordinate(point); - return arr.length > 0 ? true : false; + return arr.length > 0; }, - show: function () { + show: function () + { this.vectorLayer.setVisible(true); return this.refresh(); }, - hide: function () { + hide: function () + { this.vectorLayer.setVisible(false); }, - isVisible: function () { + isVisible: function () + { return this.vectorLayer.getVisible(); - }, + } }; var moonLayer = { @@ -309,7 +338,8 @@ var moonLayer = { vectorLayer: null, icon: null, pin: null, - init: function (map) { + init: function (map) + { this.map = map; this.icon = new ol.style.Icon({ @@ -318,7 +348,7 @@ var moonLayer = { anchorXUnits: "pixels", anchor: [255, 255], scale: 0.1, - opacity: 0.5, + opacity: 0.5 }); this.pin = iconFeature( @@ -331,16 +361,18 @@ var moonLayer = { this.vectorLayer = new ol.layer.Vector({ source: this.vectorSource, - zIndex: 30, + zIndex: 30 }); this.map.getLayers().insertAt(1, this.vectorLayer); }, - future: function (now) { + future: function (now) + { var r = 0; var x = 25; var i = 3600; var data = Array(); - for (r = 0; r < x; r++) { + for (r = 0; r < x; r++) + { data.push(subLunar(now + r * i).ll); } line = []; @@ -348,16 +380,22 @@ var moonLayer = { var lonOff = 0; var lastc = 0; - for (var i = 0; i < data.length; i++) { + for (var i = 0; i < data.length; i++) + { var c = data[i]; - if (isNaN(c[0])) { + if (isNaN(c[0])) + { continue; } - if (Math.abs(lastc - c[0]) > 270) { + if (Math.abs(lastc - c[0]) > 270) + { // Wrapped - if (c[0] < lastc) { + if (c[0] < lastc) + { lonOff += 360; - } else { + } + else + { lonOff -= 360; } } @@ -365,7 +403,8 @@ var moonLayer = { line.push(ol.proj.fromLonLat([c[0] + lonOff, c[1]])); } - if (line.length == 0) { + if (line.length == 0) + { line.push(ol.proj.fromLonLat(start)); } @@ -374,18 +413,20 @@ var moonLayer = { feature.setStyle( new ol.style.Style({ - stroke: new ol.style.Stroke({ color: "#FFF", width: 1 }), + stroke: new ol.style.Stroke({ color: "#FFF", width: 1 }) }) ); return feature; }, - refresh: function () { + refresh: function () + { this.vectorSource.clear(); - if (g_appSettings.moonTrack == 1) { + if (g_appSettings.moonTrack == 1) + { now = timeNowSec(); if (g_appSettings.moonPath == 1) - this.vectorSource.addFeature(this.future(now)); + { this.vectorSource.addFeature(this.future(now)); } this.pin = iconFeature( ol.proj.fromLonLat(subLunar(now).ll), this.icon, @@ -396,16 +437,19 @@ var moonLayer = { } }, - show: function () { + show: function () + { this.refresh(); this.vectorLayer.setVisible(true); lunaButonImg.style.webkitFilter = "brightness(100%)"; }, - hide: function () { + hide: function () + { this.vectorLayer.setVisible(false); lunaButonImg.style.webkitFilter = "brightness(50%)"; }, - isVisible: function () { + isVisible: function () + { return this.vectorLayer.getVisible(); - }, + } }; diff --git a/package.nw/lib/stats.js b/package.nw/lib/stats.js index f25358ee..fde5218f 100644 --- a/package.nw/lib/stats.js +++ b/package.nw/lib/stats.js @@ -2,29 +2,35 @@ // All rights reserved. // See LICENSE for more information. -document.oncontextmenu = function (event) { +document.oncontextmenu = function (event) +{ event.preventDefault(); }; -document.addEventListener("dragover", function (event) { +document.addEventListener("dragover", function (event) +{ event.preventDefault(); }); -document.addEventListener("drop", function (event) { +document.addEventListener("drop", function (event) +{ event.preventDefault(); }); -function openInfoTab(evt, tabName, callFunc, callObj) { +function openInfoTab(evt, tabName, callFunc, callObj) +{ // Declare all variables var i, infoTabcontent, infoTablinks; // Get all elements with class="infoTabcontent" and hide them infoTabcontent = document.getElementsByClassName("infoTabcontent"); - for (i = 0; i < infoTabcontent.length; i++) { + for (i = 0; i < infoTabcontent.length; i++) + { infoTabcontent[i].style.display = "none"; } // Get all elements with class="infoTablinks" and remove the class "active" infoTablinks = document.getElementsByClassName("infoTablinks"); - for (i = 0; i < infoTablinks.length; i++) { + for (i = 0; i < infoTablinks.length; i++) + { infoTablinks[i].className = infoTablinks[i].className.replace( " active", "" @@ -34,13 +40,16 @@ function openInfoTab(evt, tabName, callFunc, callObj) { document.getElementById(tabName).style.display = "block"; if (typeof evt.currentTarget != "undefined") - evt.currentTarget.className += " active"; + { evt.currentTarget.className += " active"; } else evt.className += " active"; - if (callFunc) { - if (typeof window.opener.window[callFunc] != "undefined") { + if (callFunc) + { + if (typeof window.opener.window[callFunc] != "undefined") + { var caller = window.opener.window[callFunc]; - if (caller) { + if (caller) + { if (callObj) caller(callObj); else caller(); } @@ -48,47 +57,60 @@ function openInfoTab(evt, tabName, callFunc, callObj) { } } -function resetSearch() { +function resetSearch() +{ window.opener.resetSearch(); } -function lookupCallsign(callsign) { +function lookupCallsign(callsign) +{ window.opener.lookupCallsign(callsign); } -function appendToChild(elementString, object, onInputString, defaultValue) { +function appendToChild(elementString, object, onInputString, defaultValue) +{ window[elementString].appendChild(object); object.oninput = window.opener[onInputString]; object.value = defaultValue; } -function statsFocus(selection) { +function statsFocus(selection) +{ var which = document.getElementById(selection); - if (which != null) { + if (which != null) + { which.focus(); which.selectionStart = which.selectionEnd = which.value.length; } } -function ValidateCallsign(inputText, validDiv) { - if (inputText.value.length > 0) { +function ValidateCallsign(inputText, validDiv) +{ + if (inputText.value.length > 0) + { var passed = false; inputText.value = inputText.value.toUpperCase(); - if (/\d/.test(inputText.value) || /[A-Z]/.test(inputText.value)) { + if (/\d/.test(inputText.value) || /[A-Z]/.test(inputText.value)) + { passed = true; } - if (passed) { + if (passed) + { inputText.style.color = "#FF0"; inputText.style.backgroundColor = "green"; if (validDiv) validDiv.innerHTML = "Valid!"; return true; - } else { + } + else + { inputText.style.color = "#000"; inputText.style.backgroundColor = "yellow"; if (validDiv) validDiv.innerHTML = "Invalid!"; return false; } - } else { + } + else + { inputText.style.color = "#000"; inputText.style.backgroundColor = "yellow"; if (validDiv) validDiv.innerHTML = "Invalid!"; @@ -96,79 +118,103 @@ function ValidateCallsign(inputText, validDiv) { } } -function validateCallByElement(elementString) { +function validateCallByElement(elementString) +{ ValidateCallsign(window[elementString], null); } -function init() { +function init() +{ openInfoTab(event, "workedBoxDiv", "showWorkedBox"); } -function addTextToClipboard(data) { +function addTextToClipboard(data) +{ navigator.clipboard.writeText(data); } -function setClipboardFromLookup() { - if (window.opener.g_lastLookupAddress) { +function setClipboardFromLookup() +{ + if (window.opener.g_lastLookupAddress) + { addTextToClipboard(window.opener.g_lastLookupAddress); } } -function resizeWorked() { +function resizeWorked() +{ workedListDiv.style.height = window.innerHeight - 63 - 6 + "px"; } -function Resize() { - if (statBoxDiv.style.display == "block") { +function Resize() +{ + if (statBoxDiv.style.display == "block") + { window.opener.showStatBox(true); } - if (workedBoxDiv.style.display == "block") { + if (workedBoxDiv.style.display == "block") + { resizeWorked(); } - if (callsignBoxDiv.style.display == "block") { + if (callsignBoxDiv.style.display == "block") + { window.opener.showCallsignBox(true); } - if (dxccBoxDiv.style.display == "block") { + if (dxccBoxDiv.style.display == "block") + { window.opener.showDXCCsBox(); } - if (cqzoneBoxDiv.style.display == "block") { + if (cqzoneBoxDiv.style.display == "block") + { window.opener.showCQzoneBox(); } - if (ituzoneBoxDiv.style.display == "block") { + if (ituzoneBoxDiv.style.display == "block") + { window.opener.showITUzoneBox(); } - if (waswaczoneBoxDiv.style.display == "block") { + if (waswaczoneBoxDiv.style.display == "block") + { window.opener.showWASWACzoneBox(); } - if (wpxBoxDiv.style.display == "block") { + if (wpxBoxDiv.style.display == "block") + { window.opener.showWPXBox(true); } - if (decodeLastDiv.style.display == "block") { + if (decodeLastDiv.style.display == "block") + { decodeLastListDiv.style.height = window.innerHeight - 63 + 26 + "px"; } } -function reloadInfo(bandOrMode) { - if (statBoxDiv.style.display == "block") { +function reloadInfo(bandOrMode) +{ + if (statBoxDiv.style.display == "block") + { window.opener.showStatBox(false); } - if (callsignBoxDiv.style.display == "block") { + if (callsignBoxDiv.style.display == "block") + { window.opener.showCallsignBox(false); } - if (dxccBoxDiv.style.display == "block") { + if (dxccBoxDiv.style.display == "block") + { window.opener.showDXCCsBox(); } - if (wpxBoxDiv.style.display == "block") { + if (wpxBoxDiv.style.display == "block") + { window.opener.showWPXBox(); } - if (cqzoneBoxDiv.style.display == "block") { + if (cqzoneBoxDiv.style.display == "block") + { window.opener.showCQzoneBox(); } - if (ituzoneBoxDiv.style.display == "block") { + if (ituzoneBoxDiv.style.display == "block") + { window.opener.showITUzoneBox(); } - if (waswaczoneBoxDiv.style.display == "block") { + if (waswaczoneBoxDiv.style.display == "block") + { window.opener.showWASWACzoneBox(); } } diff --git a/package.nw/lib/third-party.js b/package.nw/lib/third-party.js index 06b7ae8b..a92ad84b 100644 --- a/package.nw/lib/third-party.js +++ b/package.nw/lib/third-party.js @@ -1,3 +1,5 @@ +/* eslint-disable */ + // HamGridSquare.js // Copyright 2014 Paul Brewer KI6CQ // License: MIT License http://opensource.org/licenses/MIT