-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
44 lines (33 loc) · 1.15 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
(function () {
var leapify = {
toggleOnOff: (function () {
var activated = false;
var refreshTab = function () {
chrome.tabs.getSelected(null, function (tab) {
chrome.tabs.sendMessage(tab.id, {refresh:true});
});
};
var toggleOnOff = function () {
if (activated) {
activated = false;
// chrome.browserAction.setIcon({path:"icon_off.png"});
} else {
activated = true;
// chrome.browserAction.setIcon({path:"icon_on.png"});
}
refreshTab();
};
chrome.extension.onMessage.addListener(
function (request, sender, sendResponse) {
if (request.checkActivated) {
sendResponse({
isActivated: activated
});
}
}
);
return toggleOnOff;
})()
};
chrome.browserAction.onClicked.addListener(leapify.toggleOnOff);
})();