Fix spot table reversing bug and add "de" callsign to mobile view

This commit is contained in:
Ian Renton
2025-12-30 09:06:14 +00:00
parent 6af15e4cfd
commit f4ae6b610e
2 changed files with 19 additions and 11 deletions

View File

@@ -220,7 +220,7 @@
<script src="/js/common.js?v=3"></script> <script src="/js/common.js?v=3"></script>
<script src="/js/spotsbandsandmap.js?v=3"></script> <script src="/js/spotsbandsandmap.js?v=3"></script>
<script src="/js/spots.js?v=3"></script> <script src="/js/spots.js?v=4"></script>
<script>$(document).ready(function() { $("#nav-link-spots").addClass("active"); }); <!-- highlight active page in nav --></script> <script>$(document).ready(function() { $("#nav-link-spots").addClass("active"); }); <!-- highlight active page in nav --></script>
{% end %} {% end %}

View File

@@ -147,8 +147,8 @@ function updateTable() {
table.find('tbody').append('<tr class="table-danger"><td colspan="100" style="text-align:center;">No spots match your filters.</td></tr>'); table.find('tbody').append('<tr class="table-danger"><td colspan="100" style="text-align:center;">No spots match your filters.</td></tr>');
} }
spots.reverse(); let spotsNewestFirst = spots.toReversed();
spots.forEach(s => addSpotToTopOfTable(s, false)); spotsNewestFirst.forEach(s => addSpotToTopOfTable(s, false));
} }
// Add rows corresponding to a new spot to the top of the table // Add rows corresponding to a new spot to the top of the table
@@ -280,9 +280,9 @@ function createNewTableRowsForSpot(s, highlightNew) {
var items = [] var items = []
for (var i = 0; i < s["sig_refs"].length; i++) { for (var i = 0; i < s["sig_refs"].length; i++) {
if (s["sig_refs"][i]["url"] != null) { if (s["sig_refs"][i]["url"] != null) {
items[i] = `<a href='${s["sig_refs"][i]["url"]}' title='${s["sig_refs"][i]["name"]}' target='_new' class='sig-ref-link'>${s["sig_refs"][i]["id"]}</a>` items[i] = `<span style="white-space: nowrap;"><a href='${s["sig_refs"][i]["url"]}' title='${s["sig_refs"][i]["name"]}' target='_new' class='sig-ref-link'>${s["sig_refs"][i]["id"]}</a></span>`
} else { } else {
items[i] = `${s["sig_refs"][i]["id"]}` items[i] = `<span style="white-space: nowrap;">${s["sig_refs"][i]["id"]}</span>`
} }
} }
sig_refs = items.join(", "); sig_refs = items.join(", ");
@@ -318,7 +318,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
$tr.append(`<td class='nowrap'>${time_formatted}</td>`); $tr.append(`<td class='nowrap'>${time_formatted}</td>`);
} }
if (showDX) { if (showDX) {
$tr.append(`<td class='nowrap'><span class='flag-wrapper hideonmobile' title='${dx_country}'>${dx_flag}</span><a class='dx-link' href='https://qrz.com/db/${s["dx_call"]}' target='_new' title='${s["dx_name"] != null ? s["dx_name"] : ""}'>${dx_call}</a></td>`); $tr.append(`<td class='nowrap'><span class='flag-wrapper' title='${dx_country}'>${dx_flag}</span><a class='dx-link' href='https://qrz.com/db/${s["dx_call"]}' target='_new' title='${s["dx_name"] != null ? s["dx_name"] : ""}'>${dx_call}</a></td>`);
} }
if (showFreq) { if (showFreq) {
$tr.append(`<td class='nowrap'><span class='band-bullet' title='${bandFullName}' style='${(s["freq"] != null) ? "color: " + s["band_color"] : "display: none;"}'>&#9632;</span>${freq_string}</td>`); $tr.append(`<td class='nowrap'><span class='band-bullet' title='${bandFullName}' style='${(s["freq"] != null) ? "color: " + s["band_color"] : "display: none;"}'>&#9632;</span>${freq_string}</td>`);
@@ -336,7 +336,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText}</td>`); $tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText}</td>`);
} }
if (showRef) { if (showRef) {
$tr.append(`<td class='hideonmobile'>${sig_refs}</td>`); $tr.append(`<td class='hideonmobile' style='max-width: 11em;'>${sig_refs}</td>`);
} }
if (showDE) { if (showDE) {
$tr.append(`<td class='nowrap hideonmobile'><span class='flag-wrapper' title='${de_country}'>${de_flag}</span>${de_call}</td>`); $tr.append(`<td class='nowrap hideonmobile'><span class='flag-wrapper' title='${de_country}'>${de_flag}</span>${de_call}</td>`);
@@ -357,17 +357,25 @@ function createNewTableRowsForSpot(s, highlightNew) {
} }
$td2 = $("<td colspan='100'>"); $td2 = $("<td colspan='100'>");
$td2floatleft = $(`<div style="float: left;">`);
if (showType) { if (showType) {
$td2.append(`<span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText} `); $td2floatleft.append(`<span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText} `);
} }
if (showRef) { if (showRef) {
$td2.append(`${sig_refs} `); $td2floatleft.append(`${sig_refs} `);
} }
$td2.append($td2floatleft);
$td2floatright = $(`<div style="float: right;">`);
if (showBearing) { if (showBearing) {
$td2.append(` &nbsp; Bearing: ${bearingText} `); $td2floatright.append(`${bearingText} &nbsp;`);
} }
if (showDE) {
$td2floatright.append(` de ${de_call} &nbsp;`);
}
$td2.append($td2floatright);
$td2.append(`</div><div style="clear: both;"></div>`);
if (showComment) { if (showComment) {
$td2.append(`<br/>${commentText}`); $td2.append(`${commentText}`);
} }
$tr2.append($td2); $tr2.append($td2);