Skip to content

Commit

Permalink
Blacklist GitHub repos in aside
Browse files Browse the repository at this point in the history
allow user to specify a blacklist in _config.yml
  • Loading branch information
LeeXGreen committed Jan 23, 2014
1 parent dddf07e commit 438cf4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/_includes/asides/github.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions source/javascripts/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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); }
Expand Down

0 comments on commit 438cf4a

Please sign in to comment.