diff options
| author | Sean Jensen-Grey <seanj@xyke.com> | 2014-11-01 20:43:02 -0700 |
|---|---|---|
| committer | Sean Jensen-Grey <seanj@xyke.com> | 2014-11-01 20:43:02 -0700 |
| commit | 7fbcdc75a9d26baf3ed56fc6bb53aaecd0cb4181 (patch) | |
| tree | f70d80dade4680acd2f4043909db7feeec7d1f5f /src | |
| parent | 0547a407aa03b9f1c03843aead617a2e8c5d1147 (diff) | |
| download | rust-7fbcdc75a9d26baf3ed56fc6bb53aaecd0cb4181.tar.gz rust-7fbcdc75a9d26baf3ed56fc6bb53aaecd0cb4181.zip | |
add populated search box to docs 404 page
reference https://github.com/rust-lang/rust/issues/18498
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/not_found.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/doc/not_found.md b/src/doc/not_found.md index f49772f29a1..e80d0d83abf 100644 --- a/src/doc/not_found.md +++ b/src/doc/not_found.md @@ -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> + |
