mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Now that SIGs are rebranded as Activities, we can merge DXpedition and Contest into that without it being too weird, and get rid of AlertType #147
This commit is contained in:
+14
-24
@@ -54,7 +54,7 @@ function updateTable() {
|
||||
const showDX = $("#tableShowDX")[0].checked;
|
||||
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
|
||||
const showComment = $("#tableShowComment")[0].checked;
|
||||
const showType = $("#tableShowType")[0].checked;
|
||||
const showActivity = $("#tableShowActivity")[0].checked;
|
||||
const showRef = $("#tableShowRef")[0].checked;
|
||||
|
||||
// Populate table with headers
|
||||
@@ -75,11 +75,11 @@ function updateTable() {
|
||||
if (showComment) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Comment</th>`);
|
||||
}
|
||||
if (showType) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Type</th>`);
|
||||
if (showActivity) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Activity</th>`);
|
||||
}
|
||||
if (showRef) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Ref.</th>`);
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Reference</th>`);
|
||||
}
|
||||
|
||||
table.find('tbody').empty();
|
||||
@@ -151,7 +151,7 @@ function addAlertRowsToTable(tbody, alerts) {
|
||||
const showDX = $("#tableShowDX")[0].checked;
|
||||
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
|
||||
const showComment = $("#tableShowComment")[0].checked;
|
||||
const showType = $("#tableShowType")[0].checked;
|
||||
const showActivity = $("#tableShowActivity")[0].checked;
|
||||
const showRef = $("#tableShowRef")[0].checked;
|
||||
|
||||
// Get times for the alert, and convert to local time if necessary.
|
||||
@@ -210,14 +210,14 @@ function addAlertRowsToTable(tbody, alerts) {
|
||||
if (a["dx_calls"] != null) {
|
||||
dx_calls_html = a["dx_calls"].map(call => `<a class='dx-link' href='https://qrz.com/db/${call}' target='_new'>${call}</a>`).join(", ");
|
||||
}
|
||||
if (dx_calls_html === "" && a["alert_type"] === "CONTEST") {
|
||||
if (dx_calls_html === "" && a["sig"] === "Contest") {
|
||||
// Contest = true and no DX callsigns, so display "Contest"
|
||||
dx_calls_html = "Contest"
|
||||
}
|
||||
|
||||
// Format DXpedition country
|
||||
let dx_country_html = "";
|
||||
if (a["alert_type"] === "DXPEDITION" && a["dx_country"] != null && a["dx_country"] !== "") {
|
||||
if (a["sig"] === "DXpedition" && a["dx_country"] != null && a["dx_country"] !== "") {
|
||||
dx_country_html = `<br/>${a["dx_country"]}`;
|
||||
}
|
||||
|
||||
@@ -250,20 +250,10 @@ function addAlertRowsToTable(tbody, alerts) {
|
||||
}
|
||||
|
||||
|
||||
// Type, activity or fallback to source
|
||||
let activityTypeText = a["source"];
|
||||
if (a["alert_type"] === "CONTEST") {
|
||||
activityTypeText = "Contest";
|
||||
} else if (a["alert_type"] === "DXPEDITION") {
|
||||
activityTypeText = "DXpedition";
|
||||
} else if (a["alert_type"] === "SATELLITE") {
|
||||
activityTypeText = "Satellite";
|
||||
} else if (a["alert_type"] === "XOTA") {
|
||||
if (a["sig"]) {
|
||||
activityTypeText = a["sig"];
|
||||
} else {
|
||||
activityTypeText = "xOTA";
|
||||
}
|
||||
// Activity or fallback to "General DX"
|
||||
let activityText = "General DX";
|
||||
if (a["sig"]) {
|
||||
activityText = a["sig"];
|
||||
}
|
||||
|
||||
// Format activity refs
|
||||
@@ -296,8 +286,8 @@ function addAlertRowsToTable(tbody, alerts) {
|
||||
if (showComment) {
|
||||
$tr.append(`<td class='hideonmobile'>${commentText}</td>`);
|
||||
}
|
||||
if (showType) {
|
||||
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${activityTypeText}</td>`);
|
||||
if (showActivity) {
|
||||
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${activityText}</td>`);
|
||||
}
|
||||
if (showRef) {
|
||||
$tr.append(`<td class='hideonmobile'>${activityRefs}</td>`);
|
||||
@@ -314,7 +304,7 @@ function addAlertRowsToTable(tbody, alerts) {
|
||||
}
|
||||
|
||||
const $td2 = $("<td colspan='100'>");
|
||||
if (showType) {
|
||||
if (showActivity) {
|
||||
$td2.append(`<span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> `);
|
||||
}
|
||||
if (showRef) {
|
||||
|
||||
+13
-13
@@ -128,7 +128,7 @@ function updateTable() {
|
||||
const showComment = $("#tableShowComment")[0].checked;
|
||||
const showBearing = $("#tableShowBearing")[0].checked && userPos != null;
|
||||
const showDistance = $("#tableShowDistance")[0].checked && userPos != null;
|
||||
const showType = $("#tableShowType")[0].checked;
|
||||
const showActivity = $("#tableShowActivity")[0].checked;
|
||||
const showRef = $("#tableShowRef")[0].checked;
|
||||
const showDE = $("#tableShowDE")[0].checked;
|
||||
const showWorkedCheckbox = $("#tableShowWorkedCheckbox")[0].checked;
|
||||
@@ -157,11 +157,11 @@ function updateTable() {
|
||||
if (showDistance) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Distance</th>`);
|
||||
}
|
||||
if (showType) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Type</th>`);
|
||||
if (showActivity) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Activity</th>`);
|
||||
}
|
||||
if (showRef) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Ref.</th>`);
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Reference</th>`);
|
||||
}
|
||||
if (showDE) {
|
||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>DE</th>`);
|
||||
@@ -208,7 +208,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
|
||||
const showComment = $("#tableShowComment")[0].checked;
|
||||
const showBearing = $("#tableShowBearing")[0].checked && userPos != null;
|
||||
const showDistance = $("#tableShowDistance")[0].checked && userPos != null;
|
||||
const showType = $("#tableShowType")[0].checked;
|
||||
const showActivity = $("#tableShowActivity")[0].checked;
|
||||
const showRef = $("#tableShowRef")[0].checked;
|
||||
const showDE = $("#tableShowDE")[0].checked;
|
||||
const showWorkedCheckbox = $("#tableShowWorkedCheckbox")[0].checked;
|
||||
@@ -327,10 +327,10 @@ function createNewTableRowsForSpot(s, highlightNew) {
|
||||
}
|
||||
}
|
||||
|
||||
// Format "type" (activity or fallback to source)
|
||||
let typeText = s["source"];
|
||||
// Format activity
|
||||
let activityText = "General DX";
|
||||
if (s["sig"]) {
|
||||
typeText = s["sig"];
|
||||
activityText = s["sig"];
|
||||
}
|
||||
|
||||
// Format activity refs
|
||||
@@ -397,8 +397,8 @@ function createNewTableRowsForSpot(s, highlightNew) {
|
||||
if (showDistance) {
|
||||
$tr.append(`<td class='nowrap hideonmobile'>${distanceText}</td>`);
|
||||
}
|
||||
if (showType) {
|
||||
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${s["icon"]}'></i></span> ${typeText}</td>`);
|
||||
if (showActivity) {
|
||||
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${s["icon"]}'></i></span> ${activityText}</td>`);
|
||||
}
|
||||
if (showRef) {
|
||||
$tr.append(`<td class='hideonmobile' style='max-width: 11em;'>${activityRefs}</td>`);
|
||||
@@ -410,7 +410,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
|
||||
$tr.append(`<td class='nowrap hideonmobile'>${workedCheckbox}</td>`);
|
||||
}
|
||||
|
||||
// Second row for mobile view only, containing type, ref & comment
|
||||
// Second row for mobile view only, containing activity, ref & comment
|
||||
const $tr2 = $("<tr class='hidenotonmobile'>");
|
||||
|
||||
// Apply styles as per the first row
|
||||
@@ -429,8 +429,8 @@ function createNewTableRowsForSpot(s, highlightNew) {
|
||||
|
||||
const $td2 = $("<td colspan='100'>");
|
||||
const $td2floatleft = $(`<div style="float: left;">`);
|
||||
if (showType) {
|
||||
$td2floatleft.append(`<span class='icon-wrapper'><i class='fa-solid ${s["icon"]}'></i></span> ${typeText} `);
|
||||
if (showActivity) {
|
||||
$td2floatleft.append(`<span class='icon-wrapper'><i class='fa-solid ${s["icon"]}'></i></span> ${activityText} `);
|
||||
}
|
||||
if (showRef) {
|
||||
$td2floatleft.append(`${activityRefs} `);
|
||||
|
||||
@@ -60,7 +60,7 @@ function generateActivitiesMultiToggleFilterCard(activity_options) {
|
||||
const domSafeName = o["name"].replace(/^[^A-Za-z0-9]+|[^\w]+/gi, "");
|
||||
$grid.append(`<div class="col"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-sig storeable-checkbox" id="filter-button-sig-${domSafeName}" value="${o['name']}" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-sig-${domSafeName}" for="filter-button-sig-${domSafeName}" title="${o['description']}"><i class="fa-solid ${o['icon']}"></i> ${o['name']} ${(o["region_flag"] != null) ? o['region_flag'] : ''}</label></div></div>`);
|
||||
});
|
||||
$body.append(`<div class="w-100"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-sig storeable-checkbox" id="filter-button-sig-NO_SIG" value="NO_SIG" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-sig-NO_SIG" for="filter-button-sig-NO_SIG"><i class="fa-solid fa-tower-cell"></i> General DX</label></div></div>`);
|
||||
$body.append(`<div class="w-100 mb-1"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-sig storeable-checkbox" id="filter-button-sig-NO_SIG" value="NO_SIG" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-sig-NO_SIG" for="filter-button-sig-NO_SIG"><i class="fa-solid fa-tower-cell"></i> General DX</label></div></div>`);
|
||||
$body.append($grid);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user