summaryrefslogtreecommitdiff
path: root/script.js
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-07-12 13:28:25 +0200
committerMartin Fischer <martin@push-f.com>2022-07-12 13:28:25 +0200
commit88d6a52f239c8dc706eeee337fae4972de5a9936 (patch)
treefe368c752e3e575e0dbd8e88ceae61597344249f /script.js
parentbbe6d4740723315fc91b0298ab8a0a6292fa4ac7 (diff)
implement ?author filtering
Diffstat (limited to 'script.js')
-rw-r--r--script.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/script.js b/script.js
index 0c17abf..afe5df2 100644
--- a/script.js
+++ b/script.js
@@ -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);
+ }
})();