]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | % Not Found |
2 | ||
3 | <!-- Completely hide the TOC and the section numbers --> | |
4 | <style type="text/css"> | |
5 | #TOC { display: none; } | |
6 | .header-section-number { display: none; } | |
7 | li {list-style-type: none; } | |
0bf4aa26 XL |
8 | #search-input { |
9 | width: calc(100% - 100px); | |
10 | } | |
11 | #search-but { | |
12 | cursor: pointer; | |
13 | } | |
14 | #search-but, #search-input { | |
15 | padding: 4px; | |
16 | border: 1px solid #ccc; | |
17 | border-radius: 3px; | |
18 | outline: none; | |
19 | font-size: 0.7em; | |
20 | background-color: #fff; | |
21 | } | |
22 | #search-but:hover, #search-input:focus { | |
23 | border-color: #55a9ff; | |
24 | } | |
25 | #search-from { | |
26 | border: none; | |
27 | padding: 0; | |
28 | font-size: 0.7em; | |
29 | } | |
1a4d82fc JJ |
30 | </style> |
31 | ||
32 | Looks like you've taken a wrong turn. | |
33 | ||
34 | Some things that might be helpful to you though: | |
35 | ||
62682a34 | 36 | # Search |
85aaf69f | 37 | |
0bf4aa26 XL |
38 | <div> |
39 | <form id="search-form" action="https://duckduckgo.com/"> | |
40 | <input id="search-input" type="search" name="q"></input> | |
41 | <input type="submit" value="Search" id="search-but"> | |
42 | <!-- | |
43 | Don't show the options by default, | |
44 | since "From the Standary Library" doesn't work without JavaScript | |
45 | --> | |
46 | <fieldset id="search-from" style="display:none"> | |
47 | <label><input name="from" value="library" type="radio"> From the Standard Library</label> | |
48 | <label><input name="from" value="duckduckgo" type="radio" checked> From DuckDuckGo</label> | |
49 | </fieldset> | |
50 | </form> | |
51 | </div> | |
1a4d82fc | 52 | |
62682a34 | 53 | # Reference |
85aaf69f | 54 | |
ff7c6d11 XL |
55 | * [The Rust official site](https://www.rust-lang.org) |
56 | * [The Rust reference](https://doc.rust-lang.org/reference/index.html) | |
1a4d82fc | 57 | |
62682a34 | 58 | # Docs |
85aaf69f | 59 | |
ff7c6d11 | 60 | [The standard library](https://doc.rust-lang.org/std/) |
1a4d82fc JJ |
61 | |
62 | <script> | |
63 | function get_url_fragments() { | |
64 | var last = document.URL.split("/").pop(); | |
65 | var tokens = last.split("."); | |
66 | var op = []; | |
67 | for (var i=0; i < tokens.length; i++) { | |
68 | var t = tokens[i]; | |
69 | if (t == 'html' || t.indexOf("#") != -1) { | |
70 | // no html or anchors | |
71 | } else { | |
72 | op.push(t); | |
73 | } | |
74 | } | |
75 | return op; | |
76 | } | |
77 | ||
0bf4aa26 XL |
78 | function on_submit(event) { |
79 | var form = event.target; | |
80 | var q = form['q'].value; | |
81 | ||
82 | event.preventDefault(); | |
1a4d82fc | 83 | |
0bf4aa26 XL |
84 | if (form['from'].value === 'duckduckgo') { |
85 | document.location.href = form.action + '?q=' + encodeURIComponent(q + ' site:doc.rust-lang.org'); | |
86 | } else if (form['from'].value === 'library') { | |
ee023bcb | 87 | document.location.href = '/std/index.html?search=' + encodeURIComponent(q); |
0bf4aa26 | 88 | } |
1a4d82fc JJ |
89 | } |
90 | ||
0bf4aa26 XL |
91 | function populate_search() { |
92 | var form = document.getElementById('search-form'); | |
93 | form.addEventListener('submit', on_submit); | |
94 | document.getElementById('search-from').style.display = ''; | |
1a4d82fc | 95 | |
0bf4aa26 | 96 | form['from'].value = 'library'; |
1a4d82fc | 97 | |
0bf4aa26 XL |
98 | var op = get_url_fragments(); |
99 | document.getElementById('search-input').value = op.join(' '); | |
1a4d82fc | 100 | } |
0bf4aa26 | 101 | populate_search(); |
1a4d82fc | 102 | </script> |