mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 09:14:30 +00:00
Improvements to spot timing display #3
This commit is contained in:
@@ -36,7 +36,7 @@ SIGS = [
|
||||
# Modes. Note "DIGI" and "DIGITAL" are also supported but are normalised into "DATA".
|
||||
CW_MODES = ["CW"]
|
||||
PHONE_MODES = ["PHONE", "SSB", "USB", "LSB", "AM", "FM", "DV", "DMR", "DSTAR", "C4FM", "M17"]
|
||||
DATA_MODES = ["DATA", "FT8", "FT4", "RTTY", "SSTV", "JS8", "HELL", "BPSK", "PSK", "PSK31", "BPSK31", "OLIVIA", "MFSK", "MFSK32", "PKT"]
|
||||
DATA_MODES = ["DATA", "FT8", "FT4", "RTTY", "SSTV", "JS8", "HELL", "BPSK", "PSK", "PSK31", "BPSK31", "OLIVIA", "MFSK", "MFSK32", "PKT", "MSK144"]
|
||||
ALL_MODES = CW_MODES + PHONE_MODES + DATA_MODES
|
||||
MODE_TYPES = ["CW", "PHONE", "DATA"]
|
||||
|
||||
|
||||
@@ -841,6 +841,7 @@ components:
|
||||
- MFSK
|
||||
- MFSK32
|
||||
- PKT
|
||||
- MSK144
|
||||
example: SSB
|
||||
|
||||
ModeType:
|
||||
|
||||
@@ -117,10 +117,9 @@ function toggleFilterButtons(filterQuery, state) {
|
||||
function updateRefreshDisplay() {
|
||||
if (lastUpdateTime != null) {
|
||||
let secSinceUpdate = moment.duration(moment().diff(lastUpdateTime)).asSeconds();
|
||||
let updatingString = " Connected to live spot server.";
|
||||
if (typeof REFRESH_INTERVAL_SEC !== 'undefined' && REFRESH_INTERVAL_SEC != null) {
|
||||
let count = REFRESH_INTERVAL_SEC;
|
||||
updatingString = "Updating..."
|
||||
let updatingString = "Updating..."
|
||||
if (secSinceUpdate < REFRESH_INTERVAL_SEC) {
|
||||
count = REFRESH_INTERVAL_SEC - secSinceUpdate;
|
||||
if (count <= 60) {
|
||||
@@ -131,8 +130,10 @@ function updateRefreshDisplay() {
|
||||
updatingString = "<span class='nowrap'>Updating in " + number + " minute" + (number != "1" ? "s" : "") + ".</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#timing-container").html("Last updated at " + lastUpdateTime.format('HH:mm') + " UTC. " + updatingString);
|
||||
} else {
|
||||
$("#timing-container").html("Connected to live spot server. Last spot at " + lastUpdateTime.format('HH:mm') + " UTC.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,17 @@ function restartSSEConnection() {
|
||||
// Store last updated time
|
||||
lastUpdateTime = moment.utc();
|
||||
updateRefreshDisplay();
|
||||
// Add spot to internal data store
|
||||
// Get the new spot
|
||||
newSpot = JSON.parse(event.data);
|
||||
// Awful fudge to ensure new incoming spots at the top of the list don't have timestamps that make them look
|
||||
// like they belong further down the list. If the spot is older than the latest one we already have, bump its
|
||||
// time up to match it. This isn't great but since we poll spot providers every 2 minutes anyway, it shouldn't
|
||||
// be too far wrong.
|
||||
if (spots.length > 0) {
|
||||
newSpot["time"] = Math.max(newSpot["time"], Math.max(...spots.map(s => s["time"])))
|
||||
}
|
||||
|
||||
// Add spot to internal data store
|
||||
spots.unshift(newSpot);
|
||||
spots = spots.slice(0, -1);
|
||||
// Add spot to table
|
||||
|
||||
Reference in New Issue
Block a user