From ae3d8d27d90f3f206106d356d2a58a46eea62114 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 8 Apr 2016 13:33:46 -0700 Subject: [PATCH] Options page improvements --- ext/bg/js/options-form.js | 17 ++++++++++++----- ext/bg/options.html | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) 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))); diff --git a/ext/bg/options.html b/ext/bg/options.html index 25831b38..a3588642 100644 --- a/ext/bg/options.html +++ b/ext/bg/options.html @@ -5,6 +5,11 @@ Here go options +
@@ -34,6 +39,20 @@
+
+ Preferences saved + +
+ +
+ Preferences reset to defaults + +
+