Add toolbar icon

This commit is contained in:
Arkadiusz Wieczorek 2022-04-11 13:52:45 +02:00
parent 647095ad9e
commit 51872621b7
3 changed files with 31 additions and 8286 deletions

View File

@ -1,5 +1,5 @@
trailingComma: "es5" trailingComma: "es5"
tabWidth: 3 tabWidth: 4
printWidth: 100 printWidth: 100
semi: true semi: true
singleQuote: true singleQuote: true

8305
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ import Options from '../options';
import { StolenData } from './stolen-data'; import { StolenData } from './stolen-data';
import { getshorthost, useEmitter } from '../util'; import { getshorthost, useEmitter } from '../util';
import { getMemory } from '../memory'; import { getMemory } from '../memory';
browser.browserAction.setBadgeBackgroundColor({ color: '#ffb900' });
async function getCurrentTab() { async function getCurrentTab() {
const [tab] = await browser.tabs.query({ const [tab] = await browser.tabs.query({
@ -13,6 +14,13 @@ async function getCurrentTab() {
return tab; return tab;
} }
function setDomainsNumber(counter: number) {
browser.browserAction.setBadgeText({ text: counter.toString() });
browser.browserAction.setTitle({
title: `Rentgen - ${counter !== 1 ? counter + ' podmiotów' : counter + ' podmiot'} `,
});
}
import './global.scss'; import './global.scss';
import './sidebar.scss'; import './sidebar.scss';
@ -65,6 +73,8 @@ const Sidebar = () => {
return setMarksOccurrence(true); return setMarksOccurrence(true);
} }
} }
setDomainsNumber(Object.values(getMemory().getClustersForOrigin(origin)).length);
return setMarksOccurrence(false); return setMarksOccurrence(false);
}, [eventCounts['*'], origin]); }, [eventCounts['*'], origin]);