wext-httpspluschecker/settings/options.js

24 lines
610 B
JavaScript

function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
API: document.querySelector("#API").value
});
}
function restoreOptions() {
function setCurrentChoice(result) {
document.querySelector("#API").value = result.API || "http://httpspluschecker.virtit.fr/?domain=" ;
}
function onError(error) {
console.log(`Error: ${error}`);
}
var getting = browser.storage.local.get("API");
getting.then(setCurrentChoice, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);