开发者

Firefox extension: Adding item to tools menu

开发者 https://www.devze.com 2023-02-14 13:39 出处:网络
I want my extension as menu entry under the ff menu item \"View\". I cannot figure out how to call it. This would be the code for \"Tools\":

I want my extension as menu entry under the ff menu item "View". I cannot figure out how to call it. This would be the code for "Tools":

<menupopup id="menu_ToolsPopup">
   <menuitem id="bs-hello" label="&bs.label;"
          oncommand="bs.onMenuItemCommand(event);"/>
</menupopup>

All I have to change is the id of menupopup but I don't know the id of "View". Anyone can help me 开发者_如何学编程out?


Firefox defines various ids for overlaying. The id for the View menu is menu_viewPopup. Please note the non-capital 'v'.

For other overlay points see https://developer.mozilla.org/en/FirefoxOverlayPoints/Menus


The following very simple extension adds a menu item to the View popup.

My manifest:

content menutest    chrome/content/
overlay chrome://browser/content/browser.xul chrome://menutest/content/menutest.xul

My XUL file:

<?xml version="1.0"?>
<overlay id="menutest" 
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <menupopup id="menu_viewPopup">
       <menuitem id="bs-hello" label="My View Item"
              oncommand="alert('test');"/>
    </menupopup>
</overlay>
0

精彩评论

暂无评论...
验证码 换一张
取 消