This commit is contained in:
Alex Yatskov 2016-05-21 15:50:59 -07:00
parent 0e6c9d70f6
commit c2532a9fd0

View File

@ -35,7 +35,16 @@ function formToOptions() {
}); });
} }
function updateVisibility() {
if ($('#enableAnkiConnect').prop('checked')) {
$('.options-anki').show();
} else {
$('.options-anki').hide();
}
}
function onOptionsChanged() { function onOptionsChanged() {
updateVisibility();
const opts = formToOptions(); const opts = formToOptions();
saveOptions(opts, () => { saveOptions(opts, () => {
chrome.extension.getBackgroundPage().yomichan.setOptions(opts); chrome.extension.getBackgroundPage().yomichan.setOptions(opts);
@ -44,6 +53,7 @@ function onOptionsChanged() {
$(document).ready(() => { $(document).ready(() => {
loadOptions((opts) => { loadOptions((opts) => {
updateVisibility();
optionsToForm(opts); optionsToForm(opts);
$('input').on('input paste change', onOptionsChanged); $('input').on('input paste change', onOptionsChanged);
}); });