2022-03-05 03:25:45 +00:00
|
|
|
const DEFAULT_COLUMN_ORDER = [
|
2023-10-14 20:42:44 +00:00
|
|
|
"Callsign", "Band", "Mode", "Calling", "Rig", "Wanted", "Grid", "Msg",
|
2022-05-20 15:35:49 +00:00
|
|
|
"POTA", "DXCC", "Flag", "State", "County", "Cont",
|
2022-03-05 03:25:45 +00:00
|
|
|
"dB", "Freq", "DT", "Dist", "Azim",
|
|
|
|
"CQz", "ITUz", "PX",
|
|
|
|
"LoTW", "eQSL", "OQRS",
|
2023-03-26 20:22:24 +00:00
|
|
|
"Life", "Spot", "OAMS", "Age", "UTC"
|
2022-03-05 03:25:45 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
const LEGACY_COLUMN_SORT_ID = {
|
|
|
|
0: "Callsign",
|
|
|
|
1: "Grid",
|
|
|
|
2: "dB",
|
|
|
|
3: "DT",
|
|
|
|
4: "Freq",
|
|
|
|
5: "DXCC",
|
|
|
|
7: "Dist",
|
|
|
|
8: "Azim",
|
|
|
|
9: "State",
|
|
|
|
10: "Calling",
|
|
|
|
11: "PX",
|
|
|
|
12: "Life",
|
|
|
|
13: "Spot",
|
|
|
|
14: "OAMS",
|
|
|
|
15: "County",
|
|
|
|
16: "Cont"
|
|
|
|
}
|
|
|
|
|
|
|
|
const getterSimpleComparer = (getter) => (a, b) =>
|
|
|
|
{
|
|
|
|
const aVal = getter(a);
|
|
|
|
const bVal = getter(b);
|
2022-01-02 23:38:46 +00:00
|
|
|
|
2022-03-05 03:25:45 +00:00
|
|
|
if (aVal == null) return 1;
|
|
|
|
if (bVal == null) return -1;
|
|
|
|
if (aVal > bVal) return 1;
|
|
|
|
if (aVal < bVal) return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const callObjSimpleComparer = (attr) => getterSimpleComparer((elem) => elem.callObj[attr])
|
|
|
|
|
|
|
|
const callObjLocaleComparer = (attr) => (a, b) =>
|
|
|
|
{
|
|
|
|
if (a.callObj[attr] == null) return 1;
|
|
|
|
if (b.callObj[attr] == null) return -1;
|
|
|
|
return a.callObj[attr].localeCompare(b.callObj[attr]);
|
|
|
|
}
|
|
|
|
|
|
|
|
const ROSTER_COLUMNS = {
|
|
|
|
|
|
|
|
Callsign: {
|
|
|
|
compare: callObjLocaleComparer("DEcall"),
|
|
|
|
tableHeader: () => ({ align: "left" }),
|
|
|
|
tableData: (callObj) =>
|
|
|
|
{
|
|
|
|
let attrs = {
|
|
|
|
title: callObj.awardReason,
|
|
|
|
name: "Callsign",
|
|
|
|
align: "left",
|
|
|
|
onClick: `initiateQso("${callObj.hash}")`,
|
|
|
|
rawAttrs: callObj.style.call,
|
2023-02-17 00:35:44 +00:00
|
|
|
html: html = formatCallsign((callObj.DEcallHTML || callObj.DEcall))
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
|
2023-02-17 00:35:44 +00:00
|
|
|
let acks = window.opener.GT.acknowledgedCalls || {};
|
2022-03-05 03:25:45 +00:00
|
|
|
if (acks[callObj.DEcall])
|
|
|
|
{
|
|
|
|
attrs.html = `${attrs.html} <span class='acknowledged'><img class='ackBadge' src='${acks[callObj.DEcall].badge}'></span>`
|
|
|
|
attrs.title = `${attrs.title} - ${acks[callObj.DEcall].message}`
|
|
|
|
}
|
|
|
|
|
|
|
|
return attrs
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-10-14 20:42:44 +00:00
|
|
|
Rig: {
|
|
|
|
compare: callObjSimpleComparer("instance"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
html: callObj.instance
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2022-03-05 03:25:45 +00:00
|
|
|
Band: {
|
2023-01-20 22:56:30 +00:00
|
|
|
compare: callObjSimpleComparer("band"),
|
2022-03-05 03:25:45 +00:00
|
|
|
tableData: (callObj) => ({
|
2023-02-17 00:35:44 +00:00
|
|
|
style: `color: #${window.opener.GT.pskColors[callObj.band]};`,
|
2022-03-05 03:25:45 +00:00
|
|
|
html: callObj.band
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Mode: {
|
2023-01-20 22:56:30 +00:00
|
|
|
compare: callObjSimpleComparer("mode"),
|
2022-03-05 03:25:45 +00:00
|
|
|
tableData: (callObj) => ({
|
2023-02-17 00:35:44 +00:00
|
|
|
style: `color: #${CR.modeColors[callObj.mode] || "888888"};`,
|
2022-03-05 03:25:45 +00:00
|
|
|
html: callObj.mode
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Grid: {
|
|
|
|
compare: callObjSimpleComparer("grid"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
rawAttrs: callObj.style.grid,
|
2022-09-19 02:06:49 +00:00
|
|
|
onClick: `centerOn("${callObj.grid}")`,
|
2023-01-21 21:49:07 +00:00
|
|
|
html: (callObj.grid.length > 0 ? callObj.grid : " ")
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Calling: {
|
|
|
|
compare: callObjLocaleComparer("DXcall"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
rawAttrs: callObj.style.calling,
|
|
|
|
name: callObj.CQ ? "CQ" : "Calling",
|
2023-02-17 00:35:44 +00:00
|
|
|
html: (CR.rosterSettings.wantRRCQ && callObj.RR73) ? "RR73" : formatCallsign(callObj.DXcall)
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Msg: {
|
|
|
|
compare: callObjLocaleComparer("DXcall"),
|
|
|
|
tableData: (callObj) => ({ html: callObj.msg })
|
|
|
|
},
|
|
|
|
|
|
|
|
DXCC: {
|
|
|
|
compare: (a, b) => window.opener.myDxccCompare(a.callObj, b.callObj),
|
|
|
|
tableData: (callObj) => ({
|
2023-02-17 00:35:44 +00:00
|
|
|
title: window.opener.GT.dxccInfo[callObj.dxcc].pp,
|
2022-09-26 18:45:04 +00:00
|
|
|
name: `DXCC (${callObj.dxcc})`,
|
2022-03-05 03:25:45 +00:00
|
|
|
rawAttrs: callObj.style.dxcc,
|
2023-02-17 00:35:44 +00:00
|
|
|
html: (callObj.dxccSuffix ? [window.opener.GT.dxccToAltName[callObj.dxcc], callObj.dxccSuffix].join(" ") : window.opener.GT.dxccToAltName[callObj.dxcc])
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Flag: {
|
|
|
|
compare: (a, b) => window.opener.myDxccCompare(a.callObj, b.callObj),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
align: "center",
|
|
|
|
style: "margin:0; padding:0;",
|
2023-02-17 00:35:44 +00:00
|
|
|
html: `<img style='margin-bottom:-3px;height:14px' src='./img/flags/16/${window.opener.GT.dxccInfo[callObj.dxcc].flag}'>`
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
State: {
|
|
|
|
compare: callObjSimpleComparer("state"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
align: "center",
|
|
|
|
rawAttrs: callObj.style.state,
|
2023-01-21 21:49:07 +00:00
|
|
|
html: callObj.state ? callObj.state.substr(3) : " "
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
County: {
|
|
|
|
// Not sure why this comparison uses substring, but this is what the original code did
|
2022-09-19 02:06:49 +00:00
|
|
|
// Because we're sorting on the county name, the data contains "CO,Adams", we don't want to sort by state.
|
2022-03-05 03:25:45 +00:00
|
|
|
compare: getterSimpleComparer((elem) => elem.callObj.cnty && elem.callObj.cnty.substr(3)),
|
|
|
|
tableData: (callObj) =>
|
|
|
|
{
|
|
|
|
let attrs = {
|
|
|
|
align: "center",
|
|
|
|
rawAttrs: callObj.style.cnty,
|
2023-02-17 00:35:44 +00:00
|
|
|
html: callObj.cnty ? window.opener.GT.cntyToCounty[callObj.cnty] : " "
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
2022-09-19 02:06:49 +00:00
|
|
|
if (callObj.cnty && callObj.qual == false)
|
2022-03-05 03:25:45 +00:00
|
|
|
{
|
2022-09-22 02:30:52 +00:00
|
|
|
attrs.title = $.i18n("rosterColumns.County.title")
|
2022-09-19 02:06:49 +00:00
|
|
|
attrs.onClick = `window.opener.lookupCallsign("${callObj.DEcall}", "${callObj.grid}")`
|
2023-02-17 00:35:44 +00:00
|
|
|
attrs.html = attrs.html + " +" + String(window.opener.GT.zipToCounty[callObj.zipcode].length - 1)
|
2022-09-19 02:06:49 +00:00
|
|
|
attrs.style = "cursor: pointer; color: cyan;"
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
return attrs
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
Cont: {
|
|
|
|
compare: callObjSimpleComparer("cont"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
align: "center",
|
|
|
|
rawAttrs: callObj.style.cont,
|
2023-01-21 21:49:07 +00:00
|
|
|
html: callObj.cont ? callObj.cont : " "
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
dB: {
|
|
|
|
compare: callObjSimpleComparer("RSTsent"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color:#DD44DD;",
|
|
|
|
html: `<b>${callObj.RSTsent}</b>`
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Freq: {
|
|
|
|
compare: callObjSimpleComparer("delta"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #00FF00;",
|
|
|
|
html: callObj.delta
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
DT: {
|
|
|
|
compare: callObjSimpleComparer("dt"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #1E90FF;",
|
|
|
|
html: callObj.dt
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Dist: {
|
|
|
|
compare: callObjSimpleComparer("distance"),
|
|
|
|
tableHeader: () => ({ html: `Dist (${window.opener.distanceUnit.value.toLowerCase()})` }),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: cyan;",
|
2023-01-21 21:49:07 +00:00
|
|
|
html: (callObj.distance > 0 ? Math.round(callObj.distance * MyCircle.validateRadius(window.opener.distanceUnit.value)) : " ")
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Azim: {
|
|
|
|
compare: callObjSimpleComparer("heading"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: yellow;",
|
2023-01-21 21:49:07 +00:00
|
|
|
html: (callObj.distance > 0 ? Math.round(callObj.heading) : " ")
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
CQz: {
|
|
|
|
compare: false,
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
name: "CQz",
|
|
|
|
rawAttrs: callObj.style.cqz,
|
2022-10-07 23:44:11 +00:00
|
|
|
html: [callObj.cqz, callObj.cqzSuffix].join(" ")
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
ITUz: {
|
|
|
|
compare: false,
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
name: "ITUz",
|
|
|
|
rawAttrs: callObj.style.ituz,
|
2022-10-07 23:44:11 +00:00
|
|
|
html: callObj.ituz
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
PX: {
|
|
|
|
compare: callObjSimpleComparer("px"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
rawAttrs: callObj.style.px,
|
2023-01-21 21:49:07 +00:00
|
|
|
html: callObj.px ? callObj.px : " "
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
LoTW: {
|
|
|
|
compare: false,
|
|
|
|
tableData: (callObj) =>
|
|
|
|
{
|
2023-02-17 00:35:44 +00:00
|
|
|
if (callObj.DEcall in window.opener.GT.lotwCallsigns)
|
2022-03-05 03:25:45 +00:00
|
|
|
{
|
2023-02-17 00:35:44 +00:00
|
|
|
if (CR.rosterSettings.maxLoTW < 27)
|
2022-03-05 03:25:45 +00:00
|
|
|
{
|
2023-02-17 00:35:44 +00:00
|
|
|
let months = (CR.day - window.opener.GT.lotwCallsigns[callObj.DEcall]) / 30;
|
|
|
|
if (months > CR.rosterSettings.maxLoTW)
|
2022-03-05 03:25:45 +00:00
|
|
|
{
|
|
|
|
return {
|
|
|
|
style: "color: yellow;",
|
|
|
|
align: "center",
|
2023-02-17 00:35:44 +00:00
|
|
|
title: `${$.i18n("rosterColumns.LoTW.NoUpdate")} ${toYM(Number(months))}`,
|
2022-03-05 03:25:45 +00:00
|
|
|
html: "?"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
style: "color: #0F0;",
|
|
|
|
align: "center",
|
2022-09-22 02:30:52 +00:00
|
|
|
title: `${$.i18n("rosterColumns.LoTW.LastUpdate")}${
|
2023-02-17 00:35:44 +00:00
|
|
|
window.opener.userDayString(window.opener.GT.lotwCallsigns[callObj.DEcall] * 86400000)
|
2022-03-05 03:25:45 +00:00
|
|
|
}`,
|
|
|
|
html: "✔"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
style: "color: #0F0;",
|
|
|
|
align: "center",
|
2022-09-22 02:30:52 +00:00
|
|
|
title: `${$.i18n("rosterColumns.LoTW.LastUpdate")}${
|
2023-02-17 00:35:44 +00:00
|
|
|
window.opener.userDayString(window.opener.GT.lotwCallsigns[callObj.DEcall] * 86400000)
|
2022-03-05 03:25:45 +00:00
|
|
|
}`,
|
|
|
|
html: "✔"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-21 21:49:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
html: " "
|
|
|
|
}
|
|
|
|
}
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
eQSL: {
|
|
|
|
compare: false,
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #0F0;",
|
|
|
|
align: "center",
|
2023-02-17 00:35:44 +00:00
|
|
|
html: (callObj.DEcall in window.opener.GT.eqslCallsigns ? "✔" : " ")
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
OQRS: {
|
|
|
|
compare: false,
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #0F0;",
|
|
|
|
align: "center",
|
2023-02-17 00:35:44 +00:00
|
|
|
html: (callObj.DEcall in window.opener.GT.oqrsCallsigns ? "✔" : " ")
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Life: {
|
|
|
|
compare: callObjSimpleComparer("life"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #EEE;",
|
|
|
|
class: "lifeCol",
|
|
|
|
id: `lm${callObj.hash}`,
|
2023-02-17 00:35:44 +00:00
|
|
|
html: toDHMS(timeNowSec() - callObj.life)
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
OAMS: {
|
|
|
|
tableHeader: () => ({ description: "Off-Air Message User" }),
|
|
|
|
compare: getterSimpleComparer((elem) => elem.callObj.gt != 0 ? 1 : 0),
|
|
|
|
tableData: (callObj) =>
|
|
|
|
{
|
|
|
|
if (callObj.gt != 0)
|
|
|
|
{
|
|
|
|
if (callObj.reason.includes("oams"))
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
align: "center",
|
|
|
|
style: "margin: 0; padding: 0; cursor: pointer; background-clip: content-box; box-shadow: 0 0 4px 4px inset #2222FFFF;",
|
|
|
|
onClick: `openChatToCid("${callObj.gt}")`,
|
2023-01-21 21:49:07 +00:00
|
|
|
html: "<img height='13px' style='margin-bottom:-2px;' src='./img/gt_chat.png' />"
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
align: "center",
|
|
|
|
style: "margin: 0; padding: 0; cursor: pointer;",
|
|
|
|
onClick: `openChatToCid("${callObj.gt}")`,
|
2023-01-21 21:49:07 +00:00
|
|
|
html: "<img height='13px' style='margin-bottom:-2px;' src='./img/gt_chat.png' />"
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-21 21:49:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
html: " "
|
|
|
|
}
|
|
|
|
}
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-03-26 20:22:24 +00:00
|
|
|
UTC: {
|
|
|
|
compare: callObjSimpleComparer("age"),
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #EEE;",
|
|
|
|
html: callObj.UTC
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2022-03-05 03:25:45 +00:00
|
|
|
Age: {
|
2022-09-19 02:06:49 +00:00
|
|
|
compare: callObjSimpleComparer("age"),
|
2022-03-05 03:25:45 +00:00
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #EEE;",
|
|
|
|
class: "timeCol",
|
|
|
|
id: `tm${callObj.hash}`,
|
2023-02-17 00:35:44 +00:00
|
|
|
html: toDHMS(timeNowSec() - callObj.age)
|
2022-03-05 03:25:45 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
Spot: {
|
|
|
|
compare: (a, b) =>
|
|
|
|
{
|
2023-02-17 00:35:44 +00:00
|
|
|
let cutoff = timeNowSec() - window.opener.GT.receptionSettings.viewHistoryTimeSec;
|
2022-03-05 03:25:45 +00:00
|
|
|
|
|
|
|
if (a.callObj.spot.when <= cutoff) return -1;
|
|
|
|
if (b.callObj.spot.when <= cutoff) return 1;
|
|
|
|
|
|
|
|
let aSNR = Number(a.callObj.spot.snr);
|
|
|
|
let bSNR = Number(b.callObj.spot.snr);
|
|
|
|
|
|
|
|
if (aSNR > bSNR) return 1;
|
|
|
|
if (aSNR < bSNR) return -1;
|
|
|
|
|
|
|
|
if (a.callObj.spot.when > b.callObj.spot.when) return 1;
|
|
|
|
if (a.callObj.spot.when < b.callObj.spot.when) return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
tableData: (callObj) => ({
|
|
|
|
style: "color: #EEE;",
|
|
|
|
class: "spotCol",
|
|
|
|
id: `sp${callObj.hash}`,
|
|
|
|
html: getSpotString(callObj)
|
|
|
|
})
|
2022-05-20 01:19:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
POTA: {
|
2023-01-20 22:56:30 +00:00
|
|
|
compare: callObjSimpleComparer("pota"),
|
2022-05-20 01:19:24 +00:00
|
|
|
tableData: (callObj) => ({
|
|
|
|
name: "POTA",
|
|
|
|
rawAttrs: callObj.style.pota,
|
2022-09-11 19:49:23 +00:00
|
|
|
title: potaColumnHover(callObj),
|
|
|
|
html: potaColumnRef(callObj)
|
2022-05-20 01:19:24 +00:00
|
|
|
})
|
2022-01-02 23:38:46 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Wanted: {
|
2022-01-03 18:07:16 +00:00
|
|
|
compare: (a, b) => wantedColumnComparer(a.callObj, b.callObj),
|
2022-01-02 23:38:46 +00:00
|
|
|
tableData: (callObj) => ({
|
|
|
|
class: "wantedCol",
|
2022-01-03 18:07:16 +00:00
|
|
|
title: wantedColumnParts(callObj).map(entry => `• ${entry}`).join("\n"),
|
|
|
|
html: wantedColumnParts(callObj).join(" - ", { html: true })
|
2022-01-02 23:38:46 +00:00
|
|
|
})
|
2022-03-05 03:25:45 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-02 23:38:46 +00:00
|
|
|
|
2022-09-11 19:49:23 +00:00
|
|
|
function potaColumnRef(callObj)
|
|
|
|
{
|
2022-11-29 04:26:59 +00:00
|
|
|
if (callObj.pota)
|
2022-09-11 19:49:23 +00:00
|
|
|
{
|
2022-11-29 04:26:59 +00:00
|
|
|
return callObj.pota;
|
2022-09-11 20:18:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-01-21 21:49:07 +00:00
|
|
|
return " ";
|
2022-09-11 19:49:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function potaColumnHover(callObj)
|
|
|
|
{
|
2022-11-29 04:26:59 +00:00
|
|
|
let value = "";
|
|
|
|
|
2023-02-17 00:35:44 +00:00
|
|
|
if (callObj.pota in window.opener.GT.pota.parks)
|
2022-09-11 19:49:23 +00:00
|
|
|
{
|
2023-02-17 00:35:44 +00:00
|
|
|
value += callObj.pota + " - " + window.opener.GT.pota.parks[callObj.pota].name + "\n";
|
2022-09-11 20:18:00 +00:00
|
|
|
}
|
2022-11-29 04:26:59 +00:00
|
|
|
|
2022-09-11 19:49:23 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2022-10-26 17:55:18 +00:00
|
|
|
WANTED_ORDER = ["call", "qrz", "regex", "cont", "dxcc", "cqz", "ituz", "dxccMarathon", "cqzMarathon", "state", "pota", "grid", "cnty", "wpx", "oams"];
|
2022-10-10 06:03:46 +00:00
|
|
|
WANTED_LABELS = {};
|
2022-01-02 23:38:46 +00:00
|
|
|
|
2022-01-03 18:07:16 +00:00
|
|
|
function wantedColumnParts(callObj, options)
|
2022-01-02 23:38:46 +00:00
|
|
|
{
|
2022-01-03 18:07:16 +00:00
|
|
|
options = options || {};
|
|
|
|
|
2022-09-26 00:25:34 +00:00
|
|
|
if (Object.keys(callObj.hunting).length == 0)
|
|
|
|
{
|
2023-10-14 20:42:44 +00:00
|
|
|
let sendBlank = (typeof options.html != "undefined" && options.html == true);
|
|
|
|
return [(sendBlank ? " " : "")];
|
2022-09-26 00:25:34 +00:00
|
|
|
}
|
2022-01-02 23:38:46 +00:00
|
|
|
|
|
|
|
let parts = [];
|
2022-01-03 18:07:16 +00:00
|
|
|
|
2022-01-02 23:38:46 +00:00
|
|
|
WANTED_ORDER.forEach(field =>
|
|
|
|
{
|
|
|
|
let wanted = callObj.hunting[field];
|
|
|
|
|
2022-01-04 18:52:10 +00:00
|
|
|
if (wanted == "calling") { parts.push("Calling"); }
|
2022-01-05 14:37:21 +00:00
|
|
|
// else if (wanted == "caller") { parts.push("Called"); }
|
|
|
|
else if (wanted == "hunted" && field == "qrz") { parts.push("Caller"); }
|
2022-01-03 18:07:16 +00:00
|
|
|
else if (wanted == "hunted" && field == "oams") { parts.push("OAMS User"); }
|
2022-10-10 12:37:55 +00:00
|
|
|
else if (wanted == "hunted" && field == "regex") { parts.push("Regex match"); }
|
2022-01-03 18:07:16 +00:00
|
|
|
else if (wanted == "hunted") { parts.push(`${options.html ? "<b>" : ""}New ${WANTED_LABELS[field]}${options.html ? "<b>" : ""}`); }
|
2022-01-02 23:38:46 +00:00
|
|
|
else if (wanted == "worked") { parts.push(`Worked ${WANTED_LABELS[field]}`); }
|
|
|
|
else if (wanted == "mixed") { parts.push(`${callObj.band} ${WANTED_LABELS[field]}`); }
|
|
|
|
else if (wanted == "mixed-worked") { parts.push(`${callObj.band} ${WANTED_LABELS[field]}`); parts.push(`Worked ${WANTED_LABELS[field]}`); }
|
|
|
|
else if (wanted == "worked-and-mixed") { parts.push(`Worked ${callObj.band} ${WANTED_LABELS[field]}`); }
|
|
|
|
})
|
|
|
|
|
2022-01-05 14:37:21 +00:00
|
|
|
if (parts[0] == "Calling" && parts[1] == "Caller")
|
2022-01-03 18:07:16 +00:00
|
|
|
{
|
|
|
|
parts.shift(); parts.shift();
|
2022-01-04 18:52:10 +00:00
|
|
|
parts.unshift(`${options.html ? "<b>" : ""}Working${options.html ? "<b>" : ""}`);
|
2022-01-03 18:07:16 +00:00
|
|
|
}
|
|
|
|
|
2022-01-02 23:38:46 +00:00
|
|
|
return parts;
|
|
|
|
}
|
|
|
|
|
2022-01-03 18:07:16 +00:00
|
|
|
function wantedColumnWeighter(callObj, field)
|
2022-01-02 23:38:46 +00:00
|
|
|
{
|
2022-01-03 18:07:16 +00:00
|
|
|
let wanted = callObj.hunting[field];
|
|
|
|
|
|
|
|
// We use negative numbers so that sorting is "reversed" by default, placing most interesting items up top.
|
|
|
|
if (wanted == "calling" || wanted == "caller") return -10;
|
|
|
|
else if (wanted == "hunted") return -5;
|
|
|
|
else if (wanted == "worked") return -4;
|
|
|
|
else if (wanted == "mixed") return -3;
|
|
|
|
else if (wanted == "mixed-worked") return -2;
|
|
|
|
else if (wanted == "worked-and-mixed") return -1;
|
|
|
|
else return 0;
|
|
|
|
}
|
2022-01-02 23:38:46 +00:00
|
|
|
|
2022-01-03 18:07:16 +00:00
|
|
|
function wantedColumnComparer(a, b)
|
|
|
|
{
|
|
|
|
if (!a.hunting) return 1;
|
|
|
|
if (!b.hunting) return -1;
|
2022-01-02 23:38:46 +00:00
|
|
|
|
2022-01-03 18:07:16 +00:00
|
|
|
for (const index in WANTED_ORDER)
|
|
|
|
{
|
|
|
|
const field = WANTED_ORDER[index];
|
|
|
|
const aWeight = wantedColumnWeighter(a, field);
|
|
|
|
const bWeight = wantedColumnWeighter(b, field);
|
2022-01-02 23:38:46 +00:00
|
|
|
|
2022-01-03 18:07:16 +00:00
|
|
|
if (aWeight < bWeight) return 1;
|
|
|
|
if (aWeight > bWeight) return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
2022-10-09 19:18:03 +00:00
|
|
|
}
|