bug fixes

This commit is contained in:
undefined committed 2025-10-23 17:57:29 +08:00
1 parent d0944bdde9
commit 2f2e006eff
10 files changed
+56 -65

No files matched your search

@@ -15,11 +15,12 @@ import {
addSpeculationRules, delay, i18n, pjax, request,
} from 'vj/utils';
const keywords = ['category', 'difficulty', 'namespace'];
const list = [];
const filterTags = {};
const pinned: Record<string, string[]> = { category: [], difficulty: [], namespace: [] };
const selections = { category: {}, difficulty: {}, namespace: {} };
const selectedTags: Record<string, string[]> = { category: [], difficulty: [], namespace: [] };
const pinned: Record<string, string[]> = Object.fromEntries(keywords.map((keyword) => [keyword, []]));
const selections = Object.fromEntries(keywords.map((keyword) => [keyword, {}]));
const selectedTags: Record<string, string[]> = Object.fromEntries(keywords.map((keyword) => [keyword, []]));
let selectedPids: string[] = [];
let clearSelectionHandler: (() => void) | null = null;
@@ -35,7 +36,7 @@ function setDomSelected($dom, selected, icon?) {
}
const parserOptions = {
keywords: ['category', 'difficulty', 'namespace'],
keywords,
offsets: true,
alwaysArray: true,
tokenize: true,
@@ -46,8 +47,7 @@ function writeSelectionToInput() {
const parsedCurrentValue = parser.parse(currentValue, parserOptions) as SearchParserResult;
const q = parser.stringify({
...parsedCurrentValue,
category: selectedTags.category,
difficulty: selectedTags.difficulty,
...keywords.reduce((acc, keyword) => ({ ...acc, [keyword]: selectedTags[keyword] }), {}),
text: parsedCurrentValue.text,
}, parserOptions);
$('[name="q"]').val(q);