add populated search box to docs 404 page
reference https://github.com/rust-lang/rust/issues/18498
This commit is contained in:
parent
0547a407aa
commit
7fbcdc75a9
1 changed files with 24 additions and 0 deletions
|
@ -11,9 +11,33 @@ Looks like you've taken a wrong turn.
|
||||||
|
|
||||||
Some things that might be helpful to you though:
|
Some things that might be helpful to you though:
|
||||||
|
|
||||||
|
## Search
|
||||||
|
* <form action="https://duckduckgo.com/">
|
||||||
|
<input type="text" id="code.search" name="q" size="80"></input>
|
||||||
|
<input type="submit" value="Search DuckDuckGo">
|
||||||
|
</form>
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
* [The Rust official site](http://rust-lang.org)
|
* [The Rust official site](http://rust-lang.org)
|
||||||
* [The Rust reference](http://doc.rust-lang.org/reference.html) (* [PDF](http://doc.rust-lang.org/reference.pdf))
|
* [The Rust reference](http://doc.rust-lang.org/reference.html) (* [PDF](http://doc.rust-lang.org/reference.pdf))
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
* [The standard library](http://doc.rust-lang.org/std/)
|
* [The standard library](http://doc.rust-lang.org/std/)
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function populate_search_box() {
|
||||||
|
|
||||||
|
var last = document.URL.split("/").pop();
|
||||||
|
var tokens = last.split(".");
|
||||||
|
var op = [];
|
||||||
|
for (var i=0; i < tokens.length; i++) {
|
||||||
|
if (tokens[i].indexOf("#") == -1)
|
||||||
|
op.push(tokens[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var search = document.getElementById('code.search');
|
||||||
|
search.value = op.join(' ') + " site:doc.rust-lang.org";
|
||||||
|
}
|
||||||
|
populate_search_box();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue