PATH:
home
/
letacommog
/
entrepro
/
wp-content
/
plugins
/
geo-my-wp
/
assets
/
lib
/
google
/
markerspiderfier
(function(){var t,r,e,i,n,s,a={}.hasOwnProperty,o=[].slice;this.OverlappingMarkerSpiderfier=function(){function t(t,i){var n,o,h,c;this.map=t,null==i&&(i={}),null==this.constructor.hasInitialized&&(this.constructor.hasInitialized=!0,e=google.maps,r=e.event,s=e.MapTypeId,l.keepSpiderfied=!1,l.ignoreMapClick=!1,l.markersWontHide=!1,l.markersWontMove=!1,l.basicFormatEvents=!1,l.nearbyDistance=20,l.circleSpiralSwitchover=9,l.circleFootSeparation=23,l.circleStartAngle=u/12,l.spiralFootSeparation=26,l.spiralLengthStart=11,l.spiralLengthFactor=4,l.spiderfiedZIndex=e.Marker.MAX_ZINDEX+2e4,l.highlightedLegZIndex=e.Marker.MAX_ZINDEX+1e4,l.usualLegZIndex=e.Marker.MAX_ZINDEX+1,l.legWeight=1.5,l.legColors={usual:{},highlighted:{}},h=l.legColors.usual,o=l.legColors.highlighted,h[s.HYBRID]=h[s.SATELLITE]="#fff",o[s.HYBRID]=o[s.SATELLITE]="#f00",h[s.TERRAIN]=h[s.ROADMAP]="#444",o[s.TERRAIN]=o[s.ROADMAP]="#f00",this.constructor.ProjHelper=function(t){return this.setMap(t)},this.constructor.ProjHelper.prototype=new e.OverlayView,this.constructor.ProjHelper.prototype.draw=function(){});for(n in i)a.call(i,n)&&(c=i[n],this[n]=c);this.projHelper=new this.constructor.ProjHelper(this.map),this.initMarkerArrays(),this.listeners={},this.formatIdleListener=this.formatTimeoutId=null,this.addListener("click",function(t,e){return r.trigger(t,"spider_click",e)}),this.addListener("format",function(t,e){return r.trigger(t,"spider_format",e)}),this.ignoreMapClick||r.addListener(this.map,"click",function(t){return function(){return t.unspiderfy()}}(this)),r.addListener(this.map,"maptypeid_changed",function(t){return function(){return t.unspiderfy()}}(this)),r.addListener(this.map,"zoom_changed",function(t){return function(){return t.unspiderfy(),t.basicFormatEvents?void 0:t.formatMarkers()}}(this))}var r,e,i,n,s,l,h,u,c;for(l=t.prototype,h=[t,l],i=0,n=h.length;n>i;i++)c=h[i],c.VERSION="1.0.3";return u=2*Math.PI,e=r=s=null,t.markerStatus={SPIDERFIED:"SPIDERFIED",SPIDERFIABLE:"SPIDERFIABLE",UNSPIDERFIABLE:"UNSPIDERFIABLE",UNSPIDERFIED:"UNSPIDERFIED"},l.initMarkerArrays=function(){return this.markers=[],this.markerListenerRefs=[]},l.addMarker=function(t,r){return t.setMap(this.map),this.trackMarker(t,r)},l.trackMarker=function(t,e){var i;return null!=t._oms?this:(t._oms=!0,i=[r.addListener(t,"click",function(r){return function(e){return r.spiderListener(t,e)}}(this))],this.markersWontHide||i.push(r.addListener(t,"visible_changed",function(r){return function(){return r.markerChangeListener(t,!1)}}(this))),this.markersWontMove||i.push(r.addListener(t,"position_changed",function(r){return function(){return r.markerChangeListener(t,!0)}}(this))),null!=e&&i.push(r.addListener(t,"spider_click",e)),this.markerListenerRefs.push(i),this.markers.push(t),this.basicFormatEvents?this.trigger("format",t,this.constructor.markerStatus.UNSPIDERFIED):(this.trigger("format",t,this.constructor.markerStatus.UNSPIDERFIABLE),this.formatMarkers()),this)},l.markerChangeListener=function(t,r){return this.spiderfying||this.unspiderfying?void 0:(null==t._omsData||!r&&t.getVisible()||this.unspiderfy(r?t:null),this.formatMarkers())},l.getMarkers=function(){return this.markers.slice(0)},l.removeMarker=function(t){return this.forgetMarker(t),t.setMap(null)},l.forgetMarker=function(t){var e,i,n,s,a;if(null!=t._omsData&&this.unspiderfy(),e=this.arrIndexOf(this.markers,t),0>e)return this;for(a=this.markerListenerRefs.splice(e,1)[0],i=0,n=a.length;n>i;i++)s=a[i],r.removeListener(s);return delete t._oms,this.markers.splice(e,1),this.formatMarkers(),this},l.removeAllMarkers=l.clearMarkers=function(){var t,r,e,i;for(i=this.getMarkers(),this.forgetAllMarkers(),t=0,r=i.length;r>t;t++)e=i[t],e.setMap(null);return this},l.forgetAllMarkers=function(){var t,e,i,n,s,a,o,l,h;for(this.unspiderfy(),h=this.markers,t=e=0,i=h.length;i>e;t=++e){for(o=h[t],a=this.markerListenerRefs[t],l=0,n=a.length;n>l;l++)s=a[l],r.removeListener(s);delete o._oms}return this.initMarkerArrays(),this},l.addListener=function(t,r){var e;return(null!=(e=this.listeners)[t]?e[t]:e[t]=[]).push(r),this},l.removeListener=function(t,r){var e;return e=this.arrIndexOf(this.listeners[t],r),0>e||this.listeners[t].splice(e,1),this},l.clearListeners=function(t){return this.listeners[t]=[],this},l.trigger=function(){var t,r,e,i,n,s,a,l;for(r=arguments[0],t=2<=arguments.length?o.call(arguments,1):[],a=null!=(s=this.listeners[r])?s:[],l=[],i=0,n=a.length;n>i;i++)e=a[i],l.push(e.apply(null,t));return l},l.generatePtsCircle=function(t,r){var i,n,s,a,o,l,h,c;for(s=this.circleFootSeparation*(2+t),l=s/u,n=u/t,c=[],a=o=0,h=t;h>=0?h>o:o>h;a=h>=0?++o:--o)i=this.circleStartAngle+a*n,c.push(new e.Point(r.x+l*Math.cos(i),r.y+l*Math.sin(i)));return c},l.generatePtsSpiral=function(t,r){var i,n,s,a,o,l,h;for(a=this.spiralLengthStart,i=0,h=[],n=s=0,l=t;l>=0?l>s:s>l;n=l>=0?++s:--s)i+=this.spiralFootSeparation/a+5e-4*n,o=new e.Point(r.x+a*Math.cos(i),r.y+a*Math.sin(i)),a+=u*this.spiralLengthFactor/i,h.push(o);return h},l.spiderListener=function(t,r){var e,i,n,s,a,o,l,h,u,c,f;if(o=null!=t._omsData,o&&this.keepSpiderfied||this.unspiderfy(),o||this.map.getStreetView().getVisible()||"GoogleEarthAPI"===this.map.getMapTypeId())return this.trigger("click",t,r);for(h=[],u=[],l=this.nearbyDistance,c=l*l,a=this.llToPt(t.position),f=this.markers,e=0,i=f.length;i>e;e++)n=f[e],null!=n.map&&n.getVisible()&&(s=this.llToPt(n.position),this.ptDistanceSq(s,a)<c?h.push({marker:n,markerPt:s}):u.push(n));return 1===h.length?this.trigger("click",t,r):this.spiderfy(h,u)},l.markersNearMarker=function(t,r){var e,i,n,s,a,o,l,h,u,c,f;if(null==r&&(r=!1),null==this.projHelper.getProjection())throw"Must wait for 'idle' event on map before calling markersNearMarker";for(l=this.nearbyDistance,h=l*l,a=this.llToPt(t.position),o=[],u=this.markers,e=0,i=u.length;i>e&&(n=u[e],!(n!==t&&null!=n.map&&n.getVisible()&&(s=this.llToPt(null!=(c=null!=(f=n._omsData)?f.usualPosition:void 0)?c:n.position),this.ptDistanceSq(s,a)<h&&(o.push(n),r))));e++);return o},l.markerProximityData=function(){var t,r,e,i,n,s,a,o,l,h,u,c,f,p,g,m;if(null==this.projHelper.getProjection())throw"Must wait for 'idle' event on map before calling markersNearAnyOtherMarker";for(f=this.nearbyDistance,p=f*f,u=function(){var t,r,e,i,n,a;for(e=this.markers,a=[],t=0,r=e.length;r>t;t++)s=e[t],a.push({pt:this.llToPt(null!=(i=null!=(n=s._omsData)?n.usualPosition:void 0)?i:s.position),willSpiderfy:!1});return a}.call(this),g=this.markers,t=e=0,i=g.length;i>e;t=++e)if(a=g[t],null!=a.getMap()&&a.getVisible()&&(o=u[t],!o.willSpiderfy))for(m=this.markers,r=c=0,n=m.length;n>c;r=++c)if(l=m[r],r!==t&&null!=l.getMap()&&l.getVisible()&&(h=u[r],(!(t>r)||h.willSpiderfy)&&this.ptDistanceSq(o.pt,h.pt)<p)){o.willSpiderfy=h.willSpiderfy=!0;break}return u},l.markersNearAnyOtherMarker=function(){var t,r,e,i,n,s,a;for(n=this.markerProximityData(),s=this.markers,a=[],t=r=0,e=s.length;e>r;t=++r)i=s[t],n[t].willSpiderfy&&a.push(i);return a},l.setImmediate=function(t){return window.setTimeout(t,0)},l.formatMarkers=function(){return this.basicFormatEvents||null!=this.formatTimeoutId?void 0:this.formatTimeoutId=this.setImmediate(function(t){return function(){return t.formatTimeoutId=null,null!=t.projHelper.getProjection()?t._formatMarkers():null==t.formatIdleListener?t.formatIdleListener=r.addListenerOnce(t.map,"idle",function(){return t._formatMarkers()}):void 0}}(this))},l._formatMarkers=function(){var t,r,e,i,n,s,a,o,l,h,u;if(this.basicFormatEvents){for(l=[],r=0,e=markers.length;e>r;r++)n=markers[r],u=null!=n._omsData?"SPIDERFIED":"UNSPIDERFIED",l.push(this.trigger("format",n,this.constructor.markerStatus[u]));return l}for(a=this.markerProximityData(),o=this.markers,h=[],t=s=0,i=o.length;i>s;t=++s)n=o[t],u=null!=n._omsData?"SPIDERFIED":a[t].willSpiderfy?"SPIDERFIABLE":"UNSPIDERFIABLE",h.push(this.trigger("format",n,this.constructor.markerStatus[u]));return h},l.makeHighlightListenerFuncs=function(t){return{highlight:function(r){return function(){return t._omsData.leg.setOptions({strokeColor:r.legColors.highlighted[r.map.mapTypeId],zIndex:r.highlightedLegZIndex})}}(this),unhighlight:function(r){return function(){return t._omsData.leg.setOptions({strokeColor:r.legColors.usual[r.map.mapTypeId],zIndex:r.usualLegZIndex})}}(this)}},l.spiderfy=function(t,i){var n,s,a,o,l,h,u,c,f,p,g;return this.spiderfying=!0,p=t.length,n=this.ptAverage(function(){var r,e,i;for(i=[],r=0,e=t.length;e>r;r++)c=t[r],i.push(c.markerPt);return i}()),o=p>=this.circleSpiralSwitchover?this.generatePtsSpiral(p,n).reverse():this.generatePtsCircle(p,n),g=function(){var i,n,c;for(c=[],i=0,n=o.length;n>i;i++)a=o[i],s=this.ptToLl(a),f=this.minExtract(t,function(t){return function(r){return t.ptDistanceSq(r.markerPt,a)}}(this)),u=f.marker,h=new e.Polyline({map:this.map,path:[u.position,s],strokeColor:this.legColors.usual[this.map.mapTypeId],strokeWeight:this.legWeight,zIndex:this.usualLegZIndex}),u._omsData={usualPosition:u.getPosition(),usualZIndex:u.getZIndex(),leg:h},this.legColors.highlighted[this.map.mapTypeId]!==this.legColors.usual[this.map.mapTypeId]&&(l=this.makeHighlightListenerFuncs(u),u._omsData.hightlightListeners={highlight:r.addListener(u,"mouseover",l.highlight),unhighlight:r.addListener(u,"mouseout",l.unhighlight)}),this.trigger("format",u,this.constructor.markerStatus.SPIDERFIED),u.setPosition(s),u.setZIndex(Math.round(this.spiderfiedZIndex+a.y)),c.push(u);return c}.call(this),delete this.spiderfying,this.spiderfied=!0,this.trigger("spiderfy",g,i)},l.unspiderfy=function(t){var e,i,n,s,a,o,l,h;if(null==t&&(t=null),null==this.spiderfied)return this;for(this.unspiderfying=!0,h=[],a=[],o=this.markers,e=0,i=o.length;i>e;e++)s=o[e],null!=s._omsData?(s._omsData.leg.setMap(null),s!==t&&s.setPosition(s._omsData.usualPosition),s.setZIndex(s._omsData.usualZIndex),n=s._omsData.hightlightListeners,null!=n&&(r.removeListener(n.highlight),r.removeListener(n.unhighlight)),delete s._omsData,s!==t&&(l=this.basicFormatEvents?"UNSPIDERFIED":"SPIDERFIABLE",this.trigger("format",s,this.constructor.markerStatus[l])),h.push(s)):a.push(s);return delete this.unspiderfying,delete this.spiderfied,this.trigger("unspiderfy",h,a),this},l.ptDistanceSq=function(t,r){var e,i;return e=t.x-r.x,i=t.y-r.y,e*e+i*i},l.ptAverage=function(t){var r,i,n,s,a,o;for(a=o=0,r=0,i=t.length;i>r;r++)s=t[r],a+=s.x,o+=s.y;return n=t.length,new e.Point(a/n,o/n)},l.llToPt=function(t){return this.projHelper.getProjection().fromLatLngToDivPixel(t)},l.ptToLl=function(t){return this.projHelper.getProjection().fromDivPixelToLatLng(t)},l.minExtract=function(t,r){var e,i,n,s,a,o,l;for(n=a=0,o=t.length;o>a;n=++a)s=t[n],l=r(s),("undefined"==typeof e||null===e||i>l)&&(i=l,e=n);return t.splice(e,1)[0]},l.arrIndexOf=function(t,r){var e,i,n,s;if(null!=t.indexOf)return t.indexOf(r);for(e=i=0,n=t.length;n>i;e=++i)if(s=t[e],s===r)return e;return-1},t}(),r=/(\?.*(&|&)|\?)spiderfier_callback=(\w+)/,n=document.currentScript,null==n&&(n=function(){var t,e,i,n,a;for(i=document.getElementsByTagName("script"),a=[],t=0,e=i.length;e>t;t++)s=i[t],(null!=(n=s.getAttribute("src"))?n.match(r):void 0)&&a.push(s);return a}()[0]),null!=n&&(t=null!=(e=n.getAttribute("src"))&&null!=(i=e.match(r))?i[3]:void 0,t&&"function"==typeof window[t]&&window[t]()),"function"==typeof window.spiderfier_callback&&window.spiderfier_callback()}).call(this);
[+]
..
[-] google.markerspiderfier.min.js
[edit]
[-] google.markerspiderfier.js
[edit]