I'm developing an extension for Firefox browsers, so the need arose to control the action button so that it is inactive until the user enters a certain page.
For example, I'll use the link page as an example. Well, I would like the button to be active only when it is with the active tab and with that page open.
Here is my code:
var data = require("sdk/self").data;
// o painel que será exibido
var panel = require("sdk/panel").Panel({
contentURL: data.url("painel.html")
});
// as configurações do botão de ação
var actionBtn = require("sdk/ui/button/action").ActionButton({
id: "ID do botão",
label: "Descrição do botão",
icon: {
"16": "./logo-16.png",
"36": "./logo-36.png"
},
onClick : openPanel
});
// função que exibe o painel quando o botão de ação é clicado.
function openPanel(){
panel.show();
}
So far I have the normal code, only to open the panel when the user clicks on it. How can I make this control on / off?