firefox插件:将图标添加到上下文菜单
我正在尝试构建一个 Firefox 插件 &我想在右键单击内容菜单中添加图像/图标,例如,firebug 在右键单击上下文菜单中有一个图标
我想做类似的事情,我的插件也包含菜单项
上下文菜单中插件的结构:
[icon] [menu]
[menu item 1]
[menu item 2]
[menu item 3]
[menu item 4]
我该怎么做?
I'm trying to build a firefox addon & I want to add image/icon in the right click content menu , for example, firebug had an icon in the right click context menu,
I wanna do something similar, my addon also consists of menu items
structure of my addon in context menu :
[icon] [menu]
[menu item 1]
[menu item 2]
[menu item 3]
[menu item 4]
How can I do it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须设置
image
属性,为元素提供classmenu-iconic
并存储图像,以便你可以访问它。XUL:
JavaScript:
您还可以动态设置或更改图像(首先获取对元素的引用):
You have to set the
image
attribute, give the element the classmenu-iconic
and store the image so that you can access it.XUL:
JavaScript:
You can also set or change the image dynamically (get a reference to the element first):
您可以使用新的 Mozilla Add-ons SDK 图像(使用
可选选项下的图像属性)添加上下文菜单:
只需添加图像属性,如下
图所示:项目的图标,字符串 URL。 URL 可以是远程的、对附加组件数据目录中图像的引用或数据 URI。
Addon SDK 的 Mozilla 上下文菜单帮助页面
You can add a context menu using the new Mozilla Add-ons SDK image using the image property
under Optional options:
just add the image attribute like this
image: The item's icon, a string URL. The URL can be remote, a reference to an image in the add-on's data directory, or a data URI.
Mozilla context menu help page for Addon SDK