From c620b4ba363c3b5ed603575e9179be3f1c1e2c03 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 7 May 2016 14:02:54 -0700 Subject: Simplify options page --- ext/bg/js/options-form.js | 21 +++++++-------------- ext/bg/options.html | 24 ------------------------ 2 files changed, 7 insertions(+), 38 deletions(-) (limited to 'ext') 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))); diff --git a/ext/bg/options.html b/ext/bg/options.html index 961d11f7..01f29f87 100644 --- a/ext/bg/options.html +++ b/ext/bg/options.html @@ -5,11 +5,6 @@ Yomichan Options -
@@ -46,25 +41,6 @@
- -
- Preferences saved - -
- -
- Preferences reset to defaults - -
- -
- - -
-- cgit v1.2.3