feat(search): 前端图标搜索支持源中文名(圣诞/毛绒/动漫等风格词);基线更新至443168/262

This commit is contained in:
sgp
2026-11-05 01:22:12 +08:00
parent d785d5d503
commit bc9c8e8bba
8 changed files with 22 additions and 16 deletions
+7 -1
View File
@@ -8,7 +8,7 @@
const HGB_IconLib = (function () {
'use strict';
const VERSION = '20261105b'; // 与 index.html 中 builtin-icons.js?v= 版本联动
const VERSION = '20261105c'; // 与 index.html 中 builtin-icons.js?v= 版本联动
const cache = {}; // sid -> {icons:[...]}
const pending = {}; // sid -> Promise
@@ -160,9 +160,15 @@ const HGB_IconLib = (function () {
for (var _i = 0; _i < sids.length; _i++) {
var sid = sids[_i];
var list = cache[sid].icons || [];
// 源级中文名匹配(如「圣诞」→ withicons-christmas 全部图标)
var meta = (typeof HGB_BuiltinIcons !== 'undefined' && HGB_BuiltinIcons.sources &&
HGB_BuiltinIcons.sources[sid]) || null;
var srcHit = !!(q && meta &&
((meta.name || '') + ' ' + (meta.nameCn || '')).toLowerCase().indexOf(q) !== -1);
for (var j = 0; j < list.length; j++) {
var ic = list[j];
var sc = scoreIcon(ic, q, roots);
if (sc < 0 && srcHit) sc = 250;
if (sc >= 0) {
hits.push({
sc: sc,