diff --git a/firefox/background.js b/firefox/background.js index 66e398e..4a92455 100644 --- a/firefox/background.js +++ b/firefox/background.js @@ -1,25 +1,14 @@ -let isNewSession = true; const homepageUrl = "https://startyparty.dev"; -chrome.tabs.onCreated.addListener((tab) => { - if ( - isNewSession && - (tab.url === "about:blank" || tab.url === "about:newtab") - ) { - chrome.tabs.update(tab.id, { url: homepageUrl }); - } +chrome.browserAction.onClicked.addListener((tab) => { + chrome.tabs.update(tab.id, { url: homepageUrl }); }); -chrome.windows.onCreated.addListener(() => { - if (isNewSession) { - isNewSession = false; +browser.windows.onCreated.addListener(async (window) => { + if (window.type === "normal") { + const tabs = await browser.tabs.query({ windowId: window.id }); + if (tabs.length === 1 && tabs[0].url === "about:blank") { + await browser.tabs.update(tabs[0].id, { url: homepageUrl }); + } } }); - -chrome.runtime.onStartup.addListener(() => { - isNewSession = true; -}); - -chrome.browserAction.onClicked.addListener((tab) => { - chrome.tabs.update(tab.id, { url: homepageUrl }); -}); \ No newline at end of file diff --git a/firefox/manifest.json b/firefox/manifest.json index f0eb6ec..d68261b 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "startyparty", - "version": "3.4.2", + "version": "3.4.5", "description": "The start of it all.", "author": "Marko Bajlovic - (des)mosthenes", "homepage_url": "https://startyparty.dev", @@ -16,7 +16,7 @@ }, "default_title": "startyparty" }, - "permissions": ["browserSettings", "webNavigation", "storage", "tabs", "activeTab"], + "permissions": ["webNavigation", "storage", "tabs", "activeTab"], "chrome_url_overrides": { "newtab": "newtab.html" }, diff --git a/firefox/newtab.html b/firefox/newtab.html index 0a690fc..0ee8fff 100644 --- a/firefox/newtab.html +++ b/firefox/newtab.html @@ -3,7 +3,7 @@
-