-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice_worker.js
More file actions
41 lines (36 loc) · 957 Bytes
/
Copy pathservice_worker.js
File metadata and controls
41 lines (36 loc) · 957 Bytes
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
// Callback on browser startup
browser.runtime.onStartup.addListener(get);
browser.runtime.onInstalled.addListener(get);
// Initial settings check for status icon setup
function get() {
let getting = browser.proxy.settings.get({});
getting.then((got) => {
if (got.value.proxyType == "system") {
icoOff();
} else if (got.value.proxyType == "manual") {
icoOn();
}
});
}
// Set icons to enabled state
function icoOn() {
browser.action.setIcon({path:iconsOn});
}
// Set icons to disabled state
function icoOff() {
browser.action.setIcon({path:iconsOff});
}
// Icons path object for enabled state
const iconsOn = {
"16":"images/on/icon-16.png",
"32":"images/on/icon-32.png",
"48":"images/on/icon-48.png",
"128":"images/on/icon-128.png"
}
// Icons path object for disabled state
const iconsOff = {
"16":"images/icon-16.png",
"32":"images/icon-32.png",
"48":"images/icon-48.png",
"128":"images/icon-128.png"
}