Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up rustdoc front-end source code #76022

Merged
merged 2 commits into from
Aug 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
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();
GuillaumeGomez marked this conversation as resolved.
Show resolved Hide resolved
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;
}
jyn514 marked this conversation as resolved.
Show resolved Hide resolved

var toggle = createSimpleToggle(false);
var hideMethodDocs = getCurrentValue("rustdoc-auto-hide-method-docs") === "true";
var hideImplementors = getCurrentValue("rustdoc-auto-collapse-implementors") !== "false";
Expand Down