diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-05-21 21:24:03 -0700 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-05-22 09:07:24 -0700 |
| commit | 5ebbed6cb02fb4d0272a0b86c500d8f668de321d (patch) | |
| tree | 7641034271cce55d1fab7e1405265edb4ac357e9 /src/librustdoc/html/static | |
| parent | 5dc8789e300930751a78996da0fa906be5a344a2 (diff) | |
| download | rust-5ebbed6cb02fb4d0272a0b86c500d8f668de321d.tar.gz rust-5ebbed6cb02fb4d0272a0b86c500d8f668de321d.zip | |
Fix auto-hide for implementations and implementors.
This sets their toggles to be closed in the HTML (matching the default setting), and opens them if the setting indicates to do so. This distinguishes between implementations and implementors based on being descendants of certain named elements.
Diffstat (limited to 'src/librustdoc/html/static')
| -rw-r--r-- | src/librustdoc/html/static/main.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 1e28056bb68..a96b0c87108 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -776,12 +776,29 @@ function hideThemeButtonState() { var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true"; var hideImplementors = getSettingValue("auto-collapse-implementors") !== "false"; + var hideImplementations = getSettingValue("auto-hide-trait-implementations") !== "false"; var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false"; - onEachLazy(document.getElementsByTagName("details"), function (e) { - var showLargeItem = !hideLargeItemContents && hasClass(e, "type-contents-toggle"); - var showImplementor = !hideImplementors && hasClass(e, "implementors-toggle"); - if (showLargeItem || showImplementor) { + function openImplementors(id) { + var list = document.getElementById(id); + if (list !== null) { + onEachLazy(list.getElementsByClassName("implementors-toggle"), function(e) { + e.open = true; + }); + } + } + + if (!hideImplementations) { + openImplementors("trait-implementations-list"); + openImplementors("blanket-implementations-list"); + } + + if (!hideImplementors) { + openImplementors("implementors-list"); + } + + onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function (e) { + if (!hideLargeItemContents && hasClass(e, "type-contents-toggle")) { e.open = true; } if (hideMethodDocs && hasClass(e, "method-toggle")) { |
