Simple Map - Version 2.8.7

Version Description

Download this release

Release Info

Developer miyauchi
Plugin Icon wp plugin Simple Map
Version 2.8.7
Comparing to
See all releases

Code changes from version 0.3.0 to 2.8.7

.svnignore ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ .git
3
+ .gitignore
4
+ .travis.yml
5
+ Gruntfile.js
6
+ LINGUAS
7
+ Makefile
8
+ README.md
9
+ _site
10
+ bin
11
+ composer.json
12
+ composer.lock
13
+ node_modules
14
+ npm-debug.log
15
+ package.json
16
+ phpunit.xml
17
+ tests
18
+ vendor
js/gmaps.js DELETED
@@ -1,8 +0,0 @@
1
- /*
2
- * GMaps.js 0.1.12.1
3
- * http://hpneo.github.com/gmaps/
4
- *
5
- * Copyright 2012, Gustavo Leon
6
- * Released under the MIT License.
7
- */
8
- var GMaps=(function(b){var a=function(m){var l=this;var j="position:absolute;display:none;min-width:100px;background:white;list-style:none;padding:8px;box-shadow:2px 2px 6px #ccc";window.context_menu={};this.div=b(m.div)[0];this.controls=[];this.overlays=[];this.layers=[];this.markers=[];this.polylines=[];this.routes=[];this.polygons=[];this.infoWindow=null;this.overlay_div=null;this.zoom=m.zoom||15;var g;if(m.mapType){g=google.maps.MapTypeId[m.mapType.toUpperCase()]}else{g=google.maps.MapTypeId.ROADMAP}var d=new google.maps.LatLng(m.lat,m.lng);delete m.lat;delete m.lng;delete m.mapType;var f={zoom:this.zoom,center:d,mapTypeId:g};var k=b.extend(f,m);this.map=new google.maps.Map(this.div,k);var h=function(p,t){var s="";var v=window.context_menu[p];for(var q in v){if(v.hasOwnProperty(q)){var r=v[q];s+='<li><a id="'+p+"_"+q+'" href="#">'+r.title+"</a></li>"}}var o=b("#gmaps_context_menu");o.html(s);o.undelegate();o.delegate("li a","click",function(w){w.preventDefault();v[b(this).attr("id").replace(p+"_","")].action.call(l,t);l.hideContextMenu()});var n=b(l.div).offset().left+t.pixel.x-15;var u=b(l.div).offset().top+t.pixel.y-15;o.css({left:n,top:u}).fadeIn(200)};var i=function(p,o){if(p==="marker"){o.pixel={};var n=new google.maps.OverlayView();n.setMap(l.map);n.draw=function(){var r=n.getProjection();var q=o.marker.getPosition();o.pixel=r.fromLatLngToContainerPixel(q);h(p,o)}}else{h(p,o)}};this.setContextMenu=function(n){window.context_menu[n.control]={};var p='<ul id="gmaps_context_menu" style="'+j+'"></ul>';for(var o in n.options){if(n.options.hasOwnProperty(o)){var q=n.options[o];window.context_menu[n.control][q.name]={title:q.title,action:q.action}}}b("body").append(p);b("#gmaps_context_menu").mouseleave(function(){b(this).delay(100).fadeOut(200)})};this.hideContextMenu=function(){b("#gmaps_context_menu").fadeOut(200)};google.maps.event.addListener(this.map,"bounds_changed",function(n){if(m.bounds_changed){m.bounds_changed(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"center_changed",function(n){if(m.center_changed){m.center_changed(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"click",function(n){if(m.click){m.click(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"dblclick",function(n){if(m.dblclick){m.dblclick(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"drag",function(n){if(m.drag){m.drag(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"dragend",function(n){if(m.dragend){m.dragend(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"dragstart",function(n){if(m.dragstart){m.dragstart(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"idle",function(n){if(m.idle){m.idle(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"maptypeid_changed",function(n){if(m.maptypeid_changed){m.maptypeid_changed(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"mousemove",function(n){if(m.mousemove){m.mousemove(n)}});google.maps.event.addListener(this.map,"mouseout",function(n){if(m.mouseout){m.mouseout(n)}});google.maps.event.addListener(this.map,"mouseover",function(n){if(m.mouseover){m.mouseover(n)}});google.maps.event.addListener(this.map,"projection_changed",function(n){if(m.projection_changed){m.projection_changed(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"resize",function(n){if(m.resize){m.resize(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"rightclick",function(n){if(m.rightclick){m.rightclick(n)}i("map",n)});google.maps.event.addListener(this.map,"tilesloaded",function(n){if(m.tilesloaded){m.tilesloaded(n)}l.hideContextMenu()});google.maps.event.addListener(this.map,"zoom_changed",function(n){if(m.zoom_changed){m.zoom_changed(n)}l.hideContextMenu()});this.setCenter=function(o,n,p){this.map.panTo(new google.maps.LatLng(o,n));if(p){p()}};this.getCenter=function(){return this.map.getCenter()};this.getDiv=function(){return this.div};this.setZoom=function(n){this.map.setZoom(n)};this.zoomIn=function(n){this.map.setZoom(this.map.getZoom()+n)};this.zoomOut=function(n){this.map.setZoom(this.map.getZoom()-n)};this.createControl=function(o){o.style.cursor="pointer";o.style.fontFamily="Arial, sans-serif";o.style.fontSize="13px";o.style.boxShadow="rgba(0, 0, 0, 0.398438) 0px 2px 4px";var n=b("<div></div>");n.css(o.style);n.text(o.text);var q=n[0];for(var p in o.events){google.maps.event.addDomListener(q,p,function(){o.events[p].apply(this,[this])})}q.index=1;return q};this.addControl=function(o){var n=google.maps.ControlPosition[o.position.toUpperCase()];delete o.position;var p=this.createControl(o);this.controls.push(p);this.map.controls[n].push(p);return p};this.createMarker=function(r){if(r.lat&&r.lng){var p=this;var s=r.details;var u=r.fences;var t=r.outside;var q={position:new google.maps.LatLng(r.lat,r.lng),map:null};delete r.lat;delete r.lng;delete r.fences;delete r.outside;var o=b.extend(q,r);var n=new google.maps.Marker(o);n.fences=u;if(r.infoWindow){n.infoWindow=new google.maps.InfoWindow(r.infoWindow);if(r.infoWindow.closeclick){google.maps.event.addListener(n.infoWindow,"closeclick",function(){r.infoWindow.closeclick()})}if(r.infoWindow.content_changed){google.maps.event.addListener(n.infoWindow,"content_changed",function(){r.infoWindow.content_changed()})}if(r.infoWindow.domready){google.maps.event.addListener(n.infoWindow,"domready",function(){r.infoWindow.domready()})}if(r.infoWindow.position_changed){google.maps.event.addListener(n.infoWindow,"position_changed",function(){r.infoWindow.position_changed()})}if(r.infoWindow.zindex_changed){google.maps.event.addListener(n.infoWindow,"zindex_changed",function(){r.infoWindow.zindex_changed()})}}google.maps.event.addListener(n,"click",function(){this.details=s;if(r.click){r.click.apply(this,[this])}if(n.infoWindow){p.hideInfoWindows();n.infoWindow.open(p.map,n)}});if(r.drag){google.maps.event.addListener(n,"drag",function(){r.drag(this)})}if(r.dragend||n.fences){google.maps.event.addListener(n,"dragend",function(){if(r.dragend){r.dragend(this)}if(n.fences){p.checkMarkerGeofence(n,function(v,w){t(v,w)})}})}if(r.dragstart){google.maps.event.addListener(n,"dragstart",function(){r.dragstart(this)})}if(r.mouseout){google.maps.event.addListener(n,"mouseout",function(){r.mouseout(this)})}if(r.mouseover){google.maps.event.addListener(n,"mouseover",function(){r.mouseover(this)})}if(r.mouseup){google.maps.event.addListener(n,"mouseup",function(){r.mouseup(this)})}if(r.position_changed){google.maps.event.addListener(n,"position_changed",function(){r.position_changed(this)})}return n}else{throw"No latitude or longitude defined"}};this.addMarker=function(o){if(o.lat&&o.lng){var n=this.createMarker(o);n.setMap(this.map);this.markers.push(n);return n}else{throw"No latitude or longitude defined"}};this.addMarkers=function(p){for(var o=0,n;n=p[o];o++){this.addMarker(n)}return this.markers};this.hideInfoWindows=function(){for(var o=0,n;n=this.markers[o];o++){if(n.infoWindow){n.infoWindow.close()}}};this.removeMarkers=function(){for(var o=0,n;n=this.markers[o];o++){n.setMap(null)}this.markers=[]};this.drawOverlay=function(o){var n=new google.maps.OverlayView();n.setMap(l.map);n.onAdd=function(){var r=document.createElement("div");r.style.borderStyle="none";r.style.borderWidth="0px";r.style.position="absolute";r.innerHTML=o.content;l.overlay_div=r;var q=this.getPanes();if(!o.layer){o.layer="overlayLayer"}var p=q[o.layer];p.appendChild(r)};n.draw=function(){var p=this.getProjection();var q=p.fromLatLngToDivPixel(new google.maps.LatLng(o.lat,o.lng));o.horizontalOffset=o.horizontalOffset||0;o.verticalOffset=o.verticalOffset||0;var s=l.overlay_div;var r=s.children;switch(o.verticalAlign){case"top":s.style.top=(q.y-b(r).height()+o.verticalOffset)+"px";break;default:case"middle":s.style.top=(q.y-(b(r).height()/2)+o.verticalOffset)+"px";break;case"bottom":s.style.top=(q.y+o.verticalOffset)+"px";break}switch(o.horizontalAlign){case"left":s.style.left=(q.x-b(r).width()+o.horizontalOffset)+"px";break;default:case"center":s.style.left=(q.x-(b(r).width()/2)+o.horizontalOffset)+"px";break;case"right":s.style.left=(q.x+o.horizontalOffset)+"px";break}};n.onRemove=function(){l.overlay_div.parentNode.removeChild(l.overlay_div);l.overlay_div=null};l.overlays.push(n);return n};this.removeOverlay=function(n){n.setMap(null)};this.removeOverlays=function(){for(var n=0,o;o=l.overlays[n];n++){o.setMap(null)}l.overlays=[]};this.drawPolyline=function(o){var r=[];var q=o.path;if(q.length){if(q[0][0]===undefined){r=q}else{for(var p=0,s;s=q[p];p++){r.push(new google.maps.LatLng(s[0],s[1]))}}}var n=new google.maps.Polyline({map:this.map,path:r,strokeColor:o.strokeColor,strokeOpacity:o.strokeOpacity,strokeWeight:o.strokeWeight});if(o.click){google.maps.event.addListener(n,"click",function(t){o.click(t)})}if(o.dblclick){google.maps.event.addListener(n,"dblclick",function(t){o.dblclick(t)})}if(o.mousedown){google.maps.event.addListener(n,"mousedown",function(t){o.mousedown(t)})}if(o.mousemove){google.maps.event.addListener(n,"mousemove",function(t){o.mousemove(t)})}if(o.mouseout){google.maps.event.addListener(n,"mouseout",function(t){o.mouseout(t)})}if(o.mouseover){google.maps.event.addListener(n,"mouseover",function(t){o.mouseover(t)})}if(o.mouseup){google.maps.event.addListener(n,"mouseup",function(t){o.mouseup(t)})}if(o.rightclick){google.maps.event.addListener(n,"rightclick",function(t){o.rightclick(t)})}this.polylines.push(n);return n};this.drawCircle=function(n){n=b.extend({map:this.map,center:new google.maps.LatLng(n.lat,n.lng)},n);delete n.lat;delete n.lng;var o=new google.maps.Circle(n);google.maps.event.addListener(o,"click",function(p){if(n.click){n.click(p)}});google.maps.event.addListener(o,"dblclick",function(p){if(n.dblclick){n.dblclick(p)}});google.maps.event.addListener(o,"mousedown",function(p){if(n.mousedown){n.mousedown(p)}});google.maps.event.addListener(o,"mousemove",function(p){if(n.mousemove){n.mousemove(p)}});google.maps.event.addListener(o,"mouseout",function(p){if(n.mouseout){n.mouseout(p)}});google.maps.event.addListener(o,"mouseover",function(p){if(n.mouseover){n.mouseover(p)}});google.maps.event.addListener(o,"mouseup",function(p){if(n.mouseup){n.mouseup(p)}});google.maps.event.addListener(o,"rightclick",function(p){if(n.rightclick){n.rightclick(p)}});return o};this.drawPolygon=function(n){n=b.extend({map:this.map},n);var o=new google.maps.Polygon(n);google.maps.event.addListener(o,"click",function(p){if(n.click){n.click(p)}});google.maps.event.addListener(o,"dblclick",function(p){if(n.dblclick){n.dblclick(p)}});google.maps.event.addListener(o,"mousedown",function(p){if(n.mousedown){n.mousedown(p)}});google.maps.event.addListener(o,"mousemove",function(p){if(n.mousemove){n.mousemove(p)}});google.maps.event.addListener(o,"mouseout",function(p){if(n.mouseout){n.mouseout(p)}});google.maps.event.addListener(o,"mouseover",function(p){if(n.mouseover){n.mouseover(p)}});google.maps.event.addListener(o,"mouseup",function(p){if(n.mouseup){n.mouseup(p)}});google.maps.event.addListener(o,"rightclick",function(p){if(n.rightclick){n.rightclick(p)}});this.polygons.push(o);return o};this.getFromFusionTables=function(o){var q=o.events;delete o.events;var n=o;var p=new google.maps.FusionTablesLayer(n);for(var r in q){google.maps.event.addListener(p,r,function(s){q[r].apply(this,[s])})}this.layers.push(p);return p};this.loadFromFusionTables=function(n){var o=this.getFromFusionTables(n);o.setMap(this.map);return o};this.getFromKML=function(o){var n=o.url;var q=o.events;delete o.url;delete o.events;var s=o;var p=new google.maps.KmlLayer(n,s);for(var r in q){google.maps.event.addListener(p,r,function(t){q[r].apply(this,[t])})}this.layers.push(p);return p};this.loadFromKML=function(n){var o=this.getFromKML(n);o.setMap(this.map);return o};var c,e;this.getRoutes=function(r){switch(r.travelMode){case"bicycling":c=google.maps.TravelMode.BICYCLING;break;case"driving":c=google.maps.TravelMode.DRIVING;break;default:c=google.maps.TravelMode.WALKING;break}if(r.unitSystem==="imperial"){e=google.maps.UnitSystem.IMPERIAL}else{e=google.maps.UnitSystem.METRIC}var q={avoidHighways:true,avoidTolls:true,optimizeWaypoints:true,waypoints:[]};var p=b.extend(q,r);p.origin=new google.maps.LatLng(r.origin[0],r.origin[1]);p.destination=new google.maps.LatLng(r.destination[0],r.destination[1]);p.travelMode=c;p.unitSystem=e;delete p.callback;var o=this;var n=new google.maps.DirectionsService();n.route(p,function(s,t){if(t===google.maps.DirectionsStatus.OK){for(var u in s.routes){if(s.routes.hasOwnProperty(u)){o.routes.push(s.routes[u])}}}if(r.callback){r.callback(o.routes)}})};this.drawRoute=function(o){var n=this;this.getRoutes({origin:o.origin,destination:o.destination,travelMode:o.travelMode,callback:function(p){if(p.length>0){n.drawPolyline({path:p[p.length-1].overview_path,strokeColor:o.strokeColor,strokeOpacity:o.strokeOpacity,strokeWeight:o.strokeWeight});if(o.callback){o.callback(p[p.length-1])}}}})};this.travelRoute=function(o){if(o.origin&&o.destination){this.getRoutes({origin:o.origin,destination:o.destination,travelMode:o.travelMode,callback:function(v){if(v.length>0&&o.step){var s=v[v.length-1];if(s.legs.length>0){var r=s.legs[0].steps;for(var t=0,u;u=r[t];t++){u.step_number=t;o.step(u)}}}}})}else{if(o.route){if(o.route.legs.length>0){var n=o.route.legs[0].steps;for(var p=0,q;q=n[p];p++){q.step_number=p;o.step(q)}}}}};this.drawSteppedRoute=function(o){if(o.origin&&o.destination){this.getRoutes({origin:o.origin,destination:o.destination,travelMode:o.travelMode,callback:function(v){if(v.length>0&&o.step){var s=v[v.length-1];if(s.legs.length>0){var r=s.legs[0].steps;for(var t=0,u;u=r[t];t++){u.step_number=t;l.drawPolyline({path:u.path,strokeColor:o.strokeColor,strokeOpacity:o.strokeOpacity,strokeWeight:o.strokeWeight});o.step(u)}}}}})}else{if(o.route){if(o.route.legs.length>0){var n=o.route.legs[0].steps;for(var p=0,q;q=n[p];p++){q.step_number=p;l.drawPolyline({path:q.path,strokeColor:o.strokeColor,strokeOpacity:o.strokeOpacity,strokeWeight:o.strokeWeight});o.step(q)}}}}};this.checkGeofence=function(o,n,p){return p.containsLatLng(new google.maps.LatLng(o,n))};this.checkMarkerGeofence=function(n,p){if(n.fences){for(var o=0,q;q=n.fences[o];o++){var r=n.getPosition();if(!l.checkGeofence(r.lat(),r.lng(),q)){p(n,q)}}}}};a.Route=function(c){this.map=c.map;this.route=c.route;this.step_count=0;this.steps=this.route.legs[0].steps;this.steps_length=this.steps.length;this.polyline=this.map.drawPolyline({path:new google.maps.MVCArray(),strokeColor:c.strokeColor,strokeOpacity:c.strokeOpacity,strokeWeight:c.strokeWeight}).getPath();this.back=function(){if(this.step_count>0){this.step_count--;var e=this.route.legs[0].steps[this.step_count].path;for(var d in e){if(e.hasOwnProperty(d)){this.polyline.pop()}}}};this.forward=function(){if(this.step_count<this.steps_length){var e=this.route.legs[0].steps[this.step_count].path;for(var d in e){if(e.hasOwnProperty(d)){this.polyline.push(e[d])}}this.step_count++}}};a.geolocate=function(c){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(d){c.success(d);if(c.always){c.always()}},function(d){c.error(d);if(c.always){c.always()}},c.options)}else{c.not_supported();if(c.always){c.always()}}};a.geocode=function(c){this.geocoder=new google.maps.Geocoder();var d=c.callback;if(c.lat&&c.lng){c.latLng=new google.maps.LatLng(c.lat,c.lng)}delete c.lat;delete c.lng;delete c.callback;this.geocoder.geocode(c,function(f,e){d(f,e)})};a.staticMapURL=function(d){var g=[];var v;var e="http://maps.googleapis.com/maps/api/staticmap";if(d.url){e=d.url;delete d.url}e+="?";var t=d.markers;delete d.markers;if(!t&&d.marker){t=[d.marker];delete d.marker}var o=d.polyline;delete d.polyline;if(d.center){g.push("center="+d.center);delete d.center}else{if(d.address){g.push("center="+d.address);delete d.address}else{if(d.lat){g.push(["center=",d.lat,",",d.lng].join(""));delete d.lat;delete d.lng}else{if(d.visible){var c=encodeURI(d.visible.join("|"));g.push("visible="+c)}}}}var m=d.size;if(m){if(m.join){m=m.join("x")}delete d.size}else{m="630x300"}g.push("size="+m);if(!d.zoom){d.zoom=15}var u=d.hasOwnProperty("sensor")?!!d.sensor:true;delete d.sensor;g.push("sensor="+u);for(var h in d){if(d.hasOwnProperty(h)){g.push(h+"="+d[h])}}if(t){var k,l;for(var r=0;v=t[r];r++){k=[];if(v.size&&v.size!=="normal"){k.push("size:"+v.size)}else{if(v.icon){k.push("icon:"+encodeURI(v.icon))}}if(v.color){k.push("color:"+v.color.replace("#","0x"))}if(v.label){k.push("label:"+v.label[0].toUpperCase())}l=(v.address?v.address:v.lat+","+v.lng);if(k.length||r===0){k.push(l);k=k.join("|");g.push("markers="+encodeURI(k))}else{k=g.pop()+encodeURI("|"+l);g.push(k)}}}function s(i,j){if(i[0]==="#"){i=i.replace("#","0x");if(j){j=parseFloat(j);j=Math.min(1,Math.max(j,0));if(j===0){return"0x00000000"}j=(j*255).toString(16);if(j.length===1){j+=j}i=i.slice(0,8)+j}}return i}if(o){v=o;o=[];if(v.strokeWeight){o.push("weight:"+parseInt(v.strokeWeight,10))}if(v.strokeColor){var p=s(v.strokeColor,v.strokeOpacity);o.push("color:"+p)}if(v.fillColor){var w=s(v.fillColor,v.fillOpacity);o.push("fillcolor:"+w)}var n=v.path;if(n.join){for(var q=0,f;f=n[q];q++){o.push(f.join(","))}}else{o.push("enc:"+n)}o=o.join("|");g.push("path="+encodeURI(o))}g=g.join("&");return e+g};if(!google.maps.Polygon.prototype.getBounds){google.maps.Polygon.prototype.getBounds=function(e){var d=new google.maps.LatLngBounds();var h=this.getPaths();var g;for(var f=0;f<h.getLength();f++){g=h.getAt(f);for(var c=0;c<g.getLength();c++){d.extend(g.getAt(c))}}return d}}google.maps.Polygon.prototype.containsLatLng=function(g){var c=this.getBounds();if(c!==null&&!c.contains(g)){return false}var e=false;var d=this.getPaths().getLength();for(var f=0;f<d;f++){var o=this.getPaths().getAt(f);var l=o.getLength();var h=l-1;for(var k=0;k<l;k++){var n=o.getAt(k);var m=o.getAt(h);if(n.lng()<g.lng()&&m.lng()>=g.lng()||m.lng()<g.lng()&&n.lng()>=g.lng()){if(n.lat()+(g.lng()-n.lng())/(m.lng()-n.lng())*(m.lat()-n.lat())<g.lat()){e=!e}}h=k}}return e};google.maps.LatLngBounds.prototype.containsLatLng=function(c){return this.contains(c)};google.maps.Marker.prototype.setFences=function(c){this.fences=c};google.maps.Marker.prototype.addFence=function(c){this.fences.push(c)};return a}(jQuery));
 
 
 
 
 
 
 
 
js/gmaps.src.js DELETED
@@ -1,1225 +0,0 @@
1
- /*!
2
- * GMaps.js 0.1.12.1
3
- * http://hpneo.github.com/gmaps/
4
- *
5
- * Copyright 2012, Gustavo Leon
6
- * Released under the MIT License.
7
- */
8
-
9
- var GMaps = (function($) {
10
- "use strict";
11
-
12
- var GMaps = function(options) {
13
- var self = this;
14
- var context_menu_style = 'position:absolute;display:none;min-width:100px;' +
15
- 'background:white;list-style:none;padding:8px;box-shadow:2px 2px 6px #ccc';
16
- window.context_menu = {};
17
-
18
- this.div = $(options.div)[0];
19
- this.controls = [];
20
- this.overlays = [];
21
- this.layers = [];
22
- this.markers = [];
23
- this.polylines = [];
24
- this.routes = [];
25
- this.polygons = [];
26
- this.infoWindow = null;
27
- this.overlay_div = null;
28
- this.zoom = options.zoom || 15;
29
-
30
- //'Hybrid', 'Roadmap', 'Satellite' or 'Terrain'
31
- var mapType;
32
-
33
- if (options.mapType) {
34
- mapType = google.maps.MapTypeId[options.mapType.toUpperCase()];
35
- }
36
- else {
37
- mapType = google.maps.MapTypeId.ROADMAP;
38
- }
39
-
40
- var map_center = new google.maps.LatLng(options.lat, options.lng);
41
-
42
- delete options.lat;
43
- delete options.lng;
44
- delete options.mapType;
45
-
46
- var map_base_options = {
47
- zoom: this.zoom,
48
- center: map_center,
49
- mapTypeId: mapType
50
- };
51
-
52
- var map_options = $.extend(map_base_options, options);
53
-
54
- this.map = new google.maps.Map(this.div, map_options);
55
-
56
- // Context menus
57
- var buildContextMenuHTML = function(control, e) {
58
- var html = '';
59
- var options = window.context_menu[control];
60
- for (var i in options){
61
- if (options.hasOwnProperty(i)){
62
- var option = options[i];
63
- html += '<li><a id="' + control + '_' + i + '" href="#">' +
64
- option.title + '</a></li>';
65
- }
66
- }
67
- var $context_menu = $('#gmaps_context_menu');
68
- $context_menu.html(html);
69
- $context_menu.undelegate();
70
- $context_menu.delegate('li a', 'click', function(ev) {
71
- ev.preventDefault();
72
- options[$(this).attr('id').replace(control + '_', '')].action.call(self, e);
73
- self.hideContextMenu();
74
- });
75
-
76
- var left = $(self.div).offset().left + e.pixel.x - 15;
77
- var top = $(self.div).offset().top + e.pixel.y - 15;
78
- $context_menu.css({
79
- left: left,
80
- top: top
81
- }).fadeIn(200);
82
- };
83
-
84
- var buildContextMenu = function(control, e) {
85
- if (control === 'marker') {
86
- e.pixel = {};
87
- var overlay = new google.maps.OverlayView();
88
- overlay.setMap(self.map);
89
- overlay.draw = function() {
90
- var projection = overlay.getProjection();
91
- var position = e.marker.getPosition();
92
- e.pixel = projection.fromLatLngToContainerPixel(position);
93
-
94
- buildContextMenuHTML(control, e);
95
- };
96
- }
97
- else {
98
- buildContextMenuHTML(control, e);
99
- }
100
- };
101
-
102
- this.setContextMenu = function(options) {
103
- window.context_menu[options.control] = {};
104
- var html = '<ul id="gmaps_context_menu" style="' + context_menu_style + '"></ul>';
105
- for (var i in options.options){
106
- if (options.options.hasOwnProperty(i)){
107
- var option = options.options[i];
108
- window.context_menu[options.control][option.name] = {
109
- title: option.title,
110
- action: option.action
111
- };
112
- }
113
- }
114
- $('body').append(html);
115
- $('#gmaps_context_menu').mouseleave(function() {
116
- $(this).delay(100).fadeOut(200);
117
- });
118
- };
119
-
120
- this.hideContextMenu = function() {
121
- $('#gmaps_context_menu').fadeOut(200);
122
- };
123
-
124
- //Events
125
- google.maps.event.addListener(this.map, 'bounds_changed', function(e) {
126
- if (options.bounds_changed) {
127
- options.bounds_changed(e);
128
- }
129
- self.hideContextMenu();
130
- });
131
- google.maps.event.addListener(this.map, 'center_changed', function(e) {
132
- if (options.center_changed) {
133
- options.center_changed(e);
134
- }
135
- self.hideContextMenu();
136
- });
137
- google.maps.event.addListener(this.map, 'click', function(e) {
138
- if (options.click) {
139
- options.click(e);
140
- }
141
- self.hideContextMenu();
142
- });
143
- google.maps.event.addListener(this.map, 'dblclick', function(e) {
144
- if (options.dblclick) {
145
- options.dblclick(e);
146
- }
147
- self.hideContextMenu();
148
- });
149
- google.maps.event.addListener(this.map, 'drag', function(e) {
150
- if (options.drag) {
151
- options.drag(e);
152
- }
153
- self.hideContextMenu();
154
- });
155
- google.maps.event.addListener(this.map, 'dragend', function(e) {
156
- if (options.dragend) {
157
- options.dragend(e);
158
- }
159
- self.hideContextMenu();
160
- });
161
- google.maps.event.addListener(this.map, 'dragstart', function(e) {
162
- if (options.dragstart) {
163
- options.dragstart(e);
164
- }
165
- self.hideContextMenu();
166
- });
167
- google.maps.event.addListener(this.map, 'idle', function(e) {
168
- if (options.idle) {
169
- options.idle(e);
170
- }
171
- self.hideContextMenu();
172
- });
173
- google.maps.event.addListener(this.map, 'maptypeid_changed', function(e) {
174
- if (options.maptypeid_changed) {
175
- options.maptypeid_changed(e);
176
- }
177
- self.hideContextMenu();
178
- });
179
- google.maps.event.addListener(this.map, 'mousemove', function(e) {
180
- if (options.mousemove) {
181
- options.mousemove(e);
182
- }
183
- });
184
- google.maps.event.addListener(this.map, 'mouseout', function(e) {
185
- if (options.mouseout) {
186
- options.mouseout(e);
187
- }
188
- });
189
- google.maps.event.addListener(this.map, 'mouseover', function(e) {
190
- if (options.mouseover) {
191
- options.mouseover(e);
192
- }
193
- });
194
- google.maps.event.addListener(this.map, 'projection_changed', function(e) {
195
- if (options.projection_changed) {
196
- options.projection_changed(e);
197
- }
198
- self.hideContextMenu();
199
- });
200
- google.maps.event.addListener(this.map, 'resize', function(e) {
201
- if (options.resize) {
202
- options.resize(e);
203
- }
204
- self.hideContextMenu();
205
- });
206
- google.maps.event.addListener(this.map, 'rightclick', function(e) {
207
- if (options.rightclick) {
208
- options.rightclick(e);
209
- }
210
-
211
- buildContextMenu('map', e);
212
- });
213
- google.maps.event.addListener(this.map, 'tilesloaded', function(e) {
214
- if (options.tilesloaded) {
215
- options.tilesloaded(e);
216
- }
217
- self.hideContextMenu();
218
- });
219
- google.maps.event.addListener(this.map, 'zoom_changed', function(e) {
220
- if (options.zoom_changed) {
221
- options.zoom_changed(e);
222
- }
223
- self.hideContextMenu();
224
- });
225
-
226
- // Map methods
227
- this.setCenter = function(lat, lng, callback) {
228
- this.map.panTo(new google.maps.LatLng(lat, lng));
229
- if (callback) {
230
- callback();
231
- }
232
- };
233
-
234
- this.getCenter = function() {
235
- return this.map.getCenter();
236
- };
237
-
238
- this.getDiv = function() {
239
- return this.div;
240
- };
241
-
242
- this.setZoom = function(value) {
243
- this.map.setZoom(value);
244
- };
245
-
246
- this.zoomIn = function(value) {
247
- this.map.setZoom(this.map.getZoom() + value);
248
- };
249
-
250
- this.zoomOut = function(value) {
251
- this.map.setZoom(this.map.getZoom() - value);
252
- };
253
-
254
- this.createControl = function(options) {
255
- options.style.cursor = 'pointer';
256
- options.style.fontFamily = 'Arial, sans-serif';
257
- options.style.fontSize = '13px';
258
- options.style.boxShadow = 'rgba(0, 0, 0, 0.398438) 0px 2px 4px';
259
-
260
- var controlDiv = $('<div></div>');
261
- controlDiv.css(options.style);
262
- controlDiv.text(options.text);
263
-
264
- var control = controlDiv[0];
265
-
266
- for(var e in options.events) {
267
- google.maps.event.addDomListener(control, e, function() {
268
- options.events[e].apply(this, [this]);
269
- });
270
- }
271
-
272
- control.index = 1;
273
-
274
- return control;
275
- };
276
-
277
- this.addControl = function(options) {
278
- var position = google.maps.ControlPosition[options.position.toUpperCase()];
279
-
280
- delete options.position;
281
-
282
- var control = this.createControl(options);
283
- this.controls.push(control);
284
- this.map.controls[position].push(control);
285
-
286
- return control;
287
- };
288
-
289
- // Markers
290
- this.createMarker = function(options) {
291
- if (options.lat && options.lng) {
292
- var self = this;
293
- var details = options.details;
294
- var fences = options.fences;
295
- var outside = options.outside;
296
- var base_options = {
297
- position: new google.maps.LatLng(options.lat, options.lng),
298
- map: null
299
- };
300
- delete options.lat;
301
- delete options.lng;
302
- delete options.fences;
303
- delete options.outside;
304
-
305
- var marker_options = $.extend(base_options, options);
306
-
307
- var marker = new google.maps.Marker(marker_options);
308
-
309
- marker.fences = fences;
310
-
311
- if (options.infoWindow) {
312
- marker.infoWindow = new google.maps.InfoWindow(options.infoWindow);
313
-
314
- if (options.infoWindow.closeclick) {
315
- google.maps.event.addListener(marker.infoWindow, 'closeclick', function() {
316
- options.infoWindow.closeclick();
317
- });
318
- }
319
- if (options.infoWindow.content_changed) {
320
- google.maps.event.addListener(marker.infoWindow, 'content_changed', function() {
321
- options.infoWindow.content_changed();
322
- });
323
- }
324
- if (options.infoWindow.domready) {
325
- google.maps.event.addListener(marker.infoWindow, 'domready', function() {
326
- options.infoWindow.domready();
327
- });
328
- }
329
- if (options.infoWindow.position_changed) {
330
- google.maps.event.addListener(marker.infoWindow, 'position_changed', function() {
331
- options.infoWindow.position_changed();
332
- });
333
- }
334
- if (options.infoWindow.zindex_changed) {
335
- google.maps.event.addListener(marker.infoWindow, 'zindex_changed', function() {
336
- options.infoWindow.zindex_changed();
337
- });
338
- }
339
- }
340
-
341
- google.maps.event.addListener(marker, 'click', function() {
342
- this.details = details;
343
-
344
- if (options.click) {
345
- options.click.apply(this, [this]);
346
- }
347
-
348
- if (marker.infoWindow) {
349
- self.hideInfoWindows();
350
- marker.infoWindow.open(self.map, marker);
351
- }
352
- });
353
-
354
- if (options.drag) {
355
- google.maps.event.addListener(marker, 'drag', function() {
356
- options.drag(this);
357
- });
358
- }
359
- if (options.dragend || marker.fences) {
360
- google.maps.event.addListener(marker, 'dragend', function() {
361
- if (options.dragend) {
362
- options.dragend(this);
363
- }
364
- if (marker.fences) {
365
- self.checkMarkerGeofence(marker, function(m, f) {
366
- outside(m, f);
367
- });
368
- }
369
- });
370
- }
371
- if (options.dragstart) {
372
- google.maps.event.addListener(marker, 'dragstart', function() {
373
- options.dragstart(this);
374
- });
375
- }
376
- if (options.mouseout) {
377
- google.maps.event.addListener(marker, 'mouseout', function() {
378
- options.mouseout(this);
379
- });
380
- }
381
- if (options.mouseover) {
382
- google.maps.event.addListener(marker, 'mouseover', function() {
383
- options.mouseover(this);
384
- });
385
- }
386
- if (options.mouseup) {
387
- google.maps.event.addListener(marker, 'mouseup', function() {
388
- options.mouseup(this);
389
- });
390
- }
391
- if (options.position_changed) {
392
- google.maps.event.addListener(marker, 'position_changed', function() {
393
- options.position_changed(this);
394
- });
395
- }
396
-
397
- return marker;
398
- }
399
- else {
400
- throw 'No latitude or longitude defined';
401
- }
402
- };
403
-
404
- this.addMarker = function(options) {
405
- if (options.lat && options.lng) {
406
- var marker = this.createMarker(options);
407
- marker.setMap(this.map);
408
- this.markers.push(marker);
409
-
410
- return marker;
411
- }
412
- else {
413
- throw 'No latitude or longitude defined';
414
- }
415
- };
416
-
417
- this.addMarkers = function(array) {
418
- for (var i=0, marker; marker=array[i]; i++) {
419
- this.addMarker(marker);
420
- }
421
- return this.markers;
422
- };
423
-
424
- this.hideInfoWindows = function() {
425
- for (var i=0, marker; marker=this.markers[i]; i++){
426
- if (marker.infoWindow){
427
- marker.infoWindow.close();
428
- }
429
- }
430
- };
431
-
432
- this.removeMarkers = function() {
433
- for (var i=0, marker; marker=this.markers[i]; i++){
434
- marker.setMap(null);
435
- }
436
- this.markers = [];
437
- };
438
-
439
- // Overlays
440
- this.drawOverlay = function(options) {
441
- var overlay = new google.maps.OverlayView();
442
- overlay.setMap(self.map);
443
-
444
- overlay.onAdd = function() {
445
- var div = document.createElement('div');
446
- div.style.borderStyle = "none";
447
- div.style.borderWidth = "0px";
448
- div.style.position = "absolute";
449
- div.innerHTML = options.content;
450
-
451
- self.overlay_div = div;
452
-
453
- var panes = this.getPanes();
454
- if (!options.layer) {
455
- options.layer = 'overlayLayer';
456
- }
457
- var overlayLayer = panes[options.layer];
458
- overlayLayer.appendChild(div);
459
- };
460
-
461
- overlay.draw = function() {
462
- var projection = this.getProjection();
463
- var pixel = projection.fromLatLngToDivPixel(new google.maps.LatLng(options.lat, options.lng));
464
-
465
- options.horizontalOffset = options.horizontalOffset || 0;
466
- options.verticalOffset = options.verticalOffset || 0;
467
-
468
- var div = self.overlay_div;
469
- var content = div.children;
470
-
471
- switch (options.verticalAlign) {
472
- case 'top':
473
- div.style.top = (pixel.y - $(content).height() + options.verticalOffset) + 'px';
474
- break;
475
- default:
476
- case 'middle':
477
- div.style.top = (pixel.y - ($(content).height() / 2) + options.verticalOffset) + 'px';
478
- break;
479
- case 'bottom':
480
- div.style.top = (pixel.y + options.verticalOffset) + 'px';
481
- break;
482
- }
483
-
484
- switch (options.horizontalAlign) {
485
- case 'left':
486
- div.style.left = (pixel.x - $(content).width() + options.horizontalOffset) + 'px';
487
- break;
488
- default:
489
- case 'center':
490
- div.style.left = (pixel.x - ($(content).width() / 2) + options.horizontalOffset) + 'px';
491
- break;
492
- case 'right':
493
- div.style.left = (pixel.x + options.horizontalOffset) + 'px';
494
- break;
495
- }
496
- };
497
-
498
- overlay.onRemove = function() {
499
- self.overlay_div.parentNode.removeChild(self.overlay_div);
500
- self.overlay_div = null;
501
- };
502
- self.overlays.push(overlay);
503
- return overlay;
504
- };
505
-
506
- this.removeOverlay = function(overlay) {
507
- overlay.setMap(null);
508
- };
509
-
510
- this.removeOverlays = function() {
511
- for (var i=0, item; item=self.overlays[i]; i++){
512
- item.setMap(null);
513
- }
514
- self.overlays = [];
515
- };
516
-
517
- this.drawPolyline = function(options) {
518
- var path = [];
519
- var points = options.path;
520
-
521
- if (points.length){
522
- if (points[0][0] === undefined){
523
- path = points;
524
- }
525
- else {
526
- for (var i=0, latlng; latlng=points[i]; i++){
527
- path.push(new google.maps.LatLng(latlng[0], latlng[1]));
528
- }
529
- }
530
- }
531
-
532
- var polyline = new google.maps.Polyline({
533
- map: this.map,
534
- path: path,
535
- strokeColor: options.strokeColor,
536
- strokeOpacity: options.strokeOpacity,
537
- strokeWeight: options.strokeWeight
538
- });
539
-
540
- if (options.click) {
541
- google.maps.event.addListener(polyline, 'click', function(e) {
542
- options.click(e);
543
- });
544
- }
545
- if (options.dblclick) {
546
- google.maps.event.addListener(polyline, 'dblclick', function(e) {
547
- options.dblclick(e);
548
- });
549
- }
550
- if (options.mousedown) {
551
- google.maps.event.addListener(polyline, 'mousedown', function(e) {
552
- options.mousedown(e);
553
- });
554
- }
555
- if (options.mousemove) {
556
- google.maps.event.addListener(polyline, 'mousemove', function(e) {
557
- options.mousemove(e);
558
- });
559
- }
560
- if (options.mouseout) {
561
- google.maps.event.addListener(polyline, 'mouseout', function(e) {
562
- options.mouseout(e);
563
- });
564
- }
565
- if (options.mouseover) {
566
- google.maps.event.addListener(polyline, 'mouseover', function(e) {
567
- options.mouseover(e);
568
- });
569
- }
570
- if (options.mouseup) {
571
- google.maps.event.addListener(polyline, 'mouseup', function(e) {
572
- options.mouseup(e);
573
- });
574
- }
575
- if (options.rightclick) {
576
- google.maps.event.addListener(polyline, 'rightclick', function(e) {
577
- options.rightclick(e);
578
- });
579
- }
580
-
581
- this.polylines.push(polyline);
582
-
583
- return polyline;
584
- };
585
-
586
- this.drawCircle = function(options) {
587
- options = $.extend({
588
- map: this.map,
589
- center: new google.maps.LatLng(options.lat, options.lng)
590
- }, options);
591
-
592
- delete options.lat;
593
- delete options.lng;
594
- var polygon = new google.maps.Circle(options);
595
-
596
- google.maps.event.addListener(polygon, 'click', function(e) {
597
- if (options.click) {
598
- options.click(e);
599
- }
600
- });
601
- google.maps.event.addListener(polygon, 'dblclick', function(e) {
602
- if (options.dblclick) {
603
- options.dblclick(e);
604
- }
605
- });
606
- google.maps.event.addListener(polygon, 'mousedown', function(e) {
607
- if (options.mousedown) {
608
- options.mousedown(e);
609
- }
610
- });
611
- google.maps.event.addListener(polygon, 'mousemove', function(e) {
612
- if (options.mousemove) {
613
- options.mousemove(e);
614
- }
615
- });
616
- google.maps.event.addListener(polygon, 'mouseout', function(e) {
617
- if (options.mouseout) {
618
- options.mouseout(e);
619
- }
620
- });
621
- google.maps.event.addListener(polygon, 'mouseover', function(e) {
622
- if (options.mouseover) {
623
- options.mouseover(e);
624
- }
625
- });
626
- google.maps.event.addListener(polygon, 'mouseup', function(e) {
627
- if (options.mouseup) {
628
- options.mouseup(e);
629
- }
630
- });
631
- google.maps.event.addListener(polygon, 'rightclick', function(e) {
632
- if (options.rightclick) {
633
- options.rightclick(e);
634
- }
635
- });
636
-
637
- return polygon;
638
- };
639
-
640
- this.drawPolygon = function(options) {
641
- options = $.extend({
642
- map: this.map
643
- }, options);
644
- var polygon = new google.maps.Polygon(options);
645
-
646
- google.maps.event.addListener(polygon, 'click', function(e) {
647
- if (options.click) {
648
- options.click(e);
649
- }
650
- });
651
- google.maps.event.addListener(polygon, 'dblclick', function(e) {
652
- if (options.dblclick) {
653
- options.dblclick(e);
654
- }
655
- });
656
- google.maps.event.addListener(polygon, 'mousedown', function(e) {
657
- if (options.mousedown) {
658
- options.mousedown(e);
659
- }
660
- });
661
- google.maps.event.addListener(polygon, 'mousemove', function(e) {
662
- if (options.mousemove) {
663
- options.mousemove(e);
664
- }
665
- });
666
- google.maps.event.addListener(polygon, 'mouseout', function(e) {
667
- if (options.mouseout) {
668
- options.mouseout(e);
669
- }
670
- });
671
- google.maps.event.addListener(polygon, 'mouseover', function(e) {
672
- if (options.mouseover) {
673
- options.mouseover(e);
674
- }
675
- });
676
- google.maps.event.addListener(polygon, 'mouseup', function(e) {
677
- if (options.mouseup) {
678
- options.mouseup(e);
679
- }
680
- });
681
- google.maps.event.addListener(polygon, 'rightclick', function(e) {
682
- if (options.rightclick) {
683
- options.rightclick(e);
684
- }
685
- });
686
-
687
- this.polygons.push(polygon);
688
-
689
- return polygon;
690
- };
691
-
692
- this.getFromFusionTables = function(options) {
693
- var events = options.events;
694
-
695
- delete options.events;
696
-
697
- var fusion_tables_options = options;
698
-
699
- var layer = new google.maps.FusionTablesLayer(fusion_tables_options);
700
-
701
- for (var e in events) {
702
- google.maps.event.addListener(layer, e, function(ev){
703
- events[e].apply(this, [ev]);
704
- });
705
- }
706
-
707
- this.layers.push(layer);
708
-
709
- return layer;
710
- };
711
-
712
- this.loadFromFusionTables = function(options) {
713
- var layer = this.getFromFusionTables(options);
714
- layer.setMap(this.map);
715
-
716
- return layer;
717
- };
718
-
719
- this.getFromKML = function(options) {
720
- var url = options.url;
721
- var events = options.events;
722
-
723
- delete options.url;
724
- delete options.events;
725
-
726
- var kml_options = options;
727
-
728
- var layer = new google.maps.KmlLayer(url, kml_options);
729
-
730
- for (var e in events) {
731
- google.maps.event.addListener(layer, e, function(ev){
732
- events[e].apply(this, [ev]);
733
- });
734
- }
735
-
736
- this.layers.push(layer);
737
-
738
- return layer;
739
- };
740
-
741
- this.loadFromKML = function(options) {
742
- var layer = this.getFromKML(options);
743
- layer.setMap(this.map);
744
-
745
- return layer;
746
- };
747
-
748
- // Services
749
- var travelMode, unitSystem;
750
- this.getRoutes = function(options) {
751
- switch (options.travelMode) {
752
- case 'bicycling':
753
- travelMode = google.maps.TravelMode.BICYCLING;
754
- break;
755
- case 'driving':
756
- travelMode = google.maps.TravelMode.DRIVING;
757
- break;
758
- // case 'walking':
759
- default:
760
- travelMode = google.maps.TravelMode.WALKING;
761
- break;
762
- }
763
-
764
- if (options.unitSystem === 'imperial') {
765
- unitSystem = google.maps.UnitSystem.IMPERIAL;
766
- }
767
- else {
768
- unitSystem = google.maps.UnitSystem.METRIC;
769
- }
770
-
771
- var base_options = {
772
- avoidHighways: true,
773
- avoidTolls: true,
774
- optimizeWaypoints: true,
775
- waypoints: []
776
- };
777
- var request_options = $.extend(base_options, options);
778
- request_options.origin = new google.maps.LatLng(options.origin[0], options.origin[1]);
779
- request_options.destination = new google.maps.LatLng(options.destination[0], options.destination[1]);
780
- request_options.travelMode = travelMode;
781
- request_options.unitSystem = unitSystem;
782
-
783
- delete request_options.callback;
784
-
785
- var self = this;
786
- var service = new google.maps.DirectionsService();
787
-
788
- service.route(request_options, function(result, status) {
789
- if (status === google.maps.DirectionsStatus.OK) {
790
- for (var r in result.routes) {
791
- if (result.routes.hasOwnProperty(r)) {
792
- self.routes.push(result.routes[r]);
793
- }
794
- }
795
- }
796
- if (options.callback) {
797
- options.callback(self.routes);
798
- }
799
- });
800
- };
801
-
802
- this.drawRoute = function(options) {
803
- var self = this;
804
- this.getRoutes({
805
- origin: options.origin,
806
- destination: options.destination,
807
- travelMode: options.travelMode,
808
- callback: function(e) {
809
- if (e.length > 0) {
810
- self.drawPolyline({
811
- path: e[e.length - 1].overview_path,
812
- strokeColor: options.strokeColor,
813
- strokeOpacity: options.strokeOpacity,
814
- strokeWeight: options.strokeWeight
815
- });
816
- if (options.callback) {
817
- options.callback(e[e.length - 1]);
818
- }
819
- }
820
- }
821
- });
822
- };
823
-
824
- this.travelRoute = function(options) {
825
- if (options.origin && options.destination) {
826
- this.getRoutes({
827
- origin: options.origin,
828
- destination: options.destination,
829
- travelMode: options.travelMode,
830
- callback: function(e) {
831
- if (e.length > 0 && options.step) {
832
- var route = e[e.length - 1];
833
- if (route.legs.length > 0) {
834
- var steps = route.legs[0].steps;
835
- for (var i=0, step; step=steps[i]; i++) {
836
- step.step_number = i;
837
- options.step(step);
838
- }
839
- }
840
- }
841
- }
842
- });
843
- }
844
- else if (options.route) {
845
- if (options.route.legs.length > 0) {
846
- var steps = options.route.legs[0].steps;
847
- for (var i=0, step; step=steps[i]; i++) {
848
- step.step_number = i;
849
- options.step(step);
850
- }
851
- }
852
- }
853
- };
854
-
855
- this.drawSteppedRoute = function(options) {
856
- if (options.origin && options.destination) {
857
- this.getRoutes({
858
- origin: options.origin,
859
- destination: options.destination,
860
- travelMode: options.travelMode,
861
- callback: function(e) {
862
- if (e.length > 0 && options.step) {
863
- var route = e[e.length - 1];
864
- if (route.legs.length > 0) {
865
- var steps = route.legs[0].steps;
866
- for (var i=0, step; step=steps[i]; i++) {
867
- step.step_number = i;
868
- self.drawPolyline({
869
- path: step.path,
870
- strokeColor: options.strokeColor,
871
- strokeOpacity: options.strokeOpacity,
872
- strokeWeight: options.strokeWeight
873
- });
874
- options.step(step);
875
- }
876
- }
877
- }
878
- }
879
- });
880
- }
881
- else if (options.route) {
882
- if (options.route.legs.length > 0) {
883
- var steps = options.route.legs[0].steps;
884
- for (var i=0, step; step=steps[i]; i++) {
885
- step.step_number = i;
886
- self.drawPolyline({
887
- path: step.path,
888
- strokeColor: options.strokeColor,
889
- strokeOpacity: options.strokeOpacity,
890
- strokeWeight: options.strokeWeight
891
- });
892
- options.step(step);
893
- }
894
- }
895
- }
896
- };
897
-
898
- // Geofence
899
- this.checkGeofence = function(lat, lng, fence) {
900
- return fence.containsLatLng(new google.maps.LatLng(lat, lng));
901
- };
902
-
903
- this.checkMarkerGeofence = function(marker, outside_callback) {
904
- if (marker.fences) {
905
- for (var i=0, fence; fence=marker.fences[i]; i++) {
906
- var pos = marker.getPosition();
907
- if (!self.checkGeofence(pos.lat(), pos.lng(), fence)) {
908
- outside_callback(marker, fence);
909
- }
910
- }
911
- }
912
- };
913
- };
914
-
915
- GMaps.Route = function(options) {
916
- this.map = options.map;
917
- this.route = options.route;
918
- this.step_count = 0;
919
- this.steps = this.route.legs[0].steps;
920
- this.steps_length = this.steps.length;
921
-
922
- this.polyline = this.map.drawPolyline({
923
- path: new google.maps.MVCArray(),
924
- strokeColor: options.strokeColor,
925
- strokeOpacity: options.strokeOpacity,
926
- strokeWeight: options.strokeWeight
927
- }).getPath();
928
-
929
- this.back = function() {
930
- if (this.step_count > 0) {
931
- this.step_count--;
932
- var path = this.route.legs[0].steps[this.step_count].path;
933
- for (var p in path){
934
- if (path.hasOwnProperty(p)){
935
- this.polyline.pop();
936
- }
937
- }
938
- }
939
- };
940
-
941
- this.forward = function() {
942
- if (this.step_count < this.steps_length) {
943
- var path = this.route.legs[0].steps[this.step_count].path;
944
- for (var p in path){
945
- if (path.hasOwnProperty(p)){
946
- this.polyline.push(path[p]);
947
- }
948
- }
949
- this.step_count++;
950
- }
951
- };
952
- };
953
-
954
- // Geolocation (Modern browsers only)
955
- GMaps.geolocate = function(options) {
956
- if (navigator.geolocation) {
957
- navigator.geolocation.getCurrentPosition(function(position) {
958
- options.success(position);
959
- if (options.always) {
960
- options.always();
961
- }
962
- }, function(error) {
963
- options.error(error);
964
- if (options.always) {
965
- options.always();
966
- }
967
- }, options.options);
968
- }
969
- else {
970
- options.not_supported();
971
- if (options.always) {
972
- options.always();
973
- }
974
- }
975
- };
976
-
977
- // Geocoding
978
- GMaps.geocode = function(options) {
979
- this.geocoder = new google.maps.Geocoder();
980
- var callback = options.callback;
981
- if (options.lat && options.lng) {
982
- options.latLng = new google.maps.LatLng(options.lat, options.lng);
983
- }
984
-
985
- delete options.lat;
986
- delete options.lng;
987
- delete options.callback;
988
- this.geocoder.geocode(options, function(results, status) {
989
- callback(results, status);
990
- });
991
- };
992
-
993
- // Static maps
994
- GMaps.staticMapURL = function(options){
995
- var parameters = [];
996
- var data;
997
-
998
- var static_root = 'http://maps.googleapis.com/maps/api/staticmap';
999
- if (options.url){
1000
- static_root = options.url;
1001
- delete options.url;
1002
- }
1003
- static_root += '?';
1004
-
1005
- var markers = options.markers;
1006
- delete options.markers;
1007
- if (!markers && options.marker){
1008
- markers = [options.marker];
1009
- delete options.marker;
1010
- }
1011
-
1012
- var polyline = options.polyline;
1013
- delete options.polyline;
1014
-
1015
- /** Map options **/
1016
- if (options.center){
1017
- parameters.push('center=' + options.center);
1018
- delete options.center;
1019
- }
1020
- else if (options.address){
1021
- parameters.push('center=' + options.address);
1022
- delete options.address;
1023
- }
1024
- else if (options.lat){
1025
- parameters.push(['center=', options.lat, ',', options.lng].join(''));
1026
- delete options.lat;
1027
- delete options.lng;
1028
- }
1029
- else if (options.visible){
1030
- var visible = encodeURI(options.visible.join('|'));
1031
- parameters.push('visible=' + visible);
1032
- }
1033
-
1034
- var size = options.size;
1035
- if (size){
1036
- if (size.join){
1037
- size = size.join('x');
1038
- }
1039
- delete options.size;
1040
- }
1041
- else {
1042
- size = '630x300';
1043
- }
1044
- parameters.push('size=' + size);
1045
-
1046
- if (!options.zoom){
1047
- options.zoom = 15;
1048
- }
1049
-
1050
- var sensor = options.hasOwnProperty('sensor') ? !!options.sensor : true;
1051
- delete options.sensor;
1052
- parameters.push('sensor=' + sensor);
1053
-
1054
- for (var param in options){
1055
- if (options.hasOwnProperty(param)){
1056
- parameters.push(param + '=' + options[param]);
1057
- }
1058
- }
1059
-
1060
- /** Markers **/
1061
- if (markers){
1062
- var marker, loc;
1063
-
1064
- for (var i=0; data=markers[i]; i++){
1065
- marker = [];
1066
-
1067
- if (data.size && data.size !== 'normal'){
1068
- marker.push('size:' + data.size);
1069
- }
1070
- else if (data.icon){
1071
- marker.push('icon:' + encodeURI(data.icon));
1072
- }
1073
-
1074
- if (data.color){
1075
- marker.push('color:' + data.color.replace('#', '0x'));
1076
- }
1077
-
1078
- if (data.label){
1079
- marker.push('label:' + data.label[0].toUpperCase());
1080
- }
1081
-
1082
- loc = (data.address ? data.address : data.lat + ',' + data.lng);
1083
-
1084
- if (marker.length || i === 0){
1085
- marker.push(loc);
1086
- marker = marker.join('|');
1087
- parameters.push('markers=' + encodeURI(marker));
1088
- }
1089
- // New marker without styles
1090
- else {
1091
- marker = parameters.pop() + encodeURI('|' + loc);
1092
- parameters.push(marker);
1093
- }
1094
- }
1095
- }
1096
-
1097
- /** Polylines **/
1098
- function parseColor(color, opacity){
1099
- if (color[0] === '#'){
1100
- color = color.replace('#', '0x');
1101
-
1102
- if (opacity){
1103
- opacity = parseFloat(opacity);
1104
- opacity = Math.min(1, Math.max(opacity, 0));
1105
- if (opacity === 0){
1106
- return '0x00000000';
1107
- }
1108
- opacity = (opacity * 255).toString(16);
1109
- if (opacity.length === 1){
1110
- opacity += opacity;
1111
- }
1112
-
1113
- color = color.slice(0,8) + opacity;
1114
- }
1115
- }
1116
- return color;
1117
- }
1118
-
1119
- if (polyline){
1120
- data = polyline;
1121
- polyline = [];
1122
-
1123
- if (data.strokeWeight){
1124
- polyline.push('weight:' + parseInt(data.strokeWeight, 10));
1125
- }
1126
-
1127
- if (data.strokeColor){
1128
- var color = parseColor(data.strokeColor, data.strokeOpacity);
1129
- polyline.push('color:' + color);
1130
- }
1131
-
1132
- if (data.fillColor){
1133
- var fillcolor = parseColor(data.fillColor, data.fillOpacity);
1134
- polyline.push('fillcolor:' + fillcolor);
1135
- }
1136
-
1137
- var path = data.path;
1138
- if (path.join){
1139
- for (var j=0, pos; pos=path[j]; j++){
1140
- polyline.push(pos.join(','));
1141
- }
1142
- }
1143
- else {
1144
- polyline.push('enc:' + path);
1145
- }
1146
-
1147
- polyline = polyline.join('|');
1148
- parameters.push('path=' + encodeURI(polyline));
1149
- }
1150
-
1151
- parameters = parameters.join('&');
1152
- return static_root + parameters;
1153
- };
1154
-
1155
- //==========================
1156
- // Polygon containsLatLng
1157
- // https://github.com/tparkin/Google-Maps-Point-in-Polygon
1158
- // Poygon getBounds extension - google-maps-extensions
1159
- // http://code.google.com/p/google-maps-extensions/source/browse/google.maps.Polygon.getBounds.js
1160
- if (!google.maps.Polygon.prototype.getBounds) {
1161
- google.maps.Polygon.prototype.getBounds = function(latLng) {
1162
- var bounds = new google.maps.LatLngBounds();
1163
- var paths = this.getPaths();
1164
- var path;
1165
-
1166
- for (var p = 0; p < paths.getLength(); p++) {
1167
- path = paths.getAt(p);
1168
- for (var i = 0; i < path.getLength(); i++) {
1169
- bounds.extend(path.getAt(i));
1170
- }
1171
- }
1172
-
1173
- return bounds;
1174
- };
1175
- }
1176
-
1177
- // Polygon containsLatLng - method to determine if a latLng is within a polygon
1178
- google.maps.Polygon.prototype.containsLatLng = function(latLng) {
1179
- // Exclude points outside of bounds as there is no way they are in the poly
1180
- var bounds = this.getBounds();
1181
-
1182
- if (bounds !== null && !bounds.contains(latLng)) {
1183
- return false;
1184
- }
1185
-
1186
- // Raycast point in polygon method
1187
- var inPoly = false;
1188
-
1189
- var numPaths = this.getPaths().getLength();
1190
- for (var p = 0; p < numPaths; p++) {
1191
- var path = this.getPaths().getAt(p);
1192
- var numPoints = path.getLength();
1193
- var j = numPoints - 1;
1194
-
1195
- for (var i = 0; i < numPoints; i++) {
1196
- var vertex1 = path.getAt(i);
1197
- var vertex2 = path.getAt(j);
1198
-
1199
- if (vertex1.lng() < latLng.lng() && vertex2.lng() >= latLng.lng() || vertex2.lng() < latLng.lng() && vertex1.lng() >= latLng.lng()) {
1200
- if (vertex1.lat() + (latLng.lng() - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < latLng.lat()) {
1201
- inPoly = !inPoly;
1202
- }
1203
- }
1204
-
1205
- j = i;
1206
- }
1207
- }
1208
-
1209
- return inPoly;
1210
- };
1211
-
1212
- google.maps.LatLngBounds.prototype.containsLatLng = function(latLng) {
1213
- return this.contains(latLng);
1214
- };
1215
-
1216
- google.maps.Marker.prototype.setFences = function(fences) {
1217
- this.fences = fences;
1218
- };
1219
-
1220
- google.maps.Marker.prototype.addFence = function(fence) {
1221
- this.fences.push(fence);
1222
- };
1223
-
1224
- return GMaps;
1225
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/simple-map.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( $ ){
2
+ var SimpleMap = function( element ) {
3
+ this.base_url = 'https://maps.google.com/maps?';
4
+ var self = this;
5
+ var zoom = 16;
6
+ if ( parseFloat( $( element ).data( 'zoom' ) ) ) {
7
+ zoom = $( element ).data( 'zoom' );
8
+ }
9
+ if ( $( element ).data( 'lat' ) && $( element ).data( 'lng' ) ) {
10
+ var lat = $( element ).data( 'lat' );
11
+ var lng = $( element ).data( 'lng' );
12
+ var infoCont = $( element ).html();
13
+ var pos = new google.maps.LatLng(
14
+ lat,
15
+ lng
16
+ );
17
+ this.display( element, pos, zoom, infoCont );
18
+ } else if ( $( element ).data( 'addr' ).length || $( element ).text().length ) {
19
+ var address = $( element ).data( 'addr' ).length ? $( element ).data( 'addr' ) : $( element ).text();
20
+ GMaps.geocode( {
21
+ address: address,
22
+ callback: function( results, status ) {
23
+ if ( status == 'OK' ) {
24
+ var pos = results[0].geometry.location;
25
+ self.display( element, pos, zoom, $( element ).html() );
26
+ }
27
+ }
28
+ } );
29
+ }
30
+ }
31
+
32
+ SimpleMap.prototype.display = function( element, pos, zoom, infoCont ) {
33
+ $( element ).show();
34
+ var breakpoint = $( element ).data( 'breakpoint' );
35
+ if ( $( 'html' ).width() > breakpoint ) {
36
+ var map = new GMaps( {
37
+ div: element,
38
+ lat: pos.lat(),
39
+ lng: pos.lng(),
40
+ mapTypeControl: false,
41
+ zoom: parseFloat( zoom ),
42
+ streetViewControl: false,
43
+ scrollwheel: false,
44
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
45
+ width: element.style.width,
46
+ height: element.style.height
47
+ } );
48
+
49
+ var visible = $( element ).is( ':visible' );
50
+ if ( !visible ) {
51
+ var intervalId = setInterval( function(){
52
+ if ( $( element ).is( ':visible' ) ) {
53
+ clearInterval( intervalId );
54
+ map.refresh();
55
+ map.setCenter( pos.lat(), pos.lng() );
56
+ }
57
+ }, 1000 );
58
+ }
59
+
60
+ if ( infoCont.length ) {
61
+ var marker = map.addMarker( {
62
+ lat: pos.lat(),
63
+ lng: pos.lng(),
64
+ infoWindow: {
65
+ content: infoCont
66
+ }
67
+ } );
68
+ if ( $( element ).data( 'infowindow' ) == 'open' ) {
69
+ marker.infoWindow.open( marker.map, marker );
70
+ }
71
+ } else {
72
+ map.addMarker( {
73
+ lat: pos.lat(),
74
+ lng: pos.lng()
75
+ } );
76
+ }
77
+ } else {
78
+ var url = GMaps.staticMapURL( {
79
+ center: pos.lat() + ',' + pos.lng(),
80
+ zoom: zoom,
81
+ size: breakpoint + 'x' + $( element ).height(),
82
+ markers: [
83
+ {lat: pos.lat(), lng: pos.lng()}
84
+ ],
85
+ sensor: 'false'
86
+ } );
87
+ var img = $( '<img />' );
88
+ $( img ).attr( 'src', url );
89
+ $( img ).attr( 'alt', $( element ).text() );
90
+ var a = $( '<a />' );
91
+ $( a ).attr(
92
+ 'href',
93
+ this.base_url + 'q=' + pos.lat() + ',' + pos.lng() + '&z=' + zoom
94
+ );
95
+ $( a ).html( img );
96
+ $( element ).html( a );
97
+ $( element ).addClass( 'staticmap' );
98
+ }
99
+ }
100
+
101
+ $( '.simplemap' ).each( function(){
102
+ new SimpleMap( $( 'div', this ).get( 0 ) );
103
+ } );
104
+
105
+ } )( jQuery );
js/simple-map.min.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Simple Map - v2.8.1
3
+ *
4
+ * http://wordpress.org/plugins/simple-map/
5
+ * https://github.com/miya0001/simple-map
6
+ *
7
+ * Special thanks!
8
+ * http://hpneo.github.io/gmaps/
9
+ *
10
+ * Copyright 2015, Takayuki Miyauchi (http://wpist.me/)
11
+ * Released under the GPLv2
12
+ */
13
+ "use strict";!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(["jquery","googlemaps!"],b):a.GMaps=b()}(this,function(){var a=function(a,b){var c;if(a===b)return a;for(c in b)a[c]=b[c];return a},b=function(a,b){var c,d=Array.prototype.slice.call(arguments,2),e=[],f=a.length;if(Array.prototype.map&&a.map===Array.prototype.map)e=Array.prototype.map.call(a,function(a){var c=d.slice(0);return c.splice(0,0,a),b.apply(this,c)});else for(c=0;f>c;c++)callback_params=d,callback_params.splice(0,0,a[c]),e.push(b.apply(this,callback_params));return e},c=function(a){var b,c=[];for(b=0;b<a.length;b++)c=c.concat(a[b]);return c},d=function(a,b){var c=a[0],d=a[1];return b&&(c=a[1],d=a[0]),new google.maps.LatLng(c,d)},f=function(a,b){var c;for(c=0;c<a.length;c++)a[c]instanceof google.maps.LatLng||(a[c].length>0&&"object"==typeof a[c][0]?a[c]=f(a[c],b):a[c]=d(a[c],b));return a},g=function(a,b){var c,d=a.replace(".","");return c="jQuery"in this&&b?$("."+d,b)[0]:document.getElementsByClassName(d)[0]},h=function(a,b){var c,a=a.replace("#","");return c="jQuery"in window&&b?$("#"+a,b)[0]:document.getElementById(a)},i=function(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return[b,c]},j=function(b){if("object"!=typeof window.google||!window.google.maps)return"object"==typeof window.console&&window.console.error,function(){};var c=document,d=function(b){if(!this)return new d(b);b.zoom=b.zoom||15,b.mapType=b.mapType||"roadmap";var e,f=function(a,b){return void 0===a?b:a},j=this,k=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],l=["mousemove","mouseout","mouseover"],m=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],n=b.el||b.div,o=b.markerClusterer,p=google.maps.MapTypeId[b.mapType.toUpperCase()],q=new google.maps.LatLng(b.lat,b.lng),r=f(b.zoomControl,!0),s=b.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},t=s.style||"DEFAULT",u=s.position||"TOP_LEFT",v=f(b.panControl,!0),w=f(b.mapTypeControl,!0),x=f(b.scaleControl,!0),y=f(b.streetViewControl,!0),z=f(z,!0),A={},B={zoom:this.zoom,center:q,mapTypeId:p},C={panControl:v,zoomControl:r,zoomControlOptions:{style:google.maps.ZoomControlStyle[t],position:google.maps.ControlPosition[u]},mapTypeControl:w,scaleControl:x,streetViewControl:y,overviewMapControl:z};if("string"==typeof b.el||"string"==typeof b.div?n.indexOf("#")>-1?this.el=h(n,b.context):this.el=g.apply(this,[n,b.context]):this.el=n,"undefined"==typeof this.el||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[j.el.id]={},this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=b.zoom,this.registered_events={},this.el.style.width=b.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=b.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=b.enableNewStyle,e=0;e<m.length;e++)delete b[m[e]];for(1!=b.disableDefaultUI&&(B=a(B,C)),A=a(B,b),e=0;e<k.length;e++)delete A[k[e]];for(e=0;e<l.length;e++)delete A[l[e]];this.map=new google.maps.Map(this.el,A),o&&(this.markerClusterer=o.apply(this,[this.map]));var D=function(a,b){var c="",d=window.context_menu[j.el.id][a];for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];c+='<li><a id="'+a+"_"+e+'" href="#">'+f.title+"</a></li>"}if(h("gmaps_context_menu")){var g=h("gmaps_context_menu");g.innerHTML=c;var e,k=g.getElementsByTagName("a"),l=k.length;for(e=0;l>e;e++){var m=k[e],n=function(c){c.preventDefault(),d[this.id.replace(a+"_","")].action.apply(j,[b]),j.hideContextMenu()};google.maps.event.clearListeners(m,"click"),google.maps.event.addDomListenerOnce(m,"click",n,!1)}var o=i.apply(this,[j.el]),p=o[0]+b.pixel.x-15,q=o[1]+b.pixel.y-15;g.style.left=p+"px",g.style.top=q+"px"}};this.buildContextMenu=function(a,b){if("marker"===a){b.pixel={};var c=new google.maps.OverlayView;c.setMap(j.map),c.draw=function(){var d=c.getProjection(),e=b.marker.getPosition();b.pixel=d.fromLatLngToContainerPixel(e),D(a,b)}}else D(a,b);var d=h("gmaps_context_menu");setTimeout(function(){d.style.display="block"},0)},this.setContextMenu=function(a){window.context_menu[j.el.id][a.control]={};var b,d=c.createElement("ul");for(b in a.options)if(a.options.hasOwnProperty(b)){var e=a.options[b];window.context_menu[j.el.id][a.control][e.name]={title:e.title,action:e.action}}d.id="gmaps_context_menu",d.style.display="none",d.style.position="absolute",d.style.minWidth="100px",d.style.background="white",d.style.listStyle="none",d.style.padding="8px",d.style.boxShadow="2px 2px 6px #ccc",h("gmaps_context_menu")||c.body.appendChild(d);var f=h("gmaps_context_menu");google.maps.event.addDomListener(f,"mouseout",function(a){a.relatedTarget&&this.contains(a.relatedTarget)||window.setTimeout(function(){f.style.display="none"},400)},!1)},this.hideContextMenu=function(){var a=h("gmaps_context_menu");a&&(a.style.display="none")};var E=function(a,c){google.maps.event.addListener(a,c,function(a){void 0==a&&(a=this),b[c].apply(this,[a]),j.hideContextMenu()})};google.maps.event.addListener(this.map,"zoom_changed",this.hideContextMenu);for(var F=0;F<k.length;F++){var G=k[F];G in b&&E(this.map,G)}for(var F=0;F<l.length;F++){var G=l[F];G in b&&E(this.map,G)}google.maps.event.addListener(this.map,"rightclick",function(a){b.rightclick&&b.rightclick.apply(this,[a]),void 0!=window.context_menu[j.el.id].map&&j.buildContextMenu("map",a)}),this.refresh=function(){google.maps.event.trigger(this.map,"resize")},this.fitZoom=function(){var a,b=[],c=this.markers.length;for(a=0;c>a;a++)"boolean"==typeof this.markers[a].visible&&this.markers[a].visible&&b.push(this.markers[a].getPosition());this.fitLatLngBounds(b)},this.fitLatLngBounds=function(a){var b,c=a.length,d=new google.maps.LatLngBounds;for(b=0;c>b;b++)d.extend(a[b]);this.map.fitBounds(d)},this.setCenter=function(a,b,c){this.map.panTo(new google.maps.LatLng(a,b)),c&&c()},this.getElement=function(){return this.el},this.zoomIn=function(a){a=a||1,this.zoom=this.map.getZoom()+a,this.map.setZoom(this.zoom)},this.zoomOut=function(a){a=a||1,this.zoom=this.map.getZoom()-a,this.map.setZoom(this.zoom)};var H,I=[];for(H in this.map)"function"!=typeof this.map[H]||this[H]||I.push(H);for(e=0;e<I.length;e++)!function(a,b,c){a[c]=function(){return b[c].apply(b,arguments)}}(this,this.map,I[e])};return d}(this);j.prototype.createControl=function(a){var b=document.createElement("div");b.style.cursor="pointer",a.disableDefaultStyles!==!0&&(b.style.fontFamily="Roboto, Arial, sans-serif",b.style.fontSize="11px",b.style.boxShadow="rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px");for(var c in a.style)b.style[c]=a.style[c];a.id&&(b.id=a.id),a.title&&(b.title=a.title),a.classes&&(b.className=a.classes),a.content&&("string"==typeof a.content?b.innerHTML=a.content:a.content instanceof HTMLElement&&b.appendChild(a.content)),a.position&&(b.position=google.maps.ControlPosition[a.position.toUpperCase()]);for(var d in a.events)!function(b,c){google.maps.event.addDomListener(b,c,function(){a.events[c].apply(this,[this])})}(b,d);return b.index=1,b},j.prototype.addControl=function(a){var b=this.createControl(a);return this.controls.push(b),this.map.controls[b.position].push(b),b},j.prototype.removeControl=function(a){var b,c=null;for(b=0;b<this.controls.length;b++)this.controls[b]==a&&(c=this.controls[b].position,this.controls.splice(b,1));if(c)for(b=0;b<this.map.controls.length;b++){var d=this.map.controls[a.position];if(d.getAt(b)==a){d.removeAt(b);break}}return a},j.prototype.createMarker=function(b){if(void 0==b.lat&&void 0==b.lng&&void 0==b.position)throw"No latitude or longitude defined.";var c=this,d=b.details,e=b.fences,f=b.outside,g={position:new google.maps.LatLng(b.lat,b.lng),map:null},h=a(g,b);delete h.lat,delete h.lng,delete h.fences,delete h.outside;var i=new google.maps.Marker(h);if(i.fences=e,b.infoWindow){i.infoWindow=new google.maps.InfoWindow(b.infoWindow);for(var j=["closeclick","content_changed","domready","position_changed","zindex_changed"],k=0;k<j.length;k++)!function(a,c){b.infoWindow[c]&&google.maps.event.addListener(a,c,function(a){b.infoWindow[c].apply(this,[a])})}(i.infoWindow,j[k])}for(var l=["animation_changed","clickable_changed","cursor_changed","draggable_changed","flat_changed","icon_changed","position_changed","shadow_changed","shape_changed","title_changed","visible_changed","zindex_changed"],m=["dblclick","drag","dragend","dragstart","mousedown","mouseout","mouseover","mouseup"],k=0;k<l.length;k++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(){b[c].apply(this,[this])})}(i,l[k]);for(var k=0;k<m.length;k++)!function(a,c,d){b[d]&&google.maps.event.addListener(c,d,function(c){c.pixel||(c.pixel=a.getProjection().fromLatLngToPoint(c.latLng)),b[d].apply(this,[c])})}(this.map,i,m[k]);return google.maps.event.addListener(i,"click",function(){this.details=d,b.click&&b.click.apply(this,[this]),i.infoWindow&&(c.hideInfoWindows(),i.infoWindow.open(c.map,i))}),google.maps.event.addListener(i,"rightclick",function(a){a.marker=this,b.rightclick&&b.rightclick.apply(this,[a]),void 0!=window.context_menu[c.el.id].marker&&c.buildContextMenu("marker",a)}),i.fences&&google.maps.event.addListener(i,"dragend",function(){c.checkMarkerGeofence(i,function(a,b){f(a,b)})}),i},j.prototype.addMarker=function(a){var b;if(a.hasOwnProperty("gm_accessors_"))b=a;else{if(!(a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")||a.position))throw"No latitude or longitude defined.";b=this.createMarker(a)}return b.setMap(this.map),this.markerClusterer&&this.markerClusterer.addMarker(b),this.markers.push(b),j.fire("marker_added",b,this),b},j.prototype.addMarkers=function(a){for(var b,c=0;b=a[c];c++)this.addMarker(b);return this.markers},j.prototype.hideInfoWindows=function(){for(var a,b=0;a=this.markers[b];b++)a.infoWindow&&a.infoWindow.close()},j.prototype.removeMarker=function(a){for(var b=0;b<this.markers.length;b++)if(this.markers[b]===a){this.markers[b].setMap(null),this.markers.splice(b,1),this.markerClusterer&&this.markerClusterer.removeMarker(a),j.fire("marker_removed",a,this);break}return a},j.prototype.removeMarkers=function(a){var b=[];if("undefined"==typeof a){for(var c=0;c<this.markers.length;c++){var d=this.markers[c];d.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(d),j.fire("marker_removed",d,this)}this.markers=b}else{for(var c=0;c<a.length;c++){var e=this.markers.indexOf(a[c]);if(e>-1){var d=this.markers[e];d.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(d),j.fire("marker_removed",d,this)}}for(var c=0;c<this.markers.length;c++){var d=this.markers[c];null!=d.getMap()&&b.push(d)}this.markers=b}},j.prototype.drawOverlay=function(a){var b=new google.maps.OverlayView,c=!0;return b.setMap(this.map),null!=a.auto_show&&(c=a.auto_show),b.onAdd=function(){var c=document.createElement("div");c.style.borderStyle="none",c.style.borderWidth="0px",c.style.position="absolute",c.style.zIndex=100,c.innerHTML=a.content,b.el=c,a.layer||(a.layer="overlayLayer");var d=this.getPanes(),e=d[a.layer],f=["contextmenu","DOMMouseScroll","dblclick","mousedown"];e.appendChild(c);for(var g=0;g<f.length;g++)!function(a,b){google.maps.event.addDomListener(a,b,function(a){-1!=navigator.userAgent.toLowerCase().indexOf("msie")&&document.all?(a.cancelBubble=!0,a.returnValue=!1):a.stopPropagation()})}(c,f[g]);a.click&&(d.overlayMouseTarget.appendChild(b.el),google.maps.event.addDomListener(b.el,"click",function(){a.click.apply(b,[b])})),google.maps.event.trigger(this,"ready")},b.draw=function(){var d=this.getProjection(),e=d.fromLatLngToDivPixel(new google.maps.LatLng(a.lat,a.lng));a.horizontalOffset=a.horizontalOffset||0,a.verticalOffset=a.verticalOffset||0;var f=b.el,g=f.children[0],h=g.clientHeight,i=g.clientWidth;switch(a.verticalAlign){case"top":f.style.top=e.y-h+a.verticalOffset+"px";break;default:case"middle":f.style.top=e.y-h/2+a.verticalOffset+"px";break;case"bottom":f.style.top=e.y+a.verticalOffset+"px"}switch(a.horizontalAlign){case"left":f.style.left=e.x-i+a.horizontalOffset+"px";break;default:case"center":f.style.left=e.x-i/2+a.horizontalOffset+"px";break;case"right":f.style.left=e.x+a.horizontalOffset+"px"}f.style.display=c?"block":"none",c||a.show.apply(this,[f])},b.onRemove=function(){var c=b.el;a.remove?a.remove.apply(this,[c]):(b.el.parentNode.removeChild(b.el),b.el=null)},this.overlays.push(b),b},j.prototype.removeOverlay=function(a){for(var b=0;b<this.overlays.length;b++)if(this.overlays[b]===a){this.overlays[b].setMap(null),this.overlays.splice(b,1);break}},j.prototype.removeOverlays=function(){for(var a,b=0;a=this.overlays[b];b++)a.setMap(null);this.overlays=[]},j.prototype.drawPolyline=function(a){var b=[],c=a.path;if(c.length)if(void 0===c[0][0])b=c;else for(var d,e=0;d=c[e];e++)b.push(new google.maps.LatLng(d[0],d[1]));var f={map:this.map,path:b,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight,geodesic:a.geodesic,clickable:!0,editable:!1,visible:!0};a.hasOwnProperty("clickable")&&(f.clickable=a.clickable),a.hasOwnProperty("editable")&&(f.editable=a.editable),a.hasOwnProperty("icons")&&(f.icons=a.icons),a.hasOwnProperty("zIndex")&&(f.zIndex=a.zIndex);for(var g=new google.maps.Polyline(f),h=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],i=0;i<h.length;i++)!function(b,c){a[c]&&google.maps.event.addListener(b,c,function(b){a[c].apply(this,[b])})}(g,h[i]);return this.polylines.push(g),j.fire("polyline_added",g,this),g},j.prototype.removePolyline=function(a){for(var b=0;b<this.polylines.length;b++)if(this.polylines[b]===a){this.polylines[b].setMap(null),this.polylines.splice(b,1),j.fire("polyline_removed",a,this);break}},j.prototype.removePolylines=function(){for(var a,b=0;a=this.polylines[b];b++)a.setMap(null);this.polylines=[]},j.prototype.drawCircle=function(b){b=a({map:this.map,center:new google.maps.LatLng(b.lat,b.lng)},b),delete b.lat,delete b.lng;for(var c=new google.maps.Circle(b),d=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],e=0;e<d.length;e++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(c,d[e]);return this.polygons.push(c),c},j.prototype.drawRectangle=function(b){b=a({map:this.map},b);var c=new google.maps.LatLngBounds(new google.maps.LatLng(b.bounds[0][0],b.bounds[0][1]),new google.maps.LatLng(b.bounds[1][0],b.bounds[1][1]));b.bounds=c;for(var d=new google.maps.Rectangle(b),e=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],f=0;f<e.length;f++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(d,e[f]);return this.polygons.push(d),d},j.prototype.drawPolygon=function(d){var e=!1;d.hasOwnProperty("useGeoJSON")&&(e=d.useGeoJSON),delete d.useGeoJSON,d=a({map:this.map},d),0==e&&(d.paths=[d.paths.slice(0)]),d.paths.length>0&&d.paths[0].length>0&&(d.paths=c(b(d.paths,f,e)));for(var g=new google.maps.Polygon(d),h=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],i=0;i<h.length;i++)!function(a,b){d[b]&&google.maps.event.addListener(a,b,function(a){d[b].apply(this,[a])})}(g,h[i]);return this.polygons.push(g),j.fire("polygon_added",g,this),g},j.prototype.removePolygon=function(a){for(var b=0;b<this.polygons.length;b++)if(this.polygons[b]===a){this.polygons[b].setMap(null),this.polygons.splice(b,1),j.fire("polygon_removed",a,this);break}},j.prototype.removePolygons=function(){for(var a,b=0;a=this.polygons[b];b++)a.setMap(null);this.polygons=[]},j.prototype.getFromFusionTables=function(a){var b=a.events;delete a.events;var c=a,d=new google.maps.FusionTablesLayer(c);for(var e in b)!function(a,c){google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(d,e);return this.layers.push(d),d},j.prototype.loadFromFusionTables=function(a){var b=this.getFromFusionTables(a);return b.setMap(this.map),b},j.prototype.getFromKML=function(a){var b=a.url,c=a.events;delete a.url,delete a.events;var d=a,e=new google.maps.KmlLayer(b,d);for(var f in c)!function(a,b){google.maps.event.addListener(a,b,function(a){c[b].apply(this,[a])})}(e,f);return this.layers.push(e),e},j.prototype.loadFromKML=function(a){var b=this.getFromKML(a);return b.setMap(this.map),b},j.prototype.addLayer=function(a,b){b=b||{};var c;switch(a){case"weather":this.singleLayers.weather=c=new google.maps.weather.WeatherLayer;break;case"clouds":this.singleLayers.clouds=c=new google.maps.weather.CloudLayer;break;case"traffic":this.singleLayers.traffic=c=new google.maps.TrafficLayer;break;case"transit":this.singleLayers.transit=c=new google.maps.TransitLayer;break;case"bicycling":this.singleLayers.bicycling=c=new google.maps.BicyclingLayer;break;case"panoramio":this.singleLayers.panoramio=c=new google.maps.panoramio.PanoramioLayer,c.setTag(b.filter),delete b.filter,b.click&&google.maps.event.addListener(c,"click",function(a){b.click(a),delete b.click});break;case"places":if(this.singleLayers.places=c=new google.maps.places.PlacesService(this.map),b.search||b.nearbySearch||b.radarSearch){var d={bounds:b.bounds||null,keyword:b.keyword||null,location:b.location||null,name:b.name||null,radius:b.radius||null,rankBy:b.rankBy||null,types:b.types||null};b.radarSearch&&c.radarSearch(d,b.radarSearch),b.search&&c.search(d,b.search),b.nearbySearch&&c.nearbySearch(d,b.nearbySearch)}if(b.textSearch){var e={bounds:b.bounds||null,location:b.location||null,query:b.query||null,radius:b.radius||null};c.textSearch(e,b.textSearch)}}return void 0!==c?("function"==typeof c.setOptions&&c.setOptions(b),"function"==typeof c.setMap&&c.setMap(this.map),c):void 0},j.prototype.removeLayer=function(a){if("string"==typeof a&&void 0!==this.singleLayers[a])this.singleLayers[a].setMap(null),delete this.singleLayers[a];else for(var b=0;b<this.layers.length;b++)if(this.layers[b]===a){this.layers[b].setMap(null),this.layers.splice(b,1);break}};var k,l;return j.prototype.getRoutes=function(b){switch(b.travelMode){case"bicycling":k=google.maps.TravelMode.BICYCLING;break;case"transit":k=google.maps.TravelMode.TRANSIT;break;case"driving":k=google.maps.TravelMode.DRIVING;break;default:k=google.maps.TravelMode.WALKING}l="imperial"===b.unitSystem?google.maps.UnitSystem.IMPERIAL:google.maps.UnitSystem.METRIC;var c={avoidHighways:!1,avoidTolls:!1,optimizeWaypoints:!1,waypoints:[]},d=a(c,b);d.origin=/string/.test(typeof b.origin)?b.origin:new google.maps.LatLng(b.origin[0],b.origin[1]),d.destination=/string/.test(typeof b.destination)?b.destination:new google.maps.LatLng(b.destination[0],b.destination[1]),d.travelMode=k,d.unitSystem=l,delete d.callback,delete d.error;var e=this,f=new google.maps.DirectionsService;f.route(d,function(a,c){if(c===google.maps.DirectionsStatus.OK){for(var d in a.routes)a.routes.hasOwnProperty(d)&&e.routes.push(a.routes[d]);b.callback&&b.callback(e.routes)}else b.error&&b.error(a,c)})},j.prototype.removeRoutes=function(){this.routes=[]},j.prototype.getElevations=function(d){d=a({locations:[],path:!1,samples:256},d),d.locations.length>0&&d.locations[0].length>0&&(d.locations=c(b([d.locations],f,!1)));var e=d.callback;delete d.callback;var g=new google.maps.ElevationService;if(d.path){var h={path:d.locations,samples:d.samples};g.getElevationAlongPath(h,function(a,b){e&&"function"==typeof e&&e(a,b)})}else delete d.path,delete d.samples,g.getElevationForLocations(d,function(a,b){e&&"function"==typeof e&&e(a,b)})},j.prototype.cleanRoute=j.prototype.removePolylines,j.prototype.drawRoute=function(a){var b=this;this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,unitSystem:a.unitSystem,error:a.error,callback:function(c){if(c.length>0){var d={path:c[c.length-1].overview_path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(d.icons=a.icons),b.drawPolyline(d),a.callback&&a.callback(c[c.length-1])}}})},j.prototype.travelRoute=function(a){if(a.origin&&a.destination)this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,unitSystem:a.unitSystem,error:a.error,callback:function(b){if(b.length>0&&a.start&&a.start(b[b.length-1]),b.length>0&&a.step){var c=b[b.length-1];if(c.legs.length>0)for(var d,e=c.legs[0].steps,f=0;d=e[f];f++)d.step_number=f,a.step(d,c.legs[0].steps.length-1)}b.length>0&&a.end&&a.end(b[b.length-1])}});else if(a.route&&a.route.legs.length>0)for(var b,c=a.route.legs[0].steps,d=0;b=c[d];d++)b.step_number=d,a.step(b)},j.prototype.drawSteppedRoute=function(a){var b=this;if(a.origin&&a.destination)this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,error:a.error,callback:function(c){if(c.length>0&&a.start&&a.start(c[c.length-1]),c.length>0&&a.step){var d=c[c.length-1];if(d.legs.length>0)for(var e,f=d.legs[0].steps,g=0;e=f[g];g++){e.step_number=g;var h={path:e.path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(h.icons=a.icons),b.drawPolyline(h),a.step(e,d.legs[0].steps.length-1)}}c.length>0&&a.end&&a.end(c[c.length-1])}});else if(a.route&&a.route.legs.length>0)for(var c,d=a.route.legs[0].steps,e=0;c=d[e];e++){c.step_number=e;var f={path:c.path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(f.icons=a.icons),b.drawPolyline(f),a.step(c)}},j.Route=function(a){this.origin=a.origin,this.destination=a.destination,this.waypoints=a.waypoints,this.map=a.map,this.route=a.route,this.step_count=0,this.steps=this.route.legs[0].steps,this.steps_length=this.steps.length;var b={path:new google.maps.MVCArray,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(b.icons=a.icons),this.polyline=this.map.drawPolyline(b).getPath()},j.Route.prototype.getRoute=function(a){var b=this;this.map.getRoutes({origin:this.origin,destination:this.destination,travelMode:a.travelMode,waypoints:this.waypoints||[],error:a.error,callback:function(){b.route=e[0],a.callback&&a.callback.call(b)}})},j.Route.prototype.back=function(){if(this.step_count>0){this.step_count--;var a=this.route.legs[0].steps[this.step_count].path;for(var b in a)a.hasOwnProperty(b)&&this.polyline.pop()}},j.Route.prototype.forward=function(){if(this.step_count<this.steps_length){var a=this.route.legs[0].steps[this.step_count].path;for(var b in a)a.hasOwnProperty(b)&&this.polyline.push(a[b]);this.step_count++}},j.prototype.checkGeofence=function(a,b,c){return c.containsLatLng(new google.maps.LatLng(a,b))},j.prototype.checkMarkerGeofence=function(a,b){if(a.fences)for(var c,d=0;c=a.fences[d];d++){var e=a.getPosition();this.checkGeofence(e.lat(),e.lng(),c)||b(a,c)}},j.prototype.toImage=function(a){var a=a||{},b={};if(b.size=a.size||[this.el.clientWidth,this.el.clientHeight],b.lat=this.getCenter().lat(),b.lng=this.getCenter().lng(),this.markers.length>0){b.markers=[];for(var c=0;c<this.markers.length;c++)b.markers.push({lat:this.markers[c].getPosition().lat(),lng:this.markers[c].getPosition().lng()})}if(this.polylines.length>0){var d=this.polylines[0];b.polyline={},b.polyline.path=google.maps.geometry.encoding.encodePath(d.getPath()),b.polyline.strokeColor=d.strokeColor,b.polyline.strokeOpacity=d.strokeOpacity,b.polyline.strokeWeight=d.strokeWeight}return j.staticMapURL(b)},j.staticMapURL=function(a){function b(a,b){if("#"===a[0]&&(a=a.replace("#","0x"),b)){if(b=parseFloat(b),b=Math.min(1,Math.max(b,0)),0===b)return"0x00000000";b=(255*b).toString(16),1===b.length&&(b+=b),a=a.slice(0,8)+b}return a}var c,d=[],e=("file:"===location.protocol?"http:":location.protocol)+"//maps.googleapis.com/maps/api/staticmap";a.url&&(e=a.url,delete a.url),e+="?";var f=a.markers;delete a.markers,!f&&a.marker&&(f=[a.marker],delete a.marker);var g=a.styles;delete a.styles;var h=a.polyline;if(delete a.polyline,a.center)d.push("center="+a.center),delete a.center;else if(a.address)d.push("center="+a.address),delete a.address;else if(a.lat)d.push(["center=",a.lat,",",a.lng].join("")),delete a.lat,delete a.lng;else if(a.visible){var i=encodeURI(a.visible.join("|"));d.push("visible="+i)}var j=a.size;j?(j.join&&(j=j.join("x")),delete a.size):j="630x300",d.push("size="+j),a.zoom||a.zoom===!1||(a.zoom=15);var k=a.hasOwnProperty("sensor")?!!a.sensor:!0;delete a.sensor,d.push("sensor="+k);for(var l in a)a.hasOwnProperty(l)&&d.push(l+"="+a[l]);if(f)for(var m,n,o=0;c=f[o];o++){m=[],c.size&&"normal"!==c.size?(m.push("size:"+c.size),delete c.size):c.icon&&(m.push("icon:"+encodeURI(c.icon)),delete c.icon),c.color&&(m.push("color:"+c.color.replace("#","0x")),delete c.color),c.label&&(m.push("label:"+c.label[0].toUpperCase()),delete c.label),n=c.address?c.address:c.lat+","+c.lng,delete c.address,delete c.lat,delete c.lng;for(var l in c)c.hasOwnProperty(l)&&m.push(l+":"+c[l]);m.length||0===o?(m.push(n),m=m.join("|"),d.push("markers="+encodeURI(m))):(m=d.pop()+encodeURI("|"+n),d.push(m))}if(g)for(var o=0;o<g.length;o++){var p=[];g[o].featureType&&p.push("feature:"+g[o].featureType.toLowerCase()),g[o].elementType&&p.push("element:"+g[o].elementType.toLowerCase());for(var q=0;q<g[o].stylers.length;q++)for(var r in g[o].stylers[q]){var s=g[o].stylers[q][r];("hue"==r||"color"==r)&&(s="0x"+s.substring(1)),p.push(r+":"+s)}var t=p.join("|");""!=t&&d.push("style="+t)}if(h){if(c=h,h=[],c.strokeWeight&&h.push("weight:"+parseInt(c.strokeWeight,10)),c.strokeColor){var u=b(c.strokeColor,c.strokeOpacity);h.push("color:"+u)}if(c.fillColor){var v=b(c.fillColor,c.fillOpacity);h.push("fillcolor:"+v)}var w=c.path;if(w.join)for(var x,q=0;x=w[q];q++)h.push(x.join(","));else h.push("enc:"+w);h=h.join("|"),d.push("path="+encodeURI(h))}var y=window.devicePixelRatio||1;return d.push("scale="+y),d=d.join("&"),e+d},j.prototype.addMapType=function(a,b){if(!b.hasOwnProperty("getTileUrl")||"function"!=typeof b.getTileUrl)throw"'getTileUrl' function required.";b.tileSize=b.tileSize||new google.maps.Size(256,256);var c=new google.maps.ImageMapType(b);this.map.mapTypes.set(a,c)},j.prototype.addOverlayMapType=function(a){if(!a.hasOwnProperty("getTile")||"function"!=typeof a.getTile)throw"'getTile' function required.";var b=a.index;delete a.index,this.map.overlayMapTypes.insertAt(b,a)},j.prototype.removeOverlayMapType=function(a){this.map.overlayMapTypes.removeAt(a)},j.prototype.addStyle=function(a){var b=new google.maps.StyledMapType(a.styles,{name:a.styledMapName});this.map.mapTypes.set(a.mapTypeId,b)},j.prototype.setStyle=function(a){this.map.setMapTypeId(a)},j.prototype.createPanorama=function(a){return a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")||(a.lat=this.getCenter().lat(),a.lng=this.getCenter().lng()),this.panorama=j.createPanorama(a),this.map.setStreetView(this.panorama),this.panorama},j.createPanorama=function(b){var c=h(b.el,b.context);b.position=new google.maps.LatLng(b.lat,b.lng),delete b.el,delete b.context,delete b.lat,delete b.lng;for(var d=["closeclick","links_changed","pano_changed","position_changed","pov_changed","resize","visible_changed"],e=a({visible:!0},b),f=0;f<d.length;f++)delete e[d[f]];for(var g=new google.maps.StreetViewPanorama(c,e),f=0;f<d.length;f++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(){b[c].apply(this)})}(g,d[f]);return g},j.prototype.on=function(a,b){return j.on(a,this,b)},j.prototype.off=function(a){j.off(a,this)},j.custom_events=["marker_added","marker_removed","polyline_added","polyline_removed","polygon_added","polygon_removed","geolocated","geolocation_failed"],j.on=function(a,b,c){if(-1==j.custom_events.indexOf(a))return b instanceof j&&(b=b.map),google.maps.event.addListener(b,a,c);var d={handler:c,eventName:a};return b.registered_events[a]=b.registered_events[a]||[],b.registered_events[a].push(d),d},j.off=function(a,b){-1==j.custom_events.indexOf(a)?(b instanceof j&&(b=b.map),google.maps.event.clearListeners(b,a)):b.registered_events[a]=[]},j.fire=function(a,b,c){if(-1==j.custom_events.indexOf(a))google.maps.event.trigger(b,a,Array.prototype.slice.apply(arguments).slice(2));else if(a in c.registered_events)for(var d=c.registered_events[a],e=0;e<d.length;e++)!function(a,b,c){a.apply(b,[c])}(d[e].handler,c,b)},j.geolocate=function(a){var b=a.always||a.complete;navigator.geolocation?navigator.geolocation.getCurrentPosition(function(c){a.success(c),b&&b()},function(c){a.error(c),b&&b()},a.options):(a.not_supported(),b&&b())},j.geocode=function(a){this.geocoder=new google.maps.Geocoder;var b=a.callback;a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")&&(a.latLng=new google.maps.LatLng(a.lat,a.lng)),delete a.lat,delete a.lng,delete a.callback,this.geocoder.geocode(a,function(a,c){b(a,c)})},"object"==typeof window.google&&window.google.maps&&(google.maps.Polygon.prototype.getBounds||(google.maps.Polygon.prototype.getBounds=function(a){for(var b,c=new google.maps.LatLngBounds,d=this.getPaths(),e=0;e<d.getLength();e++){b=d.getAt(e);for(var f=0;f<b.getLength();f++)c.extend(b.getAt(f))}return c}),google.maps.Polygon.prototype.containsLatLng||(google.maps.Polygon.prototype.containsLatLng=function(a){var b=this.getBounds();if(null!==b&&!b.contains(a))return!1;for(var c=!1,d=this.getPaths().getLength(),e=0;d>e;e++)for(var f=this.getPaths().getAt(e),g=f.getLength(),h=g-1,i=0;g>i;i++){var j=f.getAt(i),k=f.getAt(h);(j.lng()<a.lng()&&k.lng()>=a.lng()||k.lng()<a.lng()&&j.lng()>=a.lng())&&j.lat()+(a.lng()-j.lng())/(k.lng()-j.lng())*(k.lat()-j.lat())<a.lat()&&(c=!c),h=i}return c}),google.maps.Circle.prototype.containsLatLng||(google.maps.Circle.prototype.containsLatLng=function(a){return google.maps.geometry?google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(),a)<=this.getRadius():!0}),google.maps.LatLngBounds.prototype.containsLatLng=function(a){return this.contains(a)},google.maps.Marker.prototype.setFences=function(a){this.fences=a},google.maps.Marker.prototype.addFence=function(a){this.fences.push(a)},google.maps.Marker.prototype.getId=function(){return this.__gm_id}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),j}),function(a){var b=function(b){this.base_url="https://maps.google.com/maps?";var c=this,d=16;if(parseFloat(a(b).data("zoom"))&&(d=a(b).data("zoom")),a(b).data("lat")&&a(b).data("lng")){var e=a(b).data("lat"),f=a(b).data("lng"),g=a(b).html(),h=new google.maps.LatLng(e,f);this.display(b,h,d,g)}else if(a(b).data("addr").length||a(b).text().length){var i=a(b).data("addr").length?a(b).data("addr"):a(b).text();GMaps.geocode({address:i,callback:function(e,f){if("OK"==f){var g=e[0].geometry.location;c.display(b,g,d,a(b).html())}}})}};b.prototype.display=function(b,c,d,e){a(b).show();var f=a(b).data("breakpoint");if(a("html").width()>f){var g=new GMaps({div:b,lat:c.lat(),lng:c.lng(),mapTypeControl:!1,zoom:parseFloat(d),streetViewControl:!1,scrollwheel:!1,mapTypeId:google.maps.MapTypeId.ROADMAP,width:b.style.width,height:b.style.height}),h=a(b).is(":visible");if(!h)var i=setInterval(function(){a(b).is(":visible")&&(clearInterval(i),g.refresh(),g.setCenter(c.lat(),c.lng()))},1e3);if(e.length){var j=g.addMarker({lat:c.lat(),lng:c.lng(),infoWindow:{content:e}});"open"==a(b).data("infowindow")&&j.infoWindow.open(j.map,j)}else g.addMarker({lat:c.lat(),lng:c.lng()})}else{var k=GMaps.staticMapURL({center:c.lat()+","+c.lng(),zoom:d,size:f+"x"+a(b).height(),markers:[{lat:c.lat(),lng:c.lng()}],sensor:"false"}),l=a("<img />");a(l).attr("src",k),
14
+ a(l).attr("alt",a(b).text());var m=a("<a />");a(m).attr("href",this.base_url+"q="+c.lat()+","+c.lng()+"&z="+d),a(m).html(l),a(b).html(m),a(b).addClass("staticmap")}},a(".simplemap").each(function(){new b(a("div",this).get(0))})}(jQuery);
js/simplemap.js DELETED
@@ -1 +0,0 @@
1
- (function(a){var b=function(c,e,d){this.base_url="https://maps.google.com/maps?";this.display(c,e,d)};b.prototype.display=function(g,j,h){var d=a(g).attr("data-breakpoint");if(d>640){d=640}if(a("html").width()>d){var i=new GMaps({div:g,lat:j.lat(),lng:j.lng(),mapTypeControl:false,zoom:parseFloat(h),streetViewControl:false,scrollwheel:false,mapTypeId:google.maps.MapTypeId.ROADMAP});i.addMarker({lat:j.lat(),lng:j.lng()})}else{var f=GMaps.staticMapURL({center:j.lat()+","+j.lng(),zoom:h,size:d+"x"+a(g).height(),markers:[{lat:j.lat(),lng:j.lng()}],sensor:"false"});var e=a("<img />");a(e).attr("src",f);a(e).attr("alt",a(g).text());var c=a("<a />");a(c).attr("href",this.base_url+"q="+j.lat()+","+j.lng()+"&z="+h+"&hl=ja");a(c).html(e);a(g).html(c);a(g).addClass("staticmap")}};a(".simplemap").each(function(){var d=a("div",this).get(0);var e=16;if(parseFloat(a(d).attr("data-zoom"))){e=a(d).attr("data-zoom")}if(a(d).text().length){GMaps.geocode({address:a(d).text(),callback:function(i,h){if(h=="OK"){var j=i[0].geometry.location;new b(d,j,e)}}})}else{if(a(d).attr("data-lat")&&a(d).attr("data-lng")){var f=a(d).attr("data-lat");var c=a(d).attr("data-lng");var g=new google.maps.LatLng(f,c);new b(d,g,e)}}})})(jQuery);
 
js/simplemap.src.js DELETED
@@ -1,80 +0,0 @@
1
- (function($){
2
-
3
- var SimpleMap = function(element, pos, zoom) {
4
- this.base_url = 'https://maps.google.com/maps?';
5
- this.display(element, pos, zoom);
6
- }
7
-
8
- SimpleMap.prototype.display = function(element, pos, zoom) {
9
- var breakpoint = $(element).attr('data-breakpoint');
10
- if (breakpoint > 640) {
11
- breakpoint = 640;
12
- }
13
- if ($('html').width() > breakpoint) {
14
- var map = new GMaps({
15
- div: element,
16
- lat: pos.lat(),
17
- lng: pos.lng(),
18
- mapTypeControl: false,
19
- zoom: parseFloat(zoom),
20
- streetViewControl: false,
21
- scrollwheel: false,
22
- mapTypeId: google.maps.MapTypeId.ROADMAP
23
- });
24
- map.addMarker({
25
- lat: pos.lat(),
26
- lng: pos.lng()
27
- });
28
- } else {
29
- var url = GMaps.staticMapURL({
30
- center: pos.lat()+','+pos.lng(),
31
- zoom: zoom,
32
- size: breakpoint+'x'+$(element).height(),
33
- markers: [
34
- {lat: pos.lat(), lng: pos.lng()}
35
- ],
36
- sensor: 'false'
37
- });
38
- var img = $('<img />');
39
- $(img).attr('src', url);
40
- $(img).attr('alt', $(element).text());
41
- var a = $('<a />');
42
- $(a).attr(
43
- 'href',
44
- this.base_url+'q='+pos.lat()+','+pos.lng()+'&z='+zoom+'&hl=ja'
45
- );
46
- $(a).html(img);
47
- $(element).html(a);
48
- $(element).addClass('staticmap');
49
- }
50
- }
51
-
52
- $('.simplemap').each(function(){
53
- var element = $('div', this).get(0);
54
- var zoom = 16;
55
- if (parseFloat($(element).attr('data-zoom'))) {
56
- zoom = $(element).attr('data-zoom');
57
- }
58
- if ($(element).text().length) {
59
- GMaps.geocode({
60
- address: $(element).text(),
61
- callback: function(results, status) {
62
- if (status == 'OK') {
63
- var pos = results[0].geometry.location;
64
- new SimpleMap(element, pos, zoom);
65
- }
66
- }
67
- });
68
- } else if ($(element).attr('data-lat') && $(element).attr('data-lng')) {
69
- var lat = $(element).attr('data-lat');
70
- var lng = $(element).attr('data-lng');
71
- var pos = new google.maps.LatLng(
72
- lat,
73
- lng
74
- );
75
- new SimpleMap(element, pos, zoom);
76
- }
77
- });
78
-
79
- })(jQuery);
80
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,58 +1,231 @@
1
  === Simple Map ===
2
  Contributors: miyauchi
3
  Donate link: http://wpist.me/
4
- Tags: widget
5
- Requires at least: 3.3
6
- Tested up to: 3.3.2
7
- Stable tag: 0.3.0
8
 
9
- Easy way to embed google map.
10
 
11
  == Description ==
12
 
13
- Easy way to embed google map.
14
- This plugin allow you convert address to google maps like below.
15
 
16
- [map addr="San Francisco, California"]
17
 
18
- [This plugin maintained on GitHub.](https://github.com/miya0001/simple-map)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  = Some features: =
21
 
22
- * Allow you to embed google map based on shortcode.
23
- * Points can be added using address or lat/ong.
24
- * Display static map for iPhone automatically.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  = Translators =
27
 
28
  * Japanese(ja) - [Takayuki Miyauchi](http://firegoby.jp/)
29
 
30
- Please contact to me.
31
 
32
- * http://wpist.me/ (en)
33
- * http://firegoby.jp/ (ja)
34
- * @miya0001 on twitter.
35
- * https://github.com/miya0001/simple-map
36
 
37
  = Contributors =
38
 
39
  * [Takayuki Miyauchi](http://firegoby.jp/)
 
 
 
 
40
 
41
  == Installation ==
42
 
43
- * A plug-in installation screen is displayed on the WordPress admin panel.
44
- * It installs it in `wp-content/plugins`.
45
- * The plug-in is made effective.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  == Changelog ==
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  = 0.1.0 =
50
  * The first release.
51
 
52
  == Credits ==
53
 
54
- This plug-in is not guaranteed though the user of WordPress can freely use this plug-in free of charge regardless of the purpose.
55
- The author must acknowledge the thing that the operation guarantee and the support in this plug-in use are not done at all beforehand.
56
 
57
  == Contact ==
58
 
1
  === Simple Map ===
2
  Contributors: miyauchi
3
  Donate link: http://wpist.me/
4
+ Tags: google maps, map, shortcode, address
5
+ Requires at least: 3.6
6
+ Tested up to: 4.3
7
+ Stable tag: 2.8.7
8
 
9
+ Easy way to embed google map(s).
10
 
11
  == Description ==
12
 
13
+ Easy way to embed google map(s) using [gmaps.js](http://hpneo.github.com/gmaps/).
 
14
 
15
+ This plugin allows you to convert address into google maps like below:
16
 
17
+ `[map]San Francisco, California[/map]`
18
+
19
+ Another way, you can embed Google Map with url only like oEmbed.
20
+
21
+
22
+ You can also use coordinates, set width, height and zoom:
23
+
24
+ `[map lat="37.77493" lng="-122.41942"]
25
+ Text you would
26
+ like to appear
27
+ as a tooltip
28
+ goes here
29
+ [/map]`
30
+
31
+ In this case there will be a marker on the map with a tooltip appearing on click on the said marker.
32
+ You can use simple html as the tooltip content.
33
+
34
+
35
+ [This plugin is maintained on GitHub.](https://github.com/miya0001/simple-map)
36
 
37
  = Some features: =
38
 
39
+ * Allows you to embed google map based on shortcode.
40
+ * Markers can be added using address or lat/long.
41
+ * Displays static map for iPhone automatically.
42
+ * oEmbed Support.
43
+
44
+ = Arguments =
45
+
46
+ * width: Width of the map. Default value is "100%".
47
+ * height: Height of the map. Default value is "200px".
48
+ * zoom: Zoom of the map. Default value is "16".
49
+ * breakpoint: If display is narrower than this value, this plugin will display static map. Default value is "480".
50
+ * addr: Address of the map you want to place.
51
+ * lat: Lat of the map you want to place.
52
+ * lng: Lng of the map you want to place.
53
+ * infowindow: If you want to open infoWindow by Default, please set "open".
54
+
55
+ If you will set lat/lng and address, this plugin gives priority to lat/lng.
56
+
57
+ = Filter Hooks =
58
+
59
+ This plugin has some filter hooks for customize default.
60
+
61
+ * simplemap_default_width
62
+ * simplemap_default_height
63
+ * simplemap_default_zoom
64
+ * simplemap_default_breakpoint
65
+ * simplemap_default_infowindow
66
+
67
+ `add_filter( 'simplemap_default_zoom', function(){
68
+ return 10; // Default zoom is 10
69
+ } );`
70
 
71
  = Translators =
72
 
73
  * Japanese(ja) - [Takayuki Miyauchi](http://firegoby.jp/)
74
 
75
+ Please contact me.
76
 
77
+ * https://github.com/miya0001/simple-map/issues
 
 
 
78
 
79
  = Contributors =
80
 
81
  * [Takayuki Miyauchi](http://firegoby.jp/)
82
+ * [Zoltán Balogh](http://birdcreation.com/)
83
+ * [Takanobu Watanabe](https://github.com/tknv)
84
+ * [Shinichi Nishikawa](http://th-daily.shinichi.me/)
85
+ * [nissuk](http://www.nissuk.info/)
86
 
87
  == Installation ==
88
 
89
+ * Download the zip, extract it and upload the extracted folder to your-wp-directory/wp-content/plugins/
90
+ * Go to the plugins administration screen in your WordPress admin and activate the plugin.
91
+
92
+ OR
93
+
94
+ * Download the zip, go to the plugins administration screen in your WordPress admin, click on Add New then on upload, browse to the downloaded zip, upload the plugin and activate it.
95
+
96
+ OR
97
+
98
+ * Go to the plugins administration screen in your WordPress admin, click on Add New, search for Simple Map and click on Install Now.
99
+
100
+ *Usage*
101
+
102
+ This plugin allows you to convert address into google maps like below:
103
+
104
+ `[map]San Francisco, California[/map]`
105
+
106
+ Another way, you can embed Google Map with url only like oEmbed.
107
+
108
+ You can also use coordinates, set width, height and zoom:
109
+
110
+ `[map lat="37.77493" lng="-122.41942" width="100%" height="400px" zoom="15"]
111
+ Text you would
112
+ like to appear
113
+ as a tooltip
114
+ goes here
115
+ [/map]`
116
+
117
+ In this case there will be a marker on the map with a tooltip appearing on click on the said marker.
118
+ You can use simple html as the tooltip content.
119
+
120
+ == Screenshots ==
121
+
122
+ 1. Very easy.
123
+ 2. Info Window.
124
+ 3. Mobile Support. (Google static map)
125
 
126
  == Changelog ==
127
 
128
+ = 2.8.5 =
129
+
130
+ * Auto deploy
131
+
132
+ = 2.8.1 =
133
+
134
+ * Update SimpleMap class.
135
+
136
+ https://github.com/miya0001/simple-map/compare/2.8.0...2.8.1
137
+
138
+ = 2.8.0 =
139
+
140
+ * Display map in modal window.
141
+
142
+ https://github.com/miya0001/simple-map/compare/2.7.0...2.8.0
143
+
144
+ = 2.7.0 =
145
+
146
+ * UPdate gmaps.js to 0.4.21
147
+ * Add tests on travis
148
+
149
+ https://github.com/miya0001/simple-map/compare/2.6.0...2.7.0
150
+
151
+ = 2.6.0 =
152
+
153
+ * Update gmaps.js from 0.4.18 to 0.4.19
154
+ * Add front end test
155
+
156
+ https://github.com/miya0001/simple-map/compare/2.5.0...2.6.0
157
+
158
+ = 2.5.0 =
159
+ * Update gmaps.js 0.4.17 to 0.4.18
160
+ * Tested on WordPress 4.3
161
+
162
+ = 2.4.0 =
163
+ * Update gmaps.js 0.4.16 to 0.4.17
164
+
165
+ = 2.3.0 =
166
+ * Tested on the WordPress 4.1.
167
+ * Up to minimum required to WordPress 3.6.
168
+
169
+ = 2.2.0 =
170
+ * update gmaps.js 0.4.15 to 0.4.16
171
+
172
+ = 2.1.0 =
173
+ * update gmaps.js 0.4.14 to 0.4.15
174
+
175
+ = 2.0.0 =
176
+ * Add argument infowindow
177
+ * little fix
178
+
179
+ = 1.9.0 =
180
+ * update gmaps.js 0.4.13 to 0.4.14
181
+
182
+ = 1.8.0 =
183
+ * update gmaps.js 0.4.12 to 0.4.13
184
+
185
+ = 1.7.0 =
186
+ * update gmaps.js 0.4.11 to 0.4.12
187
+
188
+ = 1.6.0 =
189
+ * update gmaps.js 0.4.9 to 0.4.11
190
+
191
+ = 1.5.0 =
192
+ * enable ssl source of google map api js
193
+
194
+ = 1.4.0 =
195
+ * change URL match pattern.
196
+
197
+ = 1.3.0 =
198
+ * Update gmaps.js to 0.4.9.
199
+
200
+ = 1.2.0 =
201
+ * Tested on the WordPress 3.8.
202
+ * Add Grunt.
203
+
204
+ = 1.1.0 =
205
+ * Added support for gmaps.js tooltip on markers
206
+
207
+ = 1.0.0 =
208
+ * Delete hl=ja param from static map link uri.
209
+
210
+ = 0.9.0 =
211
+ * hook changed to the init.
212
+
213
+ = 0.8.0 =
214
+ * shortcode atts and address priority changed.
215
+
216
+ = 0.7.0 =
217
+ * gmaps.js updated 0.4.4 to 0.4.5
218
+
219
+ = 0.6.0 =
220
+ * oEmbed Support
221
+
222
  = 0.1.0 =
223
  * The first release.
224
 
225
  == Credits ==
226
 
227
+ This plugin is not guaranteed though the user of WordPress can freely use this plugin free of charge regardless of the purpose.
228
+ The author must acknowledge the thing that the operation guarantee and the support in this plugin use are not done at all beforehand.
229
 
230
  == Contact ==
231
 
simple-map.php CHANGED
@@ -2,124 +2,167 @@
2
  /*
3
  Plugin Name: Simple Map
4
  Author: Takayuki Miyauchi
5
- Plugin URI: http://wpist.me/
6
  Description: Insert google map convert from address.
7
- Version: 0.3.0
8
  Author URI: http://wpist.me/
9
  Domain Path: /languages
10
  Text Domain: simplemap
11
  */
12
 
13
- new SimpleMap();
14
-
15
- class SimpleMap{
16
-
17
- private $class_name = 'simplemap';
18
- private $width = '100%';
19
- private $height = '200px';
20
- private $zoom = 16;
21
- private $breakpoint = 480;
22
- private $max_breakpoint = 640;
23
-
24
- function __construct()
25
- {
26
- add_action('wp_head', array(&$this, 'wp_head'));
27
- add_shortcode('map', array(&$this, 'shortcode'));
28
- }
29
-
30
- public function wp_head()
31
- {
32
- echo "<style>.simplemap img{max-width:none;padding:0;margin:0;}.staticmap,.staticmap img{max-width:100%;height:auto;}</style>\n";
33
- }
34
-
35
- public function wp_enqueue_scripts()
36
- {
37
- wp_register_script(
38
- 'google-maps-api',
39
- 'http://maps.google.com/maps/api/js?sensor=false',
40
- false,
41
- null,
42
- true
43
- );
44
-
45
- wp_register_script(
46
- 'gmaps.js',
47
- plugins_url('js/gmaps.js' , __FILE__),
48
- array('jquery', 'google-maps-api'),
49
- '0.1.12.1',
50
- true
51
- );
52
-
53
- wp_register_script(
54
- 'simplemap',
55
- apply_filters(
56
- "simplemap_script",
57
- plugins_url('js/simplemap.js' , __FILE__)
58
- ),
59
- array('gmaps.js'),
60
- filemtime(dirname(__FILE__).'/js/simplemap.js'),
61
- true
62
- );
63
- wp_enqueue_script('simplemap');
64
- }
65
-
66
- public function shortcode($p)
67
- {
68
- add_action("wp_footer", array(&$this, "wp_enqueue_scripts"));
69
-
70
- if (isset($p['width']) && preg_match("/^[0-9]+(%|px)$/", $p['width'])) {
71
- $w = $p['width'];
72
- } else {
73
- $w = apply_filters("simplemap_default_width", $this->width);
74
- }
75
- if (isset($p['height']) && preg_match("/^[0-9]+(%|px)$/", $p['height'])) {
76
- $h = $p['height'];
77
- } else {
78
- $h = apply_filters("simplemap_default_height", $this->height);
79
- }
80
- if (isset($p['zoom']) && $p['zoom']) {
81
- $zoom = $p['zoom'];
82
- } else {
83
- $zoom = apply_filters('simplemap_default_zoom', $this->zoom);
84
- }
85
- if (isset($p['breakpoint']) && intval($p['breakpoint'])) {
86
- if (intval($p['breakpoint']) > $this->max_breakpoint) {
87
- $breakpoint = $this->max_breakpoint;
88
- } else {
89
- $breakpoint = intval($p['breakpoint']);
90
- }
91
- } else {
92
- $breakpoint = apply_filters(
93
- 'simplemap_default_breakpoint',
94
- $this->breakpoint
95
- );
96
- }
97
- $addr = '';
98
- $lat = '';
99
- $lng = '';
100
- if (isset($p['addr']) && $p['addr']) {
101
- $addr = esc_html($p['addr']);
102
- } elseif (isset($p['lat']) && preg_match("/^\-?[0-9\.]+$/", $p['lat'])
103
- && isset($p['lng']) && preg_match("/^\-?[0-9\.]+$/", $p['lng'])){
104
- $lat = $p['lat'];
105
- $lng = $p['lng'];
106
- } else {
107
- return;
108
- }
109
- return sprintf(
110
- '<div class="%s"><div data-breakpoint="%s" data-lat="%s" data-lng="%s" data-zoom="%s" style="width:%s;height:%s;">%s</div></div>',
111
- apply_filters("simplemap_class_name", $this->class_name),
112
- $breakpoint,
113
- $lat,
114
- $lng,
115
- $zoom,
116
- $w,
117
- $h,
118
- $addr
119
- );
120
- }
121
-
122
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
 
125
  // EOF
2
  /*
3
  Plugin Name: Simple Map
4
  Author: Takayuki Miyauchi
5
+ Plugin URI: https://github.com/miya0001/simple-map
6
  Description: Insert google map convert from address.
7
+ Version: 2.8.7
8
  Author URI: http://wpist.me/
9
  Domain Path: /languages
10
  Text Domain: simplemap
11
  */
12
 
13
+ $simplemap = new Simple_Map();
14
+
15
+ class Simple_Map {
16
+
17
+ private $shortcode_tag = 'map';
18
+ private $class_name = 'simplemap';
19
+ private $width = '100%';
20
+ private $height = '200px';
21
+ private $zoom = 16;
22
+ private $breakpoint = 480;
23
+ private $max_breakpoint = 640;
24
+
25
+ function __construct()
26
+ {
27
+ add_action( 'init', array( $this, 'init' ) );
28
+ }
29
+
30
+ public function init()
31
+ {
32
+ add_action( 'wp_head', array( $this, 'wp_head' ) );
33
+ add_shortcode( $this->get_shortcode_tag(), array( $this, 'shortcode' ) );
34
+
35
+ wp_embed_register_handler(
36
+ 'google-map',
37
+ '#( https://( www|maps ).google.[a-z]{2,3}\.?[a-z]{0,3}/maps( /ms )?\?.+ )#i',
38
+ array( &$this, 'oembed_handler' )
39
+ );
40
+ }
41
+
42
+ public function oembed_handler( $match )
43
+ {
44
+ return sprintf(
45
+ '[%s url="%s"]',
46
+ $this->get_shortcode_tag(),
47
+ esc_url( $match[0] )
48
+ );
49
+ }
50
+
51
+ public function wp_head()
52
+ {
53
+ echo "<style>.simplemap img{max-width:none !important;padding:0 !important;margin:0 !important;}.staticmap,.staticmap img{max-width:100% !important;height:auto !important;}.simplemap .simplemap-content{display:none;}</style>\n";
54
+ }
55
+
56
+ public function wp_enqueue_scripts()
57
+ {
58
+ wp_register_script(
59
+ 'google-maps-api',
60
+ '//maps.google.com/maps/api/js?sensor=false',
61
+ false,
62
+ null,
63
+ true
64
+ );
65
+
66
+ wp_register_script(
67
+ 'simplemap',
68
+ apply_filters(
69
+ 'simplemap_script',
70
+ plugins_url( 'js/simple-map.min.js' , __FILE__ )
71
+ ),
72
+ array( 'jquery', 'google-maps-api' ),
73
+ filemtime( dirname( __FILE__ ).'/js/simple-map.min.js' ),
74
+ true
75
+ );
76
+ wp_enqueue_script( 'simplemap' );
77
+ }
78
+
79
+ public function shortcode( $p, $content = null )
80
+ {
81
+ add_action( 'wp_footer', array( &$this, 'wp_enqueue_scripts' ) );
82
+
83
+ if ( isset( $p['width'] ) && preg_match( '/^[0-9]+(%|px)$/', $p['width'] ) ) {
84
+ $w = $p['width'];
85
+ } else {
86
+ $w = apply_filters( 'simplemap_default_width', $this->width );
87
+ }
88
+ if ( isset( $p['height'] ) && preg_match( '/^[0-9]+(%|px)$/', $p['height'] ) ) {
89
+ $h = $p['height'];
90
+ } else {
91
+ $h = apply_filters( 'simplemap_default_height', $this->height );
92
+ }
93
+ if ( isset( $p['zoom'] ) && intval( $p['zoom'] ) ) {
94
+ $zoom = $p['zoom'];
95
+ } else {
96
+ $zoom = apply_filters( 'simplemap_default_zoom', $this->zoom );
97
+ }
98
+ if ( isset( $p['breakpoint'] ) && intval( $p['breakpoint'] ) ) {
99
+ if ( intval( $p['breakpoint'] ) > $this->max_breakpoint ) {
100
+ $breakpoint = $this->max_breakpoint;
101
+ } else {
102
+ $breakpoint = intval( $p['breakpoint'] );
103
+ }
104
+ } else {
105
+ $breakpoint = apply_filters(
106
+ 'simplemap_default_breakpoint',
107
+ $this->breakpoint
108
+ );
109
+ }
110
+ if ( $content ) {
111
+ $content = do_shortcode( $content );
112
+ }
113
+ if ( isset( $p['infowindow'] ) && $p['infowindow'] ) {
114
+ $infowindow = $p['infowindow'];
115
+ } else {
116
+ $infowindow = apply_filters( 'simplemap_default_infowindow', 'close' );
117
+ }
118
+
119
+ $addr = '';
120
+ $lat = '';
121
+ $lng = '';
122
+
123
+ if ( isset( $p['url'] ) && $p['url'] ) {
124
+ $iframe = '<iframe width="%s" height="%s" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="%s"></iframe>';
125
+
126
+ return sprintf(
127
+ $iframe,
128
+ $w,
129
+ $h,
130
+ esc_url( $p['url'].'&output=embed' )
131
+ );
132
+ } elseif ( isset( $p['lat'] ) && preg_match( '/^\-?[0-9\.]+$/', $p['lat'] )
133
+ && isset( $p['lng'] ) && preg_match( '/^\-?[0-9\.]+$/', $p['lng'] ) ){
134
+ $lat = $p['lat'];
135
+ $lng = $p['lng'];
136
+ } elseif ( isset( $p['addr'] ) && $p['addr'] ) {
137
+ if ( $content ) {
138
+ $addr = esc_html( $p['addr'] );
139
+ } else {
140
+ $content = esc_html( $p['addr'] );
141
+ }
142
+ } elseif ( ! $content ) {
143
+ return;
144
+ }
145
+ return sprintf(
146
+ '<div class="%1$s"><div class="%1$s-content" data-breakpoint="%2$s" data-lat="%3$s" data-lng="%4$s" data-zoom="%5$s" data-addr="%6$s" data-infowindow="%7$s" style="width:%8$s;height:%9$s;">%10$s</div></div>',
147
+ apply_filters( 'simplemap_class_name', $this->class_name ),
148
+ $breakpoint,
149
+ $lat,
150
+ $lng,
151
+ $zoom,
152
+ $addr,
153
+ $infowindow,
154
+ $w,
155
+ $h,
156
+ trim( $content )
157
+ );
158
+ }
159
+
160
+ private function get_shortcode_tag()
161
+ {
162
+ return apply_filters( 'simplemap_shortcode_tag', $this->shortcode_tag );
163
+ }
164
+
165
+ } // end class
166
 
167
 
168
  // EOF
trunk/.svnignore ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ .git
3
+ .gitignore
4
+ .travis.yml
5
+ Gruntfile.js
6
+ LINGUAS
7
+ Makefile
8
+ README.md
9
+ _site
10
+ bin
11
+ composer.json
12
+ composer.lock
13
+ node_modules
14
+ npm-debug.log
15
+ package.json
16
+ phpunit.xml
17
+ tests
18
+ vendor
trunk/js/simple-map.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( $ ){
2
+ var SimpleMap = function( element ) {
3
+ this.base_url = 'https://maps.google.com/maps?';
4
+ var self = this;
5
+ var zoom = 16;
6
+ if ( parseFloat( $( element ).data( 'zoom' ) ) ) {
7
+ zoom = $( element ).data( 'zoom' );
8
+ }
9
+ if ( $( element ).data( 'lat' ) && $( element ).data( 'lng' ) ) {
10
+ var lat = $( element ).data( 'lat' );
11
+ var lng = $( element ).data( 'lng' );
12
+ var infoCont = $( element ).html();
13
+ var pos = new google.maps.LatLng(
14
+ lat,
15
+ lng
16
+ );
17
+ this.display( element, pos, zoom, infoCont );
18
+ } else if ( $( element ).data( 'addr' ).length || $( element ).text().length ) {
19
+ var address = $( element ).data( 'addr' ).length ? $( element ).data( 'addr' ) : $( element ).text();
20
+ GMaps.geocode( {
21
+ address: address,
22
+ callback: function( results, status ) {
23
+ if ( status == 'OK' ) {
24
+ var pos = results[0].geometry.location;
25
+ self.display( element, pos, zoom, $( element ).html() );
26
+ }
27
+ }
28
+ } );
29
+ }
30
+ }
31
+
32
+ SimpleMap.prototype.display = function( element, pos, zoom, infoCont ) {
33
+ $( element ).show();
34
+ var breakpoint = $( element ).data( 'breakpoint' );
35
+ if ( $( 'html' ).width() > breakpoint ) {
36
+ var map = new GMaps( {
37
+ div: element,
38
+ lat: pos.lat(),
39
+ lng: pos.lng(),
40
+ mapTypeControl: false,
41
+ zoom: parseFloat( zoom ),
42
+ streetViewControl: false,
43
+ scrollwheel: false,
44
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
45
+ width: element.style.width,
46
+ height: element.style.height
47
+ } );
48
+
49
+ var visible = $( element ).is( ':visible' );
50
+ if ( !visible ) {
51
+ var intervalId = setInterval( function(){
52
+ if ( $( element ).is( ':visible' ) ) {
53
+ clearInterval( intervalId );
54
+ map.refresh();
55
+ map.setCenter( pos.lat(), pos.lng() );
56
+ }
57
+ }, 1000 );
58
+ }
59
+
60
+ if ( infoCont.length ) {
61
+ var marker = map.addMarker( {
62
+ lat: pos.lat(),
63
+ lng: pos.lng(),
64
+ infoWindow: {
65
+ content: infoCont
66
+ }
67
+ } );
68
+ if ( $( element ).data( 'infowindow' ) == 'open' ) {
69
+ marker.infoWindow.open( marker.map, marker );
70
+ }
71
+ } else {
72
+ map.addMarker( {
73
+ lat: pos.lat(),
74
+ lng: pos.lng()
75
+ } );
76
+ }
77
+ } else {
78
+ var url = GMaps.staticMapURL( {
79
+ center: pos.lat() + ',' + pos.lng(),
80
+ zoom: zoom,
81
+ size: breakpoint + 'x' + $( element ).height(),
82
+ markers: [
83
+ {lat: pos.lat(), lng: pos.lng()}
84
+ ],
85
+ sensor: 'false'
86
+ } );
87
+ var img = $( '<img />' );
88
+ $( img ).attr( 'src', url );
89
+ $( img ).attr( 'alt', $( element ).text() );
90
+ var a = $( '<a />' );
91
+ $( a ).attr(
92
+ 'href',
93
+ this.base_url + 'q=' + pos.lat() + ',' + pos.lng() + '&z=' + zoom
94
+ );
95
+ $( a ).html( img );
96
+ $( element ).html( a );
97
+ $( element ).addClass( 'staticmap' );
98
+ }
99
+ }
100
+
101
+ $( '.simplemap' ).each( function(){
102
+ new SimpleMap( $( 'div', this ).get( 0 ) );
103
+ } );
104
+
105
+ } )( jQuery );
trunk/js/simple-map.min.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Simple Map - v2.8.1
3
+ *
4
+ * http://wordpress.org/plugins/simple-map/
5
+ * https://github.com/miya0001/simple-map
6
+ *
7
+ * Special thanks!
8
+ * http://hpneo.github.io/gmaps/
9
+ *
10
+ * Copyright 2015, Takayuki Miyauchi (http://wpist.me/)
11
+ * Released under the GPLv2
12
+ */
13
+ "use strict";!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(["jquery","googlemaps!"],b):a.GMaps=b()}(this,function(){var a=function(a,b){var c;if(a===b)return a;for(c in b)a[c]=b[c];return a},b=function(a,b){var c,d=Array.prototype.slice.call(arguments,2),e=[],f=a.length;if(Array.prototype.map&&a.map===Array.prototype.map)e=Array.prototype.map.call(a,function(a){var c=d.slice(0);return c.splice(0,0,a),b.apply(this,c)});else for(c=0;f>c;c++)callback_params=d,callback_params.splice(0,0,a[c]),e.push(b.apply(this,callback_params));return e},c=function(a){var b,c=[];for(b=0;b<a.length;b++)c=c.concat(a[b]);return c},d=function(a,b){var c=a[0],d=a[1];return b&&(c=a[1],d=a[0]),new google.maps.LatLng(c,d)},f=function(a,b){var c;for(c=0;c<a.length;c++)a[c]instanceof google.maps.LatLng||(a[c].length>0&&"object"==typeof a[c][0]?a[c]=f(a[c],b):a[c]=d(a[c],b));return a},g=function(a,b){var c,d=a.replace(".","");return c="jQuery"in this&&b?$("."+d,b)[0]:document.getElementsByClassName(d)[0]},h=function(a,b){var c,a=a.replace("#","");return c="jQuery"in window&&b?$("#"+a,b)[0]:document.getElementById(a)},i=function(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return[b,c]},j=function(b){if("object"!=typeof window.google||!window.google.maps)return"object"==typeof window.console&&window.console.error,function(){};var c=document,d=function(b){if(!this)return new d(b);b.zoom=b.zoom||15,b.mapType=b.mapType||"roadmap";var e,f=function(a,b){return void 0===a?b:a},j=this,k=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],l=["mousemove","mouseout","mouseover"],m=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],n=b.el||b.div,o=b.markerClusterer,p=google.maps.MapTypeId[b.mapType.toUpperCase()],q=new google.maps.LatLng(b.lat,b.lng),r=f(b.zoomControl,!0),s=b.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},t=s.style||"DEFAULT",u=s.position||"TOP_LEFT",v=f(b.panControl,!0),w=f(b.mapTypeControl,!0),x=f(b.scaleControl,!0),y=f(b.streetViewControl,!0),z=f(z,!0),A={},B={zoom:this.zoom,center:q,mapTypeId:p},C={panControl:v,zoomControl:r,zoomControlOptions:{style:google.maps.ZoomControlStyle[t],position:google.maps.ControlPosition[u]},mapTypeControl:w,scaleControl:x,streetViewControl:y,overviewMapControl:z};if("string"==typeof b.el||"string"==typeof b.div?n.indexOf("#")>-1?this.el=h(n,b.context):this.el=g.apply(this,[n,b.context]):this.el=n,"undefined"==typeof this.el||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[j.el.id]={},this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=b.zoom,this.registered_events={},this.el.style.width=b.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=b.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=b.enableNewStyle,e=0;e<m.length;e++)delete b[m[e]];for(1!=b.disableDefaultUI&&(B=a(B,C)),A=a(B,b),e=0;e<k.length;e++)delete A[k[e]];for(e=0;e<l.length;e++)delete A[l[e]];this.map=new google.maps.Map(this.el,A),o&&(this.markerClusterer=o.apply(this,[this.map]));var D=function(a,b){var c="",d=window.context_menu[j.el.id][a];for(var e in d)if(d.hasOwnProperty(e)){var f=d[e];c+='<li><a id="'+a+"_"+e+'" href="#">'+f.title+"</a></li>"}if(h("gmaps_context_menu")){var g=h("gmaps_context_menu");g.innerHTML=c;var e,k=g.getElementsByTagName("a"),l=k.length;for(e=0;l>e;e++){var m=k[e],n=function(c){c.preventDefault(),d[this.id.replace(a+"_","")].action.apply(j,[b]),j.hideContextMenu()};google.maps.event.clearListeners(m,"click"),google.maps.event.addDomListenerOnce(m,"click",n,!1)}var o=i.apply(this,[j.el]),p=o[0]+b.pixel.x-15,q=o[1]+b.pixel.y-15;g.style.left=p+"px",g.style.top=q+"px"}};this.buildContextMenu=function(a,b){if("marker"===a){b.pixel={};var c=new google.maps.OverlayView;c.setMap(j.map),c.draw=function(){var d=c.getProjection(),e=b.marker.getPosition();b.pixel=d.fromLatLngToContainerPixel(e),D(a,b)}}else D(a,b);var d=h("gmaps_context_menu");setTimeout(function(){d.style.display="block"},0)},this.setContextMenu=function(a){window.context_menu[j.el.id][a.control]={};var b,d=c.createElement("ul");for(b in a.options)if(a.options.hasOwnProperty(b)){var e=a.options[b];window.context_menu[j.el.id][a.control][e.name]={title:e.title,action:e.action}}d.id="gmaps_context_menu",d.style.display="none",d.style.position="absolute",d.style.minWidth="100px",d.style.background="white",d.style.listStyle="none",d.style.padding="8px",d.style.boxShadow="2px 2px 6px #ccc",h("gmaps_context_menu")||c.body.appendChild(d);var f=h("gmaps_context_menu");google.maps.event.addDomListener(f,"mouseout",function(a){a.relatedTarget&&this.contains(a.relatedTarget)||window.setTimeout(function(){f.style.display="none"},400)},!1)},this.hideContextMenu=function(){var a=h("gmaps_context_menu");a&&(a.style.display="none")};var E=function(a,c){google.maps.event.addListener(a,c,function(a){void 0==a&&(a=this),b[c].apply(this,[a]),j.hideContextMenu()})};google.maps.event.addListener(this.map,"zoom_changed",this.hideContextMenu);for(var F=0;F<k.length;F++){var G=k[F];G in b&&E(this.map,G)}for(var F=0;F<l.length;F++){var G=l[F];G in b&&E(this.map,G)}google.maps.event.addListener(this.map,"rightclick",function(a){b.rightclick&&b.rightclick.apply(this,[a]),void 0!=window.context_menu[j.el.id].map&&j.buildContextMenu("map",a)}),this.refresh=function(){google.maps.event.trigger(this.map,"resize")},this.fitZoom=function(){var a,b=[],c=this.markers.length;for(a=0;c>a;a++)"boolean"==typeof this.markers[a].visible&&this.markers[a].visible&&b.push(this.markers[a].getPosition());this.fitLatLngBounds(b)},this.fitLatLngBounds=function(a){var b,c=a.length,d=new google.maps.LatLngBounds;for(b=0;c>b;b++)d.extend(a[b]);this.map.fitBounds(d)},this.setCenter=function(a,b,c){this.map.panTo(new google.maps.LatLng(a,b)),c&&c()},this.getElement=function(){return this.el},this.zoomIn=function(a){a=a||1,this.zoom=this.map.getZoom()+a,this.map.setZoom(this.zoom)},this.zoomOut=function(a){a=a||1,this.zoom=this.map.getZoom()-a,this.map.setZoom(this.zoom)};var H,I=[];for(H in this.map)"function"!=typeof this.map[H]||this[H]||I.push(H);for(e=0;e<I.length;e++)!function(a,b,c){a[c]=function(){return b[c].apply(b,arguments)}}(this,this.map,I[e])};return d}(this);j.prototype.createControl=function(a){var b=document.createElement("div");b.style.cursor="pointer",a.disableDefaultStyles!==!0&&(b.style.fontFamily="Roboto, Arial, sans-serif",b.style.fontSize="11px",b.style.boxShadow="rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px");for(var c in a.style)b.style[c]=a.style[c];a.id&&(b.id=a.id),a.title&&(b.title=a.title),a.classes&&(b.className=a.classes),a.content&&("string"==typeof a.content?b.innerHTML=a.content:a.content instanceof HTMLElement&&b.appendChild(a.content)),a.position&&(b.position=google.maps.ControlPosition[a.position.toUpperCase()]);for(var d in a.events)!function(b,c){google.maps.event.addDomListener(b,c,function(){a.events[c].apply(this,[this])})}(b,d);return b.index=1,b},j.prototype.addControl=function(a){var b=this.createControl(a);return this.controls.push(b),this.map.controls[b.position].push(b),b},j.prototype.removeControl=function(a){var b,c=null;for(b=0;b<this.controls.length;b++)this.controls[b]==a&&(c=this.controls[b].position,this.controls.splice(b,1));if(c)for(b=0;b<this.map.controls.length;b++){var d=this.map.controls[a.position];if(d.getAt(b)==a){d.removeAt(b);break}}return a},j.prototype.createMarker=function(b){if(void 0==b.lat&&void 0==b.lng&&void 0==b.position)throw"No latitude or longitude defined.";var c=this,d=b.details,e=b.fences,f=b.outside,g={position:new google.maps.LatLng(b.lat,b.lng),map:null},h=a(g,b);delete h.lat,delete h.lng,delete h.fences,delete h.outside;var i=new google.maps.Marker(h);if(i.fences=e,b.infoWindow){i.infoWindow=new google.maps.InfoWindow(b.infoWindow);for(var j=["closeclick","content_changed","domready","position_changed","zindex_changed"],k=0;k<j.length;k++)!function(a,c){b.infoWindow[c]&&google.maps.event.addListener(a,c,function(a){b.infoWindow[c].apply(this,[a])})}(i.infoWindow,j[k])}for(var l=["animation_changed","clickable_changed","cursor_changed","draggable_changed","flat_changed","icon_changed","position_changed","shadow_changed","shape_changed","title_changed","visible_changed","zindex_changed"],m=["dblclick","drag","dragend","dragstart","mousedown","mouseout","mouseover","mouseup"],k=0;k<l.length;k++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(){b[c].apply(this,[this])})}(i,l[k]);for(var k=0;k<m.length;k++)!function(a,c,d){b[d]&&google.maps.event.addListener(c,d,function(c){c.pixel||(c.pixel=a.getProjection().fromLatLngToPoint(c.latLng)),b[d].apply(this,[c])})}(this.map,i,m[k]);return google.maps.event.addListener(i,"click",function(){this.details=d,b.click&&b.click.apply(this,[this]),i.infoWindow&&(c.hideInfoWindows(),i.infoWindow.open(c.map,i))}),google.maps.event.addListener(i,"rightclick",function(a){a.marker=this,b.rightclick&&b.rightclick.apply(this,[a]),void 0!=window.context_menu[c.el.id].marker&&c.buildContextMenu("marker",a)}),i.fences&&google.maps.event.addListener(i,"dragend",function(){c.checkMarkerGeofence(i,function(a,b){f(a,b)})}),i},j.prototype.addMarker=function(a){var b;if(a.hasOwnProperty("gm_accessors_"))b=a;else{if(!(a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")||a.position))throw"No latitude or longitude defined.";b=this.createMarker(a)}return b.setMap(this.map),this.markerClusterer&&this.markerClusterer.addMarker(b),this.markers.push(b),j.fire("marker_added",b,this),b},j.prototype.addMarkers=function(a){for(var b,c=0;b=a[c];c++)this.addMarker(b);return this.markers},j.prototype.hideInfoWindows=function(){for(var a,b=0;a=this.markers[b];b++)a.infoWindow&&a.infoWindow.close()},j.prototype.removeMarker=function(a){for(var b=0;b<this.markers.length;b++)if(this.markers[b]===a){this.markers[b].setMap(null),this.markers.splice(b,1),this.markerClusterer&&this.markerClusterer.removeMarker(a),j.fire("marker_removed",a,this);break}return a},j.prototype.removeMarkers=function(a){var b=[];if("undefined"==typeof a){for(var c=0;c<this.markers.length;c++){var d=this.markers[c];d.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(d),j.fire("marker_removed",d,this)}this.markers=b}else{for(var c=0;c<a.length;c++){var e=this.markers.indexOf(a[c]);if(e>-1){var d=this.markers[e];d.setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(d),j.fire("marker_removed",d,this)}}for(var c=0;c<this.markers.length;c++){var d=this.markers[c];null!=d.getMap()&&b.push(d)}this.markers=b}},j.prototype.drawOverlay=function(a){var b=new google.maps.OverlayView,c=!0;return b.setMap(this.map),null!=a.auto_show&&(c=a.auto_show),b.onAdd=function(){var c=document.createElement("div");c.style.borderStyle="none",c.style.borderWidth="0px",c.style.position="absolute",c.style.zIndex=100,c.innerHTML=a.content,b.el=c,a.layer||(a.layer="overlayLayer");var d=this.getPanes(),e=d[a.layer],f=["contextmenu","DOMMouseScroll","dblclick","mousedown"];e.appendChild(c);for(var g=0;g<f.length;g++)!function(a,b){google.maps.event.addDomListener(a,b,function(a){-1!=navigator.userAgent.toLowerCase().indexOf("msie")&&document.all?(a.cancelBubble=!0,a.returnValue=!1):a.stopPropagation()})}(c,f[g]);a.click&&(d.overlayMouseTarget.appendChild(b.el),google.maps.event.addDomListener(b.el,"click",function(){a.click.apply(b,[b])})),google.maps.event.trigger(this,"ready")},b.draw=function(){var d=this.getProjection(),e=d.fromLatLngToDivPixel(new google.maps.LatLng(a.lat,a.lng));a.horizontalOffset=a.horizontalOffset||0,a.verticalOffset=a.verticalOffset||0;var f=b.el,g=f.children[0],h=g.clientHeight,i=g.clientWidth;switch(a.verticalAlign){case"top":f.style.top=e.y-h+a.verticalOffset+"px";break;default:case"middle":f.style.top=e.y-h/2+a.verticalOffset+"px";break;case"bottom":f.style.top=e.y+a.verticalOffset+"px"}switch(a.horizontalAlign){case"left":f.style.left=e.x-i+a.horizontalOffset+"px";break;default:case"center":f.style.left=e.x-i/2+a.horizontalOffset+"px";break;case"right":f.style.left=e.x+a.horizontalOffset+"px"}f.style.display=c?"block":"none",c||a.show.apply(this,[f])},b.onRemove=function(){var c=b.el;a.remove?a.remove.apply(this,[c]):(b.el.parentNode.removeChild(b.el),b.el=null)},this.overlays.push(b),b},j.prototype.removeOverlay=function(a){for(var b=0;b<this.overlays.length;b++)if(this.overlays[b]===a){this.overlays[b].setMap(null),this.overlays.splice(b,1);break}},j.prototype.removeOverlays=function(){for(var a,b=0;a=this.overlays[b];b++)a.setMap(null);this.overlays=[]},j.prototype.drawPolyline=function(a){var b=[],c=a.path;if(c.length)if(void 0===c[0][0])b=c;else for(var d,e=0;d=c[e];e++)b.push(new google.maps.LatLng(d[0],d[1]));var f={map:this.map,path:b,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight,geodesic:a.geodesic,clickable:!0,editable:!1,visible:!0};a.hasOwnProperty("clickable")&&(f.clickable=a.clickable),a.hasOwnProperty("editable")&&(f.editable=a.editable),a.hasOwnProperty("icons")&&(f.icons=a.icons),a.hasOwnProperty("zIndex")&&(f.zIndex=a.zIndex);for(var g=new google.maps.Polyline(f),h=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],i=0;i<h.length;i++)!function(b,c){a[c]&&google.maps.event.addListener(b,c,function(b){a[c].apply(this,[b])})}(g,h[i]);return this.polylines.push(g),j.fire("polyline_added",g,this),g},j.prototype.removePolyline=function(a){for(var b=0;b<this.polylines.length;b++)if(this.polylines[b]===a){this.polylines[b].setMap(null),this.polylines.splice(b,1),j.fire("polyline_removed",a,this);break}},j.prototype.removePolylines=function(){for(var a,b=0;a=this.polylines[b];b++)a.setMap(null);this.polylines=[]},j.prototype.drawCircle=function(b){b=a({map:this.map,center:new google.maps.LatLng(b.lat,b.lng)},b),delete b.lat,delete b.lng;for(var c=new google.maps.Circle(b),d=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],e=0;e<d.length;e++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(c,d[e]);return this.polygons.push(c),c},j.prototype.drawRectangle=function(b){b=a({map:this.map},b);var c=new google.maps.LatLngBounds(new google.maps.LatLng(b.bounds[0][0],b.bounds[0][1]),new google.maps.LatLng(b.bounds[1][0],b.bounds[1][1]));b.bounds=c;for(var d=new google.maps.Rectangle(b),e=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],f=0;f<e.length;f++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(d,e[f]);return this.polygons.push(d),d},j.prototype.drawPolygon=function(d){var e=!1;d.hasOwnProperty("useGeoJSON")&&(e=d.useGeoJSON),delete d.useGeoJSON,d=a({map:this.map},d),0==e&&(d.paths=[d.paths.slice(0)]),d.paths.length>0&&d.paths[0].length>0&&(d.paths=c(b(d.paths,f,e)));for(var g=new google.maps.Polygon(d),h=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],i=0;i<h.length;i++)!function(a,b){d[b]&&google.maps.event.addListener(a,b,function(a){d[b].apply(this,[a])})}(g,h[i]);return this.polygons.push(g),j.fire("polygon_added",g,this),g},j.prototype.removePolygon=function(a){for(var b=0;b<this.polygons.length;b++)if(this.polygons[b]===a){this.polygons[b].setMap(null),this.polygons.splice(b,1),j.fire("polygon_removed",a,this);break}},j.prototype.removePolygons=function(){for(var a,b=0;a=this.polygons[b];b++)a.setMap(null);this.polygons=[]},j.prototype.getFromFusionTables=function(a){var b=a.events;delete a.events;var c=a,d=new google.maps.FusionTablesLayer(c);for(var e in b)!function(a,c){google.maps.event.addListener(a,c,function(a){b[c].apply(this,[a])})}(d,e);return this.layers.push(d),d},j.prototype.loadFromFusionTables=function(a){var b=this.getFromFusionTables(a);return b.setMap(this.map),b},j.prototype.getFromKML=function(a){var b=a.url,c=a.events;delete a.url,delete a.events;var d=a,e=new google.maps.KmlLayer(b,d);for(var f in c)!function(a,b){google.maps.event.addListener(a,b,function(a){c[b].apply(this,[a])})}(e,f);return this.layers.push(e),e},j.prototype.loadFromKML=function(a){var b=this.getFromKML(a);return b.setMap(this.map),b},j.prototype.addLayer=function(a,b){b=b||{};var c;switch(a){case"weather":this.singleLayers.weather=c=new google.maps.weather.WeatherLayer;break;case"clouds":this.singleLayers.clouds=c=new google.maps.weather.CloudLayer;break;case"traffic":this.singleLayers.traffic=c=new google.maps.TrafficLayer;break;case"transit":this.singleLayers.transit=c=new google.maps.TransitLayer;break;case"bicycling":this.singleLayers.bicycling=c=new google.maps.BicyclingLayer;break;case"panoramio":this.singleLayers.panoramio=c=new google.maps.panoramio.PanoramioLayer,c.setTag(b.filter),delete b.filter,b.click&&google.maps.event.addListener(c,"click",function(a){b.click(a),delete b.click});break;case"places":if(this.singleLayers.places=c=new google.maps.places.PlacesService(this.map),b.search||b.nearbySearch||b.radarSearch){var d={bounds:b.bounds||null,keyword:b.keyword||null,location:b.location||null,name:b.name||null,radius:b.radius||null,rankBy:b.rankBy||null,types:b.types||null};b.radarSearch&&c.radarSearch(d,b.radarSearch),b.search&&c.search(d,b.search),b.nearbySearch&&c.nearbySearch(d,b.nearbySearch)}if(b.textSearch){var e={bounds:b.bounds||null,location:b.location||null,query:b.query||null,radius:b.radius||null};c.textSearch(e,b.textSearch)}}return void 0!==c?("function"==typeof c.setOptions&&c.setOptions(b),"function"==typeof c.setMap&&c.setMap(this.map),c):void 0},j.prototype.removeLayer=function(a){if("string"==typeof a&&void 0!==this.singleLayers[a])this.singleLayers[a].setMap(null),delete this.singleLayers[a];else for(var b=0;b<this.layers.length;b++)if(this.layers[b]===a){this.layers[b].setMap(null),this.layers.splice(b,1);break}};var k,l;return j.prototype.getRoutes=function(b){switch(b.travelMode){case"bicycling":k=google.maps.TravelMode.BICYCLING;break;case"transit":k=google.maps.TravelMode.TRANSIT;break;case"driving":k=google.maps.TravelMode.DRIVING;break;default:k=google.maps.TravelMode.WALKING}l="imperial"===b.unitSystem?google.maps.UnitSystem.IMPERIAL:google.maps.UnitSystem.METRIC;var c={avoidHighways:!1,avoidTolls:!1,optimizeWaypoints:!1,waypoints:[]},d=a(c,b);d.origin=/string/.test(typeof b.origin)?b.origin:new google.maps.LatLng(b.origin[0],b.origin[1]),d.destination=/string/.test(typeof b.destination)?b.destination:new google.maps.LatLng(b.destination[0],b.destination[1]),d.travelMode=k,d.unitSystem=l,delete d.callback,delete d.error;var e=this,f=new google.maps.DirectionsService;f.route(d,function(a,c){if(c===google.maps.DirectionsStatus.OK){for(var d in a.routes)a.routes.hasOwnProperty(d)&&e.routes.push(a.routes[d]);b.callback&&b.callback(e.routes)}else b.error&&b.error(a,c)})},j.prototype.removeRoutes=function(){this.routes=[]},j.prototype.getElevations=function(d){d=a({locations:[],path:!1,samples:256},d),d.locations.length>0&&d.locations[0].length>0&&(d.locations=c(b([d.locations],f,!1)));var e=d.callback;delete d.callback;var g=new google.maps.ElevationService;if(d.path){var h={path:d.locations,samples:d.samples};g.getElevationAlongPath(h,function(a,b){e&&"function"==typeof e&&e(a,b)})}else delete d.path,delete d.samples,g.getElevationForLocations(d,function(a,b){e&&"function"==typeof e&&e(a,b)})},j.prototype.cleanRoute=j.prototype.removePolylines,j.prototype.drawRoute=function(a){var b=this;this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,unitSystem:a.unitSystem,error:a.error,callback:function(c){if(c.length>0){var d={path:c[c.length-1].overview_path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(d.icons=a.icons),b.drawPolyline(d),a.callback&&a.callback(c[c.length-1])}}})},j.prototype.travelRoute=function(a){if(a.origin&&a.destination)this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,unitSystem:a.unitSystem,error:a.error,callback:function(b){if(b.length>0&&a.start&&a.start(b[b.length-1]),b.length>0&&a.step){var c=b[b.length-1];if(c.legs.length>0)for(var d,e=c.legs[0].steps,f=0;d=e[f];f++)d.step_number=f,a.step(d,c.legs[0].steps.length-1)}b.length>0&&a.end&&a.end(b[b.length-1])}});else if(a.route&&a.route.legs.length>0)for(var b,c=a.route.legs[0].steps,d=0;b=c[d];d++)b.step_number=d,a.step(b)},j.prototype.drawSteppedRoute=function(a){var b=this;if(a.origin&&a.destination)this.getRoutes({origin:a.origin,destination:a.destination,travelMode:a.travelMode,waypoints:a.waypoints,error:a.error,callback:function(c){if(c.length>0&&a.start&&a.start(c[c.length-1]),c.length>0&&a.step){var d=c[c.length-1];if(d.legs.length>0)for(var e,f=d.legs[0].steps,g=0;e=f[g];g++){e.step_number=g;var h={path:e.path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(h.icons=a.icons),b.drawPolyline(h),a.step(e,d.legs[0].steps.length-1)}}c.length>0&&a.end&&a.end(c[c.length-1])}});else if(a.route&&a.route.legs.length>0)for(var c,d=a.route.legs[0].steps,e=0;c=d[e];e++){c.step_number=e;var f={path:c.path,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(f.icons=a.icons),b.drawPolyline(f),a.step(c)}},j.Route=function(a){this.origin=a.origin,this.destination=a.destination,this.waypoints=a.waypoints,this.map=a.map,this.route=a.route,this.step_count=0,this.steps=this.route.legs[0].steps,this.steps_length=this.steps.length;var b={path:new google.maps.MVCArray,strokeColor:a.strokeColor,strokeOpacity:a.strokeOpacity,strokeWeight:a.strokeWeight};a.hasOwnProperty("icons")&&(b.icons=a.icons),this.polyline=this.map.drawPolyline(b).getPath()},j.Route.prototype.getRoute=function(a){var b=this;this.map.getRoutes({origin:this.origin,destination:this.destination,travelMode:a.travelMode,waypoints:this.waypoints||[],error:a.error,callback:function(){b.route=e[0],a.callback&&a.callback.call(b)}})},j.Route.prototype.back=function(){if(this.step_count>0){this.step_count--;var a=this.route.legs[0].steps[this.step_count].path;for(var b in a)a.hasOwnProperty(b)&&this.polyline.pop()}},j.Route.prototype.forward=function(){if(this.step_count<this.steps_length){var a=this.route.legs[0].steps[this.step_count].path;for(var b in a)a.hasOwnProperty(b)&&this.polyline.push(a[b]);this.step_count++}},j.prototype.checkGeofence=function(a,b,c){return c.containsLatLng(new google.maps.LatLng(a,b))},j.prototype.checkMarkerGeofence=function(a,b){if(a.fences)for(var c,d=0;c=a.fences[d];d++){var e=a.getPosition();this.checkGeofence(e.lat(),e.lng(),c)||b(a,c)}},j.prototype.toImage=function(a){var a=a||{},b={};if(b.size=a.size||[this.el.clientWidth,this.el.clientHeight],b.lat=this.getCenter().lat(),b.lng=this.getCenter().lng(),this.markers.length>0){b.markers=[];for(var c=0;c<this.markers.length;c++)b.markers.push({lat:this.markers[c].getPosition().lat(),lng:this.markers[c].getPosition().lng()})}if(this.polylines.length>0){var d=this.polylines[0];b.polyline={},b.polyline.path=google.maps.geometry.encoding.encodePath(d.getPath()),b.polyline.strokeColor=d.strokeColor,b.polyline.strokeOpacity=d.strokeOpacity,b.polyline.strokeWeight=d.strokeWeight}return j.staticMapURL(b)},j.staticMapURL=function(a){function b(a,b){if("#"===a[0]&&(a=a.replace("#","0x"),b)){if(b=parseFloat(b),b=Math.min(1,Math.max(b,0)),0===b)return"0x00000000";b=(255*b).toString(16),1===b.length&&(b+=b),a=a.slice(0,8)+b}return a}var c,d=[],e=("file:"===location.protocol?"http:":location.protocol)+"//maps.googleapis.com/maps/api/staticmap";a.url&&(e=a.url,delete a.url),e+="?";var f=a.markers;delete a.markers,!f&&a.marker&&(f=[a.marker],delete a.marker);var g=a.styles;delete a.styles;var h=a.polyline;if(delete a.polyline,a.center)d.push("center="+a.center),delete a.center;else if(a.address)d.push("center="+a.address),delete a.address;else if(a.lat)d.push(["center=",a.lat,",",a.lng].join("")),delete a.lat,delete a.lng;else if(a.visible){var i=encodeURI(a.visible.join("|"));d.push("visible="+i)}var j=a.size;j?(j.join&&(j=j.join("x")),delete a.size):j="630x300",d.push("size="+j),a.zoom||a.zoom===!1||(a.zoom=15);var k=a.hasOwnProperty("sensor")?!!a.sensor:!0;delete a.sensor,d.push("sensor="+k);for(var l in a)a.hasOwnProperty(l)&&d.push(l+"="+a[l]);if(f)for(var m,n,o=0;c=f[o];o++){m=[],c.size&&"normal"!==c.size?(m.push("size:"+c.size),delete c.size):c.icon&&(m.push("icon:"+encodeURI(c.icon)),delete c.icon),c.color&&(m.push("color:"+c.color.replace("#","0x")),delete c.color),c.label&&(m.push("label:"+c.label[0].toUpperCase()),delete c.label),n=c.address?c.address:c.lat+","+c.lng,delete c.address,delete c.lat,delete c.lng;for(var l in c)c.hasOwnProperty(l)&&m.push(l+":"+c[l]);m.length||0===o?(m.push(n),m=m.join("|"),d.push("markers="+encodeURI(m))):(m=d.pop()+encodeURI("|"+n),d.push(m))}if(g)for(var o=0;o<g.length;o++){var p=[];g[o].featureType&&p.push("feature:"+g[o].featureType.toLowerCase()),g[o].elementType&&p.push("element:"+g[o].elementType.toLowerCase());for(var q=0;q<g[o].stylers.length;q++)for(var r in g[o].stylers[q]){var s=g[o].stylers[q][r];("hue"==r||"color"==r)&&(s="0x"+s.substring(1)),p.push(r+":"+s)}var t=p.join("|");""!=t&&d.push("style="+t)}if(h){if(c=h,h=[],c.strokeWeight&&h.push("weight:"+parseInt(c.strokeWeight,10)),c.strokeColor){var u=b(c.strokeColor,c.strokeOpacity);h.push("color:"+u)}if(c.fillColor){var v=b(c.fillColor,c.fillOpacity);h.push("fillcolor:"+v)}var w=c.path;if(w.join)for(var x,q=0;x=w[q];q++)h.push(x.join(","));else h.push("enc:"+w);h=h.join("|"),d.push("path="+encodeURI(h))}var y=window.devicePixelRatio||1;return d.push("scale="+y),d=d.join("&"),e+d},j.prototype.addMapType=function(a,b){if(!b.hasOwnProperty("getTileUrl")||"function"!=typeof b.getTileUrl)throw"'getTileUrl' function required.";b.tileSize=b.tileSize||new google.maps.Size(256,256);var c=new google.maps.ImageMapType(b);this.map.mapTypes.set(a,c)},j.prototype.addOverlayMapType=function(a){if(!a.hasOwnProperty("getTile")||"function"!=typeof a.getTile)throw"'getTile' function required.";var b=a.index;delete a.index,this.map.overlayMapTypes.insertAt(b,a)},j.prototype.removeOverlayMapType=function(a){this.map.overlayMapTypes.removeAt(a)},j.prototype.addStyle=function(a){var b=new google.maps.StyledMapType(a.styles,{name:a.styledMapName});this.map.mapTypes.set(a.mapTypeId,b)},j.prototype.setStyle=function(a){this.map.setMapTypeId(a)},j.prototype.createPanorama=function(a){return a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")||(a.lat=this.getCenter().lat(),a.lng=this.getCenter().lng()),this.panorama=j.createPanorama(a),this.map.setStreetView(this.panorama),this.panorama},j.createPanorama=function(b){var c=h(b.el,b.context);b.position=new google.maps.LatLng(b.lat,b.lng),delete b.el,delete b.context,delete b.lat,delete b.lng;for(var d=["closeclick","links_changed","pano_changed","position_changed","pov_changed","resize","visible_changed"],e=a({visible:!0},b),f=0;f<d.length;f++)delete e[d[f]];for(var g=new google.maps.StreetViewPanorama(c,e),f=0;f<d.length;f++)!function(a,c){b[c]&&google.maps.event.addListener(a,c,function(){b[c].apply(this)})}(g,d[f]);return g},j.prototype.on=function(a,b){return j.on(a,this,b)},j.prototype.off=function(a){j.off(a,this)},j.custom_events=["marker_added","marker_removed","polyline_added","polyline_removed","polygon_added","polygon_removed","geolocated","geolocation_failed"],j.on=function(a,b,c){if(-1==j.custom_events.indexOf(a))return b instanceof j&&(b=b.map),google.maps.event.addListener(b,a,c);var d={handler:c,eventName:a};return b.registered_events[a]=b.registered_events[a]||[],b.registered_events[a].push(d),d},j.off=function(a,b){-1==j.custom_events.indexOf(a)?(b instanceof j&&(b=b.map),google.maps.event.clearListeners(b,a)):b.registered_events[a]=[]},j.fire=function(a,b,c){if(-1==j.custom_events.indexOf(a))google.maps.event.trigger(b,a,Array.prototype.slice.apply(arguments).slice(2));else if(a in c.registered_events)for(var d=c.registered_events[a],e=0;e<d.length;e++)!function(a,b,c){a.apply(b,[c])}(d[e].handler,c,b)},j.geolocate=function(a){var b=a.always||a.complete;navigator.geolocation?navigator.geolocation.getCurrentPosition(function(c){a.success(c),b&&b()},function(c){a.error(c),b&&b()},a.options):(a.not_supported(),b&&b())},j.geocode=function(a){this.geocoder=new google.maps.Geocoder;var b=a.callback;a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")&&(a.latLng=new google.maps.LatLng(a.lat,a.lng)),delete a.lat,delete a.lng,delete a.callback,this.geocoder.geocode(a,function(a,c){b(a,c)})},"object"==typeof window.google&&window.google.maps&&(google.maps.Polygon.prototype.getBounds||(google.maps.Polygon.prototype.getBounds=function(a){for(var b,c=new google.maps.LatLngBounds,d=this.getPaths(),e=0;e<d.getLength();e++){b=d.getAt(e);for(var f=0;f<b.getLength();f++)c.extend(b.getAt(f))}return c}),google.maps.Polygon.prototype.containsLatLng||(google.maps.Polygon.prototype.containsLatLng=function(a){var b=this.getBounds();if(null!==b&&!b.contains(a))return!1;for(var c=!1,d=this.getPaths().getLength(),e=0;d>e;e++)for(var f=this.getPaths().getAt(e),g=f.getLength(),h=g-1,i=0;g>i;i++){var j=f.getAt(i),k=f.getAt(h);(j.lng()<a.lng()&&k.lng()>=a.lng()||k.lng()<a.lng()&&j.lng()>=a.lng())&&j.lat()+(a.lng()-j.lng())/(k.lng()-j.lng())*(k.lat()-j.lat())<a.lat()&&(c=!c),h=i}return c}),google.maps.Circle.prototype.containsLatLng||(google.maps.Circle.prototype.containsLatLng=function(a){return google.maps.geometry?google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(),a)<=this.getRadius():!0}),google.maps.LatLngBounds.prototype.containsLatLng=function(a){return this.contains(a)},google.maps.Marker.prototype.setFences=function(a){this.fences=a},google.maps.Marker.prototype.addFence=function(a){this.fences.push(a)},google.maps.Marker.prototype.getId=function(){return this.__gm_id}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),j}),function(a){var b=function(b){this.base_url="https://maps.google.com/maps?";var c=this,d=16;if(parseFloat(a(b).data("zoom"))&&(d=a(b).data("zoom")),a(b).data("lat")&&a(b).data("lng")){var e=a(b).data("lat"),f=a(b).data("lng"),g=a(b).html(),h=new google.maps.LatLng(e,f);this.display(b,h,d,g)}else if(a(b).data("addr").length||a(b).text().length){var i=a(b).data("addr").length?a(b).data("addr"):a(b).text();GMaps.geocode({address:i,callback:function(e,f){if("OK"==f){var g=e[0].geometry.location;c.display(b,g,d,a(b).html())}}})}};b.prototype.display=function(b,c,d,e){a(b).show();var f=a(b).data("breakpoint");if(a("html").width()>f){var g=new GMaps({div:b,lat:c.lat(),lng:c.lng(),mapTypeControl:!1,zoom:parseFloat(d),streetViewControl:!1,scrollwheel:!1,mapTypeId:google.maps.MapTypeId.ROADMAP,width:b.style.width,height:b.style.height}),h=a(b).is(":visible");if(!h)var i=setInterval(function(){a(b).is(":visible")&&(clearInterval(i),g.refresh(),g.setCenter(c.lat(),c.lng()))},1e3);if(e.length){var j=g.addMarker({lat:c.lat(),lng:c.lng(),infoWindow:{content:e}});"open"==a(b).data("infowindow")&&j.infoWindow.open(j.map,j)}else g.addMarker({lat:c.lat(),lng:c.lng()})}else{var k=GMaps.staticMapURL({center:c.lat()+","+c.lng(),zoom:d,size:f+"x"+a(b).height(),markers:[{lat:c.lat(),lng:c.lng()}],sensor:"false"}),l=a("<img />");a(l).attr("src",k),
14
+ a(l).attr("alt",a(b).text());var m=a("<a />");a(m).attr("href",this.base_url+"q="+c.lat()+","+c.lng()+"&z="+d),a(m).html(l),a(b).html(m),a(b).addClass("staticmap")}},a(".simplemap").each(function(){new b(a("div",this).get(0))})}(jQuery);
trunk/readme.txt ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Simple Map ===
2
+ Contributors: miyauchi
3
+ Donate link: http://wpist.me/
4
+ Tags: google maps, map, shortcode, address
5
+ Requires at least: 3.6
6
+ Tested up to: 4.3
7
+ Stable tag: 2.8.7
8
+
9
+ Easy way to embed google map(s).
10
+
11
+ == Description ==
12
+
13
+ Easy way to embed google map(s) using [gmaps.js](http://hpneo.github.com/gmaps/).
14
+
15
+ This plugin allows you to convert address into google maps like below:
16
+
17
+ `[map]San Francisco, California[/map]`
18
+
19
+ Another way, you can embed Google Map with url only like oEmbed.
20
+
21
+
22
+ You can also use coordinates, set width, height and zoom:
23
+
24
+ `[map lat="37.77493" lng="-122.41942"]
25
+ Text you would
26
+ like to appear
27
+ as a tooltip
28
+ goes here
29
+ [/map]`
30
+
31
+ In this case there will be a marker on the map with a tooltip appearing on click on the said marker.
32
+ You can use simple html as the tooltip content.
33
+
34
+
35
+ [This plugin is maintained on GitHub.](https://github.com/miya0001/simple-map)
36
+
37
+ = Some features: =
38
+
39
+ * Allows you to embed google map based on shortcode.
40
+ * Markers can be added using address or lat/long.
41
+ * Displays static map for iPhone automatically.
42
+ * oEmbed Support.
43
+
44
+ = Arguments =
45
+
46
+ * width: Width of the map. Default value is "100%".
47
+ * height: Height of the map. Default value is "200px".
48
+ * zoom: Zoom of the map. Default value is "16".
49
+ * breakpoint: If display is narrower than this value, this plugin will display static map. Default value is "480".
50
+ * addr: Address of the map you want to place.
51
+ * lat: Lat of the map you want to place.
52
+ * lng: Lng of the map you want to place.
53
+ * infowindow: If you want to open infoWindow by Default, please set "open".
54
+
55
+ If you will set lat/lng and address, this plugin gives priority to lat/lng.
56
+
57
+ = Filter Hooks =
58
+
59
+ This plugin has some filter hooks for customize default.
60
+
61
+ * simplemap_default_width
62
+ * simplemap_default_height
63
+ * simplemap_default_zoom
64
+ * simplemap_default_breakpoint
65
+ * simplemap_default_infowindow
66
+
67
+ `add_filter( 'simplemap_default_zoom', function(){
68
+ return 10; // Default zoom is 10
69
+ } );`
70
+
71
+ = Translators =
72
+
73
+ * Japanese(ja) - [Takayuki Miyauchi](http://firegoby.jp/)
74
+
75
+ Please contact me.
76
+
77
+ * https://github.com/miya0001/simple-map/issues
78
+
79
+ = Contributors =
80
+
81
+ * [Takayuki Miyauchi](http://firegoby.jp/)
82
+ * [Zoltán Balogh](http://birdcreation.com/)
83
+ * [Takanobu Watanabe](https://github.com/tknv)
84
+ * [Shinichi Nishikawa](http://th-daily.shinichi.me/)
85
+ * [nissuk](http://www.nissuk.info/)
86
+
87
+ == Installation ==
88
+
89
+ * Download the zip, extract it and upload the extracted folder to your-wp-directory/wp-content/plugins/
90
+ * Go to the plugins administration screen in your WordPress admin and activate the plugin.
91
+
92
+ OR
93
+
94
+ * Download the zip, go to the plugins administration screen in your WordPress admin, click on Add New then on upload, browse to the downloaded zip, upload the plugin and activate it.
95
+
96
+ OR
97
+
98
+ * Go to the plugins administration screen in your WordPress admin, click on Add New, search for Simple Map and click on Install Now.
99
+
100
+ *Usage*
101
+
102
+ This plugin allows you to convert address into google maps like below:
103
+
104
+ `[map]San Francisco, California[/map]`
105
+
106
+ Another way, you can embed Google Map with url only like oEmbed.
107
+
108
+ You can also use coordinates, set width, height and zoom:
109
+
110
+ `[map lat="37.77493" lng="-122.41942" width="100%" height="400px" zoom="15"]
111
+ Text you would
112
+ like to appear
113
+ as a tooltip
114
+ goes here
115
+ [/map]`
116
+
117
+ In this case there will be a marker on the map with a tooltip appearing on click on the said marker.
118
+ You can use simple html as the tooltip content.
119
+
120
+ == Screenshots ==
121
+
122
+ 1. Very easy.
123
+ 2. Info Window.
124
+ 3. Mobile Support. (Google static map)
125
+
126
+ == Changelog ==
127
+
128
+ = 2.8.5 =
129
+
130
+ * Auto deploy
131
+
132
+ = 2.8.1 =
133
+
134
+ * Update SimpleMap class.
135
+
136
+ https://github.com/miya0001/simple-map/compare/2.8.0...2.8.1
137
+
138
+ = 2.8.0 =
139
+
140
+ * Display map in modal window.
141
+
142
+ https://github.com/miya0001/simple-map/compare/2.7.0...2.8.0
143
+
144
+ = 2.7.0 =
145
+
146
+ * UPdate gmaps.js to 0.4.21
147
+ * Add tests on travis
148
+
149
+ https://github.com/miya0001/simple-map/compare/2.6.0...2.7.0
150
+
151
+ = 2.6.0 =
152
+
153
+ * Update gmaps.js from 0.4.18 to 0.4.19
154
+ * Add front end test
155
+
156
+ https://github.com/miya0001/simple-map/compare/2.5.0...2.6.0
157
+
158
+ = 2.5.0 =
159
+ * Update gmaps.js 0.4.17 to 0.4.18
160
+ * Tested on WordPress 4.3
161
+
162
+ = 2.4.0 =
163
+ * Update gmaps.js 0.4.16 to 0.4.17
164
+
165
+ = 2.3.0 =
166
+ * Tested on the WordPress 4.1.
167
+ * Up to minimum required to WordPress 3.6.
168
+
169
+ = 2.2.0 =
170
+ * update gmaps.js 0.4.15 to 0.4.16
171
+
172
+ = 2.1.0 =
173
+ * update gmaps.js 0.4.14 to 0.4.15
174
+
175
+ = 2.0.0 =
176
+ * Add argument infowindow
177
+ * little fix
178
+
179
+ = 1.9.0 =
180
+ * update gmaps.js 0.4.13 to 0.4.14
181
+
182
+ = 1.8.0 =
183
+ * update gmaps.js 0.4.12 to 0.4.13
184
+
185
+ = 1.7.0 =
186
+ * update gmaps.js 0.4.11 to 0.4.12
187
+
188
+ = 1.6.0 =
189
+ * update gmaps.js 0.4.9 to 0.4.11
190
+
191
+ = 1.5.0 =
192
+ * enable ssl source of google map api js
193
+
194
+ = 1.4.0 =
195
+ * change URL match pattern.
196
+
197
+ = 1.3.0 =
198
+ * Update gmaps.js to 0.4.9.
199
+
200
+ = 1.2.0 =
201
+ * Tested on the WordPress 3.8.
202
+ * Add Grunt.
203
+
204
+ = 1.1.0 =
205
+ * Added support for gmaps.js tooltip on markers
206
+
207
+ = 1.0.0 =
208
+ * Delete hl=ja param from static map link uri.
209
+
210
+ = 0.9.0 =
211
+ * hook changed to the init.
212
+
213
+ = 0.8.0 =
214
+ * shortcode atts and address priority changed.
215
+
216
+ = 0.7.0 =
217
+ * gmaps.js updated 0.4.4 to 0.4.5
218
+
219
+ = 0.6.0 =
220
+ * oEmbed Support
221
+
222
+ = 0.1.0 =
223
+ * The first release.
224
+
225
+ == Credits ==
226
+
227
+ This plugin is not guaranteed though the user of WordPress can freely use this plugin free of charge regardless of the purpose.
228
+ The author must acknowledge the thing that the operation guarantee and the support in this plugin use are not done at all beforehand.
229
+
230
+ == Contact ==
231
+
232
+ twitter @miya0001
trunk/simple-map.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Simple Map
4
+ Author: Takayuki Miyauchi
5
+ Plugin URI: https://github.com/miya0001/simple-map
6
+ Description: Insert google map convert from address.
7
+ Version: 2.8.7
8
+ Author URI: http://wpist.me/
9
+ Domain Path: /languages
10
+ Text Domain: simplemap
11
+ */
12
+
13
+ $simplemap = new Simple_Map();
14
+
15
+ class Simple_Map {
16
+
17
+ private $shortcode_tag = 'map';
18
+ private $class_name = 'simplemap';
19
+ private $width = '100%';
20
+ private $height = '200px';
21
+ private $zoom = 16;
22
+ private $breakpoint = 480;
23
+ private $max_breakpoint = 640;
24
+
25
+ function __construct()
26
+ {
27
+ add_action( 'init', array( $this, 'init' ) );
28
+ }
29
+
30
+ public function init()
31
+ {
32
+ add_action( 'wp_head', array( $this, 'wp_head' ) );
33
+ add_shortcode( $this->get_shortcode_tag(), array( $this, 'shortcode' ) );
34
+
35
+ wp_embed_register_handler(
36
+ 'google-map',
37
+ '#( https://( www|maps ).google.[a-z]{2,3}\.?[a-z]{0,3}/maps( /ms )?\?.+ )#i',
38
+ array( &$this, 'oembed_handler' )
39
+ );
40
+ }
41
+
42
+ public function oembed_handler( $match )
43
+ {
44
+ return sprintf(
45
+ '[%s url="%s"]',
46
+ $this->get_shortcode_tag(),
47
+ esc_url( $match[0] )
48
+ );
49
+ }
50
+
51
+ public function wp_head()
52
+ {
53
+ echo "<style>.simplemap img{max-width:none !important;padding:0 !important;margin:0 !important;}.staticmap,.staticmap img{max-width:100% !important;height:auto !important;}.simplemap .simplemap-content{display:none;}</style>\n";
54
+ }
55
+
56
+ public function wp_enqueue_scripts()
57
+ {
58
+ wp_register_script(
59
+ 'google-maps-api',
60
+ '//maps.google.com/maps/api/js?sensor=false',
61
+ false,
62
+ null,
63
+ true
64
+ );
65
+
66
+ wp_register_script(
67
+ 'simplemap',
68
+ apply_filters(
69
+ 'simplemap_script',
70
+ plugins_url( 'js/simple-map.min.js' , __FILE__ )
71
+ ),
72
+ array( 'jquery', 'google-maps-api' ),
73
+ filemtime( dirname( __FILE__ ).'/js/simple-map.min.js' ),
74
+ true
75
+ );
76
+ wp_enqueue_script( 'simplemap' );
77
+ }
78
+
79
+ public function shortcode( $p, $content = null )
80
+ {
81
+ add_action( 'wp_footer', array( &$this, 'wp_enqueue_scripts' ) );
82
+
83
+ if ( isset( $p['width'] ) && preg_match( '/^[0-9]+(%|px)$/', $p['width'] ) ) {
84
+ $w = $p['width'];
85
+ } else {
86
+ $w = apply_filters( 'simplemap_default_width', $this->width );
87
+ }
88
+ if ( isset( $p['height'] ) && preg_match( '/^[0-9]+(%|px)$/', $p['height'] ) ) {
89
+ $h = $p['height'];
90
+ } else {
91
+ $h = apply_filters( 'simplemap_default_height', $this->height );
92
+ }
93
+ if ( isset( $p['zoom'] ) && intval( $p['zoom'] ) ) {
94
+ $zoom = $p['zoom'];
95
+ } else {
96
+ $zoom = apply_filters( 'simplemap_default_zoom', $this->zoom );
97
+ }
98
+ if ( isset( $p['breakpoint'] ) && intval( $p['breakpoint'] ) ) {
99
+ if ( intval( $p['breakpoint'] ) > $this->max_breakpoint ) {
100
+ $breakpoint = $this->max_breakpoint;
101
+ } else {
102
+ $breakpoint = intval( $p['breakpoint'] );
103
+ }
104
+ } else {
105
+ $breakpoint = apply_filters(
106
+ 'simplemap_default_breakpoint',
107
+ $this->breakpoint
108
+ );
109
+ }
110
+ if ( $content ) {
111
+ $content = do_shortcode( $content );
112
+ }
113
+ if ( isset( $p['infowindow'] ) && $p['infowindow'] ) {
114
+ $infowindow = $p['infowindow'];
115
+ } else {
116
+ $infowindow = apply_filters( 'simplemap_default_infowindow', 'close' );
117
+ }
118
+
119
+ $addr = '';
120
+ $lat = '';
121
+ $lng = '';
122
+
123
+ if ( isset( $p['url'] ) && $p['url'] ) {
124
+ $iframe = '<iframe width="%s" height="%s" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="%s"></iframe>';
125
+
126
+ return sprintf(
127
+ $iframe,
128
+ $w,
129
+ $h,
130
+ esc_url( $p['url'].'&output=embed' )
131
+ );
132
+ } elseif ( isset( $p['lat'] ) && preg_match( '/^\-?[0-9\.]+$/', $p['lat'] )
133
+ && isset( $p['lng'] ) && preg_match( '/^\-?[0-9\.]+$/', $p['lng'] ) ){
134
+ $lat = $p['lat'];
135
+ $lng = $p['lng'];
136
+ } elseif ( isset( $p['addr'] ) && $p['addr'] ) {
137
+ if ( $content ) {
138
+ $addr = esc_html( $p['addr'] );
139
+ } else {
140
+ $content = esc_html( $p['addr'] );
141
+ }
142
+ } elseif ( ! $content ) {
143
+ return;
144
+ }
145
+ return sprintf(
146
+ '<div class="%1$s"><div class="%1$s-content" data-breakpoint="%2$s" data-lat="%3$s" data-lng="%4$s" data-zoom="%5$s" data-addr="%6$s" data-infowindow="%7$s" style="width:%8$s;height:%9$s;">%10$s</div></div>',
147
+ apply_filters( 'simplemap_class_name', $this->class_name ),
148
+ $breakpoint,
149
+ $lat,
150
+ $lng,
151
+ $zoom,
152
+ $addr,
153
+ $infowindow,
154
+ $w,
155
+ $h,
156
+ trim( $content )
157
+ );
158
+ }
159
+
160
+ private function get_shortcode_tag()
161
+ {
162
+ return apply_filters( 'simplemap_shortcode_tag', $this->shortcode_tag );
163
+ }
164
+
165
+ } // end class
166
+
167
+
168
+ // EOF