Is it possible to add a second button to this Firefox extension:
var tabs = require("sdk/tabs");
var { ActionButton } = require("sdk/ui/button/action");
var button = ActionButton({
id: "my-button",
label: "my button",
icon: {
"16": "./icon-16.png",
"32": "./icon-32.png",
"64": "./icon-64.png"
},
onClick: firstClick
});
function firstClick(state) {
button.on("click", firstClick);
tabs.activeTab.url = "url";
tabs.activeTab.reload();
}
Well that's that. I'd like to know if I can add two buttons.
You have to do this part for sure:
let myPanel = ActionButton({
....
})
let { getActiveView }=require("sdk/view/core");
let myPanelView = getActiveView(myPanel);
Then you have to add the style of chromeclass-toolbar-additional
somewhere into the DOM of it. Try adding it straight to the obtained element:
myPanelView.classList.add('chromeclass-toolbar-additional');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.