Icon for dark/incognito mode (Chrome)

master
magnolia1234 2020-10-29 18:39:26 +01:00
parent dba852ca46
commit f7a631ab34
5 changed files with 17 additions and 1 deletions

View File

@ -840,6 +840,7 @@ function clear_cookies() {
});
}
var chrome_scheme = 'light';
ext_api.runtime.onMessage.addListener(function (message, sender) {
// check storage for opt in
if (message.request === 'optin') {
@ -866,6 +867,13 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
}
});
}
if (message.scheme && message.scheme !== chrome_scheme) {
let icon_path = {path: {'128': 'bypass.png'}};
if (message.scheme === 'dark')
icon_path = {path: {'128': 'bypass-dark.png'}};
ext_api.browserAction.setIcon(icon_path);
chrome_scheme = message.scheme;
}
});
// show the tab if we haven't registered the user reacting to the prompt.

BIN
bypass-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

View File

@ -5,6 +5,7 @@ Post-release
Add Deutsche Wirtschafts Nachrichten
Add WirtschaftsWoche (Germany)
Fix-update Quartz (newsletter)
Icon for dark/incognito mode (Chrome)
* v1.9.2.0 (2020-10-25)
Add Foreign Affairs

View File

@ -28,6 +28,13 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
// ask for opt-in confirmation
ext_api.runtime.sendMessage({request: 'optin'});
// message for dark or incognito mode (chrome)
if (typeof browser !== 'object')
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches || ext_api.extension.inIncognitoContext)
ext_api.runtime.sendMessage({scheme: 'dark'});
else
ext_api.runtime.sendMessage({scheme: 'light'});
// Content workarounds/domain
if (matchDomain("thesaturdaypaper.com.au")) {

View File

@ -324,5 +324,5 @@
"webRequest",
"webRequestBlocking"
],
"version": "1.9.2.2"
"version": "1.9.2.3"
}