From 2af057702a427c26e5e4d689e6396dc935fa3208 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Wed, 9 Jul 2014 15:55:55 +0000 Subject: [PATCH] * Fix: Garmin cadence * Infowindows closing on mouseout --- WP-GPX-Maps.js | 8 ++++++++ readme.txt | 5 ++++- wp-gpx-maps.php | 4 ++-- wp-gpx-maps_utils.php | 35 ++++++++++++----------------------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 64352aa..61808fb 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -1199,6 +1199,14 @@ Author URI: http://www.pedemontanadelgrappa.it/ infowindow = new google.maps.InfoWindow({ content: cnt}); infowindow.open(map,m); }); + + google.maps.event.addListener(m, "mouseout", function () { + if (infowindow) + { + infowindow.close(); + } + }); + } function getItemFromArray(arr,index) diff --git a/readme.txt b/readme.txt index 7434eca..f060cbb 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence Requires at least: 2.0.0 Tested up to: 3.9 -Stable tag: 1.3.3 +Stable tag: 1.3.4 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -187,6 +187,9 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.3.4 = +* Fix: Garmin cadence +* Infowindows closing on mouseout = 1.3.3 = * Add feet/Nautical Miles units (thanks to elperepat) * Update OpenStreetMaps Credits diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index aaaebdf..85548d0 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -3,7 +3,7 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.devfarm.it/ Description: Draws a GPX track with altitude chart -Version: 1.3.3 +Version: 1.3.4 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ */ @@ -249,7 +249,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') $gpxurl = $gpx; - $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.2.7"; + $cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showEle,$showW,$showHr,$showAtemp,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$showGrade,$uomspeed,$uom,$distanceType,v1.3.4"; $cacheFileName = md5($cacheFileName); diff --git a/wp-gpx-maps_utils.php b/wp-gpx-maps_utils.php index fba363a..0ff69ca 100644 --- a/wp-gpx-maps_utils.php +++ b/wp-gpx-maps_utils.php @@ -201,32 +201,21 @@ if (isset($trkpt->extensions)) { - + $trkpt->registerXPathNamespace('gpxtpx', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1'); - $_hr = @$trkpt->xpath('extensions/gpxtpx:TrackPointExtension/gpxtpx:hr/text() | extensions/TrackPointExtension/hr/text()'); - if ($_hr) + $_ext = @$trkpt->xpath('extensions/gpxtpx:TrackPointExtension | extensions/TrackPointExtension'); + + if ($_ext) { - foreach ($_hr as $node) { - $hr = (float)$node; + if ($_ext[0]) + { + $hr = @$_ext[0]->hr; + $atemp = @$_ext[0]->atemp; + $cad = @$_ext[0]->cad; } } - $_atemp = @$trkpt->xpath('extensions/gpxtpx:TrackPointExtension/gpxtpx:atemp/text() | extensions/TrackPointExtension/atemp/text()'); - if ($_atemp) - { - foreach ($_atemp as $node) { - $atemp = (float)$node; - } - } - - $_cad = @$trkpt->xpath('extensions/gpxtpx:TrackPointExtension/gpxtpx:cad/text() | extensions/TrackPointExtension/cad/text()'); - if ($_cad) - { - foreach ($_cad as $node) { - $cad = (float)$node; - } - } } if ($lastLat == 0 && $lastLon == 0) @@ -239,9 +228,9 @@ array_push($points->ele, (float)round($ele,2)); array_push($points->dist, (float)round($dist,2)); array_push($points->speed, 0); - array_push($points->hr, $hr); - array_push($points->atemp, $atemp); - array_push($points->cad, $cad); + array_push($points->hr, (float)$hr); + array_push($points->atemp, (float)$atemp); + array_push($points->cad, (float)$cad); array_push($points->grade, $grade); $lastLat=$lat;