0

I'm actually working on a add-on for Firefox, in my index.js, I have a pageMod

pageMod.PageMod({
    include: "*.leclercdrive.fr",
    contentScriptFile: blabla
    }
);

I have also set a Menubutton on the Firefox toolbar:
The MenuButton

What I need to do is when the user clicks on the icon, the add-on is turned off, and when another click is performed, the add-on is turned on, and so on...

Actually, I've tried using:

function click(state, isMenu) {
    if (isMenu) {     //isMenu is if the click is performed on the arrow
        myPanel.show({
        position: button
        });
    } else { //click on the icon
        i++;
        if (i = 3) {
             //i++;
             //change include to "*.leclercdrive.fr"
        } else {
             //change include to "*.notexisting.not"
        }
  }
}

With a var i = 1, first click i=2, include = "*.notexisting", second click i=3, back to "*.leclercdrive.fr", i=1 ...

But I can't get it to work.

Makyen
  • 31,849
  • 12
  • 86
  • 121
  • Please [edit] your question to be on-topic: Questions seeking debugging help ("**why isn't this code working?**") must include: ►the desired behavior, ►a specific problem or error *and* ►the shortest code necessary to reproduce it (a **complete** [mcve]) **in the question itself**. Questions without a clear problem statement are not useful to other readers. See: "**How to create a [mcve]**", [What topics can I ask about here?](http://stackoverflow.com/help/on-topic), and [ask]. Try a [snippet](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/). – Makyen Nov 17 '16 at 17:28
  • The reason that a [mcve] is required is that *we want to help*. It is **much** easier to help if we don't have to recreate all the code needed to duplicate the problem. This is code that you already have. So, please help us to help you and provide a *complete* [mcve] that duplicates the problem with such questions. Without a [mcve] the amount of effort required to even begin to help you is **much** higher which *significantly* reduces the number of people willing/able to help you. Even if we put out the extra effort, we have to *guess* at significant portions of what your problem might be. – Makyen Nov 17 '16 at 17:28

0 Answers0