From d5636f90263e15b7f2f30f6f958c5d8c8a2121b1 Mon Sep 17 00:00:00 2001 From: sgmklp <2394501736@qq.com> Date: Mon, 17 Oct 2022 03:47:26 +0800 Subject: [PATCH] also add Tags in extra file without translation --- javascript/tagAutocomplete.js | 22 ++++++++++------------ tags/config.json | 8 +++++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index c7f493f..96336b7 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -520,10 +520,10 @@ onUiUpdate(function () { console.error("Error loading tags file: " + e); return; } - if (acConfig.translation.extraTranslationFile) { + if (acConfig.extra.extraFile) { try { - allTranslations = loadCSV(`file/tags/${acConfig.translation.extraTranslationFile}`); - if (acConfig.simpleExtraTranslationFile) { + allTranslations = loadCSV(`file/tags/${acConfig.extra.extraFile}`); + if (acConfig.onlyTranslationExtraFile) { for (let i = 0; i < allTranslations.length; i++) { if (allTranslations[i][0]) { allTags[i][2] = allTranslations[i][0]; @@ -531,17 +531,15 @@ onUiUpdate(function () { } } else { allTranslations.map(x => { - if (x[2]) { - let i = 0 - for (; i < allTags.length; i++) { - if (x[0] === allTags[i][0] && x[1] === allTags[i][1]) { - allTags[i][2] = x[2]; - } - } - if (i === allTags.length) { - allTags.push(x); + let i = 0 + for (; i < allTags.length; i++) { + if (x[2] && x[0] === allTags[i][0] && x[1] === allTags[i][1]) { + allTags[i][2] = x[2]; } } + if (i === allTags.length) { + allTags.push(x); + } }); } } catch (e) { diff --git a/tags/config.json b/tags/config.json index 8a56dd6..1f1f578 100644 --- a/tags/config.json +++ b/tags/config.json @@ -13,9 +13,11 @@ "showAllResults": false, "translation": { "searchByTranslation": true, - "onlyShowTranslation": false, - "simpleExtraTranslationFile": false, - "extraTranslationFile": "" + "onlyShowTranslation": false + }, + "extra": { + "extraFile": "", + "onlyTranslationExtraFile": false }, "colors": { "danbooru": {