dynamic context menu extension? - Mozilla

This is a discussion on dynamic context menu extension? - Mozilla ; Hi. I'm new here. I need to create an app that adds a bunch of menu items to the context menu. Easy enough. But! I need only a subset of the additional items to be displayed at a given time ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: dynamic context menu extension?

  1. dynamic context menu extension?

    Hi. I'm new here.

    I need to create an app that adds a bunch of menu items to the context
    menu. Easy enough. But! I need only a subset of the additional items
    to be displayed at a given time (based on some message; possibly the
    value of a cookie or the contents of the clipboard).

    There may be several dozen of these menu items, but no more than 10
    would be displayed at one time. They are all known at the time Firefox
    is invoked.

    Would it be possible to have a JavaScript function that would
    selective which menu items should be displayed at the time that the
    right mouse button is clicked?

    TIA,

    Paul M Lieberman
    American Psychological Association


  2. Re: dynamic context menu extension?

    On Sep 16, 7:46 pm, Bloody Viking wrote:
    > Hi. I'm new here.
    >
    > I need to create an app that adds a bunch of menu items to the context
    > menu. Easy enough. But! I need only a subset of the additional items
    > to be displayed at a given time (based on some message; possibly the
    > value of a cookie or the contents of the clipboard).
    >
    > There may be several dozen of these menu items, but no more than 10
    > would be displayed at one time. They are all known at the time Firefox
    > is invoked.
    >
    > Would it be possible to have a JavaScript function that would
    > selective which menu items should be displayed at the time that the
    > right mouse button is clicked?
    >
    > TIA,
    >
    > Paul M Lieberman
    > American Psychological Association


    Yes, look into using the "popupshowing" event for the context menu.
    You can attach it using:
    var menu = document.getElementById("contentAreaContextMenu");
    menu.addEventListener("popupshowing", yourFunc, false);

    then, you can put the code to show/hide or enable/disable menu items
    in a function named "yourFunc" (change the name to suit yourself).


+ Reply to Thread