Add custom world info filter mode

This commit is contained in:
Hao19911125
2026-04-06 23:02:04 +08:00
parent d9c5d39c72
commit 78cd92f707
8 changed files with 1249 additions and 21 deletions

View File

@@ -1983,6 +1983,21 @@ function _refreshConfigTab() {
"bme-setting-notice-display-mode",
settings.noticeDisplayMode ?? "normal",
);
_setInputValue(
"bme-setting-wi-filter-mode",
settings.worldInfoFilterMode || "default",
);
_setInputValue(
"bme-setting-wi-filter-keywords",
settings.worldInfoFilterCustomKeywords || "",
);
const wiFilterCustomSection = panelEl?.querySelector(
"#bme-wi-filter-custom-section",
);
if (wiFilterCustomSection) {
wiFilterCustomSection.style.display =
(settings.worldInfoFilterMode || "default") === "custom" ? "" : "none";
}
_setInputValue("bme-setting-extract-every", settings.extractEvery ?? 1);
_setInputValue(
@@ -2337,6 +2352,29 @@ function _bindConfigControls() {
});
noticeDisplayModeEl.dataset.bmeBound = "true";
}
const wiFilterModeEl = document.getElementById("bme-setting-wi-filter-mode");
if (wiFilterModeEl && wiFilterModeEl.dataset.bmeBound !== "true") {
wiFilterModeEl.addEventListener("change", () => {
const nextValue = wiFilterModeEl.value || "default";
_patchSettings({ worldInfoFilterMode: nextValue });
const section = panelEl?.querySelector("#bme-wi-filter-custom-section");
if (section) {
section.style.display = nextValue === "custom" ? "" : "none";
}
});
wiFilterModeEl.dataset.bmeBound = "true";
}
const wiFilterKeywordsEl = document.getElementById(
"bme-setting-wi-filter-keywords",
);
if (wiFilterKeywordsEl && wiFilterKeywordsEl.dataset.bmeBound !== "true") {
wiFilterKeywordsEl.addEventListener("change", () => {
_patchSettings({
worldInfoFilterCustomKeywords: wiFilterKeywordsEl.value || "",
});
});
wiFilterKeywordsEl.dataset.bmeBound = "true";
}
bindNumber("bme-setting-extract-every", 1, 1, 50, (value) =>
_patchSettings({ extractEvery: value }),