Update background.js

This commit is contained in:
Yumi Izumi 2020-11-11 09:01:33 +09:00 committed by GitHub
parent f483faad4a
commit 27736105d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -129,12 +129,7 @@ const layers = {
traffic: "S", // not implemented on OSM, default to standard.
bicycling: "C",
};
const notPrivateSearchEngine = [
"google.com",
"google.co.jp",
"www.google.com",
"www.google.co.jp",
];
const googleSearchRegex = /https?:\/\/(((www|maps)\.)?(google\.).*(\/search)|search\.(google\.).*)/;
const privateSearchEngine = [
{ link: "https://duckduckgo.com", q: "/" },
{ link: "https://startpage.com", q: "/search/" },
@ -642,7 +637,7 @@ browser.webRequest.onBeforeRequest.addListener(
redirect = {
redirectUrl: redirectReddit(url, initiator, details.type),
};
} else if (notPrivateSearchEngine.includes(url.host)) {
} else if (url.href.match(googleSearchRegex)) {
redirect = {
redirectUrl: redirectSearchEngine(url, initiator),
};