From 443409b90253c2e45d7d080819286a9b6dd39e88 Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Mon, 28 Jun 2021 19:19:26 -0500 Subject: [PATCH] refactor so far --- package.nw/gt_roster.html | 7 ++ package.nw/lib/roster.js | 52 ------------- package.nw/lib/roster/sendAlerts.js | 116 ++++++++++++++-------------- 3 files changed, 65 insertions(+), 110 deletions(-) diff --git a/package.nw/gt_roster.html b/package.nw/gt_roster.html index f7dc2c0..0fb7480 100644 --- a/package.nw/gt_roster.html +++ b/package.nw/gt_roster.html @@ -22,6 +22,13 @@ + + + + + + + diff --git a/package.nw/lib/roster.js b/package.nw/lib/roster.js index d7997f6..8ce9b2e 100644 --- a/package.nw/lib/roster.js +++ b/package.nw/lib/roster.js @@ -369,58 +369,6 @@ function myGTCompare(a, b) return 0; } -var r_sortFunction = [ - myCallCompare, - myGridCompare, - myDbCompare, - myDTCompare, - myFreqCompare, - myDxccCompare, - myTimeCompare, - myDistanceCompare, - myHeadingCompare, - myStateCompare, - myCQCompare, - myWPXCompare, - myLifeCompare, - mySpotCompare, - myGTCompare, - myCntyCompare, - myContCompare -]; - -var r_excptTest = [ - timeChk, - crEnable, - blockedCall, - blockedFrom, - blcokedDXCC, - cqOnly, - useRegex, - reqGrid, - minDB, - maxDT, - minFreq, - maxFreq, - noMsg, - onlyMesg, - myDXCC, - lotwUse, - eqslUse, - oqrsUse, - noMyCQDX, - callWorked, - callConfirmed, - huntGrid, - huntDXCC, - huntDXCCs, - huntWPX, - huntCQ, - huntITU, - huntUSStates, - huntUSState -]; - function showRosterBox(sortIndex) { if (g_rosterSettings.lastSortIndex != sortIndex) diff --git a/package.nw/lib/roster/sendAlerts.js b/package.nw/lib/roster/sendAlerts.js index ab814f1..7dcfa0f 100644 --- a/package.nw/lib/roster/sendAlerts.js +++ b/package.nw/lib/roster/sendAlerts.js @@ -52,84 +52,84 @@ function sendAlerts(callRoster, rosterSettings) } callObj.shouldAlert = false; -} -// NOTE: Ring alerts if needed -try -{ - if (fs.existsSync(dirPath)) + // NOTE: Ring alerts if needed + try { - if (window.opener.g_platform == "windows") + if (fs.existsSync(dirPath)) { - script = "cr-alert.bat"; - } - if ( - fs.existsSync(dirPath + script) && + if (window.opener.g_platform == "windows") + { + script = "cr-alert.bat"; + } + if ( + fs.existsSync(dirPath + script) && g_rosterSettings.realtime == false - ) - { - scriptExists = true; - scriptIcon.innerHTML = + ) + { + scriptExists = true; + scriptIcon.innerHTML = "
" + (window.opener.g_crScript == 1 ? "Script Enabled" : "Script Disabled") + "
"; - scriptIcon.style.display = "block"; - } - else - { - scriptIcon.style.display = "none"; + scriptIcon.style.display = "block"; + } + else + { + scriptIcon.style.display = "none"; + } } } -} -catch (e) {} + catch (e) {} -if (shouldAlert > 0) -{ - if (window.opener.g_classicAlerts.huntRoster == true) + if (shouldAlert > 0) { - var notify = window.opener.huntRosterNotify.value; - if (notify == "0") + if (window.opener.g_classicAlerts.huntRoster == true) { - var media = window.opener.huntRosterNotifyMedia.value; - if (media != "none") window.opener.playAlertMediaFile(media); + var notify = window.opener.huntRosterNotify.value; + if (notify == "0") + { + var media = window.opener.huntRosterNotifyMedia.value; + if (media != "none") window.opener.playAlertMediaFile(media); + } + else if (notify == "1") + { + window.opener.speakAlertString( + window.opener.huntRosterNotifyWord.value + ); + } } - else if (notify == "1") - { - window.opener.speakAlertString( - window.opener.huntRosterNotifyWord.value - ); - } - } - if ( - g_rosterSettings.realtime == false && + if ( + g_rosterSettings.realtime == false && scriptExists && window.opener.g_crScript == 1 - ) - { - try + ) { - fs.writeFileSync( - dirPath + "cr-alert.json", - JSON.stringify(g_scriptReport, null, 2) - ); + try + { + fs.writeFileSync( + dirPath + "cr-alert.json", + JSON.stringify(g_scriptReport, null, 2) + ); - var thisProc = dirPath + script; - var cp = require("child_process"); - var child = cp.spawn(thisProc, [], { - detached: true, - cwd: dirPath.slice(0, -1), - stdio: ["ignore", "ignore", "ignore"] - }); - child.unref(); + var thisProc = dirPath + script; + var cp = require("child_process"); + var child = cp.spawn(thisProc, [], { + detached: true, + cwd: dirPath.slice(0, -1), + stdio: ["ignore", "ignore", "ignore"] + }); + child.unref(); + } + catch (e) + { + conosle.log(e); + } + g_scriptReport = Object(); } - catch (e) - { - conosle.log(e); - } - g_scriptReport = Object(); + else g_scriptReport = Object(); } - else g_scriptReport = Object(); }