Page 1 of 1
Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 09:30
by moonbat
I'm revamping Pure URL, converting it from Jetpack to a regular overlay extension, and trying to add a few visual improvements (helps me learn more about extension development as well). Currently it has a toolbar button that launches an options dialog (with an easier to use list of garbage fields to add/remove).How do I display a mini counter on top of the toolbar icon for links processed, similar to nMatrix or uBlock Origin?
Re: Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 10:27
by vannilla
It's probably a good starting point to read the source code of the extensions you listed.
Re: Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 10:36
by moonbat
Does it make a difference if they're addon/jetpack vs the regular overlay extension I'm working on?
Re: Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 13:57
by vannilla
moonbat wrote: ↑2020-04-19, 10:36
Does it make a difference if they're addon/jetpack vs the regular overlay extension I'm working on?
I don't think so, no.
Just make sure you call the code only if the toolbar button is actually on a toolbar.
Re: Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 14:10
by moonbat
Can't make head or tail of the code in uBO - there is no XUL to define the toolbar icon since it is a bootstrap/jetpack extension. I searched the code for words like 'icon' but no luck, it is almost entirely only related with processing pages (as expected).
Re: Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 14:23
by adesh
Re: Add a counter to a toolbar button, like nMatrix?
Posted: 2020-04-19, 14:44
by moonbat
Interesting, he's using CSS to superimpose a badge. Good point to start looking, thanks