1
I am developing an extension for Firefox browsers, soon arose the need to control the action button so that it is inactive until the user enters a particular page.
Exemplifying, I will use as an example the page "/". Well, I would like the button to be active only when the tab is active and this page is open.
Just follow 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?
You can disable a button by setting the disabled property to true
– Tony
yes, I saw this in the documentation. But the question is: how to make it disabled on the other pages that does not matter my extension? I want the button to be active only at a specific URL.
– Renan Gomes