diff --git a/main.js b/main.js index 8720e82..37fe88c 100644 --- a/main.js +++ b/main.js @@ -245,6 +245,11 @@ async function main() { map.addOverlay(overlayElement); } + function isRecentTimestamp (tst) { + // newer than 2 hours ago? + return (tst * 1000) > (Date.now() - 2*60*60*1000); + } + function updateData(startInterval=false) { fetch('https://r2b22.kip.pe/last.json') .then(response => response.json()) @@ -255,6 +260,7 @@ async function main() { for (const item of data) { if (!tourStatus.participants.includes(item.name)) continue; + if (!isRecentTimestamp(item.tst)) continue; createParticipantHTML(item.name); createParticipantOverlay(item.name); const overlay = peopleOverlays[item.name];