custom-openstreetmap-tile-s.../settings/settings.js

24 lines
601 B
JavaScript
Raw Normal View History

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);