summary refs log tree commit diff
path: root/src/librustdoc/html/static/main.js
AgeCommit message (Collapse)AuthorLines
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-10Improve the page title switch handling between search and docGuillaume Gomez-2/+5
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: js: Use getSettingValue for all rustdoc-* valuesIan Jackson-11/+11
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-19Add link to rustdoc book in rustdoc help popupGuillaume Gomez-0/+5
2020-10-16Fix sidebar scroll on mobile devicesGuillaume Gomez-4/+0
2020-08-31Rollup merge of #76052 - ↵Aleksey Kladov-4/+8
aszenz:GH-66816_removes_disable_attribute_before_return, r=GuillaumeGomez GH-66816: Remove disable attr before return Passing --disable-per-crate-search removes the create search inputs so moved code around so that the search input is enabled first before the function returns. Fixes #66816
2020-08-30Rollup merge of #76022 - GuillaumeGomez:cleanup-rustdoc-front, r=jyn514Dylan DPC-8/+9
Clean up rustdoc front-end source code r? @jyn514
2020-08-29Use an id instead of a functionGuillaume Gomez-6/+3
2020-08-29GH-66816: Process before enabling searchasrar-2/+5
2020-08-29GH-66816: Removes disable before returnasrar-3/+4
Passing --disable-per-crate-search removes the create search inputs so moved code around so that the search input is enabled first before the function returns
2020-08-28Clean up rustdoc front-end source codeGuillaume Gomez-8/+12
2020-08-27Auto merge of #75976 - GuillaumeGomez:help-popup, r=jyn514bors-4/+5
Improve help popup Fixes #75623. The second commit is just a slight improvement: the help popup won't be created until someone presses "?" or ESC. Not a big improvement in itself but considering the low amount of code required, I think it was worth the shot. r? @jyn514
2020-08-27Delay help popup creation to when it's neededGuillaume Gomez-2/+3
2020-08-27Improve helper wordingGuillaume Gomez-2/+2
2020-08-24Add explanations on the results search element checkGuillaume Gomez-0/+3
2020-08-23Prevent automatic page change when using historyGuillaume Gomez-4/+11
2020-08-11Fully handle "?" shortcutGuillaume Gomez-3/+1
2020-08-11Rollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514Dylan DPC-1/+3
Add help button Part of #75197. Here is a screenshot of the result: ![Screenshot from 2020-08-10 16-53-20](https://user-images.githubusercontent.com/3050060/89796547-14112a00-db2a-11ea-9f25-57b30ab68f9b.png) r? @jyn514
2020-08-10Add help buttonGuillaume Gomez-1/+3
2020-08-09Rename "Important traits" to "Notable traits"Camelid-2/+2
* Rename it in the UI * Rename the CSS classes
2020-07-16Review comments for JSManish Goregaokar-8/+2
2020-07-16Make spotlight show on hoverManish Goregaokar-18/+3
This makes the spotlight show on hover instead of click. Clicks can be used to persist it, which is also what's used on mobile.
2020-07-16Revert "Remove "important traits" feature"Manish Goregaokar-0/+28
This reverts commit 1244ced9580b942926afc06815e0691cf3f4a846.
2020-07-15Rollup merge of #74196 - GuillaumeGomez:auto-collapse-implementors, ↵Manish Goregaokar-3/+9
r=Manishearth Add option to collapse automatically implementors Fixes #73403 It adds an option (enabled by default) which collapses all implementors impl blocks. r? @kinnison cc @rust-lang/rustdoc
2020-07-09Add option to collapse automatically implementorsGuillaume Gomez-3/+9
2020-07-02Simplify DOM by removing IDs for code tagsGuillaume Gomez-14/+7
2020-07-02Expand sub code blocks block content when hidden when the page hash refers to itGuillaume Gomez-0/+8
2020-07-02Improve page hash handlingGuillaume Gomez-5/+7
2020-07-02No need to call getPageId a second timeGuillaume Gomez-1/+1
2020-06-26Rollup merge of #72967 - integer32llc:prevent-default-arrows, r=kinnisonManish Goregaokar-0/+2
Don't move cursor in search box when using arrows to navigate results ## What happens - Go to https://doc.rust-lang.org/stable/std/index.html - Press 's' to focus the search box - Type a query like 'test' - Press the down arrow one or more times to change which search result is highlighted - Press the up arrow once to go up one search result - Notice the cursor in the search box is now at the beginning of your query, such that if you now typed 'a' the search box would contain 'atest', when it would be expected that the cursor would have remained where it was and if you typed 'a' at this point it would result in 'testa' - Press the down arrow once to go down one search result - Now notice the cursor is at the end of your query again ## What I expected I expected that changing which search result was highlighted using the up and down arrows would have no effect on where the cursor was in the search box. ## The fix This PR prevents the default action of the up and down arrows when the custom keydown events are happening during a search.
2020-06-23rustdoc: Fix doc aliases with crate filteringOliver Middleton-6/+7
Fix a crash when searching for an alias contained in the currently selected filter crate. Also remove alias search results for crates that should be filtered out. The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.
2020-06-18Rollup merge of #72968 - integer32llc:docs-arrow-keys, r=GuillaumeGomezManish Goregaokar-13/+24
Only highlight doc search results via mouseover if mouse has moved ## What happens - Go to https://doc.rust-lang.org/stable/std/index.html - Put your mouse cursor somewhere in the middle where search results will appear and then don't move the mouse - Press 's' to focus the search box - Type a query that brings up enough search results to go under where your mouse cursor is - Press the down arrow - The search result that is one below where your mouse cursor is will be highlighted. ## What I expected When not currently using the mouse, I expect doing a search and then pressing the down arrow to always highlight the first search result immediately below the search box. ## The fix This feels a bit hacky to me; I'm open to other solutions. This introduces a global JS var that keeps track of whether the person searching has moved their mouse after doing a search or not, and only uses the mouse position to highlight search results if the person HAS moved the mouse AFTER doing a search.
2020-06-08Rollup merge of #71842 - tspiteri:doc-impl-const, r=GuillaumeGomezDylan DPC-1/+3
doc: make impl block collapsible if it has an associated constant Fixes #71822.
2020-06-03Only highlight results via mouseover if mouse has movedCarol (Nichols || Goulding)-13/+24
2020-06-03Don't move cursor in search box when using arrows to navigate search resultsCarol (Nichols || Goulding)-0/+2
2020-05-31Rollup merge of #72691 - GuillaumeGomez:escape-key-handling, r=kinnisonDylan DPC-4/+12
Fix escape key handling Fixes #72647. The problem was that you could have a timeout just after the moment you press "escape", putting back the results. r? @kinnison
2020-05-31Put input timeout clearance inside a functionGuillaume Gomez-13/+11
2020-05-28Fix escape key handlingGuillaume Gomez-3/+13
2020-05-27doc: make impl block collapsible if it has an associated constantTrevor Spiteri-1/+3
Fixes #71822.
2020-05-26Improve formattingGuillaume Gomez-2/+2
2020-05-26Fix eslint lintsGuillaume Gomez-31/+23
2020-05-26Reexported functions are now declared directly as "windows" fieldGuillaume Gomez-11/+6
2020-05-26Move "global" code into anonymous functionsGuillaume Gomez-248/+258
2020-05-26Move focusSearchBar and defocusSearchBar functions to the top of the file ↵Guillaume Gomez-10/+11
with other functions
2020-05-21Rollup merge of #72272 - ↵Ralf Jung-0/+6
GuillaumeGomez:fix-back-on-page-with-search-behaviour, r=kinnison Fix going back in history to a search result page on firefox This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs: * Make a search * Pick an element (which isn't on the same page as the current element!) * Go back in history Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it [here](http://web.archive.org/web/20100428053932/http://www.firefoxanswer.com/firefox/672-firefoxanswer.html). r? @kinnison cc @ollie27
2020-05-19Fix going back in history to a search result page on firefoxGuillaume Gomez-0/+6
2020-05-14* Update aliases data struct from HashMap to BTreeMap to have more ↵Guillaume Gomez-3/+4
deterministic results * Update Javascript to take this change into account * Update CrateData::aliases field to take a reference instead (it allowed to remove a conversion loop)