1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Implemented: Customize badge colors (#109)

This commit is contained in:
nobody
2020-09-25 07:34:59 +02:00
parent 15b1037a4b
commit 46f5ffac76
7 changed files with 153 additions and 37 deletions

View File

@@ -1,9 +1,13 @@
/**
* Internal API Wrapper Module
* Belongs to Decentraleyes.
* Belongs to LocalCDN.
*
* @author Thomas Rientjes
* @since 2017-12-03
* @author nobody
* @since 2020-07-09
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -26,6 +30,10 @@ var wrappers = {};
wrappers.setBadgeBackgroundColor = function (details) {
if (chrome.browserAction.setBadgeBackgroundColor !== undefined) {
chrome.browserAction.setBadgeBackgroundColor(details);
storageManager.type.set({
[Setting.BADGE_COLOR]: details.color
});
}
};
@@ -38,6 +46,10 @@ wrappers.setBadgeText = function (details) {
wrappers.setBadgeTextColor = function (details) {
if (chrome.browserAction.setBadgeTextColor !== undefined) {
chrome.browserAction.setBadgeTextColor(details);
storageManager.type.set({
[Setting.BADGE_TEXT_COLOR]: details.color
});
}
};
@@ -49,3 +61,11 @@ wrappers.setIcon = function (details, type) {
}
chrome.browserAction.setIcon(details);
};
storageManager.type.get([Setting.BADGE_COLOR, Setting.BADGE_TEXT_COLOR], function (items) {
wrappers.textColor = items.badgeTextColor || '#FFFFFF';
wrappers.backgroundColor = items.badgeColor || '#4A826C';
wrappers.setBadgeTextColor({color: wrappers.textColor});
wrappers.setBadgeBackgroundColor({color: wrappers.backgroundColor});
});