diff --git a/org/gpx/20260314_london_italy/js/gpx.js b/org/gpx/20260314_london_italy/js/gpx.js index 9e8f74a..639fffd 100644 --- a/org/gpx/20260314_london_italy/js/gpx.js +++ b/org/gpx/20260314_london_italy/js/gpx.js @@ -34,12 +34,31 @@ }).on('loaded', function(e) { map.fitBounds(e.target.getBounds()); }).on('mouseover', function(e) { - var paths = gpx.split("/"); - this.bindTooltip( - "Click to download: " + paths[paths.length - 1], - { sticky: true - }); - this.openPopup(e.latlng); + var paths = gpx.split("/") + var filename = paths[paths.length - 1] + var kms = e.target.get_distance() / 1000 + var movingTime = e.target.get_duration_string_iso(e.target.get_moving_time(), true) + var movingSpeed = e.target.get_moving_speed() + var totalAvgTime = e.target.get_duration_string_iso(e.target.get_total_time(), true) + var totalAvgSpeed = e.target.get_total_speed() + var tooltip = ` +
+

${e.target.get_name()}

+
+ Distance: ${kms.toFixed(2)} km
+ Total time: ${totalAvgTime} h
+ Moving time: ${movingTime} h
+
+
+ Elevation gain: ${e.target.get_elevation_gain().toFixed()} m d+
+ Avg speed: ${totalAvgSpeed.toFixed(2)} km/h
+ Avg moving speed: ${movingSpeed.toFixed(2)} km/h
+
+
+

Click to download: ${filename}

+
` + this.bindTooltip(tooltip, {sticky: true}) + this.openPopup(e.latlng) }).on('mouseout', function(e) { setTimeout(this.closePopup(), 500); }).on('click', function(e) { diff --git a/org/gpx/20260927_biciclettata/js/gpx.js b/org/gpx/20260927_biciclettata/js/gpx.js index 6d9b9fa..01109c5 100644 --- a/org/gpx/20260927_biciclettata/js/gpx.js +++ b/org/gpx/20260927_biciclettata/js/gpx.js @@ -34,14 +34,33 @@ }).on('loaded', function(e) { map.fitBounds(e.target.getBounds()); }).on('mouseover', function(e) { - var paths = gpx.split("/"); - this.bindTooltip( - "Click to download: " + paths[paths.length - 1], - { sticky: true - }); - this.openPopup(e.latlng); - }).on('mouseout', function(e) { - setTimeout(this.closePopup(), 500); + var paths = gpx.split("/") + var filename = paths[paths.length - 1] + var kms = e.target.get_distance() / 1000 + var movingTime = e.target.get_duration_string_iso(e.target.get_moving_time(), true) + var movingSpeed = e.target.get_moving_speed() + var totalAvgTime = e.target.get_duration_string_iso(e.target.get_total_time(), true) + var totalAvgSpeed = e.target.get_total_speed() + var tooltip = ` +
+

${e.target.get_name()}

+
+ Distance: ${kms.toFixed(2)} km
+ Total time: ${totalAvgTime} h
+ Moving time: ${movingTime} h
+
+
+ Elevation gain: ${e.target.get_elevation_gain().toFixed()} m d+
+ Avg speed: ${totalAvgSpeed.toFixed(2)} km/h
+ Avg moving speed: ${movingSpeed.toFixed(2)} km/h
+
+
+

Click to download: ${filename}

+
` + this.bindTooltip(tooltip, {sticky: true}) + this.openPopup(e.latlng) + // }).on('mouseout', function(e) { + // setTimeout(this.closePopup(), 500); }).on('click', function(e) { setTimeout(this.closePopup(), 500); download(gpx);