From f377d72080656a36e04b5c99a38f28042658a9fe Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 6 Sep 2025 16:30:40 +0200 Subject: [PATCH] updated frontend --- html/index.html | 12 +++++++++++- html/static/engine.js | 9 +++++---- html/static/service.js | 12 ++++++++---- html/static/style.css | 31 +++++++++++++++++++++++++++---- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/html/index.html b/html/index.html index c5dcd95..14ee134 100644 --- a/html/index.html +++ b/html/index.html @@ -12,9 +12,19 @@
- +
+ + + +
+
+ + + +
+ diff --git a/html/static/engine.js b/html/static/engine.js index d3c6722..18b5a2c 100644 --- a/html/static/engine.js +++ b/html/static/engine.js @@ -2,6 +2,7 @@ let socket = new WebSocket("wss://trackme.ovh/ws"); const arrows = ["↑", "↗", "→", "↘", "↓", "↙", "←", "↖"]; +let togglefollowbtn; class Position { constructor(type, iconUrl, iconRetinaUrl) { @@ -157,16 +158,16 @@ function ping() { } function followButton() { - if (follow) togglefollow.innerHTML = "Unfollow tracker"; - else togglefollow.innerHTML = "Follow tracker"; + if (follow) togglefollowbtn.innerHTML = "Unfollow tracker"; + else togglefollowbtn.innerHTML = "Follow tracker"; } function main() { - const togglefollow = document.querySelector("#togglefollow"); + togglefollowbtn = document.querySelector("#togglefollowbtn"); follow = JSON.parse(localStorage.getItem("follow")); followButton(); - togglefollow.addEventListener("click", function() { + togglefollowbtn.addEventListener("click", function() { follow = !follow; localStorage.setItem("follow", follow); followButton(); diff --git a/html/static/service.js b/html/static/service.js index aee4f34..933a315 100644 --- a/html/static/service.js +++ b/html/static/service.js @@ -2,13 +2,13 @@ const CACHE_NAME = "trackme-v1"; const urlsToCache = [ "/", - "/leaflet/leaflet.js", - "/engine.js", - "/style.css", + "/static/leaflet/leaflet.js", + "/static/engine.js", + "/static/style.css", ]; { if ("serviceWorker" in navigator) { - navigator.serviceWorker.register("/engine.js") + navigator.serviceWorker.register("/static/service.js") .then((_reg) => { console.log("Registration successful"); }).catch((error) => { @@ -25,4 +25,8 @@ const urlsToCache = [ }) ); }); + + self.addEventListener("fetch", function(event) { + console.log("fetch"); + }); } diff --git a/html/static/style.css b/html/static/style.css index 1c4a0d3..16f31f4 100644 --- a/html/static/style.css +++ b/html/static/style.css @@ -1,12 +1,35 @@ +html, body { + width: 100%; + height: 100%; +} + +body { + display: flex; +} + .leaflet-popup-content { /*font-size: 13pt;*/ } #map { - height: 95%; -} - -#dash { height: 100%; width: 100%; } + +#dash { + display: flex; + flex-direction: column; + height: 100%; + width: 100%; +} + +.buttonscontainer { + display: flex; + flex-direction: row; + width: 100%; +} + +.buttonscontainer > button { + margin: 3px; + width: 100%; +}