Exclude dead servers from hidden group tally

docs
gravel 3 years ago
parent 139e696686
commit f465669db1
Signed by: gravel
SSH Key Fingerprint: SHA256:p4HP49CCk4YQMkJpWJ09L8peEPQWjERtdCRAFxPfbOY

@ -86,8 +86,10 @@ function hideBadCommunities() {
let numberOfHiddenCommunities = 0;
for (const category of ['tests', 'offensive', 'legacy']) {
filteredCommunities[category].forEach(hideElementByID);
numberOfHiddenCommunities += filteredCommunities[category].length;
numberOfHiddenCommunities +=
filteredCommunities[category]
.map(hideElementByID)
.reduce((a, b) => a + b);
}
// Not ideal. Separate element should be allocated for content.
@ -95,8 +97,13 @@ function hideBadCommunities() {
summary.innerText += ` (${numberOfHiddenCommunities} hidden)`;
}
/**
* Removes an element by its ID and returns the number of elements removed.
*/
function hideElementByID(id) {
document.getElementById(id)?.remove();
const element = document.getElementById(id);
element?.remove();
return element ? 1 : 0;
}
/**

Loading…
Cancel
Save