Updated background.js

This commit is contained in:
aapl-yumi 2020-11-22 16:41:43 +09:00
parent 27736105d5
commit 9c3ca12b65
1 changed files with 11 additions and 16 deletions

View File

@ -586,22 +586,17 @@ function redirectSearchEngine(url, initiator) {
if (disableSearchEngine || isException(url, initiator)) {
return null;
}
if (url.pathname.includes("/home")) {
return null;
}
if (url.pathname.includes("search")) {
searchEngine =
searchEngineInstance || getRandomInstance(privateSearchEngine);
search = "";
url.search
.slice(1)
.split("&")
.forEach(function (input) {
if (input.startsWith("q=")) search = input;
});
console.log("search: ", search);
return `${searchEngine.link}${searchEngine.q}?${search}`;
}
let searchEngine = getRandomInstance(privateSearchEngine);
let search = "";
url.search
.slice(1)
.split("&")
.forEach(function (input) {
if (input.startsWith("q=")) search = input;
});
console.log("search: ", search);
return `${searchEngine.link}${searchEngine.q}?${search}`;
}
browser.webRequest.onBeforeRequest.addListener(