[英]Add a second button to a Firefox extension using jpm
Is it possible to add a second button to this Firefox extension: 是否可以在此Firefox扩展中添加第二个按钮:
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. 然后,您必须将chromeclass-toolbar-additional
的样式添加到其DOM中。 Try adding it straight to the obtained element: 尝试将其直接添加到获得的元素中:
myPanelView.classList.add('chromeclass-toolbar-additional');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.