forked from k33g/gh3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02-user.html
57 lines (47 loc) · 1.31 KB
/
02-user.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>gh3</title>
</head>
<body>
<ul id="users"></ul>
<script src="../vendors/jquery-2.1.0.min.js"></script>
<script src="../vendors/underscore-min.js"></script>
<script src="../gh3.js"></script>
<script>
var GitHubUser = Gh3.User.extend({//instance members
constructor : function(login) {
GitHubUser.__super__.constructor.call(this, login);
GitHubUser.allUsers.push(this);
}
},{ //Static members
allUsers : [],
each : function (callback) {
_.each(GitHubUser.allUsers, function (user) {
callback(user);
})
}
});
var k33g = new GitHubUser("k33g")
, loicdescotte = new GitHubUser("loicdescotte")
, mklabs = new GitHubUser("mklabs")
, chamerling = new GitHubUser("chamerling")
, usersInfos = $("#users");
GitHubUser.each(function (user) {
user.fetch(function (err, resUser) {
if(err) {
throw "outch ..."
}
usersInfos.append("<li><ul id='"+resUser.login+"'>");
var tmp_ul = $("#"+resUser.login);
_.each(_.keys(resUser), function (prop) {
tmp_ul.append(
$('<li>').append(prop+" : "+resUser[prop])
);
});
});
})
</script>
</body>
</html>