【问题标题】:Using the Toolbar Buttons library in Firefox在 Firefox 中使用工具栏按钮库
【发布时间】:2013-04-22 19:50:11
【问题描述】:
【问题讨论】:
标签:
javascript
html
firefox
firefox-addon
【解决方案1】:
下载这个包:
https://github.com/voldsoftware/toolbarbutton-jplib
将toolbarbutton.js 添加到您的 Lib 文件夹中。此外,您可能还想添加listen.js 和unload+.js。 (依赖项)
在exports.main函数中添加如下代码:
// create toolbarbutton
var tbb = toolbar.ToolbarButton({
id: "TBB-TEST",
label: "TBB TEST",
onCommand: function () {
tbb.destroy(); // kills the toolbar button
}
});
if (require('self').loadReason == "install") {
tbb.moveTo({
toolbarID: "nav-bar",
forceMove: false // only move from palette
});
}
默认情况下,这会将一组新图标添加到导航工具栏。去图:)