Firefox 扩展开发:将选项卡添加到首选项窗格?
我将其添加
<prefwindow id="BrowserPreferences">
<!-- Create a new pane (tab) -->
<prefpane id="whateverPrefs" label="yes!"
onpaneload="alert('hey')"
image="chrome://helloworld/content/images/man.png">
<!-- Intermediary between GUI and preferences system -->
<preferences>
<!-- see the next section for more information -->
</preferences>
<!-- GUI Elements... -->
</prefpane>
</prefwindow>
到我的overlay.xul 中。 尽管建议在此处,但它无论如何都不起作用。 不过,我确实在这段代码上取得了巨大的成功:
<menupopup id="menu_ToolsPopup">
<menuitem id="helloworld-hello2" label="frigger!"
oncommand="HelloWorld.onMenuItemCommand(event);"/>
</menupopup>
这是版本问题吗(例如,Firefox 3.x 不会这样做)? 我无法在 browser.xul 中找到字符串 BrowserPreferences,这似乎是问题的一部分。 如何将选项卡添加到 Firefox 的首选项窗格?
[抱歉,如果这个问题真的很简单,但是搜索 Firefox 扩展的帮助就像搜索“is”这个词的帮助一样。]
I'm adding this:
<prefwindow id="BrowserPreferences">
<!-- Create a new pane (tab) -->
<prefpane id="whateverPrefs" label="yes!"
onpaneload="alert('hey')"
image="chrome://helloworld/content/images/man.png">
<!-- Intermediary between GUI and preferences system -->
<preferences>
<!-- see the next section for more information -->
</preferences>
<!-- GUI Elements... -->
</prefpane>
</prefwindow>
to my overlay.xul. It doesn't work whatsoever, though it is suggested here. I do have wonderful success with this code, though:
<menupopup id="menu_ToolsPopup">
<menuitem id="helloworld-hello2" label="frigger!"
oncommand="HelloWorld.onMenuItemCommand(event);"/>
</menupopup>
Is this a version problem (e.g., Firefox 3.x will not do it)? I am unable to find the string BrowserPreferences in browser.xul, which seems to be part of the problem. How can I add tabs to the preference pane in Firefox?
[Sorry if this question is really simple, but searching for help on Firefox Extensions is like searching for help on the word "is."]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你的代码是错误的,但它应该覆盖preferences.xul而不是browser.xul - 我猜你的覆盖层正在注册browser.xul,这就是你的菜单项工作正常的原因。
查看 MDC 文章中的“注册覆盖”部分构建扩展
I don't think your code is wrong, but it should be overlaying preferences.xul not browser.xul - I'm guessing your overlay is registering with browser.xul and that's why your menu item works fine.
Check the section 'Register an Overlay' about half way down the MDC article Building an Extension