Various stuff

This commit is contained in:
Ian Renton
2025-09-30 20:51:56 +01:00
parent 280749919d
commit 37692f41a8
9 changed files with 100 additions and 56 deletions

View File

@@ -1,17 +1,19 @@
$.getJSON('/api/spots', function(jsonData) {
let headers = Object.keys(jsonData[0]);
let table = $('<table>').append('<thead><tr></tr></thead><tbody></tbody>');
let table = $('<table class="table table-striped table-hover">').append('<thead><tr class="table-primary"></tr></thead><tbody></tbody>');
["Time", "DX", "Frequency", "Mode", "Comment", "Source", "DE"].forEach(header => table.find('thead tr').append(`<th>${header}</th>`));
jsonData.forEach(row => {
let $tr = $('<tr>');
$tr.append(`<td>${row["time"]}</td>`);
$tr.append(`<td>${row["dx_call"]}</td>`);
var time = moment(row["time"], moment.ISO_8601);
var time_formatted = time.format("HH:mm")
$tr.append(`<td>${time_formatted}</td>`);
$tr.append(`<td>${row["dx_flag"]}&nbsp;${row["dx_call"]}</td>`);
$tr.append(`<td>${row["freq"]}</td>`);
$tr.append(`<td>${row["mode"]}</td>`);
$tr.append('<td>').append(escapeHtml(`${row["comment"]}`)).append('</td>');
$tr.append('<td>' + escapeHtml(`${row["comment"]}`) + '</td>');
$tr.append(`<td>${row["source"]}</td>`);
$tr.append(`<td>${row["de_call"]}</td>`);
$tr.append(`<td>${row["de_flag"]}&nbsp;${row["de_call"]}</td>`);
table.find('tbody').append($tr);
});