diff options
author | Yumi Izumi <me@yumiizumi.com> | 2020-11-11 09:01:33 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-11 09:01:33 +0900 |
commit | 27736105d577f63f4a3d3e2410ad2ce37206273f (patch) | |
tree | 2864b552dbe0aae8550963ed61ea7740c85a1748 /background.js | |
parent | Update README.md (diff) | |
download | libredirect-27736105d577f63f4a3d3e2410ad2ce37206273f.zip |
Update background.js
Diffstat (limited to '')
-rw-r--r-- | background.js | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/background.js b/background.js index 64895260..cba476f8 100644 --- a/background.js +++ b/background.js @@ -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), }; |