aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2017-06-11 11:15:44 +0200
committerRahiel Kasim <rahielkasim@gmail.com>2017-06-11 11:15:44 +0200
commitcd9b5129ec243c7e30d37e2e49586aff2a8f6a02 (patch)
treef0525d87db485ad17d236ba6b3d1e2b4d9b5aebc
parent0aadf3f04c0ed419808ab5f8a1216081e1c6c2c1 (diff)
automatically save options after every change
-rw-r--r--package.json4
-rw-r--r--src/options.html13
-rw-r--r--src/options.js20
3 files changed, 12 insertions, 25 deletions
diff --git a/package.json b/package.json
index 015a4ec..760c7fc 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint . --ignore-path .gitignore && web-ext lint -s ./dist",
"build": "webpack --optimize-minimize",
- "firefox": "web-ext run -s ./dist --verbose",
+ "firefox": "web-ext run -s ./dist -f /usr/bin/firefox --verbose",
"start": "webpack --watch"
},
"repository": {
@@ -23,7 +23,7 @@
"eslint": "^3.19.0",
"source-map-loader": "^0.2.1",
"web-ext": "^1.9.1",
- "webpack": "^2.5.0"
+ "webpack": "^2.6.1"
},
"babel": {
"presets": [
diff --git a/src/options.html b/src/options.html
index 468883c..65c8891 100644
--- a/src/options.html
+++ b/src/options.html
@@ -4,7 +4,7 @@
<title>Archiveror Options</title>
<style type="text/css">
body {padding: 10px; line-height: 1.6; font-size: 14px}
- input[type="radio"] {margin-right: 5px}
+ input[type="checkbox"], input[type="radio"] {margin-right: 10px}
</style>
</head>
<body>
@@ -67,17 +67,6 @@
</label>
</div>
- <table>
- <tr>
- <td>
- <button id="save">Save</button>
- </td>
- <td>
- <b><div id="status" style="color:#3fba66"></div></b>
- </td>
- </tr>
- </table>
-
<script src="options.js"></script>
</body>
</html>
diff --git a/src/options.js b/src/options.js
index 2ac70f1..548ed09 100644
--- a/src/options.js
+++ b/src/options.js
@@ -25,8 +25,6 @@ function save_options() {
chrome.storage.local.set({
archiveMode: mode, archiveDir: dir, archiveBookmarks: bookmarks, archiveServices: services,
email: email
- }, function () {
- message("Options saved.");
});
}
@@ -56,10 +54,18 @@ function restore_options() {
}
}
document.addEventListener("DOMContentLoaded", restore_options);
-document.getElementById("save").addEventListener("click", save_options);
document.getElementById("local").addEventListener("click", show_local);
document.getElementById("online").addEventListener("click", show_local);
+let inputs = document.querySelectorAll(`input[type="checkbox"], input[type="radio"]`);
+for (let input of inputs) {
+ input.addEventListener("change", save_options);
+}
+let textInputs = document.querySelectorAll(`input[type="text"]`);
+for (let input of textInputs) {
+ input.addEventListener("input", save_options);
+}
+
function show_local() {
let local = document.getElementById("local").checked;
if (local === true)
@@ -68,14 +74,6 @@ function show_local() {
document.getElementById("local_options").style.display = "none";
}
-function message(text) {
- let status = document.getElementById("status");
- status.textContent = text;
- window.setTimeout(function () {
- status.textContent = "";
- }, 3000);
-}
-
if (!hasPageCapture) {
let div = document.getElementById("archivingMode");
div.style.display = "none";