I am trying to write a very simple extension for Firefox that shows an Icon Notifier in to Toolbar displaying the number of items I have visited the current website.
So far, I have set up a very simple manifest.json, which basically just creates the extension and an icon in the toolbar.
{
"description": "Count the visits for the current website",
"manifest_version": 2,
"name": "CounttheVisits",
"icons": {
"48": "beasts-32.png"
},
"permissions": [
"tabs"
],
"version": "1.0",
"browser_action": {
"browser_style": true
},
"background": {
"scripts": ["background.js"]
}
}
Now I understand that I would have to add browserAction.setBadgeText() to the background.js and set it to take the value for number of visits from my browser history.
My best guess is something along the lines of:
var visits = browser.history.getVisits();
browser.browserAction.setBadgeText({text: (++visits).toString()});
But I am sure I am missing something - can anyone of you help? Much appreciated :)