Rollup merge of #92830 - jsha:style-cleanups, r=GuillaumeGomez
Rustdoc style cleanups - Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown Demo: https://rustdoc.crud.net/jsha/style-cleanups/std/string/struct.String.html r? `@GuillaumeGomez`
This commit is contained in:
commit
deee6f770f
10 changed files with 62 additions and 41 deletions
|
@ -288,9 +288,6 @@ function hideThemeButtonState() {
|
|||
loadSearch();
|
||||
}
|
||||
|
||||
// `crates{version}.js` should always be loaded before this script, so we can use it
|
||||
// safely.
|
||||
searchState.addCrateDropdown(window.ALL_CRATES);
|
||||
var params = searchState.getQueryStringParams();
|
||||
if (params.search !== undefined) {
|
||||
var search = searchState.outputElement();
|
||||
|
@ -300,30 +297,6 @@ function hideThemeButtonState() {
|
|||
loadSearch();
|
||||
}
|
||||
},
|
||||
addCrateDropdown: function(crates) {
|
||||
var elem = document.getElementById("crate-search");
|
||||
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var savedCrate = getSettingValue("saved-filter-crate");
|
||||
for (var i = 0, len = crates.length; i < len; ++i) {
|
||||
var option = document.createElement("option");
|
||||
option.value = crates[i];
|
||||
option.innerText = crates[i];
|
||||
elem.appendChild(option);
|
||||
// Set the crate filter from saved storage, if the current page has the saved crate
|
||||
// filter.
|
||||
//
|
||||
// If not, ignore the crate filter -- we want to support filtering for crates on
|
||||
// sites like doc.rust-lang.org where the crates may differ from page to page while
|
||||
// on the
|
||||
// same domain.
|
||||
if (crates[i] === savedCrate) {
|
||||
elem.value = savedCrate;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function getPageId() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue