From 16cf06fb33d2de95e6e885575bcaff7f56fc3fbe Mon Sep 17 00:00:00 2001 From: Carl Vargklint Date: Mon, 6 Jan 2025 19:56:53 +0100 Subject: [PATCH] Added description message to marker --- map.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/map.js b/map.js index 18859e5..43ad5e0 100644 --- a/map.js +++ b/map.js @@ -1,4 +1,7 @@ +var noDescText = "No description available"; + + var shOSM = L.tileLayer('https://mbtiler.nyaaa.net/styles/basic-preview/512/{z}/{x}/{y}.png', { maxZoom: 19, @@ -45,11 +48,12 @@ fetch('./data.json') .then(data => { // Define waypoint markers function createMarker(waypoint) { + return L.marker([waypoint.lat, waypoint.lng], { radius: 5, color: '#337aff', fillColor: '#337aff' - }); + }).bindPopup(waypoint.desc ?? noDescText); }; // Create waypoints from server data and add them to the map