diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/options-form.js | 21 | ||||
-rw-r--r-- | ext/bg/options.html | 24 |
2 files changed, 7 insertions, 38 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))); 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 @@ <title>Yomichan Options</title> <link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css"> - <style type="text/css"> - .notifyAlerts { - display: none; - } - </style> </head> <body> <div class="container"> @@ -46,25 +41,6 @@ </div> </div> </div> - - <div class="alert alert-success notifyAlerts" id="notifySave"> - Preferences saved - <button type="button" class="close" data-hide="notifySave"> - <span aria-hidden="true">×</span> - </button> - </div> - - <div class="alert alert-warning notifyAlerts" id="notifyReset"> - Preferences reset to defaults - <button type="button" class="close" data-hide="notifyReset"> - <span aria-hidden="true">×</span> - </button> - </div> - - <div class="text-right"> - <button type="button" id="saveOptions" class="btn btn-default">Save</button> - <button type="button" id="resetOptions" class="btn btn-danger">Reset</button> - </div> </form> <script src="../lib/jquery-2.2.2.min.js"></script> |