about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js
AgeCommit message (Collapse)AuthorLines
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
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-21rustdoc: Restore --default-theme, etc, by restoring varname escapingIan Jackson-0/+2
In #86157 cd0f93193c84ddc6698f9b65909da71c084dcb74 Use Tera templates for rustdoc. dropped the following transformation from the keys of the default settings element's `data-` attribute names: .map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v))) The `Escape` part is indeed no longer needed, because Tera does that for us. But the massaging of `-` to `_` is needed, for the (bizarre) reasons explained in the new comments. I have tested that the default theme function works again for me. I have also verified that passing --default-theme="zork&" escapes the value in the HTML. Closes #87263. CC: Jacob Hoffman-Andrews <github@hoffman-andrews.com> Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-16Copy item path rather than full `use` statement.moxian-1/+1
2021-07-13Rollup merge of #87035 - GuillaumeGomez:fix-implementors-display, r=notriddleYuki Okushi-4/+14
Fix implementors display Part of https://github.com/rust-lang/rust/issues/86632. This PR does a few things: * It fixes of the JS rendered implementors. * It generates anchors for JS rendered implementors to make it coherent with the others. * It adds a test to ensure that we won't have the same issue again. * It changes the way we render the rustdoc-gui crates to simplify it a bit and also to allow to have dependencies without going through compiletest. Before: ![Screenshot from 2021-07-10 13-30-13](https://user-images.githubusercontent.com/3050060/125174172-b4048700-e1c3-11eb-8f0e-c46081371d4f.png) After: ![Screenshot from 2021-07-10 21-11-15](https://user-images.githubusercontent.com/3050060/125174173-b49d1d80-e1c3-11eb-8740-1dbbff70c2eb.png) I plan to add the `[src]` links in another PR because this one is already big enough. cc `@Mark-Simulacrum` (for the bootstrap changes) r? `@Nemo157`
2021-07-10cleanup(rustdoc): remove unused function getObjectNameByIdMichael Howell-15/+8
This function was used in an earlier version, when idx's were used to serialize function inputs and outputs. That's not done any more, so removed the JS-side support for it.
2021-07-10Fix display for external trait implementorsGuillaume Gomez-4/+14
2021-07-07Clean up rustdoc static filesGuillaume Gomez-0/+3107