Skip to content

Commit bee39d2

Browse files
committed
make crate selector more explanatory
1 parent 6f9fde6 commit bee39d2

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/librustdoc/html/static/css/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ table,
10361036
}
10371037
/* pseudo-element for holding the dropdown-arrow image; needs to be a separate thing
10381038
so that we can apply CSS-filters to change the arrow color in themes */
1039-
#crate-search-div::after {
1039+
#crate-search::after {
10401040
/* lets clicks through! */
10411041
pointer-events: none;
10421042
/* completely covers the underlying div */

src/librustdoc/html/static/js/search.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -2760,7 +2760,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
27602760
* @param {boolean} go_to_first
27612761
* @param {string} filterCrates
27622762
*/
2763-
async function showResults(results, go_to_first, filterCrates) {
2763+
async function showResults(results, go_to_first, _filterCrates) {
27642764
const search = searchState.outputElement();
27652765
if (go_to_first || (results.others.length === 1
27662766
&& getSettingValue("go-to-only-result") === "true")
@@ -2815,9 +2815,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
28152815
}
28162816
}
28172817

2818-
let crates = "";
2819-
2820-
let output = `<h1 class="search-results-title">Results${crates}</h1>`;
2818+
let output = "<h1 class="search-results-title">Results</h1>";
28212819
if (results.query.error !== null) {
28222820
const error = results.query.error;
28232821
error.forEach((value, index) => {
@@ -3879,17 +3877,19 @@ ${item.displayPath}<span class="${type}">${name}</span>\
38793877
}
38803878

38813879

3882-
console.log(rawSearchIndex);
3883-
let crates = "";
3880+
let crates = "Searching in ";
38843881
if (rawSearchIndex.size > 1) {
3885-
crates = "<div id=\"crate-search-div\"><select id=\"crate-search\">" +
3882+
crates += "<select id=\"crate-search\">" +
38863883
"<option value=\"all crates\" selected>all crates</option>";
38873884
for (const c of rawSearchIndex.keys()) {
3885+
console.log(c);
38883886
crates += `<option value="${c}">${c}</option>`;
38893887
}
3890-
crates += "</select></div>";
3888+
crates += "</select>";
3889+
} else {
3890+
crates += rawSearchIndex.keys().next().value;
38913891
}
3892-
document.getElementById("search-focus-panel").innerHTML = crates;
3892+
document.getElementById("crate-search-div").innerHTML = crates;
38933893
}
38943894

38953895
if (typeof window !== "undefined") {

src/librustdoc/html/static/js/storage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class RustdocSearchElement extends HTMLElement {
279279
</div>
280280
</form>
281281
</nav>
282-
<div id="search-focus-panel">loading crate list...</div>`;
282+
<div id="search-focus-panel"><div id="crate-search-div">loading crate list...</div></div>`;
283283
}
284284
}
285285
window.customElements.define("rustdoc-search", RustdocSearchElement);

0 commit comments

Comments
 (0)