diff --git a/docs/QUICK_REF.md b/docs/QUICK_REF.md index 1850c09..96efa16 100644 --- a/docs/QUICK_REF.md +++ b/docs/QUICK_REF.md @@ -7,7 +7,7 @@ ## 版本速查 ### 当前版本 -`0.2.10` → 下一目标 `0.2.11` ([M3.11](./M3.md)) +`0.2.11` → 下一目标 `0.3.1` ([M4.1](./M4.md)) ### 模块版本范围 diff --git a/docs/README.md b/docs/README.md index 04ff81e..6c03400 100644 --- a/docs/README.md +++ b/docs/README.md @@ -65,9 +65,9 @@ M11.10完成 → 1.0.0 (正式发布) ## 当前状态 -**当前版本**: `0.2.10` -**当前进度**: 24/97 (25%) -**下一任务**: [M3.11 词典图标标识](./M3.md#m311-词典图标标识--目标版本-0211) +**当前版本**: `0.2.11` +**当前进度**: 25/97 (26%) +**下一任务**: [M4.1 Popup基础界面](./M4.md#m41-popup基础界面--目标版本-031) --- diff --git a/docs/VERSION.md b/docs/VERSION.md index fc19b0c..ed6241c 100644 --- a/docs/VERSION.md +++ b/docs/VERSION.md @@ -46,7 +46,7 @@ | M3.8 | 0.2.8 | 加载状态显示 | ✅ | 2026-02-11 | | M3.9 | 0.2.9 | 有道词典实现 | ✅ | 2026-02-11 | | M3.10 | 0.2.10 | 结果折叠/展开 | ✅ | 2026-02-11 | -| M3.11 | 0.2.11 | 词典图标标识 | ⬜ | - | +| M3.11 | 0.2.11 | 词典图标标识 | ✅ | 2026-02-11 | --- diff --git a/manifest.json b/manifest.json index d697aad..658d9d5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "沙拉查词", - "version": "0.2.10", + "version": "0.2.11", "description": "聚合词典划词翻译", "permissions": [ "storage", diff --git a/package.json b/package.json index 741cc96..991f256 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salad-dict", - "version": "0.2.10", + "version": "0.2.11", "description": "聚合词典划词翻译", "private": true, "type": "module", diff --git a/src/content/components/DictPanel.js b/src/content/components/DictPanel.js index 4358cdf..ce16260 100644 --- a/src/content/components/DictPanel.js +++ b/src/content/components/DictPanel.js @@ -200,13 +200,39 @@ export class DictPanel { } .dict-toggle { - font-size: 12px; - margin-right: 8px; + font-size: 10px; + margin-right: 6px; color: #666; width: 12px; text-align: center; } + .dict-icon { + width: 16px; + height: 16px; + border-radius: 3px; + margin-right: 8px; + display: flex; + align-items: center; + justify-content: center; + font-size: 10px; + font-weight: bold; + color: white; + flex-shrink: 0; + } + + .dict-icon.bing { + background: #00809d; + } + + .dict-icon.youdao { + background: #e93a2b; + } + + .dict-icon.default { + background: #999; + } + .dict-name { font-size: 13px; font-weight: 600; @@ -425,6 +451,32 @@ export class DictPanel { this._setContent(html); } + /** + * 获取词典图标类名 + * @private + * @param {string} dictName - 词典名称 + * @returns {string} 图标类名 + */ + _getDictIconClass(dictName) { + const name = dictName.toLowerCase(); + if (name.includes('必应') || name.includes('bing')) return 'bing'; + if (name.includes('有道') || name.includes('youdao')) return 'youdao'; + return 'default'; + } + + /** + * 获取词典图标文字 + * @private + * @param {string} dictName - 词典名称 + * @returns {string} 图标文字 + */ + _getDictIconText(dictName) { + const name = dictName.toLowerCase(); + if (name.includes('必应') || name.includes('bing')) return 'B'; + if (name.includes('有道') || name.includes('youdao')) return 'Y'; + return dictName.charAt(0).toUpperCase(); + } + /** * 渲染单个词典区块 * @private @@ -438,10 +490,14 @@ export class DictPanel { const toggleIcon = isCollapsed ? '▶' : '▼'; const contentClass = isCollapsed ? 'dict-content collapsed' : 'dict-content'; + const iconClass = this._getDictIconClass(dictName); + const iconText = this._getDictIconText(dictName); + return `
${toggleIcon} +
${iconText}
${this._escapeHtml(dictName)}