Commit 30b47d89 authored by Sindre Sorhus's avatar Sindre Sorhus

Add contributor list to the site

Dynamically updated from the GitHub API
parent cab2a2c2
......@@ -135,6 +135,7 @@ had it been designed for web apps">AngularJS</a>
<hr>
<footer>
<p>© TodoMVC. Brought to you by <a href="http://github.com/addyosmani">Addy Osmani</a> (lead), <a href="https://github.com/boushley">Aaron Boushley</a> and <a href="https://github.com/sindresorhus">Sindre Sorhus</a>.</p>
<p id="contributor-list">Big thanks to our magnificent contributors: <span></span></p>
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
......
......@@ -95,6 +95,11 @@ h2 {
right: 20px;
}
#contributor-list {
display: none;
font-size: 12px;
}
@media (max-width: 480px) {
#demos ul {
float: none;
......
......@@ -2,15 +2,39 @@
// Demos popover
$('#demos li a').popover({
delay: 200,
placement: 'in right',
title: function() {
return $(this).text() + '<a href="' + $(this).data('source') + '">Go to site</a>';
}
}).on('click', '.popover', function(e) {
// Prevent click on the popover, but allow links inside
if ( e.target.nodeName !== 'A' ) {
if ( e.target.nodeName.toLowerCase() !== 'a' ) {
e.preventDefault();
}
});
// Contributor list
$.getJSON('https://api.github.com/repos/addyosmani/todomvc/contributors?callback=?', function( res ) {
var data = res.data;
// Add some previous contributors not on the GitHub list
/*
[].push.apply(data, [{
login: 'test'
}, {
login: 'test'
}, {
login: 'test'
}]);
*/
var ret = $.map( res.data, function( elem ) {
var username = elem.login;
if ( $.inArray( username, [ 'addyosmani', 'boushley', 'sindresorhus' ] ) >= 0 ) {
return;
}
return '<a href="https://github.com/' + username + '">' + username + '</a>';
});
$('#contributor-list').show().children('span').html( ret.join(', ') );
});
})();
\ No newline at end of file
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