mirror of
https://github.com/twofas/2fas-browser-extension.git
synced 2024-11-21 17:49:56 +01:00
#1663 setIcon FIX
This commit is contained in:
parent
b46588b853
commit
2ae6707982
@ -18,7 +18,7 @@
|
||||
//
|
||||
|
||||
const browser = require('webextension-polyfill');
|
||||
const { onConnect, onCommand, onContextMenuClick, onInstalled, getBrowserInfo, onMessage, onStartup, browserAction, createContextMenus, dummyGetLocalStorage } = require('./functions');
|
||||
const { onConnect, onCommand, onContextMenuClick, onInstalled, getBrowserInfo, onMessage, onStartup, browserAction, createContextMenus, dummyGetLocalStorage, setIcon } = require('./functions');
|
||||
const { onTabRemoved, onTabUpdated, onTabActivated } = require('./tabs');
|
||||
|
||||
const browserInfo = getBrowserInfo();
|
||||
@ -47,3 +47,5 @@ browser.tabs.onActivated.addListener(onTabActivated);
|
||||
setInterval(() => {
|
||||
return dummyGetLocalStorage();
|
||||
}, 25 * 1000);
|
||||
|
||||
setIcon(null, false, false);
|
||||
|
@ -49,16 +49,21 @@ const getIconObj = async (tabID, isActive) => {
|
||||
iconFileName = isActive ? typeFilename : `${typeFilename}gray`;
|
||||
}
|
||||
|
||||
return {
|
||||
const iconObj = {
|
||||
path: {
|
||||
16: browser.runtime.getURL(`images/icons/icon16${iconFileName}.png`),
|
||||
32: browser.runtime.getURL(`images/icons/icon32${iconFileName}.png`),
|
||||
48: browser.runtime.getURL(`images/icons/icon48${iconFileName}.png`),
|
||||
96: browser.runtime.getURL(`images/icons/icon96${iconFileName}.png`),
|
||||
128: browser.runtime.getURL(`images/icons/icon128${iconFileName}.png`)
|
||||
},
|
||||
tabId: tabID
|
||||
}
|
||||
};
|
||||
|
||||
if (tabID) {
|
||||
iconObj.tabId = tabID;
|
||||
}
|
||||
|
||||
return iconObj;
|
||||
};
|
||||
|
||||
const setIcon = async (tabID, isActive = true, changeTitle = false) => {
|
||||
|
@ -20,7 +20,7 @@
|
||||
const SlimSelect = require('slim-select');
|
||||
const browser = require('webextension-polyfill');
|
||||
const { loadFromLocalStorage, saveToLocalStorage } = require('../../localStorage');
|
||||
const checkTabCS = require('../../background/functions/checkTabCS');
|
||||
const setIcon = require('../../background/functions/setIcon');
|
||||
|
||||
const setIconSelect = async () => {
|
||||
const { extIcon } = await loadFromLocalStorage(['extIcon']);
|
||||
@ -57,7 +57,8 @@ const setIconSelect = async () => {
|
||||
const tabID = await browser.tabs.query({ active: true, currentWindow: true }).then(tabs => tabs[0].id);
|
||||
|
||||
await saveToLocalStorage({ extIcon: parseInt(item[0].value, 10) });
|
||||
await checkTabCS(tabID);
|
||||
await setIcon(null, false, false);
|
||||
await setIcon(tabID, false, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user