From 7b6438dce56f11a04858f6c0199ab651a195a343 Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 7 Jul 2021 21:55:35 -0400 Subject: [PATCH 1/3] fix some background-theme stuff --- background.js | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/background.js b/background.js index 3e30d1f..505d0b8 100644 --- a/background.js +++ b/background.js @@ -222,6 +222,10 @@ function themeWindow(window) { browser.theme.update(window.id, btheme); } } + + function unsetTheme() { + browser.theme.reset() + } function logTabs(tabInfo) { function onContextGotTheme(context) { if (context.name == titlepref) { @@ -251,6 +255,8 @@ function themeWindow(window) { } else if (context.name == muwirepref) { console.log("Active in MuWire window"); dynamicTheme(); + } else { + browser.theme.reset(); } } if ( @@ -262,22 +268,7 @@ function themeWindow(window) { .then(onContextGotTheme, onThemeError); } else { console.log("Not active in I2P window"); - function unSetTheme(them) { - console.log("unsetting theme", them); - if (Object.keys(them).length > 0) { - try { - browser.theme.update(window.id, them.originalTheme); - } catch (e) { - console.log( - "Original theme set error. Your theme must have an SVG in it.", - e - ); - } - } else { - browser.theme.update(window.id, { colors: null }); - } - } - browser.storage.local.get("originalTheme").then(unSetTheme, onError); + browser.theme.reset(); } } From 7bd7701aeb6b9b6a7c879cafbc3bdbc10a447456 Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 7 Jul 2021 22:34:01 -0400 Subject: [PATCH 2/3] Remove obsolete workaround to theme reset issue --- background.js | 72 ++++++++++----------------------------------------- 1 file changed, 14 insertions(+), 58 deletions(-) diff --git a/background.js b/background.js index 505d0b8..1a81065 100644 --- a/background.js +++ b/background.js @@ -203,7 +203,8 @@ let dtheme = { function themeWindow(window) { // Check if the window is in private browsing function onThemeError() { - console.log("theme color set error"); + console.log("(theme) color set error"); + browser.theme.reset(); } function dynamicTheme() { @@ -215,7 +216,7 @@ function themeWindow(window) { } function browserTheme() { - console.log("Active in I2P window"); + console.log("(theme)Active in I2P window"); if (window.incognito) { browser.theme.update(window.id, btheme); } else { @@ -224,7 +225,7 @@ function themeWindow(window) { } function unsetTheme() { - browser.theme.reset() + browser.theme.reset(); } function logTabs(tabInfo) { function onContextGotTheme(context) { @@ -232,30 +233,31 @@ function themeWindow(window) { browserTheme(); browser.pageAction.show(tabInfo[0].id); } else if (context.name == routerpref) { - console.log("Active in Router Console window"); + console.log("(theme) Active in Router Console window"); dynamicTheme(); } else if (context.name == tunnelpref) { - console.log("Active in Hidden Services Manager window"); + console.log("(theme) Active in Hidden Services Manager window"); dynamicTheme(); } else if (context.name == mailpref) { - console.log("Active in Web Mail window"); + console.log("(theme) Active in Web Mail window"); dynamicTheme(); } else if (context.name == torrentpref) { - console.log("Active in Bittorrent window"); + console.log("(theme) Active in Bittorrent window"); dynamicTheme(); } else if (context.name == botepref) { - console.log("Active in Bote window"); + console.log("(theme) Active in Bote window"); dynamicTheme(); } else if (context.name == ircpref) { - console.log("Active in IRC window"); + console.log("(theme) Active in IRC window"); dynamicTheme(); } else if (context.name == blogpref) { - console.log("Active in Blog window"); + console.log("(theme) (theme) Active in Blog window"); dynamicTheme(); } else if (context.name == muwirepref) { - console.log("Active in MuWire window"); + console.log("(theme) Active in MuWire window"); dynamicTheme(); } else { + console.log("(theme) Not active in MuWire window"); browser.theme.reset(); } } @@ -267,7 +269,7 @@ function themeWindow(window) { .get(tabInfo[0].cookieStoreId) .then(onContextGotTheme, onThemeError); } else { - console.log("Not active in I2P window"); + console.log("(theme) Not active in I2P window"); browser.theme.reset(); } } @@ -373,52 +375,6 @@ gettingListenerInfo.then((got) => { } }); -function handleUpdated(updateInfo) { - function maybeSet(them) { - console.log("original theme found:", them, Object.keys(them).length); - try { - if (updateInfo.theme.colors != null) { - console.log( - "testing theme", - updateInfo.theme.colors.toolbar, - "!=", - btheme.colors.toolbar - ); - console.log( - "testing theme", - updateInfo.theme.colors.toolbar, - "!=", - dtheme.colors.toolbar - ); - if ( - updateInfo.theme.colors.toolbar != dtheme.colors.toolbar && - updateInfo.theme.colors.toolbar != btheme.colors.toolbar - ) { - function onSet() { - console.log("stored theme:", updateInfo.theme); - } - /*if ( - updateInfo.theme.colors != null && - updateInfo.theme.images != null && - updateInfo.theme.properties != null - ) {*/ - console.log("storing theme:", updateInfo.theme); - browser.storage.local - .set({ originalTheme: updateInfo.theme }) - .then(onSet, onError); - //} - } - } - } catch (e) { - console.log("theme storage error", e); - } - } - console.log("Handling theme", updateInfo); - browser.storage.local.get("originalTheme").then(maybeSet, onError); -} - -browser.theme.onUpdated.addListener(handleUpdated); - function handleClick() { console.log("Opening page action"); browser.pageAction.openPopup(); From d3cf9e8686682f279d70c53c9e577a9e43e3d7fa Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 7 Jul 2021 22:53:14 -0400 Subject: [PATCH 3/3] bump strict-min-version so the validator shuts up, nobody's as far back as Firefox 60 right now --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0a0aba3..6948726 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "applications": { "gecko": { "id": "i2ppb@eyedeekay.github.io", - "strict_min_version": "60.0" + "strict_min_version": "64.0" } }, "permissions": [