WIP
This commit is contained in:
parent
0e6c9d70f6
commit
c2532a9fd0
@ -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);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user