diff --git a/background.js b/background.js new file mode 100644 index 0000000..88a441c --- /dev/null +++ b/background.js @@ -0,0 +1,6 @@ +function autoCloseNewTab(tabId, changeInfo, tab) { + console.log(tabId, changeInfo, tab) + if (tab.url.trim() === "about:newtab") + browser.tabs.remove([tabId]); +} +browser.tabs.onUpdated.addListener(autoCloseNewTab); diff --git a/icons/icon.svg b/icons/icon.svg new file mode 100644 index 0000000..55aeba4 --- /dev/null +++ b/icons/icon.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..8aaea2e --- /dev/null +++ b/manifest.json @@ -0,0 +1,21 @@ +{ + "manifest_version": 2, + "name": "Auto Close New Tab", + "version": "1.0", + + "description": "Automatically closes the tab whenever you open a new tab.", + "homepage_url": "https://gitlab.com/ceda_ei/autoclose-newtab", + + "icons": { + "48": "icons/icon.svg", + "96": "icons/icon.svg" + }, + + "permissions": [ + "tabs" + ], + + "background": { + "scripts": ["background.js"] + } +}