From 83be46381192ef3944722f3a0b2739cbcbacf480 Mon Sep 17 00:00:00 2001 From: Aurelien <63868592+aurelienlux@users.noreply.github.com> Date: Fri, 30 Oct 2020 16:24:23 +0100 Subject: [PATCH] Option to ignore preference pages to set language when ignoring search (#103) --- background.js | 22 ++++++++++++++++++++-- options.html | 10 +++++++++- options.js | 2 ++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/background.js b/background.js index 7dc1580..6213727 100644 --- a/background.js +++ b/background.js @@ -237,7 +237,7 @@ function reopenTab ({url, tab, cookieStoreId}) { index: tab.index + 1, windowId: tab.windowId }); - // We do not want to erase google container if going from + // We do not want to erase google container if going from // google container back to default. if (!(isSearchPageURL(tab.url))) { browser.tabs.remove(tab.id); @@ -269,6 +269,16 @@ function isSearchPageURL (url) { return parsedUrl.pathname.startsWith('/search'); } +function isPrefPageURL (url) { + const parsedUrl = new URL(url); + return parsedUrl.pathname.startsWith('/preferences'); +} + +function isSetprefsPageURL (url) { + const parsedUrl = new URL(url); + return parsedUrl.pathname.startsWith('/setprefs'); +} + function isMapsURL (url) { const parsedUrl = new URL(url); return parsedUrl.pathname.startsWith('/maps'); @@ -295,6 +305,14 @@ function shouldContainInto (url, tab) { handleUrl = false; } + if (handleUrl && extensionSettings.ignore_prefpages && isPrefPageURL(url)) { + handleUrl = false; + } + + if (handleUrl && extensionSettings.ignore_prefpages && isSetprefsPageURL(url)) { + handleUrl = false; + } + if (handleUrl && extensionSettings.ignore_maps && isMapsURL(url)) { handleUrl = false; } @@ -309,7 +327,7 @@ function shouldContainInto (url, tab) { // Tab is already in a container, the user doesn't want us to override containers return false; } - + // Google-URL outside of Google Container Tab // Should contain into Google Container return googleCookieStoreId; diff --git a/options.html b/options.html index cfed07b..82c4f54 100644 --- a/options.html +++ b/options.html @@ -30,6 +30,14 @@

Settings

+

+ +

+

Settings

(Means don't use Google Container on Google sites with a path of /flights.)

- +