aboutsummaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/index.js19
-rw-r--r--src/settings/settings.html15
-rw-r--r--src/settings/settings.scss7
3 files changed, 41 insertions, 0 deletions
diff --git a/src/settings/index.js b/src/settings/index.js
new file mode 100644
index 0000000..f2bba32
--- /dev/null
+++ b/src/settings/index.js
@@ -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);
+});
diff --git a/src/settings/settings.html b/src/settings/settings.html
new file mode 100644
index 0000000..1719d6c
--- /dev/null
+++ b/src/settings/settings.html
@@ -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>
diff --git a/src/settings/settings.scss b/src/settings/settings.scss
new file mode 100644
index 0000000..5a0f08c
--- /dev/null
+++ b/src/settings/settings.scss
@@ -0,0 +1,7 @@
+.vimvixen-settings-form {
+ textarea[name=plain-json] {
+ font-family: monospace;
+ width: 100%;
+ resize: vertical;
+ }
+}