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

function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
"muffcast": {
"unsplashInterval": document.querySelector("#muffcast-unsplash-interval").value,
"unsplashCredit": document.querySelector("#muffcast-unsplash-credit").value,
"unsplashClient": document.querySelector("#muffcast-unsplash-client").value
}
});
}
function restoreOptions() {
browser.storage.local.get("muffcast").then(function(result) {
document.querySelector("#muffcast-unsplash-interval").value = result.muffcast && result.muffcast.unsplashInterval || 8000;
document.querySelector("#muffcast-unsplash-credit").value = result.muffcast && result.muffcast.unsplashCredit || "";
document.querySelector("#muffcast-unsplash-client").value = result.muffcast && result.muffcast.unsplashClient || "";
});
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);