2 Commits

Author SHA1 Message Date
Râu Cao
e74e460480 1.9.0 2022-09-15 10:02:34 +02:00
Râu Cao
0cb10203c7 Only show riders when tracking timestamp is newer than 3 hours ago 2022-09-15 10:02:15 +02:00
6 changed files with 17 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@@ -7,7 +7,7 @@
<title>Road2Bitcoin Live Map</title> <title>Road2Bitcoin Live Map</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css">
<script defer data-domain="r2b22.kip.pe" src="https://plausible.io/js/plausible.js"></script> <script defer data-domain="r2b22.kip.pe" src="https://plausible.io/js/plausible.js"></script>
<script type="module" crossorigin src="/assets/index.8fd3a327.js"></script> <script type="module" crossorigin src="/assets/index.b6f9bc24.js"></script>
<link rel="stylesheet" href="/assets/index.eed9f443.css"> <link rel="stylesheet" href="/assets/index.eed9f443.css">
</head> </head>
<body> <body>

View File

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

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "ol-vite", "name": "ol-vite",
"version": "1.8.0", "version": "1.9.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ol-vite", "name": "ol-vite",
"version": "1.8.0", "version": "1.9.0",
"dependencies": { "dependencies": {
"ol": "latest" "ol": "latest"
}, },

View File

@@ -1,6 +1,6 @@
{ {
"name": "map", "name": "map",
"version": "1.8.0", "version": "1.9.0",
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"build": "vite build", "build": "vite build",