initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form>
|
||||
<label>Muffcast URL<input type="url" id="muffcast-url" /></label> <br />
|
||||
<label>Muffcast Sync Interval<input type="number" id="muffcast-sync-interval" min="1000" step="1000" /></label> <br />
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
|
||||
<script src="options.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user