about summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2021-01-18Remove inline script tagsGuillaume Gomez-12/+27
2021-01-15Rollup merge of #80515 - GuillaumeGomez:js-for-loop-perf, r=Nemo157,jyn514Guillaume Gomez-56/+50
Improve JS performance by storing length before comparing to it in loops Since https://github.com/rust-lang/rust/pull/79052 is quite complicated to review, I suggested to split into smaller parts. This first part is mostly about saving the array length into a variable (I tried to not change anything else as much as possible :smiley: ). r? `@jyn514`
2021-01-15Use Array.some instead of onEach to have better performanceGuillaume Gomez-1/+1
2021-01-15Improve JS performance by storing length before comparing to it in loopsGuillaume Gomez-56/+50
2021-01-08Rollup merge of #80738 - arusahni:master, r=GuillaumeGomezYuki Okushi-0/+1
Remove bottom margin from crate version when the docs sidebar is collapsed This fixes a mobile UI bug where a vertical scrollbar would always be rendered on the sidebar nav when the menu was closed. When opened, the overflow would be handled by the opened sidebar, causing the scrollbar to disappear, and the contents to shift to the right. ## Firefox **Before** ![before-ff](https://user-images.githubusercontent.com/139487/103713599-c2f74c00-4f8a-11eb-88c0-d5c6c088f8a0.png) ![before](https://user-images.githubusercontent.com/139487/103713793-2bdec400-4f8b-11eb-8223-94b77cc05f71.gif) **After** ![after-ff](https://user-images.githubusercontent.com/139487/103713605-c8ed2d00-4f8a-11eb-9ee8-f86cafaa8775.png) ![after](https://user-images.githubusercontent.com/139487/103713805-31d4a500-4f8b-11eb-9e5b-4156402ca43e.gif) ## Chrome **Before** ![localhost_8000_unicode_xid_ (1)](https://user-images.githubusercontent.com/139487/103713626-d60a1c00-4f8a-11eb-8605-cc98e04e9ad0.png) **After** ![localhost_8000_unicode_xid_](https://user-images.githubusercontent.com/139487/103713622-d1456800-4f8a-11eb-8c66-7d19f81614ca.png)
2021-01-05Remove bottom margin from crate version when the sidebar is collapsed.Aru Sahni-0/+1
This fixes a mobile UI bug where a vertical scrollbar would always be rendered on the sidebar nav when the menu was closed.
2021-01-04Auto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514bors-18/+12
More js cleanup Part of #79052 (Same kind as #80515). This one is about some small fixes: * Replacing some loops with `onEachLazy`. * Removing unused function arguments. * Turn `buildHelperPopup` into a variable so it can be "replaced" once the function has been called once so it's not called again. r? `@jyn514`
2021-01-03Inline resetMouseMoved function directly into "mousemove" event handlerGuillaume Gomez-5/+1
2021-01-03Replace some loops with "onEachLazy" callGuillaume Gomez-13/+11
2021-01-02Auto merge of #80412 - GuillaumeGomez:fix-search-section-pos, r=jyn514bors-1/+4
Fix search section position on small devices Fixes #79526. This is exactly the same issue fixed in 9c36491538476dd3ff5ec834944aacdaceb12f30 (in https://github.com/rust-lang/rust/pull/79936) but applied to the search section. When the width becomes too small, the search input goes on its own line to get more space, making it go "under" the section following (so either "main" or "search"). The fix is to simply make the section go more under so that it doesn't go over the search input. r? `@jyn514`
2020-12-31Use Array.prototype.filter instead of open-codingMichael Howell-7/+1
Part of #79052, originally suggested in https://github.com/rust-lang/rust/pull/79052#discussion_r523468743 Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-30If the current search result tab is empty, it picks the first non-empty one. ↵Guillaume Gomez-0/+15
If all are empty, the current one doesn't change.
2020-12-30Rollup merge of #80472 - GuillaumeGomez:sans-serif-for-all-items-page, r=Nemo157Yuki Okushi-1/+3
Use sans-serif font for the "all items" page links The "all items" pages' links aren't using a sans-serif font unlike the rest of equivalent items in the other module pages. ``@Nemo157`` reported me this issue so here is the fix! r? ``@Nemo157``
2020-12-29Use sans-serif font for the "all items" page linksGuillaume Gomez-1/+3
2020-12-29Fix search section position on small devicesGuillaume Gomez-1/+4
2020-12-24Auto merge of #79742 - GuillaumeGomez:move-tooltips-messages-out-of-html, ↵bors-13/+23
r=Nemo157 Move tooltips messages out of html First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have `ignore`, `compile_fail`, `should_panic` and `edition`. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up. So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (`::before` and `::after`). The message is now inside `::after` and we use the `::before` to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice. So now, back to the `edition` change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip called `edition` which contains this information. Then, the `::after` uses it inside its `content` (you can get the content of an element's attribute by using `attr` and concat different strings by simply having them after the other). Don't hesitate if a part of my explanations isn't clear. r? `@jyn514`
2020-12-23Update HTML DOM attribute "edition" to "data-edition"Guillaume Gomez-1/+1
2020-12-15Rollup merge of #79796 - ↵Guillaume Gomez-3/+6
GuillaumeGomez:hide-associated-const-when-collapsing, r=jyn514 Hide associated constants too when collapsing implementation Fixes #71849. r? `@jyn514`
2020-12-15Rollup merge of #79379 - GuillaumeGomez:no-js-not-hidden, r=Nemo157Guillaume Gomez-0/+10
Show hidden elements by default when JS is disabled Fixes #79301. A lot of things are hidden by default which shouldn't when JS is disabled. This PR fixes it. Before: ![Screenshot from 2020-11-24 14-10-16](https://user-images.githubusercontent.com/3050060/100099361-a16d5580-2e5f-11eb-891b-a4c005aeb1d0.png) After: ![after](https://user-images.githubusercontent.com/3050060/100099382-a6caa000-2e5f-11eb-8190-14f330aff9a2.png) r? `@jyn514`
2020-12-14Rollup merge of #79936 - GuillaumeGomez:mobile-fix-item-name, r=Nemo157,jyn514Guillaume Gomez-1/+5
Fix item name display on mobile Fixes https://github.com/rust-lang/docs.rs/issues/1200 ![Screenshot_20201211-200931](https://user-images.githubusercontent.com/3050060/101944457-0c06eb00-3bed-11eb-8f63-a4d4fd3cbb56.jpg) ![Screenshot_20201211-195846](https://user-images.githubusercontent.com/3050060/101944459-0d381800-3bed-11eb-91ff-815a2af7ca72.jpg) cc `@jyn514` r? `@Nemo157`
2020-12-12rustdoc light theme: Fix CSS for selected buttonsCamelid-1/+1
The background was dark before, which made the text impossible to read. Now the background is white, which is how selected `div`s are rendered. As a result, the search results tabs now look identical to how they used to look (before #79896).
2020-12-11Fix main section position so that the search input remains clickableGuillaume Gomez-0/+4
2020-12-11Fix item name display on mobileGuillaume Gomez-1/+1
2020-12-10Make search results tab and help button focusable with keyboardGuillaume Gomez-19/+22
2020-12-09Rollup merge of #79862 - GuillaumeGomez:tab-lock, r=ManishearthTyler Mandry-16/+17
Remove tab-lock and replace it with ctrl+up/down arrows to switch between search result tabs Fixes https://github.com/rust-lang/rust/issues/65212 What took the longest time was to update the help popup in the end. r? `@Manishearth`
2020-12-09Remove tab-lock and replace it with ctrl+up/down arrows to switch between ↵Guillaume Gomez-16/+17
search result tabs
2020-12-09Hide associated constants too when collapsing implementationGuillaume Gomez-3/+6
2020-12-05Move tooltips messages to CSS instead of inside HTMLGuillaume Gomez-13/+23
2020-12-03Use `createElement` and `innerHTML` instead of `DOMParser`Camelid-5/+3
@GuillaumeGomez was concerned about browser compatibility.
2020-12-03Render Markdown in search resultsCamelid-2/+23
Previously Markdown documentation was not rendered to HTML for search results, which led to the output not being very readable, particularly for inline code. This PR fixes that by rendering Markdown to HTML with the help of pulldown-cmark (the library rustdoc uses to parse Markdown for the main text of documentation). However, the text for the title attribute (the text shown when you hover over an element) still uses the plain-text rendering since it is displayed in browsers as plain-text. Only these styles will be rendered; everything else is stripped away: * *italics* * **bold** * `inline code`
2020-12-01Auto merge of #78876 - GuillaumeGomez:better-setting-keyboard-ux, r=jyn514bors-55/+62
Make keyboard interactions in the settings menu more pleasant #78868 improved the keyboard interactions with the settings page. This PR goes a bit further by allowing more than just "space" to toggle the checkboxes. r? `@jyn514`
2020-11-24Rename "stability" CSS class to "item-info"Guillaume Gomez-23/+24
2020-11-24Show hidden elements by default when JS is disabledGuillaume Gomez-0/+10
2020-11-22Prevent feature information to be hidden if it's on the impl directlyGuillaume Gomez-2/+8
2020-11-18add [src] links to methods on a trait's pageNixon Enraght-Moony-5/+5
2020-11-14Add tests and improve rendering of features on traitsWim Looman-3/+7
2020-11-12Improve comment for getVirtualKey functionGuillaume Gomez-1/+1
2020-11-12Improve settings.js code by using 'onEachLazy' directly instead of looping ↵Guillaume Gomez-33/+22
through DOM iterators
2020-11-12Make keyboard interactions in the settings menu more pleasantGuillaume Gomez-26/+44
2020-11-12Auto merge of #78976 - GuillaumeGomez:rollup-endkih3, r=GuillaumeGomezbors-2/+5
Rollup of 5 pull requests Successful merges: - #78916 (extend const generics test suite) - #78921 (Improve the page title switch handling between search and doc) - #78933 (Don't print thread ids and names in `tracing` logs) - #78960 (Test default values for const parameters.) - #78971 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-12Rollup merge of #78921 - GuillaumeGomez:search-result-title, r=jyn514Guillaume Gomez-2/+5
Improve the page title switch handling between search and doc The current behavior often "forgets" to update the page title when discarding/putting back the search results. This isn't optimal which is why I wrote this fix. r? ``@jyn514``
2020-11-12Auto merge of #78773 - GuillaumeGomez:theme-picker-shortcut, r=jyn514bors-0/+10
Add shortcut for theme picker menu Follow-up of #78584 Just like you can focus the search input by pressing "S", you can now access the theme picker menu by pressing "T" and navigate through the options only using the keyboard. cc `@notriddle` r? `@jyn514`
2020-11-10Improve the page title switch handling between search and docGuillaume Gomez-2/+5
2020-11-07Fix tab focus on restyled switchesMichael Howell-2/+3
Setting a checkbox to `display:none` makes it impossible to tab onto it, which makes the rustdoc settings page completely keyboard inaccessible.
2020-11-05Add shortcut for theme picker menuGuillaume Gomez-0/+10
2020-10-30Pull theme picker keyboard code into main.jsMichael Howell-1/+59
Most of the code in mod.rs should be code that really needs to have the list of available themes inlined into it.
2020-10-30Close the theme picker when Escape is pressedMichael Howell-8/+2
2020-10-28rustdoc: Provide a way to set the default settings from Rust codeIan Jackson-1/+23
rustdoc has various user-configurable preferences. These are recorded in web Local Storage (where available). But we want to provide a way to configure the default default, including for when web storage is not available. getSettingValue is the function responsible for looking up these settings. Here we make it fall back some in-DOM data, which ultimately comes from RenderOptions.default_settings. Using HTML data atrtributes is fairly convenient here, dsspite the need to transform between snake and kebab case to avoid the DOM converting kebab case to camel case (!) We cache the element and dataset lookup in a global variable, to ensure that getSettingValue remains fast. The DOM representation has to be in an element which precedes the inclusion of storage.js. That means it has to be in the <head> and we should not use an empty <div> as the container (although most browsers will accept that). An empty <script> element provides a convenient and harmless container object. <meta> would be another possibility but runs a greater risk of having unwanted behaviours on weird browsers. We trust the RenderOptions not to contain unhelpful setting names, which don't fit nicely into an HTML attribute. It's awkward to quote dataset keys. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: js: Use getSettingValue for all rustdoc-* valuesIan Jackson-24/+25
Currently, storage.js and main.js have many open-coded calls to getCurrentValue for "rustdoc-" values, but these are settings and should be handled by getSettingValue. So make getSettingValue part of storage.js (where everyone can call it) and use it everywhere. No functional change yet. We are going to make getSettingValue do something more sophisticated in a moment. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-23Always store Rustdoc theme when it's changednasso-5/+6