From 533bbc41f15241c19b7635a722c022e9dec9109e Mon Sep 17 00:00:00 2001 From: bastianonm Date: Mon, 9 Jun 2014 13:18:24 +0000 Subject: [PATCH] * Add feet/Nautical Miles units (thanks to elperepat) * Update OpenStreetMaps Credits (thanks to OpenStreetMaps) * WP Tabs fix (thanks to Douglas) --- WP-GPX-Maps.js | 38 ++++++++++++++++++++++----- readme.txt | 10 ++++--- wp-gpx-maps.php | 48 +++++++++++++++++++++++++++++----- wp-gpx-maps_admin.php | 2 +- wp-gpx-maps_admin_settings.php | 1 + 5 files changed, 82 insertions(+), 17 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index a4615aa..64352aa 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -2,7 +2,7 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.devfarm.it/ Description: Draws a gpx track with altitude graph -Version: 1.3.0 +Version: 1.3.3 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ */ @@ -11,6 +11,7 @@ Author URI: http://www.pedemontanadelgrappa.it/ var infowindow; var CustomMarker; + var map; CustomMarker = function( map, latlng, src, img_w, img_h) { this.latlng_ = latlng; @@ -135,6 +136,7 @@ Author URI: http://www.pedemontanadelgrappa.it/ var el_map = document.getElementById("map_" + targetId); var el_chart = document.getElementById("chart_" + targetId); var el_report = document.getElementById("report_" + targetId); + var el_osm_credits = document.getElementById("wpgpxmaps_" + targetId + "_osm_footer"); var mapWidth = el_map.style.width; @@ -164,8 +166,16 @@ Author URI: http://www.pedemontanadelgrappa.it/ case 'OSM6': { mapType = "OSM6"; break;} default: { mapType = google.maps.MapTypeId.HYBRID; break;} } - - var map = new google.maps.Map(el_map, { + + if ( mapType == "TERRAIN" || mapType == "SATELLITE" || mapType == "ROADMAP" ) + { + // google maps + } else { + // Show OpenStreetMaps credits + $(el_osm_credits).show(); + } + + map = new google.maps.Map(el_map, { mapTypeId: mapType, scrollwheel: (zoomOnScrollWheel == 'true'), mapTypeControlOptions: { @@ -223,8 +233,7 @@ Author URI: http://www.pedemontanadelgrappa.it/ alt : "MapToolKit - Terrain", maxZoom: 18 })); - - + // FULL SCREEN BUTTON var controlDiv = document.createElement('div'); controlDiv.style.padding = '5px'; @@ -239,7 +248,7 @@ Author URI: http://www.pedemontanadelgrappa.it/ // Setup the click event listeners google.maps.event.addDomListener(controlUI, 'click', function(event) { var isFullScreen = (controlUI.isfullscreen == true); - var mapDiv = map.getDiv(); + var mapDiv = [ map.getDiv(), map.getDiv().parentNode ]; var center = map.getCenter(); if (isFullScreen) @@ -630,6 +639,18 @@ Author URI: http://www.pedemontanadelgrappa.it/ map.setCenter(bounds.getCenter()); map.fitBounds(bounds); + // FIX post tabs + var $_tab = $(el).closest(".wordpress-post-tabs").eq(0); + if ($_tab) + { + $("div > ul > li > a", $_tab).click(function(e){ + setTimeout(function(e){ + map.fitBounds(bounds); + google.maps.event.trigger(map, 'resize'); + },10); + }); + } + var controlUIcenter = null; var idFirstCenterChanged = true; @@ -691,6 +712,11 @@ Author URI: http://www.pedemontanadelgrappa.it/ l_x = { suf : "mi", dec : 1 }; l_y = { suf : "m", dec : 0 }; } + else if (unit=="5") + { + l_x = { suf : "NM", dec : 1 }; + l_y = { suf : "ft", dec : 0 }; + } else { l_x = { suf : "m", dec : 0 }; diff --git a/readme.txt b/readme.txt index 2273a5d..7434eca 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.2 +Stable tag: 1.3.3 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -14,7 +14,7 @@ Draws a gpx track with altitude graph. You can also display your nextgen gallery This plugin has, as input, the GPX file with the track you've made and as output it shows the map of the track and an interactive altitude graph (where available). Fully configurable: -- Custom colors +- Custom colors - Custom icons - Multiple language support @@ -102,7 +102,7 @@ The attributes are: 1. pointsoffset: skip points closer than XX meters(default is 10) -1. uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles) +1. uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4, 5 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles) 1. mlinecolor: map line color (default is #3366cc) @@ -187,6 +187,10 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.3.3 = +* Add feet/Nautical Miles units (thanks to elperepat) +* Update OpenStreetMaps Credits +* WP Tabs fix = 1.3.2 = * fix: left axis not visible (downgrade highcharts to v3.0.10) * fix: fullscreen map js error diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 56a721b..aaaebdf 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.2 +Version: 1.3.3 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ */ @@ -18,7 +18,7 @@ add_shortcode('sgpxf','handle_WP_GPX_Maps_folder_Shortcodes'); register_activation_hook(__FILE__,'WP_GPX_Maps_install'); register_deactivation_hook( __FILE__, 'WP_GPX_Maps_remove'); add_filter('plugin_action_links', 'WP_GPX_Maps_action_links', 10, 2); -add_action( 'wp_print_scripts', 'print_WP_GPX_Maps_scripts' ); +add_action('wp_print_styles', 'print_WP_GPX_Maps_styles' ); add_action('wp_enqueue_scripts', 'enqueue_WP_GPX_Maps_scripts'); add_action('plugins_loaded' ,'WP_GPX_Maps_lang_init'); @@ -51,10 +51,10 @@ function enqueue_WP_GPX_Maps_scripts() wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'googlemaps', '//maps.googleapis.com/maps/api/js?sensor=false', null, null); wp_enqueue_script( 'highcharts', "//code.highcharts.com/3.0.10/highcharts.js", array('jquery'), "3.0.10", true); - wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.2"); + wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','highcharts'), "1.3.3"); } -function print_WP_GPX_Maps_scripts() +function print_WP_GPX_Maps_styles() { ?> ID."_".rand(1,5000000); $output = ' -
-
+
+
+
+ +
diff --git a/wp-gpx-maps_admin.php b/wp-gpx-maps_admin.php index 2351475..425616a 100644 --- a/wp-gpx-maps_admin.php +++ b/wp-gpx-maps_admin.php @@ -108,7 +108,7 @@ function WP_GPX_Maps_html_page() {
  • waypoints: print the gpx waypoints inside the map (default is FALSE)
  • donotreducegpx: print all the point without reduce it (default is FALSE)
  • pointsoffset: skip points closer than XX meters(default is 10)
  • -
  • uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles)
  • +
  • uom: distance/altitude possible unit of measure are: 0, 1, 2, 3, 4, 5 (0 = meters, 1 = feet/miles, 2 = meters/kilometers, 3 = meters/nautical miles, 4 = meters/miles, 5 = feet/nautical miles)
  • mlinecolor: map line color (default is #3366cc)
  • glinecolor: graph line color (default is #3366cc)
  • glinecolorspeed: speed line color (default is #ff0000)
  • diff --git a/wp-gpx-maps_admin_settings.php b/wp-gpx-maps_admin_settings.php index 90e7b35..09f48f9 100644 --- a/wp-gpx-maps_admin_settings.php +++ b/wp-gpx-maps_admin_settings.php @@ -299,6 +299,7 @@ +