Firefox 上下文菜单项图标
我正在尝试在上下文菜单中添加图标,但不知道为什么它没有显示。
这是完整的代码:
chrome.menifest
content xulschoolhello jar:chrome/xulschoolhello.jar!/content/
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/
locale xulschoolhello en-US jar:chrome/xulschoolhello.jar!/locale/en-US/
overlay chrome://browser/content/browser.xul chrome://xulschoolhello/content/browserOverlay.xul
style chrome://browser/content/browser.xul chrome://xulschoolhello/skin/browserOverlay.css
browserOverlay.xul
<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM
"chrome://xulschoolhello/locale/browserOverlay.dtd">
<overlay id="xulschoolhello-browser-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
.
.
.
<!-- Context menu additions -->
<popup id="contentAreaContextMenu">
<menuseparator id="ss-context-menu-separator"/>
<menuitem id="ss-context-menu-item" class="menuitem-iconic"
label="click me"
oncommand="XULSchoolChrome.BrowserOverlay.sayHello(event);"/>
</popup>
</overlay>
browserOverlay.css
#ss-context-menu-item {
list-style-image: url("ss_16.png");
}
对问题有任何想法吗?
I am trying to add an icon in context menu but don't know why it is not showing.
Here is the complete code:
chrome.menifest
content xulschoolhello jar:chrome/xulschoolhello.jar!/content/
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/
locale xulschoolhello en-US jar:chrome/xulschoolhello.jar!/locale/en-US/
overlay chrome://browser/content/browser.xul chrome://xulschoolhello/content/browserOverlay.xul
style chrome://browser/content/browser.xul chrome://xulschoolhello/skin/browserOverlay.css
browserOverlay.xul
<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM
"chrome://xulschoolhello/locale/browserOverlay.dtd">
<overlay id="xulschoolhello-browser-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
.
.
.
<!-- Context menu additions -->
<popup id="contentAreaContextMenu">
<menuseparator id="ss-context-menu-separator"/>
<menuitem id="ss-context-menu-item" class="menuitem-iconic"
label="click me"
oncommand="XULSchoolChrome.BrowserOverlay.sayHello(event);"/>
</popup>
</overlay>
browserOverlay.css
#ss-context-menu-item {
list-style-image: url("ss_16.png");
}
Any idea about problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我使用自己的扩展进行的测试,我认为除了
chrome.manifest
中的样式表之外,您可能还必须在叠加层中添加对样式表的引用。为此,您必须在 doctype 声明之前添加以下行:如果您不输入文件名,只留下
chrome://xulschoolhello/skin/
,它也应该可以工作,根据教程。From my tests with my own extension, I think that maybe you have to add a reference to the stylesheet in the overlay, in addition to the one in
chrome.manifest
. To do this you have to add the following line before the doctype declaration:If you don't put the file name, leaving only
chrome://xulschoolhello/skin/
, it should also work, according to the tutorial.