about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js
AgeCommit message (Collapse)AuthorLines
2022-02-10Remove support for multi-query searchGuillaume Gomez-97/+6
2022-02-07Rollup merge of #93673 - jsha:linkify-sidebar-headings, r=GuillaumeGomezMara Bos-16/+24
Linkify sidebar headings for sibling items Also adjust CSS so this doesn't produce excess padding/margin. Note: I tried and failed to write a test with browser-UI-test. First I tried to `assert-property: (".block.mod h3 a", {"href": "index.html#macros"})`. But the `href` that gets read out is the fully-quallified URL, starting with `file:///`. That URL will differ depending on what path the test is run from, so that doesn't work. Next I tried clicking on the appropriate sidebar link, and verifying that the appropriate heading on the next page is highlighted with the right background color. However, that also didn't work: according to browser-UI-test, the targeted heading was plain white. However, running with no-headless, I could see that it actually was yellow. I suspect this is a bug in the older version of Chromium used with browser-UI-test's bundled puppeteer, since it doesn't reproduce on latest Chrome. Fixes #92957 Demo: https://rustdoc.crud.net/jsha/linkify-sidebar-headings/std/string/trait.ToString.html r? ``@GuillaumeGomez``
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-04Refactor conditionalEliaz Bobadilla-5/+2
2022-02-04Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jshaMatthias Krüger-58/+108
Add crate filter parameter in URL Fixes #92621. r? `@jsha`
2022-02-03Add filter-crate URL parameterGuillaume Gomez-47/+97
2022-02-02Unify storage getter and setter functionsGuillaume Gomez-12/+12
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-25Rollup merge of #93251 - jsha:theme-radio, r=GuillaumeGomezMatthias Krüger-10/+19
rustdoc settings: use radio buttons for theme This reduces the number of clicks required to change theme. Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon. Demo: https://rustdoc.crud.net/jsha/theme-radio/settings.html r? ``@GuillaumeGomez`` New: ![image](https://user-images.githubusercontent.com/220205/150702647-4826d525-54fa-439a-b24c-6d5bca6f95bf.png) Old: ![image](https://user-images.githubusercontent.com/220205/150702669-6a4214ed-1dab-4fee-b1aa-59acfce3dbca.png)
2022-01-23Update theme on pageshow eventJacob Hoffman-Andrews-6/+25
When a user goes forward or back, the page may be rendered from the back/forward cache (https://web.dev/bfcache/) rather than from scratch. If they have changed theme in the meantime, that means seeing an incorrect theme on the page they went forward or back to. The `pageshow` event fires on such navigations, so we can update the theme based on that event.
2022-01-23rustdoc settings: use radio buttons for themeJacob Hoffman-Andrews-10/+19
This reduces the number of clicks required to change theme. Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon.
2022-01-18Simplify and unify rustdoc sidebar stylesJacob Hoffman-Andrews-40/+22
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-33/+12
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-33/+12
- 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-14Add support for "always theme" in settingJacob Hoffman-Andrews-4/+35
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-09Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomezMatthias Krüger-17/+22
Move crate drop-down to search results page This reduces clutter on doc pages. Part of #59840 r? ```@GuillaumeGomez``` Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
2022-01-06Create CSS class instead of using inline style for search resultsGuillaume Gomez-2/+2
2022-01-05Move crate drop-down to search results pageJacob Hoffman-Andrews-17/+22
This reduces clutter on doc pages.
2021-12-22Add some JSDoc comments to rustdoc JSJacob Hoffman-Andrews-30/+170
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-20Move duplicates removal when generating results instead of when displaying themGuillaume Gomez-11/+13
2021-12-16Make loop more clear by renaming variablesGuillaume Gomez-4/+8
2021-12-16Clean up search code and unify function returned valuesGuillaume Gomez-108/+96
2021-12-08Fix indent of itemTypes in search.jsGuillaume Gomez-26/+28
2021-12-02Rename ID "main" into "main-content"Guillaume Gomez-7/+8
2021-11-29rustdoc: rework source sidebarcynecx-16/+9
2021-11-29rustdoc: merge source sidebar into main sidebarcynecx-6/+8
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-14/+26
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-10-29Fix invalid handling of genericsGuillaume Gomez-13/+24
2021-10-08Move more scrape-examples logic from JS to rustWill Crichton-33/+13
Fix failing test Add missing backslash Fix padding issue with horizontal scrollbar
2021-10-07Move some expansion logic into generation-time, fix section header links, ↵Will Crichton-9/+3
remove ID from line numbers, fix horizontal scrolling on non-expanded elements
2021-10-06Fix lint error, change scrape-examples.js minify callWill Crichton-0/+2
2021-10-06Move JS into a standalone fileWill Crichton-115/+110
2021-10-06Incorporate jyn's feedbackWill Crichton-0/+25
* Move call location logic from function constructor to rendering * Fix issue with macro spans in scraping examples * Clean up example loading logic Documentation / newtype for DecorationInfo Fix line number display Serialize edition of call site, other small cleanup
2021-10-06Move highlighting logic from JS to RustWill Crichton-124/+31
Continue migrating JS functionality Cleanup Fix compile error Clean up the diff Set toggle font to sans-serif
2021-10-06Sort examples by sizeWill Crichton-9/+20
Improve styling Start to clean up code, add comments
2021-10-06Factor scraping and rendering into separate calls to rustdocWill Crichton-44/+11
Simplify toggle UI logic, add workspace root for URLs
2021-10-06Fix check issueWill Crichton-6/+15
Clean up tidy checks
2021-10-06Add updated support for example-analyzerWill Crichton-0/+196
Move rendering of examples into Finalize design Cleanup, rename found -> scraped Softer yellow Clean up dead code Document scrape_examples More simplification and documentation Remove extra css Test
2021-09-17Add rustdoc version into the help popupGuillaume Gomez-0/+9
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1