summaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
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)));