diff options
-rw-r--r-- | index.html | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -45,11 +45,11 @@ <div id="contributors"></div> </div> <script> - const getContributors = _ => fetch("/people.json").then(res => res.json()); + const getContributors = _ => fetch(`${window.location.href}/people.json`).then(res => res.json()); const toPersonNode = person => $("<div>", {class: "person"}).append( toPersonHeader(person), - ...person.entries.sort(cmpEntry).map(toPersonEntryNode), + ...person.entries.sort(cmpName).map(toPersonEntryNode), ); const toPersonImage = github => github @@ -77,13 +77,11 @@ }).append($("<code>").text(entry.name)), ); - const cmpPeople = () => 1; // TODO - - const cmpEntry = () => 1; // TODO + const cmpName = (a, b) => a.name < b.name ? -1 : 1; $(document).ready(async _ => { const contributors = await getContributors() - .then(people => people.sort(cmpPeople)) + .then(people => people.sort(cmpName)) .then(people => people.map(toPersonNode)) .then(nodes => $("#contributors").append(...nodes)); console.log(contributors); |