-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathjquery.tinyMap.min.js
More file actions
60 lines (60 loc) · 29.6 KB
/
jquery.tinyMap.min.js
File metadata and controls
60 lines (60 loc) · 29.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*! jQuery tinyMap v3.4.11, Licensed MIT (c) essoduke.org | https://code.essoduke.org/tinyMap/ */
window.gMapsCallback=function(){$(window).trigger("gMapsCallback")};
(function(g,u,p,J){function y(a){var b;if(a instanceof Array)for(b=0;b<a.length;b+=1)y(a[b]);else if("object"===typeof a)for(b in a)if("string"!==typeof a[b])y(a[b]);else if(/^google\.map/gi.test(a[b])){var d=a[b].split(".");4===d.length&&(a[b]=google.maps[d[2]][d[3]])}}function r(a,b,d){var c={lat:"",lng:""},e=/^[+-]?\d+(\.\d+)?$/;if("string"===typeof a||Array.isArray(a)){var f=Array.isArray(a)?a:a.toString().replace(/\s+/,"").split(",");if(2===f.length)e.test(f[0])&&e.test(f[1])&&(c.lat=f[0],c.lng=
f[1]);else return a}else if("object"===typeof a){if("function"===typeof a.lat)return a;a.hasOwnProperty("x")&&a.hasOwnProperty("y")?(c.lat=a.x,c.lng=a.y):a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")&&(c.lat=a.lat,c.lng=a.lng)}if("undefined"===typeof d||!0===d)c.lat=parseFloat(c.lat,10)+(Math.random()-.5)/5E3,c.lng=parseFloat(c.lng,10)+(Math.random()-.5)/5E3;return!0===b?new google.maps.LatLng(c.lat,c.lng):c}function v(a){var b=a.hasOwnProperty("css")?a.css.toString():"";this.setValues(a);this.span=
g("<span/>").css({position:"relative",left:"-50%",top:"0","white-space":"nowrap"}).addClass(b);this.div=g("<div/>").css({position:"absolute",display:"none"});this.span.appendTo(this.div)}function z(a,b){var d=this,c=g.extend({},I,b);d.idleOnceCount=!1;d.map=null;d._markers=[];d._markersCluster=[];d._clusters={};d._bounds={};d._labels=[];d._polylines=[];d._polygons=[];d._circles=[];d._kmls=[];d._directions=[];d._directionsMarkers=[];d._places=[];d.container=a;d.options=c;d.googleMapOptions={};d.interval=
parseInt(d.options.interval,10)||200;g(u).on("gMapsCallback",function(){d.init()});g(this.container).html(c.loading);return d.init()}var E=!1,F=!1,G=!1,H=!1,w={language:"zh-TW",callback:"gMapsCallback",api:"https://maps.googleapis.com/maps/api/js",clusterer:"https://cdn.essoduke.org/js/tinyMap/markerclusterer.js",withLabel:"https://cdn.essoduke.org/js/tinyMap/markerwithlabel.js",OMS:"https://cdn.essoduke.org/js/tinyMap/oms.min.js"},I={autoLocation:!1,center:[24,121],infoWindowAutoClose:!0,interval:200,
loading:"\u8b80\u53d6\u4e2d…",notFound:"\u627e\u4e0d\u5230\u67e5\u8a62\u7684\u5730\u9ede",zoom:8,markerOffset:!1},A={};A={greyscale:[{featureType:"all",stylers:[{saturation:-100},{gamma:.5}]}]};z.prototype={VERSION:"3.4.11",formatSize:function(a){return Array.isArray(a)&&2===a.length?new google.maps.Size(a[0],a[1]):a},formatPoint:function(a){return Array.isArray(a)&&2===a.length?new google.maps.Point(a[0],a[1]):a},overlay:function(a){a=this.map;var b=this.options;try{this.idleOnceCount||(this.kml(a,
b),this.directionService(a,b),this.placeMarkers(a,b),this.drawPolyline(a,b),this.drawPolygon(a,b),this.drawCircle(a,b),this.streetView(a,b),this.places(a,b),this.geoLocation(a,b),this.idleOnceCount=!0)}catch(d){console.error(d)}finally{google.maps.event.trigger(a,"resize")}},bindEvents:function(a,b){var d=this,c={};switch(typeof b){case "function":google.maps.event.clearListeners(a,"click");google.maps.event.addListener(a,"click",b);break;case "object":for(c in b)"function"===typeof b[c]?"created"===
c?b[c].call(a):(google.maps.event.clearListeners(a,c),google.maps.event.addListener(a,c,b[c])):b[c].hasOwnProperty("func")&&"function"===typeof b[c].func?b[c].hasOwnProperty("once")&&!0===b[c].once?google.maps.event.addListenerOnce(a,c,b[c].func):(google.maps.event.clearListeners(a,c),google.maps.event.addListener(a,c,b[c].func)):"function"===typeof b[c]&&(google.maps.event.clearListeners(a,c),google.maps.event.addListener(a,c,b[c]))}a.hasOwnProperty("defaultInfoWindow")&&(google.maps.event.clearListeners(a,
"click"),google.maps.event.addListener(a,"click",function(){var b;if(d.options.hasOwnProperty("infoWindowAutoClose")&&!0===d.options.infoWindowAutoClose)for(b=0;b<d._markers.length;b+=1){var c=d._markers[b];c.hasOwnProperty("infoWindow")&&"function"===typeof c.infoWindow.close&&c.infoWindow.close()}a.infoWindow.open(d.map,a)}))},kml:function(a,b){var d={url:"",map:a,preserveViewport:!1,suppressInfoWindows:!1},c={},e;if(b.hasOwnProperty("kml"))if("string"===typeof b.kml)d.url=b.kml,c=new google.maps.KmlLayer(d),
this._kmls.push(c);else if(Array.isArray(b.kml))for(e=0;e<b.kml.length;e+=1)"string"===typeof b.kml[e]?(d.url=b.kml[e],c=new google.maps.KmlLayer(d)):"object"===typeof b.kml[e]&&(d=g.extend({},d,b.kml[e]),c=new google.maps.KmlLayer(d),d.hasOwnProperty("event")&&this.bindEvents(c,d.event)),this._kmls.push(c)},drawPolyline:function(a,b){var d={},c=[],e={},f={},h={};h={};var k=[],n=[],l=0;h={};h={};var m=0,t=function(a,b){if(b===google.maps.DirectionsStatus.OK){for(m=0;m<a.routes[0].overview_path.length;m+=
1)n.push(a.routes[0].overview_path[m]);e.setPath(n);"function"===typeof d.getDistance&&(f=a.routes[0].legs[0].distance,d.getDistance.call(this,f))}};if(b.hasOwnProperty("polyline")&&Array.isArray(b.polyline))for(l=0;l<b.polyline.length;l+=1)if(d=b.polyline[l],d.hasOwnProperty("coords")&&Array.isArray(d.coords)){k=new google.maps.MVCArray;for(m=0;m<d.coords.length;m+=1)h=d.coords[m],h=r(h,!0,!1),"function"===typeof h.lat&&k.push(h);h=g.extend({},{strokeColor:d.color||"#FF0000",strokeOpacity:d.opacity||
1,strokeWeight:d.width||2},d);e=new google.maps.Polyline(h);this._polylines.push(e);if(2<k.getLength())for(m=0;m<k.length;m+=1)0<m&&k.length-1>m&&c.push({location:k.getAt(m),stopover:!1});d.hasOwnProperty("event")&&this.bindEvents(e,d.event);d.hasOwnProperty("snap")&&!0===d.snap?(h=new google.maps.DirectionsService,h.route({origin:k.getAt(0),waypoints:c,destination:k.getAt(k.length-1),travelMode:google.maps.DirectionsTravelMode.DRIVING},t)):(e.setPath(k),google.maps.hasOwnProperty("geometry")&&google.maps.geometry.hasOwnProperty("spherical")&&
"function"===typeof google.maps.geometry.spherical.computeDistanceBetween&&(f=google.maps.geometry.spherical.computeDistanceBetween(k.getAt(0),k.getAt(k.length-1)),"function"===typeof d.getDistance&&d.getDistance.call(this,f)));e.setMap(a)}},drawPolygon:function(a,b){var d,c;if(b.hasOwnProperty("polygon")&&Array.isArray(b.polygon))for(c=0;c<b.polygon.length;c+=1){var e=[];if(b.polygon[c].hasOwnProperty("coords")){for(d=0;d<b.polygon[c].coords.length;d+=1){var f=b.polygon[c].coords[d];f=r(f,!0,!1);
"function"===typeof f.lat&&e.push(f)}d=g.extend({},{path:e,strokeColor:b.polygon[c].color||"#FF0000",strokeOpacity:1,strokeWeight:b.polygon[c].width||2,fillColor:b.polygon[c].fillcolor||"#CC0000",fillOpacity:.35},b.polygon[c]);e=new google.maps.Polygon(d);this._polygons.push(e);e.setMap(a);d.hasOwnProperty("event")&&this.bindEvents(e,d.event)}}},drawCircle:function(a,b){var d={},c;if(b.hasOwnProperty("circle")&&Array.isArray(b.circle))for(c=0;c<b.circle.length;c+=1){var e=b.circle[c];var f=g.extend({map:a,
strokeColor:e.color||"#FF0000",strokeOpacity:e.opacity||.8,strokeWeight:e.width||2,fillColor:e.fillcolor||"#FF0000",fillOpacity:e.fillopacity||.35,radius:e.radius||10,zIndex:100,id:e.hasOwnProperty("id")?e.id:""},e);e.hasOwnProperty("center")&&(d=r(e.center,!0,!1),f.center=d);"function"===typeof d.lat&&(f=new google.maps.Circle(f),this._circles.push(f),e.hasOwnProperty("event")&&this.bindEvents(f,e.event))}},markerIcon:function(a){var b={};if(a.hasOwnProperty("icon")){b=a.icon;if("string"===typeof a.icon)return a.icon;
a.icon.hasOwnProperty("url")&&(b.url=a.icon.url);a.icon.hasOwnProperty("size")&&Array.isArray(a.icon.size)&&2===a.icon.size.length&&(b.size=this.formatSize(a.icon.size));a.icon.hasOwnProperty("scaledSize")&&Array.isArray(a.icon.scaledSize)&&2===a.icon.scaledSize.length&&(b.scaledSize=this.formatSize(a.icon.scaledSize));a.icon.hasOwnProperty("anchor")&&Array.isArray(a.icon.anchor)&&2===a.icon.anchor.length&&(b.anchor=this.formatPoint(a.icon.anchor))}return b},processMarker:function(a,b,d,c,e){var f=
this;a=f.get("marker");var h={},k={};e={};c.hasOwnProperty("position")&&("function"===typeof c.getPosition&&f._bounds.extend(c.position),d.hasOwnProperty("markerFitBounds")&&!0===d.markerFitBounds&&a.length===d.marker.length&&b.fitBounds(f._bounds));"undefined"===typeof c.infoWindow&&(c.infoWindow=new google.maps.InfoWindow({content:c.text}));c.hasOwnProperty("text")&&(c.infoWindow.setContent(c.text),c.hasOwnProperty("event")&&c.event.hasOwnProperty("click")||(c.defaultInfoWindow=!0),f.bindEvents(c,
c.event),c.hasOwnProperty("infoWindowOptions")&&(e=g.extend({},{content:c.infoWindowOptions.hasOwnProperty("content")?c.infoWindowOptions.content:c.text},c.infoWindowOptions),c.infoWindow.setOptions(e),e.hasOwnProperty("event")&&"undefined"!==typeof e.event&&f.bindEvents(c.infoWindow,e.event)));(!c.hasOwnProperty("cluster")||c.hasOwnProperty("cluster")&&!0===c.cluster)&&"function"===typeof f._clusters.addMarker&&f._clusters.addMarker(c);if(d.hasOwnProperty("markerWithLabel")&&!0===d.markerWithLabel||
c.hasOwnProperty("newLabel")&&c.newLabel)k={id:c.id,text:c.newLabel,map:b,css:c.hasOwnProperty("newLabelCSS")?c.newLabelCSS.toString():""},f.get({label:[c.id]},function(a){a.label.length?a.label.forEach(function(a){a.text=c.newLabel;g(a.span).addClass(c.newLabelCSS);a.bindTo("position",c);a.draw()}):(h=new v(k),h.bindTo("position",c),f._labels.push(h),h.set("visible",c.showLabel),"object"===typeof h&&!0===d.markerCluster&&google.maps.event.addListener(c,"map_changed",function(){"function"===typeof h.setMap&&
h.set("visible",null!==c.getMap())}))});f.bindEvents(c,c.event)},markerControl:function(){var a=this,b=a.options,d={css:"",label:"\u8acb\u9078\u64c7…",infoWindow:!0,panTo:!0,onChange:""};if(b.hasOwnProperty("markerControl")){if("string"===typeof b.markerControl)var c=g(b.markerControl.toString());else c=b.markerControl.hasOwnProperty("container")?g(b.markerControl.container):g(b.markerControl),d=g.extend({},d,b.markerControl);c.length&&a.get("marker",function(b){var f=['<select class="marker-list-control">',
"<option>"+d.label+"</option>"];b.forEach(function(a){"undefined"!==typeof a.infoWindow&&a.infoWindow.close();f.push('<option value="'+a.id+'" data-marker-id="'+a.id+'">'+(a.title?a.title:a.id)+"</option>")});f.push("</select>");c.on("change.tinyMap","select",function(){var b=g(this);a.close("marker");this.value.length&&a.get({marker:[this.value]},function(c){c.marker.length&&"undefined"!==c.marker[0]&&(c=c.marker[0],!0===d.infoWindow&&"undefined"!==typeof c.infoWindow&&"function"===typeof c.infoWindow.open&&
c.infoWindow.open(a.map,c),!0===d.panTo&&a.map.panTo(c.getPosition()),"function"===typeof d.onChange&&d.onChange.call(b,c))})}).html(f.join(""));"string"===typeof d.css&&c.find("select").addClass(d.css)})}},placeMarkers:function(a,b,d,c){var e=this,f={},h={maxZoom:null,gridSize:60},k=Array.isArray(b.marker)?b.marker:[],n={},l=!1;"undefined"!==typeof c&&Array.isArray(c)&&c.length&&(k=c);e.options.hasOwnProperty("markerCluster")&&"function"===typeof MarkerClusterer&&(h=g.extend({},h,b.markerCluster),
e._clusters=new MarkerClusterer(a,[],h),h.hasOwnProperty("event")&&e.bindEvents(e._clusters,h.event));e.options.hasOwnProperty("enableOMS")&&"function"===typeof OverlappingMarkerSpiderfier&&(l=!0);l&&(n=new OverlappingMarkerSpiderfier(a,{markersWontHide:!0}),n.addListener("click",function(b){b.hasOwnProperty("oms")&&b.infoWindow.setContent(b.oms);b.infoWindow.open(a,b)}),n.addListener("spiderfy",function(a){}),n.addListener("unspiderfy",function(a){}));var m=k.length;k.forEach(function(c,k){var h=
r(c.addr,!0,!!b.markerOffset),t=e.markerIcon(c),B=!0,C=!1,x={},p={},D="undefined"!==typeof c.id?c.id:c.addr.toString().replace(/\s/g,""),q={id:D,map:a,animation:null,showLabel:!0};q=g.extend({},q,c);"modify"===d&&D&&e.get({marker:[D]},function(a){!Array.isArray(a.marker)||!a.marker.length||c.hasOwnProperty("forceInsert")&&!0===c.forceInsert||(c=g.extend(a.marker[0],c),"function"===typeof e._clusters.removeMarker&&e._clusters.removeMarker(a.marker[0]),B=!1,C=!0)});c.hasOwnProperty("title")&&(q.title=
c.title.toString().replace(/<([^>]+)>/g,""));g.isEmptyObject(t)||(q.icon=t);c.hasOwnProperty("animation")&&"string"===typeof c.animation&&(q.animation=google.maps.Animation[c.animation.toUpperCase()]);"string"===typeof h?(f=new google.maps.Geocoder,f.geocode({address:h},function(f,h){h===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){e.placeMarkers(m,a,b,d,[c])},e.interval*(k+1)):h===google.maps.GeocoderStatus.OK&&(!B&&C?("function"===typeof c.setPosition&&(c.setPosition(f[0].geometry.location),
q.hasOwnProperty("title")&&c.setTitle(q.title),q.hasOwnProperty("icon")&&c.setIcon(q.icon)),p=c):(q.position=f[0].geometry.location,x=b.hasOwnProperty("markerWithLabel")&&!0===b.markerWithLabel?"function"===typeof MarkerWithLabel?new MarkerWithLabel(q):new google.maps.Marker(q):new google.maps.Marker(q),e._markers.push(x),p=x),l&&n.addMarker(p),e.processMarker(m,a,b,p,d))})):(!B&&C?("function"===typeof c.setPosition&&h.lat()&&h.lng()&&c.setPosition(h),q.hasOwnProperty("title")&&c.setTitle(q.title),
q.hasOwnProperty("icon")&&c.setIcon(q.icon),p=c):(q.position=h,x=b.hasOwnProperty("markerWithLabel")&&!0===b.markerWithLabel?"function"===typeof MarkerWithLabel?new MarkerWithLabel(q):new google.maps.Marker(q):new google.maps.Marker(q),e._markers.push(x),p=x,l&&n.addMarker(p)),e.processMarker(m,a,b,p,d))});b.hasOwnProperty("markerWithLabel")&&g.isNumeric(b.markerWithLabel)&&function(){e.clear("label");var c=a.getCenter(),b=[];e.get("marker",function(d){d.forEach(function(a){1E3>google.maps.geometry.spherical.computeDistanceBetween(a.getPosition(),
c)&&b.push(a)});b&&b.forEach(function(c){var b={id:c.id,text:c.newLabel,map:a,css:c.hasOwnProperty("newLabelCSS")?c.newLabelCSS.toString():""};b=new v(b);b.bindTo("position",c);b.set("visible",c.showLabel);e._labels.push(b)})})}.apply(e,arguments);e.markerControl()},directionService:function(a,b){var d=this,c=!!b.markerOffset,e=new google.maps.DirectionsService;Array.isArray(b.direction)&&b.direction.forEach(function(b){if("undefined"!==typeof b.from&&"undefined"!==typeof b.to){var f={},k=new google.maps.DirectionsRenderer,
n=g.extend({},{infoWindow:new google.maps.InfoWindow,map:d.map},b),l=[],m=[],t=[];f.origin=r(b.from,!0,!1);f.destination=r(b.to,!0,!1);f.travelMode=b.hasOwnProperty("travel")&&google.maps.TravelMode[b.travel.toString().toUpperCase()]?google.maps.TravelMode[b.travel.toString().toUpperCase()]:google.maps.TravelMode.DRIVING;b.hasOwnProperty("panel")&&g(b.panel).length&&(n.panel=g(b.panel).get(0));b.hasOwnProperty("requestExtra")&&b.requestExtra&&(f=g.extend({},f,b.requestExtra));b.hasOwnProperty("optimize")&&
(f.optimizeWaypoints=b.optimize);b.hasOwnProperty("waypoint")&&Array.isArray(b.waypoint)&&(b.waypoint.forEach(function(a){var b={stopover:!0};"string"===typeof a||Array.isArray(a)?b.location=r(a,!0,c):a.hasOwnProperty("location")&&(b.location=r(a.location,!0,c),b.stopover=a.hasOwnProperty("stopover")?a.stopover:!0);m.push(a.text||a.toString());a.hasOwnProperty("icon")&&t.push(a.icon.toString());l.push(b)}),f.waypoints=l);e.route(f,function(c,e){e===google.maps.DirectionsStatus.OK&&(c.routes.forEach(function(e,
k){b.hasOwnProperty("renderAll")&&!0===b.renderAll&&!0===f.provideRouteAlternatives&&new google.maps.DirectionsRenderer({map:a,directions:c,routeIndex:k});var h=e.legs,g="",l="",p={};b.hasOwnProperty("fromText")&&(g=h[0].start_address=b.fromText);b.hasOwnProperty("toText")&&(1===h.length?h[0].end_address=b.toText:h[h.length-1].end_address=b.toText,l=b.toText);b.hasOwnProperty("icon")&&(n.suppressMarkers=!0,b.icon.hasOwnProperty("from")&&"string"===typeof b.icon.from&&d.directionServiceMarker(h[0].start_location,
{icon:b.icon.from,text:g},n.infoWindow,b),b.icon.hasOwnProperty("to")&&"string"===typeof b.icon.to&&d.directionServiceMarker(h[h.length-1].end_location,{icon:b.icon.to,text:l},n.infoWindow,b));for(g=1;g<h.length;g+=1)b.hasOwnProperty("icon")&&(b.icon.hasOwnProperty("waypoint")&&"string"===typeof b.icon.waypoint?p.icon=b.icon.waypoint:"string"===typeof t[g-1]&&(p.icon=t[g-1]),p.text=m[g-1],d.directionServiceMarker(h[g].start_location,p,n.infoWindow,b))}),console.log(n),d.bindEvents(k,b.event),k.setOptions(n),
k.setDirections(c),d._directions.push(k))})}})},directionServiceMarker:function(a,b,d,c){var e=this,f={},h=g.extend({},{position:a,map:e.map,id:c.hasOwnProperty("id")?c.id:""},b),k=new google.maps.Marker(h);h.hasOwnProperty("text")&&(f=function(){d.setPosition(a);d.setContent(h.text);d.open(e.map,k)});e._directionsMarkers.push(k);e.bindEvents(k,f)},getDirectionsInfo:function(){var a=[];this.get("direction",function(b){b.forEach(function(b,c){var d=b.getDirections();d.hasOwnProperty("routes")&&"undefined"!==
typeof d.routes[0]&&"undefined"!==typeof d.routes[0].legs&&(a[c]=[],d.routes[0].legs.forEach(function(b,d){a[c].push({from:b.start_address,to:b.end_address,distance:b.distance,duration:b.duration})}))})});return a},streetView:function(a,b){var d=b.hasOwnProperty("streetViewObj")?b.streetViewObj:{};if("function"===typeof a.getStreetView){if(d.hasOwnProperty("position")){var c=r(d.position,!0,!1);d.position="object"===typeof c?a.getCenter():c}else d.position=a.getCenter();d.hasOwnProperty("pov")&&(d.pov=
g.extend({},{heading:0,pitch:0,zoom:1},d.pov));c=a.getStreetView();c.setOptions(d);d.hasOwnProperty("event")&&this.bindEvents(c,d.event);d.hasOwnProperty("visible")&&c.setVisible(d.visible)}},places:function(a,b){var d=this,c={};c=b.hasOwnProperty("places")?b.places:{};var e=g.extend({location:a.getCenter(),radius:100},c);e.location=r(e.location,!0,!1);"undefined"!==typeof google.maps.places&&(c=new google.maps.places.PlacesService(a),c.nearbySearch(e,function(b,c){c===google.maps.places.PlacesServiceStatus.OK&&
(d._places.push(b),e.hasOwnProperty("createMarker")&&!0===e.createMarker&&b.forEach(function(b){b.hasOwnProperty("geometry")&&d._markers.push(new google.maps.Marker({map:a,position:b.geometry.location}))}),e.hasOwnProperty("callback")&&"function"===typeof e.callback&&e.callback.call(b))}))},geoLocation:function(a,b){try{var d=this,c={},e=navigator.geolocation;e&&(b.hasOwnProperty("geolocation")&&(c=g.extend({},{maximumAge:6E5,timeout:3E3,enableHighAccuracy:!1},b.geolocation)),!0===b.autoLocation||
"function"===typeof b.autoLocation?this.watchid=e.watchPosition(function(c){"undefined"!==typeof c&&"coords"in c&&"latitude"in c.coords&&"longitude"in c.coords&&(a.panTo(new google.maps.LatLng(c.coords.latitude,c.coords.longitude)),"function"===typeof b.autoLocation&&b.autoLocation.call(d,c))},function(a){console.error(a)},c):e.clearWatch(this.watchid))}catch(f){}},panTo:function(a,b){var d=this.map,c={},e={};null!==d&&"undefined"!==typeof d&&(c=r(a,!0,!1),"string"===typeof c?(e=new google.maps.Geocoder,
e.geocode({address:c},function(a,c){c===google.maps.GeocoderStatus.OK&&"function"===typeof d.panTo&&Array.isArray(a)&&a.length?a[0].hasOwnProperty("geometry")&&d.panTo(a[0].geometry.location):"function"===typeof b?b.call(this,c):console.error(c)})):"function"===typeof d.panTo&&d.panTo(c));return g(this.container)},close:function(a,b){var d=this.get(a),c={},e="";d.hasOwnProperty("map")&&delete d.map;Array.isArray(d)?c[a]=d:c=d;try{for(e in c)Array.isArray(c[e])&&c[e].forEach(function(a){a.hasOwnProperty("infoWindow")&&
"function"===typeof a.infoWindow.close&&a.infoWindow.close()});"function"===typeof b&&b.call(this)}catch(f){console.warn(f)}finally{return g(this.container)}},clear:function(a,b){function d(a,b){"function"===typeof a.setMap&&f._directionsMarkers[b].setMap(null)}function c(a){"direction"===m&&(h.forEach(d),f._directionsMarkers.filter(function(a){return"undefined"!==typeof a}));"function"===typeof a.set&&a.set("visible",!1);"function"===typeof a.setMap&&a.setMap(null);-1!==f[l].indexOf(a)&&delete f[l][f[l].indexOf(a)]}
function e(a){return"undefined"!==typeof a}var f=this,h=f._directionsMarkers,k=f.get(a),n={},l="",m="";"undefined"!==typeof k&&"undefined"!==typeof k.map&&delete k.map;Array.isArray(k)?n[a]=k:n=k;try{for(m in n)Array.isArray(n[m])&&(l="_"+m.toString().toLowerCase()+"s",n[m].forEach(c),f[l]=f[l].filter(e));"function"===typeof b&&b.call(this)}catch(t){console.warn(t)}finally{return g(f.container)}},get:function(a,b){function d(b){var d=c[k].indexOf(b);(0===a[h].length||-1!==a[h].indexOf(d)||"undefined"!==
typeof b.id&&0<b.id.length&&-1!==b.id.indexOf(a[h]))&&f[h].push(b)}var c=this,e=[],f={},h={},k="",g="",l=0;"undefined"===typeof a&&(a={marker:[],label:[],polygon:[],polyline:[],circle:[],direction:[],kml:[],cluster:[],bound:[]});try{if("string"===typeof a)if(-1!==a.indexOf(","))for(e=a.replace(/\s/gi,"").split(","),l=0;l<e.length;l+=1)g=e[l].toString().toLowerCase(),"map"===g?f[g]=c.map:(console.log(g),k="_"+g+"s",f[g]=c[k]);else"map"===a.toString().toLowerCase()?f=c.map:(k="_"+a.toString().toLowerCase()+
"s",f=c[k]);else{for(h in a)Array.isArray(a[h])&&(k="_"+h.toString().toLowerCase()+"s",Array.isArray(c[k])&&(f[h]=[],c[k].forEach(d)));f.map=c.map}"function"===typeof b&&b.call(this,f);return f}catch(m){console.error(m)}finally{return f}},modify:function(a){var b=[],d=[["kml","kml"],["marker","placeMarkers"],["direction","directionService"],["polyline","drawPolyline"],["polygon","drawPolygon"],["circle","drawCircle"],["streetView","streetView"],["markerFitBounds","markerFitBounds"],["places","places"],
["autoLocation","geoLocation"]],c,e=this.map;if("undefined"!==typeof a){for(c=0;c<d.length;c+=1)a.hasOwnProperty(d[c][0])&&b.push(d[c][1]);if(null!==e){if(b.length)for(c=0;c<b.length;c+=1)"function"===typeof this[b[c]]&&("streetView"===b[c]&&(a.streetViewObj=a.streetView,delete a.streetView),this[b[c]](e,a,"modify"));else e.setOptions(a);a.hasOwnProperty("event")&&this.bindEvents(e,a.event);google.maps.event.trigger(e,"resize")}}return g(this.container)},query:function(a,b){var d=this,c=new google.maps.Geocoder,
e=r(a,!1,!1),f={};"string"===typeof e?f.address=e:f={location:{lat:parseFloat(e.lat,10),lng:parseFloat(e.lng,10)}};c.geocode(f,function(c,e){try{if(e===google.maps.GeocoderStatus.OVER_QUERY_LIMIT)setTimeout(function(){d.query(a,b)},d.interval);else if(e===google.maps.GeocoderStatus.OK&&Array.isArray(c)){if(0<c.length&&c[0].hasOwnProperty("geometry"))if("function"===typeof b)b.call(d,c[0]);else return c[0]}else console.error("Geocoder Error Code: "+e)}catch(n){console.error(n)}})},destroy:function(){var a=
g(this.container);a.length&&g.removeData(this.container,"tinyMap");return a.empty()},getKML:function(a){var b=g.extend({},{marker:!0,polyline:!0,polygon:!0,circle:!0,direction:!0,download:!1},a),d="<Placemark> <name><![CDATA[#NAME#]]\x3e</name> <Snippet></Snippet> <description><![CDATA[]]\x3e</description> <styleUrl>#style1</styleUrl> <ExtendedData></ExtendedData> #DATA# </Placemark>".split(" "),c="<Placemark> <styleUrl>#style1</styleUrl> <name><![CDATA[#NAME#]]\x3e</name> <Polygon> <tessellate>1</tessellate> <extrude>1</extrude> <altitudeMode>clampedToGround</altitudeMode> <outerBoundaryIs> <LinearRing> <coordinates>#LATLNG#</coordinates> </LinearRing> </outerBoundaryIs> </Polygon> </Placemark>".split(" "),
e="",f="",h="",k="",n="";a="";this.get("marker,polyline,polygon,circle,direction",function(a){var g="";!0===b.marker&&"undefined"!==typeof a.marker&&a.marker.forEach(function(a){g=[a.getPosition().lng(),a.getPosition().lat()].join();e+=d.join("").replace(/#NAME#/gi,"Markers").replace(/#DATA#/gi,"<Point><coordinates>#LATLNG#,0.000000</coordinates></Point>".replace(/#LATLNG#/gi,g))});!0===b.polyline&&"undefined"!==typeof a.polyline&&a.polyline.forEach(function(a){g="";a.getPath().getArray().forEach(function(a){g+=
[a.lng(),a.lat(),"0.000000\n"].join()});f+=d.join("").replace(/#NAME#/gi,"Polylines").replace(/#DATA#/gi,"<LineString><tessellate>1</tessellate><coordinates>#LATLNG#</coordinates></LineString>".replace(/#LATLNG#/gi,g))});!0===b.polygon&&"undefined"!==typeof a.polygon&&a.polygon.forEach(function(a){g="";a.getPath().getArray().forEach(function(a){g+=[a.lng(),a.lat(),"0.000000\n"].join()});h+=c.join("").replace(/#NAME#/gi,"Polygons").replace(/#LATLNG#/gi,g)});!0===b.circle&&"undefined"!==typeof a.circle&&
a.circle.forEach(function(a){g="";var b=Math.PI/180,d=180/Math.PI;d*=a.getRadius()/6378137;b=d/Math.cos(a.getCenter().lat()*b);var e;for(e=0;65>e;e+=1){var f=e/32*Math.PI;var h=a.getCenter().lng()+b*Math.cos(f);f=a.getCenter().lat()+d*Math.sin(f);g+=[h,f,"0.000000\n"].join()}k+=c.join("").replace(/#NAME#/gi,"Circles").replace(/#LATLNG#/gi,g)});!0===b.direction&&"undefined"!==typeof a.direction&&a.direction.forEach(function(a){a=a.getDirections();a.hasOwnProperty("routes")&&Array.isArray(a.routes)&&
"undefined"!==typeof a.routes[0]&&"undefined"!==typeof a.routes[0].legs&&Array.isArray(a.routes[0].legs)&&a.routes[0].legs.forEach(function(a){Array.isArray(a.steps)&&a.steps.forEach(function(a){g="";Array.isArray(a.path)&&a.path.forEach(function(a){g+=[a.lng(),a.lat(),"0.000000\n"].join()});n+=d.join("").replace(/#NAME#/gi,"Directions").replace(/#DATA#/gi,"<LineString><tessellate>1</tessellate><coordinates>#LATLNG#</coordinates></LineString>".replace(/#LATLNG#/gi,g))})})})});a='<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.2"><Document><name><![CDATA[jQuery tinyMap Plugin]]\x3e</name><description><![CDATA[]]\x3e</description><Style id="style1"><PolyStyle><color>50F05A14</color><colorMode>normal</colorMode><fill>1</fill><outline>1</outline></PolyStyle><IconStyle><Icon><href>https://maps.google.com/mapfiles/kml/paddle/grn-circle_maps.png</href></Icon></IconStyle></Style>#PLACEMARKS#</Document></kml>'.replace(/#NAME#/gi,
"").replace(/#PLACEMARKS#/gi,e+f+h+k+n);if(!0===b.download)u.open("data:application/vnd.google-earth.kml+xml;charset=utf-8;base64,"+u.btoa(u.decodeURIComponent(u.encodeURIComponent(a))));else return a},init:function(){var a=this,b={},d={};d=g.extend({},w);var c=d.api.split("?")[0],e="";b={};var f={};try{delete d.api,delete d.clusterer,delete d.withLabel,d=g.param(d)}catch(k){}E||"undefined"!==typeof u.google||(b=p.createElement("script"),b.setAttribute("src",[c,d].join("?")),(p.getElementsByTagName("head")[0]||
p.documentElement).appendChild(b),E=!0,b=null);if("object"===typeof u.google){y(a.options);!F&&a.options.hasOwnProperty("markerCluster")&&!1!==a.options.markerCluster&&"undefined"===typeof MarkerClusterer&&(b=p.createElement("script"),b.setAttribute("src",w.clusterer),(p.getElementsByTagName("head")[0]||p.documentElement).appendChild(b),F=!0,b=null);!G&&a.options.hasOwnProperty("markerWithLabel")&&!0===a.options.markerWithLabel&&"undefined"===typeof MarkerWithLabel&&(b=p.createElement("script"),b.setAttribute("src",
w.withLabel),(p.getElementsByTagName("head")[0]||p.documentElement).appendChild(b),G=!0,b=null);!H&&a.options.hasOwnProperty("enableOMS")&&"undefined"===typeof OverlappingMarkerSpiderfier&&(b=p.createElement("script"),b.setAttribute("src",w.OMS),(p.getElementsByTagName("head")[0]||p.documentElement).appendChild(b),H=!0,b=null);a._bounds=new google.maps.LatLngBounds;v.prototype=new google.maps.OverlayView;v.prototype.onAdd=function(){var a=this;null!==a.div&&(a.div.appendTo(g(a.getPanes().overlayLayer)),
a.listeners=[google.maps.event.addListener(a,"visible_changed",function(){a.draw()}),google.maps.event.addListener(a,"position_changed",function(){a.draw()}),google.maps.event.addListener(a,"visible_changed",function(){a.draw()}),google.maps.event.addListener(a,"clickable_changed",function(){a.draw()}),google.maps.event.addListener(a,"text_changed",function(){a.draw()}),google.maps.event.addListener(a,"zindex_changed",function(){a.draw()})])};v.prototype.draw=function(){var a=this.getProjection(),
b={};try{null!==this.div&&a&&((b=a.fromLatLngToDivPixel(this.get("position")))&&this.div.css({left:b.x+"px",top:b.y+"px",display:this.get("visible")?"block":"none"}),this.text&&this.span.html(this.text.toString()))}catch(l){console.error(l)}};v.prototype.onRemove=function(){g(this.div).remove();this.div=null};for(f in a.options)a.options.hasOwnProperty(f)&&(b=a.options[f],/ControlOptions/g.test(f)&&b.hasOwnProperty("position")&&"string"===typeof b.position&&(a.options[f].position=google.maps.ControlPosition[b.position.toUpperCase()]));
a.googleMapOptions=a.options;a.options.hasOwnProperty("streetView")&&(a.googleMapOptions.streetViewObj=a.options.streetView,delete a.googleMapOptions.streetView);a.googleMapOptions.center=r(a.options.center,!0,!1);a.options.hasOwnProperty("styles")&&("string"===typeof a.options.styles&&A.hasOwnProperty(a.options.styles)?a.googleMapOptions.styles=A[a.options.styles]:Array.isArray(a.options.styles)&&(a.googleMapOptions.styles=a.options.styles));if("string"===typeof a.options.center)d=new google.maps.Geocoder,
d.geocode({address:a.options.center},function(b,c){try{c===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){a.init()},a.interval):c===google.maps.GeocoderStatus.OK&&Array.isArray(b)?0<b.length&&b[0].hasOwnProperty("geometry")&&(a.googleMapOptions.center=b[0].geometry.location,a.map=new google.maps.Map(a.container,a.googleMapOptions),h="undefined"!==typeof a.options.event?a.options.event:{},a.mapIdleEvent(h)):(e=(a.options.notFound||c).toString(),a.container.innerHTML=g("<div/>").text(e).html(),
console.error("Geocoder Error Code: "+c))}catch(l){console.error(l)}});else{a.map=new google.maps.Map(a.container,a.googleMapOptions);var h="undefined"!==typeof a.options.event?a.options.event:{};a.mapIdleEvent(h)}}},mapIdleEvent:function(a){var b=this;a.hasOwnProperty("idle")?"undefined"!==a.idle.func&&"function"===typeof a.idle.func&&"undefined"!==typeof a.idle.once?!0===a.idle.once?google.maps.event.addListenerOnce(b.map,"idle",function(){b.overlay();a.idle.func.apply(this,arguments);delete a.idle}):
google.maps.event.addListener(b.map,"idle",function(){b.overlay();a.idle.func.apply(this,arguments)}):"function"===typeof a.idle&&google.maps.event.addListener(b.map,"idle",function(){b.overlay();a.idle.apply(this,arguments)}):google.maps.event.addListenerOnce(b.map,"idle",function(){b.overlay()});b.bindEvents(b.map,a)}};g.fn.tinyMapConfigure=function(a){w=g.extend(w,a)};g.fn.tinyMap=function(a){var b={},d=[],c=arguments;return"string"===typeof a?(this.each(function(){b=g.data(this,"tinyMap");b instanceof
z&&"function"===typeof b[a]&&(d=b[a].apply(b,Array.prototype.slice.call(c,1)))}),"undefined"!==typeof d?d:this):this.each(function(){g.data(this,"tinyMap")||g.data(this,"tinyMap",new z(this,a))})}})(window.jQuery||{},window,document);