Opt-in by starring resume.github.com project.

This commit is contained in:
7rans
2013-11-19 17:31:01 -05:00
parent 1e45a8e458
commit d9dca6e8f6
4 changed files with 30 additions and 46 deletions

View File

@@ -79,12 +79,36 @@ var github_user_orgs = function(username, callback) {
$.getJSON('https://api.github.com/users/' + username + '/orgs?callback=?', callback);
}
var github_user_stars = function(username) {
var repos = [];
$.ajax({
url: 'https://api.github.com/users/' + username + '/starred',
async: false,
dataType: 'json',
success: function(json) {
repos = json;
}
});
return repos;
}
var github_user_starred_resume = function(username) {
var starred = false;
var repos = github_user_stars(username);
$.each(repos, function(i, repo) {
if (repo.full_name == "resume/resume.github.com") {
starred = true;
}
});
return starred;
}
var run = function() {
var itemCount = 0,
maxItems = 5,
maxLanguages = 9;
if (githubresume_opt_out_users.indexOf(username) >= 0) {
if (! github_user_starred_resume(username)) {
$.ajax({
url: 'views/opt_out.html',
dataType: 'html',