I created a Firefox add-on called New Tab Plus:
https://addons.mozilla.org/en-US/firefox/addon/newtabplus/
Currently the [+] icon is located at the very right portion of the tabstrip. I would like the [+] icon to be in the same position as the default Firefox "open a new tab" position, it's located next to the last tab. Is there any way do this?
manifest.json
{
"manifest_version": 2,
"name": "New Tab Plus",
"version": "1.0",
"description": "Adds a [+] icon which opens a new tab to a specified URL.",
"icons": {
"48": "page-48.svg"
},
"developer": {
"name": "Andy Bajka"
},
"background": {
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": {
"48": "page-48.svg"
},
"default_area": "tabstrip"
},
"permissions": [
"storage",
"tabs"
],
"options_ui": {
"page": "options.html"
},
"browser_specific_settings": {
"gecko": {
"id": "bcd339e2-fee5-40fd-8acd-2021a8815b95@bajka.com",
"strict_min_version": "102.0"
}
}
}
background.js
function openPage() {
browser.storage.local.get(['preferred_URL'], function(result) {
console.log(result);
browser.tabs.create({
"url": result.preferred_URL
})
});
}
function onGot(item) {
let preference_url = "https://www.google.com/";
if (item.preference_url) {
preference_url = item.preference_url;
}
browser.storage.local.set({ "preferred_URL" : preference_url });
}
function onError(error) {
console.log(`Error: ${error}`);
}
browser.browserAction.onClicked.addListener(openPage);
console.log(browser.browserAction.onClicked.addListener);
let getting = browser.storage.sync.get("preference_url");
getting.then(onGot, onError);
How can I get the icon ID? Perhaps with the icon ID I could use CSS or other code to move it.