From c9b2d4b6fbcf02be5c33b14884fa10e49b0eda17 Mon Sep 17 00:00:00 2001 From: bastianonm Date: Mon, 4 Jun 2012 12:31:21 +0000 Subject: [PATCH] --- WP-GPX-Maps.js | 107 ++++++++++++++++++++++++------------------------ readme.txt | 5 ++- wp-gpx-maps.php | 27 ++++++------ 3 files changed, 71 insertions(+), 68 deletions(-) diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 984f0db..42b7c99 100644 --- a/WP-GPX-Maps.js +++ b/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; + + var me = this; - // Check if the el has been created. - var el = this.img_; - if (!el) { + // Check if the el has been created. + var el = this.img_; + if (!el) { - 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_; - - 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, "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, "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, "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); + }); - // Then add the overlay to the DOM - var panes = this.getPanes(); - panes.overlayImage.appendChild(el); - } + // 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; - } + // 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) { diff --git a/readme.txt b/readme.txt index 0da7395..6e79341 100644 --- a/readme.txt +++ b/readme.txt @@ -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 Yoko theme = 1.1.19 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 664dc9b..7e0415d 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -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() { ?> - - - +