Skip to content

Commit

Permalink
Clean up rustdoc front-end source code
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 28, 2020
1 parent 2fe9a33 commit 4b8ebbc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/librustdoc/html/static/main.js
Expand Up @@ -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;
});
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 4b8ebbc

Please sign in to comment.