Permalink
Browse files

Merge pull request #6 from LeeXGreen/github-aside-blacklist-repos

Allow user to blacklist GitHub repos in aside
  • Loading branch information...
erikzaadi committed Mar 20, 2014
2 parents 0078f37 + 438cf4a commit 8a2faf07c240c05aed60a1b19ddadf79343b2f0f
Showing with 4 additions and 1 deletion.
  1. +2 −1 source/_includes/asides/github.html
  2. +2 −0 source/javascripts/github.js
@@ -21,7 +21,8 @@ <h1>GitHub Repos</h1>
user: '{{site.github_user}}',
count: {{site.github_repo_count}},
skip_forks: {{site.github_skip_forks}},
- target: '#gh_repos'
+ target: '#gh_repos',
+ blacklist: '{{site.github_blacklist_repos}}'
});
});
</script>
@@ -12,6 +12,7 @@ var github = (function(){
}
return {
showRepos: function(options){
+ options.blacklist = options.blacklist.split(',');
$.ajax({
url: "https://api.github.com/users/"+options.user+"/repos?sort=pushed"
, dataType: 'json'
@@ -21,6 +22,7 @@ var github = (function(){
if (!data ) { return; }
for (var i = 0; i < data.length; i++) {
if (options.skip_forks && data[i].fork) { continue; }
+ if (options.blacklist instanceof Array && options.blacklist.indexOf(data[i].name) !== -1) { continue; }
repos.push(data[i]);
}
if (options.count) { repos.splice(options.count); }

0 comments on commit 8a2faf0

Please sign in to comment.