This commit is contained in:
parent
68b9d8ab1b
commit
c9b2d4b6fb
105
WP-GPX-Maps.js
105
WP-GPX-Maps.js
|
@ -43,8 +43,6 @@ function setup()
|
|||
CustomMarker = function( map, latlng, src, img_w, img_h) {
|
||||
this.latlng_ = latlng;
|
||||
|
||||
// Once the LatLng and text are set, add the overlay to the map. This will
|
||||
// trigger a call to panes_changed which should in turn call draw.
|
||||
this.setMap(map);
|
||||
this.src_ = src;
|
||||
this.img_w_ = img_w;
|
||||
|
@ -54,71 +52,72 @@ function setup()
|
|||
CustomMarker.prototype = new google.maps.OverlayView();
|
||||
|
||||
CustomMarker.prototype.draw = function() {
|
||||
var me = this;
|
||||
|
||||
// Check if the el has been created.
|
||||
var el = this.img_;
|
||||
if (!el) {
|
||||
var me = this;
|
||||
|
||||
el = this.img_ = document.createElement('img');
|
||||
el.style.cssText = "border:1px solid #fff;position:absolute;cursor:pointer;margin:0;width:"+(this.img_w_/3)+"px;height:"+(this.img_h_/3)+"px;z-index:1;";
|
||||
el.setAttribute("lat",this.latlng_.lat());
|
||||
el.setAttribute("lon",this.latlng_.lng());
|
||||
el.src=this.src_;
|
||||
// Check if the el has been created.
|
||||
var el = this.img_;
|
||||
if (!el) {
|
||||
|
||||
google.maps.event.addDomListener(el, "click", function(event) {
|
||||
google.maps.event.trigger(me, "click",el);
|
||||
});
|
||||
this.img_ = document.createElement('img');
|
||||
el = this.img_;
|
||||
el.style.cssText = "width:"+(this.img_w_/3)+"px;height:"+(this.img_h_/3)+"px;";
|
||||
el.setAttribute("class", "myngimages");
|
||||
el.setAttribute("lat",this.latlng_.lat());
|
||||
el.setAttribute("lon",this.latlng_.lng());
|
||||
el.src=this.src_;
|
||||
|
||||
google.maps.event.addDomListener(el, "mouseover", function(event) {
|
||||
var _t = el.style.top.replace('px','');
|
||||
var _l = el.style.left.replace('px','');
|
||||
jQuery(el).animate({
|
||||
height: me.img_h_,
|
||||
width : me.img_w_,
|
||||
top : _t - (me.img_h_ / 3),
|
||||
left : _l - (me.img_w_ / 3),
|
||||
'z-index' : 9999
|
||||
}, 100);
|
||||
});
|
||||
google.maps.event.addDomListener(el, "click", function(event) {
|
||||
google.maps.event.trigger(me, "click", el);
|
||||
});
|
||||
|
||||
google.maps.event.addDomListener(el, "mouseout", function(event) {
|
||||
jQuery(el).animate({
|
||||
height: me.img_h_ / 3,
|
||||
width: me.img_w_ / 3,
|
||||
top : me.orig_top,
|
||||
left : me.orig_left,
|
||||
'z-index' : 1
|
||||
}, 100);
|
||||
});
|
||||
google.maps.event.addDomListener(el, "mouseover", function(event) {
|
||||
var _t = el.style.top.replace('px','');
|
||||
var _l = el.style.left.replace('px','');
|
||||
jQuery(el).animate({
|
||||
height: me.img_h_,
|
||||
width : me.img_w_,
|
||||
top : _t - (me.img_h_ / 3),
|
||||
left : _l - (me.img_w_ / 3),
|
||||
'z-index' : 9999
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// Then add the overlay to the DOM
|
||||
var panes = this.getPanes();
|
||||
panes.overlayImage.appendChild(el);
|
||||
}
|
||||
google.maps.event.addDomListener(el, "mouseout", function(event) {
|
||||
jQuery(el).animate({
|
||||
height: me.img_h_ / 3,
|
||||
width: me.img_w_ / 3,
|
||||
top : me.orig_top,
|
||||
left : me.orig_left,
|
||||
'z-index' : 1
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// Position the overlay
|
||||
var point = this.getProjection().fromLatLngToDivPixel(this.latlng_);
|
||||
if (point) {
|
||||
el.style.left = point.x + 'px';
|
||||
el.style.top = point.y + 'px';
|
||||
this.orig_left = point.x;
|
||||
this.orig_top = point.y;
|
||||
}
|
||||
// Then add the overlay to the DOM
|
||||
var panes = this.getPanes();
|
||||
panes.overlayImage.appendChild(el);
|
||||
}
|
||||
|
||||
// Position the overlay
|
||||
var point = this.getProjection().fromLatLngToDivPixel(this.latlng_);
|
||||
if (point) {
|
||||
el.style.left = point.x + 'px';
|
||||
el.style.top = point.y + 'px';
|
||||
this.orig_left = point.x;
|
||||
this.orig_top = point.y;
|
||||
}
|
||||
};
|
||||
|
||||
CustomMarker.prototype.remove = function() {
|
||||
// Check if the overlay was on the map and needs to be removed.
|
||||
if (this.img_) {
|
||||
this.img_.parentNode.removeChild(this.img_);
|
||||
this.img_ = null;
|
||||
}
|
||||
// Check if the overlay was on the map and needs to be removed.
|
||||
if (this.img_) {
|
||||
this.img_.parentNode.removeChild(this.img_);
|
||||
this.img_ = null;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function _wpgpxmaps(params)
|
||||
{
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|||
Tags: maps, gpx, gps, graph, chart, google maps, highcharts, 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.3
|
||||
Stable tag: 1.1.20
|
||||
Stable tag: 1.1.21
|
||||
License: GPLv2 or later
|
||||
|
||||
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
||||
|
@ -123,6 +123,9 @@ Yes!
|
|||
1. Altitude & Speed & Hearth rate
|
||||
|
||||
== Changelog ==
|
||||
= 1.1.21 =
|
||||
* google maps images fixed (templates with bad css)
|
||||
* upgrade to google maps 3.9
|
||||
= 1.1.20 =
|
||||
* google maps images fixed in <a href="http://wordpress.org/extend/themes/yoko">Yoko theme</a>
|
||||
= 1.1.19 =
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: WP-GPX-Maps
|
||||
Plugin URI: http://www.darwinner.it/
|
||||
Description: Draws a gpx track with altitude graph
|
||||
Version: 1.1.20
|
||||
Version: 1.1.21
|
||||
Author: Bastianon Massimo
|
||||
Author URI: http://www.pedemontanadelgrappa.it/
|
||||
License: GPL
|
||||
|
@ -44,8 +44,12 @@ function enqueue_WP_GPX_Maps_scripts()
|
|||
|
||||
//wp_enqueue_script( 'jquery' );
|
||||
|
||||
wp_deregister_script( 'googleapis' );
|
||||
wp_register_script( 'googleapis', 'https://maps.googleapis.com/maps/api/js?sensor=false&v=3.9', null, null);
|
||||
wp_enqueue_script( 'googleapis' );
|
||||
|
||||
wp_deregister_script( 'WP-GPX-Maps' );
|
||||
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery'), "1.1.15");
|
||||
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery'), "1.1.21");
|
||||
wp_enqueue_script( 'WP-GPX-Maps' );
|
||||
|
||||
wp_deregister_script( 'highcharts' );
|
||||
|
@ -57,17 +61,14 @@ function enqueue_WP_GPX_Maps_scripts()
|
|||
function print_WP_GPX_Maps_scripts()
|
||||
{
|
||||
?>
|
||||
<script type='text/javascript' src='https://www.google.com/jsapi?ver=3.2.1'></script>
|
||||
<script type='text/javascript'>
|
||||
google.load("maps", "3", {other_params: 'sensor=false'});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.wpgpxmaps { clear:both; }
|
||||
#content .wpgpxmaps img,
|
||||
.entry-content .wpgpxmaps img,
|
||||
.wpgpxmaps img { max-width: none; width: none; }
|
||||
.wpgpxmaps .ngimages { display:none; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.wpgpxmaps { clear:both; }
|
||||
#content .wpgpxmaps img,
|
||||
.entry-content .wpgpxmaps img,
|
||||
.wpgpxmaps img { max-width: none; width: none; padding:0; background:none; }
|
||||
.wpgpxmaps .ngimages { display:none; }
|
||||
.wpgpxmaps .myngimages { border:1px solid #fff;position:absolute;cursor:pointer;margin:0;z-index:1; }
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue