1
0
Fork 1

Exclude dead servers from hidden group tally

remotes/1715175271555336803/main
gravel 3 years ago
parent 40d05970fc
commit 2764a00db6
Signed by: gravel
GPG Key ID: C0538F3C906B308F

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