MapPress Easy Google Maps - Version 2.46.5

Version Description

  • Fixed: javascript error on settings screen
  • Fixed: improved check for multiple API keys
  • Fixed: custom template not applied for mashup POIs
Download this release

Release Info

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

Code changes from version 2.46.4 to 2.46.5

js/mappress.min.js CHANGED
@@ -1 +1 @@
1
- var mapp=window.mapp||{};+function(n){mapp.Map=function(t){function c(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(r,n[i],t)}function l(){var u,t;n("[data-mapp-type]",i.menu).removeClass("mapp-active");n('[data-mapp-type="'+r.getMapTypeId()+'"]',i.menu).addClass("mapp-active");for(layer in e)u=!!e[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',i.menu).toggleClass("mapp-active",u);t=!!(f.center&&f.zoom);n('[data-mapp-action="viewport-set"]',i.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',i.menu).toggle(t)}function a(){var n=mappl10n.options.styles,i=mappl10n.options.style,u=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&r.setOptions({styles:n[i]}),f.editable){for(t in n)r.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),u.push(t);r.setOptions({mapTypeControlOptions:{mapTypeIds:u,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[f.mapTypeId]!="undefined"&&r.setOptions({styles:n[f.mapTypeId]})}function v(){i.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;r.controls[t].push(i.get(0))})}function y(){var o,i,t,u;for(e={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},o=n.makeArray(f.options.layers),i=0;i<o.length;i++)t=n.trim(o[i]),u=t.split(".").pop(),e[t]?h(t):u=="kml"||u=="kmz"?e[t]=new google.maps.KmlLayer({map:r,preserveViewport:!0,url:t}):u=="json"&&(e[t]=new google.maps.Data({map:r}).loadGeoJson(t))}function h(t,i){i=typeof i!="undefined"?i:e[t].getMap()==null;n.each(["traffic","bicycling","transit"],function(n,t){e[t].setMap(null)});t&&e[t].setMap(i?r:null)}function p(t,i){var u=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(r.getMapTypeId()==t);t=f.editable?i&&(u||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":u?t:"roadmap";r.setMapTypeId(t)}this.center=t.center;this.height=t.height;this.mapid=t.mapid;this.mapTypeId=t.mapTypeId?t.mapTypeId:"roadmap";this.metaKey=t.metaKey;this.name=t.name;this.options=t.options;this.query=t.query;this.title=t.title;this.width=t.width;this.zoom=t.zoom?parseInt(t.zoom,10):null;this.editable=t.options.editable;this.iw=null;this.layers=t.options.layers;this.places=null;this.poi=null;var f=this,o=null,i={},r=null,e={},w=t.options,u=[],s;this.display=function(){if(i.layout=n("#"+this.name),i.canvas=n(".mapp-canvas",i.layout),i.controls=n(".mapp-controls",i.layout),i.dialog=n(".mapp-dialog",i.layout),i.dir=n(".mapp-directions",i.layout),i.filters=n(".mapp-filters",i.layout),i.list=n(".mapp-list",i.layout),i.menu=n(".mapp-menu",i.controls),!i.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);r=new google.maps.Map(i.canvas.get(0),{mapTypeId:"roadmap",zoom:1});s=google.maps.Marker.MAX_ZINDEX;var u={backgroundColor:"transparent",fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:this.options.minZoom?parseInt(this.options.minZoom):0,scaleControl:!0,scrollwheel:!1,streetViewControl:!(this.editable||this.query)};r.setOptions(u);a();v();y();p(this.mapTypeId,!0);this.places=new mapp.Places(null,{gmap:r});google.maps.event.addListener(this.places,"search",function(n){f.search(n)});i.layout.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action");t.preventDefault();f.action(i,n(this).attr("data-mapp-"+i),n(this))});i.filters.on("change",function(){f.ajaxQuery(r.getBounds())});c("click drag",function(){f.closeInfoWindow()});i.layout.on("click",function(t){var r=n(t.target),u=r.attr("data-mapp-action");r==i.filters||u=="filters-toggle"||r.closest(i.filters).length||f.toggleView("filters",!1);r==i.menu||u=="menu-toggle"||r.closest(i.menu).length||f.toggleView("menu",!1)});if(n(window).resize(function(){f.resize()}),this.iw=this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow,mappl10n.options.directions!="none"&&(o=new mapp.Directions(i.dir,{map:f,directions:mappl10n.options.directions})),this.query){this.options.search?this.places.parse(this.options.search):this.ajaxQuery();return}google.maps.event.addListenerOnce(r,"idle",function(){f.initCenter()});this.setPois(t.pois);this.renderList()};this.action=function(t,f,e){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":i.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(r.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate();break;case"layer":h(f);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var o=e.attr("data-mapp-poi");this.openInfoWindow(u[o]);break;case"show":i.layout.show();this.resize();this.initCenter();break;case"viewport-set":this.center=r.getCenter().toJSON();this.zoom=r.getZoom();this.toggleView("menu",!1);break;case"viewport-reset":this.center=null;this.zoom=null;this.toggleView("menu",!1);break;default:return!0}};this.closeInfoWindow=function(){this.iw.close();this.poiSelect(null)};this.openDirections=function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";o.open(i,r)};this.poiSelect=function(t){if(this.poi=t,n("[data-mapp-poi]",i.list).removeClass("mapp-selected"),t){var f=n.inArray(t,u),r=n('[data-mapp-poi="'+f+'"]',i.list);r.addClass("mapp-selected");mapp.lib.scrollTo(i.list,r);s++;t.setZIndex(s)}};this.getMap=function(){return r};this.renderList=function(){this.editable&&(i.list.html(mapp.lib.template("poi-list",{pois:u})),google.maps.event.trigger(this,"rendered"))};this.getPoi=function(n){return n=typeof n=="string"?parseInt(n,10):n,u[n]};this.getPoiById=function(n){for(var t=0;t<u.length;t++)if(u[t].postid==n)return u[t];return null};this.getPois=function(){return u};this.addPoi=function(n){u.unshift(n);n.setMap(this);f.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,u);i!=-1&&(u[i].setMap(null),u.splice(i,1),f.renderList())};this.setPois=function(n){for(var i,t=0;t<u.length;t++)u[t].setMap(null);if(u=[],n){for(t=0;t<n.length;t++)i=new mapp.Poi,i.fromJSON(n[t]),u.push(i),i.setMap(this),i.setZIndex(s+n.length-1-t);s+=n.length-1}};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(u[r])}if(t.length!=u.length)return!1;u=t;this.renderList()};this.openInfoWindow=function(n,t){if(this.iw){if(o&&o.close(),this.iw.close(),this.poiSelect(n),!this.editable){if(this.options.mashupClick=="post"&&n.postid&&n.url){window.location.assign(n.url);return}this.iw.setContent(n.html)}google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(f,"poidomready",n)});google.maps.event.trigger(f,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(r,i)}};this.togglePois=function(n){n=!!n;for(var t=0;t<u.length;t++)u[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!i.layout.hasClass("mapp-view-"+n):t;i.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&l()};this.resize=function(){var n=r.getCenter();google.maps.event.trigger(r,"resize");r.setCenter(n);return};this.initCenter=function(){var n=u.length?u[0]:null;google.maps.event.addListenerOnce(r,"idle",function(){if(o&&f.options.initialOpenDirections){f.openDirections(null,n);return}n&&f.options.initialOpenInfo&&n.open()});this.recenter()};this.recenter=function(){var f=!this.query&&this.center?new google.maps.LatLng(this.center.lat,this.center.lng):null,t=!this.query&&this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,n,i;if(f){r.setCenter(f);r.setZoom(t?t:1);return}if(u.length==0){r.setCenter(new google.maps.LatLng(0,0));r.setZoom(1);return}if(u.length==1){u[0].center(t);return}for(bounds=new google.maps.LatLngBounds,n=0;n<u.length;n++)i=u[n].getBounds(),bounds=i?bounds.union(i):bounds.extend(u[n].getPosition());r.fitBounds(bounds)};this.toJSON=function(){for(var t={center:this.center,height:this.height,mapid:this.mapid,mapTypeId:r.getMapTypeId(),metaKey:this.metaKey,pois:[],title:this.title,width:this.width,zoom:this.zoom},n=0;n<u.length;n++)t.pois.push(u[n].toJSON());return t};this.ajaxSave=function(n){mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:JSON.stringify(this),postid:mappl10n.options.postid},callback:function(t){t.status=="OK"&&(f.mapid=t.data.mapid,n(t.data))}})}};mapp.Map.ajaxCreate=function(t,i,r){mapp.lib.ajax({type:"GET",data:{action:"mapp_create"},callback:function(u){if(u.status=="OK"){n.extend(u.data.map.options,i);u.data.map.name=t;var f=new mapp.Map(u.data.map);r(f)}}})};mapp.Map.ajaxGet=function(t,i,r,u){mapp.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:t},callback:function(t){if(t.status=="OK"){n.extend(t.data.map.options,r);t.data.map.name=i;var f=new mapp.Map(t.data.map);u(f)}}})};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){function h(t,i,o){var c=n(".mapp-travelmode-on > span",r).hasClass("mapp-dir-walk")?google.maps.DirectionsTravelMode.WALKING:n(".mapp-travelmode-on > span",r).hasClass("mapp-dir-transit")?google.maps.DirectionsTravelMode.TRANSIT:n(".mapp-travelmode-on > span",r).hasClass("mapp-dir-bike")?google.maps.DirectionsTravelMode.BICYCLING:google.maps.DirectionsTravelMode.DRIVING;var l={travelMode:c,transitOptions:{departureTime:null},provideRouteAlternatives:!0,origin:t,destination:i},h=n(".mapp-dir-renderer",r).get(0);n(".mapp-dir-renderer",r).empty();s||(s=new google.maps.DirectionsService);s.route(l,function(n,t){switch(t){case google.maps.DirectionsStatus.OK:f.opts.map.togglePois(!1);u?(u.setDirections(n),u.setMap(e),u.setPanel(h)):u=new google.maps.DirectionsRenderer({map:e,panel:h,directions:n,hideRouteList:!1,draggable:!0});break;case google.maps.DirectionsStatus.NOT_FOUND:alert(mappl10n.dir_error);break;case google.maps.DirectionsStatus.ZERO_RESULTS:alert(mappl10n.dir_error);break;default:alert(mappl10n.dir_error+t)}o()})}this.opts=n.extend({map:null,directions:null},i);var r=n(t),e,o,u,s,f=this;e=this.opts.map.getMap();o=new mapp.Geocoder(e);r.on("keydown",function(t){t.which==13?(f.getDirections(n(".mapp-dir-saddr",r).val(),n(".mapp-dir-daddr",r).val()),t.preventDefault()):t.which==27&&f.close()});r.on("click","[data-mapp-action]",function(t){var h=n(this).attr("data-mapp-action"),i,u,e,s;t.preventDefault();switch(h){case"dir-cancel":f.close();break;case"dir-get":f.getDirections();break;case"dir-google":i=n(".mapp-dir-saddr",r).val();u=n(".mapp-dir-daddr",r).val();f.openGoogle(i,u);f.close();break;case"dir-myloc":o.geolocate(function(t){t?n(".mapp-dir-saddr",r).val(t.coords.latitude+", "+t.coords.longitude):alert(mappl10n.no_geolocate)});break;case"dir-swap":e=n(".mapp-dir-daddr",r).val();s=n(".mapp-dir-saddr",r).val();n(".mapp-dir-saddr",r).val(e);n(".mapp-dir-daddr",r).val(s)}});this.open=function(t,i){if(this.opts.directions=="google"){this.openGoogle(t,i);return}this.opts.map.toggleView("directions",!0);n(".mapp-dir-saddr",r).val(t);n(".mapp-dir-daddr",r).val(i);n(".mapp-dir-get",r).focus();n(".mapp-dir-saddr",r).focus()};this.close=function(){this.opts.map.toggleView("directions",!1);u&&(u.setPanel(null),u.getMap()&&(u.setMap(null),this.opts.map.togglePois(!0)))};this.getDirections=function(){this.opts.map.closeInfoWindow();n(".mapp-spinner",r).show();var t=n(".mapp-dir-saddr",r),i=n(".mapp-dir-daddr",r),u=n(".mapp-dir-saddr-err",r),f=n(".mapp-dir-daddr-err",r);o.geocodeField(t,u,function(t){o.geocodeField(i,f,function(i){t&&i?h(t,i,function(){n(".mapp-spinner",r).hide();return}):n(".mapp-spinner",r).hide()})})};this.printDirections=function(){var i,t=n(".mapp-travelmode-on > span",r);i=t.hasClass("mapp-dir-walk")?"w":t.hasClass("mapp-dir-bike")?"b":t.hasClass("mapp-dir-transit")?"r":"d";this.openGoogle(n(".mapp-dir-saddr",r).val(),n(".mapp-dir-daddr",r).val(),i)};this.openGoogle=function(n,t,i){var r=mappl10n.options.directionsServer;r.toLowerCase().indexOf("http")==-1&&(r="https://"+r);r+="?saddr="+encodeURIComponent(n);r+="&daddr="+encodeURIComponent(t);i&&(r+="&dirflg="+i);window.open(r)}}}(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({disableAutoPan:!1,border:20},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.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.log(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.log(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(n.trim(r),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"]').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-canvas",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.opts.types||(this.opts.types=[]);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){if(n.which==13)return!1});google.maps.event.addListener(this.autocomplete,"place_changed",function(){u.parse(this.getPlace())})}};mapp.Places.prototype={parse:function(t){var u,i=this,r;if(this.error(!1),r=t&&t.name?n.trim(t.name):n.trim(t),!r)return this.error(!0);if(r=="geolocate")return this.geolocate();if(r.substring(0,4)=="http"||r.substring(0,3)=="kml"&&typeof typenow!="undefined"&&typenow=="mappress_map"){google.maps.event.trigger(i,"search",r=="kml"?"http://googlemaps.github.io/js-v2-samples/ggeoxml/cta.kml":r);return}if(t&&t.geometry){t.formatted_address&&this.set(t.formatted_address);google.maps.event.trigger(i,"search",t);return}if(latLngLoc=this.parseLatLng(t)){google.maps.event.trigger(i,"search",latLngLoc);return}this.autocompleteService.getPlacePredictions({input:r,types:this.opts.types,bounds:this.opts.map.getMap().getBounds()},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,r;return t instanceof google.maps.LatLng?i=t:t&&t.lat&&t.lng?i=new google.maps.LatLng(t.lat,t.lng):(name=t&&t.name?n.trim(t.name):n.trim(t),r=name.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(){var n=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(t){n.set("");var i=new google.maps.LatLng(t.coords.latitude,t.coords.longitude),r={name:i.toUrlValue(),geometry:{location:i}};google.maps.event.trigger(n,"search",r)},function(){alert(mappl10n.no_geolocate)},{timeout:1e4,enableHighAccuracy:!0,maximumAge:3e4})},set:function(n){n=n.replace(", United States of America","").replace(", USA","").replace(", United States","");this.sel.blur();this.sel.val(n);this.sel.blur();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)}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(){this.address=null;this.body=null;this.html=null;this.iconid=null;this.kml=null;this.map=null;this.overlay=null;this.postid=null;this.title="";this.url=null;this.type=null;this.viewport=null;for(var n in arguments[0])typeof arguments[0][n]!="undefined"&&(this[n]=arguments[0][n])};mapp.Poi.prototype={fromJSON:function(n){var u,f,i,o,t,r,s,e;this.address=n.correctedAddress;this.body=n.body;this.correctedAddress=n.correctedAddress;this.html=n.html;this.iconid=n.iconid;this.kml=n.kml;this.postid=n.postid;this.title=n.title;this.type=n.type;this.url=n.url;n.viewport&&n.viewport.sw&&n.viewport.ne&&(u=new google.maps.LatLng(n.viewport.sw.lat,n.viewport.sw.lng),f=new google.maps.LatLng(n.viewport.ne.lat,n.viewport.ne.lng),this.viewport=u.lat()==0&&u.lng()==0&&f.lat()==0&&f.lng()==0?null:new google.maps.LatLngBounds(u,f));i=[];o=[];switch(this.type){case"polygon":if(n.poly&&n.poly.paths)for(t=0;t<n.poly.paths.length;t++){for(i=[],r=0;r<n.poly.paths[t].length;r++)i.push(new google.maps.LatLng(n.poly.paths[t][r].lat,n.poly.paths[t][r].lng));o.push(new google.maps.MVCArray(i))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(o)});this.setColors(n.poly);break;case"polyline":if(n.poly&&n.poly.path)for(t=0;t<n.poly.path.length;t++)i.push(new google.maps.LatLng(n.poly.path[t].lat,n.poly.path[t].lng));this.overlay=new google.maps.Polyline({path:new google.maps.MVCArray(i)});this.setColors(n.poly);break;case"circle":e=new google.maps.LatLng(n.point.lat,n.point.lng);this.overlay=new google.maps.Circle({center:e,radius:parseFloat(n.poly.radius)});this.setColors(n.poly);break;case"rectangle":this.overlay=new google.maps.Rectangle({bounds:this.viewport});this.setColors(n.poly);break;case"kml":s=n.kml&&n.kml.url?n.kml.url:"";this.overlay=new google.maps.KmlLayer(s,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:e=new google.maps.LatLng(n.point.lat,n.point.lng);this.overlay=new google.maps.Marker({position:e})}},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)})))},getZIndex:function(){return this.type?this.overlay.zIndex:this.overlay.getZIndex()},setZIndex:function(n){this.type?this.overlay.zIndex=n:this.overlay.setZIndex(n)},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(n){var t=this.map.getMap(),i=this.getBounds();if(typeof n=="number"){t.setCenter(this.getPosition());t.setZoom(n);return}i?(t.fitBounds(i),t.setCenter(this.getPosition())):(t.setCenter(this.getPosition()),t.setZoom(parseInt(mappl10n.options.poiZoom)))},open:function(n){this.map.openInfoWindow(this,n)},isPoly:function(){return jQuery.inArray(this.type,["polyline","polygon","circle","rectangle"])!=-1},getBounds:function(){var n;if(!this.map.editable&&this.viewport)return this.viewport;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?this.viewport:null}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(){mapp.load=function(){if(typeof mapp!="undefined"&&mapp.data)while(mapp.data.length){var n=mapp.data.pop(),t=new mapp.Map(n);window[n.name]=t;t.display()}}}(jQuery);typeof mapp.Media!="undefined"?window.mappEditor=new mapp.Media:mapp.load()
1
+ var mapp=window.mapp||{};+function(n){mapp.Map=function(t){function c(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(r,n[i],t)}function l(){var u,t;n("[data-mapp-type]",i.menu).removeClass("mapp-active");n('[data-mapp-type="'+r.getMapTypeId()+'"]',i.menu).addClass("mapp-active");for(layer in e)u=!!e[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',i.menu).toggleClass("mapp-active",u);t=!!(f.center&&f.zoom);n('[data-mapp-action="viewport-set"]',i.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',i.menu).toggle(t)}function a(){var n=mappl10n.options.styles,i=mappl10n.options.style,u=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&r.setOptions({styles:n[i]}),f.editable){for(t in n)r.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),u.push(t);r.setOptions({mapTypeControlOptions:{mapTypeIds:u,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[f.mapTypeId]!="undefined"&&r.setOptions({styles:n[f.mapTypeId]})}function v(){i.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;r.controls[t].push(i.get(0))})}function y(){var o,i,t,u;for(e={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},o=n.makeArray(f.options.layers),i=0;i<o.length;i++)t=n.trim(o[i]),u=t.split(".").pop(),e[t]?h(t):u=="kml"||u=="kmz"?e[t]=new google.maps.KmlLayer({map:r,preserveViewport:!0,url:t}):u=="json"&&(e[t]=new google.maps.Data({map:r}).loadGeoJson(t))}function h(t,i){i=typeof i!="undefined"?i:e[t].getMap()==null;n.each(["traffic","bicycling","transit"],function(n,t){e[t].setMap(null)});t&&e[t].setMap(i?r:null)}function p(t,i){var u=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(r.getMapTypeId()==t);t=f.editable?i&&(u||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":u?t:"roadmap";r.setMapTypeId(t)}this.center=t.center;this.height=t.height;this.mapid=t.mapid;this.mapTypeId=t.mapTypeId?t.mapTypeId:"roadmap";this.metaKey=t.metaKey;this.name=t.name;this.options=t.options;this.query=t.query;this.title=t.title;this.width=t.width;this.zoom=t.zoom?parseInt(t.zoom,10):null;this.editable=t.options.editable;this.iw=null;this.layers=t.options.layers;this.places=null;this.poi=null;var f=this,o=null,i={},r=null,e={},w=t.options,u=[],s;this.display=function(){if(i.layout=n("#"+this.name),i.canvas=n(".mapp-canvas",i.layout),i.controls=n(".mapp-controls",i.layout),i.dialog=n(".mapp-dialog",i.layout),i.dir=n(".mapp-directions",i.layout),i.filters=n(".mapp-filters",i.layout),i.list=n(".mapp-list",i.layout),i.menu=n(".mapp-menu",i.controls),!i.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);r=new google.maps.Map(i.canvas.get(0),{mapTypeId:"roadmap",zoom:1});s=google.maps.Marker.MAX_ZINDEX;var u={backgroundColor:"transparent",fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:this.options.minZoom?parseInt(this.options.minZoom):0,scaleControl:!0,scrollwheel:!1,streetViewControl:!(this.editable||this.query)};r.setOptions(u);a();v();y();p(this.mapTypeId,!0);this.places=new mapp.Places(null,{gmap:r});google.maps.event.addListener(this.places,"search",function(n){f.search(n)});i.layout.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action");t.preventDefault();f.action(i,n(this).attr("data-mapp-"+i),n(this))});i.filters.on("change",function(){f.ajaxQuery(r.getBounds())});c("click drag",function(){f.closeInfoWindow()});i.layout.on("click",function(t){var r=n(t.target),u=r.attr("data-mapp-action");r==i.filters||u=="filters-toggle"||r.closest(i.filters).length||f.toggleView("filters",!1);r==i.menu||u=="menu-toggle"||r.closest(i.menu).length||f.toggleView("menu",!1)});if(n(window).resize(function(){f.resize()}),this.iw=this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow,mappl10n.options.directions!="none"&&(o=new mapp.Directions(i.dir,{map:f,directions:mappl10n.options.directions})),this.query){this.options.search?this.places.parse(this.options.search):this.ajaxQuery();return}google.maps.event.addListenerOnce(r,"idle",function(){f.initCenter()});this.setPois(t.pois);this.renderList()};this.action=function(t,f,e){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":i.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(r.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate();break;case"layer":h(f);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var o=e.attr("data-mapp-poi");this.openInfoWindow(u[o]);break;case"show":i.layout.show();this.resize();this.initCenter();break;case"viewport-set":this.center=r.getCenter().toJSON();this.zoom=r.getZoom();this.toggleView("menu",!1);break;case"viewport-reset":this.center=null;this.zoom=null;this.toggleView("menu",!1);break;default:return!0}};this.closeInfoWindow=function(){this.iw.close();this.poiSelect(null)};this.openDirections=function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";o.open(i,r)};this.poiSelect=function(t){if(this.poi=t,n("[data-mapp-poi]",i.list).removeClass("mapp-selected"),t){var f=n.inArray(t,u),r=n('[data-mapp-poi="'+f+'"]',i.list);r.addClass("mapp-selected");mapp.lib.scrollTo(i.list,r);s++;t.setZIndex(s)}};this.getMap=function(){return r};this.renderList=function(){this.editable&&(i.list.html(mapp.lib.template("poi-list",{pois:u})),google.maps.event.trigger(this,"rendered"))};this.getPoi=function(n){return n=typeof n=="string"?parseInt(n,10):n,u[n]};this.getPoiById=function(n){for(var t=0;t<u.length;t++)if(u[t].postid==n)return u[t];return null};this.getPois=function(){return u};this.addPoi=function(n){u.unshift(n);n.setMap(this);f.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,u);i!=-1&&(u[i].setMap(null),u.splice(i,1),f.renderList())};this.setPois=function(n){for(var i,t=0;t<u.length;t++)u[t].setMap(null);if(u=[],n){for(t=0;t<n.length;t++)i=new mapp.Poi,i.fromJSON(n[t]),u.push(i),i.setMap(this),i.setZIndex(s+n.length-1-t);s+=n.length-1}};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(u[r])}if(t.length!=u.length)return!1;u=t;this.renderList()};this.openInfoWindow=function(n,t){if(this.iw){if(o&&o.close(),this.iw.close(),this.poiSelect(n),!this.editable){if(this.options.mashupClick=="post"&&n.postid&&n.url){window.location.assign(n.url);return}this.iw.setContent(n.html)}google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(f,"poidomready",n)});google.maps.event.trigger(f,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(r,i)}};this.togglePois=function(n){n=!!n;for(var t=0;t<u.length;t++)u[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!i.layout.hasClass("mapp-view-"+n):t;i.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&l()};this.resize=function(){var n=r.getCenter();google.maps.event.trigger(r,"resize");r.setCenter(n);return};this.initCenter=function(){var n=u.length?u[0]:null;google.maps.event.addListenerOnce(r,"idle",function(){if(o&&f.options.initialOpenDirections){f.openDirections(null,n);return}n&&f.options.initialOpenInfo&&n.open()});this.recenter()};this.recenter=function(){var f=!this.query&&this.center?new google.maps.LatLng(this.center.lat,this.center.lng):null,t=!this.query&&this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,n,i;if(f){r.setCenter(f);r.setZoom(t?t:1);return}if(u.length==0){r.setCenter(new google.maps.LatLng(0,0));r.setZoom(1);return}if(u.length==1){u[0].center(t);return}for(bounds=new google.maps.LatLngBounds,n=0;n<u.length;n++)i=u[n].getBounds(),bounds=i?bounds.union(i):bounds.extend(u[n].getPosition());r.fitBounds(bounds)};this.toJSON=function(){for(var t={center:this.center,height:this.height,mapid:this.mapid,mapTypeId:r.getMapTypeId(),metaKey:this.metaKey,pois:[],title:this.title,width:this.width,zoom:this.zoom},n=0;n<u.length;n++)t.pois.push(u[n].toJSON());return t};this.ajaxSave=function(n){mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:JSON.stringify(this),postid:mappl10n.options.postid},callback:function(t){t.status=="OK"&&(f.mapid=t.data.mapid,n(t.data))}})}};mapp.Map.ajaxCreate=function(t,i,r){mapp.lib.ajax({type:"GET",data:{action:"mapp_create"},callback:function(u){if(u.status=="OK"){n.extend(u.data.map.options,i);u.data.map.name=t;var f=new mapp.Map(u.data.map);r(f)}}})};mapp.Map.ajaxGet=function(t,i,r,u){mapp.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:t},callback:function(t){if(t.status=="OK"){n.extend(t.data.map.options,r);t.data.map.name=i;var f=new mapp.Map(t.data.map);u(f)}}})};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){function h(t,i,o){var c=n(".mapp-travelmode-on > span",r).hasClass("mapp-dir-walk")?google.maps.DirectionsTravelMode.WALKING:n(".mapp-travelmode-on > span",r).hasClass("mapp-dir-transit")?google.maps.DirectionsTravelMode.TRANSIT:n(".mapp-travelmode-on > span",r).hasClass("mapp-dir-bike")?google.maps.DirectionsTravelMode.BICYCLING:google.maps.DirectionsTravelMode.DRIVING;var l={travelMode:c,transitOptions:{departureTime:null},provideRouteAlternatives:!0,origin:t,destination:i},h=n(".mapp-dir-renderer",r).get(0);n(".mapp-dir-renderer",r).empty();s||(s=new google.maps.DirectionsService);s.route(l,function(n,t){switch(t){case google.maps.DirectionsStatus.OK:f.opts.map.togglePois(!1);u?(u.setDirections(n),u.setMap(e),u.setPanel(h)):u=new google.maps.DirectionsRenderer({map:e,panel:h,directions:n,hideRouteList:!1,draggable:!0});break;case google.maps.DirectionsStatus.NOT_FOUND:alert(mappl10n.dir_error);break;case google.maps.DirectionsStatus.ZERO_RESULTS:alert(mappl10n.dir_error);break;default:alert(mappl10n.dir_error+t)}o()})}this.opts=n.extend({map:null,directions:null},i);var r=n(t),e,o,u,s,f=this;e=this.opts.map.getMap();o=new mapp.Geocoder(e);r.on("keydown",function(t){t.which==13?(f.getDirections(n(".mapp-dir-saddr",r).val(),n(".mapp-dir-daddr",r).val()),t.preventDefault()):t.which==27&&f.close()});r.on("click","[data-mapp-action]",function(t){var h=n(this).attr("data-mapp-action"),i,u,e,s;t.preventDefault();switch(h){case"dir-cancel":f.close();break;case"dir-get":f.getDirections();break;case"dir-google":i=n(".mapp-dir-saddr",r).val();u=n(".mapp-dir-daddr",r).val();f.openGoogle(i,u);f.close();break;case"dir-myloc":o.geolocate(function(t){t?n(".mapp-dir-saddr",r).val(t.coords.latitude+", "+t.coords.longitude):alert(mappl10n.no_geolocate)});break;case"dir-swap":e=n(".mapp-dir-daddr",r).val();s=n(".mapp-dir-saddr",r).val();n(".mapp-dir-saddr",r).val(e);n(".mapp-dir-daddr",r).val(s)}});this.open=function(t,i){if(this.opts.directions=="google"){this.openGoogle(t,i);return}this.opts.map.toggleView("directions",!0);n(".mapp-dir-saddr",r).val(t);n(".mapp-dir-daddr",r).val(i);n(".mapp-dir-get",r).focus();n(".mapp-dir-saddr",r).focus()};this.close=function(){this.opts.map.toggleView("directions",!1);u&&(u.setPanel(null),u.getMap()&&(u.setMap(null),this.opts.map.togglePois(!0)))};this.getDirections=function(){this.opts.map.closeInfoWindow();n(".mapp-spinner",r).show();var t=n(".mapp-dir-saddr",r),i=n(".mapp-dir-daddr",r),u=n(".mapp-dir-saddr-err",r),f=n(".mapp-dir-daddr-err",r);o.geocodeField(t,u,function(t){o.geocodeField(i,f,function(i){t&&i?h(t,i,function(){n(".mapp-spinner",r).hide();return}):n(".mapp-spinner",r).hide()})})};this.printDirections=function(){var i,t=n(".mapp-travelmode-on > span",r);i=t.hasClass("mapp-dir-walk")?"w":t.hasClass("mapp-dir-bike")?"b":t.hasClass("mapp-dir-transit")?"r":"d";this.openGoogle(n(".mapp-dir-saddr",r).val(),n(".mapp-dir-daddr",r).val(),i)};this.openGoogle=function(n,t,i){var r=mappl10n.options.directionsServer;r.toLowerCase().indexOf("http")==-1&&(r="https://"+r);r+="?saddr="+encodeURIComponent(n);r+="&daddr="+encodeURIComponent(t);i&&(r+="&dirflg="+i);window.open(r)}}}(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({disableAutoPan:!1,border:20},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.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.log(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.log(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(n.trim(r),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-canvas",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.opts.types||(this.opts.types=[]);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){if(n.which==13)return!1});google.maps.event.addListener(this.autocomplete,"place_changed",function(){u.parse(this.getPlace())})}};mapp.Places.prototype={parse:function(t){var u,i=this,r;if(this.error(!1),r=t&&t.name?n.trim(t.name):n.trim(t),!r)return this.error(!0);if(r=="geolocate")return this.geolocate();if(r.substring(0,4)=="http"||r.substring(0,3)=="kml"&&typeof typenow!="undefined"&&typenow=="mappress_map"){google.maps.event.trigger(i,"search",r=="kml"?"http://googlemaps.github.io/js-v2-samples/ggeoxml/cta.kml":r);return}if(t&&t.geometry){t.formatted_address&&this.set(t.formatted_address);google.maps.event.trigger(i,"search",t);return}if(latLngLoc=this.parseLatLng(t)){google.maps.event.trigger(i,"search",latLngLoc);return}this.autocompleteService.getPlacePredictions({input:r,types:this.opts.types,bounds:this.opts.map.getMap().getBounds()},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,r;return t instanceof google.maps.LatLng?i=t:t&&t.lat&&t.lng?i=new google.maps.LatLng(t.lat,t.lng):(name=t&&t.name?n.trim(t.name):n.trim(t),r=name.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(){var n=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(t){n.set("");var i=new google.maps.LatLng(t.coords.latitude,t.coords.longitude),r={name:i.toUrlValue(),geometry:{location:i}};google.maps.event.trigger(n,"search",r)},function(){alert(mappl10n.no_geolocate)},{timeout:1e4,enableHighAccuracy:!0,maximumAge:3e4})},set:function(n){n=n.replace(", United States of America","").replace(", USA","").replace(", United States","");this.sel.blur();this.sel.val(n);this.sel.blur();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)}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(){this.address=null;this.body=null;this.html=null;this.iconid=null;this.kml=null;this.map=null;this.overlay=null;this.postid=null;this.title="";this.url=null;this.type=null;this.viewport=null;for(var n in arguments[0])typeof arguments[0][n]!="undefined"&&(this[n]=arguments[0][n])};mapp.Poi.prototype={fromJSON:function(n){var u,f,i,o,t,r,s,e;this.address=n.correctedAddress;this.body=n.body;this.correctedAddress=n.correctedAddress;this.html=n.html;this.iconid=n.iconid;this.kml=n.kml;this.postid=n.postid;this.title=n.title;this.type=n.type;this.url=n.url;n.viewport&&n.viewport.sw&&n.viewport.ne&&(u=new google.maps.LatLng(n.viewport.sw.lat,n.viewport.sw.lng),f=new google.maps.LatLng(n.viewport.ne.lat,n.viewport.ne.lng),this.viewport=u.lat()==0&&u.lng()==0&&f.lat()==0&&f.lng()==0?null:new google.maps.LatLngBounds(u,f));i=[];o=[];switch(this.type){case"polygon":if(n.poly&&n.poly.paths)for(t=0;t<n.poly.paths.length;t++){for(i=[],r=0;r<n.poly.paths[t].length;r++)i.push(new google.maps.LatLng(n.poly.paths[t][r].lat,n.poly.paths[t][r].lng));o.push(new google.maps.MVCArray(i))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(o)});this.setColors(n.poly);break;case"polyline":if(n.poly&&n.poly.path)for(t=0;t<n.poly.path.length;t++)i.push(new google.maps.LatLng(n.poly.path[t].lat,n.poly.path[t].lng));this.overlay=new google.maps.Polyline({path:new google.maps.MVCArray(i)});this.setColors(n.poly);break;case"circle":e=new google.maps.LatLng(n.point.lat,n.point.lng);this.overlay=new google.maps.Circle({center:e,radius:parseFloat(n.poly.radius)});this.setColors(n.poly);break;case"rectangle":this.overlay=new google.maps.Rectangle({bounds:this.viewport});this.setColors(n.poly);break;case"kml":s=n.kml&&n.kml.url?n.kml.url:"";this.overlay=new google.maps.KmlLayer(s,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:e=new google.maps.LatLng(n.point.lat,n.point.lng);this.overlay=new google.maps.Marker({position:e})}},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)})))},getZIndex:function(){return this.type?this.overlay.zIndex:this.overlay.getZIndex()},setZIndex:function(n){this.type?this.overlay.zIndex=n:this.overlay.setZIndex(n)},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(n){var t=this.map.getMap(),i=this.getBounds();if(typeof n=="number"){t.setCenter(this.getPosition());t.setZoom(n);return}i?(t.fitBounds(i),t.setCenter(this.getPosition())):(t.setCenter(this.getPosition()),t.setZoom(parseInt(mappl10n.options.poiZoom)))},open:function(n){this.map.openInfoWindow(this,n)},isPoly:function(){return jQuery.inArray(this.type,["polyline","polygon","circle","rectangle"])!=-1},getBounds:function(){var n;if(!this.map.editable&&this.viewport)return this.viewport;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?this.viewport:null}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(){mapp.load=function(){if(typeof mapp!="undefined"&&mapp.data)while(mapp.data.length){var n=mapp.data.pop(),t=new mapp.Map(n);window[n.name]=t;t.display()}}}(jQuery);typeof mapp.Media!="undefined"?window.mappEditor=new mapp.Media:mapp.load()
js/mappress_settings.min.js CHANGED
@@ -1 +1 @@
1
- +function(n){function t(i){i=i?i:0;i==0&&n(".mapp-log").empty();mapp.lib.ajax({data:{action:"mapp_import"},callback:function(i){n(".mapp-log").append(i.data.log.join("<br/>"),"<br/>");i.data.start>=0?t(i.data.start):n(".mapp-spinner").hide()}})}n(document).ready(function(){new mapp.widgets.IconPicker;n(document).on("focus",".mapp-expand",function(){n(this).parent().width("100%");n(this).attr("rows",20)});n(document).on("blur",".mapp-expand",function(){n(this).parent().width("auto");n(this).attr("rows",1)});n(".mapp-autoicons").on("change","#mapp-autoicons-key",function(){mapp.lib.ajax({data:{action:"mapp_autoicons_form",key:n(this).val()},callback:function(t){n(".mapp-autoicons").html(t.data);new mapp.widgets.Grid(n("[data-mapp-grid]",".mapp-autoicons"))}})});jQuery("#mapp-filters tbody").sortable({handle:".mapp-handle"});n(".mapp-confirm").on("change",function(){var t=n(".mapp-confirm").is(":checked");n(".mapp-import").prop("disabled",!t)});n(".mapp-import").on("click",function(){n(".mapp-confirm, .mapp-import").prop("disabled",!0);t()})})}(jQuery)
1
+ +function(n){function t(i){i=i?i:0;i==0&&n(".mapp-log").empty();mapp.lib.ajax({data:{action:"mapp_import"},callback:function(i){n(".mapp-log").append(i.data.log.join("<br/>"),"<br/>");i.data.start>=0?t(i.data.start):n(".mapp-spinner").hide()}})}n(document).ready(function(){n(".mapp-confirm").on("change",function(){var t=n(".mapp-confirm").is(":checked");n(".mapp-import").prop("disabled",!t)});n(".mapp-import").on("click",function(){n(".mapp-confirm, .mapp-import").prop("disabled",!0);t()})})}(jQuery)
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.46.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
- "POT-Creation-Date: 2017-09-12 17:16:24+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -113,27 +113,27 @@ msgstr ""
113
  msgid "Upgrade to MapPress Pro"
114
  msgstr ""
115
 
116
- #: languages/texts.php:24 mappress.php:419
117
  msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
118
  msgstr ""
119
 
120
- #: languages/texts.php:25 mappress.php:424
121
  msgid "WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress."
122
  msgstr ""
123
 
124
- #: languages/texts.php:26 mappress.php:429
125
  msgid "WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
126
  msgstr ""
127
 
128
- #: languages/texts.php:27 mappress.php:436
129
  msgid "A Google Maps API key is required"
130
  msgstr ""
131
 
132
- #: languages/texts.php:28 mappress.php:436
133
  msgid "Please update your"
134
  msgstr ""
135
 
136
- #: languages/texts.php:29 mappress.php:436
137
  msgid "MapPress Settings"
138
  msgstr ""
139
 
@@ -149,7 +149,7 @@ msgstr ""
149
  msgid "One of the addresses could not be found."
150
  msgstr ""
151
 
152
- #: languages/texts.php:33 mappress.php:568
153
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
154
  msgstr ""
155
 
@@ -161,7 +161,7 @@ msgstr ""
161
  msgid "Directions"
162
  msgstr ""
163
 
164
- #: languages/texts.php:36 mappress.php:569
165
  msgid "Error reading KML file"
166
  msgstr ""
167
 
@@ -169,11 +169,11 @@ msgstr ""
169
  msgid "Loading..."
170
  msgstr ""
171
 
172
- #: languages/texts.php:38 mappress.php:570
173
  msgid "No matching address"
174
  msgstr ""
175
 
176
- #: languages/texts.php:39 mappress.php:571
177
  msgid "Unable to get your location"
178
  msgstr ""
179
 
@@ -202,11 +202,11 @@ msgstr ""
202
  msgid "Click to change"
203
  msgstr ""
204
 
205
- #: languages/texts.php:47 mappress.php:572
206
  msgid "Delete this POI?"
207
  msgstr ""
208
 
209
- #: languages/texts.php:48 mappress.php:573
210
  msgid "Delete this map?"
211
  msgstr ""
212
 
@@ -214,7 +214,7 @@ msgstr ""
214
  msgid "Please save the map first"
215
  msgstr ""
216
 
217
- #: languages/texts.php:50 mappress.php:574
218
  msgid "Shape"
219
  msgstr ""
220
 
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.46.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
+ "POT-Creation-Date: 2017-09-17 18:57:34+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
113
  msgid "Upgrade to MapPress Pro"
114
  msgstr ""
115
 
116
+ #: languages/texts.php:24 mappress.php:416
117
  msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
118
  msgstr ""
119
 
120
+ #: languages/texts.php:25 mappress.php:421
121
  msgid "WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress."
122
  msgstr ""
123
 
124
+ #: languages/texts.php:26 mappress.php:426
125
  msgid "WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
126
  msgstr ""
127
 
128
+ #: languages/texts.php:27 mappress.php:433
129
  msgid "A Google Maps API key is required"
130
  msgstr ""
131
 
132
+ #: languages/texts.php:28 mappress.php:433
133
  msgid "Please update your"
134
  msgstr ""
135
 
136
+ #: languages/texts.php:29 mappress.php:433
137
  msgid "MapPress Settings"
138
  msgstr ""
139
 
149
  msgid "One of the addresses could not be found."
150
  msgstr ""
151
 
152
+ #: languages/texts.php:33 mappress.php:551
153
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
154
  msgstr ""
155
 
161
  msgid "Directions"
162
  msgstr ""
163
 
164
+ #: languages/texts.php:36 mappress.php:552
165
  msgid "Error reading KML file"
166
  msgstr ""
167
 
169
  msgid "Loading..."
170
  msgstr ""
171
 
172
+ #: languages/texts.php:38 mappress.php:553
173
  msgid "No matching address"
174
  msgstr ""
175
 
176
+ #: languages/texts.php:39 mappress.php:554
177
  msgid "Unable to get your location"
178
  msgstr ""
179
 
202
  msgid "Click to change"
203
  msgstr ""
204
 
205
+ #: languages/texts.php:47 mappress.php:555
206
  msgid "Delete this POI?"
207
  msgstr ""
208
 
209
+ #: languages/texts.php:48 mappress.php:556
210
  msgid "Delete this map?"
211
  msgstr ""
212
 
214
  msgid "Please save the map first"
215
  msgstr ""
216
 
217
+ #: languages/texts.php:50 mappress.php:557
218
  msgid "Shape"
219
  msgstr ""
220
 
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.46.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.46.4';
38
 
39
  static
40
  $baseurl,
@@ -192,8 +192,7 @@ class Mappress {
192
  return $content;
193
 
194
  // Don't add the shortcode for feeds or admin screens
195
- $ajax = defined('DOING_AJAX') && DOING_AJAX;
196
- if (!$ajax && (is_feed() || is_admin()) )
197
  return $content;
198
 
199
  // No shortcode if post is password protected
@@ -237,8 +236,7 @@ class Mappress {
237
  return;
238
 
239
  // Try to protect against calls to do_shortcode() in the post editor...
240
- $ajax = defined('DOING_AJAX') && DOING_AJAX;
241
- if (is_admin() && !$ajax)
242
  return;
243
 
244
  $atts = self::scrub_atts($atts);
@@ -271,8 +269,7 @@ class Mappress {
271
  return;
272
 
273
  // Prevent do_shortcode() in the post editor, but allow for AJAX calls from other plugins (which run as admin)
274
- $ajax = defined('DOING_AJAX') && DOING_AJAX;
275
- if (is_admin() && !$ajax)
276
  return;
277
 
278
  $atts = self::scrub_atts($atts);
@@ -321,17 +318,17 @@ class Mappress {
321
  * CSS is loaded from: child theme, theme, or plugin directory
322
  */
323
  static function wp_enqueue_scripts() {
324
- // Load the default CSS from the plugin directory
325
- wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
326
 
327
- // If a 'mappress.css' exists in the theme directory, load that afterwards
328
- if ( @file_exists( get_stylesheet_directory() . '/mappress.css' ) )
329
- $file = get_stylesheet_directory_uri() . '/mappress.css';
330
- elseif ( @file_exists( get_template_directory() . '/mappress.css' ) )
331
- $file = get_template_directory_uri() . '/mappress.css';
332
 
333
- if (isset($file))
334
- wp_enqueue_style('mappress-custom', $file, array('mappress'), self::VERSION);
335
 
336
  // Load scripts in header
337
  if (!self::$options->footer || self::infinite_scroll())
@@ -503,20 +500,6 @@ class Mappress {
503
  return $data;
504
  }
505
 
506
- static function boolean_to_string($data) {
507
- if ($data === false)
508
- return "false";
509
- if ($data === true)
510
- return "true";
511
-
512
- if (is_array($data)) {
513
- foreach($data as &$datum)
514
- $datum = self::boolean_to_string($datum);
515
- }
516
-
517
- return $data;
518
- }
519
-
520
  static function load($type = null) {
521
  static $loaded;
522
 
@@ -643,7 +626,7 @@ class Mappress {
643
 
644
  $template_name .= ".php";
645
  $template_file = locate_template($template_name, false);
646
- if (!self::$pro || is_admin() || empty($template_file))
647
  $template_file = Mappress::$basedir . "/templates/$template_name";
648
 
649
  if (file_exists($template_file))
@@ -681,6 +664,12 @@ class Mappress {
681
  static function ssl() {
682
  return (is_ssl() || !filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE));
683
  }
 
 
 
 
 
 
684
  } // End Mappress class
685
 
686
  $mappress = new Mappress();
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.46.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.46.5';
38
 
39
  static
40
  $baseurl,
192
  return $content;
193
 
194
  // Don't add the shortcode for feeds or admin screens
195
+ if (is_feed() || self::is_admin())
 
196
  return $content;
197
 
198
  // No shortcode if post is password protected
236
  return;
237
 
238
  // Try to protect against calls to do_shortcode() in the post editor...
239
+ if (self::is_admin())
 
240
  return;
241
 
242
  $atts = self::scrub_atts($atts);
269
  return;
270
 
271
  // Prevent do_shortcode() in the post editor, but allow for AJAX calls from other plugins (which run as admin)
272
+ if (self::is_admin())
 
273
  return;
274
 
275
  $atts = self::scrub_atts($atts);
318
  * CSS is loaded from: child theme, theme, or plugin directory
319
  */
320
  static function wp_enqueue_scripts() {
321
+ // Load the default CSS from the plugin directory
322
+ wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
323
 
324
+ // If a 'mappress.css' exists in the theme directory, load that afterwards
325
+ if ( @file_exists( get_stylesheet_directory() . '/mappress.css' ) )
326
+ $file = get_stylesheet_directory_uri() . '/mappress.css';
327
+ elseif ( @file_exists( get_template_directory() . '/mappress.css' ) )
328
+ $file = get_template_directory_uri() . '/mappress.css';
329
 
330
+ if (isset($file))
331
+ wp_enqueue_style('mappress-custom', $file, array('mappress'), self::VERSION);
332
 
333
  // Load scripts in header
334
  if (!self::$options->footer || self::infinite_scroll())
500
  return $data;
501
  }
502
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  static function load($type = null) {
504
  static $loaded;
505
 
626
 
627
  $template_name .= ".php";
628
  $template_file = locate_template($template_name, false);
629
+ if (!self::$pro || self::is_admin() || empty($template_file))
630
  $template_file = Mappress::$basedir . "/templates/$template_name";
631
 
632
  if (file_exists($template_file))
664
  static function ssl() {
665
  return (is_ssl() || !filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE));
666
  }
667
+
668
+ // WP returns is_admin() = true during AJAX calls, this one returns false in that case
669
+ static function is_admin() {
670
+ $ajax = defined('DOING_AJAX') && DOING_AJAX;
671
+ return is_admin() && !$ajax;
672
+ }
673
  } // End Mappress class
674
 
675
  $mappress = new Mappress();
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.46.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.46.4 =
90
  * Fixed: mashup poilist not shown if shortcode enabled and global setting disabled
91
  * Fixed: default map style not always applied
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.46.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.46.5 =
90
+ * Fixed: javascript error on settings screen
91
+ * Fixed: improved check for multiple API keys
92
+ * Fixed: custom template not applied for mashup POIs
93
+
94
  = 2.46.4 =
95
  * Fixed: mashup poilist not shown if shortcode enabled and global setting disabled
96
  * Fixed: default map style not always applied