forked from meetuparchive/widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheverywhere_map.html
58 lines (58 loc) · 1.88 KB
/
everywhere_map.html
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
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="local.js"></script>
<script src="api_key.js"></script>
<!-- custom script won't work live, for now -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script id="config" type="text/javascript">
var $parameters = {
urlname: "mashable",
_width: 520,
_height: 300,
_name: "Everywhere Map",
_description: "Shows Everywhere meetups on a simple Google map."
};
var $queries = {
events: function() {
return api_call("/ew/events", {status: "upcoming", urlname: $parameters.urlname});
}
};
</script>
<script>
with_jquery(function($) {
$(function() {
var map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 2,
center: new google.maps.LatLng(0,0),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
$.getJSON($queries.events(), function(data) {
if (data.status && data.status.match(/^200/) == null) {
alert(data.status + ": " + data.details);
} else {
$.each(data.results, function(i, ev) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(ev.lat, ev.lon),
map: map,
});
google.maps.event.addListener(marker, 'click', function() {
var link = '<h3><a href="' + ev.meetup_url + '">' + ('title' in ev ? ev.title : ev.container.name) + '</a></h3>';
var city = '<p>' + ev.city + '</p>';
var win = new google.maps.InfoWindow({
content: link + city
});
win.open(map, marker);
});
});
}
});
});
});
</script>
</head>
<body>
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>