-
Notifications
You must be signed in to change notification settings - Fork 0
/
DevGoogleMaps.min.js
1 lines (1 loc) · 2.06 KB
/
DevGoogleMaps.min.js
1
!function(e,o,a,n){e.fn.DevGoogleMaps=function(){if(e.fn.gmap3){var a,n=e.now();return function(t,s,i,r){if(a)return a;var l=e.Deferred(),g=function(){l.resolve(o.google&&o.google.maps?o.google.maps:!1)},c="loadGoogleMaps_"+n++;return s=e.extend({sensor:r||"false"},s?{key:s}:{},i?{language:i}:{}),o.google&&o.google.maps?g():o.google&&o.google.load?o.google.load("maps",t||3,{other_params:e.param(s),callback:g}):(s=e.extend(s,{v:t||3,callback:c}),o[c]=function(){g(),setTimeout(function(){try{delete o[c]}catch(e){}},20)},e.ajax({dataType:"script",data:s,url:"//maps.googleapis.com/maps/api/js"})),a=l.promise()}().done(e.proxy(function(){this.each(function(){var a,n,t,s={},i=e(this).data(),r=[];for(t in i)switch(t){case"center":s[t]=i[t].split(",");break;case"parallaxmap":i[t]===!0&&(a=!0);break;case"mapTypeId":s[t]=o.google.maps.MapTypeId[i[t]];break;case"markers":r=e.map(i[t]||[],function(e){var o;return o="undefined"!=typeof e.bounced?"BOUNCE"==e.bounced?google.maps.Animation.BOUNCE:"DROP"==e.bounced?google.maps.Animation.DROP:!1:!1,{latLng:[e.lat,e.lng],data:e.data?e.data:!1,options:{animation:o!==!1?o:!1,icon:e.icon?new google.maps.MarkerImage(e.icon):new google.maps.MarkerImage("https://www.google.com/mapfiles/marker_black.png")}}});break;case"background":n=i[t];break;case"monochrome":i[t]&&(s.styles=[{stylers:[{saturation:i.saturation},{hue:i.background}]}]);break;default:s[t]=i[t]}e(this).gmap3({map:{options:s,events:{idle:function(){if(1==a){var o=e(this).gmap3("get"),n=$(o.getDiv()).offset();google.maps.event.clearListeners(o,"idle"),o.panBy(($(window).scrollLeft()-n.left)/4,($(window).scrollTop()-n.top)/4),google.maps.event.addDomListener(window,"scroll",function(){var e=$(window).scrollTop(),a=$(window).scrollLeft(),n=o.get("scroll");n&&o.panBy(-((n.x-a)/3),-((n.y-e)/3)),o.set("scroll",{x:a,y:e})})}}}},marker:{values:r,events:{click:function(o,a,n){var t=e(this).gmap3("get"),s=e(this).gmap3({get:{name:"infowindow"}});s?(s.open(t,o),s.setContent(n.data)):e(this).gmap3({infowindow:{anchor:o,options:{content:n.data}}})}}}})})},this)),this}}}(jQuery,window,document);