]>
Commit | Line | Data |
---|---|---|
4a191e80 | 1 | function show(enabled, useSettingsInsteadOfPreferences) { |
bab26a4d RBR |
2 | if (useSettingsInsteadOfPreferences) { |
3 | document.getElementsByClassName("state-on")[0].innerText = | |
4 | "Junction’s extension is currently on. You can turn it off in the Extensions section of Safari Settings."; | |
5 | document.getElementsByClassName("state-off")[0].innerText = | |
6 | "Junction’s extension is currently off. You can turn it on in the Extensions section of Safari Settings."; | |
7 | document.getElementsByClassName("state-unknown")[0].innerText = | |
8 | "You can turn on Junction’s extension in the Extensions section of Safari Settings."; | |
9 | document.getElementsByClassName("open-preferences")[0].innerText = | |
10 | "Quit and Open Safari Settings…"; | |
11 | } | |
4a191e80 | 12 | |
bab26a4d RBR |
13 | if (typeof enabled === "boolean") { |
14 | document.body.classList.toggle(`state-on`, enabled); | |
15 | document.body.classList.toggle(`state-off`, !enabled); | |
16 | } else { | |
17 | document.body.classList.remove(`state-on`); | |
18 | document.body.classList.remove(`state-off`); | |
19 | } | |
4a191e80 RBR |
20 | } |
21 | ||
22 | function openPreferences() { | |
bab26a4d | 23 | webkit.messageHandlers.controller.postMessage("open-preferences"); |
4a191e80 RBR |
24 | } |
25 | ||
bab26a4d RBR |
26 | document |
27 | .querySelector("button.open-preferences") | |
28 | .addEventListener("click", openPreferences); |