aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bg/css/settings.css2
-rw-r--r--ext/bg/js/settings-dictionaries.js17
-rw-r--r--ext/bg/settings.html6
3 files changed, 14 insertions, 11 deletions
diff --git a/ext/bg/css/settings.css b/ext/bg/css/settings.css
index 1036622d..102d53de 100644
--- a/ext/bg/css/settings.css
+++ b/ext/bg/css/settings.css
@@ -18,7 +18,7 @@
#anki-spinner, #anki-error,
-#dict-spinner, #dict-error, #dict-warning, #dict-purge, #dict-import-progress,
+#dict-spinner, #dict-import-progress,
.storage-hidden, #storage-spinner {
display: none;
}
diff --git a/ext/bg/js/settings-dictionaries.js b/ext/bg/js/settings-dictionaries.js
index 72a27475..2f33d1ac 100644
--- a/ext/bg/js/settings-dictionaries.js
+++ b/ext/bg/js/settings-dictionaries.js
@@ -270,6 +270,8 @@ async function onDatabaseUpdated(options) {
const dictionaries = await utilDatabaseGetDictionaryInfo();
dictionaryUI.setDictionaries(dictionaries);
+ document.querySelector('#dict-warning').hidden = (dictionaries.length > 0);
+
updateMainDictionarySelect(options, dictionaries);
const {counts, total} = await utilDatabaseGetDictionaryCounts(dictionaries.map(v => v.title), true);
@@ -353,8 +355,8 @@ dictionaryErrorToString.overrides = [
];
function dictionaryErrorsShow(errors) {
- const dialog = $('#dict-error');
- dialog.show().text('');
+ const dialog = document.querySelector('#dict-error');
+ dialog.textContent = '';
if (errors !== null && errors.length > 0) {
const uniqueErrors = {};
@@ -375,12 +377,12 @@ function dictionaryErrorsShow(errors) {
} else {
div.textContent = `${e}`;
}
- dialog.append($(div));
+ dialog.appendChild(div);
}
- dialog.show();
+ dialog.hidden = false;
} else {
- dialog.hide();
+ dialog.hidden = true;
}
}
@@ -410,7 +412,8 @@ async function onDictionaryPurge(e) {
$('#dict-purge-modal').modal('hide');
const dictControls = $('#dict-importer, #dict-groups, #dict-groups-extra, #dict-main-group').hide();
- const dictProgress = $('#dict-purge').show();
+ const dictProgress = document.querySelector('#dict-purge');
+ dictProgress.hidden = false;
try {
dictionaryErrorsShow(null);
@@ -432,7 +435,7 @@ async function onDictionaryPurge(e) {
dictionarySpinnerShow(false);
dictControls.show();
- dictProgress.hide();
+ dictProgress.hidden = true;
if (storageEstimate.mostRecent !== null) {
storageUpdateStats();
diff --git a/ext/bg/settings.html b/ext/bg/settings.html
index fb39e5c3..4fc20d77 100644
--- a/ext/bg/settings.html
+++ b/ext/bg/settings.html
@@ -426,9 +426,9 @@
<select class="form-control" id="dict-main"></select>
</div>
- <div class="text-danger" id="dict-purge">Dictionary data is being purged, please be patient...</div>
- <div class="alert alert-warning" id="dict-warning">No dictionaries have been installed</div>
- <div class="alert alert-danger" id="dict-error"></div>
+ <div class="text-danger" id="dict-purge" hidden>Dictionary data is being purged, please be patient...</div>
+ <div class="alert alert-warning" id="dict-warning" hidden>No dictionaries have been installed</div>
+ <div class="alert alert-danger" id="dict-error" hidden></div>
<div id="dict-groups"></div>
<div id="dict-groups-extra"></div>