-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add option to collapse automatically implementors #74196
Changes from all commits
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 |
---|---|---|
|
@@ -2241,8 +2241,7 @@ function defocusSearchBar() { | |
relatedDoc = relatedDoc.nextElementSibling; | ||
} | ||
|
||
if ((!relatedDoc && hasClass(docblock, "docblock") === false) || | ||
(pageId && document.getElementById(pageId))) { | ||
if (!relatedDoc && hasClass(docblock, "docblock") === false) { | ||
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. Little note about this change for the reviewers: it was to prevent an element targetted by the url hash (so |
||
return; | ||
} | ||
|
||
|
@@ -2362,6 +2361,7 @@ function defocusSearchBar() { | |
(function() { | ||
var toggle = createSimpleToggle(false); | ||
var hideMethodDocs = getCurrentValue("rustdoc-auto-hide-method-docs") === "true"; | ||
var hideImplementors = getCurrentValue("rustdoc-auto-collapse-implementors") !== "false"; | ||
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. Just curious - why do these use strings instead of 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. When you use the local storage, it converts everything to string. As simple as that. :) |
||
var pageId = getPageId(); | ||
|
||
var func = function(e) { | ||
|
@@ -2391,7 +2391,13 @@ function defocusSearchBar() { | |
if (hasClass(e, "impl") && | ||
(next.getElementsByClassName("method").length > 0 || | ||
next.getElementsByClassName("associatedconstant").length > 0)) { | ||
insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]); | ||
var newToggle = toggle.cloneNode(true); | ||
insertAfter(newToggle, e.childNodes[e.childNodes.length - 1]); | ||
// In case the option "auto-collapse implementors" is not set to false, we collapse | ||
// all implementors. | ||
if (hideImplementors === true && e.parentNode.id === "implementors-list") { | ||
collapseDocs(newToggle, "hide", 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.
overall i think we might need to fix up the language used for all these settings in a separate issue, it seems very unclear (cc @jyn514 thoughts?)
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.
It's not terribly clear but it does say exactly what it does (
attributes
is the technical term for#[some_macro]
, right?). I think it would be helpful to have screenshots before and after, then it's very clear to see.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.
I'm thinking of the entire set of names, not just this one, though. This one is kinda fine.