-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.gmap-3.min.js
5 lines (5 loc) · 1.42 KB
/
jquery.gmap-3.min.js
1
2
3
4
5
/**
* @author Thomas <[email protected]>
* @licence Solire <http://www.solire.fr>
*/
(function(b){var a="gmap-id",c={};b.fn.gmap=function(f){if(f==null&&this.attr(a)!=null){return c[this.attr(a)]}var i={center:{lat:0,lng:-180},zoom:15,streetViewControl:false,panControl:false,overviewMapControl:false,disableDoubleClickZoom:true,mapTypeId:google.maps.MapTypeId.ROADMAP},g=b.extend({},i,f),d=g.center,h=null;if(typeof d.lat!="function"){g.center=new google.maps.LatLng(d.lat,d.lng)}function k(o){var p="",n=0,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(n=0;n<o;n++){p+=m.charAt(Math.floor(Math.random()*m.length))}return p}function l(m,n){do{tmpId=k(10)}while(b("["+m+'="'+n+tmpId+'"]').length>0);return n+tmpId}function j(m,n){return new google.maps.Map(m,n)}function e(n){var m={map:n,markers:{},infoWindows:{},count:0,addMarker:function(t,p,s){var r=new google.maps.LatLng(t,p),o=new google.maps.Marker({map:n,position:r}),q=null;if(typeof s!="undefined"&&s!=null){q=new google.maps.InfoWindow({content:s,position:r});this.infoWindows[this.count]=q;google.maps.event.addListener(o,"click",function(u){q.open(this.map)})}this.markers[this.count]=o;this.count++;return o}};return m}this.each(function(){var p=this,m=b(p),o=b.extend({},g,{center:null}),r=l(a,"solire-jquery-gmap-"),q,n;m.attr(a,r);o.center=new google.maps.LatLng(g.center.lat(),g.center.lng());q=j(p,o);n=e(q);if(h==null){h=n}c[r]=n});return h}})(jQuery);