1
Fork 0

Hide type declarations by default

This commit is contained in:
Guillaume Gomez 2018-03-27 11:57:00 +02:00
parent 184156ed97
commit 73b97c7e7c
2 changed files with 166 additions and 139 deletions

View file

@ -1833,11 +1833,16 @@
onEach(e.getElementsByClassName('associatedconstant'), func);
});
function createToggle() {
function createToggle(otherMessage) {
var span = document.createElement('span');
span.className = 'toggle-label';
span.style.display = 'none';
span.innerHTML = ' Expand description';
if (!otherMessage) {
span.innerHTML = ' Expand description';
} else {
span.innerHTML = otherMessage;
span.style.fontSize = '20px';
}
var mainToggle = toggle.cloneNode(true);
mainToggle.appendChild(span);
@ -1850,7 +1855,14 @@
onEach(document.getElementById('main').getElementsByClassName('docblock'), function(e) {
if (e.parentNode.id === "main") {
e.parentNode.insertBefore(createToggle(), e);
var otherMessage;
if (hasClass(e, "type-decl")) {
otherMessage = ' Show type declaration';
}
e.parentNode.insertBefore(createToggle(otherMessage), e);
if (otherMessage) {
collapseDocs(e.previousSibling.childNodes[0], "toggle");
}
}
});