about summary refs log tree commit diff stats
path: root/background.js
diff options
context:
space:
mode:
Diffstat (limited to 'background.js')
-rw-r--r--background.js9
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),
       };