about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/main.js
AgeCommit message (Collapse)AuthorLines
2022-04-30Move settings into full JSGuillaume Gomez-34/+145
2022-04-26Remove dead code in main.jsGuillaume Gomez-23/+0
2022-04-26Migrate main.js to ES6Guillaume Gomez-128/+130
2022-03-08Unify inherent impl blocks by wrapping them into a divGuillaume Gomez-1/+1
2022-02-05Linkify sidebar headings for sibling itemsJacob Hoffman-Andrews-16/+24
Also adjust CSS so this doesn't produce excess padding/margin.
2022-02-04Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jshaMatthias Krüger-20/+3
Add crate filter parameter in URL Fixes #92621. r? `@jsha`
2022-02-03Add filter-crate URL parameterGuillaume Gomez-20/+3
2022-01-29rustdoc: small fixes to mobile navigationJacob Hoffman-Andrews-1/+1
- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode.
2022-01-18Simplify and unify rustdoc sidebar stylesJacob Hoffman-Andrews-39/+21
This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise. I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler. Because the heading font sizes are bigger, increase the sidebar width slightly. As a very minor change, removed version from the "All types" page. It's now only on the crate page.
2022-01-18Rollup merge of #92830 - jsha:style-cleanups, r=GuillaumeGomezMatthias Krüger-27/+0
Rustdoc style cleanups - Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown Demo: https://rustdoc.crud.net/jsha/style-cleanups/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-18Rollup merge of #92803 - jsha:hide-sidebar, r=GuillaumeGomezMatthias Krüger-0/+4
Hide mobile sidebar on some clicks When the user clicks outside the sidebar, the sidebar should close. Also, when the user clicks an internal link in the sidebar, it should close. Fixes #92682 Demo: https://rustdoc.crud.net/jsha/hide-sidebar/std/string/struct.String.html
2022-01-17Hide mobile sidebar on some clicksJacob Hoffman-Andrews-0/+4
When the user clicks outside the sidebar, the sidebar should close. Also, when the user clicks an internal link in the sidebar, it should close.
2022-01-17Rustdoc style cleanupsJacob Hoffman-Andrews-27/+0
- Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown.
2022-01-14Pick themes on settings page, not every pageJacob Hoffman-Andrews-0/+5
This hides the paintbrush icon on most pages by default, in preference for the settings on the settings page. When loading from a local file, and not in mobile view, continue to show the theme picker. That's because some browsers limit access to localStorage from file:/// URLs, so choosing a theme from settings.html doesn't take effect.
2022-01-06Create CSS class instead of using inline style for search resultsGuillaume Gomez-2/+2
2021-12-22Add some JSDoc comments to rustdoc JSJacob Hoffman-Andrews-0/+7
This follows the Closure Compiler dialect of JSDoc, so we can use it to do some basic type checking. We don't plan to compile with Closure Compiler, just use it to check types. See https://github.com/google/closure-compiler/wiki/ for details.
2021-12-02Rename ID "main" into "main-content"Guillaume Gomez-2/+3
2021-11-29rustdoc: use flexbox to layout sidebar and main contentcynecx-1/+1
2021-11-24Consistentize the system for image URLs in CSS.Jacob Hoffman-Andrews-2/+2
2021-11-24Move themes and version into rustdoc-varsJacob Hoffman-Andrews-9/+24
We had been injecting the list of themes and the rustdoc version into main.js by rewriting it at doc generation time. By avoiding this rewrite, we can make it easier to edit main.js without regenerating all the docs. Added a more convenient accessor for rustdoc-vars. Changed storage.js to not rely on resourcesSuffix. It could in theory use rustdoc-vars, but because rustdoc-vars is at the end of the HTML, it's not available when storage.js runs (very early in page load).
2021-11-24Fix clicking on anchors inside summary tags.Jacob Hoffman-Andrews-1/+1
2021-11-22Add GUI test for clicking on non-toggle summaryJacob Hoffman-Andrews-1/+1
2021-11-21Inhibit clicks on summary's childrenJacob Hoffman-Andrews-0/+8
A byproduct of using `<details>` and `<summary>` to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior. That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise. This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a `<div>`, which is the target for anything that doesn't have a more specific target.
2021-11-04Fix missing bottom border for headings in sidebarGuillaume Gomez-2/+7
2021-10-31Hide search bar in noscript.cssJacob Hoffman-Andrews-1/+3
Also, remove the highlighting of the search bar in disabled state. This reduces flicker when loading a page.
2021-09-17Add rustdoc version into the help popupGuillaume Gomez-0/+9
2021-08-16Rollup merge of #87178 - moxian:rd-use, r=jyn514Mara Bos-1/+1
[rustdoc] Copy only item path to clipboard rather than full `use` statement. The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice. However, i tend to write my code with fully qualified paths wherever feasible and only resort to `use` statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say ```rust impl use std::ops::Add; for MyType { ``` and then go back and remove the `use ` and `;`. This PR removes the `use ;` decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the `use ;` decoration can be done by hand with little effort.
2021-07-25Rustdoc accessibility: use real headers for doc itemsbors-1/+2
Part of #87059 Partially reverts #84703 Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
2021-07-16Copy item path rather than full `use` statement.moxian-1/+1
2021-07-10Fix display for external trait implementorsGuillaume Gomez-4/+14
2021-07-07Clean up rustdoc static filesGuillaume Gomez-0/+1018