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
/
group_calendar.html
92 lines (92 loc) · 2.79 KB
/
group_calendar.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
<html>
<head>
<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>
<script id="config" type="text/javascript">
var $parameters = {
group_urlname: "ny-tech",
after: "-6m",
before: "6m",
_width: 400,
_height: 290,
_name: "Group Calendar",
_description: "Lists recent and upcoming meetups for the specified group. The style is very basic so it can be easily adapted to match your site."
};
var $queries = {
events: function() {
return api_call("/events", {
after: $parameters.after,
before: $parameters.before,
group_urlname: $parameters.group_urlname,
page: 6,
desc: true
});
},
groups: function() {
return api_call("/groups", {
group_urlname: $parameters.group_urlname
});
}
};
</script>
<style type="text/css">
body {
font-family: arial, sans-serif;
font-size: 12px;
padding: 0;
margin: 0;
}
h2 { margin: 0 0 1em 0 }
ul {
padding: 0;
margin: 0;
list-style-type: none;
}
li { margin: 1em 0; }
</style>
<script type="text/javascript">
$(function() {
target = $("#meetups");
$.getJSON($queries.groups(), function(data) {
if (data.results) for (var i in data.results) {
$("#group_name").text(data.results[i].name)
}
});
$.getJSON($queries.events(), function(data) {
target.empty();
if (data.status && data.status.match(/^200/) == null) {
$("#meetup_listing").empty();
} else for (var i in data.results.reverse()) {
ev = data.results[data.results.length - i - 1];
ds = ev.time.match(/\w+ (\w+) (\d+) (\d+):(\d+):\d+ \w+ (\d+)/)
year = ds.pop();
minute = ds.pop();
hour = ds.pop();
day = ds.pop();
month = ds.pop();
date = month + " " + day + ", " + year + " @ " + hour % 12 + ":" +
minute + (hour < 12 ? "am" : "pm");
li = $('<li></li>');
li.append($('<div style="font-weight: bold"></div>').append(ev.name))
go = $('<div></div>').append($('<a target="_TOP" href="' + ev.event_url + '"></a>').append(date))
if (ev.status == 'upcoming')
go.append(' | ')
.append($('<a target="_TOP" href="' + ev.event_url + '" style="background: red; color: white; text-decoration: none; font-size: smaller; font-weight: bold; padding: .3em .5em; border: white; -webkit-border-radius: .3em; -moz-border-radius: .3em"></a>')
.append("RSVP")
);
target.append(li.append(go));
}
});
});
</script>
</head>
<body>
<div id="meetup_listing">
<h2><span id="group_name"></span> Calendar</h2>
<ul id="meetups">
<li><em>Loading...</em></li>
</ul>
</div>
</body>
</html>