Alerts now displays a "Type" in the table not just the source. Closes #142

This commit is contained in:
Ian Renton
2026-09-11 14:43:33 +01:00
parent 8f8ff46426
commit 04f5df5260
11 changed files with 63 additions and 32 deletions
+37 -13
View File
@@ -54,7 +54,7 @@ function updateTable() {
const showDX = $("#tableShowDX")[0].checked;
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
const showComment = $("#tableShowComment")[0].checked;
const showSource = $("#tableShowSource")[0].checked;
const showType = $("#tableShowType")[0].checked;
const showRef = $("#tableShowRef")[0].checked;
// Populate table with headers
@@ -75,8 +75,8 @@ function updateTable() {
if (showComment) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Comment</th>`);
}
if (showSource) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Source</th>`);
if (showType) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Type</th>`);
}
if (showRef) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Ref.</th>`);
@@ -151,7 +151,7 @@ function addAlertRowsToTable(tbody, alerts) {
const showDX = $("#tableShowDX")[0].checked;
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
const showComment = $("#tableShowComment")[0].checked;
const showSource = $("#tableShowSource")[0].checked;
const showType = $("#tableShowType")[0].checked;
const showRef = $("#tableShowRef")[0].checked;
// Get times for the alert, and convert to local time if necessary.
@@ -232,14 +232,38 @@ function addAlertRowsToTable(tbody, alerts) {
if (a["comment"] != null) {
commentText = escapeHtml(a["comment"]);
}
if (a["url"] != null) {
commentText += ` <a href="${escapeHtml(a['url'])}" target="_new" style="text-decoration: none">🔗</a>`;
// Format extra text, like URL and attribution
let subComment = a["url"] != null || a["source"] === "NG3K" || a["source"] === "WA7BNM Contest Calendar";
if (subComment) {
let subCommentText = ""
if (a["url"] != null) {
subCommentText += `<a href="${escapeHtml(a['url'])}" target="_new" style="text-decoration: none">More info</a>`;
}
if ((a["source"] === "NG3K" || a["source"] === "WA7BNM Contest Calendar")) {
if (subCommentText !== "") {
subCommentText += " | ";
}
subCommentText += `From ${a["source"]}`;
}
commentText += `<div class="mt-2 small text-secondary">${subCommentText}</div>`;
}
// Sig or fallback to source
let sigSourceText = a["source"];
if (a["sig"]) {
sigSourceText = a["sig"];
// Type, SIG or fallback to source
let sigTypeText = a["source"];
if (a["alert_type"] === "CONTEST") {
sigTypeText = "Contest";
} else if (a["alert_type"] === "DXPEDITION") {
sigTypeText = "DXpedition";
} else if (a["alert_type"] === "SATELLITE") {
sigTypeText = "Satellite";
} else if (a["alert_type"] === "XOTA") {
if (a["sig"]) {
sigTypeText = a["sig"];
} else {
sigTypeText = "xOTA";
}
}
// Format sig_refs
@@ -272,8 +296,8 @@ function addAlertRowsToTable(tbody, alerts) {
if (showComment) {
$tr.append(`<td class='hideonmobile'>${commentText}</td>`);
}
if (showSource) {
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${sigSourceText}</td>`);
if (showType) {
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${sigTypeText}</td>`);
}
if (showRef) {
$tr.append(`<td class='hideonmobile'>${sig_refs}</td>`);
@@ -290,7 +314,7 @@ function addAlertRowsToTable(tbody, alerts) {
}
const $td2 = $("<td colspan='100'>");
if (showSource) {
if (showType) {
$td2.append(`<span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> `);
}
if (showRef) {