开发者

How to change behavior of items in Firefox context menu

开发者 https://www.devze.com 2022-12-23 10:59 出处:网络
I\'m trying to change the behavior of <popup id=\"placesContext\"> in placesOverlay.开发者_开发百科xul. My goal is to disable the Properties entry upon conditions that I need to figure out using

I'm trying to change the behavior of <popup id="placesContext"> in placesOverlay.开发者_开发百科xul. My goal is to disable the Properties entry upon conditions that I need to figure out using Javascript.

I am new to XBL bindings and handlers and don't know how to register such a handler for an existing/browser-defined XUL element. Or is there a simpler way?

Thanks.


The best way is to add a event listener for "popupshowing" events on the popup that contains the option you want to disable. It will be called just before the pop up shows and at that point you can do whatever checks you want to do and disable or enable to menuitem.

There is more information here: https://developer-stage.mozilla.org/en/XUL/PopupGuide/ContextMenus#Hiding_and_Showing_Menu_Items_based_on_Context

0

精彩评论

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