diff options
-rw-r--r-- | script.js | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -9,9 +9,8 @@ function newEl(tagname, content) { return cell; } -(async function() { - const data = await (await fetch('proposals.json')).json(); - data.forEach(proposal => { +function display(proposals) { + proposals.forEach(proposal => { const row = document.createElement('tr'); const statusCell = newEl('td', proposal.status); @@ -35,4 +34,15 @@ function newEl(tagname, content) { tbody.appendChild(row); }); +} + +(async function() { + const proposals = await (await fetch('proposals.json')).json(); + + const authorFilter = new URLSearchParams(location.search).get('author'); + if (authorFilter) { + display(proposals.filter(p => p.authors && p.authors.includes(authorFilter))); + } else { + display(proposals); + } })(); |