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.

21 lines
944 B

7 years ago
  1. function saveOptions(e) {
  2. e.preventDefault();
  3. browser.storage.local.set({
  4. "muffcast": {
  5. "unsplashInterval": document.querySelector("#muffcast-unsplash-interval").value,
  6. "unsplashCredit": document.querySelector("#muffcast-unsplash-credit").value,
  7. "unsplashClient": document.querySelector("#muffcast-unsplash-client").value
  8. }
  9. });
  10. }
  11. function restoreOptions() {
  12. browser.storage.local.get("muffcast").then(function(result) {
  13. document.querySelector("#muffcast-unsplash-interval").value = result.muffcast && result.muffcast.unsplashInterval || 8000;
  14. document.querySelector("#muffcast-unsplash-credit").value = result.muffcast && result.muffcast.unsplashCredit || "";
  15. document.querySelector("#muffcast-unsplash-client").value = result.muffcast && result.muffcast.unsplashClient || "";
  16. });
  17. }
  18. document.addEventListener("DOMContentLoaded", restoreOptions);
  19. document.querySelector("form").addEventListener("submit", saveOptions);