Skip to content
This repository has been archived by the owner on Jan 11, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git@github.com:meetup/javascript-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Shapiro committed Jun 8, 2010
2 parents ad39c16 + 04502cb commit 0f4127b
Showing 1 changed file with 47 additions and 72 deletions.
119 changes: 47 additions & 72 deletions Widget/widget
Original file line number Diff line number Diff line change
Expand Up @@ -30,94 +30,31 @@ size = gup("size");
var groupname = gup("name");
var key = gup("key");

$.getJSON("http://api.meetup.com/ew/containers?urlname="+ groupname +"&key=" + key +"&callback=?", function(data) {
if (data.status && data.status.match(/^200/) == null) {
alert(data.status + ": " + data.details);
} else {
$.each(data.results, function(i, ev) {
if (i==0) {
webaddress = ev.meetup_url;
formattedname = ev.name;
//TBD - pull user and group counts out somehow

peoplecount_area = peoplecount_area.concat("<span class=techcrunch\"MEETUP_EVERYWHERE_WIDGET_people\">2,213 People</span>");
logo_area = logo_area.concat("<a class=\"MEETUP_EVERYWHERE_WIDGET_logo\" href=\"" + ev.meetup_url + "\"><img class=\"MEETUP_EVERYWHERE_WIDGET_bottom_logo\" src=\"http://img1.meetupstatic.com/84869143793177372874/img/birddog/everywhere_widget.png\"/></a>");
}
});
}

});

$.getJSON("http://api.meetup.com/ew/events?order=time&urlname="+ groupname +"&key="+key+"&callback=?", function(data) {
if (data.status && data.status.match(/^200/) == null) {
alert(data.status + ": " + data.details);
} else {
groupcount = parseInt(data.meta.total_count);
groupname_area = groupname_area.concat("<span class=\"MEETUP_EVERYWHERE_WIDGET_count\">"+groupcount+" </span><span class=\"MEETUP_EVERYWHERE_WIDGET_name\">"+ formattedname +" </span><span class=\"MEETUP_EVERYWHERE_WIDGET_suffix\"> Meetups</span>");

$.each(data.results, function(i, ev) {
if (i==0) {
formattedname = ev.container.name;
webaddress = "http://www.meetup.com/"+formattedname+"/";
groupname_area = groupname_area.concat("<span class=\"MEETUP_EVERYWHERE_WIDGET_count\">"+groupcount+" </span><span class=\"MEETUP_EVERYWHERE_WIDGET_name\">"+ formattedname +" </span><span class=\"MEETUP_EVERYWHERE_WIDGET_suffix\"> Meetups</span>");
peoplecount_area = peoplecount_area.concat("<span class=techcrunch\"MEETUP_EVERYWHERE_WIDGET_people\">2,213 People</span>");
logo_area = logo_area.concat("<a class=\"MEETUP_EVERYWHERE_WIDGET_logo\" href=\"" + ev.meetup_url + "\"><img class=\"MEETUP_EVERYWHERE_WIDGET_bottom_logo\" src=\"http://img1.meetupstatic.com/84869143793177372874/img/birddog/everywhere_widget.png\"/></a>");
//FORMAT TIME AND DATE
var myDate = new Date( ev.time);
var h = myDate.getHours();
var m = myDate.getMinutes();
var time_out = "";
var time = "AM";

if (h >= 12) {time = "PM";}
if (h > 12) { h = h - 12;}
if (m > 9) { time_out = (h + ":" + m + " " + time);}
else {time_out = (h + ":0" + m + " " + time);}

var month_out = "";
switch (myDate.getMonth())
{
case 0:
month_out = ("Jan");
break;
case 1:
month_out = ("Feb");
break;
case 2:
month_out = ("Mar");
break;
case 3:
month_out = ("Apr");
break;
case 4:
month_out = ("May");
break;
case 5:
month_out = ("Jun");
break;
case 6:
month_out = ("Jul");
break;
case 7:
month_out = ("Aug");
break;
case 8:
month_out = ("Sep");
break;
case 9:
month_out = ("Oct");
break;
case 10:
month_out = ("Nov");
break;
case 11:
month_out = ("Dec");
break;
default:
month_out = ("Undef");
}

if (ev.state) {
place = ev.state;
}
else {
place = ev.country;
}
time_date_area = time_date_area.concat("<a href=\"" + ev.meetup_url + "\"><span class=\"when birddogData\"><span class=\"date\">" + month_out + " " + (myDate.getDate()) + "</span><span class=\"time\">"+ time_out + "</span></span><span class=\"loc birddogData\"><span class=\"city linked\">" + ev.city+ ", " + place.toUpperCase() + "</span></span></a><a href=\""+ ev.meetup_url + "\"><span class=\"MEETUP_EVERYWHERE_WIDGET_all\">See all<span class=\"MEETUP_EVERYWHERE_WIDGET_go\">></span></span></a>");
time_date_area = time_date_area.concat("<a href=\"" + ev.meetup_url + "\"><span class=\"when birddogData\"><span class=\"date\">" + getMonth(myDate.getMonth()) + " " + (myDate.getDate()) + "</span><span class=\"time\">"+ getTime(myDate.getHours(),myDate.getMinutes()) + "</span></span><span class=\"loc birddogData\"><span class=\"city linked\">" + ev.city+ ", " + place.toUpperCase() + "</span></span></a><a href=\""+ webaddress + "\"><span class=\"MEETUP_EVERYWHERE_WIDGET_all\">See all<span class=\"MEETUP_EVERYWHERE_WIDGET_go\">></span></span></a>");
}
// MAP GENERATOR
if (i < 100) {
Expand All @@ -132,8 +69,46 @@ $.getJSON("http://api.meetup.com/ew/events?order=time&urlname="+ groupname +"&ke
write();
});

function parseCoord(loc) {

function getTime(h, m) {

var time = "AM";

if (h >= 12) {time = "PM";}
if (h > 12) { h = h - 12;}
if (m > 9) { return (h + ":" + m + " " + time);}
else {return (h + ":0" + m + " " + time);}
}

function getMonth(m) {
switch (m)
{
case 0:
return ("Jan");
case 1:
return ("Feb");
case 2:
return ("Mar");
case 3:
return ("Apr");
case 4:
return ("May");
case 5:
return ("Jun");
case 6:
return ("Jul");
case 7:
return ("Aug");
case 8:
return ("Sep");
case 9:
return ("Oct");
case 10:
return ("Nov");
case 11:
return ("Dec");
default:
return ("Undef");
}
}

function write() {
Expand Down

0 comments on commit 0f4127b

Please sign in to comment.