Version Description
- Fixed: maps in Jquery tabs control not automatically resizing
Download this release
Release Info
Developer | chrisvrichardson |
Plugin | MapPress Easy Google Maps |
Version | 2.46.7 |
Comparing to | |
See all releases |
Code changes from version 2.47.6 to 2.46.7
- js/mappress.min.js +1 -1
- languages/mappress-google-maps-for-wordpress.pot +2 -2
- mappress.php +2 -2
- readme.txt +4 -1
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,minZoom: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={backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:this.minZoom?parseInt(this.minZoom):0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query};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(_.throttle(function(){e.resize()},500));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.setPois(this.pois);this.center?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.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=="post"||mappl10n.options.mashupClick=="postnew")&&n.postid&&n.url){mappl10n.options.mashupClick=="post"?window.location.assign(n.url):window.open(n.url);return}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();google.maps.event.trigger(u,"resize");u.setCenter(n);this.toggleView("mini",f.layout.width()<450);return};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.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)},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(){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){function r(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(_gmap,n[i],t)}function f(){var i,t;n("[data-mapp-type]",_div.menu).removeClass("mapp-active");n('[data-mapp-type="'+_gmap.getMapTypeId()+'"]',_div.menu).addClass("mapp-active");for(layer in _layers)i=!!_layers[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',_div.menu).toggleClass("mapp-active",i);t=!!(me.center&&me.zoom);n('[data-mapp-action="viewport-set"]',_div.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',_div.menu).toggle(t)}function e(){var n=mappl10n.options.styles,i=mappl10n.options.style,r=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&_gmap.setOptions({styles:n[i]}),me.editable){for(t in n)_gmap.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),r.push(t);_gmap.setOptions({mapTypeControlOptions:{mapTypeIds:r,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[me.mapTypeId]!="undefined"&&_gmap.setOptions({styles:n[me.mapTypeId]})}function o(){_div.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;_gmap.controls[t].push(i.get(0))})}function s(){var f,r,i,u;for(_layers={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},f=n.makeArray(me.layers),r=0;r<f.length;r++)i=n.trim(f[r]),u=i.split(".").pop(),_layers[i]?t(i):u=="kml"||u=="kmz"?_layers[i]=new google.maps.KmlLayer({map:_gmap,preserveViewport:!0,url:i}):u=="json"&&(_layers[i]=new google.maps.Data({map:_gmap}).loadGeoJson(i))}function t(t,i){n.each(["traffic","bicycling","transit"],function(n,t){_layers[t].setMap(null)});t&&(i=typeof i=="undefined"?_layers[t].getMap()==null:i,_layers[t].setMap(i?_gmap:null))}function u(t,i){var r=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(_gmap.getMapTypeId()==t);t=me.editable?i&&(r||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":r?t:"roadmap";_gmap.setMapTypeId(t)}mapp.Map=function(t,i){this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,minZoom: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=i?i:{};var f=this,h={},c=null,l=[];_.extend(this,this.defaults,_.pick(t,_.keys(this.defaults)),_.pick(this.settings,_.keys(this.defaults)));this.display=function(){if(h.layout=n("#"+this.name),n.each(["canvas","controls","directions","filters","list","menu","search"],function(t,i){h[i]=n(".mapp-"+i,h.layout)}),!h.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);c=new google.maps.Map(h.canvas.get(0),{mapTypeId:"roadmap",zoom:1});var t={backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:this.minZoom?parseInt(this.minZoom):0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query};c.setOptions(t);e();o();s();u(this.mapTypeId,!0);this.toggleView("mini",h.layout.width()<450);this.places=new mapp.Places(n(".mapp-places",h.search),{map:f});f.editable||google.maps.event.addListener(this.places,"search",function(n){f.search(n)})};h.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))});h.filters.on("change",function(){f.ajaxQuery(c.getBounds())});r("click drag",function(){f.closeInfoWindow()});n("body").on("click",function(t){var i=n(t.target),r=i.attr("data-mapp-action");i==h.filters||r=="filters-toggle"||i.closest(h.filters).length||f.toggleView("filters",!1);i==h.menu||r=="menu-toggle"||i.closest(h.menu).length||f.toggleView("menu",!1)});n(window).resize(_.throttle(function(){f.resize()},500));this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow;google.maps.event.addListenerOnce(c,"idle",function(){var n=l.length?l[0]:null;f.initialOpenDirections?f.openDirections(null,n):n&&f.initialOpenInfo&&n.open()});mappl10n.options.search&&google.maps.event.addListenerOnce(c,"tilesloaded",function(){google.maps.event.addListenerOnce(c,"idle",function(){r("dragend zoom_changed",function(){f.ajaxQuery(c.getBounds())})})});this.setPois(this.pois);this.center?this.places.parse(this.center):this.query?this.ajaxQuery():this.recenter()};this.load=function(n){_.extend(this,this.defaults,n,this.settings);u(this.mapTypeId,!0);this.toggleView("menu",!1);t();this.closeInfoWindow();this.setPois(this.pois);this.places.set("");google.maps.event.trigger(this,"load")};this.action=function(i,r,u){switch(i){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":_div.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(_gmap.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){me.search(n)});break;case"layer":t(r);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var f=u.attr("data-mapp-poi");this.openInfoWindow(_pois[f]);break;case"show":_div.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=_gmap.getCenter().toJSON();this.zoom=_gmap.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}),u=i?i.union(r.getBounds()):r.getBounds();_gmap.fitBounds(u,0);_gmap.setCenter(t);this.query&&this.ajaxQuery(u)};this.dialog=function(t,i){t?(_div.canvas.append("<div class='mapp-dialog'>"+t+"<\/div>"),i&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){me.dialog(null)},3e3))):n(".mapp-dialog",_div.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():"";_dir||(_dir=new mapp.Directions(_div.directions,me));_dir.open(i,r)};this.poiSelect=function(t){if(n("[data-mapp-poi]",_div.list).removeClass("mapp-selected"),t){var r=n.inArray(t,_pois),i=n('[data-mapp-poi="'+r+'"]',_div.list);i.addClass("mapp-selected");mapp.lib.scrollTo(_div.list,i);t.setZIndex(++_zIndex)}this.poi=t};this.getMap=function(){return _gmap};this.renderList=function(){this.editable&&(_div.list.html(mapp.lib.template("poi-list",{pois:_pois})),google.maps.event.trigger(this,"render-list"))};this.getPois=function(){return _pois};this.addPoi=function(n){_pois.unshift(n);n.setMap(this);me.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,_pois);i!=-1&&(_pois[i].setMap(null),_pois.splice(i,1),me.renderList())};this.resetPois=function(){for(i=0;i<_pois.length;i++)_pois[i].setMap(null);_pois=[];_zIndex=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]),_pois.push(i),i.setMap(this),i.setZIndex(_zIndex+n.length-1-t);_zIndex+=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(_pois[r])}if(t.length!=_pois.length)return!1;_pois=t;this.renderList()};this.openInfoWindow=function(n,t){if(_dir&&_dir.close(),this.iw.close(),this.poiSelect(n),(mappl10n.options.mashupClick=="post"||mappl10n.options.mashupClick=="postnew")&&n.postid&&n.url){mappl10n.options.mashupClick=="post"?window.location.assign(n.url):window.open(n.url);return}this.editable||this.iw.setContent(n.html);google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(me,"poidomready",n)});google.maps.event.trigger(me,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(_gmap,i)};this.togglePois=function(n){n=!!n;for(var t=0;t<_pois.length;t++)_pois[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!_div.layout.hasClass("mapp-view-"+n):t;_div.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&f();n=="directions"&&this.resize()};this.resize=function(){var n=_gmap.getCenter();google.maps.event.trigger(_gmap,"resize");_gmap.setCenter(n);this.toggleView("mini",_div.layout.width()<450);return};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){_gmap.setCenter(i);_gmap.setZoom(n?n:1);return}if(_pois.length==0){_gmap.setCenter(new google.maps.LatLng(0,0));_gmap.setZoom(n?n:1);return}if(_pois.length==1){_pois[0].center(n);return}for(bounds=new google.maps.LatLngBounds,t=0;t<_pois.length;t++)r=_pois[t].getBounds(),bounds=r?bounds.union(r):bounds.extend(_pois[t].getPosition());_gmap.fitBounds(bounds,0)};this.toJSON=function(){var n;for(this.pois=[],n=0;n<_pois.length;n++)this.pois.push(_pois[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:_gmap.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"&&(me.mapid=t.data.mapid,n(t.data),google.maps.event.trigger(me,"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.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)},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(){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.47.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
|
7 |
-
"POT-Creation-Date: 2018-03-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
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.47.7\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
|
7 |
+
"POT-Creation-Date: 2018-03-07 00:23:40+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
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.47.
|
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.47.
|
38 |
|
39 |
static
|
40 |
$baseurl,
|
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.47.7
|
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.47.7';
|
38 |
|
39 |
static
|
40 |
$baseurl,
|
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.47.
|
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,9 @@ Please see the plugin documentation pages:
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
89 |
= 2.47.6 =
|
90 |
* Added: prevent javascript caching when upgrading from free to Pro
|
91 |
* Added: enable gzip compression for AJAX data (depends on server settings)
|
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.47.7
|
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.47.7 =
|
90 |
+
* Fixed: internal javascript error
|
91 |
+
|
92 |
= 2.47.6 =
|
93 |
* Added: prevent javascript caching when upgrading from free to Pro
|
94 |
* Added: enable gzip compression for AJAX data (depends on server settings)
|