Hide the expand arrow if there is not enough orgs displayed

lektura
Vincent Lequertier 2018-02-20 15:52:00 +01:00
parent 1b91bc7787
commit cee4179acd
1 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,13 @@ function selectOrgType(type) {
li_orgs[i].style.display = "inline-block";
}
}
// Hide the 'expand' arrow if there is no need for it
if (countOrgsToDisplay(li_orgs, type) < 27) {
document.getElementsByClassName('expand')[0].style.visibility = 'hidden';
} else {
document.getElementsByClassName('expand')[0].style.visibility = 'visible';
}
}
function showAllOrgs() {
@ -35,3 +42,9 @@ function showAllOrgs() {
li_orgs[i].style.display = "inline-block";
}
}
function countOrgsToDisplay(orgs, type) {
return Array.from(orgs).filter(function(element) {
return element.getAttribute('orgtype') === type;
}).length;
}