diff options
author | braxtonhall | 2022-10-24 04:16:20 +0000 |
---|---|---|
committer | braxtonhall | 2022-10-24 04:16:20 +0000 |
commit | 21d4b1499fbbb5dc6f2c91c7a2e525d0c7a1a599 (patch) | |
tree | a57eb91cf0c17bb895babe0568e27a5c2b775b56 | |
parent | b29897383d848f93fc175577bf921fbe484badb1 (diff) |
Sort entries, use correct URL for people
-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); |