summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/settings.js
AgeCommit message (Collapse)AuthorLines
2023-01-17rustdoc: instead of `.setting-name { width: 100% }`, use default div CSSMichael Howell-1/+1
2023-01-13rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggleMichael Howell-2/+2
This swaps things around so that the class that gets used more often has the shorter name.
2022-11-26rustdoc: improve popover focus handling JSMichael Howell-1/+1
This commit fixes a few inconsistencies and erratic behavior from the notable traits, settings, and sidebar popups: * It makes it so that pressing Escape closes the mobile sidebar. This is a bit difficult to do on iPhone, but on other setups like desktop tiling window managers, it's easy and makes sense. * It makes sure that pressing escape while a notable trait popover is open focuses the popover's toggle button, instead of leaving nothing focused, since that makes more sense with keyboard navigation. Clicking the settings, help, or sidebar buttons, however, will not focus the notable trait popover toggle button. * It ensures that notable trait and settings popovers are exclusive with the mobile sidebar. Nothing should ever overlap a popover, and there should never be more than one popover open at once.
2022-11-13Simplify settings UI by merging system theme with the theme choicesGuillaume Gomez-24/+36
2022-11-10rustdoc: use checkbox instead of switch for settings togglesMichael Howell-3/+1
The switch is designed to give the application a "physical" feel, but nothing else in here really followed through. They didn't support the "flick" gesture that real iOS switches support, and the radio buttons that were also used in Rustdoc Settings were a more "classic" form element anyway. Also, while "switches" are the exclusive toggle design on iOS (since [Apple HIG] reserves checkboxes for Mac only), the [Google Material] guidelines say that lists of switches are bad, and you should just use check boxes. [Apple HIG]: https://developer.apple.com/design/human-interface-guidelines/components/selection-and-input/toggles [Google Material]: https://m3.material.io/components/checkbox/guidelines#6902f23d-ceba-4b19-ae3b-b78b9b01d185
2022-10-29rustdoc: add hash to filename of toolchain filesJacob Hoffman-Andrews-4/+6
All static files used by rustdoc are now stored in static.files/ and include a hash of their contents. They no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration.
2022-10-15Fix display of settings pageGuillaume Gomez-1/+3
2022-09-21rustdoc: dynamically show-hide line numbers on code examplesMichael Howell-0/+7
2022-06-23Merge all popover hide functions into oneGuillaume Gomez-7/+5
2022-06-23Move help popup into a pocket menu as wellGuillaume Gomez-22/+8
2022-05-30Improve display of settings radio buttonsGuillaume Gomez-1/+1
2022-05-26Rollup merge of #97394 - GuillaumeGomez:more-eslint-rules, r=notriddleGuillaume Gomez-1/+1
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-1/+1
2022-05-24Allow to click on toggle text to update itGuillaume Gomez-6/+5
2022-05-18Move some DOM generation into the HTML settings file directlyGuillaume Gomez-16/+2
2022-05-15Add new eslint rule about brace styleGuillaume Gomez-2/+2
2022-05-14Improve settings menu displayGuillaume Gomez-25/+57
2022-05-07Enforce quote rule for JS source codeGuillaume Gomez-5/+4
2022-05-07Change eslint rules from configuration comments to configuration filesFolyd-4/+0
2022-05-05Rollup merge of #96741 - GuillaumeGomez:improve-settings-loading-strategy, ↵Michael Goulet-4/+1
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/+1
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-05Improve settings loading strategy by loading CSS and JS at the same time to ↵Guillaume Gomez-4/+1
prevent the style to be applied afterwards on slow connections
2022-05-05Add rotation animation on settings button when loadingGuillaume Gomez-0/+1
2022-05-05Use "strict" mode in JS scriptsGuillaume Gomez-0/+2
2022-05-04Move callback to the () => {} syntax.Folyd-6/+7
Fix lint Fix main.js Restore anonymous functions Fix Fix more
2022-05-01* Add documentation for settings page rendering functions.Guillaume Gomez-49/+59
* 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-9/+174
2022-04-26Small JS code improvementsGuillaume Gomez-1/+1
2022-04-24Update settings.js to ES6Guillaume Gomez-6/+9
2022-02-02Unify storage getter and setter functionsGuillaume Gomez-1/+1
2022-01-23rustdoc settings: use radio buttons for themeJacob Hoffman-Andrews-10/+19
This reduces the number of clicks required to change theme. Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon.
2022-01-14Add support for "always theme" in settingJacob Hoffman-Andrews-0/+28
2021-07-07Clean up rustdoc static filesGuillaume Gomez-0/+60