-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from IQSS/16-contributors
add github contributors #16
- Loading branch information
Showing
9 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
config.json | ||
cache | ||
*.pyc | ||
*.tsv | ||
contributors.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
$(document).ready(function() { | ||
loadJSON(function(response) { | ||
var contributors = JSON.parse(response); | ||
showContributors(contributors); | ||
}, | ||
"contributors.json"); | ||
}); | ||
|
||
function showContributors(contributors) { | ||
document.getElementById("contributors").innerHTML = getContributorsPerRepo(contributors); | ||
} | ||
|
||
function getContributorsPerRepo(contributors) { | ||
var all = contributors; | ||
var line = ""; | ||
for (var i = 0; i < all.length; ++i) { | ||
var url = all[i].url; | ||
var contrib_url = url + "/graphs/contributors"; | ||
var num_contributors = all[i].contributors.length; | ||
personOrPeople = 'person has contributed to'; | ||
if (num_contributors > 1) { | ||
personOrPeople = 'people have contributed to'; | ||
} | ||
line += "<p>" + num_contributors + " " + personOrPeople + " " + "<a href=\"" + contrib_url + "\" target=\"_blank\">" + url + "</a>.</p>"; | ||
} | ||
return line; | ||
} | ||
|
||
// https://codepen.io/KryptoniteDove/post/load-json-file-locally-using-pure-javascript | ||
function loadJSON(callback, jsonFile) { | ||
|
||
var xobj = new XMLHttpRequest(); | ||
xobj.overrideMimeType("application/json"); | ||
xobj.open('GET', jsonFile, true); | ||
xobj.onreadystatechange = function() { | ||
if (xobj.readyState == 4 && xobj.status == "200") { | ||
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode | ||
callback(xobj.responseText); | ||
} | ||
}; | ||
xobj.send(null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters