Commit 4694fe3f authored by Sindre Sorhus's avatar Sindre Sorhus

Add some names to the contributor list and show the name instead of username if possible

Had to use the old GitHub v2 API, since v3 doesn't have a 'name' field...
parent 30b47d89
......@@ -15,24 +15,28 @@
});
// Contributor list
$.getJSON('https://api.github.com/repos/addyosmani/todomvc/contributors?callback=?', function( res ) {
var data = res.data;
$.ajaxSetup({
cache: true
});
$.getJSON('https://github.com/api/v2/json/repos/show/addyosmani/todomvc/contributors?callback=?', function( res ) {
var data = res.contributors;
// Add some previous contributors not on the GitHub list
/*
[].push.apply(data, [{
login: 'test'
login: 'tomdale',
name: 'Tom Dale'
}, {
login: 'test'
login: 'justinbmeyer',
name: 'Justin Meyer'
}, {
login: 'test'
login: 'maccman',
name: 'Alex MacCaw'
}]);
*/
var ret = $.map( res.data, function( elem ) {
var ret = $.map( data, function( elem ) {
var username = elem.login;
if ( $.inArray( username, [ 'addyosmani', 'boushley', 'sindresorhus' ] ) >= 0 ) {
return;
}
return '<a href="https://github.com/' + username + '">' + username + '</a>';
return '<a href="https://github.com/' + username + '">' + ( elem.name || username ) + '</a>';
});
$('#contributor-list').show().children('span').html( ret.join(', ') );
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment