通过多次点击按钮调整PageMod的匹配页面

时间:2016-11-17 16:31:42

标签: javascript firefox-addon firefox-addon-sdk

我实际上正在开发Firefox的附加组件,在我的 index.js 中,我有一个pageMod

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

我还在Firefox工具栏上设置了Menubutton:
The MenuButton

我需要做的是当用户点击图标时,加载项已关闭,当执行另一次点击时,加载项会打开,依此类推......

实际上,我尝试过使用:

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"
        }
  }
}

使用var i = 1,首先点击i=2include = "*.notexisting",然后点击i=3,返回"*.leclercdrive.fr"i=1 ... < / p>

但是我无法让它发挥作用。

0 个答案:

没有答案