help.ts: Hide empty alias divs

This commit is contained in:
glacambre 2018-06-03 16:38:03 +02:00
parent 54e980499c
commit d89311cf17
No known key found for this signature in database
GPG key ID: B9625DB1767553AC

View file

@ -60,6 +60,14 @@ async function setCommandAliases() {
aliasElems[excmd].appendChild(aliasLi)
}
}
// Remove all aliasElems that do not have at least one alias
Object.values(aliasElems)
.filter(
(e: HTMLElement) =>
!Array.from(e.children).find(c => c.tagName == "LI"),
)
.forEach((e: HTMLElement) => e.parentNode.removeChild(e))
}
browser.storage.onChanged.addListener((changes, areaname) => {