29 lines
767 B
JavaScript
29 lines
767 B
JavaScript
function onError(error) {
|
|
console.log('UrlToJD2_options_error: ' + error);
|
|
}
|
|
|
|
// autostart
|
|
var chck_autostart = document.getElementById("autostart");
|
|
|
|
|
|
chck_autostart.onchange = function () {
|
|
if (chck_autostart.checked) {
|
|
browser.storage.local.set({ autostart: true });
|
|
} else {
|
|
browser.storage.local.set({ autostart: false });
|
|
}
|
|
}
|
|
|
|
|
|
// Update the options UI or default setting
|
|
function updateUI(restoredSettings) {
|
|
if (restoredSettings.autostart == undefined) {
|
|
chck_autostart.checked = true; //default
|
|
} else {
|
|
chck_autostart.checked = restoredSettings.autostart;
|
|
}
|
|
}
|
|
|
|
// On opening the options page
|
|
const gettingStoredSettings = browser.storage.local.get();
|
|
gettingStoredSettings.then(updateUI, onError); |