forked from opentofu/manifesto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.js
24 lines (21 loc) · 807 Bytes
/
count.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
window.onload = function() {
let counts = {
'Company': 0,
'Project': 0,
'Foundation': 0,
'Individual': 0
};
let rows = document.querySelectorAll('table tr');
rows.forEach(row => {
let cells = row.querySelectorAll('td');
cells.forEach(cell => {
if (counts.hasOwnProperty(cell.textContent)) {
counts[cell.textContent]++;
}
});
});
document.querySelector('#companyOutput .count').textContent = counts['Company'];
document.querySelector('#projectOutput .count').textContent = counts['Project'];
document.querySelector('#foundationOutput .count').textContent = counts['Foundation'];
document.querySelector('#individualOutput .count').textContent = counts['Individual'];
};