MapPress Easy Google Maps - Version 2.48.5

Version Description

  • Fixed: shake in editor caused by Google API update
  • Fixed: API compatibility setting not applied in admin screens
  • Changed: removed inline directions, shape editor
Download this release

Release Info

Developer chrisvrichardson
Plugin Icon 128x128 MapPress Easy Google Maps
Version 2.48.5
Comparing to
See all releases

Code changes from version 2.48.4 to 2.48.5

js/mappress.min.js CHANGED
@@ -1 +1 @@
1
- var mapp=window.mapp||{};+function(n){mapp.Map=function(t,r){function a(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(u,n[i],t)}function y(){var i,t;n("[data-mapp-type]",f.menu).removeClass("mapp-active");n('[data-mapp-type="'+u.getMapTypeId()+'"]',f.menu).addClass("mapp-active");for(layer in s)i=!!s[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',f.menu).toggleClass("mapp-active",i);t=!!(e.center&&e.zoom);n('[data-mapp-action="viewport-set"]',f.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',f.menu).toggle(t)}function p(){var n=mappl10n.options.styles,i=mappl10n.options.style,r=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&u.setOptions({styles:n[i]}),e.editable){for(t in n)u.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),r.push(t);u.setOptions({mapTypeControlOptions:{mapTypeIds:r,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[e.mapTypeId]!="undefined"&&u.setOptions({styles:n[e.mapTypeId]})}function w(){f.controls.children("[data-mapp-position]").each(function(){var t=n(this).attr("data-mapp-position"),i;t=t?google.maps.ControlPosition[t]:google.maps.ControlPosition.TOP_RIGHT;i=n(this);i.get(0).index=0;u.controls[t].push(i.get(0))})}function b(){var f,i,t,r;for(s={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},f=n.makeArray(e.layers),i=0;i<f.length;i++)t=n.trim(f[i]),r=t.split(".").pop(),s[t]?l(t):r=="kml"||r=="kmz"?s[t]=new google.maps.KmlLayer({map:u,preserveViewport:!0,url:t}):r=="json"&&(s[t]=new google.maps.Data({map:u}).loadGeoJson(t))}function l(t,i){n.each(["traffic","bicycling","transit"],function(n,t){s[t].setMap(null)});t&&(i=typeof i=="undefined"?s[t].getMap()==null:i,s[t].setMap(i?u:null))}function v(t,i){var r=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(u.getMapTypeId()==t);t=e.editable?i&&(r||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":r?t:"roadmap";u.setMapTypeId(t)}this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,mapOpts:null,name:null,pois:null,postid:null,query:null,title:null,width:null,zoom:null};this.iw=null;this.places=null;this.poi=null;this.settings=r?r:{};var e=this,h=null,f={},u=null,s={},o=[],c;_.extend(this,this.defaults,_.pick(t,_.keys(this.defaults)),_.pick(this.settings,_.keys(this.defaults)));this.display=function(){if(f.layout=n("#"+this.name),n.each(["canvas","controls","directions","filters","list","menu","search"],function(t,i){f[i]=n(".mapp-"+i,f.layout)}),!f.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);u=new google.maps.Map(f.canvas.get(0),{mapTypeId:"roadmap",zoom:1});var t=_.extend({backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query},this.mapOpts);t.minZoom=isNaN(parseInt(t.minZoom))?0:parseInt(t.minZoom);u.setOptions(t);p();w();b();v(this.mapTypeId,!0);this.toggleView("mini",f.layout.width()<450);this.places=new mapp.Places(n(".mapp-places",f.search),{map:e});e.editable||google.maps.event.addListener(this.places,"search",function(n){e.search(n)});f.layout.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action");t.preventDefault();e.action(i,n(this).attr("data-mapp-"+i),n(this))});f.filters.on("change",function(){e.ajaxQuery(u.getBounds())});a("click drag",function(){e.closeInfoWindow()});n("body").on("click",function(t){var i=n(t.target),r=i.attr("data-mapp-action");i==f.filters||r=="filters-toggle"||i.closest(f.filters).length||e.toggleView("filters",!1);i==f.menu||r=="menu-toggle"||i.closest(f.menu).length||e.toggleView("menu",!1)});n(window).resize(function(){e.resize()});this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow;google.maps.event.addListenerOnce(u,"idle",function(){var n=o.length?o[0]:null;e.initialOpenDirections?e.openDirections(null,n):n&&e.initialOpenInfo&&n.open()});mappl10n.options.search&&google.maps.event.addListenerOnce(u,"tilesloaded",function(){google.maps.event.addListenerOnce(u,"idle",function(){a("dragend zoom_changed",function(){e.ajaxQuery(u.getBounds())})})});this.query||this.setPois(this.pois);typeof this.center=="string"?this.places.parse(this.center):this.query?this.ajaxQuery():this.recenter()};this.load=function(n){_.extend(this,this.defaults,n,this.settings);v(this.mapTypeId,!0);this.toggleView("menu",!1);l();this.closeInfoWindow();this.setPois(this.pois);this.places.set("");google.maps.event.trigger(this,"load")};this.action=function(t,i,r){switch(t){case"center":this.toggleView("menu",!1);this.closeInfoWindow();this.recenter();break;case"dir":this.openDirections(null,this.poi);break;case"dir-from":this.openDirections(this.poi,null);break;case"filters-reset":f.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(u.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){e.search(n)});break;case"layer":l(i);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var s=r.attr("data-mapp-poi");this.openInfoWindow(o[s]);break;case"show":f.layout.show();this.resize();this.initCenter();break;case"view-map":this.toggleView("list",!1);break;case"view-list":this.toggleView("list",!0);break;case"viewport-set":this.center=u.getCenter().toJSON();this.zoom=u.getZoom();this.toggleView("menu",!1);break;case"viewport-reset":this.center=null;this.zoom=null;this.toggleView("menu",!1);this.recenter();break;default:return!0}};this.search=function(n){var t=n.geometry.location?n.geometry.location:null,i=n.geometry.viewport?n.geometry.viewport:null,r=new google.maps.Circle({center:t,radius:mappl10n.options.radius*1e3}),f=i?i.union(r.getBounds()):r.getBounds();u.fitBounds(f,0);u.setCenter(t);this.query&&this.ajaxQuery(f)};this.dialog=function(t,i){t?(f.canvas.append("<div class='mapp-dialog'>"+t+"<\/div>"),i&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){e.dialog(null)},3e3))):n(".mapp-dialog",f.canvas).remove()};this.closeInfoWindow=function(){this.iw.close();this.poiSelect(null)};this.openDirections=function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";h||(h=new mapp.Directions(f.directions,e));h.open(i,r)};this.poiSelect=function(t){if(n("[data-mapp-poi]",f.list).removeClass("mapp-selected"),t){var r=n.inArray(t,o),i=n('[data-mapp-poi="'+r+'"]',f.list);i.addClass("mapp-selected");mapp.lib.scrollTo(f.list,i);t.setZIndex(++c)}this.poi=t};this.getMap=function(){return u};this.renderList=function(){this.editable&&(f.list.html(mapp.lib.template("poi-list",{pois:o})),google.maps.event.trigger(this,"render-list"))};this.getPois=function(){return o};this.addPoi=function(n){o.unshift(n);n.setMap(this);e.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,o);i!=-1&&(o[i].setMap(null),o.splice(i,1),e.renderList())};this.resetPois=function(){for(i=0;i<o.length;i++)o[i].setMap(null);o=[];c=google.maps.Marker.MAX_ZINDEX};this.setPois=function(n){var t,i;if(this.resetPois(),n){for(t=0;t<n.length;t++)i=new mapp.Poi(n[t]),o.push(i),i.setMap(this),i.setZIndex(c+n.length-1-t);c+=n.length-1}this.renderList()};this.sortPois=function(n){for(var r,t=Array(),i=0;i<n.length;i++){if(r=parseInt(n[i]),isNaN(r))return!1;t.push(o[r])}if(t.length!=o.length)return!1;o=t;this.renderList()};this.openInfoWindow=function(n,t){if(h&&h.close(),this.iw.close(),this.poiSelect(n),mappl10n.options.mashupClick!="poi"&&n.postid&&n.url){window.open(n.url);return}this.toggleView("list",!1);this.editable||this.iw.setContent(n.html);google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(e,"poidomready",n)});google.maps.event.trigger(e,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(u,i)};this.togglePois=function(n){n=!!n;for(var t=0;t<o.length;t++)o[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!f.layout.hasClass("mapp-view-"+n):t;f.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&y();n=="directions"&&this.resize()};this.resize=function(){var n=u.getCenter();this.toggleView("mini",f.layout.width()<450);google.maps.event.trigger(u,"resize");u.setCenter(n)};this.recenter=function(){var i=!this.query&&this.center&&this.center.lat&&this.center.lng?new google.maps.LatLng(this.center.lat,this.center.lng):null,n=!this.query&&this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,t,r;if(this.center&&this.center.lat==0&&this.center.lng==0&&(i=null),i){u.setCenter(i);u.setZoom(n?n:1);return}if(o.length==0){u.setCenter(new google.maps.LatLng(0,0));u.setZoom(n?n:1);return}if(o.length==1){o[0].center(n);return}for(bounds=new google.maps.LatLngBounds,t=0;t<o.length;t++)r=o[t].getBounds(),bounds=r?bounds.union(r):bounds.extend(o[t].getPosition());u.fitBounds(bounds,0)};this.toJSON=function(){var n;for(this.pois=[],n=0;n<o.length;n++)this.pois.push(o[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:u.getMapTypeId(),metaKey:this.metaKey,pois:this.pois,title:this.title,width:this.width,zoom:this.zoom}};this.ajaxSave=function(n){var t=JSON.stringify(this),i=!this.mapid||!this.postid?mappl10n.options.postid:this.postid;mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:t,postid:i},callback:function(t){t.status=="OK"&&(e.mapid=t.data.mapid,n(t.data),google.maps.event.trigger(e,"save"))}})}};mapp.Map.ajaxCreate=function(n,t){mapp.lib.ajax({type:"GET",data:{action:"mapp_create"},callback:function(i){if(i.status=="OK"){var r=new mapp.Map(i.data.map,n);t(r)}}})};mapp.Map.ajaxGet=function(n,t,i){mapp.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:n},callback:function(n){if(n.status=="OK"){var r=new mapp.Map(n.data.map,t);i(r)}}})};mapp.Map.ajaxDelete=function(n,t){mapp.lib.ajax({type:"POST",data:{action:"mapp_delete",mapid:n},callback:function(n){n.status=="OK"&&t&&t()}})}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Directions=function(t,i){this.sel=n(t);this.map=i;this.directionsRenderer=null;this.directionsService=null;this.placesService=null;var r=this;this.sel.on("keydown",function(n){n.which==13?(r.getDirections(),n.preventDefault()):n.which==27&&r.close()});this.sel.on("click","[data-mapp-action]",function(t){var f=n(this).attr("data-mapp-action"),i=n(".mapp-dir-daddr",r.sel).val(),u=n(".mapp-dir-saddr",r.sel).val();t.preventDefault();switch(f){case"dir-cancel":r.close();break;case"dir-get":r.getDirections();break;case"dir-google":r.openGoogle(u,i);r.close();break;case"dir-myloc":r.map.places.geolocate(function(t){n(".mapp-dir-saddr",r.sel).val(t.name);r.getDirections()});break;case"dir-swap":n(".mapp-dir-saddr",r.sel).val(i);n(".mapp-dir-daddr",r.sel).val(u);r.getDirections()}});this.open=function(t,i){if(mappl10n.options.directions=="google"){this.openGoogle(t,i);return}this.map.toggleView("directions",!0);n(".mapp-dir-addr",this.sel).removeClass("mapp-error");n(".mapp-dir-saddr",this.sel).val(t);n(".mapp-dir-daddr",this.sel).val(i);n(".mapp-dir-get",this.sel).focus();n(".mapp-dir-saddr",this.sel).focus()};this.close=function(){this.map.toggleView("directions",!1);this.directionsRenderer&&(this.directionsRenderer.setPanel(null),this.directionsRenderer.getMap()&&(this.directionsRenderer.setMap(null),this.map.togglePois(!0)))};this.getDirections=function(){var t;this.map.closeInfoWindow();n(".mapp-spinner",this.sel).css("visibility","visible");this.directionsService=this.directionsService?this.directionsService:new google.maps.DirectionsService;this.directionsRenderer=this.directionsRenderer?this.directionsRenderer:new google.maps.DirectionsRenderer({hideRouteList:!1,draggable:!0});this.placesService=this.placesService?this.placesService:new google.maps.places.PlacesService(this.map.getMap());n(".mapp-dir-renderer",this.sel).empty();t={travelMode:google.maps.DirectionsTravelMode.DRIVING,provideRouteAlternatives:!0,origin:n(".mapp-dir-saddr",this.sel).val(),destination:n(".mapp-dir-daddr",this.sel).val()};this.directionsService.route(t,function(t,i){(n(".mapp-spinner",r.sel).css("visibility","hidden"),n(".mapp-dir-addr",r.sel).removeClass("mapp-error"),n.each(t.geocoded_waypoints,function(t,i){n(".mapp-dir-addr",r.sel).eq(t).toggleClass("mapp-error",i.geocoder_status!="OK");i.place_id&&r.placesService.getDetails({placeId:i.place_id},function(i,u){if(u=="OK"){var f=i.formatted_address.replace(", USA","");f.indexOf(i.name)===-1&&(f=i.name+", "+f);n(".mapp-dir-addr",r.sel).eq(t).val(f)}})}),n(".mapp-dir-addr.mapp-error").length)||(i==google.maps.DirectionsStatus.OK?(r.map.togglePois(!1),r.directionsRenderer.setOptions({directions:t,map:r.map.getMap(),panel:n(".mapp-dir-renderer",r.sel).get(0)})):alert(mappl10n.dir_error+i))})};this.openGoogle=function(n,t){var i=mappl10n.options.directionsServer;i.toLowerCase().indexOf("http")==-1&&(i="https://"+i);i+="?saddr="+encodeURIComponent(n);i+="&daddr="+encodeURIComponent(t);window.open(i)}}}(jQuery);mapp=window.mapp||{};mapp.Geocoder=function(n){function r(n,t){jQuery(n).removeClass("mapp-error");jQuery(t).hide()}function u(n,t,i){jQuery(n).addClass("mapp-error");jQuery(t).html(i);jQuery(t).show()}var t,f,i=this;f=n;this.geocode=function(i,r){typeof i=="string"&&i.substring(0,1)=="("&&(split=i.replace(/\(|\)/g,"").split(","),i=new google.maps.LatLng(split[0],split[1]));var u=i instanceof google.maps.LatLng?{location:i}:{address:i,region:mappl10n.options.country,bounds:n.getBounds()};t||(t=new google.maps.Geocoder);t.geocode(u,function(n,t){if(n){for(var i=0;i<n.length;i++)n[i].formatted_address==""&&n.splice(i,1);r(n[0],t)}else r(null,t)})};this.geolocate=function(n){if(!navigator||!navigator.geolocation)return null;navigator.geolocation.getCurrentPosition(function(t){n(t)},function(){n(null)},{timeout:1e4,enableHighAccuracy:!0,maximumAge:3e4})};this.stringToLatLng=function(n){var t=n.split(",",2),i=Number(t[0]),r=Number(t[1]);return isNaN(i)||isNaN(r)?!1:new google.maps.LatLng(i,r)};this.geocodeField=function(n,t,i){r(n,t);checkAddress(n,t,jQuery(n).val(),function(r){if(!r){u(n,t,mappl10n.no_address);i(null);return}if(r&&r.formatted_address){jQuery(n).val(r.formatted_address);i(r.formatted_address);return}i(r);return})};this.autocompleteField=function(n,t,f,e,o){jQuery(n).keypress(function(i){i.which==13&&(checkAddress(n,t,jQuery(n).val(),o),i.preventDefault())});jQuery(f).click(function(){return checkAddress(n,t,jQuery(n).val(),o),!1});jQuery(e).click(function(){return r(n,t),i.geolocate(function(i){if(i){var r="("+i.coords.latitude+", "+i.coords.longitude+")";jQuery(n).val("");checkAddress(n,t,r,o)}else u(n,t,mappl10n.no_geolocate);return}),!1})};checkAddress=function(n,t,f,e){if(r(n,t),f=jQuery.trim(f),f==""){e(null);return}var o=i.stringToLatLng(f);if(o){e(o);return}if(f.substring(0,4)=="http"){e(f);return}i.geocode(f,function(i,r){if(!i||r!=google.maps.GeocoderStatus.OK){u(n,t,mappl10n.no_address);e(null);return}e(i);return})}};mapp.Geocoder.parseAddress=function(n){return!n||n==""?{firstLine:"",secondLine:""}:(n.lastIndexOf(", USA")>0||n.lastIndexOf(", United States")>0)&&(n.lastIndexOf(", USA")>0&&(n=n.slice(0,n.lastIndexOf(", USA"))),n.lastIndexOf(", United States")>0&&(n=n.slice(0,n.lastIndexOf(", United States"))),n.indexOf(",")==n.lastIndexOf(","))?{firstLine:n,secondLine:""}:n.indexOf(",")==-1?{firstLine:n,secondLine:""}:{firstLine:n.slice(0,n.indexOf(",")),secondLine:n.slice(n.indexOf(", ")+2)}};mapp=window.mapp||{};mapp.Icons={};mapp.Icons.get=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};mapp.Icons.getUrl=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};mapp=window.mapp||{};+function(n){mapp.InfoBox=function(t,i){var f=n.extend({border:20,disableAutoPan:!1},i),u=null,r=null,e=null,o=this;r=n('<div class="mapp-ib" tabindex="0">').appendTo(t.getMap().getDiv());e=n('<div class="mapp-ib-tip">').appendTo(t.getMap().getDiv());jQuery(window).resize(function(){o.close()});r.on("keydown",function(n){n.which==27&&o.close()});r.on("click",".mapp-close",function(){o.close()});this.getContent=function(){return r};this.setContent=function(n){r.empty().append(n)};this.open=function(n,t){u=t;this.setMap(n)};this.onAdd=function(){r.show();e.show();var t=n(":input",r);t.length?t.first().focus():r.focus();google.maps.event.trigger(o,"domready")};this.draw=function(){var l=this.getMap(),c=this.getProjection().fromLatLngToContainerPixel(u.position),t={width:n(l.getDiv()).width(),height:n(l.getDiv()).height()},v=n(".mapp-ib-body",r);if(!f.disableAutoPan){r.css({"max-height":"9999px",left:0,bottom:0,top:"auto",right:"auto"});var s=r.outerWidth(!0),h=r.outerHeight(!0),a=e.outerHeight(!0),i=c.x,o=c.y;i+s/2>t.width&&(i=t.width-s/2);i-s/2<0&&(i=s/2);o-h+u.anchorPoint.y-a<f.border&&(o=h-u.anchorPoint.y+f.border+a);o>t.height&&(o=t.height);l.panBy(c.x-i,c.y-o);h>t.height+u.anchorPoint.y-2*f.border&&(h=t.height+u.anchorPoint.y-2*f.border,r.css({"max-height":h+2}));r.css({left:i-s/2,bottom:t.height-o-u.anchorPoint.y+a});e.css({left:i,bottom:t.height-o-u.anchorPoint.y})}};this.close=function(){r.is(":visible")&&(this.setMap(null),google.maps.event.trigger(this,"closed"))};this.onRemove=function(){r.empty();r.hide();e.hide()}};mapp.InfoBox.prototype=new google.maps.OverlayView}(jQuery);mapp=window.mapp||{};+function(n){if(mapp.lib={ajax:function(t){var r=this,u,i;if(n.extend({type:"GET",cache:!1,data:null,spinner:null,callback:n.noop},t),t.cache)for(typeof mapp.lib.ajax.cache=="undefined"&&(mapp.lib.ajax.cache=[]),u=JSON.stringify(t.data),i=0;i<mapp.lib.ajax.cache.length;i++)if(mapp.lib.ajax.cache[i].hash==u){t.callback(mapp.lib.ajax.cache[i].response);return}return t.spinner&&t.spinner.show(),n.ajax({type:t.type,cache:!1,url:mappl10n.options.ajaxurl,data:t.data,success:function(n,i,u){if(t.spinner&&t.spinner.hide(),n.output){r.alert("AJAX Error\r\n"+n.output);return}if(n.status=="OK"){t.cache&&mapp.lib.ajax.cache.push({hash:JSON.stringify(t.data),response:n});t.callback&&t.callback(n,u);return}var f=typeof n=="object"?n.status:n;r.alert("AJAX ERROR\r\nResponse="+f+" TextStatus="+i+"\r\nResponseText="+u.responseText)},error:function(n,i,u){(t.spinner&&t.spinner.hide(),i!="cancel")&&typeof u!="undefined"&&u!=""&&r.alert("AJAX ERROR\r\nTextStatus="+i+"\r\nError="+u+"\r\nResponseText="+n.responseText)}})},alert:function(n){mappl10n.options.admin||mappl10n.options.debug?alert(n):window.console&&console.error(n)},fullscreen:function(n){var u=document.documentElement,i={requestFullscreen:"onfullscreenchange",webkitRequestFullscreen:"onwebkitfullscreenchange",mozRequestFullScreen:"onmozfullscreenchange",msRequestFullscreen:"onmsfullscreenchange"},t,r;for(t in i)u[t]&&(r=i[t],document[r]=n)},jqVersionCheck:function(t){if(typeof n=="undefined"||typeof t=="undefined")return!1;for(t=t.split("."),v=n.fn.jquery.split("."),i=0;i<t.length;i++){var r=parseInt(t[i]),u=typeof v[i]!="undefined"?parseInt(v[i]):0;if(u!=r)return u>r}return!0},log:function(n){window.console&&console.error(n)},scrollTo:function(n,t){if(n&&t&&n.length&&t.length){var i=n.scrollTop(),u=n.height(),r=i+t.position().top,f=r+t.outerHeight(!0);r<i?n.scrollTop(r):f>i+u&&n.scrollTop(f-u)}},template:function(t,i){if(mapp.lib.templates=mapp.lib.templates?mapp.lib.templates:{},!mapp.lib.templates[t]){var r=mappl10n.options.templates?mappl10n.options.template[t]:n("#mapp-tmpl-"+t).html();if(r)mapp.lib.templates[t]=_.template(r.replace(/[\n\r\t]/g,""),null,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});else return""}return mapp.lib.templates[t](i)}},typeof google=="undefined")return mapp.lib.alert("ERROR: Google Maps API not loaded");if(!mappl10n.options.apiKey)return mapp.lib.alert("ERROR: Google Maps API Key missing, please check MapPress settings and FAQ");n(document).ready(function(){n('script[src*="https://maps.googleapis.com/maps/api/js?v=3"]').length>1&&mapp.lib.alert("ERROR: Google Maps API key loaded multiple times, please see MapPress FAQ.")});mapp.lib.jqVersionCheck("1.7")||mapp.lib.alert("jQuery version is too old: "+n.fn.jquery);n("body").on("tabsactivate tabsshow",function(t,i){var r=i.newPanel?i.newPanel:i.panel;r&&n(".mapp-layout",r).each(function(){var i=n(this).attr("id"),t=window[i];t.resize();t.initCenter()})})}(jQuery);mapp=window.mapp||{};+function(n){mapp.Places=function(t,i){var u=this,r;if(this.sel=n(t),this.opts=n.extend({map:null,types:[]},i),r=n('<div style="display:none">').appendTo("body"),this.placesService=new google.maps.places.PlacesService(r.get(0)),this.autocompleteService=new google.maps.places.AutocompleteService,this.sel.length){this.autocomplete=new google.maps.places.Autocomplete(this.sel.get(0),{types:this.opts.types});this.autocomplete.bindTo("bounds",this.opts.map.getMap());this.sel.on("keydown",function(n){n.which==13&&n.preventDefault()});google.maps.event.addListener(this.autocomplete,"place_changed",function(){u.parse(this.getPlace())})}};mapp.Places.prototype={parse:function(t){var u,i=this,r,e,f;if(this.error(!1),r=t&&t.name?n.trim(t.name):n.trim(t),!r)return this.error(!0);if(r=="user"){this.geolocate(function(n){google.maps.event.trigger(i,"search",n)});return}if(r.substring(0,4)=="http"){google.maps.event.trigger(i,"search",r);return}if(t&&t.geometry){t.formatted_address&&this.set(t.formatted_address);google.maps.event.trigger(i,"search",t);return}if(e=this.parseLatLng(t),e){google.maps.event.trigger(i,"search",e);return}f=this.opts.map.getMap().getBounds();f=f?f:new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180));this.autocompleteService.getPlacePredictions({input:r,types:this.opts.types,bounds:f},function(n,t){if(t!="OK"||n==null||n.length==0)return i.error(!0);u=typeof n[0].description!="undefined"?n[0].description:null;i.placesService.getDetails({placeId:n[0].place_id},function(n,t){if(t!="OK"||!n||!n.geometry)return i.error(!0);u=u?u:n.formatted_address;i.set(u);google.maps.event.trigger(i,"search",n)})})},parseLatLng:function(t){var i,u,r;return t instanceof google.maps.LatLng?i=t:t&&t.lat&&t.lng?i=new google.maps.LatLng(t.lat,t.lng):(u=t&&t.name?n.trim(t.name):n.trim(t),r=u.split(","),r.length!=2||isNaN(r[0])||isNaN(r[1])||(i=new google.maps.LatLng(r[0],r[1]))),i?{name:i.toUrlValue(),geometry:{location:i}}:null},geolocate:function(n){var t=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(i){t.set("");var r=new google.maps.LatLng(i.coords.latitude,i.coords.longitude);n({name:r.toUrlValue(),geometry:{location:r}})},function(n){var t=n&&n.message?" : "+n.message:"";alert(mappl10n.no_geolocate+t)},{timeout:15e3,enableHighAccuracy:!0,maximumAge:3e4})},set:function(n){n=n.replace(", United States of America","").replace(", USA","").replace(", United States","");this.sel.val(n);this.error(!1)},get:function(){return n.trim(this.sel.val())},focus:function(){this.sel.focus()},error:function(n){this.sel.toggleClass("mapp-error",!!n)},destroy:function(){this.autocomplete.unbindAll();google.maps.event.clearInstanceListeners(this.sel.get(0))}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(t){var f,e,r,s,i,u,h,o;if(this.defaults={address:null,body:null,html:null,iconid:null,kml:null,map:null,overlay:null,postid:null,title:"",url:null,type:null,viewport:null},n.extend(this,this.defaults,t),t&&t.correctedAddress&&(this.address=t.correctedAddress),t.viewport&&t.viewport.sw&&t.viewport.ne&&(f=new google.maps.LatLng(t.viewport.sw.lat,t.viewport.sw.lng),e=new google.maps.LatLng(t.viewport.ne.lat,t.viewport.ne.lng),this.viewport=f.lat()==0&&f.lng()==0&&e.lat()==0&&e.lng()==0?null:new google.maps.LatLngBounds(f,e)),r=[],s=[],!t.overlay)switch(this.type){case"polygon":if(t.poly&&t.poly.paths)for(i=0;i<t.poly.paths.length;i++){for(r=[],u=0;u<t.poly.paths[i].length;u++)r.push(new google.maps.LatLng(t.poly.paths[i][u].lat,t.poly.paths[i][u].lng));s.push(new google.maps.MVCArray(r))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(s)});this.setColors(t.poly);break;case"polyline":if(t.poly&&t.poly.path)for(i=0;i<t.poly.path.length;i++)r.push(new google.maps.LatLng(t.poly.path[i].lat,t.poly.path[i].lng));this.overlay=new google.maps.Polyline({path:new google.maps.MVCArray(r)});this.setColors(t.poly);break;case"circle":o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Circle({center:o,radius:parseFloat(t.poly.radius)});this.setColors(t.poly);break;case"rectangle":this.overlay=new google.maps.Rectangle({bounds:this.viewport});this.setColors(t.poly);break;case"kml":h=t.kml&&t.kml.url?t.kml.url:"";this.overlay=new google.maps.KmlLayer(h,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Marker({position:o})}};mapp.Poi.prototype={toJSON:function(){var n={address:this.address,body:this.body,correctedAddress:this.address,iconid:this.iconid,point:null,poly:null,title:this.title,type:this.type,viewport:null},r=this.getPosition(),t,i;if(n.point={lat:r.lat(),lng:r.lng()},t=this.viewport?this.viewport:this.getBounds(),t&&(n.viewport={sw:{lat:t.getSouthWest().lat(),lng:t.getSouthWest().lng()},ne:{lat:t.getNorthEast().lat(),lng:t.getNorthEast().lng()}}),this.type=="kml"&&(n.kml={url:this.overlay.getUrl()}),this.isPoly()){n.poly=this.getColors();switch(this.type){case"circle":n.poly.radius=this.overlay.getRadius();break;case"polyline":n.poly.path=[];this.overlay.getPath().forEach(function(t){n.poly.path.push({lat:t.lat(),lng:t.lng()})});break;case"polygon":n.poly.paths=[];this.overlay.getPaths().forEach(function(t){var i=[];t.forEach(function(n){i.push({lat:n.lat(),lng:n.lng()})});n.poly.paths.push(i)});break;case"rectangle":i=this.overlay.getBounds();n.viewport={sw:{lat:i.getSouthWest().lat(),lng:i.getSouthWest().lng()},ne:{lat:i.getNorthEast().lat(),lng:i.getNorthEast().lng()}}}}return n},setMap:function(t){var i=this;if(google.maps.event.clearInstanceListeners(this.overlay),t==null){this.overlay.setMap(null);return}this.type=="kml"&&(google.maps.event.addListener(this.overlay,"defaultviewport_changed",function(){i.viewport=i.overlay.getDefaultViewport()}),google.maps.event.addListener(this.overlay,"status_changed",function(){var n=i.overlay.getStatus();n!="OK"&&mappl10n.ajaxErrors&&alert(mappl10n.kml_error+":"+n)}));this.map=t;this.overlay.setMap(t.getMap());this.setEditable(this.map.editable);this.setIcon(this.iconid);this.type||this.overlay.setTitle(n("<div>").html(this.title).text());google.maps.event.addListener(this.overlay,"click",function(n){i.open(n)})},setEditable:function(n){var t=this;this.type!="kml"&&(this.overlay.setDraggable(n),this.isPoly()&&this.overlay.setEditable(n),google.maps.event.clearListeners(this.overlay,"rightclick"),google.maps.event.clearListeners(this.overlay,"dragstart"),n&&(google.maps.event.addListener(this.overlay,"dragstart",function(){t.viewport=null;t.map.closeInfoWindow()}),(this.type=="polygon"||this.type=="polyline")&&google.maps.event.addListener(this.overlay,"rightclick",function(n){n.vertex!=null&&t.overlay.getPath().getLength()>2&&t.overlay.getPath().removeAt(n.vertex)})))},setZIndex:function(n){this.overlay.set("zIndex",n)},select:function(){},setIcon:function(n){this.type||typeof mapp.Icons=="undefined"||(this.overlay.setIcon(null),this.overlay.setIcon(mapp.Icons.get(n)),this.iconid=n)},setVisible:function(n){typeof this.overlay.setVisible!="undefined"&&this.overlay.setVisible(n)},setColors:function(n){var i={};for(var t in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})n&&typeof n[t]!="undefined"&&(i[t]=n[t]);this.overlay.setOptions(i)},getColors:function(){var t={};for(var n in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})typeof this.overlay[n]!="undefined"&&(t[n]=this.overlay[n]);return t},center:function(t){var i=this.map.getMap(),u=this.getBounds(),r,t;if(typeof t=="number"){i.setCenter(this.getPosition());i.setZoom(t);return}if(!u){i.setCenter(this.getPosition());i.setZoom(parseInt(mappl10n.options.poiZoom));return}r=u.getNorthEast().lng()-u.getSouthWest().lng();r<0&&(r+=360);t=Math.round(Math.log(n(i.getDiv()).width()*360/r/256)/Math.LN2);i.setCenter(this.getPosition());i.setZoom(t)},open:function(n){this.map.openInfoWindow(this,n)},isPoly:function(){return jQuery.inArray(this.type,["polyline","polygon","circle","rectangle"])!=-1},getBounds:function(){var n;switch(this.type){case"polyline":n=new google.maps.LatLngBounds;this.overlay.getPath().forEach(function(t){n.extend(t)});break;case"polygon":n=new google.maps.LatLngBounds;this.overlay.getPaths().forEach(function(t){t.forEach(function(t){n.extend(t)})});break;case"rectangle":case"circle":n=this.overlay.getBounds();break;case"kml":n=this.overlay.getDefaultViewport();n=n?n:this.viewport;break;default:return this.viewport}return n},getPosition:function(n){if(!this.type)return this.overlay.getPosition();if(this.type=="kml"&&n&&n.latLng)return n.latLng;var t=this.getBounds();return t?t.getCenter():new google.maps.LatLng(0,0)},click:function(){google.maps.event.trigger(this.overlay,"click")},getAddress:function(){return this.address?this.address:this.type=="kml"?this.kml.url:this.getPosition().toUrlValue()},getAnchorPoint:function(n){return this.type=="kml"?n&&n.pixelOffset?new google.maps.Point(n.pixelOffset.width,n.pixelOffset.height):new google.maps.Point(0,0):this.type?new google.maps.Point(0,0):typeof this.overlay.anchorPoint!="undefined"?this.overlay.anchorPoint:new google.maps.Point(0,-32)}}}(jQuery);mapp=window.mapp||{};mapp.widgets={};+function(n){mapp.widgets.Grid=function(t,i){this.el=n(t);this.options=jQuery.extend({action:null,sortable:!1},i);var r=this;this.table=n("table",this.el);this.template=n("script",this.el).html().replace(new RegExp("'","g"),'"');this.el.on("click",function(t){var u=n(t.target),i=u.attr("data-mapp-action");i&&(r[i](t),t.preventDefault())})};mapp.widgets.Grid.prototype={add:function(){this.table.show();var t=n(this.template).appendTo(this.table);n(":input:eq(0)",t).focus()},remove:function(t){var i=n(t.target).closest("tr").remove();n("tbody > tr",this.table).length||this.table.hide()}}}(jQuery);+function(n){mapp.widgets.Popup=function(t,i){this.options=n.extend({destroy:!1,fullscreen:!1,modal:!1,position:null,toggle:null},i);this.activeToggle=null;var r=this;this.el=n('<div class="mapp-popup" tabindex="-1">').appendTo("body").hide();this.setContent(t);this.el.on("focusout",function(t){n.contains(r.el.get(0),t.relatedTarget)||r.el.get(0)==t.relatedTarget||r.close()});if(this.options.toggle)n(document).on("click",this.options.toggle,function(t){r.activeToggle=n(this);r.open();t.stopPropagation()});this.el.on("click",".mapp-close",function(){r.close()});this.el.on("keydown",function(n){n.which==27&&r.close()});return this};mapp.widgets.Popup.prototype={close:function(){this.el.is(":visible")&&(this.backdrop&&this.backdrop.remove(),n("body").removeClass("mapp-popup-open"),this.el.hide(),this.activeToggle.focus(),this.el.trigger("closed.mapp.popup"))},destroy:function(){this.el.remove();n(document).off("click.mapp.popup",function(){me.close()})},open:function(){var i=this,t;n(document).trigger("click.mapp.popup");this.el.trigger("open.mapp.popup");this.el.show();this.options.modal||this.el.position(n.extend({my:"center bottom",at:"center top-5",of:this.activeToggle,collision:"flipfit"},this.options.position));t=n(":input",this.el);t.length?t.first().focus():this.el.focus();this.options.modal&&(this.backdrop=n('<div class="mapp-backdrop"><\/div>'),this.el.after(this.backdrop),n("body").addClass("mapp-popup-open"))},setContent:function(n){this.el.empty();this.el.append('<span class="mapp-close">');this.el.append(n)},toggle:function(){this.el.is(":visible")?this.close():this.open()}}}(jQuery);+function(){mapp.load=function(){if(typeof mapp!="undefined"&&mapp.data)while(mapp.data.length){var n=mapp.data.pop();window[n.name]=new mapp.Map(n);window[n.name].display()}}}(jQuery);typeof mapp.Media!="undefined"?window.mappEditor=new mapp.Media:mapp.load()
1
+ var mapp=window.mapp||{};+function(n){mapp.Map=function(t,r){function a(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(u,n[i],t)}function y(){var i,t;n("[data-mapp-type]",f.menu).removeClass("mapp-active");n('[data-mapp-type="'+u.getMapTypeId()+'"]',f.menu).addClass("mapp-active");for(layer in s)i=!!s[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',f.menu).toggleClass("mapp-active",i);t=!!(e.center&&e.zoom);n('[data-mapp-action="viewport-set"]',f.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',f.menu).toggle(t)}function p(){var n=mappl10n.options.styles,i=mappl10n.options.style,r=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&u.setOptions({styles:n[i]}),e.editable){for(t in n)u.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),r.push(t);u.setOptions({mapTypeControlOptions:{mapTypeIds:r,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[e.mapTypeId]!="undefined"&&u.setOptions({styles:n[e.mapTypeId]})}function w(){f.controls.children("[data-mapp-position]").each(function(){var t=n(this).attr("data-mapp-position"),i;t=t?google.maps.ControlPosition[t]:google.maps.ControlPosition.TOP_RIGHT;i=n(this);i.get(0).index=0;u.controls[t].push(i.get(0))})}function b(){var f,i,t,r;for(s={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},f=n.makeArray(e.layers),i=0;i<f.length;i++)t=n.trim(f[i]),r=t.split(".").pop(),s[t]?l(t):r=="kml"||r=="kmz"?s[t]=new google.maps.KmlLayer({map:u,preserveViewport:!0,url:t}):r=="json"&&(s[t]=new google.maps.Data({map:u}).loadGeoJson(t))}function l(t,i){n.each(["traffic","bicycling","transit"],function(n,t){s[t].setMap(null)});t&&(i=typeof i=="undefined"?s[t].getMap()==null:i,s[t].setMap(i?u:null))}function v(t,i){var r=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(u.getMapTypeId()==t);t=e.editable?i&&(r||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":r?t:"roadmap";u.setMapTypeId(t)}this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,mapOpts:null,name:null,pois:null,postid:null,query:null,title:null,width:null,zoom:null};this.iw=null;this.places=null;this.poi=null;this.settings=r?r:{};var e=this,h=null,f={},u=null,s={},o=[],c;_.extend(this,this.defaults,_.pick(t,_.keys(this.defaults)),_.pick(this.settings,_.keys(this.defaults)));this.display=function(){if(f.layout=n("#"+this.name),n.each(["canvas","controls","directions","filters","list","menu","search"],function(t,i){f[i]=n(".mapp-"+i,f.layout)}),!f.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);u=new google.maps.Map(f.canvas.get(0),{mapTypeId:"roadmap",zoom:1});var t=_.extend({backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query},this.mapOpts);t.minZoom=isNaN(parseInt(t.minZoom))?0:parseInt(t.minZoom);u.setOptions(t);p();w();b();v(this.mapTypeId,!0);this.toggleView("mini",f.layout.width()<450);this.places=new mapp.Places(n(".mapp-places",f.search),{map:e});e.editable||google.maps.event.addListener(this.places,"search",function(n){e.search(n)});f.layout.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action");t.preventDefault();e.action(i,n(this).attr("data-mapp-"+i),n(this))});f.filters.on("change",function(){e.ajaxQuery(u.getBounds())});a("click drag",function(){e.closeInfoWindow()});n("body").on("click",function(t){var i=n(t.target),r=i.attr("data-mapp-action");i==f.filters||r=="filters-toggle"||i.closest(f.filters).length||e.toggleView("filters",!1);i==f.menu||r=="menu-toggle"||i.closest(f.menu).length||e.toggleView("menu",!1)});n(window).resize(function(){e.resize()});this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow;google.maps.event.addListenerOnce(u,"idle",function(){var n=o.length?o[0]:null;e.initialOpenDirections?e.openDirections(null,n):n&&e.initialOpenInfo&&n.open()});mappl10n.options.search&&google.maps.event.addListenerOnce(u,"tilesloaded",function(){google.maps.event.addListenerOnce(u,"idle",function(){a("dragend zoom_changed",function(){e.ajaxQuery(u.getBounds())})})});this.query||this.setPois(this.pois);typeof this.center=="string"?this.places.parse(this.center):this.query?this.ajaxQuery():this.recenter()};this.load=function(n){_.extend(this,this.defaults,n,this.settings);v(this.mapTypeId,!0);this.toggleView("menu",!1);l();this.closeInfoWindow();this.setPois(this.pois);this.places.set("");google.maps.event.trigger(this,"load")};this.action=function(t,i,r){switch(t){case"center":this.toggleView("menu",!1);this.closeInfoWindow();this.recenter();break;case"dir":this.openDirections(null,this.poi);break;case"dir-from":this.openDirections(this.poi,null);break;case"filters-reset":f.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(u.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){e.search(n)});break;case"layer":l(i);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var s=r.attr("data-mapp-poi");this.openInfoWindow(o[s]);break;case"show":f.layout.show();this.resize();this.initCenter();break;case"view-map":this.toggleView("list",!1);break;case"view-list":this.toggleView("list",!0);break;case"viewport-set":this.center=u.getCenter().toJSON();this.zoom=u.getZoom();this.toggleView("menu",!1);break;case"viewport-reset":this.center=null;this.zoom=null;this.toggleView("menu",!1);this.recenter();break;default:return!0}};this.search=function(n){var t=n.geometry.location?n.geometry.location:null,i=n.geometry.viewport?n.geometry.viewport:null,r=new google.maps.Circle({center:t,radius:mappl10n.options.radius*1e3}),f=i?i.union(r.getBounds()):r.getBounds();u.fitBounds(f,0);u.setCenter(t);this.query&&this.ajaxQuery(f)};this.dialog=function(t,i){t?(f.canvas.append("<div class='mapp-dialog'>"+t+"<\/div>"),i&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){e.dialog(null)},3e3))):n(".mapp-dialog",f.canvas).remove()};this.closeInfoWindow=function(){this.iw.close();this.poiSelect(null)};this.openDirections=function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";h||(h=new mapp.Directions(f.directions,e));h.open(i,r)};this.poiSelect=function(t){if(n("[data-mapp-poi]",f.list).removeClass("mapp-selected"),t){var r=n.inArray(t,o),i=n('[data-mapp-poi="'+r+'"]',f.list);i.addClass("mapp-selected");mapp.lib.scrollTo(f.list,i);t.setZIndex(++c)}this.poi=t};this.getMap=function(){return u};this.renderList=function(){this.editable&&(f.list.html(mapp.lib.template("poi-list",{pois:o})),google.maps.event.trigger(this,"render-list"))};this.getPois=function(){return o};this.addPoi=function(n){o.unshift(n);n.setMap(this);e.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,o);i!=-1&&(o[i].setMap(null),o.splice(i,1),e.renderList())};this.resetPois=function(){for(i=0;i<o.length;i++)o[i].setMap(null);o=[];c=google.maps.Marker.MAX_ZINDEX};this.setPois=function(n){var t,i;if(this.resetPois(),n){for(t=0;t<n.length;t++)i=new mapp.Poi(n[t]),o.push(i),i.setMap(this),i.setZIndex(c+n.length-1-t);c+=n.length-1}this.renderList()};this.sortPois=function(n){for(var r,t=Array(),i=0;i<n.length;i++){if(r=parseInt(n[i]),isNaN(r))return!1;t.push(o[r])}if(t.length!=o.length)return!1;o=t;this.renderList()};this.openInfoWindow=function(n,t){if(h&&h.close(),this.iw.close(),this.poiSelect(n),mappl10n.options.mashupClick!="poi"&&n.postid&&n.url){window.open(n.url);return}this.toggleView("list",!1);this.editable||this.iw.setContent(n.html);google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(e,"poidomready",n)});google.maps.event.trigger(e,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(u,i)};this.togglePois=function(n){n=!!n;for(var t=0;t<o.length;t++)o[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!f.layout.hasClass("mapp-view-"+n):t;f.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&y();n=="directions"&&this.resize()};this.resize=function(){var n=u.getCenter();this.toggleView("mini",f.layout.width()<450);google.maps.event.trigger(u,"resize");u.setCenter(n)};this.recenter=function(){var i=!this.query&&this.center&&this.center.lat&&this.center.lng?new google.maps.LatLng(this.center.lat,this.center.lng):null,n=!this.query&&this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,t,r;if(this.center&&this.center.lat==0&&this.center.lng==0&&(i=null),i){u.setCenter(i);u.setZoom(n?n:1);return}if(o.length==0){u.setCenter(new google.maps.LatLng(0,0));u.setZoom(n?n:1);return}if(o.length==1){o[0].center(n);return}for(bounds=new google.maps.LatLngBounds,t=0;t<o.length;t++)r=o[t].getBounds(),bounds=r?bounds.union(r):bounds.extend(o[t].getPosition());u.fitBounds(bounds,0)};this.toJSON=function(){var n;for(this.pois=[],n=0;n<o.length;n++)this.pois.push(o[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:u.getMapTypeId(),metaKey:this.metaKey,pois:this.pois,title:this.title,width:this.width,zoom:this.zoom}};this.ajaxSave=function(n){var t=JSON.stringify(this),i=!this.mapid||!this.postid?mappl10n.options.postid:this.postid;mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:t,postid:i},callback:function(t){t.status=="OK"&&(e.mapid=t.data.mapid,n(t.data),google.maps.event.trigger(e,"save"))}})}};mapp.Map.ajaxCreate=function(n,t){mapp.lib.ajax({type:"GET",data:{action:"mapp_create"},callback:function(i){if(i.status=="OK"){var r=new mapp.Map(i.data.map,n);t(r)}}})};mapp.Map.ajaxGet=function(n,t,i){mapp.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:n},callback:function(n){if(n.status=="OK"){var r=new mapp.Map(n.data.map,t);i(r)}}})};mapp.Map.ajaxDelete=function(n,t){mapp.lib.ajax({type:"POST",data:{action:"mapp_delete",mapid:n},callback:function(n){n.status=="OK"&&t&&t()}})}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Directions=function(t,i){this.sel=n(t);this.map=i;this.directionsRenderer=null;this.directionsService=null;this.placesService=null;var r=this;this.sel.on("keydown",function(n){n.which==13?(r.getDirections(),n.preventDefault()):n.which==27&&r.close()});this.sel.on("click","[data-mapp-action]",function(t){var f=n(this).attr("data-mapp-action"),i=n(".mapp-dir-daddr",r.sel).val(),u=n(".mapp-dir-saddr",r.sel).val();t.preventDefault();switch(f){case"dir-cancel":r.close();break;case"dir-get":r.getDirections();break;case"dir-google":r.openGoogle(u,i);r.close();break;case"dir-myloc":r.map.places.geolocate(function(t){n(".mapp-dir-saddr",r.sel).val(t.name);r.getDirections()});break;case"dir-swap":n(".mapp-dir-saddr",r.sel).val(i);n(".mapp-dir-daddr",r.sel).val(u);r.getDirections()}});this.open=function(t,i){this.openGoogle(t,i);return};this.close=function(){this.map.toggleView("directions",!1);this.directionsRenderer&&(this.directionsRenderer.setPanel(null),this.directionsRenderer.getMap()&&(this.directionsRenderer.setMap(null),this.map.togglePois(!0)))};this.getDirections=function(){var t;this.map.closeInfoWindow();n(".mapp-spinner",this.sel).css("visibility","visible");this.directionsService=this.directionsService?this.directionsService:new google.maps.DirectionsService;this.directionsRenderer=this.directionsRenderer?this.directionsRenderer:new google.maps.DirectionsRenderer({hideRouteList:!1,draggable:!0});this.placesService=this.placesService?this.placesService:new google.maps.places.PlacesService(this.map.getMap());n(".mapp-dir-renderer",this.sel).empty();t={travelMode:google.maps.DirectionsTravelMode.DRIVING,provideRouteAlternatives:!0,origin:n(".mapp-dir-saddr",this.sel).val(),destination:n(".mapp-dir-daddr",this.sel).val()};this.directionsService.route(t,function(t,i){(n(".mapp-spinner",r.sel).css("visibility","hidden"),n(".mapp-dir-addr",r.sel).removeClass("mapp-error"),n.each(t.geocoded_waypoints,function(t,i){n(".mapp-dir-addr",r.sel).eq(t).toggleClass("mapp-error",i.geocoder_status!="OK");i.place_id&&r.placesService.getDetails({placeId:i.place_id},function(i,u){if(u=="OK"){var f=i.formatted_address.replace(", USA","");f.indexOf(i.name)===-1&&(f=i.name+", "+f);n(".mapp-dir-addr",r.sel).eq(t).val(f)}})}),n(".mapp-dir-addr.mapp-error").length)||(i==google.maps.DirectionsStatus.OK?(r.map.togglePois(!1),r.directionsRenderer.setOptions({directions:t,map:r.map.getMap(),panel:n(".mapp-dir-renderer",r.sel).get(0)})):alert(mappl10n.dir_error+i))})};this.openGoogle=function(n,t){var i=mappl10n.options.directionsServer;i.toLowerCase().indexOf("http")==-1&&(i="https://"+i);i+="?saddr="+encodeURIComponent(n);i+="&daddr="+encodeURIComponent(t);window.open(i)}}}(jQuery);mapp=window.mapp||{};mapp.Geocoder=function(n){function r(n,t){jQuery(n).removeClass("mapp-error");jQuery(t).hide()}function u(n,t,i){jQuery(n).addClass("mapp-error");jQuery(t).html(i);jQuery(t).show()}var t,f,i=this;f=n;this.geocode=function(i,r){typeof i=="string"&&i.substring(0,1)=="("&&(split=i.replace(/\(|\)/g,"").split(","),i=new google.maps.LatLng(split[0],split[1]));var u=i instanceof google.maps.LatLng?{location:i}:{address:i,region:mappl10n.options.country,bounds:n.getBounds()};t||(t=new google.maps.Geocoder);t.geocode(u,function(n,t){if(n){for(var i=0;i<n.length;i++)n[i].formatted_address==""&&n.splice(i,1);r(n[0],t)}else r(null,t)})};this.geolocate=function(n){if(!navigator||!navigator.geolocation)return null;navigator.geolocation.getCurrentPosition(function(t){n(t)},function(){n(null)},{timeout:1e4,enableHighAccuracy:!0,maximumAge:3e4})};this.stringToLatLng=function(n){var t=n.split(",",2),i=Number(t[0]),r=Number(t[1]);return isNaN(i)||isNaN(r)?!1:new google.maps.LatLng(i,r)};this.geocodeField=function(n,t,i){r(n,t);checkAddress(n,t,jQuery(n).val(),function(r){if(!r){u(n,t,mappl10n.no_address);i(null);return}if(r&&r.formatted_address){jQuery(n).val(r.formatted_address);i(r.formatted_address);return}i(r);return})};this.autocompleteField=function(n,t,f,e,o){jQuery(n).keypress(function(i){i.which==13&&(checkAddress(n,t,jQuery(n).val(),o),i.preventDefault())});jQuery(f).click(function(){return checkAddress(n,t,jQuery(n).val(),o),!1});jQuery(e).click(function(){return r(n,t),i.geolocate(function(i){if(i){var r="("+i.coords.latitude+", "+i.coords.longitude+")";jQuery(n).val("");checkAddress(n,t,r,o)}else u(n,t,mappl10n.no_geolocate);return}),!1})};checkAddress=function(n,t,f,e){if(r(n,t),f=jQuery.trim(f),f==""){e(null);return}var o=i.stringToLatLng(f);if(o){e(o);return}if(f.substring(0,4)=="http"){e(f);return}i.geocode(f,function(i,r){if(!i||r!=google.maps.GeocoderStatus.OK){u(n,t,mappl10n.no_address);e(null);return}e(i);return})}};mapp.Geocoder.parseAddress=function(n){return!n||n==""?{firstLine:"",secondLine:""}:(n.lastIndexOf(", USA")>0||n.lastIndexOf(", United States")>0)&&(n.lastIndexOf(", USA")>0&&(n=n.slice(0,n.lastIndexOf(", USA"))),n.lastIndexOf(", United States")>0&&(n=n.slice(0,n.lastIndexOf(", United States"))),n.indexOf(",")==n.lastIndexOf(","))?{firstLine:n,secondLine:""}:n.indexOf(",")==-1?{firstLine:n,secondLine:""}:{firstLine:n.slice(0,n.indexOf(",")),secondLine:n.slice(n.indexOf(", ")+2)}};mapp=window.mapp||{};mapp.Icons={};mapp.Icons.get=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};mapp.Icons.getUrl=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};mapp=window.mapp||{};+function(n){mapp.InfoBox=function(t,i){var f=n.extend({border:20,disableAutoPan:!1},i),u=null,r=null,e=null,o=this;r=n('<div class="mapp-ib" tabindex="0">').appendTo(t.getMap().getDiv());e=n('<div class="mapp-ib-tip">').appendTo(t.getMap().getDiv());jQuery(window).resize(function(){o.close()});r.on("keydown",function(n){n.which==27&&o.close()});r.on("click",".mapp-close",function(){o.close()});this.getContent=function(){return r};this.setContent=function(n){r.empty().append(n)};this.open=function(n,t){u=t;this.setMap(n)};this.onAdd=function(){r.show();e.show();var t=n(":input",r);t.length?t.first().focus():r.focus();google.maps.event.trigger(o,"domready")};this.draw=function(){var l=this.getMap(),c=this.getProjection().fromLatLngToContainerPixel(u.position),t={width:n(l.getDiv()).width(),height:n(l.getDiv()).height()},v=n(".mapp-ib-body",r);if(!f.disableAutoPan){r.css({"max-height":"9999px",left:0,bottom:0,top:"auto",right:"auto"});var s=r.outerWidth(!0),h=r.outerHeight(!0),a=e.outerHeight(!0),i=c.x,o=c.y;i+s/2>t.width&&(i=t.width-s/2);i-s/2<0&&(i=s/2);o-h+u.anchorPoint.y-a<f.border&&(o=h-u.anchorPoint.y+f.border+a);o>t.height&&(o=t.height);l.panBy(c.x-i,c.y-o);h>t.height+u.anchorPoint.y-2*f.border&&(h=t.height+u.anchorPoint.y-2*f.border,r.css({"max-height":h+2}));r.css({left:i-s/2,bottom:t.height-o-u.anchorPoint.y+a});e.css({left:i,bottom:t.height-o-u.anchorPoint.y})}};this.close=function(){r.is(":visible")&&(this.setMap(null),google.maps.event.trigger(this,"closed"))};this.onRemove=function(){r.empty();r.hide();e.hide()}};mapp.InfoBox.prototype=new google.maps.OverlayView}(jQuery);mapp=window.mapp||{};+function(n){if(mapp.lib={ajax:function(t){var r=this,u,i;if(n.extend({type:"GET",cache:!1,data:null,spinner:null,callback:n.noop},t),t.cache)for(typeof mapp.lib.ajax.cache=="undefined"&&(mapp.lib.ajax.cache=[]),u=JSON.stringify(t.data),i=0;i<mapp.lib.ajax.cache.length;i++)if(mapp.lib.ajax.cache[i].hash==u){t.callback(mapp.lib.ajax.cache[i].response);return}return t.spinner&&t.spinner.show(),n.ajax({type:t.type,cache:!1,url:mappl10n.options.ajaxurl,data:t.data,success:function(n,i,u){if(t.spinner&&t.spinner.hide(),n.output){r.alert("AJAX Error\r\n"+n.output);return}if(n.status=="OK"){t.cache&&mapp.lib.ajax.cache.push({hash:JSON.stringify(t.data),response:n});t.callback&&t.callback(n,u);return}var f=typeof n=="object"?n.status:n;r.alert("AJAX ERROR\r\nResponse="+f+" TextStatus="+i+"\r\nResponseText="+u.responseText)},error:function(n,i,u){(t.spinner&&t.spinner.hide(),i!="cancel")&&typeof u!="undefined"&&u!=""&&r.alert("AJAX ERROR\r\nTextStatus="+i+"\r\nError="+u+"\r\nResponseText="+n.responseText)}})},alert:function(n){mappl10n.options.admin||mappl10n.options.debug?alert(n):window.console&&console.error(n)},fullscreen:function(n){var u=document.documentElement,i={requestFullscreen:"onfullscreenchange",webkitRequestFullscreen:"onwebkitfullscreenchange",mozRequestFullScreen:"onmozfullscreenchange",msRequestFullscreen:"onmsfullscreenchange"},t,r;for(t in i)u[t]&&(r=i[t],document[r]=n)},jqVersionCheck:function(t){if(typeof n=="undefined"||typeof t=="undefined")return!1;for(t=t.split("."),v=n.fn.jquery.split("."),i=0;i<t.length;i++){var r=parseInt(t[i]),u=typeof v[i]!="undefined"?parseInt(v[i]):0;if(u!=r)return u>r}return!0},log:function(n){window.console&&console.error(n)},scrollTo:function(n,t){if(n&&t&&n.length&&t.length){var i=n.scrollTop(),u=n.height(),r=i+t.position().top,f=r+t.outerHeight(!0);r<i?n.scrollTop(r):f>i+u&&n.scrollTop(f-u)}},template:function(t,i){if(mapp.lib.templates=mapp.lib.templates?mapp.lib.templates:{},!mapp.lib.templates[t]){var r=mappl10n.options.templates?mappl10n.options.template[t]:n("#mapp-tmpl-"+t).html();if(r)mapp.lib.templates[t]=_.template(r.replace(/[\n\r\t]/g,""),null,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});else return""}return mapp.lib.templates[t](i)}},typeof google=="undefined")return mapp.lib.alert("ERROR: Google Maps API not loaded");if(!mappl10n.options.apiKey)return mapp.lib.alert("ERROR: Google Maps API Key missing, please check MapPress settings and FAQ");n(document).ready(function(){n('script[src*="https://maps.googleapis.com/maps/api/js?v=3"]').length>1&&mapp.lib.alert("ERROR: Google Maps API key loaded multiple times, please see MapPress FAQ.")});mapp.lib.jqVersionCheck("1.7")||mapp.lib.alert("jQuery version is too old: "+n.fn.jquery);n("body").on("tabsactivate tabsshow",function(t,i){var r=i.newPanel?i.newPanel:i.panel;r&&n(".mapp-layout",r).each(function(){var i=n(this).attr("id"),t=window[i];t.resize();t.initCenter()})})}(jQuery);mapp=window.mapp||{};+function(n){mapp.Places=function(t,i){var u=this,r;if(this.sel=n(t),this.opts=n.extend({map:null,types:[]},i),r=n('<div style="display:none">').appendTo("body"),this.placesService=new google.maps.places.PlacesService(r.get(0)),this.autocompleteService=new google.maps.places.AutocompleteService,this.sel.length){this.autocomplete=new google.maps.places.Autocomplete(this.sel.get(0),{types:this.opts.types});this.autocomplete.bindTo("bounds",this.opts.map.getMap());this.sel.on("keydown",function(n){n.which==13&&n.preventDefault()});google.maps.event.addListener(this.autocomplete,"place_changed",function(){u.parse(this.getPlace())})}};mapp.Places.prototype={parse:function(t){var u,i=this,r,e,f;if(this.error(!1),r=t&&t.name?n.trim(t.name):n.trim(t),!r)return this.error(!0);if(r=="user"){this.geolocate(function(n){google.maps.event.trigger(i,"search",n)});return}if(r.substring(0,4)=="http"){google.maps.event.trigger(i,"search",r);return}if(t&&t.geometry){t.formatted_address&&this.set(t.formatted_address);google.maps.event.trigger(i,"search",t);return}if(e=this.parseLatLng(t),e){google.maps.event.trigger(i,"search",e);return}f=this.opts.map.getMap().getBounds();f=f?f:new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180));this.autocompleteService.getPlacePredictions({input:r,types:this.opts.types,bounds:f},function(n,t){if(t!="OK"||n==null||n.length==0)return i.error(!0);u=typeof n[0].description!="undefined"?n[0].description:null;i.placesService.getDetails({placeId:n[0].place_id},function(n,t){if(t!="OK"||!n||!n.geometry)return i.error(!0);u=u?u:n.formatted_address;i.set(u);google.maps.event.trigger(i,"search",n)})})},parseLatLng:function(t){var i,u,r;return t instanceof google.maps.LatLng?i=t:t&&t.lat&&t.lng?i=new google.maps.LatLng(t.lat,t.lng):(u=t&&t.name?n.trim(t.name):n.trim(t),r=u.split(","),r.length!=2||isNaN(r[0])||isNaN(r[1])||(i=new google.maps.LatLng(r[0],r[1]))),i?{name:i.toUrlValue(),geometry:{location:i}}:null},geolocate:function(n){var t=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(i){t.set("");var r=new google.maps.LatLng(i.coords.latitude,i.coords.longitude);n({name:r.toUrlValue(),geometry:{location:r}})},function(n){var t=n&&n.message?" : "+n.message:"";alert(mappl10n.no_geolocate+t)},{timeout:15e3,enableHighAccuracy:!0,maximumAge:3e4})},set:function(n){n=n.replace(", United States of America","").replace(", USA","").replace(", United States","");this.sel.val(n);this.error(!1)},get:function(){return n.trim(this.sel.val())},focus:function(){this.sel.focus()},error:function(n){this.sel.toggleClass("mapp-error",!!n)},destroy:function(){this.autocomplete.unbindAll();google.maps.event.clearInstanceListeners(this.sel.get(0))}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(t){var f,e,r,s,i,u,h,o;if(this.defaults={address:null,body:null,html:null,iconid:null,kml:null,map:null,overlay:null,postid:null,title:"",url:null,type:null,viewport:null},n.extend(this,this.defaults,t),t&&t.correctedAddress&&(this.address=t.correctedAddress),t.viewport&&t.viewport.sw&&t.viewport.ne&&(f=new google.maps.LatLng(t.viewport.sw.lat,t.viewport.sw.lng),e=new google.maps.LatLng(t.viewport.ne.lat,t.viewport.ne.lng),this.viewport=f.lat()==0&&f.lng()==0&&e.lat()==0&&e.lng()==0?null:new google.maps.LatLngBounds(f,e)),r=[],s=[],!t.overlay)switch(this.type){case"polygon":if(t.poly&&t.poly.paths)for(i=0;i<t.poly.paths.length;i++){for(r=[],u=0;u<t.poly.paths[i].length;u++)r.push(new google.maps.LatLng(t.poly.paths[i][u].lat,t.poly.paths[i][u].lng));s.push(new google.maps.MVCArray(r))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(s)});this.setColors(t.poly);break;case"polyline":if(t.poly&&t.poly.path)for(i=0;i<t.poly.path.length;i++)r.push(new google.maps.LatLng(t.poly.path[i].lat,t.poly.path[i].lng));this.overlay=new google.maps.Polyline({path:new google.maps.MVCArray(r)});this.setColors(t.poly);break;case"circle":o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Circle({center:o,radius:parseFloat(t.poly.radius)});this.setColors(t.poly);break;case"rectangle":this.overlay=new google.maps.Rectangle({bounds:this.viewport});this.setColors(t.poly);break;case"kml":h=t.kml&&t.kml.url?t.kml.url:"";this.overlay=new google.maps.KmlLayer(h,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Marker({position:o})}};mapp.Poi.prototype={toJSON:function(){var n={address:this.address,body:this.body,correctedAddress:this.address,iconid:this.iconid,point:null,poly:null,title:this.title,type:this.type,viewport:null},r=this.getPosition(),t,i;if(n.point={lat:r.lat(),lng:r.lng()},t=this.viewport?this.viewport:this.getBounds(),t&&(n.viewport={sw:{lat:t.getSouthWest().lat(),lng:t.getSouthWest().lng()},ne:{lat:t.getNorthEast().lat(),lng:t.getNorthEast().lng()}}),this.type=="kml"&&(n.kml={url:this.overlay.getUrl()}),this.isPoly()){n.poly=this.getColors();switch(this.type){case"circle":n.poly.radius=this.overlay.getRadius();break;case"polyline":n.poly.path=[];this.overlay.getPath().forEach(function(t){n.poly.path.push({lat:t.lat(),lng:t.lng()})});break;case"polygon":n.poly.paths=[];this.overlay.getPaths().forEach(function(t){var i=[];t.forEach(function(n){i.push({lat:n.lat(),lng:n.lng()})});n.poly.paths.push(i)});break;case"rectangle":i=this.overlay.getBounds();n.viewport={sw:{lat:i.getSouthWest().lat(),lng:i.getSouthWest().lng()},ne:{lat:i.getNorthEast().lat(),lng:i.getNorthEast().lng()}}}}return n},setMap:function(t){var i=this;if(google.maps.event.clearInstanceListeners(this.overlay),t==null){this.overlay.setMap(null);return}this.type=="kml"&&(google.maps.event.addListener(this.overlay,"defaultviewport_changed",function(){i.viewport=i.overlay.getDefaultViewport()}),google.maps.event.addListener(this.overlay,"status_changed",function(){var n=i.overlay.getStatus();n!="OK"&&mappl10n.ajaxErrors&&alert(mappl10n.kml_error+":"+n)}));this.map=t;this.overlay.setMap(t.getMap());this.setEditable(this.map.editable);this.setIcon(this.iconid);this.type||this.overlay.setTitle(n("<div>").html(this.title).text());google.maps.event.addListener(this.overlay,"click",function(n){i.open(n)})},setEditable:function(n){var t=this;this.type!="kml"&&(this.overlay.setDraggable(n),this.isPoly()&&this.overlay.setEditable(n),google.maps.event.clearListeners(this.overlay,"rightclick"),google.maps.event.clearListeners(this.overlay,"dragstart"),n&&(google.maps.event.addListener(this.overlay,"dragstart",function(){t.viewport=null;t.map.closeInfoWindow()}),(this.type=="polygon"||this.type=="polyline")&&google.maps.event.addListener(this.overlay,"rightclick",function(n){n.vertex!=null&&t.overlay.getPath().getLength()>2&&t.overlay.getPath().removeAt(n.vertex)})))},setZIndex:function(n){this.overlay.set("zIndex",n)},select:function(){},setIcon:function(n){this.type||typeof mapp.Icons=="undefined"||(this.overlay.setIcon(null),this.overlay.setIcon(mapp.Icons.get(n)),this.iconid=n)},setVisible:function(n){typeof this.overlay.setVisible!="undefined"&&this.overlay.setVisible(n)},setColors:function(n){var i={};for(var t in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})n&&typeof n[t]!="undefined"&&(i[t]=n[t]);this.overlay.setOptions(i)},getColors:function(){var t={};for(var n in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})typeof this.overlay[n]!="undefined"&&(t[n]=this.overlay[n]);return t},center:function(t){var i=this.map.getMap(),u=this.getBounds(),r,t;if(typeof t=="number"){i.setCenter(this.getPosition());i.setZoom(t);return}if(!u){i.setCenter(this.getPosition());i.setZoom(parseInt(mappl10n.options.poiZoom));return}r=u.getNorthEast().lng()-u.getSouthWest().lng();r<0&&(r+=360);t=Math.round(Math.log(n(i.getDiv()).width()*360/r/256)/Math.LN2);i.setCenter(this.getPosition());i.setZoom(t)},open:function(n){this.map.openInfoWindow(this,n)},isPoly:function(){return jQuery.inArray(this.type,["polyline","polygon","circle","rectangle"])!=-1},getBounds:function(){var n;switch(this.type){case"polyline":n=new google.maps.LatLngBounds;this.overlay.getPath().forEach(function(t){n.extend(t)});break;case"polygon":n=new google.maps.LatLngBounds;this.overlay.getPaths().forEach(function(t){t.forEach(function(t){n.extend(t)})});break;case"rectangle":case"circle":n=this.overlay.getBounds();break;case"kml":n=this.overlay.getDefaultViewport();n=n?n:this.viewport;break;default:return this.viewport}return n},getPosition:function(n){if(!this.type)return this.overlay.getPosition();if(this.type=="kml"&&n&&n.latLng)return n.latLng;var t=this.getBounds();return t?t.getCenter():new google.maps.LatLng(0,0)},click:function(){google.maps.event.trigger(this.overlay,"click")},getAddress:function(){return this.address?this.address:this.type=="kml"?this.kml.url:this.getPosition().toUrlValue()},getAnchorPoint:function(n){return this.type=="kml"?n&&n.pixelOffset?new google.maps.Point(n.pixelOffset.width,n.pixelOffset.height):new google.maps.Point(0,0):this.type?new google.maps.Point(0,0):typeof this.overlay.anchorPoint!="undefined"?this.overlay.anchorPoint:new google.maps.Point(0,-32)}}}(jQuery);mapp=window.mapp||{};mapp.widgets={};+function(n){mapp.widgets.Grid=function(t,i){this.el=n(t);this.options=jQuery.extend({action:null,sortable:!1},i);var r=this;this.table=n("table",this.el);this.template=n("script",this.el).html().replace(new RegExp("'","g"),'"');this.el.on("click",function(t){var u=n(t.target),i=u.attr("data-mapp-action");i&&(r[i](t),t.preventDefault())})};mapp.widgets.Grid.prototype={add:function(){this.table.show();var t=n(this.template).appendTo(this.table);n(":input:eq(0)",t).focus()},remove:function(t){var i=n(t.target).closest("tr").remove();n("tbody > tr",this.table).length||this.table.hide()}}}(jQuery);+function(n){mapp.widgets.Popup=function(t,i){this.options=n.extend({destroy:!1,fullscreen:!1,modal:!1,position:null,toggle:null},i);this.activeToggle=null;var r=this;this.el=n('<div class="mapp-popup" tabindex="-1">').appendTo("body").hide();this.setContent(t);this.el.on("focusout",function(t){n.contains(r.el.get(0),t.relatedTarget)||r.el.get(0)==t.relatedTarget||r.close()});if(this.options.toggle)n(document).on("click",this.options.toggle,function(t){r.activeToggle=n(this);r.open();t.stopPropagation()});this.el.on("click",".mapp-close",function(){r.close()});this.el.on("keydown",function(n){n.which==27&&r.close()});return this};mapp.widgets.Popup.prototype={close:function(){this.el.is(":visible")&&(this.backdrop&&this.backdrop.remove(),n("body").removeClass("mapp-popup-open"),this.el.hide(),this.activeToggle.focus(),this.el.trigger("closed.mapp.popup"))},destroy:function(){this.el.remove();n(document).off("click.mapp.popup",function(){me.close()})},open:function(){var i=this,t;n(document).trigger("click.mapp.popup");this.el.trigger("open.mapp.popup");this.el.show();this.options.modal||this.el.position(n.extend({my:"center bottom",at:"center top-5",of:this.activeToggle,collision:"flipfit"},this.options.position));t=n(":input",this.el);t.length?t.first().focus():this.el.focus();this.options.modal&&(this.backdrop=n('<div class="mapp-backdrop"><\/div>'),this.el.after(this.backdrop),n("body").addClass("mapp-popup-open"))},setContent:function(n){this.el.empty();this.el.append('<span class="mapp-close">');this.el.append(n)},toggle:function(){this.el.is(":visible")?this.close():this.open()}}}(jQuery);+function(){mapp.load=function(){if(typeof mapp!="undefined"&&mapp.data)while(mapp.data.length){var n=mapp.data.pop();window[n.name]=new mapp.Map(n);window[n.name].display()}}}(jQuery);typeof mapp.Media!="undefined"?window.mappEditor=new mapp.Media:mapp.load()
languages/mappress-google-maps-for-wordpress.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the MapPress Easy Google Maps package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: MapPress Easy Google Maps 2.48.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
- "POT-Creation-Date: 2018-03-22 18:49:21+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -57,7 +57,7 @@ msgstr ""
57
  msgid "Map Title"
58
  msgstr ""
59
 
60
- #: forms/map_media.php:20 languages/texts.php:51 mappress.php:621
61
  #: mappress_map.php:591
62
  msgid "Untitled"
63
  msgstr ""
@@ -98,43 +98,43 @@ msgstr ""
98
  msgid "Size"
99
  msgstr ""
100
 
101
- #: languages/texts.php:20 mappress.php:159
102
  msgid "Version"
103
  msgstr ""
104
 
105
- #: languages/texts.php:21 mappress.php:167
106
  msgid "Documentation"
107
  msgstr ""
108
 
109
- #: languages/texts.php:22 mappress.php:168
110
  msgid "Support"
111
  msgstr ""
112
 
113
- #: languages/texts.php:23 mappress.php:170
114
  msgid "Upgrade to MapPress Pro"
115
  msgstr ""
116
 
117
- #: languages/texts.php:24 mappress.php:449
118
  msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
119
  msgstr ""
120
 
121
- #: languages/texts.php:25 mappress.php:454
122
  msgid "WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress."
123
  msgstr ""
124
 
125
- #: languages/texts.php:26 mappress.php:459
126
  msgid "WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
127
  msgstr ""
128
 
129
- #: languages/texts.php:27 mappress.php:464
130
  msgid "A Google Maps API key is required"
131
  msgstr ""
132
 
133
- #: languages/texts.php:28 mappress.php:464
134
  msgid "Please update your"
135
  msgstr ""
136
 
137
- #: languages/texts.php:29 mappress.php:464
138
  msgid "MapPress Settings"
139
  msgstr ""
140
 
@@ -150,7 +150,7 @@ msgstr ""
150
  msgid "One of the addresses could not be found."
151
  msgstr ""
152
 
153
- #: languages/texts.php:33 mappress.php:611
154
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
155
  msgstr ""
156
 
@@ -162,7 +162,7 @@ msgstr ""
162
  msgid "Directions"
163
  msgstr ""
164
 
165
- #: languages/texts.php:36 mappress.php:612
166
  msgid "Error reading KML file"
167
  msgstr ""
168
 
@@ -170,11 +170,11 @@ msgstr ""
170
  msgid "Loading..."
171
  msgstr ""
172
 
173
- #: languages/texts.php:38 mappress.php:615
174
  msgid "No matching address"
175
  msgstr ""
176
 
177
- #: languages/texts.php:39 mappress.php:616
178
  msgid "Unable to get your location"
179
  msgstr ""
180
 
@@ -207,7 +207,7 @@ msgstr ""
207
  msgid "Delete this POI?"
208
  msgstr ""
209
 
210
- #: languages/texts.php:48 mappress.php:618
211
  msgid "Delete this map?"
212
  msgstr ""
213
 
@@ -215,7 +215,7 @@ msgstr ""
215
  msgid "Please save the map first"
216
  msgstr ""
217
 
218
- #: languages/texts.php:50 mappress.php:620
219
  msgid "Shape"
220
  msgstr ""
221
 
@@ -652,7 +652,7 @@ msgstr ""
652
  msgid "Reset Defaults"
653
  msgstr ""
654
 
655
- #: languages/texts.php:160 mappress.php:153
656
  msgid "Settings"
657
  msgstr ""
658
 
@@ -1024,19 +1024,19 @@ msgstr ""
1024
  msgid "Chris Richardson"
1025
  msgstr ""
1026
 
1027
- #: mappress.php:613
1028
  msgid "Loading"
1029
  msgstr ""
1030
 
1031
- #: mappress.php:614
1032
  msgid "%d results shown. Zoom in to see more."
1033
  msgstr ""
1034
 
1035
- #: mappress.php:617
1036
  msgid "Are you sure you want to delete?"
1037
  msgstr ""
1038
 
1039
- #: mappress.php:619
1040
  msgid "Save changes?"
1041
  msgstr ""
1042
 
2
  # This file is distributed under the same license as the MapPress Easy Google Maps package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: MapPress Easy Google Maps 2.48.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
+ "POT-Creation-Date: 2018-05-19 00:02:49+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
57
  msgid "Map Title"
58
  msgstr ""
59
 
60
+ #: forms/map_media.php:20 languages/texts.php:51 mappress.php:624
61
  #: mappress_map.php:591
62
  msgid "Untitled"
63
  msgstr ""
98
  msgid "Size"
99
  msgstr ""
100
 
101
+ #: languages/texts.php:20 mappress.php:160
102
  msgid "Version"
103
  msgstr ""
104
 
105
+ #: languages/texts.php:21 mappress.php:168
106
  msgid "Documentation"
107
  msgstr ""
108
 
109
+ #: languages/texts.php:22 mappress.php:169
110
  msgid "Support"
111
  msgstr ""
112
 
113
+ #: languages/texts.php:23 mappress.php:171
114
  msgid "Upgrade to MapPress Pro"
115
  msgstr ""
116
 
117
+ #: languages/texts.php:24 mappress.php:451
118
  msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
119
  msgstr ""
120
 
121
+ #: languages/texts.php:25 mappress.php:456
122
  msgid "WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress."
123
  msgstr ""
124
 
125
+ #: languages/texts.php:26 mappress.php:461
126
  msgid "WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
127
  msgstr ""
128
 
129
+ #: languages/texts.php:27 mappress.php:466
130
  msgid "A Google Maps API key is required"
131
  msgstr ""
132
 
133
+ #: languages/texts.php:28 mappress.php:466
134
  msgid "Please update your"
135
  msgstr ""
136
 
137
+ #: languages/texts.php:29 mappress.php:466
138
  msgid "MapPress Settings"
139
  msgstr ""
140
 
150
  msgid "One of the addresses could not be found."
151
  msgstr ""
152
 
153
+ #: languages/texts.php:33 mappress.php:614
154
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
155
  msgstr ""
156
 
162
  msgid "Directions"
163
  msgstr ""
164
 
165
+ #: languages/texts.php:36 mappress.php:615
166
  msgid "Error reading KML file"
167
  msgstr ""
168
 
170
  msgid "Loading..."
171
  msgstr ""
172
 
173
+ #: languages/texts.php:38 mappress.php:618
174
  msgid "No matching address"
175
  msgstr ""
176
 
177
+ #: languages/texts.php:39 mappress.php:619
178
  msgid "Unable to get your location"
179
  msgstr ""
180
 
207
  msgid "Delete this POI?"
208
  msgstr ""
209
 
210
+ #: languages/texts.php:48 mappress.php:621
211
  msgid "Delete this map?"
212
  msgstr ""
213
 
215
  msgid "Please save the map first"
216
  msgstr ""
217
 
218
+ #: languages/texts.php:50 mappress.php:623
219
  msgid "Shape"
220
  msgstr ""
221
 
652
  msgid "Reset Defaults"
653
  msgstr ""
654
 
655
+ #: languages/texts.php:160 mappress.php:154
656
  msgid "Settings"
657
  msgstr ""
658
 
1024
  msgid "Chris Richardson"
1025
  msgstr ""
1026
 
1027
+ #: mappress.php:616
1028
  msgid "Loading"
1029
  msgstr ""
1030
 
1031
+ #: mappress.php:617
1032
  msgid "%d results shown. Zoom in to see more."
1033
  msgstr ""
1034
 
1035
+ #: mappress.php:620
1036
  msgid "Are you sure you want to delete?"
1037
  msgstr ""
1038
 
1039
+ #: mappress.php:622
1040
  msgid "Save changes?"
1041
  msgstr ""
1042
 
mappress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: MapPress Easy Google Maps
4
  Plugin URI: http://www.wphostreviews.com/mappress
5
  Author URI: http://www.wphostreviews.com/mappress
6
  Description: MapPress makes it easy to insert Google Maps in WordPress posts and pages.
7
- Version: 2.48.4
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
@@ -34,7 +34,7 @@ if (is_dir(dirname( __FILE__ ) . '/pro')) {
34
  }
35
 
36
  class Mappress {
37
- const VERSION = '2.48.4';
38
 
39
  static
40
  $baseurl,
@@ -89,7 +89,8 @@ class Mappress {
89
 
90
  // Remove API loaded by other plugins
91
  if (self::$options->deregister) {
92
- add_action('wp_print_footer_scripts', array(__CLASS__, 'deregister'), -1); // wp_print_scripts for header
 
93
  add_action('wp_print_scripts', array(__CLASS__, 'deregister'), -1);
94
  }
95
 
@@ -343,9 +344,10 @@ class Mappress {
343
  */
344
  static function wp_enqueue_scripts() {
345
  // Load the default CSS from the plugin directory
 
346
  wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
347
 
348
- // If a 'mappress.css' exists in the theme directory, load that afterwards
349
  if ( @file_exists( get_stylesheet_directory() . '/mappress.css' ) )
350
  $file = get_stylesheet_directory_uri() . '/mappress.css';
351
  elseif ( @file_exists( get_template_directory() . '/mappress.css' ) )
@@ -379,7 +381,7 @@ class Mappress {
379
  wp_enqueue_code_editor(array( 'type' => 'php' ));
380
  }
381
 
382
- // CSS
383
  if (in_array($hook, self::$pages) || $editing) {
384
  wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
385
  wp_enqueue_style('mappress-admin', self::$baseurl . '/css/mappress_admin.css', null, self::VERSION);
@@ -528,7 +530,7 @@ class Mappress {
528
  global $post;
529
  $maps = Mappress_Map::get_list($post->ID, 'ids');
530
  $map = ($maps) ? Mappress_Map::get($maps[0]) : null;
531
- $atts['search'] = ($map && $map->pois) ? $map->pois[0]->point : null;
532
  }
533
 
534
  return $atts;
@@ -552,13 +554,14 @@ class Mappress {
552
  static function load($type = null) {
553
  if (self::$loaded)
554
  return;
 
555
  self::$loaded = true;
556
 
557
  $dev = self::dev();
558
  $version = (self::$pro) ? self::VERSION . 'PRO' : self::VERSION;
559
  $footer = self::footer();
560
 
561
- $apiversion = ($dev) ? 'v=3' : 'v=3'; // 3.exp removed, too many bugs in 3.32
562
  $apikey = "&key=" . self::get_api_keys()->browser;
563
  $libstring = ($type == 'editor') ? '&libraries=places,drawing' : '&libraries=places';
564
 
4
  Plugin URI: http://www.wphostreviews.com/mappress
5
  Author URI: http://www.wphostreviews.com/mappress
6
  Description: MapPress makes it easy to insert Google Maps in WordPress posts and pages.
7
+ Version: 2.48.5
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
34
  }
35
 
36
  class Mappress {
37
+ const VERSION = '2.48.5';
38
 
39
  static
40
  $baseurl,
89
 
90
  // Remove API loaded by other plugins
91
  if (self::$options->deregister) {
92
+ add_action('wp_print_footer_scripts', array(__CLASS__, 'deregister'), -1);
93
+ add_action('admin_print_footer_scripts', array(__CLASS__, 'deregister'), -1);
94
  add_action('wp_print_scripts', array(__CLASS__, 'deregister'), -1);
95
  }
96
 
344
  */
345
  static function wp_enqueue_scripts() {
346
  // Load the default CSS from the plugin directory
347
+ // Mappress CSS from plugin directory
348
  wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
349
 
350
+ // Mappress CSS from theme directory
351
  if ( @file_exists( get_stylesheet_directory() . '/mappress.css' ) )
352
  $file = get_stylesheet_directory_uri() . '/mappress.css';
353
  elseif ( @file_exists( get_template_directory() . '/mappress.css' ) )
381
  wp_enqueue_code_editor(array( 'type' => 'php' ));
382
  }
383
 
384
+ // Mappress CSS
385
  if (in_array($hook, self::$pages) || $editing) {
386
  wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
387
  wp_enqueue_style('mappress-admin', self::$baseurl . '/css/mappress_admin.css', null, self::VERSION);
530
  global $post;
531
  $maps = Mappress_Map::get_list($post->ID, 'ids');
532
  $map = ($maps) ? Mappress_Map::get($maps[0]) : null;
533
+ $atts['center'] = ($map && $map->pois) ? $map->pois[0]->point['lat'] . ',' . $map->pois[0]->point['lng'] : null;
534
  }
535
 
536
  return $atts;
554
  static function load($type = null) {
555
  if (self::$loaded)
556
  return;
557
+ else
558
  self::$loaded = true;
559
 
560
  $dev = self::dev();
561
  $version = (self::$pro) ? self::VERSION . 'PRO' : self::VERSION;
562
  $footer = self::footer();
563
 
564
+ $apiversion = ($dev) ? 'v=3.31' : 'v=3.31'; // 3.exp removed, too many bugs in 3.32
565
  $apikey = "&key=" . self::get_api_keys()->browser;
566
  $libstring = ($type == 'editor') ? '&libraries=places,drawing' : '&libraries=places';
567
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: google maps,google,map,maps,easy,poi,mapping,mapper,gps,lat,lon,latitude,longitude,geocoder,geocoding,georss,geo rss,geo,v3,marker,mashup,mash,api,v3,buddypress,mashup,geo,wp-geo,geo mashup,simplemap,simple,wpml
5
  Requires at least: 3.5
6
  Tested up to: 4.9
7
- Stable tag: 2.48.4
8
 
9
  MapPress is the most popular and easiest way to create great-looking Google Maps and driving directions in your blog.
10
 
@@ -86,6 +86,11 @@ Please see the plugin documentation pages:
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
89
  = 2.48.4 =
90
  * Added: maps now support full-screen control: [mappress fullscreenControl="true"]
91
  * Fixed: map center was changing when resizing
4
  Tags: google maps,google,map,maps,easy,poi,mapping,mapper,gps,lat,lon,latitude,longitude,geocoder,geocoding,georss,geo rss,geo,v3,marker,mashup,mash,api,v3,buddypress,mashup,geo,wp-geo,geo mashup,simplemap,simple,wpml
5
  Requires at least: 3.5
6
  Tested up to: 4.9
7
+ Stable tag: 2.48.5
8
 
9
  MapPress is the most popular and easiest way to create great-looking Google Maps and driving directions in your blog.
10
 
86
 
87
  == Changelog ==
88
 
89
+ = 2.48.5 =
90
+ * Fixed: shake in editor caused by Google API update
91
+ * Fixed: API compatibility setting not applied in admin screens
92
+ * Changed: removed inline directions, shape editor
93
+
94
  = 2.48.4 =
95
  * Added: maps now support full-screen control: [mappress fullscreenControl="true"]
96
  * Fixed: map center was changing when resizing