From ae3d8d27d90f3f206106d356d2a58a46eea62114 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 8 Apr 2016 13:33:46 -0700 Subject: Options page improvements --- ext/bg/js/options-form.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index 7504f74e..bc21793e 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -33,14 +33,21 @@ function formToOptions() { $('#saveOptions').click(() => { const opts = formToOptions(); - const yomichan = chrome.extension.getBackgroundPage().yomichan; - saveOptions(opts, () => yomichan.updateOptions(opts)); + saveOptions(opts, () => { + $('.notifyAlerts').hide(); + $('#notifySave').slideDown(); + chrome.extension.getBackgroundPage().yomichan.updateOptions(opts); + }); }); $('#resetOptions').click(() => { - if (confirm('Reset options to default values?')) { - optionsToForm(sanitizeOptions({})); - } + optionsToForm(sanitizeOptions({})); + $('.notifyAlerts').hide(); + $('#notifyReset').slideDown(); +}); + +$('[data-hide]').on('click', function() { + $('#' + $(this).attr('data-hide')).hide(); }); $(document).ready(() => loadOptions((opts) => optionsToForm(opts))); -- cgit v1.2.3