1
Fork 0

Auto merge of #49412 - GuillaumeGomez:hide-type-decl, r=QuietMisdreavus

Hide type declarations by default

I'm not very happy for the moment about the rendering but the bases are here:

<img width="610" alt="screen shot 2018-03-27 at 11 56 27" src="https://user-images.githubusercontent.com/3050060/37960492-0e045954-31b6-11e8-9cea-1ef8a3f980c4.png">

r? @QuietMisdreavus
This commit is contained in:
bors 2018-03-30 01:45:54 +00:00
commit 15e8c5d846
2 changed files with 166 additions and 139 deletions

View file

@ -1845,11 +1845,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 = '&nbsp;Expand&nbsp;description';
if (!otherMessage) {
span.innerHTML = '&nbsp;Expand&nbsp;description';
} else {
span.innerHTML = otherMessage;
span.style.fontSize = '20px';
}
var mainToggle = toggle.cloneNode(true);
mainToggle.appendChild(span);
@ -1862,7 +1867,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 = '&nbsp;Show&nbsp;type&nbsp;declaration';
}
e.parentNode.insertBefore(createToggle(otherMessage), e);
if (otherMessage) {
collapseDocs(e.previousSibling.childNodes[0], "toggle");
}
}
});