WebExtension as alternative to Chromecast
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
705 B

7 years ago
  1. function saveOptions(e) {
  2. e.preventDefault();
  3. browser.storage.local.set({
  4. "muffcast": {
  5. "url": document.querySelector("#muffcast-url").value,
  6. "syncInterval": document.querySelector("#muffcast-sync-interval").value
  7. }
  8. });
  9. }
  10. function restoreOptions() {
  11. browser.storage.local.get("muffcast").then(function(result) {
  12. document.querySelector("#muffcast-url").value = result.muffcast && result.muffcast.url || "http://localhost:8128";
  13. document.querySelector("#muffcast-sync-interval").value = result.muffcast && result.muffcast.syncInterval || 30000;
  14. });
  15. }
  16. document.addEventListener("DOMContentLoaded", restoreOptions);
  17. document.querySelector("form").addEventListener("submit", saveOptions);