Overlaying and overlay, possible?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Overlaying and overlay, possible?

Sailfish
I'm trying to add a menu to the tabpanel context menu. The current
context menu is created using an overlay and is identified by its anonid
attribute, "tabContextMenu". The only thing I could find on modifying
this has to do with changing values to already existing properties using
the getAnonymousElementByAttribute function. Is there a way to add
additon menu items to this anonymous content and, if so, can someone
either explain it to me or point me to a reference where it's discussed
(or even an relatively small extension that does it already.)

TIA

--

Mozilla Tips: http://www.ufaq.org/ , http://ilias.ca/
About Mozilla: http://www.mozilla.com/
Mozilla Themes: http://www.projectit.com/freestuff.html
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Overlaying and overlay, possible?

Philip Chee
On Wed, 01 Feb 2006 21:02:41 -0800, Sailfish wrote:

> I'm trying to add a menu to the tabpanel context menu. The current
> context menu is created using an overlay and is identified by its anonid
> attribute, "tabContextMenu". The only thing I could find on modifying
> this has to do with changing values to already existing properties using
> the getAnonymousElementByAttribute function. Is there a way to add
> additon menu items to this anonymous content and, if so, can someone
> either explain it to me or point me to a reference where it's discussed
> (or even an relatively small extension that does it already.)

In browser.js there is this bit of code:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function addBookmarkMenuitems()
{
  var tabbrowser = getBrowser();
  var tabMenu =
document.getAnonymousElementByAttribute(tabbrowser,"anonid","tabContextMenu");
  var bookmarkAllTabsItem = document.createElement("menuitem");
  bookmarkAllTabsItem.setAttribute("label",
gNavigatorBundle.getString("bookmarkAllTabs_label"));
  bookmarkAllTabsItem.setAttribute("accesskey",
gNavigatorBundle.getString("bookmarkAllTabs_accesskey"));
  bookmarkAllTabsItem.setAttribute("command", "Browser:BookmarkAllTabs");
  // set up the bookmarkAllTabs menu item correctly when the menu popup is shown
  tabMenu.addEventListener("popupshowing", UpdateBookmarkAllTabsMenuitem,
false);
  var bookmarkCurTabItem = document.createElement("menuitem");
  bookmarkCurTabItem.setAttribute("label",
gNavigatorBundle.getString("bookmarkCurTab_label"));
  bookmarkCurTabItem.setAttribute("accesskey",
gNavigatorBundle.getString("bookmarkCurTab_accesskey"));
  bookmarkCurTabItem.setAttribute("oncommand", "BookmarkThisTab();");
  var menuseparator = document.createElement("menuseparator");
  var insertPos = tabMenu.lastChild.previousSibling;
  tabMenu.insertBefore(bookmarkAllTabsItem, insertPos);
  tabMenu.insertBefore(bookmarkCurTabItem, bookmarkAllTabsItem);
  tabMenu.insertBefore(menuseparator, bookmarkCurTabItem);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Phil
--
Philip Chee <[hidden email]>, <[hidden email]>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]A thick head can do as much damage as a hard heart.
* TagZilla 0.059
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Overlaying and overlay, possible?

Sailfish
Philip Chee wrote:

> On Wed, 01 Feb 2006 21:02:41 -0800, Sailfish wrote:
>
>> I'm trying to add a menu to the tabpanel context menu. The current
>> context menu is created using an overlay and is identified by its anonid
>> attribute, "tabContextMenu". The only thing I could find on modifying
>> this has to do with changing values to already existing properties using
>> the getAnonymousElementByAttribute function. Is there a way to add
>> additon menu items to this anonymous content and, if so, can someone
>> either explain it to me or point me to a reference where it's discussed
>> (or even an relatively small extension that does it already.)
>
> In browser.js there is this bit of code:
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> function addBookmarkMenuitems()
> {
>   var tabbrowser = getBrowser();
>   var tabMenu =
> document.getAnonymousElementByAttribute(tabbrowser,"anonid","tabContextMenu");
>   var bookmarkAllTabsItem = document.createElement("menuitem");
>   bookmarkAllTabsItem.setAttribute("label",
> gNavigatorBundle.getString("bookmarkAllTabs_label"));
>   bookmarkAllTabsItem.setAttribute("accesskey",
> gNavigatorBundle.getString("bookmarkAllTabs_accesskey"));
>   bookmarkAllTabsItem.setAttribute("command", "Browser:BookmarkAllTabs");
>   // set up the bookmarkAllTabs menu item correctly when the menu popup is shown
>   tabMenu.addEventListener("popupshowing", UpdateBookmarkAllTabsMenuitem,
> false);
>   var bookmarkCurTabItem = document.createElement("menuitem");
>   bookmarkCurTabItem.setAttribute("label",
> gNavigatorBundle.getString("bookmarkCurTab_label"));
>   bookmarkCurTabItem.setAttribute("accesskey",
> gNavigatorBundle.getString("bookmarkCurTab_accesskey"));
>   bookmarkCurTabItem.setAttribute("oncommand", "BookmarkThisTab();");
>   var menuseparator = document.createElement("menuseparator");
>   var insertPos = tabMenu.lastChild.previousSibling;
>   tabMenu.insertBefore(bookmarkAllTabsItem, insertPos);
>   tabMenu.insertBefore(bookmarkCurTabItem, bookmarkAllTabsItem);
>   tabMenu.insertBefore(menuseparator, bookmarkCurTabItem);
> }
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
I'll need to do some experimenting but on the surface, it looks like it
holds the secret to solving my puzzle.

Thanks for the timely and helpful reply.

--

Mozilla Tips: http://www.ufaq.org/ , http://ilias.ca/
About Mozilla: http://www.mozilla.com/
Mozilla Themes: http://www.projectit.com/freestuff.html
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul