Merge pull request #20 from alotaiba/master.

Fixed Some Issues With Languages and Organizaitions
This commit is contained in:
David Coallier 2011-05-01 16:57:55 -07:00
commit fce62cde11
2 changed files with 8 additions and 26 deletions

View File

@ -233,26 +233,7 @@
// alert(data.repositories.length);
// });
gh.user.prototype.allRepos = function (callback, context) {
var repos = [],
username = this.username,
page = 1;
function exitCallback () {
callback.call(context, { repositories: repos });
}
function pageLoop (data) {
if (data.repositories.length == 0) {
exitCallback();
} else {
repos = repos.concat(data.repositories);
page += 1;
gh.repo.forUser(username, pageLoop, context, page);
}
}
gh.repo.forUser(username, pageLoop, context, page);
gh.repo.search('username:' + this.username, "", callback, context);
return this;
};
@ -283,6 +264,11 @@
}
);
gh.user.prototype.orgs = function(callback, context) {
jsonp("user/show/" + this.username + "/organizations", callback, context);
return this;
}
// Search users for `query`.
gh.user.search = function (query, callback, context) {
jsonp("user/search/" + query, callback, context);
@ -425,6 +411,7 @@
context = arguments[2];
}
url += "?" + paramify(opts);
jsonp(url, callback, context);
return this;
};

View File

@ -54,15 +54,10 @@ var home = function() {
};
var run = function() {
var gh_user = gh.user(username);
var itemCount = 0, maxItems = 5, maxLanguages = 9;
var res = gh_user.show(function(data) {
gh_user.allRepos(function(data) {
repos = data;
});
var since = new Date(data.user.created_at);
since = since.getFullYear();