1
Fork 0

add populated search box to docs 404 page

reference https://github.com/rust-lang/rust/issues/18498
This commit is contained in:
Sean Jensen-Grey 2014-11-01 20:43:02 -07:00
parent 0547a407aa
commit 7fbcdc75a9

View file

@ -11,9 +11,33 @@ Looks like you've taken a wrong turn.
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
* [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))
## Docs
* [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>