initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form>
|
||||
<label>Unsplash Interval <input type="number" min="2000" step="1000" value="8000" id="muffcast-unsplash-interval" /></label> <br />
|
||||
<label>Unsplash Credit <input type="text" id="muffcast-unsplash-credit" /></label> <br />
|
||||
<label>Unsplash Client Id <input type="text" id="muffcast-unsplash-client" /></label> <br />
|
||||
<button type="submit" class="browser-style">Save</button>
|
||||
</form>
|
||||
|
||||
<script src="options.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user