Flexible Map - Version 1.7.1

Version Description

[2013-10-13] = * fixed: Google link was showing marker at centre, not at marker location when marker !

Download this release

Release Info

Developer webaware
Plugin Icon 128x128 Flexible Map
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7.0 to 1.7.1

Files changed (4) hide show
  1. flexible-map.js +28 -5
  2. flexible-map.min.js +1 -1
  3. flexible-map.php +2 -2
  4. readme.txt +14 -2
flexible-map.js CHANGED
@@ -7,6 +7,7 @@ function FlexibleMap() {
7
  // instance-private members with accessors
8
  var map, // google.maps.Map object
9
  centre, // google.maps.LatLng object for map centre
 
10
  kmlLayer, // if map has a KML layer, this is the layer object
11
  hasRedrawn = false; // boolean, whether map has been asked to redrawOnce() already
12
 
@@ -35,6 +36,22 @@ function FlexibleMap() {
35
  map.setCenter(centre);
36
  };
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * get the map's KML layer if set
40
  * @return {google.maps.KmlLayer}
@@ -348,12 +365,15 @@ FlexibleMap.prototype = (function() {
348
  */
349
  showMarker: function(divID, centre, marker) {
350
  var map = this.showMap(divID, centre),
 
351
  point = new google.maps.Marker({
352
  map: map,
353
- position: new google.maps.LatLng(marker[0], marker[1]),
354
  icon: this.markerIcon
355
  });
356
 
 
 
357
  if (!this.markerTitle)
358
  this.markerTitle = this.markerAddress;
359
 
@@ -445,9 +465,11 @@ FlexibleMap.prototype = (function() {
445
  });
446
 
447
  // find Google link and append marker info, modern browsers only!
 
448
  function googleLink() { self.updateGoogleLink(); }
449
  google.maps.event.addListener(map, "idle", googleLink);
450
  google.maps.event.addListener(map, "center_changed", googleLink);
 
451
  }
452
 
453
  },
@@ -479,14 +501,15 @@ FlexibleMap.prototype = (function() {
479
  },
480
 
481
  /**
482
- * set query parameters on Google link to maps
483
- * NB: will only set the query parameters once, won't find links after that
 
484
  */
485
  updateGoogleLink: function() {
486
  if ("querySelectorAll" in document) {
487
  try {
488
  var flxmap = this.getMap().getDiv(),
489
- location = this.getCenter(),
490
  googleLinks = flxmap.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),
491
  i = 0, len = googleLinks.length,
492
  query = encodeURIComponent((this.markerAddress ? this.markerAddress : this.markerTitle) +
@@ -497,7 +520,7 @@ FlexibleMap.prototype = (function() {
497
  }
498
  }
499
  catch (e) {
500
- // we don't care
501
  }
502
  }
503
  },
7
  // instance-private members with accessors
8
  var map, // google.maps.Map object
9
  centre, // google.maps.LatLng object for map centre
10
+ markerLocation, // google.maps.LatLng object for single marker, when using showMarker()
11
  kmlLayer, // if map has a KML layer, this is the layer object
12
  hasRedrawn = false; // boolean, whether map has been asked to redrawOnce() already
13
 
36
  map.setCenter(centre);
37
  };
38
 
39
+ /**
40
+ * record the single marker location
41
+ * @param {google.maps.LatLng} latLng
42
+ */
43
+ this.setMarkerLocation = function(latLng) {
44
+ markerLocation = latLng;
45
+ };
46
+
47
+ /**
48
+ * get the single marker location
49
+ * @return {google.maps.LatLng}
50
+ */
51
+ this.getMarkerLocation = function() {
52
+ return markerLocation;
53
+ };
54
+
55
  /**
56
  * get the map's KML layer if set
57
  * @return {google.maps.KmlLayer}
365
  */
366
  showMarker: function(divID, centre, marker) {
367
  var map = this.showMap(divID, centre),
368
+ markerLocation = new google.maps.LatLng(marker[0], marker[1]),
369
  point = new google.maps.Marker({
370
  map: map,
371
+ position: markerLocation,
372
  icon: this.markerIcon
373
  });
374
 
375
+ this.setMarkerLocation(markerLocation);
376
+
377
  if (!this.markerTitle)
378
  this.markerTitle = this.markerAddress;
379
 
465
  });
466
 
467
  // find Google link and append marker info, modern browsers only!
468
+ // NB: Google link is set before initial map idle event, and reset each time the map centre changes
469
  function googleLink() { self.updateGoogleLink(); }
470
  google.maps.event.addListener(map, "idle", googleLink);
471
  google.maps.event.addListener(map, "center_changed", googleLink);
472
+ google.maps.event.addListenerOnce(map, "tilesloaded", googleLink);
473
  }
474
 
475
  },
