Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Commit

Permalink
Get more data from meetup and everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
will h committed Oct 21, 2010
1 parent a8229e4 commit 57e1a70
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions meetups_compared.html
Expand Up @@ -15,12 +15,12 @@
_description: "Shows Meetup groups side by side with an Everywhere."
};
var $queries = {
group_events: function() {
return mup_widget.api_call("/2/open_events", {status: "upcoming", topic: $parameters.group_topics});
group_events: function(page) {
return mup_widget.api_call("/2/open_events", {status: "upcoming", topic: $parameters.group_topics, offset: page});
},
ew_events: function() {
ew_events: function(page) {
return mup_widget.api_call("/ew/events",
{ urlname: $parameters.everywhere_urlname, status: "upcoming", fields: "rsvp_count"});
{ urlname: $parameters.everywhere_urlname, status: "upcoming", fields: "rsvp_count", offset: page});
}
};
</script>
Expand All @@ -34,30 +34,44 @@
center: new google.maps.LatLng(0,0),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
with_each($queries.group_events(), function(i, ev) {
var loc = typeof ev.venue == 'undefined' ? ev : ev.venue;
pin(loc, ev.group.name, ev.time, ev.event_url, "gb");
});

with_each($queries.ew_events(), function(i, ev) {
if (ev.rsvp_count > 2) {
pin(ev, ev.city + ' Rally for Sanity', ev.time, ev.meetup_url, "r4s");
}
});
var mup_call = function(page) {
with_each($queries.group_events(page), function(i, ev) {
var loc = typeof ev.venue == 'undefined' ? ev : ev.venue;
pin(loc, ev.group.name, ev.time, ev.event_url, "gb");
}, "mu", page);
};

var ev_call = function(page) {
with_each($queries.ew_events(page), function(i, ev) {
if (ev.rsvp_count > 2) {
pin(ev, ev.city + ' Rally for Sanity', ev.time, ev.meetup_url, "r5s");
}
}, "ev", page);
};

open_win = null;
var points = [];
function with_each(query, draw) {
function with_each(query, draw, type, page) {
if (!page) page = 0;
$.getJSON(query, function(data) {
if (data.status && data.status.match(/^200/) == null) {
alert(data.status + ": " + data.details);
if (typeof(console) != "undefined") {
console.error(data.status + ": " + data.details);
} else {
alert(data.status + ": " + data.details);
}
} else {
$.each(data.results, draw);
$.each(data.results, draw);
if ( page < 5) {
(type == "ev") ? ev_call(page + 1) : mup_call(page + 1);
}
}
});
}
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://photos2.meetupstatic.com/photos/event/6/7/e/9/thumb_18386601.jpeg"
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,
Expand All @@ -74,7 +88,10 @@
win.open(map, marker);
open_win = win;
});
};
};

mup_call(0);
ev_call(0);

});
});
Expand Down

0 comments on commit 57e1a70

Please sign in to comment.