This repository has been archived by the owner on Oct 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
meetups_compared.html
99 lines (92 loc) · 3.22 KB
/
meetups_compared.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<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 type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="local.js"></script>
<script src="api_key.js"></script>
<script id="config" type="text/javascript" charset="utf-8">
var $parameters = {
group_topics: "tea-party,the912project,glennbeck",
everywhere_urlname: "rally4sanityandmarch4fear",
width: 530,
_height: 300,
_name: "Meetups Compared",
_description: "Shows Meetup groups side by side with an Everywhere.",
_iframe_only: true
};
var $queries = [
function() {
return mup_widget.api_call("/2/open_events", {status: "upcoming", topic: $parameters.group_topics});
},
function() {
return mup_widget.api_call("/ew/events", {status: "upcoming", fields: "rsvp_count", urlname: $parameters.everywhere_urlname});
}
];
</script>
<script language="JavaScript">
mup_widget.with_jquery(function($, ctx) {
$(function() {
var map_canvas = $('#merged_map');
var map = new google.maps.Map(map_canvas[0], {
zoom: 1,
center: new google.maps.LatLng(0,0),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
with_each($queries, function(i, ev) {
if (typeof(ev.group) != "undefined") {
var loc = typeof ev.venue == 'undefined' ? ev : ev.venue;
pin(loc, ev.group.name, ev.time, ev.event_url, "gb");
} else {
if (ev.rsvp_count > 2) {
pin(ev, ev.city + ' Rally for Sanity', ev.time, ev.meetup_url, "r5s");
}
}
});
open_win = null;
var points = [];
function with_each(query, draw, type) {
$.each(query, function() {
$.getJSON(this(), function(data) {
if (data.status && data.status.match(/^200/) == null) {
if (typeof(console) != "undefined") {
console.error(data.status + ": " + data.details);
} else {
alert(data.status + ": " + data.details);
}
} else {
$.each(data.results, draw);
}
});
});
}
function pin(loc, title, time, url, type) {
var img = (type == "gb") ? "http://photos3.meetupstatic.com/photos/event/6/7/e/a/thumb_18386602.jpeg" : "http://photos4.meetupstatic.com/photos/event/4/7/9/5/thumb_18918325.jpeg"
var marker = new google.maps.Marker({
position: new google.maps.LatLng(loc.lat, loc.lon),
map: map,
icon : img,
title: title
});
google.maps.event.addListener(marker, 'click', function() {
if (open_win != null) open_win.close();
var heading = '<div style="margin-right:10px;font-size:12px;color:#333;font-family:Arial"><div style="font-weight: bold;font-size:13px;margin:0 0 10px">' + title + '</div>';
var link = '<div><a target="_top" href="' + url + '">Meeting up in ' + countdown(time) + ' days</a></div></div>';
var win = new google.maps.InfoWindow({
content: heading + link
});
win.open(map, marker);
open_win = win;
});
};
});
});
function countdown(millis) {
return Math.floor((millis - (new Date()).getTime()) / 86400000);
}
</script>
</head>
<body>
<div id="merged_map" style="width: 100%; height: 100%"></div>
</body>
</html>