501
  },
502
 
503
  /**
504
+ * set query parameters on Google link to maps -- modern browsers only
505
+ * NB: will only set the query parameters when Google link doesn't have them already;
506
+ * Google link is set before initial map idle event, and reset each time the map centre changes
507
  */
508
  updateGoogleLink: function() {
509
  if ("querySelectorAll" in document) {
510
  try {
511
  var flxmap = this.getMap().getDiv(),
512
+ location = this.getMarkerLocation(),
513
  googleLinks = flxmap.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),
514
  i = 0, len = googleLinks.length,
515
  query = encodeURIComponent((this.markerAddress ? this.markerAddress : this.markerTitle) +
520
  }
521
  }
522
  catch (e) {
523
+ // we don't care about IE8 and earlier...
524
  }
525
  }
526
  },
flexible-map.min.js CHANGED
@@ -2,4 +2,4 @@
2
  JavaScript for the WordPress plugin wp-flexible-map
3
  copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
- ;function FlexibleMap(){var d,b,c,a=false;this.getMap=function(){return d};this.getCenter=function(){return b};this.setCenter=function(e){b=e;d.setCenter(b)};this.getKmlLayer=function(){return c};this.redrawOnce=function(){if(!a){a=true;this.redraw()}};this.showMap=function(e,g){b=new google.maps.LatLng(g[0],g[1]);var h,f={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in f){h=f[this.zoomControlStyle]}else{h=f.small}if(this.visualRefresh){google.maps.visualRefresh=true}d=new google.maps.Map(document.getElementById(e),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:h},draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:b,zoom:this.zoom});return d};this.loadKmlMap=function(e){c=new google.maps.KmlLayer({map:d,url:e});google.maps.event.addListenerOnce(c,"defaultviewport_changed",function(){b=c.getDefaultViewport().getCenter()});return c};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.zoomControlStyle="small";this.streetViewControl=false;this.scrollwheel=false;this.draggable=true;this.dblclickZoom=true;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerHTML="";this.markerLink="";this.markerIcon="";this.markerShowInfo=true;this.markerDirections=false;this.markerDirectionsShow=false;this.markerDirectionsDefault="";this.markerAddress="";this.targetFix=true;this.dirService=false;this.dirRenderer=false;this.dirDraggable=false;this.dirSuppressMarkers=false;this.dirShowSteps=true;this.dirShowSearch=true;this.region="";this.locale="en";this.localeActive="en";this.visualRefresh=false}FlexibleMap.prototype=(function(){var c,b;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()}}else{if(document.attachEvent){c=function(d,e,f){d.attachEvent("on"+e,function(){f.call(d,window.event)})};b=function(d){d.cancelBubble=true;d.returnValue=0}}}var a=(function(){function d(f){var g=f.charCodeAt(0),e=g.toString(16);if(g<256){return"\\x"+("00"+e).slice(-2)}return"\\u"+("0000"+e).slice(-4)}return function(e){return e.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,d)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(d){this.locale=d;if(d in this.i18n){this.localeActive=d}else{d=d.substr(0,2);if(d in this.i18n){this.localeActive=d}else{this.localeActive="en"}}return this.localeActive},gettext:function(e){var d=this.i18n[this.localeActive];if(e in d){return d[e]}return e},showKML:function(d,g,h){if(typeof h!="undefined"){this.zoom=h}var f=this,e=document.getElementById(d),k=e.getAttribute("data-flxmap"),j=this.showMap(d,[0,0]),i=this.loadKmlMap(g);if(typeof h!="undefined"){google.maps.event.addListenerOnce(j,"zoom_changed",function(){j.setZoom(h);f.zoom=h})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(j)}google.maps.event.addListener(i,"click",function(q){var o=q.featureData;if(!o._flxmapOnce){o._flxmapOnce=true;if(f.targetFix){var n=/ target="_blank"/ig;o.description=o.description.replace(n,"");o.infoWindowHtml=o.infoWindowHtml.replace(n,"")}if(f.markerDirections){var m=q.latLng,p=m.lat()+","+m.lng()+",'"+a(o.name)+"',true",l='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+k+".showDirections("+p+'); return false;">'+f.gettext("Directions")+"</a>";o.infoWindowHtml=o.infoWindowHtml.replace(/<\/div><\/div>$/i,l+"</div></div>")}}});if(window.opera&&this.markerDirections){c(e,"click",function(l){if(l.target.getAttribute("data-flxmap-fix-opera")){b(l)}})}},showMarker:function(g,f,l){var e=this.showMap(g,f),p=new google.maps.Marker({map:e,position:new google.maps.LatLng(l[0],l[1]),icon:this.markerIcon});if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var k,m,r,h,j,o,q=this,d=document.createElement("DIV");d.className="flxmap-infowin";p.setTitle(this.markerTitle);j=document.createElement("DIV");j.className="flxmap-marker-title";j.appendChild(document.createTextNode(this.markerTitle));d.appendChild(j);if(this.markerHTML){j=document.createElement("DIV");j.innerHTML=this.markerHTML;d.appendChild(j)}if(this.markerDescription||this.markerLink){j=document.createElement("DIV");j.className="flxmap-marker-link";if(this.markerDescription){r=this.markerDescription.split("\n");for(k=0,m=r.length;k<m;k++){if(k>0){j.appendChild(document.createElement("BR"))}j.appendChild(document.createTextNode(r[k]))}if(this.markerLink){j.appendChild(document.createElement("BR"))}}if(this.markerLink){o=document.createElement("A");o.href=this.markerLink;o.appendChild(document.createTextNode(this.gettext("Click for details")));j.appendChild(o)}d.appendChild(j)}if(this.markerDirections){j=document.createElement("DIV");j.className="flxmap-directions-link";o=document.createElement("A");o.href="#";o.dataLatitude=l[0];o.dataLongitude=l[1];o.dataTitle=this.markerTitle;c(o,"click",function(i){b(i);q.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});o.appendChild(document.createTextNode(this.gettext("Directions")));j.appendChild(o);d.appendChild(j)}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(e);if(this.markerDirectionsShow){this.showDirections(l[0],l[1],this.markerTitle,false)}}h=new google.maps.InfoWindow({content:d});if(this.markerShowInfo){google.maps.event.addListenerOnce(e,"tilesloaded",function(){h.open(e,p)})}google.maps.event.addListener(p,"click",function(){h.open(e,p)});function n(){q.updateGoogleLink()}google.maps.event.addListener(e,"idle",n);google.maps.event.addListener(e,"center_changed",n)}},showAddress:function(d,e){var f=this,g=new google.maps.Geocoder();this.markerAddress=e;if(this.markerTitle===""){this.markerTitle=e}g.geocode({address:e,region:this.region},function(j,i){if(i==google.maps.GeocoderStatus.OK){var h=j[0].geometry.location,k=[h.lat(),h.lng()];f.showMarker(d,k,k)}else{alert("Map address returns error: "+i)}})},updateGoogleLink:function(){if("querySelectorAll" in document){try{var l=this.getMap().getDiv(),f=this.getCenter(),h=l.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),g=0,d=h.length,j=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+f.lat()+","+f.lng());for(;g<d;g++){h[g].href+="&mrt=loc&iwloc=A&q="+j}}catch(k){}}},redraw:function(){var e=this.getMap(),d=this.getKmlLayer();google.maps.event.trigger(e,"resize");if(d){e.fitBounds(d.getDefaultViewport())}else{e.setCenter(this.getCenter());e.setZoom(this.zoom)}},startDirService:function(d){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirRenderer){this.dirRenderer=new google.maps.DirectionsRenderer({map:d,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null})}},showDirections:function(k,g,j,d){var e=this;function i(){var l=document.getElementById(e.markerDirectionsDiv),n=document.createElement("form"),m,o,q;while(!!(o=l.lastChild)){l.removeChild(o)}o=document.createElement("p");o.appendChild(document.createTextNode(e.gettext("From")+": "));q=document.createElement("input");q.type="text";q.name="from";q.value=e.markerDirectionsDefault;o.appendChild(q);m=document.createElement("input");m.type="submit";m.value=e.gettext("Get directions");o.appendChild(m);n.appendChild(o);l.appendChild(n);if(typeof n.elements.from=="undefined"){n.elements.from=q}if(d){q.focus()}c(n,"submit",function(p){b(p);var r=this.elements.from.value;if(/\S/.test(r)){h(r)}})}function h(n){var l=(e.markerAddress==="")?new google.maps.LatLng(k,g):e.markerAddress,m={origin:n,region:e.region||"",destination:l,travelMode:google.maps.DirectionsTravelMode.DRIVING};e.dirService.route(m,f)}function f(n,l){var m=google.maps.DirectionsStatus;switch(l){case m.OK:e.dirRenderer.setDirections(n);break;case m.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:alert("Invalid directions request.");break;case m.NOT_FOUND:alert("Origin or destination was not found.");break;default:alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}}if(this.markerDirectionsDiv&&this.dirShowSearch){i()}if(this.markerDirectionsDefault){h(this.markerDirectionsDefault)}}}})();
2
  JavaScript for the WordPress plugin wp-flexible-map
3
  copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
+ ;function FlexibleMap(){var e,c,a,d,b=false;this.getMap=function(){return e};this.getCenter=function(){return c};this.setCenter=function(f){c=f;e.setCenter(c)};this.setMarkerLocation=function(f){a=f};this.getMarkerLocation=function(){return a};this.getKmlLayer=function(){return d};this.redrawOnce=function(){if(!b){b=true;this.redraw()}};this.showMap=function(f,h){c=new google.maps.LatLng(h[0],h[1]);var i,g={small:google.maps.ZoomControlStyle.SMALL,large:google.maps.ZoomControlStyle.LARGE,"default":google.maps.ZoomControlStyle.DEFAULT};if(this.zoomControlStyle in g){i=g[this.zoomControlStyle]}else{i=g.small}if(this.visualRefresh){google.maps.visualRefresh=true}e=new google.maps.Map(document.getElementById(f),{mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,scaleControl:this.scaleControl,panControl:this.panControl,streetViewControl:this.streetViewControl,zoomControl:this.zoomControl,zoomControlOptions:{style:i},draggable:this.draggable,disableDoubleClickZoom:!this.dblclickZoom,scrollwheel:this.scrollwheel,center:c,zoom:this.zoom});return e};this.loadKmlMap=function(f){d=new google.maps.KmlLayer({map:e,url:f});google.maps.event.addListenerOnce(d,"defaultviewport_changed",function(){c=d.getDefaultViewport().getCenter()});return d};this.mapTypeId=google.maps.MapTypeId.ROADMAP;this.mapTypeControl=true;this.scaleControl=false;this.panControl=false;this.zoomControl=true;this.zoomControlStyle="small";this.streetViewControl=false;this.scrollwheel=false;this.draggable=true;this.dblclickZoom=true;this.zoom=16;this.markerTitle="";this.markerDescription="";this.markerHTML="";this.markerLink="";this.markerIcon="";this.markerShowInfo=true;this.markerDirections=false;this.markerDirectionsShow=false;this.markerDirectionsDefault="";this.markerAddress="";this.targetFix=true;this.dirService=false;this.dirRenderer=false;this.dirDraggable=false;this.dirSuppressMarkers=false;this.dirShowSteps=true;this.dirShowSearch=true;this.region="";this.locale="en";this.localeActive="en";this.visualRefresh=false}FlexibleMap.prototype=(function(){var c,b;if(document.addEventListener){c=function(e,d,f){e.addEventListener(d,f,false)};b=function(d){d.stopPropagation();d.preventDefault()}}else{if(document.attachEvent){c=function(d,e,f){d.attachEvent("on"+e,function(){f.call(d,window.event)})};b=function(d){d.cancelBubble=true;d.returnValue=0}}}var a=(function(){function d(f){var g=f.charCodeAt(0),e=g.toString(16);if(g<256){return"\\x"+("00"+e).slice(-2)}return"\\u"+("0000"+e).slice(-4)}return function(e){return e.replace(/[\\\/"'&<>\x00-\x1f\x7f-\xa0\u2000-\u200f\u2028-\u202f]/g,d)}})();return{constructor:FlexibleMap,i18n:{en:{"Click for details":"Click for details",Directions:"Directions",From:"From","Get directions":"Get directions"}},setlocale:function(d){this.locale=d;if(d in this.i18n){this.localeActive=d}else{d=d.substr(0,2);if(d in this.i18n){this.localeActive=d}else{this.localeActive="en"}}return this.localeActive},gettext:function(e){var d=this.i18n[this.localeActive];if(e in d){return d[e]}return e},showKML:function(d,g,h){if(typeof h!="undefined"){this.zoom=h}var f=this,e=document.getElementById(d),k=e.getAttribute("data-flxmap"),j=this.showMap(d,[0,0]),i=this.loadKmlMap(g);if(typeof h!="undefined"){google.maps.event.addListenerOnce(j,"zoom_changed",function(){j.setZoom(h);f.zoom=h})}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(j)}google.maps.event.addListener(i,"click",function(q){var o=q.featureData;if(!o._flxmapOnce){o._flxmapOnce=true;if(f.targetFix){var n=/ target="_blank"/ig;o.description=o.description.replace(n,"");o.infoWindowHtml=o.infoWindowHtml.replace(n,"")}if(f.markerDirections){var m=q.latLng,p=m.lat()+","+m.lng()+",'"+a(o.name)+"',true",l='<br /><a href="#" data-flxmap-fix-opera="1" onclick="'+k+".showDirections("+p+'); return false;">'+f.gettext("Directions")+"</a>";o.infoWindowHtml=o.infoWindowHtml.replace(/<\/div><\/div>$/i,l+"</div></div>")}}});if(window.opera&&this.markerDirections){c(e,"click",function(l){if(l.target.getAttribute("data-flxmap-fix-opera")){b(l)}})}},showMarker:function(h,g,m){var f=this.showMap(h,g),d=new google.maps.LatLng(m[0],m[1]),q=new google.maps.Marker({map:f,position:d,icon:this.markerIcon});this.setMarkerLocation(d);if(!this.markerTitle){this.markerTitle=this.markerAddress}if(this.markerTitle){var l,n,s,j,k,p,r=this,e=document.createElement("DIV");e.className="flxmap-infowin";q.setTitle(this.markerTitle);k=document.createElement("DIV");k.className="flxmap-marker-title";k.appendChild(document.createTextNode(this.markerTitle));e.appendChild(k);if(this.markerHTML){k=document.createElement("DIV");k.innerHTML=this.markerHTML;e.appendChild(k)}if(this.markerDescription||this.markerLink){k=document.createElement("DIV");k.className="flxmap-marker-link";if(this.markerDescription){s=this.markerDescription.split("\n");for(l=0,n=s.length;l<n;l++){if(l>0){k.appendChild(document.createElement("BR"))}k.appendChild(document.createTextNode(s[l]))}if(this.markerLink){k.appendChild(document.createElement("BR"))}}if(this.markerLink){p=document.createElement("A");p.href=this.markerLink;p.appendChild(document.createTextNode(this.gettext("Click for details")));k.appendChild(p)}e.appendChild(k)}if(this.markerDirections){k=document.createElement("DIV");k.className="flxmap-directions-link";p=document.createElement("A");p.href="#";p.dataLatitude=m[0];p.dataLongitude=m[1];p.dataTitle=this.markerTitle;c(p,"click",function(i){b(i);r.showDirections(this.dataLatitude,this.dataLongitude,this.dataTitle,true)});p.appendChild(document.createTextNode(this.gettext("Directions")));k.appendChild(p);e.appendChild(k)}if(this.markerDirections||this.markerDirectionsShow){this.startDirService(f);if(this.markerDirectionsShow){this.showDirections(m[0],m[1],this.markerTitle,false)}}j=new google.maps.InfoWindow({content:e});if(this.markerShowInfo){google.maps.event.addListenerOnce(f,"tilesloaded",function(){j.open(f,q)})}google.maps.event.addListener(q,"click",function(){j.open(f,q)});function o(){r.updateGoogleLink()}google.maps.event.addListener(f,"idle",o);google.maps.event.addListener(f,"center_changed",o);google.maps.event.addListenerOnce(f,"tilesloaded",o)}},showAddress:function(d,e){var f=this,g=new google.maps.Geocoder();this.markerAddress=e;if(this.markerTitle===""){this.markerTitle=e}g.geocode({address:e,region:this.region},function(j,i){if(i==google.maps.GeocoderStatus.OK){var h=j[0].geometry.location,k=[h.lat(),h.lng()];f.showMarker(d,k,k)}else{alert("Map address returns error: "+i)}})},updateGoogleLink:function(){if("querySelectorAll" in document){try{var l=this.getMap().getDiv(),f=this.getMarkerLocation(),h=l.querySelectorAll("a[href*='maps.google.com/maps']:not([href*='mps_dialog']):not([href*='&q='])"),g=0,d=h.length,j=encodeURIComponent((this.markerAddress?this.markerAddress:this.markerTitle)+" @"+f.lat()+","+f.lng());for(;g<d;g++){h[g].href+="&mrt=loc&iwloc=A&q="+j}}catch(k){}}},redraw:function(){var e=this.getMap(),d=this.getKmlLayer();google.maps.event.trigger(e,"resize");if(d){e.fitBounds(d.getDefaultViewport())}else{e.setCenter(this.getCenter());e.setZoom(this.zoom)}},startDirService:function(d){if(!this.dirService){this.dirService=new google.maps.DirectionsService()}if(!this.dirRenderer){this.dirRenderer=new google.maps.DirectionsRenderer({map:d,draggable:this.dirDraggable,suppressMarkers:this.dirSuppressMarkers,panel:this.dirShowSteps?document.getElementById(this.markerDirectionsDiv):null})}},showDirections:function(k,g,j,d){var e=this;function i(){var l=document.getElementById(e.markerDirectionsDiv),n=document.createElement("form"),m,o,q;while(!!(o=l.lastChild)){l.removeChild(o)}o=document.createElement("p");o.appendChild(document.createTextNode(e.gettext("From")+": "));q=document.createElement("input");q.type="text";q.name="from";q.value=e.markerDirectionsDefault;o.appendChild(q);m=document.createElement("input");m.type="submit";m.value=e.gettext("Get directions");o.appendChild(m);n.appendChild(o);l.appendChild(n);if(typeof n.elements.from=="undefined"){n.elements.from=q}if(d){q.focus()}c(n,"submit",function(p){b(p);var r=this.elements.from.value;if(/\S/.test(r)){h(r)}})}function h(n){var l=(e.markerAddress==="")?new google.maps.LatLng(k,g):e.markerAddress,m={origin:n,region:e.region||"",destination:l,travelMode:google.maps.DirectionsTravelMode.DRIVING};e.dirService.route(m,f)}function f(n,l){var m=google.maps.DirectionsStatus;switch(l){case m.OK:e.dirRenderer.setDirections(n);break;case m.ZERO_RESULTS:alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:alert("Invalid directions request.");break;case m.NOT_FOUND:alert("Origin or destination was not found.");break;default:alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");break}}if(this.markerDirectionsDiv&&this.dirShowSearch){i()}if(this.markerDirectionsDefault){h(this.markerDirectionsDefault)}}}})();
flexible-map.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Flexible Map
4
  Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
5
  Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
6
- Version: 1.7.0
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
@@ -33,7 +33,7 @@ if (!defined('FLXMAP_PLUGIN_ROOT')) {
33
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
34
  define('FLXMAP_PLUGIN_VERSION', time());
35
  else
36
- define('FLXMAP_PLUGIN_VERSION', '1.7.0');
37
 
38
  // shortcode tags
39
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
3
  Plugin Name: Flexible Map
4
  Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/wp-flexible-map/
5
  Description: Embed Google Maps in pages and posts, either by centre coodinates or street address, or by URL to a Google Earth KML file.
6
+ Version: 1.7.1
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
33
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
34
  define('FLXMAP_PLUGIN_VERSION', time());
35
  else
36
+ define('FLXMAP_PLUGIN_VERSION', '1.7.1');
37
 
38
  // shortcode tags
39
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
7
  Tags: google, map, maps, google maps, shortcode, kml
8
  Requires at least: 3.2.1
9
  Tested up to: 3.6.1
10
- Stable tag: 1.7.0
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -179,7 +179,16 @@ When you use just centre coordinates for your map, the directions may send peopl
179
 
180
  = How do I get the maps to use my language? =
181
 
182
- Since version 1.1.0, this plugin now uses localised messages for things like the Directions link and the default message on links in info windows. If you have your [WordPress installation set to use your language](http://codex.wordpress.org/WordPress_in_Your_Language), the plugin should automatically pick it up. If you need to force it to pick up your language (or want to offer a different language), use the `locale` parameter, e.g. `locale="ru"` or `locale="zh-TW"`. Google Maps will use the locale information from your web browser to help display maps in your language (see your browser's language settings).
 
 
 
 
 
 
 
 
 
183
 
184
  = You've translated my language badly / it's missing =
185
 
@@ -270,6 +279,9 @@ NB: currently, only AJAX methods that parse script tags will work correctly; thi
270
 
271
  == Changelog ==
272
 
 
 
 
273
  = 1.7.0 [2013-10-12] =
274
  * fixed: Greek translation (thanks, [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)!)
275
  * fixed: Dutch translation (thanks, [Ivan Beemster](http://www.lijndiensten.com/)!)
7
  Tags: google, map, maps, google maps, shortcode, kml
8
  Requires at least: 3.2.1
9
  Tested up to: 3.6.1
10
+ Stable tag: 1.7.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
179
 
180
  = How do I get the maps to use my language? =
181
 
182
+ Since version 1.1.0, this plugin now uses localised messages for things like the Directions link and the default message on links in info windows. If you have your [WordPress installation set to use your language](http://codex.wordpress.org/WordPress_in_Your_Language), the plugin should automatically pick it up. If you need to force it to pick up your language (or want to offer a different language), use the `locale` parameter, e.g. `locale="ru"` or `locale="zh-TW"`.
183
+
184
+ Google Maps will use the locale information from your web browser to help display maps and directions in your language (see your browser's language settings). If you want to force the Google Maps language for every map on a page, you can use a filter hook. For example, here's how to force the Google Maps language to match the language of the page / post its on (e.g. when using WPML translated content):
185
+
186
+ `add_filter('flexmap_google_maps_api_args', 'force_flexmap_map_language');
187
+
188
+ function force_flexmap_map_language($args) {
189
+ $args['language'] = get_locale();
190
+ return $args;
191
+ }`
192
 
193
  = You've translated my language badly / it's missing =
194
 
279
 
280
  == Changelog ==
281
 
282
+ = 1.7.1 [2013-10-13] =
283
+ * fixed: Google link was showing marker at centre, not at marker location when marker != centre
284
+
285
  = 1.7.0 [2013-10-12] =
286
  * fixed: Greek translation (thanks, [Pantelis Orfanos](http://profiles.wordpress.org/ironwiller/)!)
287
  * fixed: Dutch translation (thanks, [Ivan Beemster](http://www.lijndiensten.com/)!)