diff --git a/README.md b/README.md index d67ed93874865c2411e63bbcdc1106d17d370208..7cb0c67b5b49d252bc2fbf0a7edf96ae768d3af0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ It's possible to: The extension can be start and stop via the button on the top right. +The rules are active in private window mode but you can't use the configuration window in this mode. + The code is opensource under Mozilla Public License 2.0 diff --git a/manifest.json b/manifest.json index 70d0cc64e2bdcd4bf80f73712563bde871b5275f..000b24f039e9e5e3ce80787919bad341ec8bf67c 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ }, "permissions": [ - "activeTab","storage","webRequest", "webRequestBlocking", "<all_urls>" + "activeTab","storage","webRequest", "webRequestBlocking", "<all_urls>" ,"tabs" ], "background": { diff --git a/popup/menu.js b/popup/menu.js index b90cdc7c8e0d6956731f3c18683ebe90d55b5cb4..8af4f76a5ea6dcd46e985df3270c0753953b4fd7 100644 --- a/popup/menu.js +++ b/popup/menu.js @@ -41,7 +41,24 @@ function start_modify() function start_config() { - //var strWindowFeatures = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=800,height=600"; - // window.open("config.html","Simple Modify Headers",strWindowFeatures); - browser.tabs.create({url:"config.html"}); + var promise_tabs = browser.tabs.query({currentWindow: true}); + promise_tabs.then(loadConfigTab); + } + + +function loadConfigTab(tabs) + { + var config_tab; + + // search for config tab + for (let tab of tabs) + { + if (tab.url.startsWith(browser.extension.getURL(""))) config_tab = tab; + } + + // config tab exits , put the focus on it + if (config_tab) browser.tabs.update(config_tab.id,{active:true}) + + // else create a new tab + else browser.tabs.create({url:"config.html"}); }