This repository has been archived on 2023-12-19. You can view files and clone it, but cannot push or open issues or pull requests.
Muffcast-Client/options/options.js
2017-12-07 18:16:26 +01:00

20 lines
705 B
JavaScript

function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
"muffcast": {
"url": document.querySelector("#muffcast-url").value,
"syncInterval": document.querySelector("#muffcast-sync-interval").value
}
});
}
function restoreOptions() {
browser.storage.local.get("muffcast").then(function(result) {
document.querySelector("#muffcast-url").value = result.muffcast && result.muffcast.url || "http://localhost:8128";
document.querySelector("#muffcast-sync-interval").value = result.muffcast && result.muffcast.syncInterval || 30000;
});
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);