aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-07 14:02:54 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-07 14:02:54 -0700
commitc620b4ba363c3b5ed603575e9179be3f1c1e2c03 (patch)
treeb77627eb38bb924b77aca37803f4456341476e91 /ext/bg/js/options-form.js
parent9b9985bd4ba810d5a4e985100c68c544df9bccaf (diff)
Simplify options page
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index dbeb5fe8..eb9d2f53 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -33,23 +33,16 @@ function formToOptions() {
});
}
-$('#saveOptions').click(() => {
+function onOptionsChanged() {
const opts = formToOptions();
saveOptions(opts, () => {
- $('.notifyAlerts').hide();
- $('#notifySave').slideDown();
chrome.extension.getBackgroundPage().yomichan.setOptions(opts);
});
-});
-
-$('#resetOptions').click(() => {
- optionsToForm(sanitizeOptions({}));
- $('.notifyAlerts').hide();
- $('#notifyReset').slideDown();
-});
+}
-$('[data-hide]').on('click', function() {
- $('#' + $(this).attr('data-hide')).hide();
+$(document).ready(() => {
+ loadOptions((opts) => {
+ optionsToForm(opts);
+ $('input').on('input paste change', onOptionsChanged);
+ });
});
-
-$(document).ready(() => loadOptions((opts) => optionsToForm(opts)));