]> git.r.bdr.sh - rbdr/junction/blame_incremental - safari/Junction/Resources/Script.js
Upload state
[rbdr/junction] / safari / Junction / Resources / Script.js
... / ...
CommitLineData
1function show(enabled, useSettingsInsteadOfPreferences) {
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 }
12
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 }
20}
21
22function openPreferences() {
23 webkit.messageHandlers.controller.postMessage("open-preferences");
24}
25
26document
27 .querySelector("button.open-preferences")
28 .addEventListener("click", openPreferences);