about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js
AgeCommit message (Collapse)AuthorLines
2022-06-23Merge all popover hide functions into oneGuillaume Gomez-27/+18
2022-06-23Move help popup into a pocket menu as wellGuillaume Gomez-92/+114
2022-06-20rustdoc: optimize loading of source sidebarJacob Hoffman-Andrews-8/+13
The source sidebar has a setting to remember whether it should be open or closed. Previously, this setting was handled in source-script.js, which is loaded with `defer`, meaning it is often run after the document is rendered. Since CSS renders the source sidebar as closed by default, changing this after the initial render results in a relayout. Instead, handle the setting in storage.js, which is the first script to load and is the only script that blocks render. This avoids a relayout and means navigating between files with the sidebar open is faster.
2022-06-20Improve loading of crates.js and sidebar-items.jsJacob Hoffman-Andrews-100/+76
Now that the "All Crates" dropdown is only rendered on the search results page, there is no need to load crates.js on most pages. Load it only on crate pages. Also, add the `defer` attribute so it does not block page rendering. For sidebar-items.js, move the script tag to `<head>`. Since it already has the defer attribute it won't block loading. The defer attribute does preserve ordering between scripts, so instead of the callback on load, it can set a global variable on load, which is slightly simpler. Also, since it is required to finish rendering the page, beginning its load earlier is better. Remove generation and handling of sidebar-vars. Everything there can be computed with information available in JS via other means. Remove the "other" wrapper in the sidebar. It was unnecessary. Remove excess script fields
2022-06-18Remove weird JS conditionGuillaume Gomez-4/+1
2022-06-14Fix expand/collapse on source viewer sidebar foldersGuillaume Gomez-3/+3
2022-06-06Add "no-confusing-arrow" eslint checkGuillaume Gomez-1/+1
2022-05-31Rollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jshaDylan DPC-1/+1
Improve settings theme display This is a follow-up of #96958. In this PR, I changed how the theme radio buttons are displayed and improved their look as well. It now looks like this: ![Screenshot from 2022-05-17 20-46-20](https://user-images.githubusercontent.com/3050060/168887703-a01e3bd5-9644-4012-ac11-2ae7bacd6be6.png) ![Screenshot from 2022-05-17 20-46-12](https://user-images.githubusercontent.com/3050060/168887707-132f8b2d-1163-462f-b7dd-f861121bdee7.png) You can test it [here](https://rustdoc.crud.net/imperio/improve-settings-theme-display/doc/foo/index.html). r? `@jsha`
2022-05-30Fix invalid line number computation when clicking on something else than a ↵Guillaume Gomez-0/+4
line number
2022-05-30Improve display of settings radio buttonsGuillaume Gomez-1/+1
2022-05-27Add "eqeqeq" eslint ruleGuillaume Gomez-6/+6
2022-05-26Rollup merge of #97394 - GuillaumeGomez:more-eslint-rules, r=notriddleGuillaume Gomez-7/+7
Add more eslint rules This PR adds more eslint rules. Here are the explanations for each of them: * [space-infix-ops](https://eslint.org/docs/rules/space-infix-ops) * [space-before-function-paren](https://eslint.org/docs/rules/space-before-function-paren) * [space-before-blocks](https://eslint.org/docs/rules/space-before-blocks) * [comma-dangle](https://eslint.org/docs/rules/comma-dangle) * [comma-style](https://eslint.org/docs/rules/comma-style) * [max-len](https://eslint.org/docs/rules/max-len) * [eol-last](https://eslint.org/docs/rules/eol-last) r? `@notriddle`
2022-05-25Add new eslint rule "space-before-function-paren"Guillaume Gomez-7/+7
2022-05-24Allow to click on toggle text to update itGuillaume Gomez-6/+5
2022-05-19Add new lint to enforce whitespace after keywordsGuillaume Gomez-2/+2
2022-05-18Move some DOM generation into the HTML settings file directlyGuillaume Gomez-16/+2
2022-05-18Rollup merge of #97113 - GuillaumeGomez:search-ui-fixes, r=notriddleYuki Okushi-1/+1
Search GUI fixes The first fix is about the duplicated "in": ![Screenshot from 2022-05-17 13-25-53](https://user-images.githubusercontent.com/3050060/168814186-a4e9064f-4325-469c-8bf6-46ea2737a24f.png) The second fix is about the `<select>` broken style: ![Screenshot from 2022-05-17 13-37-03](https://user-images.githubusercontent.com/3050060/168814182-b1c5ae66-d8cf-4fd5-a227-5aa8cd8453ab.png) ![Screenshot from 2022-05-17 13-36-55](https://user-images.githubusercontent.com/3050060/168814184-be9e56f8-fad4-477c-899e-9abff4d4910c.png) You can test it [here](https://rustdoc.crud.net/imperio/search-ui-fixes/doc/foo/index.html?search=test). r? `@notriddle`
2022-05-17rustdoc: make search.js a moduleJacob Hoffman-Andrews-51/+66
Previously, search.js relied on the DOM and the `window` object. It can now be loaded in the absence of the DOM, for instance by Node. The same is true of search-index.js. This allows removing a lot of code from src/tools/rustdoc-js/tester.js that tried to parse search.js and extract specific functions that were needed for testing.
2022-05-17Fix duplicated "in" in the search result textGuillaume Gomez-1/+1
2022-05-15Add new eslint rule about brace styleGuillaume Gomez-33/+52
2022-05-14Remove theme picker buttonGuillaume Gomez-135/+2
2022-05-14Improve settings menu displayGuillaume Gomez-25/+57
2022-05-12rustdoc: fix GUI crash when searching for magic JS property valuesMichael Howell-2/+2
2022-05-11Rollup merge of #96900 - GuillaumeGomez:fix-js-error, r=notriddleYuki Okushi-2/+1
Fix js error On the source code pages, we get a JS error: ![Screenshot from 2022-05-10 16-26-53](https://user-images.githubusercontent.com/3050060/167656292-51e0b0e9-6b0c-4f94-82e0-dd8fb77adf52.png) It's fixed in the first commit. The second one is removing an unused CSS rule and the third one is a little cleanup of a GUI test. cc ``@jsha`` r? ``@notriddle``
2022-05-11Rollup merge of #96879 - notriddle:notriddle/search-ranking, r=GuillaumeGomezYuki Okushi-1/+1
rustdoc: search result ranking fix # Before ![image](https://user-images.githubusercontent.com/1593513/167477286-91049761-67f9-4a73-8fb7-09dbb19ca76c.png) # After ![image](https://user-images.githubusercontent.com/1593513/167477345-6733bc0f-4bb2-4625-9f7f-094031e36414.png)
2022-05-10Fix JS error in source code pagesGuillaume Gomez-2/+1
2022-05-09rustdoc: search result ranking fixMichael Howell-1/+1
2022-05-08Remove unused param from search.js::checkPathMichael Howell-2/+2
2022-05-07Enforce quote rule for JS source codeGuillaume Gomez-52/+52
2022-05-07Change eslint rules from configuration comments to configuration filesFolyd-29/+0
2022-05-06Rollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomezGuillaume Gomez-1/+7
rustdoc: ensure HTML/JS side implementors don't have dups Fixes #94641 Rendered: - https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html - https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html
2022-05-06Rollup merge of #96748 - GuillaumeGomez:reexports-in-search, r=notriddleGuillaume Gomez-0/+3
Fixes reexports in search Fixes #96681. At some point we stopped reexporting items in search so this PR fixes it. It also adds a regression test. r? ```@notriddle```
2022-05-06Rollup merge of #96590 - notriddle:notriddle/tab-bar-fn-search, ↵Guillaume Gomez-25/+44
r=GuillaumeGomez,jsha rustdoc: when running a function-signature search, tweak the tab bar # Before ![In Names (7) / In Parameters (0) / In Return types (0)](https://user-images.githubusercontent.com/1593513/166122875-ffdeafe6-8d4d-4e61-84a6-f5986b50ac35.png) # After ![In Function Signature (7)](https://user-images.githubusercontent.com/1593513/166122883-9a3d7515-3235-4ee3-8c4b-5401d109e099.png)
2022-05-06Fix reexports missing from the search indexGuillaume Gomez-0/+3
2022-05-05Rollup merge of #96741 - GuillaumeGomez:improve-settings-loading-strategy, ↵Michael Goulet-4/+4
r=jsha Improve settings loading strategy I learned about this thanks to ```@jsha``` who suggested this approach: It improves the settings loading strategy by loading CSS and JS at the same time to prevent the style to be applied afterwards on slow connections. r? ```@jsha```
2022-05-05Rollup merge of #96704 - GuillaumeGomez:rotation-animation, r=jshaMichael Goulet-0/+2
Add rotation animation on settings button when loading As discussed, I added an animation when the settings JS file is loading (I voluntarily made the timeout at the end of the `settings.js` super long so we can see what the animation looks like): https://user-images.githubusercontent.com/3050060/166693243-816a08b7-5e39-4142-acd3-686ad9950d8e.mp4 r? ````@jsha````
2022-05-05rustdoc: ensure HTML/JS side implementors don't have dupsMichael Howell-1/+7
2022-05-05Improve settings loading strategy by loading CSS and JS at the same time to ↵Guillaume Gomez-4/+4
prevent the style to be applied afterwards on slow connections
2022-05-05rustdoc: fix JS error when rendering parse errorMichael Howell-0/+4
2022-05-05rustdoc: fix keyboard shortcuts and console log on search pageMichael Howell-12/+24
2022-05-05rustdoc: change the "In Function Signatures" to context-sensitiveMichael Howell-1/+5
* If it's just `-> a`, use "In Function Return Types" * If it's just `a b`, use "In Function Parameters" * Otherwise, still use "In Function Signatures"
2022-05-05rustdoc: when running a function-signature search, tweak the tab barMichael Howell-13/+12
2022-05-05Add rotation animation on settings button when loadingGuillaume Gomez-1/+2
2022-05-05Use "strict" mode in JS scriptsGuillaume Gomez-5/+15
2022-05-04Move callback to the () => {} syntax.Folyd-112/+109
Fix lint Fix main.js Restore anonymous functions Fix Fix more
2022-05-01* Add documentation for settings page rendering functions.Guillaume Gomez-55/+65
* Improve code. * Fix some documentation argument types. * Make settings order the same as before this PR. * Change timeout to 0 so that browser will render it as fast as possible.
2022-04-30Move settings into full JSGuillaume Gomez-53/+329
2022-04-29Rollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddleDylan DPC-245/+233
Switch JS code to ES6 - part 2 Part of #93058. It's based on https://github.com/rust-lang/rust/pull/96361 so it needs to wait for it to be merged first. r? `@notriddle`
2022-04-26Remove dead code in main.jsGuillaume Gomez-23/+0
2022-04-26Migrate scrape-examples.js to ES6Guillaume Gomez-21/+24