diff --git a/docroot/map/map_leaflet.js b/docroot/map/map_leaflet.js index 25c6ae5..aec7190 100644 --- a/docroot/map/map_leaflet.js +++ b/docroot/map/map_leaflet.js @@ -45,11 +45,19 @@ function initialize_leaflet() { var dt = moment.utc(tst * 1000).local(); data.tst = tst; data.fulldate = dt.format("DD MMM YYYY HH:mm:ss") - var t = "{{ addr }}
({{ lat }},{{lon}}) {{ fulldate }}"; - if (typeof(tst) === 'undefined') { - t = "Position: {{lat}}, {{lon}}"; + var t = "{{ addr }}
({{ lat }},{{lon}}) {{ fulldate }}
Speed: {{ speed }}"; + // if speed is 0 then don't display speed + if (speed === 0) { + t = "{{ addr }}
({{ lat }},{{lon}}) {{ fulldate }}" } - + if (typeof(tst) === 'undefined') { + t = "Position: ({{lat}},{{lon}})
Speed: {{speed}}"; + } + // if speed is 0 then don't display speed + if (typeof(tst) === 'undefined' && speed === 0) { + t = "Position: ({{lat}},{{lon}})"; + } + layer.bindPopup(Mustache.render(t, data)); } },