Add hash routing and Dota 2 logo to relations preview.

- New web/relations/router.js (parseHash/serializeHash/installRouter):
  top tabs, hero + detail sub-tab, item, patch version, tag filters and
  search query all sync to URL (#/heroes/axe/core, ?tags=...&q=...);
  pushState for discrete picks, replaceState for debounced search.
- export_relations_site.py copies router.js so static export deep-links.
- Header shows dota2_logo.png + title, served via /ui-icon/ whitelist.
- fetch_dota2_logo.py fetches the transparent emblem asset.
- Docs: CHANGELOG / README / DESIGN / AGENTS updated.
This commit is contained in:
voson
2026-07-27 13:09:14 +08:00
parent a91789b72f
commit 1d0428b4a3
13 changed files with 10306 additions and 17 deletions
+15
View File
@@ -45,6 +45,21 @@
不再被牵连出滚轮;压缩参数行距使典型技能在高屏零滚轮(无头 Chrome + CDP 实测
`scrollHeight == clientHeight` 验证)。整块宽度上限 1000→1320px、视频 700→820px、
详情列 720→760px。
- 关系预览顶栏左上角新增 Dota 2 logo +「上分帝」标题(`assets/ui_icons/dota2_logo.png`
透明 emblem),经 `/ui-icon/` 路由与静态导出统一分发;窄屏自动隐藏标题或整组标识,
不影响居中分页布局。
- 关系预览新增 **Hash 路由**:顶层标签(英雄 / 物品 / 版本)、选中英雄 + 详情子标签
(技能 / 核心装备 / 被克装备 / 版本变更)、物品页选中物品、版本页选中版本均同步进
URL;英雄页的定位标签筛选与搜索框文本以 query 参数(`?tags=核心,辅助&q=axe`)进
URL。形态如 `#/heroes/axe/core``#/items/black_king_bar``#/patches/7.41`
`#/patches` = 最新版,序列化时省略与最新同名的版本号)。刷新保状态、可分享 /
深度链接、浏览器前进后退还原;搜索框 300ms debounce + `replaceState`(不刷历史栈),
标签筛选用 `replaceState`,其余离散选择用 `pushState`。坏链接(未知英雄 / 物品 /
版本)优雅降级为丢弃该项。新增 `web/relations/router.js``parseHash` /
`serializeHash` / `installRouter`),`app.js``main()` 装载并首屏 `applyUrlToState`
`export_relations_site.py` 静态导出列表补入 `router.js`,静态站点深度链接同样可用
(可部署 GitHub Pages,无需 rewrite)。Hash 路由不命中后端路径,`serve_relations.py`
零改动。
### Fixed