Clean up rustdoc front-end source code

This commit is contained in:
Guillaume Gomez 2020-08-28 13:30:21 +02:00
parent 2fe9a33659
commit 4b8ebbcc5a

View File

@ -1396,8 +1396,8 @@ function defocusSearchBar() {
// "current" is used to know which tab we're looking into.
var current = 0;
onEachLazy(document.getElementById("results").childNodes, function(e) {
onEachLazy(e.getElementsByClassName("highlighted"), function(e) {
actives[current].push(e);
onEachLazy(e.getElementsByClassName("highlighted"), function(h_e) {
actives[current].push(h_e);
});
current += 1;
});
@ -2113,8 +2113,12 @@ function defocusSearchBar() {
}
}
function getToggleAllDocsElement() {
return document.getElementById("toggle-all-docs");
}
function toggleAllDocs(pageId, fromAutoCollapse) {
var innerToggle = document.getElementById("toggle-all-docs");
var innerToggle = getToggleAllDocsElement();
if (!innerToggle) {
return;
}
@ -2307,11 +2311,6 @@ function defocusSearchBar() {
}
}
var toggles = document.getElementById("toggle-all-docs");
if (toggles) {
toggles.onclick = toggleAllDocs;
}
function insertAfter(newNode, referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
@ -2361,6 +2360,11 @@ function defocusSearchBar() {
}
(function() {
var toggles = document.getElementById("toggle-all-docs");
if (toggles) {
toggles.onclick = toggleAllDocs;
}
var toggle = createSimpleToggle(false);
var hideMethodDocs = getCurrentValue("rustdoc-auto-hide-method-docs") === "true";
var hideImplementors = getCurrentValue("rustdoc-auto-collapse-implementors") !== "false";