1 function show(enabled
, useSettingsInsteadOfPreferences
) {
2 if (useSettingsInsteadOfPreferences
) {
3 document
.getElementsByClassName('state-on')[0].innerText
= "Junction’s extension is currently on. You can turn it off in the Extensions section of Safari Settings.";
4 document
.getElementsByClassName('state-off')[0].innerText
= "Junction’s extension is currently off. You can turn it on in the Extensions section of Safari Settings.";
5 document
.getElementsByClassName('state-unknown')[0].innerText
= "You can turn on Junction’s extension in the Extensions section of Safari Settings.";
6 document
.getElementsByClassName('open-preferences')[0].innerText
= "Quit and Open Safari Settings…";
9 if (typeof enabled
=== "boolean") {
10 document
.body
.classList
.toggle(`state-on`, enabled
);
11 document
.body
.classList
.toggle(`state-off`, !enabled
);
13 document
.body
.classList
.remove(`state-on`);
14 document
.body
.classList
.remove(`state-off`);
18 function openPreferences() {
19 webkit
.messageHandlers
.controller
.postMessage("open-preferences");
22 document
.querySelector("button.open-preferences").addEventListener("click", openPreferences
);