This commit is contained in:
bastianonm 2012-06-04 12:31:21 +00:00
parent 68b9d8ab1b
commit c9b2d4b6fb
3 changed files with 71 additions and 68 deletions

View File

@ -43,8 +43,6 @@ function setup()
CustomMarker = function( map, latlng, src, img_w, img_h) { CustomMarker = function( map, latlng, src, img_w, img_h) {
this.latlng_ = latlng; 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.setMap(map);
this.src_ = src; this.src_ = src;
this.img_w_ = img_w; this.img_w_ = img_w;
@ -54,71 +52,72 @@ function setup()
CustomMarker.prototype = new google.maps.OverlayView(); CustomMarker.prototype = new google.maps.OverlayView();
CustomMarker.prototype.draw = function() { CustomMarker.prototype.draw = function() {
var me = this;
// Check if the el has been created. var me = this;
var el = this.img_;
if (!el) {
el = this.img_ = document.createElement('img'); // Check if the el has been created.
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;"; var el = this.img_;
el.setAttribute("lat",this.latlng_.lat()); if (!el) {
el.setAttribute("lon",this.latlng_.lng());
el.src=this.src_;
google.maps.event.addDomListener(el, "click", function(event) { this.img_ = document.createElement('img');
google.maps.event.trigger(me, "click",el); 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) { google.maps.event.addDomListener(el, "click", function(event) {
var _t = el.style.top.replace('px',''); google.maps.event.trigger(me, "click", el);
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, "mouseout", function(event) { google.maps.event.addDomListener(el, "mouseover", function(event) {
jQuery(el).animate({ var _t = el.style.top.replace('px','');
height: me.img_h_ / 3, var _l = el.style.left.replace('px','');
width: me.img_w_ / 3, jQuery(el).animate({
top : me.orig_top, height: me.img_h_,
left : me.orig_left, width : me.img_w_,
'z-index' : 1 top : _t - (me.img_h_ / 3),
}, 100); left : _l - (me.img_w_ / 3),
}); 'z-index' : 9999
}, 100);
});
// Then add the overlay to the DOM google.maps.event.addDomListener(el, "mouseout", function(event) {
var panes = this.getPanes(); jQuery(el).animate({
panes.overlayImage.appendChild(el); 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 // Then add the overlay to the DOM
var point = this.getProjection().fromLatLngToDivPixel(this.latlng_); var panes = this.getPanes();
if (point) { panes.overlayImage.appendChild(el);
el.style.left = point.x + 'px'; }
el.style.top = point.y + 'px';
this.orig_left = point.x; // Position the overlay
this.orig_top = point.y; 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() { CustomMarker.prototype.remove = function() {
// Check if the overlay was on the map and needs to be removed. // Check if the overlay was on the map and needs to be removed.
if (this.img_) { if (this.img_) {
this.img_.parentNode.removeChild(this.img_); this.img_.parentNode.removeChild(this.img_);
this.img_ = null; this.img_ = null;
} }
}; };
} }
function _wpgpxmaps(params) function _wpgpxmaps(params)
{ {

View File

@ -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 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 Requires at least: 2.0.0
Tested up to: 3.3 Tested up to: 3.3
Stable tag: 1.1.20 Stable tag: 1.1.21
License: GPLv2 or later License: GPLv2 or later
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.
@ -123,6 +123,9 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == Changelog ==
= 1.1.21 =
* google maps images fixed (templates with bad css)
* upgrade to google maps 3.9
= 1.1.20 = = 1.1.20 =
* google maps images fixed in <a href="http://wordpress.org/extend/themes/yoko">Yoko theme</a> * google maps images fixed in <a href="http://wordpress.org/extend/themes/yoko">Yoko theme</a>
= 1.1.19 = = 1.1.19 =

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.1.20 Version: 1.1.21
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/ Author URI: http://www.pedemontanadelgrappa.it/
License: GPL License: GPL
@ -44,8 +44,12 @@ function enqueue_WP_GPX_Maps_scripts()
//wp_enqueue_script( 'jquery' ); //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_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_enqueue_script( 'WP-GPX-Maps' );
wp_deregister_script( 'highcharts' ); wp_deregister_script( 'highcharts' );
@ -57,17 +61,14 @@ function enqueue_WP_GPX_Maps_scripts()
function print_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> <style type="text/css">
<script type='text/javascript'> .wpgpxmaps { clear:both; }
google.load("maps", "3", {other_params: 'sensor=false'}); #content .wpgpxmaps img,
</script> .entry-content .wpgpxmaps img,
<style type="text/css"> .wpgpxmaps img { max-width: none; width: none; padding:0; background:none; }
.wpgpxmaps { clear:both; } .wpgpxmaps .ngimages { display:none; }
#content .wpgpxmaps img, .wpgpxmaps .myngimages { border:1px solid #fff;position:absolute;cursor:pointer;margin:0;z-index:1; }
.entry-content .wpgpxmaps img, </style>
.wpgpxmaps img { max-width: none; width: none; }
.wpgpxmaps .ngimages { display:none; }
</style>
<?php <?php
} }