Skip to content

Commit

Permalink
Load search index for rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
Folyd committed Feb 14, 2024
1 parent 74cb13a commit abc2ec4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions extension/script/add-search-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,22 @@
}

if (searchIndexJs) {
let script = document.createElement('script');
script.src = searchIndexJs;
script.onload = sendSearchIndex;
document.head.append(script);
if (location.pathname.startsWith("/nightly/nightly-rustc/")) {
loadSearchIndex("/nightly/nightly-rustc/search-index.js");
} else {
loadSearchIndex(searchIndexJs);
}
} else {
console.error("Sorry, no search index found.");
}
}

function loadSearchIndex(searchIndexJs) {
let script = document.createElement('script');
script.src = searchIndexJs;
script.onload = sendSearchIndex;
document.head.append(script);
}

// [rustdoc] Use Map instead of Object for source files and search index #118910
// https://github.com/rust-lang/rust/pull/118910
Expand Down

0 comments on commit abc2ec4

Please sign in to comment.