about summary refs log tree commit diff
path: root/src/librustdoc/html/static/search.js
AgeCommit message (Collapse)AuthorLines
2021-07-07Clean up rustdoc static filesGuillaume Gomez-1561/+0
2021-07-01fix(rustdoc): generics searchMichael Howell-18/+62
This commit adds a test case for generics, re-adds generics data to the search index, and tweaks function indexing to use less space in JSON. This reverts commit 14ca89446c076bcf484d3d05bd991a4b7985a409.
2021-06-30Enforce search typed queriesGuillaume Gomez-1/+2
2021-06-27Add go_to_first boolean query param to immeidately jump to the first search ↵Jean-Luc Thumm-4/+4
result
2021-06-26Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkovbors-1/+1
Use HTTPS links where possible While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS. Notes: - I didn't change any to or in licences - Some links don't support HTTPS :( - Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-06-23Fix search filter updateGuillaume Gomez-0/+4
2021-06-07Fix integration of codeblocks in search result descriptionGuillaume Gomez-1/+1
2021-05-25Generate DOM more securelyGuillaume Gomez-16/+49
2021-05-25Move extra search result information for keywords and primitives from CSS to DOMGuillaume Gomez-6/+12
2021-05-24Rollup merge of #85551 - GuillaumeGomez:fix-search-result-overflow, r=jshaGuillaume Gomez-2/+2
Fix search results display Fixes https://github.com/rust-lang/rust/issues/85544. cc `@dns2utf8` r? `@jsha`
2021-05-22Set desc class on the div instead of the span to simplify CSSGuillaume Gomez-2/+2
2021-05-20Reset "focusedByTab" field when doing another searchGuillaume Gomez-4/+5
2021-05-18Rollup merge of #84462 - jsha:focus-search-results2, r=GuillaumeGomezRalf Jung-114/+72
rustdoc: use focus for search navigation Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class. This required wrapping each row of results in one big `<a>` tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float. This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements. This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focus. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus. Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't. Demo at https://hoffman-andrews.com/rust/focus-search-results2/std/?search=fn Fixes #84384 Fixes #79962 Fixes #79872
2021-05-15Fix eslint errorsGuillaume Gomez-16/+19
2021-05-13rustdoc: use focus for search navigationJacob Hoffman-Andrews-114/+72
Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class. This required wrapping each row of results in one big <a> tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float. This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements. This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focused element. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus. Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't.
2021-05-12Fix indent in JS filesGuillaume Gomez-1/+1
2021-05-11rustdoc: remove explicit boolean comparisons.Jacob Hoffman-Andrews-39/+35
For boolean variables it's shorter and more readable to check the value directly, or negate it with `!`. In a couple of cases I reordered an if/else pair because it made the initial `if` statement simpler. Removed unused isType parameter from two functions.
2021-04-22Prevent control, shift and alt keys to make search input lose focusGuillaume Gomez-3/+6
2021-04-18Fix the wrong return value type description of validateResulthi-rustin-1/+1
2021-04-13Split search.js from search-index.js.Jacob Hoffman-Andrews-6/+4
2021-04-13Consolidate search-related vars and functions.Jacob Hoffman-Andrews-37/+39
This allows sharing across main.js and search.js without exporting too many symbols into the global namespace.
2021-04-12Move search JS into search-index.jsJacob Hoffman-Andrews-0/+1512
Export a few variables and functions into the global scope because they are needed both by main.js and search-index.js.