Skip to content
Newer
Older
100644 100 lines (92 sloc) 3.22 KB
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
1 <html>
2 <head>
3 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
4 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
5 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
6 <script src="local.js"></script>
7 <script src="api_key.js"></script>
8 <script id="config" type="text/javascript" charset="utf-8">
9 var $parameters = {
10 group_topics: "tea-party,the912project,glennbeck",
a8229e4 @n8han update default rally name
n8han authored Oct 15, 2010
11 everywhere_urlname: "rally4sanityandmarch4fear",
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
12 width: 530,
13 _height: 300,
14 _name: "Meetups Compared",
f5ece41 @n8han set iframe only flag
n8han authored Nov 2, 2010
15 _description: "Shows Meetup groups side by side with an Everywhere.",
16 _iframe_only: true
17 };
9433a48 @willh-meetup Ok, working for real this time.
willh-meetup authored Oct 21, 2010
18 var $queries = [
19 function() {
20 return mup_widget.api_call("/2/open_events", {status: "upcoming", topic: $parameters.group_topics});
21 },
22 function() {
23 return mup_widget.api_call("/ew/events", {status: "upcoming", fields: "rsvp_count", urlname: $parameters.everywhere_urlname});
24 }
25 ];
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
26 </script>
27 <script language="JavaScript">
28 mup_widget.with_jquery(function($, ctx) {
29 $(function() {
30 var map_canvas = $('#merged_map');
31
32 var map = new google.maps.Map(map_canvas[0], {
33 zoom: 1,
34 center: new google.maps.LatLng(0,0),
35 mapTypeId: google.maps.MapTypeId.ROADMAP
36 });
37
9433a48 @willh-meetup Ok, working for real this time.
willh-meetup authored Oct 21, 2010
38 with_each($queries, function(i, ev) {
39 if (typeof(ev.group) != "undefined") {
40 var loc = typeof ev.venue == 'undefined' ? ev : ev.venue;
41 pin(loc, ev.group.name, ev.time, ev.event_url, "gb");
42 } else {
43 if (ev.rsvp_count > 2) {
44 pin(ev, ev.city + ' Rally for Sanity', ev.time, ev.meetup_url, "r5s");
45 }
6da761d @willh-meetup This is more sensible, and should actually work.
willh-meetup authored Oct 21, 2010
46 }
47 });
57e1a70 @willh-meetup Get more data from meetup and everywhere.
willh-meetup authored Oct 21, 2010
48
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
49 open_win = null;
50 var points = [];
6da761d @willh-meetup This is more sensible, and should actually work.
willh-meetup authored Oct 21, 2010
51 function with_each(query, draw, type) {
52 $.each(query, function() {
53 $.getJSON(this(), function(data) {
54 if (data.status && data.status.match(/^200/) == null) {
55 if (typeof(console) != "undefined") {
56 console.error(data.status + ": " + data.details);
57 } else {
58 alert(data.status + ": " + data.details);
59 }
60 } else {
61 $.each(data.results, draw);
62 }
63 });
64 });
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
65 }
66 function pin(loc, title, time, url, type) {
67
57e1a70 @willh-meetup Get more data from meetup and everywhere.
willh-meetup authored Oct 21, 2010
68 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"
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
69 var marker = new google.maps.Marker({
70 position: new google.maps.LatLng(loc.lat, loc.lon),
71 map: map,
72 icon : img,
73 title: title
74 });
75 google.maps.event.addListener(marker, 'click', function() {
76 if (open_win != null) open_win.close();
77 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>';
78 var link = '<div><a target="_top" href="' + url + '">Meeting up in ' + countdown(time) + ' days</a></div></div>';
79 var win = new google.maps.InfoWindow({
80 content: heading + link
81 });
82 win.open(map, marker);
83 open_win = win;
84 });
57e1a70 @willh-meetup Get more data from meetup and everywhere.
willh-meetup authored Oct 21, 2010
85 };
86
a0516f2 @n8han meeutps compared
n8han authored Oct 5, 2010
87 });
88 });
89
90 function countdown(millis) {
91 return Math.floor((millis - (new Date()).getTime()) / 86400000);
92 }
93
94 </script>
95 </head>
96 <body>
97 <div id="merged_map" style="width: 100%; height: 100%"></div>
98 </body>
99 </html>
Something went wrong with that request. Please try again.