Skip to content

Commit

Permalink
Inject HTML content after loop ends
Browse files Browse the repository at this point in the history
  • Loading branch information
codegaze committed Jan 15, 2017
1 parent ecc72f9 commit 3e5c7ab
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scripts/contributors.js
Expand Up @@ -4,15 +4,16 @@ window.onload = function() {
request.open('get', 'https://api.github.com/repos/maban/styleguides/contributors?&per_page=200', true)
request.send()
function outputContributors() {
var contributors = JSON.parse(this.responseText);
var injectContributors = document.getElementById("people");
var contributors = JSON.parse(this.responseText),
injectContributors = document.getElementById('people'),
html = '';
for (i in contributors) {
var username = contributors[i].login
var avatar = contributors[i].avatar_url
var url = contributors[i].html_url
var contributions = contributors[i].contributions
var html = '<li class="person"><a class="person__url" href="'+ url +'"><img src="' + avatar + '" alt="" width="50" class="person__avatar" title="' + username + '"/></a></li>';
injectContributors.innerHTML += (html);
var username = contributors[i].login,
avatar = contributors[i].avatar_url,
url = contributors[i].html_url,
contributions = contributors[i].contributions;
html += '<li class="person"><a class="person__url" href="'+ url +'"><img src="' + avatar + '" alt="" width="50" class="person__avatar" title="' + username + '"/></a></li>';
}
injectContributors.innerHTML = html;
}
}

0 comments on commit 3e5c7ab

Please sign in to comment.