feat(css): 优化英文 bio 文本样式及技术标签颜色配置

- 为英文 bio 文本添加专门的排版样式,包括字体、行高和斜体设置
- 在白天模式下为 .tech-tag 类增加基于 data-theme 的颜色定义
- 将原有的渐变样式限制在夜间模式下应用
- 技术标签颜色方案扩展至 10 种,并区分日夜主题显示效果

fix(js): 设置页面语言属性并调整技术栈索引逻辑

- 页面加载时动态设置 html 根元素的 data-lang 属性值
- 修改技术栈项的 gradientId 计算方式,由名称哈希改为索引取模
- 注释掉旧的哈希计算相关代码以避免干扰
This commit is contained in:
hehh
2025-11-25 00:07:37 +08:00
parent 63407a9216
commit d9433396a0
2 changed files with 114 additions and 13 deletions

View File

@@ -161,6 +161,7 @@ class I18nManager {
apply() {
const t = this.dict[this.lang];
document.documentElement.setAttribute('data-lang', this.lang)
$('[data-i18n]').each(function () {
const k = $(this).data('i18n');
if (t[k]) $(this).text(t[k]);
@@ -661,11 +662,11 @@ class UIManager {
const techStackRaw = window.SiteConfig?.techStack || [];
const techStack = techStackRaw.map((item, idx) => {
const name = item.name || '';
const hash = Array.from(name).reduce((a, c) => a + c.charCodeAt(0), 0);
//const name = item.name || '';
//const hash = Array.from(name).reduce((a, c) => a + c.charCodeAt(0), 0);
const gid = Number(item.gradientId) && Number.isFinite(Number(item.gradientId))
? Math.max(1, Math.min(10, Number(item.gradientId)))
: (hash % 10) + 1;
: (idx % 10) + 1;
return {...item, gradientId: gid};
});