mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-13 23:27:13 +00:00
Remove rustc docs search
This commit is contained in:
parent
8fb9e0f6cc
commit
f3cf5909fb
3 changed files with 1 additions and 41 deletions
|
@ -11,7 +11,7 @@ export default class HelpCommand extends Command {
|
|||
"tips1": `Tips: You can use shortcut <match>Cmd</match>/<match>Ctrl</match> + <match>L</match> to autofocus the address bar`,
|
||||
"tips2": `Tips: Combine <match>Cmd</match> or <match>Alt</match> with <match>Enter</match> to open the search result in the new tab`,
|
||||
":": `Prefix <match>:</match> to execute command (:cargo, :book, :yet, :stable, etc)`,
|
||||
"/": `Prefix <match>/</match> to search nightly rust docs, prefix <match>//</match> to search nightly rustc docs`,
|
||||
"/": `Prefix <match>/</match> to search nightly rust docs`,
|
||||
"!": `Prefix <match>!</match> to search docs.rs, prefix <match>!!</match> to search crates.io, prefix <match>!!!</match> can redirect to the repository`,
|
||||
"~": `Prefix <match>~</match> to search external crate's docs`,
|
||||
"@": `Prefix <match>@crate</match> (<dim>e.g. @tokio</dim>) to search that crate's doc exclusively`,
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Ignore all non-rust doc pages.
|
||||
if (!isRustDoc()) return;
|
||||
|
||||
// rustc search index is a memory cache, therefore we don't use localStorage
|
||||
// to store the cached-version. Instead, we use `rustc:check` action.
|
||||
chrome.runtime.sendMessage({ action: "rustc:check" },
|
||||
response => {
|
||||
let now = new Date();
|
||||
let today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
|
||||
if (response?.version && today <= Date.parse(response.version)) {
|
||||
// Check version to ensure update search index once a day.
|
||||
return;
|
||||
}
|
||||
injectScripts(["script/add-search-index.js"]);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
window.addEventListener("message", function (event) {
|
||||
if (event.source === window &&
|
||||
event.data &&
|
||||
event.data.direction === "rust-search-extension:rustc") {
|
||||
console.log(event.data);
|
||||
let now = new Date();
|
||||
let version = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
|
||||
// rustc search index is a memory cache, therefore we don't use localStorage
|
||||
// to store the cached-version. Instead, we use `rustc:check` action, see above.
|
||||
chrome.runtime.sendMessage({ action: "rustc:add", version, ...event.data.message },
|
||||
(response) => {
|
||||
console.log(response);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
|
@ -52,11 +52,6 @@ json
|
|||
css=['script/doc-rust-lang-org.css', 'script/details-toggle.css'],
|
||||
exclude_matches=['*://doc.rust-lang.org/nightly/nightly-rustc/*'],
|
||||
)
|
||||
.addContentScript(
|
||||
matches=['*://doc.rust-lang.org/nightly/nightly-rustc/*'],
|
||||
js=utils.js_files('script', ['lib', 'rustc', 'rust-src-navigate']),
|
||||
css=['script/details-toggle.css'],
|
||||
)
|
||||
.addContentScript(
|
||||
matches=['*://rust.extension.sh/update'],
|
||||
js=['content-script-bundle.js'] + utils.js_files('script', ['rust-extension-sh']),
|
||||
|
|
Loading…
Reference in a new issue