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() {
updateVisibility();
const opts = formToOptions();
saveOptions(opts, () => {
chrome.extension.getBackgroundPage().yomichan.setOptions(opts);
@ -44,6 +53,7 @@ function onOptionsChanged() {
$(document).ready(() => {
loadOptions((opts) => {
updateVisibility();
optionsToForm(opts);
$('input').on('input paste change', onOptionsChanged);
});