about summary refs log tree commit diff
path: root/src/librustdoc/html/static/main.js
AgeCommit message (Collapse)AuthorLines
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)
2020-05-14Make current crate aliases go firstGuillaume Gomez-6/+14
2020-05-14Move doc alias discovery into the Attributes struct and some code improvementsGuillaume Gomez-1/+1
2020-05-07Merge aliases and search-indexGuillaume Gomez-39/+87
2020-05-07Improve doc alias JS codeGuillaume Gomez-23/+50
2020-05-05Replace title "Methods" with "Implementations"Guillaume Gomez-1/+1
2020-03-16Update src/librustdoc/html/static/main.js Guillaume Gomez-1/+1
Fix variable name Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-03-16formattingGuillaume Gomez-6/+4
2020-03-16Support type search for arguments and returned typesGuillaume Gomez-62/+66
2020-02-27Remove "important traits" featureGuillaume Gomez-28/+0
2020-02-15Auto merge of #68668 - GuillaumeGomez:struct-variant-field-search, r=ollie27bors-8/+22
Struct variant field search Fixes #16017. Reopening of #64724. cc @tomjakubowski cc @ollie27 r? @kinnison
2020-01-30rustdoc: emit JS paths for struct-like variantsTom Jakubowski-8/+22
On the backend, rustdoc now emits `paths` entries to a crate's search index for struct-like enum variants, and index items of type structfield which belong to such variants point to their variant parents in the `paths` table, rather than their enum grandparents. The path entry for a variant is the fully qualified module path plus the enum name. On the frontend, the search code recognizes structfields belonging to structlike variants in the `paths` table and re-constructs the URL to the field's anchor on the enum documentation page. closes #16017
2020-01-28Fix null synthetic_implementors errorGuillaume Gomez-14/+16
2020-01-20Remove usage of global variable "inlined_types"Guillaume Gomez-2/+18
2020-01-12rustdoc: HTML escape arrows on help popupOliver Middleton-2/+2
2019-12-22Fix invalid results showing backGuillaume Gomez-0/+4
2019-12-22Improve code readabilityGuillaume Gomez-43/+37
2019-12-22Improve JS code a bit by avoid erasing all event handlersGuillaume Gomez-4/+5
2019-12-15Fix JS error when loading page with searchGuillaume Gomez-1/+1
2019-12-02Add missing checkGuillaume Gomez-1/+1
2019-11-20Rollup merge of #66514 - GuillaumeGomez:fix-search-filter-save, r=kinnisonMazdak Farrokhzad-15/+10
Fix selected crate search filter Fixes #62929. r? @kinnison
2019-11-20Rollup merge of #66298 - Ppjet6:disable-search-field, r=GuillaumeGomezMazdak Farrokhzad-4/+4
rustdoc: fixes #64305: disable search field instead of hidding it The result seems to be ok but I wasn't entirely sure how to get there. I tried to stay generic a bit but maybe it's not required at all. @GuillaumeGomez Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-11-20rustdoc: fixes #64305: disable search field instead of hidding itMaxime “pep” Buquet-4/+4
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-11-19Rollup merge of #66430 - dns2utf8:fix_code_selection_click_handler, ↵Mazdak Farrokhzad-24/+37
r=GuillaumeGomez [doc] Fix the source code highlighting on source comments The code would always forget the previous selection. r? @GuillaumeGomez