summary refs log tree commit diff
path: root/src/librustdoc/html/static/main.js
AgeCommit message (Collapse)AuthorLines
2015-10-02Fix librustdoc search eventsSimonas Kazlauskas-11/+17
Previously only keyup event was looked at, which meant that pasting, cutting and otherwise changing the input without typing would not catch any updates to the search query.
2015-10-02Fix misnamed variable in rustdocSimonas Kazlauskas-1/+1
2015-10-02Auto merge of #28795 - marti1125:28696, r=alexcrichtonbors-0/+9
-Add a validation when input search is empty on top of 'startSearch()'
2015-10-01fixes #28696 Return to the default content when .search-input is empty -Add ↵Willy Aguirre-0/+9
a validation when input search is empty on top of 'startSearch()'
2015-09-27rustdoc: Remove crate name from primitives, make them turn up first in searchManish Goregaokar-0/+7
2015-09-14Disable browser history API on file:/ URLsJan-Erik Rediger-1/+2
history.pushState is defined, but not working whenever document.origin is "null" (literally that string, not just the null object). This is due to some security considerations and is unlikely to be ever working. For now just disable the usage of the history API when the documentation is accessed through a file:/ URL. See https://code.google.com/p/chromium/issues/detail?id=301210 for a Chrome-specific issue on the history API on file:/ URLs Closes #25953
2015-09-09rustdoc: Tweak the main template and CSS for semantic mark-up.Kang Seonghoon-6/+10
- section.sidebar -> nav.sidebar, also added an unordered list. - div#help -> aside#help, also added a hidden heading. - the current crate is now emphasized in the sidebar. Fixes #16310.
2015-08-04Improve rustdoc search type filtering.Eljay-7/+27
2015-07-20librustdoc: blur page when help dialogue is presentAndreas Tolfsen-2/+5
Blurs the document's background when the help dialogue is present, making the contents of the dialogue stand out more.
2015-07-17DRYTamir Duberstein-2/+2
2015-07-16Merge branch 'fix-26673' of https://github.com/nhowell/rust into rollup_centralSteve Klabnik-0/+6
2015-07-13Address feedbackBrian Anderson-0/+5
2015-07-08librustdoc: generalise handling of keyboard shortcutsAndreas Tolfsen-44/+48
2015-07-01rustdoc: Reset the title when pressing the back buttonNick Howell-0/+6
Fixes #26673
2015-07-01In js from the docs, change keyboard eventlistener to be compatible with ↵Mathieu David-6/+33
non-english keyboard layouts. Fixes #26016 Fixes #16572
2015-06-18rustdoc: Update document title when displaying search resultsJohannes Oertel-0/+3
Fixes #26360.
2015-05-22Rustdoc Search: Increase Relevance of PrimitivesPascal Hertleif-0/+7
2015-05-22Rustdoc: Clean Up Some JSPascal Hertleif-60/+57
There are more possible optimizations left (cached length in loops) as well as some possible bugs (shadowed variables) to fix. This is mostly syntactic.
2015-05-11Auto merge of #25225 - bluss:doc-search-assoc-items, r=alexcrichtonbors-1/+2
Rustdoc fixes for associated items This is related to isssue #22442 and solves it partly. This solves the search index links of associated types and constants, so that they link to the trait page. Also add an Associated Constants section if constants are present.
2015-05-09rustdoc: Link associated items in search index to traitUlrik Sverdrup-1/+2
This is related to isssue #22442 and solves it partly. This solves the links of associated types and constants, so that they link to the trait page.
2015-05-07Remove trailing whitespace on blank lineRory O’Kane-1/+1
This style inconsistency was noted at https://travis-ci.org/rust-lang/rust/builds/61583070#L371
2015-05-07Refactor doc toggle button label changingRory O’Kane-13/+27
To separate concerns, instead of checking the state of `#toggle-all-docs` by looking at its label text, I add or remove a class `will-expand` depending on whether the button’s next click will expand everything. (The `if` statement’s two branches were swapped as part of this change.) I moved the desired text values to a function `labelForToggleButton`, so changing the values will be easier. I also note in a comment the other file where the text is duplicated. To allow the labels of both types of toggle buttons to be uniformly set, I added a `span.inner` to the global button too. I split the template in `render.rs` into multiple lines to make room for the `span`, and that adds whitespace around the `[` and `]` text elements. That seems to be okay, though – the page still looks the same. I updated the CSS styling for `.collapse-toggle > .inner` to add a little extra space around the symbol, to make minus signs easier to identify. (`#toggle-all-docs > .inner` does not need the same style, since its text size is bigger, so it naturally puts more space around the symbol.)
2015-04-30Fix doc [−] button bug by escaping differentlyRory O’Kane-8/+8
The cause of the problem is described here: https://github.com/rust-lang/rust/pull/24797#issuecomment-97049765 . I tested this new `main.js` by changing the `main.js` content of a rendered docs page to this new content. The [−] button worked again.
2015-04-27Change literal minus ‘−’ to HTML entity ‘−’Rory O’Kane-8/+8
So that if people accidentally delete the character, they won’t re-type it as a hyphen, which would cause bugs. I changed ‘+’ too, even though it won’t be re-typed incorrectly, so that it is easier to see when plus is used as a symbol for the button, and when it is used as an operator in code. It also makes it clearer that the use of an entity for minus is on purpose, so people won’t be tempted to replace the entity incorrectly with a hyphen character.
2015-04-24In [-] doc buttons, change hyphen ‘-’ to minus ‘−’Rory O’Kane-5/+5
The minus sign ‘−’ is the same width as the plus sign ‘+’, so the button’s transition between the two symbols will look more smooth.
2015-04-24Rollup merge of #24717 - liigo:add-back-toggle-links, r=alexcrichtonManish Goregaokar-3/+7
r? @alexcrichton (since you added `.stability` warning messages)
2015-04-23rustdoc: add back [-]/[+] toggle links for unstable-methodsLiigo Zhuang-3/+7
2015-04-23rustdoc: toggle collapse/expand all docs using the same linkLiigo Zhuang-12/+17
2015-04-16rustdoc: Fix cross-crate macro source linksAlex Crichton-0/+3
The source filename for cross crate macros isn't quite right so the normal generated links are invalid. Closes #21311
2015-04-13rustdoc: Prevent '/' from showing the help dialogBarosl Lee-3/+5
Only '?' should do that. Fixes #24289.
2015-04-05Auto merge of #24055 - estsauver:24044, r=alexcrichtonbors-0/+2
If a result is highlighted, when the search changes that state should no longer be highlighted. Fixes #24044 cc @steveklabnik
2015-04-04Make changing doc search unhighlight current resultEarl St Sauver-0/+2
If a result is highlighted, when the search changes that state should no longer be highlighted. Fixes #24044 cc @steveklabnik
2015-04-01Fix sidebar bugCarlos Galarza-4/+6
Validate if the description is available in the rawSearchIndex
2015-03-14Auto merge of #23289 - mihneadb:rustdoc-search-by-type, r=alexcrichtonbors-2/+35
This adds search by type (for functions/methods) support to Rustdoc. Target issue is at https://github.com/rust-lang/rfcs/issues/658. I've described my approach here: https://github.com/rust-lang/rfcs/issues/658#issuecomment-76484200. I'll copy the text in here as well: --- Hi, it took me longer than I wished, but I have implemented this in a not-too-complex way that I think can be extended to support more complex features (like the ones mentioned [here](https://github.com/rust-lang/rust/issues/12866#issuecomment-66945317)). The idea is to generate a JSON representation of the types of methods/functions in the existing index, and then make the JS understand when it should look by type (and not by name). I tried to come up with a JSON representation that can be extended to support generics, bounds, ref/mut annotations and so on. Here are a few samples: Function: ```rust fn to_uppercase(c: char) -> char ``` ```json { "inputs": [ {"name": "char"} ], "output": { "name": "char", } } ``` Method (implemented or defined in trait): ```rust // in struct Vec // self is considered an argument as well fn capacity(&self) -> usize ``` ```json { "inputs": [ {"name": "vec"} ], "output": { "name": "usize" } } ``` This simple format can be extended by adding more fields, like `generic: bool`, a `bounds` mapping and so on. I have a working implementation in https://github.com/rust-lang/rust/compare/master...mihneadb:rustdoc-search-by-type. You can check out a live demo [here](http://data.mihneadb.net/doc/std/index.html?search=charext%20-%3E%20char). ![screenshot from 2015-02-28 00 54 00](https://cloud.githubusercontent.com/assets/643127/6422722/7e5374ee-bee4-11e4-99a6-9aac3c9d5068.png) The feature list is not that long: - search by types (you *can* use generics as well, as long as you use the exact name - e.g. [`vec,t -> `](http://data.mihneadb.net/doc/std/index.html?search=vec%2C%20t%20-%3E)) - order of arguments does not matter - `self` is took into account as well (e.g. search for `vec -> usize`) - does not use "complex" annotations (e.g. you don't search for `&char -> char` but for `char -> char`) My goal is to get a working, minimal "base" merged so that others can build upon it. How should I proceed? Do I open a PR (badly in need of code review since this is my first non "hello world"-ish rust code)? ---
2015-03-14Add support to search functions by type to rustdoc.Mihnea Dobrescu-Balaur-2/+35
2015-03-12Rollup merge of #22769 - :rustdocfix, r=brsonManish Goregaokar-17/+0
Fixes #22325
2015-03-05rustdoc: Move sidebar items into shared JavaScript.Kang Seonghoon-21/+65
It had been a source of huge bloat in rustdoc outputs. Of course, we can simply disable compiler docs (as `rustc` generates over 90M of HTML) but this approach fares better even after such decision. Each directory now has `sidebar-items.js`, which immediately calls `initSidebarItems` with a JSON sidebar data. This file is shared throughout every item in the sidebar. The current item is highlighted via a separate JS snippet (`window.sidebarCurrent`). The JS file is designed to be loaded asynchronously, as the sidebar is rendered before the content and slow sidebar loading blocks the entire rendering. For the minimal accessibility without JS, links to the parent items are left in HTML. In the future, it might also be possible to integrate crates data with the same fashion: `sidebar-items.js` at the root path will do that. (Currently rustdoc skips writing JS in that case.) This has a huge impact on the size of rustdoc outputs. Originally it was 326MB uncompressed (37.7MB gzipped, 6.1MB xz compressed); it is 169MB uncompressed (11.9MB gzipped, 5.9MB xz compressed) now. The sidebar JS only takes 10MB uncompressed & 0.3MB gzipped.
2015-02-24fix rustdoc performance problemsJulian Orth-17/+0
Fixes #22325
2015-01-23Auto merge of #20221 - liigo:rustdoc-sidebar-tooltips-v3, r=alexcrichtonbors-1/+12
This pull request add tooltips to most links of sidebar. The tooltips display "summary line" of items' document. Some lengthy/annoying raw markdown code are eliminated, such as links and headers. - `[Rust](http://rust-lang.org)` displays as `Rust` (no URLs) - `# header` displays as `header` (no `#`s) Some inline spans, e.g. ``` `code` ``` and ```*emphasis*```, are kept as they are, for better readable. I've make sure `&` `'` `"` `<` and `>` are properly displayed in tooltips, for example, `&'a Option<T>`. Online preview: http://liigo.com/tmp/tooltips/std/index.html @alexcrichton @steveklabnik since you have reviewed my previous ([v1](https://github.com/rust-lang/rust/pull/13014),[v2](https://github.com/rust-lang/rust/pull/16448)) PRs of this serise, which have been closed for technical reasons. Thank you.
2015-01-21rustdoc: fix fallout of merging ast::ViewItem into ast::Item.Eduard Burtescu-3/+2
2015-01-21fix falloutLiigo Zhuang-4/+1
2015-01-21display plain summary line in javascriptLiigo Zhuang-1/+13
2015-01-21rustdoc: add tooltips to sidebarLiigo Zhuang-1/+3
2015-01-17Increase docs search box delayChris Thorn-1/+1
Increases the delay of the search box to 500ms after key up. I tried adding a three character minimum for setting the delay, but didn't find it very useful. Should close #20095
2015-01-06Fix JS errorSteven Fackler-1/+1
ECMAScript 6 isn't really supported anywhere Closes #20681
2014-12-27Make the line numbers of the source code clickableBarosl Lee-3/+34
2014-12-05rollup merge of #19515: lifthrasiir/rustdoc-wrong-dedupCorey Richardson-1/+2
Fixes #17332.
2014-12-05rollup merge of #19503: lifthrasiir/xenophobic-rustdocCorey Richardson-2/+2
This series of commits deals with broken links to the source code. It also refactors some repetitive codes from Rustdoc. The most important commit, 1cb1f00d40f000ac7633b62a603db4fcea835ca6, describes the rationale; this will fix a half of #16289. Other commits are reasonably independent to each other and can be made into indiviudal PRs at the request. ### Notes on the broken source links As of bda97e8557820cc4ec13645dbdf976e5ccaa0ce1 (I've used this to check the PR works as intended), there are 281 (!) such broken links. They can be further classified as follows: * 178 links to incorrect item types. This is the first half of #16289, and this PR fixes all of them. * 89 links to redirect pages. They are not technically "broken" but still doesn't give a source code. I have a fix for this in mind, which would make a redirect page slightly *fat*. * 14 links to incorrect `DefId` in the `gotosrc` parameter. This is #15309, and affects many `liballoc` reexports in `libstd` but *nothing else* (curiously). I'm yet to track this down; might be a metadata bug (not sure). * 0 links to the crate reexported as a different name. This is the second half of #16289, and seems not hard to fix but I'm running out of time. Prevalence of this kind of bugs calls for a full link verifier integrated into the testing process. :S
2014-12-04rustdoc: Do not deduplicate items when their parents differ.Kang Seonghoon-1/+2
Fixes #17332.
2014-12-04rustdoc: Removed Foreign{Function,Static} item types.Kang Seonghoon-2/+2
They are just (unsafe) functions and static items to most users and even compilers! The metadata doesn't distinguish them, so Rustdoc ended up producing broken links (generated `ffi.*.html`, links to `fn.*.html`). It would be best to avoid this pitfall at all.