parent
4edb0331a1
commit
8791ed4e5e
5 changed files with 54 additions and 3 deletions
@ -0,0 +1,19 @@ |
||||
import './settings.scss'; |
||||
|
||||
let form = document.getElementById('vimvixen-settings-form'); |
||||
|
||||
form.addEventListener('submit', (e) => { |
||||
let value = { |
||||
json: e.target.elements['plain-json'].value |
||||
}; |
||||
e.preventDefault(); |
||||
browser.storage.local.set(value); |
||||
}); |
||||
|
||||
document.addEventListener('DOMContentLoaded', () => { |
||||
browser.storage.local.get().then((value) => { |
||||
if (value.json) { |
||||
form.elements['plain-json'].value = value.json; |
||||
} |
||||
}, console.error); |
||||
}); |
@ -0,0 +1,15 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset='utf-8'> |
||||
</head> |
||||
<body> |
||||
<form id='vimvixen-settings-form' class='vimvixen-settings-form'> |
||||
<label for='plain-json'>Settings by plain json: </label> |
||||
<textarea |
||||
name='plain-json'></textarea> |
||||
<button type='submit'>Save</button> |
||||
</form> |
||||
<script src='settings.js'></script> |
||||
</body> |
||||
</html> |
@ -0,0 +1,7 @@ |
||||
.vimvixen-settings-form { |
||||
textarea[name=plain-json] { |
||||
font-family: monospace; |
||||
width: 100%; |
||||
resize: vertical; |
||||
} |
||||
} |
Reference in new issue