[Project_owners] Context menu

Didier Ernotte didier at ernotte.com
Wed Feb 1 05:40:13 EST 2006


Hi,

Use 
object.setAttribute("collapsed", boolean) instead.

Didier


--- Ramiro Aparicio <frisco82 at gmail.com> wrote:

> 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?.
> > _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 



More information about the Project_owners mailing list