TanchoToplineCargo/public/topCargo/assets/js/gmap.js

2 lines
30 KiB
JavaScript
Raw Normal View History

2024-05-05 04:47:49 +00:00
"use strict";!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd&&define("GMaps",[],b),a.GMaps=b()}(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 a=function(a,b){var c;if(a===b)return a;for(c in b)a[c]=b[c];return a},b=function(a,b){var c,d=Array.prototype.slice.call(arguments,2),e=[],f=a.length;if(Array.prototype.map&&a.map===Array.prototype.map)e=Array.prototype.map.call(a,function(a){var c=d.slice(0);return c.splice(0,0,a),b.apply(this,c)});else for(c=0;f>c;c++)callback_params=d,callback_params.splice(0,0,a[c]),e.push(b.apply(this,callback_params));return e},c=function(a){var b,c=[];for(b=0;b<a.length;b++)c=c.concat(a[b]);return c},d=function(a,b){var c=a[0],d=a[1];return b&&(c=a[1],d=a[0]),new google.maps.LatLng(c,d)},f=function(a,b){var c;for(c=0;c<a.length;c++)a[c]instanceof google.maps.LatLng||(a[c].length>0&&"object"==typeof a[c][0]?a[c]=f(a[c],b):a[c]=d(a[c],b));return a},g=function(a,b){var c,d=a.replace(".","");return c="jQuery"in this&&b?$("."+d,b)[0]:document.getElementsByClassName(d)[0]},h=function(a,b){var c,a=a.replace("#","");return c="jQuery"in window&&b?$("#"+a,b)[0]:document.getElementById(a)},i=function(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return[b,c]},j=function(b){var c=document,d=function(b){if(!this)return new d(b);b.zoom=b.zoom||15,b.mapType=b.mapType||"roadmap";var e,f=this,j=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],k=["mousemove","mouseout","mouseover"],l=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],m=b.el||b.div,n=b.markerClusterer,o=google.maps.MapTypeId[b.mapType.toUpperCase()],p=new google.maps.LatLng(b.lat,b.lng),q=b.zoomControl||!0,r=b.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},s=r.style||"DEFAULT",t=r.position||"TOP_LEFT",u=b.panControl||!0,v=b.mapTypeControl||!0,w=b.scaleControl||!0,x=b.streetViewControl||!0,y=y||!0,z={},A={zoom:this.zoom,center:p,mapTypeId:o},B={panControl:u,zoomControl:q,zoomControlOptions:{style:google.maps.ZoomControlStyle[s],position:google.maps.ControlPosition[t]},mapTypeControl:v,scaleControl:w,streetViewControl:x,overviewMapControl:y};if("string"==typeof b.el||"string"==typeof b.div?m.indexOf("#")>-1?this.el=h(m,b.context):this.el=g.apply(this,[m,b.context]):this.el=m,"undefined"==typeof this.el||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[f.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=b.zoom,this.registered_events={},this.el.style.width=b.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=b.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=b.enableNewStyle,e=0;e<l.length;e++)delete b[l[e]];for(1!=b.disableDefaultUI&&(A=a(A,B)),z=a(A,b),e=0;e<j.length;e++)delete z[j[e]];for(e=0;e<k.length;e++)delete z[k[e]];this.map=new google.maps.Map(this.el,z),n&&(this.markerClusterer=n.apply(this,[this.map]));var C=function(a,b){var c="",d=window.context_menu[f.el.id][a];for(var e in d)if(d.hasOwnProperty(e)){var g=d[e];c+='<li><a id="'+a+"_"+e+'" href="#">'+g.title+"</a></li>"}if(h("gmaps_context_menu")){var j=h("gmaps_context_menu");j.innerHTML=c;var e,k=j.getElementsByTagName("a"),l=k.length;for(e=0;l>e;e++){var m=k[e],n=function(c){c.preventDefault(),d[this.id.replace(a+"_","")].action.apply(f,[b]),f.hideContextMenu()};google.maps.event.clearListeners(m,"click"),google.maps.event.addDomListenerOnce(m,"click",n,!1)}var o=i.apply(this,[f.el]),p=o[0]+b.pixel.x-15,q=o[1]+b.pixel.y-15;j.style.left=p+"px",j.style.top=q+"px",j.style.display="block"}};this.buildContextMenu=function(a,b){if
//# sourceMappingURL=gmaps.min.js.map