[Project_owners] Context menu

Ramiro Aparicio frisco82 at gmail.com
Wed Feb 1 14:32:13 EST 2006


First of all I would like to thank you for the help with extension
descriptrion localization it works perfectly now.

Now I have a different problem, I have an option in the context menu that
must be hidden most of the time but if you are in some domains it will
appear. Thanks quite usual so I have seen a lot of code that does this, but
for some reason I can not make it work properly even after copying pasting
other extensions code.

This is my overlay.xul:

<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM "chrome://foxgame/locale/foxgame.dtd">
<overlay id="FoxGameOverlay"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:nc="http://home.netscape.com/NC-rdf#"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/x-javascript"
src="chrome://global/content/strres.js"/>
<script type="application/x-javascript"
src="chrome://foxgame/content/foxgameCommon.js" />
<script type="application/x-javascript"
src="chrome://foxgame/content/foxgame.js" />
<script type="application/x-javascript"
src="chrome://foxgame/content/dateLibrary.js" />
<popup id="contentAreaContextMenu" >
<menuitem id="foxgame-config-menu" label="&foxgame.menu.configure;"
onpopupshowing="foxgame_initPopupMenu(event);"
oncommand="configureFoxGame();" />
</popup>

</overlay>

And the relevant functions in the .js:

function foxgame_initPopupMenu(event) {
    try {
        if (event.target.id != "contentAreaContextMenu") return;

        var fgMenu = document.getElementById("foxgame-config-menu");
    dump(isOGameDomain(window._content.document.location.href)+"\n");
    fgMenu.hidden = !isOGameDomain(window._content.document.location.href);
    fgMenu.collapsed =
!isOGameDomain(window._content.document.location.href);
    dump(fgMenu.hidden+"\n");
    return;
    } catch (e){
        foxgamedebug(e);
    }
}

document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",
foxgame_initPopupMenu, false);

The debug function shows an alert but it is not called so no exceptcion is
found. I have tried adding the even listener to window also, also listening
to "popupshown", giving a menu element father to the menu item...
And the funniest thing as you can see I added dumps to console and that
shows that hidden is set correctly (false when it must be false) but for
some reason it does not show the option.

I also tried disabling al extension and nothing but I have my extension
active adblock+ options are not shown.

Can somebody give me an idea about what I am doing wrong?.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20060201/cd6b6afd/attachment.htm


More information about the Project_owners mailing list