diff --git a/frontend/index.html b/frontend/index.html index 0a495ff..4a61b78 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -63,6 +63,17 @@
Sender is waiting for GPS signal
+ +Share expired
diff --git a/frontend/main.js b/frontend/main.js index 432016b..bfaf9d8 100644 --- a/frontend/main.js +++ b/frontend/main.js @@ -208,15 +208,22 @@ function setNewInterval(expire, interval) { } var noGPS = document.getElementById("searching"); - -// Attempt to fetch location data from the server once. -getJSON("./api/fetch.php?id=" + id, function(data) { - noGPS.style.display = "block"; - setNewInterval(data.expire, data.interval); - processUpdate(data); -}, function() { - document.getElementById("notfound").style.display = "block"; -}); +console.log(id); +if (location.href.indexOf("?") === -1 || id == "") { + // If there is no share ID, show the root page. + var url = location.href.indexOf("?") === -1 ? location.href : location.href.substring(0, location.href.indexOf("?")); + document.getElementById("url").textContent = url; + document.getElementById("index").style.display = "block"; +} else { + // Attempt to fetch location data from the server once. + getJSON("./api/fetch.php?id=" + id, function(data) { + noGPS.style.display = "block"; + setNewInterval(data.expire, data.interval); + processUpdate(data); + }, function() { + document.getElementById("notfound").style.display = "block"; + }); +} // Whether or not an initial location has been received. var hasReceivedFirst = false; diff --git a/frontend/style.css b/frontend/style.css index cb70e0b..28ee15a 100644 --- a/frontend/style.css +++ b/frontend/style.css @@ -94,6 +94,17 @@ font-size: 1em; } +/* Visible on the root page of Hauk. */ +#url { + color: #d80037; + font-family: monospace; + font-size: 5vmin; +} +.f-droid { + margin-top: 1vmin; + width: 50vmin; +} + /* Display the Hauk logo in the bottom left corner of the map if the viewport is wide enough to accomodate it. If it's so narrow that the Leaflet attribution could be covered by it, display it in the bottom left corner instead, above