2020-07-03 20:54:27 +02:00
|
|
|
function saveOptions(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
browser.storage.local.set({
|
|
|
|
tileserver: document.querySelector("#tileserver").value
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function restoreOptions() {
|
|
|
|
|
|
|
|
function setCurrentChoice(result) {
|
2020-07-03 21:08:10 +02:00
|
|
|
document.querySelector("#tileserver").value = result.tileserver || "";
|
2020-07-03 20:54:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onError(error) {
|
|
|
|
console.log(`Error: ${error}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
var getting = browser.storage.local.get("tileserver");
|
|
|
|
getting.then(setCurrentChoice, onError);
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", restoreOptions);
|
|
|
|
document.querySelector("form").addEventListener("submit", saveOptions);
|