From 24e9b319e68191230418ea4eaea638bf90bc5478 Mon Sep 17 00:00:00 2001 From: Marko Bajlovic Date: Wed, 15 May 2024 19:36:44 -0400 Subject: [PATCH] updates --- firefox/background.js | 27 ++++++------------ firefox/manifest.json | 4 +-- firefox/newtab.html | 2 +- ...yparty-3.4.2.zip => startyparty-3.4.5.zip} | Bin 56994 -> 57000 bytes 4 files changed, 11 insertions(+), 22 deletions(-) rename firefox/web-ext-artifacts/{startyparty-3.4.2.zip => startyparty-3.4.5.zip} (97%) 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 @@ - New Tab + startyparty