This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
memberdb/public/theme/frontend/metronic/plugins/gmaps/gmaps.min.js

1 line
29 KiB
JavaScript
Raw Permalink Normal View History

!function(e,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd&&define("GMaps",[],t),e.GMaps=t()}(this,function(){if("object"!=typeof window.google||!window.google.maps)throw"Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.";var t=function(e,t){var o;if(e===t)return e;for(o in t)e[o]=t[o];return e},o=function(e,t){var o,n=Array.prototype.slice.call(arguments,2),r=[],s=e.length;if(Array.prototype.map&&e.map===Array.prototype.map)r=Array.prototype.map.call(e,function(e){return callback_params=n,callback_params.splice(0,0,e),t.apply(this,callback_params)});else for(o=0;s>o;o++)callback_params=n,callback_params.splice(0,0,e[o]),r.push(t.apply(this,callback_params));return r},n=function(e){var t,o=[];for(t=0;t<e.length;t++)o=o.concat(e[t]);return o},r=function(e,t){var o=e[0],n=e[1];return t&&(o=e[1],n=e[0]),new google.maps.LatLng(o,n)},s=function(e,t){var o;for(o=0;o<e.length;o++)e[o]instanceof google.maps.LatLng||(e[o]=e[o].length>0&&"object"==typeof e[o][0]?s(e[o],t):r(e[o],t));return e},i=function(e,t){var o,e=e.replace("#","");return o="jQuery"in this&&t?$("#"+e,t)[0]:document.getElementById(e)},a=function(e){var t=0,o=0;if(e.offsetParent)do t+=e.offsetLeft,o+=e.offsetTop;while(e=e.offsetParent);return[t,o]},l=function(){"use strict";var e=document,o=function(n){if(!this)return new o(n);n.zoom=n.zoom||15,n.mapType=n.mapType||"roadmap";var r,s=this,l=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],p=["mousemove","mouseout","mouseover"],g=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],c=n.el||n.div,h=n.markerClusterer,u=google.maps.MapTypeId[n.mapType.toUpperCase()],d=new google.maps.LatLng(n.lat,n.lng),f=n.zoomControl||!0,m=n.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},y=m.style||"DEFAULT",v=m.position||"TOP_LEFT",k=n.panControl||!0,w=n.mapTypeControl||!0,L=n.scaleControl||!0,b=n.streetViewControl||!0,_=_||!0,M={},x={zoom:this.zoom,center:d,mapTypeId:u},C={panControl:k,zoomControl:f,zoomControlOptions:{style:google.maps.ZoomControlStyle[y],position:google.maps.ControlPosition[v]},mapTypeControl:w,scaleControl:L,streetViewControl:b,overviewMapControl:_};if(this.el="string"==typeof n.el||"string"==typeof n.div?i(c,n.context):c,"undefined"==typeof this.el||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[s.el.id]={},this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=n.zoom,this.registered_events={},this.el.style.width=n.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=n.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=n.enableNewStyle,r=0;r<g.length;r++)delete n[g[r]];for(1!=n.disableDefaultUI&&(x=t(x,C)),M=t(x,n),r=0;r<l.length;r++)delete M[l[r]];for(r=0;r<p.length;r++)delete M[p[r]];this.map=new google.maps.Map(this.el,M),h&&(this.markerClusterer=h.apply(this,[this.map]));var P=function(e,t){var o="",n=window.context_menu[s.el.id][e];for(var r in n)if(n.hasOwnProperty(r)){var l=n[r];o+='<li><a id="'+e+"_"+r+'" href="#">'+l.title+"</a></li>"}if(i("gmaps_context_menu")){var p=i("gmaps_context_menu");p.innerHTML=o;var r,g=p.getElementsByTagName("a"),c=g.length;for(r=0;c>r;r++){var h=g[r],u=function(o){o.preventDefault(),n[this.id.replace(e+"_","")].action.apply(s,[t]),s.hideContextMenu()};google.maps.event.clearListeners(h,"click"),google.maps.event.addDomListenerOnce(h,"click",u,!1)}var d=a.apply(this,[s.el]),f=d[0]+t.pixel.x-15,m=d[1]+t.pixel.y-15;p.style.left=f+"px",p.style.top=m+"px",p.style.display="block"}};this.buildContextMenu=function(e,t){if("marker"===e){t.pixel={};var o=new google.maps.OverlayView;o.setMap(s.map),o.draw=function(){var n=o.getProjection(),r=t.marker.getPosition();t.pixel=n.fromLatLngT