aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/dictionaries.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-23 22:54:06 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-07 14:34:35 -0500
commit1a0a345ae745781b6fb1d066df334b641a9cc00b (patch)
tree8cee5018387e53ef698ebb8221d3124ef0bb03cd /ext/bg/js/settings/dictionaries.js
parent16593408981d59e1bd3ad4de14071f45a8116d81 (diff)
Make reverse reading/expressions optional during database import
Diffstat (limited to 'ext/bg/js/settings/dictionaries.js')
-rw-r--r--ext/bg/js/settings/dictionaries.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js
index 065a8abc..926b05b7 100644
--- a/ext/bg/js/settings/dictionaries.js
+++ b/ext/bg/js/settings/dictionaries.js
@@ -356,6 +356,7 @@ async function dictSettingsInitialize() {
document.querySelector('#dict-file-button').addEventListener('click', (e) => onDictionaryImportButtonClick(e), false);
document.querySelector('#dict-file').addEventListener('change', (e) => onDictionaryImport(e), false);
document.querySelector('#dict-main').addEventListener('change', (e) => onDictionaryMainChanged(e), false);
+ document.querySelector('#database-enable-prefix-wildcard-searches').addEventListener('change', (e) => onDatabaseEnablePrefixWildcardSearchesChanged(e), false);
const optionsContext = getOptionsContext();
const options = await apiOptionsGet(optionsContext);
@@ -366,6 +367,9 @@ async function dictSettingsInitialize() {
async function onDictionaryOptionsChanged(options) {
if (dictionaryUI === null) { return; }
dictionaryUI.setOptionsDictionaries(options.dictionaries);
+
+ const optionsFull = await apiOptionsGetFull();
+ document.querySelector('#database-enable-prefix-wildcard-searches').checked = optionsFull.global.database.prefixWildcardsSupported;
}
async function onDatabaseUpdated(options) {
@@ -575,6 +579,12 @@ async function onDictionaryImport(e) {
const exceptions = [];
const files = [...e.target.files];
+ const optionsFull = await apiOptionsGetFull();
+
+ const importDetails = {
+ prefixWildcardsSupported: optionsFull.global.database.prefixWildcardsSupported
+ };
+
for (let i = 0, ii = files.length; i < ii; ++i) {
setProgress(0.0);
if (ii > 1) {
@@ -582,7 +592,7 @@ async function onDictionaryImport(e) {
dictImportInfo.textContent = `(${i + 1} of ${ii})`;
}
- const summary = await utilDatabaseImport(files[i], updateProgress, exceptions);
+ const summary = await utilDatabaseImport(files[i], updateProgress, exceptions, importDetails);
for (const options of toIterable(await getOptionsArray())) {
const dictionaryOptions = SettingsDictionaryListUI.createDictionaryOptions();
dictionaryOptions.enabled = true;
@@ -616,3 +626,12 @@ async function onDictionaryImport(e) {
dictProgress.hide();
}
}
+
+
+async function onDatabaseEnablePrefixWildcardSearchesChanged(e) {
+ const optionsFull = await apiOptionsGetFull();
+ const v = !!e.target.checked;
+ if (optionsFull.global.database.prefixWildcardsSupported === v) { return; }
+ optionsFull.global.database.prefixWildcardsSupported = !!e.target.checked;
+ await settingsSaveOptions();
+}