Flexible Map - Version 1.7.2.1

Version Description

Download this release

Release Info

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

Code changes from version 1.7.2 to 1.7.2.1

Files changed (4) hide show
  1. flexible-map.js +1 -1
  2. flexible-map.min.js +1 -1
  3. flexible-map.php +3 -3
  4. readme.txt +1 -1
flexible-map.js CHANGED
@@ -1,6 +1,6 @@
1
  /*!
2
  JavaScript for the WordPress plugin wp-flexible-map
3
- copyright (c) 2011-2013 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
 
6
  function FlexibleMap() {
1
  /*!
2
  JavaScript for the WordPress plugin wp-flexible-map
3
+ copyright (c) 2011-2014 WebAware Pty Ltd, released under LGPL v2.1
4
  */
5
 
6
  function FlexibleMap() {
flexible-map.min.js CHANGED
@@ -1,5 +1,5 @@
1
  /*!
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)});var o=function(){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{window.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:window.alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:window.alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:window.alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:window.alert("Invalid directions request.");break;case m.NOT_FOUND:window.alert("Origin or destination was not found.");break;default:window.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)}}}})();
1
  /*!
2
  JavaScript for the WordPress plugin wp-flexible-map
3
+ copyright (c) 2011-2014 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)});var o=function(){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{window.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:window.alert("No route could be found between the origin and destination.");break;case m.OVER_QUERY_LIMIT:window.alert("The webpage has gone over the requests limit in too short a period of time.");break;case m.REQUEST_DENIED:window.alert("The webpage is not allowed to use the directions service.");break;case m.INVALID_REQUEST:window.alert("Invalid directions request.");break;case m.NOT_FOUND:window.alert("Origin or destination was not found.");break;default:window.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
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
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.2
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
10
 
11
  /*
12
- copyright (c) 2011-2013 WebAware Pty Ltd (email : rmckay@webaware.com.au)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
1
  <?php
2
  /*
3
  Plugin Name: Flexible Map
4
+ Plugin URI: http://flexible-map.webaware.net.au/
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.2.1
7
  Author: WebAware
8
  Author URI: http://www.webaware.com.au/
9
  */
10
 
11
  /*
12
+ copyright (c) 2011-2014 WebAware Pty Ltd (email : rmckay@webaware.com.au)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
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.8
10
- Stable tag: 1.7.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
7
  Tags: google, map, maps, google maps, shortcode, kml
8
  Requires at least: 3.2.1
9
  Tested up to: 3.8
10
+ Stable tag: 1.7.2.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13