-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackground.js
30 lines (26 loc) · 868 Bytes
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Licència del codi i bla bla bla
function iconaDeshabilitada() {
chrome.browserAction.setIcon({path:"iconaDeshabilitada.png"});
} //fFuncio iconaDeshabilitada
function iconaHabilitada() {
chrome.browserAction.setIcon({path:"iconaHabilitada.png"});
} //fFuncio iconaHabilitada
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.sendMessage(tab.id, "ESTAS", function(resposta) {
if (resposta == undefined) {
chrome.tabs.executeScript(tab.id, {file: 'jquery.min.js', allFrames: true});
chrome.tabs.executeScript(tab.id, {file: 'content.js', allFrames: true});
} //fSi
iconaHabilitada();
});
});
chrome.tabs.onActivated.addListener(function(info) {
chrome.tabs.sendMessage(info.tabId, "ESTAS", function(resposta) {
if (resposta == undefined) {
iconaDeshabilitada();
}
else {
iconaHabilitada();
} //fSi
});
});