golden hour
/var/www/html/wp-content/plugins/responsive-maps-plugin/includes/js
⬆️ Go Up
Upload
File/Folder
Size
Actions
resmap.admin.dev.js
69.17 KB
Del
OK
resmap.admin.min.js
44.51 KB
Del
OK
resmap.dev.js
66.3 KB
Del
OK
resmap.min.js
31.57 KB
Del
OK
Edit: resmap.min.js
function openMarker(e,t){jQuery(".responsive-map").each(function(r){jQuery(this).data("gmap")&&e==r+1&&google.maps.event.trigger(jQuery(this).gMapResp("getMarker",t),"click")})}function resmap_addLocatemeButton(e){var t=document.createElement("div");t.id="locatemediv";var r=document.createElement("button");r.id="locatemeFirstChild",r.title="Your Location",r.type="button",t.appendChild(r);var o=document.createElement("div");o.id="locatemeSecondChild",r.appendChild(o);var i=document.createElement("div");i.id="locatemeThirdChild",o.appendChild(i),r.addEventListener("click",function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){var r=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);e.setCenter(r);new google.maps.Marker({position:r,icon:{path:"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",strokeColor:"#BBBBBB",strokeWeight:6,fillColor:"#666666",fillOpacity:.8,scale:.7},map:e,title:""})})}),t.index=1,e.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(t)}function resmap_createSearchBox(e){var t=document.createElement("div"),r=document.createElement("input");t.appendChild(r),t.setAttribute("id","locationDiv"),r.setAttribute("id","locationInput"),e.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(t);var o=new google.maps.places.Autocomplete(r,{types:["geocode"]});google.maps.event.addListener(o,"place_changed",function(){var t=o.getPlace();t&&t.geometry&&t.geometry.viewport?e.fitBounds(t.geometry.viewport):t.geometry&&(e.setCenter(t.geometry.location),e.setZoom(17))}),r.onkeyup=resmap_submitGeocode(r)}function resmap_submitGeocode(e){return function(t){(window.event?13==window.event.which||13==window.event.keyCode:13==t.which)&&"undefined"!=typeof geocoder&&geocoder.geocode({address:e.value},function(e,t){t==google.maps.GeocoderStatus.OK&&map.fitBounds(e[0].geometry.viewport)})}}function MarkerClusterer(e,t,r){this.extend(MarkerClusterer,google.maps.OverlayView),this.map_=e,this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var o=r||{};this.gridSize_=o.gridSize||60,this.minClusterSize_=o.minimumClusterSize||2,this.maxZoom_=o.maxZoom||null,this.styles_=o.styles||[],this.imagePath_=o.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=o.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,null!=o.zoomOnClick&&(this.zoomOnClick_=o.zoomOnClick),this.averageCenter_=!1,null!=o.averageCenter&&(this.averageCenter_=o.averageCenter),this.setupStyles_(),this.setMap(e),this.prevZoom_=this.map_.getZoom();var i=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var e=i.map_.getZoom();i.prevZoom_!=e&&(i.prevZoom_=e,i.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){i.redraw()}),t&&t.length&&this.addMarkers(t,!1)}function Cluster(e){this.markerClusterer_=e,this.map_=e.getMap(),this.gridSize_=e.getGridSize(),this.minClusterSize_=e.getMinClusterSize(),this.averageCenter_=e.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new ClusterIcon(this,e.getStyles(),e.getGridSize())}function ClusterIcon(e,t,r){e.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView),this.styles_=t,this.padding_=r||0,this.cluster_=e,this.center_=null,this.map_=e.getMap(),this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(this.map_)}MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="../images/m",MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png",MarkerClusterer.prototype.extend=function(e,t){return function(e){for(var t in e.prototype)this.prototype[t]=e.prototype[t];return this}.apply(e,[t])},MarkerClusterer.prototype.onAdd=function(){this.setReady_(!0)},MarkerClusterer.prototype.draw=function(){},MarkerClusterer.prototype.setupStyles_=function(){if(!this.styles_.length)for(var e,t=0;e=this.sizes[t];t++)this.styles_.push({url:this.imagePath_+(t+1)+"."+this.imageExtension_,height:e,width:e})},MarkerClusterer.prototype.fitMapToMarkers=function(){for(var e,t=this.getMarkers(),r=new google.maps.LatLngBounds,o=0;e=t[o];o++)r.extend(e.getPosition());this.map_.fitBounds(r)},MarkerClusterer.prototype.setStyles=function(e){this.styles_=e},MarkerClusterer.prototype.getStyles=function(){return this.styles_},MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_},MarkerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_},MarkerClusterer.prototype.getMarkers=function(){return this.markers_},MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length},MarkerClusterer.prototype.setMaxZoom=function(e){this.maxZoom_=e},MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_},MarkerClusterer.prototype.calculator_=function(e,t){for(var r=0,o=e.length,i=o;0!==i;)i=parseInt(i/10,10),r++;return{text:o,index:r=Math.min(r,t)}},MarkerClusterer.prototype.setCalculator=function(e){this.calculator_=e},MarkerClusterer.prototype.getCalculator=function(){return this.calculator_},MarkerClusterer.prototype.addMarkers=function(e,t){for(var r,o=0;r=e[o];o++)this.pushMarkerTo_(r);t||this.redraw()},MarkerClusterer.prototype.pushMarkerTo_=function(e){if(e.isAdded=!1,e.draggable){var t=this;google.maps.event.addListener(e,"dragend",function(){e.isAdded=!1,t.repaint()})}this.markers_.push(e)},MarkerClusterer.prototype.addMarker=function(e,t){this.pushMarkerTo_(e),t||this.redraw()},MarkerClusterer.prototype.removeMarker_=function(e){var t=-1;if(this.markers_.indexOf)t=this.markers_.indexOf(e);else for(var r,o=0;r=this.markers_[o];o++)if(r==e){t=o;break}return-1!=t&&(e.setMap(null),this.markers_.splice(t,1),!0)},MarkerClusterer.prototype.removeMarker=function(e,t){var r=this.removeMarker_(e);return!(t||!r)&&(this.resetViewport(),this.redraw(),!0)},MarkerClusterer.prototype.removeMarkers=function(e,t){for(var r,o=!1,i=0;r=e[i];i++){var s=this.removeMarker_(r);o=o||s}if(!t&&o)return this.resetViewport(),this.redraw(),!0},MarkerClusterer.prototype.setReady_=function(e){this.ready_||(this.ready_=e,this.createClusters_())},MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length},MarkerClusterer.prototype.getMap=function(){return this.map_},MarkerClusterer.prototype.setMap=function(e){this.map_=e},MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_},MarkerClusterer.prototype.setGridSize=function(e){this.gridSize_=e},MarkerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_},MarkerClusterer.prototype.setMinClusterSize=function(e){this.minClusterSize_=e},MarkerClusterer.prototype.getExtendedBounds=function(e){var t=this.getProjection(),r=new google.maps.LatLng(e.getNorthEast().lat(),e.getNorthEast().lng()),o=new google.maps.LatLng(e.getSouthWest().lat(),e.getSouthWest().lng()),i=t.fromLatLngToDivPixel(r);i.x+=this.gridSize_,i.y-=this.gridSize_;var s=t.fromLatLngToDivPixel(o);s.x-=this.gridSize_,s.y+=this.gridSize_;var n=t.fromDivPixelToLatLng(i),a=t.fromDivPixelToLatLng(s);return e.extend(n),e.extend(a),e},MarkerClusterer.prototype.isMarkerInBounds_=function(e,t){return t.contains(e.getPosition())},MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers_=[]},MarkerClusterer.prototype.resetViewport=function(e){for(var t,r=0;t=this.clusters_[r];r++)t.remove();var o;for(r=0;o=this.markers_[r];r++)o.isAdded=!1,e&&o.setMap(null);this.clusters_=[]},MarkerClusterer.prototype.repaint=function(){var e=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),window.setTimeout(function(){for(var t,r=0;t=e[r];r++)t.remove()},0)},MarkerClusterer.prototype.redraw=function(){this.createClusters_()},MarkerClusterer.prototype.distanceBetweenPoints_=function(e,t){if(!e||!t)return 0;var r=(t.lat()-e.lat())*Math.PI/180,o=(t.lng()-e.lng())*Math.PI/180,i=Math.sin(r/2)*Math.sin(r/2)+Math.cos(e.lat()*Math.PI/180)*Math.cos(t.lat()*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2);return 6371*(2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i)))},MarkerClusterer.prototype.addToClosestCluster_=function(e){for(var t,r=4e4,o=null,i=(e.getPosition(),0);t=this.clusters_[i];i++){var s=t.getCenter();if(s){var n=this.distanceBetweenPoints_(s,e.getPosition());n<r&&(r=n,o=t)}}o&&o.isMarkerInClusterBounds(e)?o.addMarker(e):((t=new Cluster(this)).addMarker(e),this.clusters_.push(t))},MarkerClusterer.prototype.createClusters_=function(){if(this.ready_)for(var e,t=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),r=this.getExtendedBounds(t),o=0;e=this.markers_[o];o++)!e.isAdded&&this.isMarkerInBounds_(e,r)&&this.addToClosestCluster_(e)},Cluster.prototype.isMarkerAlreadyAdded=function(e){if(this.markers_.indexOf)return-1!=this.markers_.indexOf(e);for(var t,r=0;t=this.markers_[r];r++)if(t==e)return!0;return!1},Cluster.prototype.addMarker=function(e){if(this.isMarkerAlreadyAdded(e))return!1;if(this.center_){if(this.averageCenter_){var t=this.markers_.length+1,r=(this.center_.lat()*(t-1)+e.getPosition().lat())/t,o=(this.center_.lng()*(t-1)+e.getPosition().lng())/t;this.center_=new google.maps.LatLng(r,o),this.calculateBounds_()}}else this.center_=e.getPosition(),this.calculateBounds_();e.isAdded=!0,this.markers_.push(e);var i=this.markers_.length;if(i<this.minClusterSize_&&e.getMap()!=this.map_&&e.setMap(this.map_),i==this.minClusterSize_)for(var s=0;s<i;s++)this.markers_[s].setMap(null);return i>=this.minClusterSize_&&e.setMap(null),this.updateIcon(),!0},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){for(var e,t=new google.maps.LatLngBounds(this.center_,this.center_),r=this.getMarkers(),o=0;e=r[o];o++)t.extend(e.getPosition());return t},Cluster.prototype.remove=function(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_},Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.calculateBounds_=function(){var e=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(e)},Cluster.prototype.isMarkerInClusterBounds=function(e){return this.bounds_.contains(e.getPosition())},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.updateIcon=function(){var e=this.map_.getZoom(),t=this.markerClusterer_.getMaxZoom();if(t&&e>t)for(var r,o=0;r=this.markers_[o];o++)r.setMap(this.map_);else if(this.markers_.length<this.minClusterSize_)this.clusterIcon_.hide();else{var i=this.markerClusterer_.getStyles().length,s=this.markerClusterer_.getCalculator()(this.markers_,i);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.setSums(s),this.clusterIcon_.show()}},ClusterIcon.prototype.triggerClusterClick=function(e){var t=this.cluster_.getMarkerClusterer();google.maps.event.trigger(t,"clusterclick",this.cluster_,e),t.isZoomOnClick()&&(this.map_.fitBounds(this.cluster_.getBounds()),this.map_.setCenter(this.cluster_.getCenter()))},ClusterIcon.prototype.onAdd=function(){if(this.div_=document.createElement("DIV"),this.visible_){var e=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(e),this.div_.innerHTML=this.sums_.text}this.getPanes().overlayMouseTarget.appendChild(this.div_);var t=this,r=!1;google.maps.event.addDomListener(this.div_,"click",function(e){r||t.triggerClusterClick(e)}),google.maps.event.addDomListener(this.div_,"mousedown",function(){r=!1}),google.maps.event.addDomListener(this.div_,"mousemove",function(){r=!0})},ClusterIcon.prototype.getPosFromLatLng_=function(e){var t=this.getProjection().fromLatLngToDivPixel(e);return"object"==typeof this.iconAnchor_&&2===this.iconAnchor_.length?(t.x-=this.iconAnchor_[0],t.y-=this.iconAnchor_[1]):(t.x-=parseInt(this.width_/2,10),t.y-=parseInt(this.height_/2,10)),t},ClusterIcon.prototype.draw=function(){if(this.visible_){var e=this.getPosFromLatLng_(this.center_);this.div_.style.top=e.y+"px",this.div_.style.left=e.x+"px"}},ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},ClusterIcon.prototype.show=function(){if(this.div_){var e=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(e),this.div_.style.display=""}this.visible_=!0},ClusterIcon.prototype.remove=function(){this.setMap(null)},ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)},ClusterIcon.prototype.setSums=function(e){this.sums_=e,this.text_=e.text,this.index_=e.index,this.div_&&(this.div_.innerHTML=e.text),this.useStyle()},ClusterIcon.prototype.useStyle=function(){var e=Math.max(0,this.sums_.index-1);e=Math.min(this.styles_.length-1,e);var t=this.styles_[e];this.url_=t.url,this.height_=t.height,this.width_=t.width,this.textColor_=t.textColor,this.anchor_=t.anchor,this.textSize_=t.textSize,this.backgroundPosition_=t.backgroundPosition,this.iconAnchor_=t.iconAnchor},ClusterIcon.prototype.setCenter=function(e){this.center_=e},ClusterIcon.prototype.createCss=function(e){var t=[];t.push("background-image:url("+this.url_+");");var r=this.backgroundPosition_?this.backgroundPosition_:"0 0";t.push("background-position:"+r+";"),"object"==typeof this.anchor_?("number"==typeof this.anchor_[0]&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?t.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):"number"==typeof this.anchor_[0]&&this.anchor_[0]<0&&-this.anchor_[0]<this.height_?t.push("height:"+this.height_+"px; line-height:"+(this.height_+this.anchor_[0])+"px;"):t.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),"number"==typeof this.anchor_[1]&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?t.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):t.push("width:"+this.width_+"px; text-align:center;")):t.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;");var o=this.textColor_?this.textColor_:"black",i=this.textSize_?this.textSize_:11;return t.push("cursor:pointer; top:"+e.y+"px; left:"+e.x+"px; color:"+o+"; position:absolute; font-size:"+i+"px; font-family:Arial,sans-serif; font-weight:bold"),t.join("")},window.MarkerClusterer=MarkerClusterer,MarkerClusterer.prototype.addMarker=MarkerClusterer.prototype.addMarker,MarkerClusterer.prototype.addMarkers=MarkerClusterer.prototype.addMarkers,MarkerClusterer.prototype.clearMarkers=MarkerClusterer.prototype.clearMarkers,MarkerClusterer.prototype.fitMapToMarkers=MarkerClusterer.prototype.fitMapToMarkers,MarkerClusterer.prototype.getCalculator=MarkerClusterer.prototype.getCalculator,MarkerClusterer.prototype.getGridSize=MarkerClusterer.prototype.getGridSize,MarkerClusterer.prototype.getExtendedBounds=MarkerClusterer.prototype.getExtendedBounds,MarkerClusterer.prototype.getMap=MarkerClusterer.prototype.getMap,MarkerClusterer.prototype.getMarkers=MarkerClusterer.prototype.getMarkers,MarkerClusterer.prototype.getMaxZoom=MarkerClusterer.prototype.getMaxZoom,MarkerClusterer.prototype.getStyles=MarkerClusterer.prototype.getStyles,MarkerClusterer.prototype.getTotalClusters=MarkerClusterer.prototype.getTotalClusters,MarkerClusterer.prototype.getTotalMarkers=MarkerClusterer.prototype.getTotalMarkers,MarkerClusterer.prototype.redraw=MarkerClusterer.prototype.redraw,MarkerClusterer.prototype.removeMarker=MarkerClusterer.prototype.removeMarker,MarkerClusterer.prototype.removeMarkers=MarkerClusterer.prototype.removeMarkers,MarkerClusterer.prototype.resetViewport=MarkerClusterer.prototype.resetViewport,MarkerClusterer.prototype.repaint=MarkerClusterer.prototype.repaint,MarkerClusterer.prototype.setCalculator=MarkerClusterer.prototype.setCalculator,MarkerClusterer.prototype.setGridSize=MarkerClusterer.prototype.setGridSize,MarkerClusterer.prototype.setMaxZoom=MarkerClusterer.prototype.setMaxZoom,MarkerClusterer.prototype.onAdd=MarkerClusterer.prototype.onAdd,MarkerClusterer.prototype.draw=MarkerClusterer.prototype.draw,Cluster.prototype.getCenter=Cluster.prototype.getCenter,Cluster.prototype.getSize=Cluster.prototype.getSize,Cluster.prototype.getMarkers=Cluster.prototype.getMarkers,ClusterIcon.prototype.onAdd=ClusterIcon.prototype.onAdd,ClusterIcon.prototype.draw=ClusterIcon.prototype.draw,ClusterIcon.prototype.onRemove=ClusterIcon.prototype.onRemove,function(e){var t=function(){this.markers=[],this.mainMarker=!1,this.icon="https://www.google.com/mapfiles/marker.png"};t.prototype.dist=function(e){return Math.sqrt(Math.pow(this.markers[0].latitude-e.latitude,2)+Math.pow(this.markers[0].longitude-e.longitude,2))},t.prototype.setIcon=function(e){this.icon=e},t.prototype.addMarker=function(e){this.markers[this.markers.length]=e},t.prototype.getMarker=function(){return this.mainmarker?this.mainmarker:(1<this.markers.length?(e=new r.MarkerImage("https://thydzik.com/thydzikGoogleMap/markerlink.php?text="+this.markers.length+"&color=EF9D3F"),t="cluster of "+this.markers.length+" markers"):(e=new r.MarkerImage(this.icon),t=this.markers[0].title),this.mainmarker=new r.Marker({position:new r.LatLng(this.markers[0].latitude,this.markers[0].longitude),icon:e,title:t,map:null}));var e,t};var r=google.maps,o=new r.Geocoder,i=0,s=0,n={};n={init:function(t){var o,i=e.extend({},e.fn.gMapResp.defaults,t);for(o in e.fn.gMapResp.defaults.icon)i.icon[o]||(i.icon[o]=e.fn.gMapResp.defaults.icon[o]);return this.each(function(){var t=e(this);o=n._getMapCenter.apply(t,[i]),"fit"==i.zoom&&(i.zoomFit=!0,i.zoom=n._autoZoom.apply(t,[i]));var s={zoom:i.zoom,center:o,mapTypeControl:i.mapTypeControl,mapTypeControlOptions:{},zoomControl:i.zoomControl,draggable:i.draggable,zoomControlOptions:{},scaleControl:i.scaleControl,scaleControlOptions:{},streetViewControl:i.streetViewControl,streetViewControlOptions:{},fullscreenControl:i.fullscreenControl,mapTypeId:i.maptype,scrollwheel:i.scrollwheel,maxZoom:i.maxZoom,minZoom:i.minZoom};if(i.controlsPositions.mapType&&(s.mapTypeControlOptions.position=i.controlsPositions.mapType),i.controlsPositions.zoom&&(s.zoomControlOptions.position=i.controlsPositions.zoom),i.controlsPositions.scale&&(s.scaleControlOptions.position=i.controlsPositions.scale),i.controlsPositions.streetView&&(s.streetViewControlOptions.position=i.controlsPositions.streetView),i.styles&&(s.styles=i.styles),s.mapTypeControlOptions.style=i.controlsStyle.mapType,s.zoomControlOptions.style=i.controlsStyle.zoom,s=new r.Map(this,s),i.log&&console.log("map center is:"),i.log&&console.log(o),t.data("$gmap",s),t.data("gmap",{opts:i,gmap:s,markers:[],markerKeys:{},infoWindow:null,clusters:[]}),0!==i.controls.length)for(o=0;o<i.controls.length;o+=1)s.controls[i.controls[o].pos].push(i.controls[o].div);i.clustering.enabled?((o=t.data("gmap")).markers=i.markers,n._renderCluster.apply(t,[]),r.event.addListener(s,"bounds_changed",function(){n._renderCluster.apply(t,[])})):0!==i.markers.length&&n.addMarkers.apply(t,[i.markers]),n._onComplete.apply(t,[])})},_delayedMode:!1,_onComplete:function(){var e=this.data("gmap"),t=this;if(0===i){if(n._delayedMode){var r=n._getMapCenter.apply(this,[e.opts,!0]);if(void 0!==r&&[r]!=[0,0]&&n._setMapCenter.apply(this,[r]),e.opts.zoomFit){var o=n._autoZoom.apply(this,[e.opts,!0]);e.gmap.setZoom(o)}}e.opts.onComplete()}else window.setTimeout(function(){n._onComplete.apply(t,[])},100)},_setMapCenter:function(e){var t=this.data("gmap");if(t&&t.opts.log&&console.log("delayed setMapCenter called"),t&&void 0!==t.gmap&&0==i)void 0!==e&&[e]!=[0,0]&&t.gmap.setCenter(e);else{var r=this;window.setTimeout(function(){void 0!==e&&[e]!=[0,0]&&n._setMapCenter.apply(r,[e])},100)}},_boundaries:null,_getBoundaries:function(e){var t,r=e.markers,o=1e3,i=-1e3,s=1e3,a=-1e3;if(r){for(t=0;t<r.length;t+=1)r[t].latitude&&r[t].longitude&&(o>r[t].latitude&&(o=r[t].latitude),i<r[t].longitude&&(i=r[t].longitude),s>r[t].longitude&&(s=r[t].longitude),a<r[t].latitude&&(a=r[t].latitude),e.log&&console.log(r[t].latitude,r[t].longitude,o,i,s,a));n._boundaries={N:o,E:i,W:s,S:a}}return-1e3==o&&(n._boundaries={N:0,E:0,W:0,S:0}),n._boundaries},_getBoundariesFromMarkers:function(){var e,t=this.data("gmap").markers,r=1e3,o=-1e3,i=1e3,s=-1e3;if(t){for(e=0;e<t.length;e+=1)r>t[e].getPosition().lat()&&(r=t[e].getPosition().lat()),o<t[e].getPosition().lng()&&(o=t[e].getPosition().lng()),i>t[e].getPosition().lng()&&(i=t[e].getPosition().lng()),s<t[e].getPosition().lat()&&(s=t[e].getPosition().lat());n._boundaries={N:r,E:o,W:i,S:s}}return-1e3==r&&(n._boundaries={N:0,E:0,W:0,S:0}),n._boundaries},_getMapCenter:function(e,t){var i,s,a,l,p=this;if(e.markers.length&&("fit"==e.latitude||"fit"==e.longitude))return t&&(e.markers=n._convertMarkers(data.markers)),l=n._getBoundaries(e),i=new r.LatLng((l.N+l.S)/2,(l.E+l.W)/2),e.log&&console.log(t,l,i),i;if(i=new r.LatLng(0,0),e.latitude&&e.longitude)return i=new r.LatLng(e.latitude,e.longitude);if(e.markers.length>0){for(a=null,s=0;s<e.markers.length;s+=1)if(e.markers[s].setCenter){a=e.markers[s];break}if(null===a)for(s=0;s<e.markers.length;s+=1){if(e.markers[s].latitude&&e.markers[s].longitude){a=e.markers[s];break}if(e.markers[s].address){a=e.markers[s];break}}if(null===a)return i;if(a.latitude&&a.longitude)return new r.LatLng(a.latitude,a.longitude);a.address&&o.geocode({address:a.address},function(t,r){r===google.maps.GeocoderStatus.OK?n._setMapCenter.apply(p,[t[0].geometry.location]):e.log&&console.log("Geocode was not successful for the following reason: "+r)})}},_renderCluster:function(){var e,r=this.data("gmap"),o=r.markers,i=r.clusters,s=r.opts;for(e=0;e<i.length;e+=1)i[e].getMarker().setMap(null);if(i.length=0,e=r.gmap.getBounds()){var a=e.getNorthEast(),l=e.getSouthWest(),p=[],u=(a.lat()-l.lat())*s.clustering.clusterSize/100;for(e=0;e<o.length;e+=1)o[e].latitude<a.lat()&&o[e].latitude>l.lat()&&o[e].longitude<a.lng()&&o[e].longitude>l.lng()&&(p[p.length]=o[e]);for(s.log&&console.log("number of markers "+p.length+"/"+o.length),s.log&&console.log("cluster radius: "+u),e=0;e<p.length;e+=1){for(a=-1,o=0;o<i.length&&!((l=i[o].dist(p[e]))<u&&(a=o,s.clustering.fastClustering));o+=1);-1===a?((o=new t).addMarker(p[e]),i[i.length]=o):i[a].addMarker(p[e])}for(s.log&&console.log("Total clusters in viewport: "+i.length),o=0;o<i.length;o+=1)i[o].getMarker().setMap(r.gmap)}else{var h=this;window.setTimeout(function(){n._renderCluster.apply(h)},1e3)}},_processMarker:function(e,t,o,i){var s,n,a=this.data("gmap"),l=a.gmap,p=a.opts;if(void 0===i&&(i=new r.LatLng(e.latitude,e.longitude)),!t){var u={image:p.icon.image,iconSize:new r.Size(p.icon.iconsize[0],p.icon.iconsize[1]),iconAnchor:new r.Point(p.icon.iconanchor[0],p.icon.iconanchor[1]),infoWindowAnchor:new r.Size(p.icon.infowindowanchor[0],p.icon.infowindowanchor[1])};t=new r.MarkerImage(u.image,u.iconSize,null,u.iconAnchor)}o||(new r.Size(p.icon.shadowsize[0],p.icon.shadowsize[1]),u&&u.iconAnchor||new r.Point(p.icon.iconanchor[0],p.icon.iconanchor[1])),t={position:i,icon:t,title:e.title,map:null,draggable:!0===e.draggable},p.clustering.enabled||(t.map=l),(s=new r.Marker(t)).setShadow(o),a.markers.push(s),e.key&&(a.markerKeys[e.key]=s),e.html&&(o={content:"string"==typeof e.html?p.html_prepend+e.html+p.html_append:e.html,pixelOffset:e.infoWindowAnchor},p.log&&console.log("setup popup with data"),p.log&&console.log(o),n=new r.InfoWindow(o),r.event.addListener(s,"click",function(){p.log&&console.log("opening popup "+e.html),p.singleInfoWindow&&a.infoWindow&&a.infoWindow.close(),n.open(l,s),a.infoWindow=n})),e.html&&e.popup&&(p.log&&console.log("opening popup "+e.html),n.open(l,s),a.infoWindow=n),e.onDragEnd&&r.event.addListener(s,"dragend",function(t){p.log&&console.log("drag end"),e.onDragEnd(t)})},_geocodeMarker:function(e,t,a){var l=this;o.geocode({address:e.address},function(o,p){p===r.GeocoderStatus.OK?(i-=1,l.data("gmap").opts.log&&console.log("Geocode was successful with point: ",o[0].geometry.location),n._processMarker.apply(l,[e,t,a,o[0].geometry.location])):(p===r.GeocoderStatus.OVER_QUERY_LIMIT&&(!l.data("gmap").opts.noAlerts&&0===s&&alert("Error: too many geocoded addresses! Switching to 1 marker/s mode."),s+=1e3,window.setTimeout(function(){n._geocodeMarker.apply(l,[e,t,a])},s)),l.data("gmap").opts.log&&console.log("Geocode was not successful for the following reason: "+p))})},_autoZoom:function(t,r){var o,i,s=e(this).data("gmap"),a=e.extend({},s?s.opts:{},t);s=39135.758482;for(a.log&&console.log("autozooming map"),a=111e3*((o=r?n._getBoundariesFromMarkers.apply(this):n._getBoundaries(a)).E-o.W)/this.width(),i=111e3*(o.S-o.N)/this.height(),o=2;20>o&&!(a>s||i>s);o+=1)s/=2;return o-1},addMarkers:function(e){var t=this.data("gmap").opts;if(0!==e.length)for(t.log&&console.log("adding "+e.length+" markers"),t=0;t<e.length;t+=1)n.addMarker.apply(this,[e[t]])},addMarker:function(e){var t=this.data("gmap").opts;t.log&&console.log("putting marker at "+e.latitude+", "+e.longitude+" with address "+e.address+" and html "+e.html);var o=t.icon.image,s=new r.Size(t.icon.iconsize[0],t.icon.iconsize[1]),a=(new r.Point(t.icon.iconanchor[0],t.icon.iconanchor[1]),new r.Size(t.icon.infowindowanchor[0],t.icon.infowindowanchor[1])),l=t.icon.shadow,p=new r.Size(t.icon.shadowsize[0],t.icon.shadowsize[1]),u=new r.Point(t.icon.shadowanchor[0],t.icon.shadowanchor[1]);e.infoWindowAnchor=a,e.icon&&(e.icon.image&&(o=e.icon.image),e.icon.iconsize&&(s=new r.Size(e.icon.iconsize[0],e.icon.iconsize[1])),e.icon.iconanchor&&new r.Point(e.icon.iconanchor[0],e.icon.iconanchor[1]),e.icon.infowindowanchor&&new r.Size(e.icon.infowindowanchor[0],e.icon.infowindowanchor[1]),e.icon.shadow&&(l=e.icon.shadow),e.icon.shadowsize&&(p=new r.Size(e.icon.shadowsize[0],e.icon.shadowsize[1])),e.icon.shadowanchor&&(u=new r.Point(e.icon.shadowanchor[0],e.icon.shadowanchor[1]))),o=void 0===e.icon.iconsize?new r.MarkerImage(o):new r.MarkerImage(o,null,null,null,s),l=new r.MarkerImage(l,p,null,u),e.address?("_address"===e.html&&(e.html=e.address),"_address"==e.title&&(e.title=e.address),t.log&&console.log("geocoding marker: "+e.address),i+=1,n._delayedMode=!0,n._geocodeMarker.apply(this,[e,o,l])):("_latlng"===e.html&&(e.html=e.latitude+", "+e.longitude),"_latlng"==e.title&&(e.title=e.latitude+", "+e.longitude),t=new r.LatLng(e.latitude,e.longitude),n._processMarker.apply(this,[e,o,l,t]))},removeAllMarkers:function(){var e,t=this.data("gmap").markers;for(e=0;e<t.length;e+=1)t[e].setMap(null),delete t[e];t.length=0},getMarker:function(e){return this.data("gmap").markerKeys[e]},fixAfterResize:function(e){var t=this.data("gmap");if(void 0!==t){r.event.trigger(t.gmap,"resize");var o=this.gMapResp("_getMapCenter",t.opts);void 0!==o&&[o]!=[0,0]&&t.gmap.panTo(o)}},setZoom:function(e,t,r){var o=this.data("gmap").gmap;"fit"===e&&(e=n._autoZoom.apply(this,[t,r])),o.setZoom(parseInt(e))},changeSettings:function(e){var t,r=this.data("gmap"),o=[];for(t=0;t<r.markers.length;t+=1)o[t]={latitude:r.markers[t].getPosition().lat(),longitude:r.markers[t].getPosition().lng()};if(e.markers=o,e.zoom&&n.setZoom.apply(this,[e.zoom,e]),e.latitude||e.longitude){var i=n._getMapCenter.apply(this,[e]);void 0!==i&&[i]!=[0,0]&&r.gmap.panTo(i)}},mapclick:function(e){google.maps.event.addListener(this.data("gmap").gmap,"click",function(t){e(t.latLng)})},geocode:function(e,t,i){o.geocode({address:e},function(e,o){o===r.GeocoderStatus.OK?t(e[0].geometry.location):i&&i(e,o)})},getRoute:function(t){var o,i,s=this.data("gmap"),n=s.gmap,a=new r.DirectionsRenderer,l=new r.DirectionsService,p={BYCAR:r.DirectionsTravelMode.DRIVING,BYBICYCLE:r.DirectionsTravelMode.BICYCLING,BYFOOT:r.DirectionsTravelMode.WALKING},u={MILES:r.DirectionsUnitSystem.IMPERIAL,KM:r.DirectionsUnitSystem.METRIC},h=null;return void 0!==t.routeDisplay?h=t.routeDisplay instanceof jQuery?t.routeDisplay[0]:"string"==typeof t.routeDisplay?e(t.routeDisplay)[0]:null:null!==s.opts.routeFinder.routeDisplay&&(h=s.opts.routeFinder.routeDisplay instanceof jQuery?s.opts.routeFinder.routeDisplay[0]:"string"==typeof s.opts.routeFinder.routeDisplay?e(s.opts.routeFinder.routeDisplay)[0]:null),a.setMap(n),null!==h&&a.setPanel(h),o=void 0!==p[s.opts.routeFinder.travelMode]?p[s.opts.routeFinder.travelMode]:p.BYCAR,i=void 0!==u[s.opts.routeFinder.travelUnit]?u[s.opts.routeFinder.travelUnit]:u.KM,l.route({origin:t.from,destination:t.to,travelMode:o,unitSystem:i},function(t,o){o==r.DirectionsStatus.OK?a.setDirections(t):null!==h&&e(h).html(s.opts.routeFinder.routeErrors[o])}),this}};e.fn.gMapResp=function(t){return n[t]?n[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist on jQuery.gmap"):n.init.apply(this,arguments)},e.fn.gMapResp.defaults={log:!1,noAlerts:!0,address:"",latitude:null,longitude:null,zoom:3,maxZoom:null,minZoom:null,markers:[],controls:{},scrollwheel:!0,maptype:google.maps.MapTypeId.ROADMAP,mapTypeControl:!0,zoomControl:!0,draggable:!0,scaleControl:!1,streetViewControl:!0,fullscreenControl:!0,controlsPositions:{mapType:null,zoom:null,scale:null,streetView:null},controlsStyle:{mapType:google.maps.MapTypeControlStyle.DEFAULT,zoom:google.maps.ZoomControlStyle.DEFAULT},singleInfoWindow:!0,html_prepend:'<div class="gmap_marker">',html_append:"</div>",icon:{image:"https://www.google.com/mapfiles/marker.png",iconsize:[20,34],iconanchor:[9,34],infowindowanchor:[0,0],shadow:"https://www.google.com/mapfiles/shadow50.png",shadowsize:[37,34],shadowanchor:[9,34]},onComplete:function(){},routeFinder:{travelMode:"BYCAR",travelUnit:"KM",routeDisplay:null,routeErrors:{INVALID_REQUEST:"The provided request is invalid.",NOT_FOUND:"One or more of the given addresses could not be found.",OVER_QUERY_LIMIT:"A temporary error occured. Please try again in a few minutes.",REQUEST_DENIED:"An error occured. Please contact us.",UNKNOWN_ERROR:"An unknown error occured. Please try again.",ZERO_RESULTS:"No route could be found within the given addresses."}},clustering:{enabled:!1,fastClustering:!1,clusterCount:10,clusterSize:40}}}(jQuery),function(){function e(){}function t(e){return s.retinaImageSuffix+e}function r(e,r){if(this.path=e||"",null!=r)this.at_2x_path=r,this.perform_check=!1;else{if(void 0!==document.createElement){var o=document.createElement("a");o.href=this.path,o.pathname=o.pathname.replace(n,t),this.at_2x_path=o.href}else{var i=this.path.split("?");i[0]=i[0].replace(n,t),this.at_2x_path=i.join("?")}this.perform_check=!0}}function o(e){this.el=e,this.path=new r(this.el.getAttribute("src"),this.el.getAttribute("data-at2x"));var t=this;this.path.check_2x_variant(function(e){e&&t.swap()})}var i="undefined"==typeof exports?window:exports,s={retinaImageSuffix:"@2x",check_mime_type:!0,force_original_dimensions:!0};i.Retina=e,e.configure=function(e){for(var t in null===e&&(e={}),e)e.hasOwnProperty(t)&&(s[t]=e[t])},e.init=function(e){null===e&&(e=i);var t=e.onload||function(){};e.onload=function(){var e,r,i=document.getElementsByTagName("img"),s=[];for(e=0;e<i.length;e+=1)(r=i[e]).getAttributeNode("data-no-retina")||s.push(new o(r));t()}},e.isRetina=function(){return i.devicePixelRatio>1||!(!i.matchMedia||!i.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)").matches)};var n=/\.\w+$/;i.RetinaImagePath=r,r.confirmed_paths=[],r.prototype.is_external=function(){return!(!this.path.match(/^https?\:/i)||this.path.match("//"+document.domain))},r.prototype.check_2x_variant=function(e){var t,o=this;return this.is_external()?e(!1):this.perform_check||void 0===this.at_2x_path||null===this.at_2x_path?this.at_2x_path in r.confirmed_paths?e(!0):((t=new XMLHttpRequest).open("HEAD",this.at_2x_path),t.onreadystatechange=function(){if(4!==t.readyState)return e(!1);if(t.status>=200&&t.status<=399){if(s.check_mime_type){var i=t.getResponseHeader("Content-Type");if(null===i||!i.match(/^image/i))return e(!1)}return r.confirmed_paths.push(o.at_2x_path),e(!0)}return e(!1)},void t.send()):e(!0)},i.RetinaImage=o,o.prototype.swap=function(e){void 0===e&&(e=this.path.at_2x_path);var t=this;!function r(){t.el.complete?(s.force_original_dimensions&&(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight)),t.el.setAttribute("src",e)):setTimeout(r,5)}()},e.isRetina()&&e.init(i)}();
Save