renamed javascript functions to avoid collision with other plugins

reduced chart line thickness
This commit is contained in:
bastianonm 2018-04-04 06:45:39 +00:00
parent 60b8c67a56
commit 31066887ac
3 changed files with 19 additions and 15 deletions

View File

@ -2,7 +2,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.devfarm.it/ Plugin URI: http://www.devfarm.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.5.02 Version: 1.5.05
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.devfarm.it/ Author URI: http://www.devfarm.it/
*/ */
@ -778,6 +778,7 @@ Author URI: http://www.devfarm.it/
data: { data: {
datasets: [], datasets: [],
}, },
borderWidth: 1,
options: { options: {
animation: { animation: {
//duration: 0, // general animation time //duration: 0, // general animation time
@ -958,7 +959,7 @@ Author URI: http://www.devfarm.it/
} }
_formats.push(l_y) _formats.push(l_y)
hoptions.options.scales.yAxes.push(yaxe); hoptions.options.scales.yAxes.push(yaxe);
hoptions.data.datasets.push( getDataset(lng.altitude, myData.Items, color2, yaxe.id )); hoptions.data.datasets.push( wpgpxmapsGetDataset(lng.altitude, myData.Items, color2, yaxe.id ));
} }
@ -1028,7 +1029,7 @@ Author URI: http://www.devfarm.it/
_formats.push(l_s); _formats.push(l_s);
hoptions.options.scales.yAxes.push(yaxe); hoptions.options.scales.yAxes.push(yaxe);
hoptions.data.datasets.push( getDataset(lng.speed, myData.Items, color3, yaxe.id ) ); hoptions.data.datasets.push( wpgpxmapsGetDataset(lng.speed, myData.Items, color3, yaxe.id ) );
} }
@ -1051,7 +1052,7 @@ Author URI: http://www.devfarm.it/
}; };
hoptions.options.scales.yAxes.push(yaxe); hoptions.options.scales.yAxes.push(yaxe);
hoptions.data.datasets.push( getDataset(lng.heartRate, myData.Items, color4, yaxe.id ) ); hoptions.data.datasets.push( wpgpxmapsGetDataset(lng.heartRate, myData.Items, color4, yaxe.id ) );
_formats.push(l_hr); _formats.push(l_hr);
} }
@ -1075,7 +1076,7 @@ Author URI: http://www.devfarm.it/
}; };
hoptions.options.scales.yAxes.push(yaxe); hoptions.options.scales.yAxes.push(yaxe);
hoptions.data.datasets.push( getDataset(lng.atemp, myData,Items, color7, yaxe.id ) ); hoptions.data.datasets.push( wpgpxmapsGetDataset(lng.atemp, myData,Items, color7, yaxe.id ) );
_formats.push({ suf : "°C", dec : 1 }); _formats.push({ suf : "°C", dec : 1 });
} }
@ -1100,7 +1101,7 @@ Author URI: http://www.devfarm.it/
}; };
hoptions.options.scales.yAxes.push(yaxe); hoptions.options.scales.yAxes.push(yaxe);
hoptions.data.datasets.push( getDataset(lng.cadence, myData.Items, color5, yaxe.id) ); hoptions.data.datasets.push( wpgpxmapsGetDataset(lng.cadence, myData.Items, color5, yaxe.id) );
_formats.push(l_cad); _formats.push(l_cad);
} }
@ -1125,7 +1126,7 @@ Author URI: http://www.devfarm.it/
_formats.push(l_grade); _formats.push(l_grade);
hoptions.options.scales.yAxes.push(yaxe); hoptions.options.scales.yAxes.push(yaxe);
hoptions.data.datasets.push( getDataset(lng.grade, myData.Items, color6, yaxe.id ) ); hoptions.data.datasets.push( wpgpxmapsGetDataset(lng.grade, myData.Items, color6, yaxe.id ) );
} }
@ -1180,14 +1181,14 @@ Author URI: http://www.devfarm.it/
} }
function getDataset(name,data,color, id) { function wpgpxmapsGetDataset(name,data,color, id) {
return { return {
label: name, label: name,
data : data, data : data,
borderColor: color, borderColor: color,
backgroundColor: hexToRgbA(color, .3), backgroundColor: hexToRgbA(color, .3),
pointRadius: 0, pointRadius: 0,
borderWidth: 0, borderWidth: 1,
pointHoverRadius: 1, pointHoverRadius: 1,
yAxisID: id, yAxisID: id,
} }
@ -1273,7 +1274,7 @@ Author URI: http://www.devfarm.it/
if (points[i]==null) if (points[i]==null)
continue; continue;
var d = dist(points[i][0], points[i][1], lat, lon); var d = wpgpxmapsDist(points[i][0], points[i][1], lat, lon);
if ( d < dd ) if ( d < dd )
{ {
ii = i; ii = i;
@ -1296,7 +1297,7 @@ Author URI: http://www.devfarm.it/
imageLat = imageLat.replace(",", "."); imageLat = imageLat.replace(",", ".");
imageLon = imageLon.replace(",", "."); imageLon = imageLon.replace(",", ".");
var d = dist(imageLat, imageLon, lat, lon); var d = wpgpxmapsDist(imageLat, imageLon, lat, lon);
if ( d < dd ) if ( d < dd )
{ {
img = img_spans[i]; img = img_spans[i];
@ -1311,7 +1312,7 @@ Author URI: http://www.devfarm.it/
return (RE.test(input)); return (RE.test(input));
} }
function dist(lat1,lon1,lat2,lon2) function wpgpxmapsDist(lat1,lon1,lat2,lon2)
{ {
// mathematically not correct but fast // mathematically not correct but fast
var dLat = (lat2-lat1); var dLat = (lat2-lat1);

View File

@ -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 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 Requires at least: 2.0.0
Tested up to: 4.9.4 Tested up to: 4.9.4
Stable tag: 1.5.04 Stable tag: 1.5.05
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -153,6 +153,9 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == Changelog ==
= 1.5.05 =
* renamed javascript functions to avoid collision with other plugins
* reduced chart line thickness
= 1.5.04 = = 1.5.04 =
* fix uom * fix uom
* fix file not found * fix file not found

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.devfarm.it/ Plugin URI: http://www.devfarm.it/
Description: Draws a GPX track with altitude chart Description: Draws a GPX track with altitude chart
Version: 1.5.04 Version: 1.5.05
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.devfarm.it/ Author URI: http://www.devfarm.it/
*/ */
@ -62,7 +62,7 @@ function enqueue_WP_GPX_Maps_scripts_admin($hook)
function enqueue_WP_GPX_Maps_scripts() { function enqueue_WP_GPX_Maps_scripts() {
wp_register_script('chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), "2.7.2" ); wp_register_script('chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), "2.7.2" );
wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','googlemaps','chartjs'), "1.5.031" ); wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','googlemaps','chartjs'), "1.5.05" );
$wpgpxmaps_googlemapsv3_apikey = get_option('wpgpxmaps_googlemapsv3_apikey'); $wpgpxmaps_googlemapsv3_apikey = get_option('wpgpxmaps_googlemapsv3_apikey');