Dienstag, 22. September 2009
A list of handy attributes and functions of gContextMenu for Mozilla Firefox Extension development (posted because google didn't find any documentation on gContextMenu when I looked for it):

gContextMenu.target

The DOM object the user clicked on.

gContextMenu.menu

The internal object representing the popup menu.

gContextMenu.popupURL

Something internal. Yeah, I know, cool explanation =).

gContextMenu.onTextInput

Returns true if target is a text input element.

gContextMenu.onImage

Returns true if target is a image.

gContextMenu.onLoadedImage

Returns true if target is image that's loaded.

gContextMenu.onLink

Returns true if target is a link.

gContextMenu.onMailtoLink

Returns true if target is a mailto link.

gContextMenu.onSaveableLink

I don't know exactly what this is good for. Comment inside the code: "If element is a directory, then you can't save it."
Implementation equivalent to:
onSaveableLink = target.getAttribute( "URL" ) && target.getAttribute( "container" ) != "true"

gContextMenu.onMetaDataItem

I don't know what this is for. Have a look at the link at the bottom, the implementation should help you figure out the exact behaviour.

gContextMenu.onMathML

I don't know what this is for. Have a look at the link at the bottom, the implementation should help you figure out the exact behaviour.

gContextMenu.link

Returns a pseudo link object (like in DOM) with a href attribute and getAttribute function.

gContextMenu.inFrame

Returns true if the user clicked inside of a frame.

gContextMenu.hasBGImage

I don't know what this is for. Have a look at the link at the bottom, the implementation should help you figure out the exact behaviour.

gContextMenu.isTextSelected

Returns true if there is selected text that you can retrieve with content.window.getSelection(). Does not work if the selected text is inside of a text input. Also returns true, if the user didn't click on the selection but somewhere else on the page.

gContextMenu.inDirList

I don't know what this is for. Have a look at the link at the bottom, the implementation should help you figure out the exact behaviour.

gContextMenu.shouldDisplay

I don't know what this is for. Have a look at the link at the bottom, the implementation should help you figure out the exact behaviour.

gContextMenu.initMenu( xulMenu )

Use the parameter xulMenu as new context menu.

Source:
http://www.koders.com/javascript/fidCF90560822BBAC49CF500EEC09210B336E08A656.aspx?s=menu#L42