This commit is contained in:
bastianonm 2011-12-20 17:17:24 +00:00
parent 5720ab8d00
commit 4f574f03b7
3 changed files with 39 additions and 9 deletions

View File

@ -9,7 +9,31 @@ var loc_it =
"altitude": "Altitudine" "altitude": "Altitudine"
}; };
var loc = loc_en; var loc = loc_en;
function sleep(ms)
{
var dt = new Date();
dt.setTime(dt.getTime() + ms);
while (new Date().getTime() < dt.getTime());
}
function wpgpxmaps(targhetId,mapType,mapData,graphData) function wpgpxmaps(targhetId,mapType,mapData,graphData)
{
var i = 0;
while ((google == undefined || google.maps == undefined || google.visualization == undefined))
{
sleep(100);
i++;
if (i== 100)
{
return;
}
}
_wpgpxmaps(targhetId,mapType,mapData,graphData);
}
function _wpgpxmaps(targhetId,mapType,mapData,graphData)
{ {
var el = document.getElementById("wpgpxmaps_" + targhetId); var el = document.getElementById("wpgpxmaps_" + targhetId);
var el_map = document.getElementById("map_" + targhetId); var el_map = document.getElementById("map_" + targhetId);

View File

@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=basti
Tags: maps, gpx, gps, graph, google maps, google chart Tags: maps, gpx, gps, graph, google maps, google chart
Requires at least: 2.0.0 Requires at least: 2.0.0
Tested up to: 3.3 Tested up to: 3.3
Stable tag: 1.0.4 Stable tag: 1.0.5
License: GPLv2 or later License: GPLv2 or later
Draws a gpx track with altitude graph Draws a gpx track with altitude graph
@ -66,6 +66,8 @@ Yes!
2. Screenshot Admin area 2. Screenshot Admin area
== Changelog == == Changelog ==
= 1.0.5 =
* Fixed javscript errors with slow javascript loading
= 1.0.4 = = 1.0.4 =
* Fixed Upload file error * Fixed Upload file error
* Added support for Garmin gpx (http://www.garmin.com/xmlschemas/GpxExtensions/v3 namespace) * Added support for Garmin gpx (http://www.garmin.com/xmlschemas/GpxExtensions/v3 namespace)
@ -80,6 +82,7 @@ Yes!
* Initial release. * Initial release.
== Upgrade Notice == == Upgrade Notice ==
= 1.0.5 =
= 1.0.4 = = 1.0.4 =
= 1.0.3 = = 1.0.3 =
= 1.0.2 = = 1.0.2 =

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.darwinner.it/ Plugin URI: http://www.darwinner.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.0.4 Version: 1.0.5
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/ Author URI: http://www.pedemontanadelgrappa.it/
License: GPL License: GPL
@ -36,17 +36,19 @@ function WP_GPX_Maps_action_links($links, $file) {
return $links; return $links;
} }
function enqueue_WP_GPX_Maps_scripts() function enqueue_WP_GPX_Maps_scripts()
{ {
?> ?>
<script type='text/javascript' src='https://www.google.com/jsapi?ver=3.2.1'></script> <script type='text/javascript' src='https://www.google.com/jsapi?ver=3.2.1'></script>
<script type='text/javascript'> <script type='text/javascript'>
google.load('maps', '3', {other_params: 'sensor=false'});
google.load('visualization', '1', {'packages':['corechart']}); google.load('visualization', '1', {'packages':['corechart']});
google.load("maps", "3", {other_params: 'sensor=false'});
</script> </script>
<script type='text/javascript' src='<?php echo plugins_url('/WP-GPX-Maps.js', __FILE__) ?>'></script> <script type='text/javascript' src='<?php echo plugins_url('/WP-GPX-Maps.js', __FILE__) ?>'></script>
<?php <?php
} }
function handle_WP_GPX_Maps_Shortcodes($attr, $content='') function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
{ {
@ -100,11 +102,12 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
<div id="chart_'.$r.'" class="plot" style="width:'.$w.'; height:'.$gh.'"></div> <div id="chart_'.$r.'" class="plot" style="width:'.$w.'; height:'.$gh.'"></div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function () {
var m_'.$r.' = ['.$points_maps.']; var m_'.$r.' = ['.$points_maps.'];
var c_'.$r.' = ['.$points_graph.']; var c_'.$r.' = ['.$points_graph.'];
wpgpxmaps("'.$r.'",\''.$mt.'\',m_'.$r.',c_'.$r.');
}); wpgpxmaps("'.$r.'","'.$mt.'",m_'.$r.',c_'.$r.');
</script>'; </script>';
} }