From f4ae6b610ebaa2d4713f9f4c407226570e54ceaa Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Tue, 30 Dec 2025 09:06:14 +0000 Subject: [PATCH] Fix spot table reversing bug and add "de" callsign to mobile view --- templates/spots.html | 2 +- webassets/js/spots.js | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/templates/spots.html b/templates/spots.html index 1b34a62..dc8c953 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -220,7 +220,7 @@ - + {% end %} \ No newline at end of file diff --git a/webassets/js/spots.js b/webassets/js/spots.js index 94685f5..4edcc16 100644 --- a/webassets/js/spots.js +++ b/webassets/js/spots.js @@ -147,8 +147,8 @@ function updateTable() { table.find('tbody').append('No spots match your filters.'); } - spots.reverse(); - spots.forEach(s => addSpotToTopOfTable(s, false)); + let spotsNewestFirst = spots.toReversed(); + spotsNewestFirst.forEach(s => addSpotToTopOfTable(s, false)); } // Add rows corresponding to a new spot to the top of the table @@ -280,9 +280,9 @@ function createNewTableRowsForSpot(s, highlightNew) { var items = [] for (var i = 0; i < s["sig_refs"].length; i++) { if (s["sig_refs"][i]["url"] != null) { - items[i] = `${s["sig_refs"][i]["id"]}` + items[i] = `${s["sig_refs"][i]["id"]}` } else { - items[i] = `${s["sig_refs"][i]["id"]}` + items[i] = `${s["sig_refs"][i]["id"]}` } } sig_refs = items.join(", "); @@ -318,7 +318,7 @@ function createNewTableRowsForSpot(s, highlightNew) { $tr.append(`${time_formatted}`); } if (showDX) { - $tr.append(`${dx_flag}${dx_call}`); + $tr.append(`${dx_flag}${dx_call}`); } if (showFreq) { $tr.append(`${freq_string}`); @@ -336,7 +336,7 @@ function createNewTableRowsForSpot(s, highlightNew) { $tr.append(` ${typeText}`); } if (showRef) { - $tr.append(`${sig_refs}`); + $tr.append(`${sig_refs}`); } if (showDE) { $tr.append(`${de_flag}${de_call}`); @@ -357,17 +357,25 @@ function createNewTableRowsForSpot(s, highlightNew) { } $td2 = $(""); + $td2floatleft = $(`
`); if (showType) { - $td2.append(` ${typeText} `); + $td2floatleft.append(` ${typeText} `); } if (showRef) { - $td2.append(`${sig_refs} `); + $td2floatleft.append(`${sig_refs} `); } + $td2.append($td2floatleft); + $td2floatright = $(`
`); if (showBearing) { - $td2.append(`   Bearing: ${bearingText} `); + $td2floatright.append(`${bearingText}  `); } + if (showDE) { + $td2floatright.append(` de ${de_call}  `); + } + $td2.append($td2floatright); + $td2.append(`
`); if (showComment) { - $td2.append(`
${commentText}`); + $td2.append(`${commentText}`); } $tr2.append($td2);