-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustdoc: make expand/collapse all ephemeral #84325
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -905,7 +905,6 @@ function hideThemeButtonState() { | |
return; | ||
} | ||
if (hasClass(innerToggle, "will-expand")) { | ||
updateLocalStorage("rustdoc-collapse", "false"); | ||
removeClass(innerToggle, "will-expand"); | ||
onEachLazy(document.getElementsByTagName("details"), function(e) { | ||
e.open = true; | ||
|
@@ -920,7 +919,6 @@ function hideThemeButtonState() { | |
}); | ||
} | ||
} else { | ||
updateLocalStorage("rustdoc-collapse", "true"); | ||
addClass(innerToggle, "will-expand"); | ||
onEachLazy(document.getElementsByTagName("details"), function(e) { | ||
e.open = false; | ||
|
@@ -1075,7 +1073,7 @@ function hideThemeButtonState() { | |
} | ||
} | ||
|
||
function collapser(e, collapse) { | ||
function collapseNonInherent(e, collapse) { | ||
// inherent impl ids are like "impl" or impl-<number>'. | ||
// they will never be hidden by default. | ||
var n = e.parentElement; | ||
|
@@ -1087,28 +1085,6 @@ function hideThemeButtonState() { | |
} | ||
} | ||
|
||
function autoCollapse(collapse) { | ||
if (collapse) { | ||
toggleAllDocs(true); | ||
} else if (getSettingValue("auto-hide-trait-implementations") !== "false") { | ||
var impl_list = document.getElementById("trait-implementations-list"); | ||
|
||
if (impl_list !== null) { | ||
onEachLazy(impl_list.getElementsByClassName("collapse-toggle"), function(e) { | ||
collapser(e, collapse); | ||
}); | ||
} | ||
|
||
var blanket_list = document.getElementById("blanket-implementations-list"); | ||
|
||
if (blanket_list !== null) { | ||
onEachLazy(blanket_list.getElementsByClassName("collapse-toggle"), function(e) { | ||
collapser(e, collapse); | ||
}); | ||
} | ||
} | ||
} | ||
|
||
function insertAfter(newNode, referenceNode) { | ||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); | ||
} | ||
|
@@ -1167,6 +1143,22 @@ function hideThemeButtonState() { | |
var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true"; | ||
var hideImplementors = getSettingValue("auto-collapse-implementors") !== "false"; | ||
var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false"; | ||
var hideTraitImplementations = | ||
getSettingValue("auto-hide-trait-implementations") !== "false"; | ||
|
||
var impl_list = document.getElementById("trait-implementations-list"); | ||
if (impl_list !== null) { | ||
onEachLazy(impl_list.getElementsByClassName("collapse-toggle"), function(e) { | ||
collapseNonInherent(e, collapse); | ||
}); | ||
} | ||
|
||
var blanket_list = document.getElementById("blanket-implementations-list"); | ||
if (blanket_list !== null) { | ||
onEachLazy(blanket_list.getElementsByClassName("collapse-toggle"), function(e) { | ||
collapseNonInherent(e, collapse); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for spotting. This was a leftover param that was only true when |
||
}); | ||
} | ||
|
||
var func = function(e) { | ||
var next = e.nextElementSibling; | ||
|
@@ -1353,8 +1345,6 @@ function hideThemeButtonState() { | |
onEachLazy(document.getElementsByClassName("docblock"), buildToggleWrapper); | ||
onEachLazy(document.getElementsByClassName("sub-variant"), buildToggleWrapper); | ||
|
||
autoCollapse(getSettingValue("collapse") === "true"); | ||
|
||
var pageId = getPageId(); | ||
if (pageId !== null) { | ||
expandSection(pageId); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this
collapse
coming from?