diff --git a/avatar.html b/avatar.html index 1cf6116..cde5450 100644 --- a/avatar.html +++ b/avatar.html @@ -333,7 +333,7 @@ - + diff --git a/index.html b/index.html index 039bc9c..840bf96 100644 --- a/index.html +++ b/index.html @@ -335,7 +335,7 @@ - + diff --git a/js/ui/panels.js b/js/ui/panels.js index 30e22b7..533935d 100644 --- a/js/ui/panels.js +++ b/js/ui/panels.js @@ -619,9 +619,15 @@ const HGB_UI = (function () { if (!HGB_IconLib.scoreIcon) { return list.filter(i => i.name.toLowerCase().includes(ql) || i.id.toLowerCase().includes(ql)); } + // 当前源中文名也可命中(如源「圣诞图标」内搜「圣诞」) + const meta = (typeof HGB_BuiltinIcons !== 'undefined' && HGB_BuiltinIcons.sources && + HGB_BuiltinIcons.sources[builtinState.source]) || null; + const srcText = meta ? ((meta.name || '') + ' ' + (meta.nameCn || '')).toLowerCase() : ''; + const srcHit = ql && srcText.indexOf(ql) !== -1; const scored = []; for (const i of list) { - const sc = HGB_IconLib.scoreIcon(i, ql, roots); + let sc = HGB_IconLib.scoreIcon(i, ql, roots); + if (sc < 0 && srcHit) sc = 250; if (sc >= 0) scored.push({ i, sc }); } scored.sort((a, b) => a.sc - b.sc);