From 27736105d577f63f4a3d3e2410ad2ce37206273f Mon Sep 17 00:00:00 2001 From: Yumi Izumi Date: Wed, 11 Nov 2020 09:01:33 +0900 Subject: [PATCH] Update background.js --- background.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/background.js b/background.js index 6489526..cba476f 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), };