commit 621f648ed622f39fb558e2baf54c99268bb73dc8 Author: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Thu Dec 3 04:20:56 2026 +0800 feat(site): add WTOffline homepage and releases catalog diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a5f6e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +Thumbs.db +Desktop.ini +.DS_Store +.vscode/ +.idea/ +*.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..b114a4e --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# WTOffline Website + +Static bilingual (Simplified Chinese / English) homepage and releases catalog for [WTOffline](https://wto-project.net). + +## Structure + +- `index.html` — Project overview, architecture summary, latest release card, and community links +- `releases.html` — Standalone releases catalog with switchable **Launcher** and **Adaptation Packs** tabs and SHA-256 checksums +- `site/tokens.css`, `site/home.css`, `site/home.js` — Theme tokens (dark/light), animations, bilingual switching, and live release fetching +- `assets/icon.svg`, `assets/wordmark.svg` — Vector brand assets + +## Local Preview + +No build step is required. Open `index.html` directly in any modern browser, or serve the repository root with any static HTTP server. + +## License + +Released under [AGPL-3.0-or-later](https://www.gnu.org/licenses/agpl-3.0.html). diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..83c4436 --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,26 @@ + + WTOffline + Square WTOffline application icon featuring the white winged WT OFFLINE wordmark on a chamfered dark plate. + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/wordmark.svg b/assets/wordmark.svg new file mode 100644 index 0000000..e072935 --- /dev/null +++ b/assets/wordmark.svg @@ -0,0 +1,22 @@ + + WTOffline + WT monogram with wings above the word OFFLINE. + + + + + + + + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..27adc27 --- /dev/null +++ b/index.html @@ -0,0 +1,396 @@ + + + + + + WTOffline · 战争雷霆本地单机离线项目 + + + + + + + + + + + +
+
+ + + +
+ + +
+
+ + + Windows x64 · 本地单机离线 · AGPL-3.0 开源 + Windows x64 · Local Single-Player · AGPL-3.0 Open Source + + +

+ WTOffline +

+ +

+ + WTOffline 是《战争雷霆》Windows 客户端的开源单机离线项目。本地服务器在 + 127.0.0.1 模拟线上服务,客户端照常登录、进机库、研发、改装与匹配 AI 对局—— + 数据全部留在本地,与线上版彻底隔离,不分发任何游戏文件。 + + + WTOffline is an open-source single-player offline project for the Windows client of War Thunder. + A local server emulates online services on 127.0.0.1 so the client signs in, manages + research and crews, and launches AI battles locally—fully isolated from the online game, with zero game files distributed. + +

+ + + +
+ + 127.0.0.1 + 纯本地服务 + Local-only server + + + Ed25519 + 更新与适配包验签 + Signed updates & packs + + + 0 B + 不分发任何原版游戏文件 + Stock game files shipped + +
+
+
+ + +
+
+
CAPABILITIES
+

+ 完整单机循环,按你的节奏游玩 + A Complete Offline Loop, Played Your Way +

+

+ + 从账号存档、科技树研发、乘员改装、本地商店与交易所,到陆空海街机/历史 AI 对局与战后结算, + 客户端按原生逻辑运行,一切规则与数据都在你的掌控之中。 + + + From local accounts, tech-tree progression, crew training, and a local store & marketplace to + Ground, Air, and Naval Arcade/Realistic AI battles—the client runs natively under your control. + +

+ +
+
+ + + + + +

+ 机库、科技树与经济系统 + Hangar, Tech Trees & Economy +

+

+ 各国科技树、隐藏载具、改装研发与挂载预设、乘员专家/王牌、联队研发、补给箱与道具回收,以及内置浏览器直接打开的本地商店与交易所。 + All nations and branches, hidden researchable vehicles, modifications, crew expert/ace, squadrons, supply chests, and a built-in local web store & marketplace. +

+
+ +
+ + + + + +

+ 本地主机 AI 对局 + Local-Host AI Battles +

+

+ 覆盖陆战、空战、海战的街机与历史模式、防守任务、核战冲突与一战活动,支持出生点与重生、无人机、空中支援、核弹胜负与完整战后结算回放。 + Ground, Air, and Naval in Arcade & Realistic, defense missions, and special events with spawn points, drones, air support, nuclear strikes, debriefing, and replays. +

+
+ +
+ + + + + +

+ 与线上版彻底隔离 + Isolated From the Online Client +

+

+ 独立用户目录与注册表,启动参数与二进制补丁双重禁用反作弊、崩溃上报与官方启动器拉起,网络钩子库将全部外部连接收口到本机端口。 + Separate user data and registry paths, dual-layer disabling of anti-cheat, crash uploads, and official launcher checks, with all sockets redirected to localhost. +

+
+ +
+ + + + + +

+ 自由调参、存档管理与模组 + Tunable Rules, Saves & Mods +

+

+ 启动器内置多存档管理、备份与一键研发/货币调整,可通过 tuning/*.jsonc 覆盖收益倍率、商店价格与对局参数,并支持增量模组扩展。 + Multi-account saves with backups and editing in the launcher, JSONC overrides for rewards, economy, and battle rules, plus additive mod support. +

+
+ +
+ + + + + +

+ 动态特征定位与热适配包 + Dynamic Patching & Signed Packs +

+

+ 补丁按特征码与字符串引用动态定位,不写死固定地址;游戏小版本更新时,启动器自动拉取经 Ed25519 签名的适配包,无需重装整包。 + Patches resolve by code signatures and string references instead of hardcoded offsets, with Ed25519-signed adaptation packs delivered through launcher updates. +

+
+ +
+ + + + + +

+ 省空间复制与零原版分发 + Space-Saving Copy & Clean Distribution +

+

+ 项目不携带任何游戏资产,安装向导从你本机的原版目录只读提取,同盘支持硬链接共享大型静态资源,大幅节省硬盘空间。 + Zero game assets are distributed. The wizard reads your own stock installation read-only and supports same-volume hardlinks to save tens of gigabytes. +

+
+
+
+
+ + +
+
+
ARCHITECTURE
+

+ 三个组件协同工作 + Three Moving Parts +

+

+ 下载后的启动器整合了安装、补丁、本地服务器与存档管理,一键拉起整套离线环境: + One launcher bundles installation, dynamic patching, the local server, and save management: +

+ +
+
+
01 / LAUNCHER
+

+ 安装器与启动器 + Installer & Launcher +

+

+ 检测本机原版客户端版本与补丁兼容性,创建独立或省空间副本,管理多份客户端、存档、数值覆盖、模组与签名更新。 + Inspects your stock client, builds an isolated or hardlinked copy, and manages clients, saves, tuning overrides, mods, and verified updates. +

+
+ +
+
02 / PATCHER & HOOK
+

+ 离线副本与网络钩子 + Client Copy & wto_ws.dll +

+

+ 改写数据包里的服务地址并应用经过校验的 exe 与界面脚本补丁;wto_ws.dll 接管进程网络并补齐本地主机对局逻辑。 + Rewrites service endpoints in memory, applies verified exe/UI patches, and uses wto_ws.dll to route sockets locally and restore host handlers. +

+
+ +
+
03 / LOCAL SERVER
+

+ 本地模拟服务器 + Local Emulation Server +

+

+ 仅监听 127.0.0.1 单端口,启动时从游戏包提取静态数据,模拟登录、档案、匹配、库存与商店协议,每次操作即时落盘。 + Listens exclusively on 127.0.0.1, extracts static data from your stock archives at startup, emulates online protocols, and writes every change to disk. +

+
+
+
+
+ + +
+
+
DOWNLOAD
+

+ 下载最新版启动器 + Download Latest Launcher +

+

+ + 支持 Windows x64。推荐下载安装版,后续启动会自动检查并验签更新;免安装用户也可选择便携压缩包。 + + + For Windows x64. The installer automatically checks for and verifies Ed25519-signed updates on launch; a portable archive is also available. + +

+ +
+
+

+ 正在获取最新版本信息… + Fetching latest release information… +

+
+
+ +

+ 提示:程序暂未购买商业代码签名,首次运行如遇 Windows SmartScreen 拦截,可核对发布页公示的 SHA-256 后选择「更多信息 → 仍要运行」。 + Note: Binaries are not Authenticode-signed yet. If Windows SmartScreen prompts on first run, verify the SHA-256 on the release page and choose "More info → Run anyway". +

+
+
+ + +
+
+
+
OPEN SOURCE & COMMUNITY
+

+ 参与讨论、反馈问题与共同适配 + Join the Community & Contribute +

+

+ + 欢迎加入 Discord 交流体验、分享调参与模组,或前往代码仓库提交 Issue 与 PR,一起推进新版本适配。 + + + Join our Discord for discussion, tuning presets, and mods, or visit the repository to file issues, submit pull requests, and help adapt new client versions. + +

+ +
+
+
+ + + + +
+ + + + diff --git a/releases.html b/releases.html new file mode 100644 index 0000000..200992e --- /dev/null +++ b/releases.html @@ -0,0 +1,127 @@ + + + + + + WTOffline · 全部版本下载 + + + + + + + +
+
+ + + +
+
+
+ + + + + 返回 WTOffline 主页 + Back to WTOffline Home + +
ALL RELEASES
+

+ 全部版本下载 + All Releases +

+

+ + 所有启动器安装版、便携压缩包与游戏版本适配包均经 Ed25519 私钥签名。已安装启动器的玩家会在启动时自动获取更新,通常无需手动下载适配包。 + + + All launcher installers, portable archives, and adaptation packs are signed with Ed25519. Installed launchers fetch updates automatically; manual adaptation pack downloads are rarely needed. + +

+
+ + +
+
+ +
+
+
+
+

+ 正在获取全部版本列表… + Loading release catalog… +

+
+
+
+
+
+ + +
+ + + + diff --git a/site/home.css b/site/home.css new file mode 100644 index 0000000..f8344a8 --- /dev/null +++ b/site/home.css @@ -0,0 +1,1068 @@ +/* ============================================================ + * WTOffline Project Homepage Styles & Motion Choreography + * ============================================================ */ + +* { box-sizing: border-box; } + +html { scroll-behavior: smooth; } + +body { + margin: 0; + font-family: var(--font-ui); + background: var(--page); + color: var(--text); + font-size: 15px; + line-height: 1.72; + -webkit-font-smoothing: antialiased; + overflow-x: hidden; +} + +code { + font-family: var(--font-mono); + font-size: 0.88em; + padding: 1px 5px; + border-radius: var(--r-xs); + background: var(--glass-2); + border: 1px solid var(--border); + color: var(--text); +} + +/* Language toggle visibility */ +[data-lang='en'] .lang-zh { display: none !important; } +[data-lang='zh'] .lang-en { display: none !important; } + +/* ---------------- Ambient Canvas & Technical Grid ---------------- */ + +.bg { + position: fixed; + inset: 0; + z-index: -2; + background: var(--canvas); + pointer-events: none; +} + +.bg::before, +.bg::after { + content: ''; + position: absolute; + border-radius: 50%; + filter: blur(96px); + opacity: 0.38; + will-change: transform; +} + +.bg::before { + width: 44vw; + height: 44vw; + left: -10vw; + top: -14vw; + background: radial-gradient(circle, rgba(229, 57, 53, 0.50) 0%, transparent 72%); + animation: drift1 26s ease-in-out infinite alternate; +} + +.bg::after { + width: 38vw; + height: 38vw; + right: -8vw; + bottom: -14vw; + background: radial-gradient(circle, rgba(49, 227, 238, 0.34) 0%, transparent 72%); + animation: drift2 32s ease-in-out infinite alternate; +} + +:root[data-mode='light'] .bg::before { opacity: 0.22; } +:root[data-mode='light'] .bg::after { opacity: 0.18; } + +@keyframes drift1 { + to { transform: translate3d(13vw, 8vh, 0) scale(1.16); } +} + +@keyframes drift2 { + to { transform: translate3d(-11vw, -9vh, 0) scale(1.12); } +} + +.grid { + position: fixed; + inset: 0; + z-index: -1; + pointer-events: none; + background-image: + linear-gradient(var(--grid-line) 1px, transparent 1px), + linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); + background-size: 64px 64px; + -webkit-mask-image: radial-gradient(74% 62% at 50% 30%, #000 30%, transparent 80%); + mask-image: radial-gradient(74% 62% at 50% 30%, #000 30%, transparent 80%); +} + +/* ---------------- Opening Shutter & Focus-In ---------------- */ + +#blink { + position: fixed; + inset: 0; + z-index: 200; + pointer-events: none; + background: var(--page); + animation: eyelid 0.95s var(--ease) forwards; +} + +@keyframes eyelid { + 0% { clip-path: inset(0 0 0 0); opacity: 1; } + 45% { clip-path: inset(0 0 0 0); opacity: 1; } + 100% { clip-path: inset(50% 0 50% 0); opacity: 0; } +} + +.focus-in { + animation: focusIn 1.15s var(--ease) both; +} + +@keyframes focusIn { + 0% { filter: blur(22px); opacity: 0; transform: scale(1.045); } + 58% { filter: blur(3px); opacity: 1; } + 100% { filter: blur(0); opacity: 1; transform: none; } +} + +.stagger > * { + animation: riseIn 0.8s var(--ease) both; +} +.stagger > *:nth-child(1) { animation-delay: 0.44s; } +.stagger > *:nth-child(2) { animation-delay: 0.56s; } +.stagger > *:nth-child(3) { animation-delay: 0.68s; } +.stagger > *:nth-child(4) { animation-delay: 0.80s; } +.stagger > *:nth-child(5) { animation-delay: 0.92s; } + +@keyframes riseIn { + from { filter: blur(11px); opacity: 0; transform: translateY(16px); } + to { filter: blur(0); opacity: 1; transform: none; } +} + +/* Scroll-triggered reveal */ +.reveal { + filter: blur(12px); + opacity: 0; + transform: translateY(22px); + transition: filter 0.78s var(--ease), opacity 0.78s var(--ease), transform 0.78s var(--ease); +} + +.reveal.in { + filter: blur(0); + opacity: 1; + transform: none; +} + +/* Smooth page leave transition for internal navigation */ +body.leaving { + animation: focusOut 0.3s var(--ease) forwards; +} + +@keyframes focusOut { + to { filter: blur(16px); opacity: 0; transform: scale(0.985); } +} + +@view-transition { + navigation: auto; +} + +@media (prefers-reduced-motion: reduce) { + html { scroll-behavior: auto; } + #blink, .focus-in, .stagger > *, body.leaving { animation: none !important; } + .reveal { filter: none; opacity: 1; transform: none; transition: none; } + .bg::before, .bg::after { animation: none; } + @view-transition { navigation: none; } +} + +/* ---------------- Sticky Header ---------------- */ + +.nav { + position: sticky; + top: 0; + z-index: 50; + display: flex; + align-items: center; + gap: var(--s3); + padding: 12px clamp(16px, 5vw, 44px); + background: color-mix(in srgb, var(--page) 68%, transparent); + -webkit-backdrop-filter: blur(18px) saturate(1.2); + backdrop-filter: blur(18px) saturate(1.2); + border-bottom: 1px solid transparent; + transition: border-color 0.28s var(--ease), background 0.28s var(--ease); +} + +.nav.stuck { + border-bottom-color: var(--border); + background: color-mix(in srgb, var(--page) 84%, transparent); +} + +.brand { + display: inline-flex; + align-items: center; + gap: 10px; + font-family: var(--font-display); + font-weight: 700; + font-size: 16px; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--text); + text-decoration: none; +} + +.brand .logo { + width: 28px; + height: 28px; + display: block; +} + +.brand-accent { + color: var(--accent); +} + +.nav-links { + margin-left: auto; + display: flex; + align-items: center; + gap: 4px; +} + +.nav-links a { + padding: 6px 11px; + border-radius: var(--r-sm); + color: var(--text-dim); + text-decoration: none; + font-size: 13.5px; + font-weight: 500; + transition: color 0.2s var(--ease), background 0.2s var(--ease); +} + +.nav-links a:hover { + color: var(--text); + background: var(--glass-2); +} + +.ui-btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 5px; + height: 32px; + padding: 0 10px; + border-radius: var(--r-sm); + border: 1px solid var(--border); + background: var(--glass-2); + color: var(--text-dim); + font-family: var(--font-mono); + font-size: 12px; + cursor: pointer; + transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease); +} + +.ui-btn:hover { + color: var(--text); + border-color: var(--border-2); + background: var(--surface); +} + +.ui-iconbtn { + width: 32px; + padding: 0; +} + +.ui-iconbtn svg { + width: 15px; + height: 15px; +} + +/* ---------------- Layout Container ---------------- */ + +.wrap { + max-width: 1040px; + margin: 0 auto; + padding: 0 clamp(18px, 5vw, 36px); +} + +/* ---------------- Hero ---------------- */ + +.hero { + position: relative; + padding: clamp(56px, 11vh, 112px) 0 clamp(44px, 7vh, 76px); + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.badge { + display: inline-flex; + align-items: center; + gap: 9px; + padding: 5px 13px; + border-radius: 999px; + border: 1px solid var(--border); + background: var(--surface); + color: var(--text-dim); + font-size: 12.5px; + text-decoration: none; + -webkit-backdrop-filter: blur(12px); + backdrop-filter: blur(12px); + transition: border-color 0.24s var(--ease), color 0.24s var(--ease), transform 0.24s var(--ease); +} + +.badge:hover { + border-color: var(--accent); + color: var(--text); + transform: translateY(-1px); +} + +.dot { + width: 7px; + height: 7px; + border-radius: 50%; + background: var(--accent); + box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.55); + animation: pulse 2.4s ease-out infinite; +} + +@keyframes pulse { + 0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.55); } + 70% { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); } + 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); } +} + +.hero-logo { + margin: 28px 0 0; + line-height: 0; +} + +.hero-wordmark { + height: clamp(112px, 15.5vw, 172px); + width: auto; + max-width: 100%; + display: block; + filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.36)); +} + +:root[data-mode='light'] .hero-wordmark { + filter: invert(0.88) contrast(1.08); +} + +.hero .sub { + margin: 26px 0 0; + max-width: 650px; + font-size: clamp(15px, 1.55vw, 17px); + color: var(--text-dim); + line-height: 1.78; +} + +.cta { + display: flex; + flex-wrap: wrap; + gap: 12px; + margin-top: 30px; +} + +/* Buttons */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + padding: 11px 20px; + border-radius: var(--r-sm); + border: 1px solid var(--border-2); + font-size: 14px; + font-weight: 600; + text-decoration: none; + cursor: pointer; + white-space: nowrap; + transition: transform 0.24s var(--ease), border-color 0.24s var(--ease), background 0.24s var(--ease), box-shadow 0.24s var(--ease), color 0.24s var(--ease); +} + +.btn svg { + width: 16px; + height: 16px; + flex-shrink: 0; +} + +.btn-primary { + background: var(--accent); + border-color: var(--accent); + color: #ffffff; + box-shadow: var(--shadow-accent); +} + +.btn-primary:hover { + background: var(--accent-hover); + border-color: var(--accent-hover); + transform: translateY(-2px); + box-shadow: 0 14px 32px rgba(229, 57, 53, 0.36); +} + +.btn-ghost { + background: var(--surface); + color: var(--text); + -webkit-backdrop-filter: blur(10px); + backdrop-filter: blur(10px); +} + +.btn-ghost:hover { + transform: translateY(-2px); + border-color: var(--accent); + color: var(--text); + box-shadow: var(--shadow-sm); +} + +.btn:active { + transform: translateY(0) scale(0.985); +} + +/* Hero key facts strip */ +.facts { + display: flex; + flex-wrap: wrap; + gap: 10px 26px; + margin-top: 34px; + padding-top: 22px; + border-top: 1px solid var(--border); + width: 100%; + max-width: 720px; + font-size: 13px; + color: var(--text-faint); +} + +.fact { + display: inline-flex; + align-items: center; + gap: 7px; +} + +.fact strong { + font-family: var(--font-mono); + font-size: 12.5px; + color: var(--text); + font-weight: 600; +} + +/* ---------------- Sections ---------------- */ + +section { + padding: clamp(44px, 7.5vh, 80px) 0; +} + +.eyebrow { + display: inline-flex; + align-items: center; + gap: 8px; + margin-bottom: 10px; + font-family: var(--font-mono); + font-size: 11.5px; + letter-spacing: 0.18em; + text-transform: uppercase; + color: var(--accent); +} + +.eyebrow::before { + content: ''; + width: 16px; + height: 2px; + background: var(--accent); +} + +h2.sec { + font-family: var(--font-display); + font-size: clamp(24px, 3.4vw, 34px); + letter-spacing: -0.015em; + font-weight: 700; + margin: 0 0 var(--s2); + line-height: 1.2; +} + +p.lede { + color: var(--text-dim); + max-width: 680px; + margin: 0 0 var(--s5); + font-size: 15.5px; +} + +/* ---------------- Feature Cards (with pointer spotlight) ---------------- */ + +.cards { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); + gap: var(--s3); +} + +.card { + position: relative; + overflow: hidden; + padding: var(--s5); + border-radius: var(--r-lg); + border: 1px solid var(--border); + background: var(--card); + -webkit-backdrop-filter: blur(14px); + backdrop-filter: blur(14px); + transition: transform 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease); +} + +.card:hover { + transform: translateY(-4px); + border-color: var(--border-2); + box-shadow: var(--shadow-md); +} + +/* Pointer-following spotlight driven by --mx / --my */ +.card::before { + content: ''; + position: absolute; + inset: -1px; + border-radius: inherit; + pointer-events: none; + background: radial-gradient( + 240px circle at var(--mx, 50%) var(--my, 0%), + rgba(229, 57, 53, 0.15), + transparent 64% + ); + opacity: 0; + transition: opacity 0.35s var(--ease); +} + +.card:hover::before { + opacity: 1; +} + +/* Subtle top chamfer accent line on hover */ +.card::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 48px; + height: 2px; + background: var(--accent); + opacity: 0.55; + transition: width 0.35s var(--ease), opacity 0.35s var(--ease); +} + +.card:hover::after { + width: 96px; + opacity: 1; +} + +.card .ico { + display: inline-grid; + place-items: center; + width: 38px; + height: 38px; + border-radius: var(--r-sm); + margin-bottom: var(--s3); + background: var(--accent-soft); + color: var(--accent); +} + +.card .ico svg { + width: 19px; + height: 19px; +} + +.card h3 { + font-size: 16px; + font-weight: 660; + margin: 0 0 8px; +} + +.card p { + font-size: 13.5px; + color: var(--text-dim); + margin: 0; + line-height: 1.68; +} + +/* ---------------- Architecture Parts ---------------- */ + +.parts { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); + gap: var(--s3); +} + +.part { + position: relative; + overflow: hidden; + padding: var(--s4); + border-radius: var(--r-md); + border: 1px solid var(--border); + background: var(--surface); + -webkit-backdrop-filter: blur(12px); + backdrop-filter: blur(12px); + transition: transform 0.28s var(--ease), border-color 0.28s var(--ease); +} + +.part:hover { + transform: translateY(-3px); + border-color: var(--border-2); +} + +.part .n { + font-family: var(--font-mono); + font-size: 12px; + color: var(--accent); + font-weight: 700; + letter-spacing: 0.08em; +} + +.part h4 { + margin: 6px 0 8px; + font-size: 16px; + font-weight: 660; +} + +.part p { + margin: 0; + font-size: 13.5px; + color: var(--text-dim); + line-height: 1.66; +} + +.part code { + font-family: var(--font-mono); + font-size: 0.88em; + padding: 1px 5px; + border-radius: var(--r-xs); + background: var(--glass-2); + border: 1px solid var(--border); + color: var(--text); +} + +/* ---------------- Live Release Panel ---------------- */ + +.release { + border-radius: var(--r-lg); + border: 1px solid var(--border); + background: var(--elev); + -webkit-backdrop-filter: blur(16px); + backdrop-filter: blur(16px); + overflow: hidden; + box-shadow: var(--shadow-sm); +} + +.release-head { + display: flex; + align-items: center; + gap: 12px; + flex-wrap: wrap; + padding: var(--s3) var(--s5); + border-bottom: 1px solid var(--border); + background: var(--glass-2); +} + +.release-tag { + font-family: var(--font-mono); + font-size: 19px; + font-weight: 700; + color: var(--accent); +} + +.release-date { + font-family: var(--font-mono); + font-size: 12.5px; + color: var(--text-faint); +} + +.release-chip { + font-family: var(--font-mono); + font-size: 11.5px; + padding: 2px 9px; + border-radius: 999px; + border: 1px solid var(--border); + color: var(--text-dim); + background: var(--surface); +} + +.release-body { + padding: var(--s5); +} + +.release-notes { + font-size: 14px; + color: var(--text-dim); +} + +.release-notes h3, +.release-notes h4 { + font-size: 14.5px; + font-weight: 660; + color: var(--text); + margin: var(--s4) 0 6px; +} + +.release-notes h3:first-child, +.release-notes h4:first-child { + margin-top: 0; +} + +.release-notes ul { + margin: 0 0 var(--s3); + padding-left: 1.3em; +} + +.release-notes li { + margin-bottom: 4px; +} + +.release-notes p { + margin: 0 0 var(--s3); +} + +.release-notes code { + font-family: var(--font-mono); + font-size: 0.88em; + padding: 1px 5px; + border-radius: var(--r-xs); + background: var(--glass-2); + border: 1px solid var(--border); +} + +.release-loading { + color: var(--text-faint); + font-size: 14px; + margin: 0; +} + +.release-dl { + display: flex; + gap: 10px; + flex-wrap: wrap; + margin-top: var(--s4); +} + +.dl { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 10px 16px; + border-radius: var(--r-sm); + border: 1px solid var(--border-2); + background: var(--card); + color: var(--text); + text-decoration: none; + font-size: 13.5px; + font-weight: 600; + transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), color 0.22s var(--ease), background 0.22s var(--ease); +} + +.dl.dl-main { + background: var(--accent); + border-color: var(--accent); + color: #ffffff; +} + +.dl.dl-main:hover { + background: var(--accent-hover); + border-color: var(--accent-hover); + color: #ffffff; +} + +.dl.dl-main .size { + color: rgba(255, 255, 255, 0.8); +} + +.dl:hover { + border-color: var(--accent); + transform: translateY(-2px); +} + +.dl .size { + font-family: var(--font-mono); + color: var(--text-faint); + font-size: 11.5px; + font-weight: 400; +} + +.dl svg { + width: 15px; + height: 15px; + flex-shrink: 0; +} + +.release-pack { + margin-top: var(--s4); + padding-top: var(--s3); + border-top: 1px solid var(--border); + font-size: 13px; + color: var(--text-dim); + display: flex; + flex-wrap: wrap; + gap: 8px 18px; + align-items: center; +} + +.release-pack code { + font-family: var(--font-mono); + font-size: 12px; + color: var(--text); +} + +.dl-note { + margin-top: var(--s3); + font-size: 13px; + color: var(--text-faint); +} + +/* ---------------- All Releases Subpage ---------------- */ + +.page-head { + padding: clamp(36px, 6.5vh, 64px) 0 18px; +} + +.back-link { + display: inline-flex; + align-items: center; + gap: 7px; + margin-bottom: 22px; + color: var(--text-dim); + text-decoration: none; + font-size: 13.5px; + transition: color 0.2s var(--ease), transform 0.2s var(--ease); +} + +.back-link svg { + width: 15px; + height: 15px; +} + +.back-link:hover { + color: var(--accent); + transform: translateX(-2px); +} + +.page-title { + margin: 0 0 var(--s2); + font-family: var(--font-display); + font-size: clamp(28px, 4.2vw, 44px); + font-weight: 700; + line-height: 1.15; + letter-spacing: -0.015em; +} + +.filter-tabs { + display: inline-flex; + gap: 6px; + padding: 4px; + border-radius: var(--r-md); + border: 1px solid var(--border); + background: var(--surface); + -webkit-backdrop-filter: blur(12px); + backdrop-filter: blur(12px); +} + +.tab { + display: inline-flex; + align-items: center; + gap: 7px; + padding: 8px 18px; + border-radius: var(--r-sm); + border: 1px solid transparent; + background: transparent; + color: var(--text-dim); + font-family: var(--font-ui); + font-size: 13.5px; + font-weight: 600; + cursor: pointer; + transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease); +} + +.tab-count { + font-family: var(--font-mono); + font-size: 11px; + opacity: 0.72; +} + +.tab-count:empty { + display: none; +} + +.tab:hover { + color: var(--text); +} + +.tab.active { + background: var(--accent); + color: #ffffff; +} + +.tab.active .tab-count { + opacity: 0.9; +} + +.rel-section { + padding: 18px 0 clamp(32px, 5vh, 56px); +} + +.rel-list { + display: flex; + flex-direction: column; + gap: var(--s4); +} + +.rel-list.switching { + animation: tabSwitch 0.35s var(--ease) both; +} + +@keyframes tabSwitch { + from { opacity: 0; transform: translateY(8px); } + to { opacity: 1; transform: none; } +} + +.release-badge-latest { + font-family: var(--font-mono); + font-size: 11px; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; + padding: 2px 8px; + border-radius: 999px; + background: var(--accent-soft); + border: 1px solid rgba(229, 57, 53, 0.45); + color: var(--accent); +} + +.release-badge-pack { + font-family: var(--font-mono); + font-size: 11px; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; + padding: 2px 8px; + border-radius: 999px; + background: rgba(49, 227, 238, 0.10); + border: 1px solid rgba(49, 227, 238, 0.35); + color: var(--accent-2); +} + +.hash-list { + margin-top: var(--s4); + padding-top: var(--s3); + border-top: 1px solid var(--border); + display: flex; + flex-direction: column; + gap: 8px; +} + +.hash-row { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 12px; + font-size: 12px; + color: var(--text-faint); +} + +.hash-file { + font-family: var(--font-mono); + color: var(--text-dim); +} + +.hash-val { + font-family: var(--font-mono); + font-size: 11.5px; + word-break: break-all; + color: var(--text-faint); +} + +.hash-copy { + padding: 2px 8px; + border-radius: var(--r-xs); + border: 1px solid var(--border); + background: var(--glass-2); + color: var(--text-dim); + font-family: var(--font-mono); + font-size: 11px; + cursor: pointer; + transition: color 0.2s var(--ease), border-color 0.2s var(--ease); +} + +.hash-copy:hover { + color: var(--text); + border-color: var(--accent); +} + +.rel-empty { + padding: var(--s5); + text-align: center; + color: var(--text-faint); + font-size: 14px; +} + +/* ---------------- Community CTA & Scope Banner ---------------- */ + +.community-card { + text-align: center; + padding: clamp(32px, 5.5vw, 54px) clamp(20px, 4vw, 44px); +} + +.community-card p.lede { + margin: 0 auto var(--s4); +} + +.community-actions { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 10px; +} + +/* ---------------- Footer ---------------- */ + +footer { + margin-top: clamp(44px, 8vh, 84px); + border-top: 1px solid var(--border); + padding: var(--s5) 0 var(--s6); +} + +.foot { + display: flex; + align-items: center; + gap: 14px var(--s4); + flex-wrap: wrap; + font-size: 13px; + color: var(--text-dim); +} + +.foot a { + color: var(--text-dim); + text-decoration: none; + transition: color 0.2s var(--ease); +} + +.foot a:hover { + color: var(--accent); +} + +.foot .right { + margin-left: auto; + display: flex; + flex-wrap: wrap; + gap: 16px; +} + +.foot-brand { + display: inline-flex; + align-items: center; + gap: 9px; + font-weight: 600; + color: var(--text); +} + +.foot-brand img { + border-radius: 4px; +} + +.disclaimer { + margin: 14px 0 0; + font-size: 12px; + color: var(--text-faint); + line-height: 1.65; +} + +/* ---------------- Responsive ---------------- */ + +@media (max-width: 680px) { + .nav-links a.hide-sm { display: none; } + .grid { background-size: 44px 44px; } + .foot .right { margin-left: 0; } +} diff --git a/site/home.js b/site/home.js new file mode 100644 index 0000000..89cf5a0 --- /dev/null +++ b/site/home.js @@ -0,0 +1,536 @@ +/* ============================================================ + * WTOffline Project Homepage & All-Releases Script + * Classic non-module script so opening HTML files directly via + * file:// works without a local server. + * Handles: language toggle, color theme toggle, opening shutter, + * scroll reveal, pointer spotlight, sticky header, internal page + * transition, and live release catalog rendering. + * ============================================================ */ +(function () { + 'use strict'; + + // Primary release feed is served via edge object storage to keep origin server load low; + // falls back to GitHub Releases API when unavailable. + var PRIMARY_FEED = 'https://dl.wto-project.net/releases'; + var FALLBACK_FEED = 'https://api.github.com/repos/N0VAN0M4LY/WT-Offline/releases?per_page=30'; + var GH_RELEASES = 'https://github.com/N0VAN0M4LY/WT-Offline/releases'; + + var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + var pageKind = document.body.getAttribute('data-page') || 'home'; + + // ---- Language (zh / en) ---- + var currentLang = 'zh'; + (function initLang() { + var saved = null; + try { saved = localStorage.getItem('wto.site.lang'); } catch (e) { /* noop */ } + if (saved === 'zh' || saved === 'en') { + currentLang = saved; + } else { + var navLang = (navigator.language || '').toLowerCase(); + currentLang = navLang.indexOf('zh') === 0 ? 'zh' : 'en'; + } + applyLang(currentLang); + + document.addEventListener('click', function (e) { + var btn = e.target.closest('[data-lang-toggle]'); + if (!btn) return; + currentLang = currentLang === 'zh' ? 'en' : 'zh'; + applyLang(currentLang); + try { localStorage.setItem('wto.site.lang', currentLang); } catch (err) { /* noop */ } + }); + })(); + + function applyLang(lang) { + document.body.setAttribute('data-lang', lang); + document.documentElement.lang = lang === 'zh' ? 'zh-CN' : 'en'; + if (pageKind === 'releases') { + document.title = lang === 'zh' + ? 'WTOffline · 全部版本下载' + : 'WTOffline · All Releases'; + } else { + document.title = lang === 'zh' + ? 'WTOffline · 战争雷霆本地单机离线项目' + : 'WTOffline · Local Single-Player Offline Project for War Thunder'; + } + } + + // ---- Color mode (dark default / light optional) ---- + (function initTheme() { + var root = document.documentElement; + var saved = null; + try { saved = localStorage.getItem('wto.site.mode'); } catch (e) { /* noop */ } + var mode = saved === 'light' || saved === 'dark' ? saved : 'dark'; + root.setAttribute('data-mode', mode); + + document.addEventListener('click', function (e) { + var btn = e.target.closest('[data-mode-toggle]'); + if (!btn) return; + var next = root.getAttribute('data-mode') === 'dark' ? 'light' : 'dark'; + root.setAttribute('data-mode', next); + try { localStorage.setItem('wto.site.mode', next); } catch (err) { /* noop */ } + }); + })(); + + // ---- Opening shutter cleanup ---- + (function initShutter() { + var el = document.getElementById('blink'); + if (!el) return; + if (reduce) { el.remove(); return; } + el.addEventListener('animationend', function () { el.remove(); }); + setTimeout(function () { if (el.parentNode) el.remove(); }, 1500); + })(); + + // ---- Scroll-triggered reveal ---- + (function initReveal() { + var items = document.querySelectorAll('.reveal'); + if (!items.length) return; + if (reduce || !('IntersectionObserver' in window)) { + items.forEach(function (n) { n.classList.add('in'); }); + return; + } + var io = new IntersectionObserver(function (entries) { + entries.forEach(function (entry) { + if (!entry.isIntersecting) return; + var index = +(entry.target.getAttribute('data-i') || 0); + setTimeout(function () { entry.target.classList.add('in'); }, index * 85); + io.unobserve(entry.target); + }); + }, { rootMargin: '0px 0px -8% 0px' }); + items.forEach(function (n) { io.observe(n); }); + })(); + + // ---- Pointer spotlight on cards ---- + (function initSpotlight() { + if (reduce) return; + document.addEventListener('mousemove', function (e) { + var card = e.target.closest('.card'); + if (!card) return; + var rect = card.getBoundingClientRect(); + card.style.setProperty('--mx', (e.clientX - rect.left) + 'px'); + card.style.setProperty('--my', (e.clientY - rect.top) + 'px'); + }); + })(); + + // ---- Sticky header border ---- + (function initStickyNav() { + var nav = document.querySelector('.nav'); + if (!nav) return; + var update = function () { nav.classList.toggle('stuck', window.scrollY > 8); }; + update(); + window.addEventListener('scroll', update, { passive: true }); + })(); + + // ---- Smooth internal page navigation ---- + (function initLeaveTransition() { + if (reduce) return; + if (document.startViewTransition) return; + document.addEventListener('click', function (e) { + var a = e.target.closest('a'); + if (!a) return; + var href = a.getAttribute('href') || ''; + if (a.target === '_blank' || a.hasAttribute('download')) return; + if (!href || href.charAt(0) === '#' || /^(https?:)?\/\//.test(href)) return; + if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return; + e.preventDefault(); + document.body.classList.add('leaving'); + setTimeout(function () { location.href = href; }, 260); + }); + })(); + + // ---- Shared helpers for release rendering ---- + var DL_ICON = + '' + + ''; + + function esc(s) { + return String(s).replace(/[&<>"]/g, function (c) { + return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; + }); + } + + function formatSize(bytes) { + if (typeof bytes !== 'number' || !isFinite(bytes)) return ''; + if (bytes >= 1048576) return (bytes / 1048576).toFixed(1) + ' MB'; + if (bytes >= 1024) return (bytes / 1024).toFixed(1) + ' KB'; + return bytes + ' B'; + } + + function inlineMd(s) { + return esc(s) + .replace(/`([^`]+)`/g, '$1') + .replace(/\*\*([^*]+)\*\*/g, '$1'); + } + + function renderMd(src) { + var out = []; + var inList = false; + String(src || '').split(/\r?\n/).forEach(function (raw) { + var line = raw.trim(); + var heading = /^(#{2,3})\s+(.*)$/.exec(line); + var bullet = /^[-*]\s+(.*)$/.exec(line); + if (heading) { + if (inList) { out.push(''); inList = false; } + out.push('

' + inlineMd(heading[2]) + '

'); + } else if (bullet) { + if (!inList) { out.push(''); inList = false; } + } else { + if (inList) { out.push(''); inList = false; } + out.push('

' + inlineMd(line) + '

'); + } + }); + if (inList) out.push(''); + return out.join(''); + } + + function parseSemver(tag) { + var m = /^v(\d+)\.(\d+)\.(\d+)$/.exec(tag || ''); + return m ? [+m[1], +m[2], +m[3]] : null; + } + + function compareSemverDesc(a, b) { + var va = parseSemver(a.tag_name) || [0, 0, 0]; + var vb = parseSemver(b.tag_name) || [0, 0, 0]; + for (var i = 0; i < 3; i++) { + if (vb[i] !== va[i]) return vb[i] - va[i]; + } + return 0; + } + + function parsePackVer(tag) { + var m = /^patches-(\d{4})\.(\d{2})\.(\d{2})(?:\.(\d+))?$/.exec(tag || ''); + return m ? [+m[1], +m[2], +m[3], m[4] ? +m[4] : 1] : null; + } + + function comparePackDesc(a, b) { + var va = parsePackVer(a.tag_name) || [0, 0, 0, 0]; + var vb = parsePackVer(b.tag_name) || [0, 0, 0, 0]; + for (var i = 0; i < 4; i++) { + if (vb[i] !== va[i]) return vb[i] - va[i]; + } + return 0; + } + + function classifyReleases(list) { + var launchers = list.filter(function (r) { + return r && !r.draft && !r.prerelease && parseSemver(r.tag_name) !== null; + }).sort(compareSemverDesc); + + var packs = list.filter(function (r) { + return r && !r.draft && parsePackVer(r.tag_name) !== null; + }).sort(comparePackDesc); + + return { launchers: launchers, packs: packs }; + } + + function fetchReleaseFeed() { + function load(url, headers) { + return fetch(url, headers ? { headers: headers } : undefined).then(function (res) { + if (!res.ok) throw new Error('HTTP ' + res.status); + return res.json(); + }).then(function (data) { + if (!Array.isArray(data) || !data.length) throw new Error('Empty feed'); + return data; + }); + } + return load(PRIMARY_FEED).catch(function () { + return load(FALLBACK_FEED, { Accept: 'application/vnd.github+json' }); + }); + } + + // ---- Home page latest release card (#release) ---- + (function initHomeRelease() { + var host = document.getElementById('release'); + if (!host) return; + + function render(list) { + var groups = classifyReleases(list); + var latest = groups.launchers[0]; + var latestPack = groups.packs[0] || null; + if (!latest) { + renderFallback(); + return; + } + + var assets = Array.isArray(latest.assets) ? latest.assets : []; + var installer = assets.filter(function (a) { return /\.exe$/i.test(a.name || ''); })[0]; + var portable = assets.filter(function (a) { return /-portable\.zip$/i.test(a.name || ''); })[0]; + var dateStr = latest.published_at ? String(latest.published_at).slice(0, 10) : ''; + + var buttons = ''; + if (installer) { + buttons += + '' + DL_ICON + + '下载安装版(推荐)' + + 'Download Installer' + + (installer.size ? '' + esc(formatSize(installer.size)) + '' : '') + + ''; + } + if (portable) { + buttons += + '' + DL_ICON + + '便携压缩包' + + 'Portable Archive' + + (portable.size ? '' + esc(formatSize(portable.size)) + '' : '') + + ''; + } + buttons += + '' + + '查看全部版本' + + 'All Releases' + + ''; + + var packHtml = ''; + if (latestPack) { + var games = Array.isArray(latestPack.game_versions) && latestPack.game_versions.length + ? latestPack.game_versions.join(', ') + : ''; + packHtml = + '
' + + '最新适配包:Latest adaptation pack: ' + esc(latestPack.tag_name) + '' + + (games ? '已核对客户端:Verified clients: ' + esc(games) + '' : '') + + '
'; + } + + host.innerHTML = + '
' + + '' + esc(latest.tag_name) + '' + + (dateStr ? '' + esc(dateStr) + '' : '') + + 'Windows x64' + + '' + + '' + + '全部版本与校验值 →All Versions & Checksums →' + + '' + + '
' + + '
' + + (latest.body ? '
' + renderMd(latest.body) + '
' : '') + + '
' + buttons + '
' + + packHtml + + '
'; + } + + function renderFallback() { + host.innerHTML = + '
' + + '

' + + '当前未能实时拉取版本清单,可打开全部版本页或前往 GitHub Releases 获取安装包。' + + 'Could not load the live release feed right now. Open the All Releases page or visit GitHub Releases for downloads.' + + '

' + + '
' + + '' + + '打开全部版本页' + + 'Open All Releases' + + '' + + '' + + 'GitHub Releases ↗' + + '' + + '
' + + '
'; + } + + fetchReleaseFeed().then(render).catch(renderFallback); + })(); + + // ---- Standalone All-Releases page (#all-releases) ---- + (function initAllReleases() { + var host = document.getElementById('all-releases'); + if (!host) return; + + var initialTab = location.hash === '#packs' ? 'pack' : 'launcher'; + var state = { launchers: [], packs: [], filter: initialTab }; + + function syncTabUi() { + document.querySelectorAll('[data-filter]').forEach(function (el) { + var active = el.getAttribute('data-filter') === state.filter; + el.classList.toggle('active', active); + el.setAttribute('aria-selected', active ? 'true' : 'false'); + }); + } + + function updateCounts() { + var lc = document.querySelector('[data-count="launcher"]'); + var pc = document.querySelector('[data-count="pack"]'); + if (lc) lc.textContent = state.launchers.length ? String(state.launchers.length) : ''; + if (pc) pc.textContent = state.packs.length ? String(state.packs.length) : ''; + } + + syncTabUi(); + + function renderLauncherCard(rel, isLatest) { + var assets = Array.isArray(rel.assets) ? rel.assets : []; + var installer = assets.filter(function (a) { return /\.exe$/i.test(a.name || ''); })[0]; + var portable = assets.filter(function (a) { return /-portable\.zip$/i.test(a.name || ''); })[0]; + var dateStr = rel.published_at ? String(rel.published_at).slice(0, 10) : ''; + + var buttons = ''; + if (installer) { + buttons += + '' + DL_ICON + + '下载安装版' + + 'Download Installer' + + (installer.size ? '' + esc(formatSize(installer.size)) + '' : '') + + ''; + } + if (portable) { + buttons += + '' + DL_ICON + + '便携压缩包' + + 'Portable Archive' + + (portable.size ? '' + esc(formatSize(portable.size)) + '' : '') + + ''; + } + + var hashes = [installer, portable].filter(function (a) { return a && a.sha256; }); + var hashHtml = hashes.length + ? '
' + hashes.map(function (a) { + return '
' + + '' + esc(a.name) + '' + + 'SHA-256: ' + esc(a.sha256) + '' + + '' + + '
'; + }).join('') + '
' + : ''; + + return '
' + + '
' + + '' + esc(rel.tag_name) + '' + + (isLatest ? 'LATEST' : '') + + (dateStr ? '' + esc(dateStr) + '' : '') + + 'Windows x64' + + '
' + + '
' + + (rel.body ? '
' + renderMd(rel.body) + '
' : '') + + (buttons ? '
' + buttons + '
' : '') + + hashHtml + + '
' + + '
'; + } + + function renderPackCard(rel, isLatest) { + var assets = Array.isArray(rel.assets) ? rel.assets : []; + var zip = assets.filter(function (a) { return /\.zip$/i.test(a.name || ''); })[0]; + var dateStr = rel.published_at ? String(rel.published_at).slice(0, 10) : ''; + var games = Array.isArray(rel.game_versions) && rel.game_versions.length + ? rel.game_versions.join(', ') + : ''; + var minApp = rel.min_app_version ? 'v' + rel.min_app_version : ''; + + var metaRows = []; + if (games) { + metaRows.push('已核对客户端:Verified clients: ' + esc(games) + ''); + } + if (minApp) { + metaRows.push('最低启动器版本:Min launcher: ' + esc(minApp) + ''); + } + + var hashHtml = zip && zip.sha256 + ? '
' + + '' + esc(zip.name) + '' + + 'SHA-256: ' + esc(zip.sha256) + '' + + '' + + '
' + : ''; + + return '
' + + '
' + + '' + esc(rel.tag_name) + '' + + '' + + '适配包PACK' + + '' + + (isLatest ? 'LATEST' : '') + + (dateStr ? '' + esc(dateStr) + '' : '') + + '
' + + '
' + + (metaRows.length ? '
' + metaRows.join('') + '
' : '') + + (rel.body ? '
' + renderMd(rel.body) + '
' : '') + + (zip ? '' : '') + + hashHtml + + '
' + + '
'; + } + + function renderView(animate) { + var cards = []; + if (state.filter === 'launcher') { + state.launchers.forEach(function (rel, idx) { + cards.push(renderLauncherCard(rel, idx === 0)); + }); + } else { + state.packs.forEach(function (rel, idx) { + cards.push(renderPackCard(rel, idx === 0)); + }); + } + if (!cards.length) { + host.innerHTML = + '
' + + '当前分类下暂无可展示的发布版本。' + + 'No releases found in this category yet.' + + '
'; + } else { + host.innerHTML = cards.join(''); + } + if (animate && !reduce) { + host.classList.remove('switching'); + void host.offsetWidth; + host.classList.add('switching'); + } + } + + document.addEventListener('click', function (e) { + var tab = e.target.closest('[data-filter]'); + if (tab) { + var next = tab.getAttribute('data-filter') === 'pack' ? 'pack' : 'launcher'; + if (next === state.filter) return; + state.filter = next; + syncTabUi(); + if (history.replaceState) { + history.replaceState(null, '', next === 'pack' ? '#packs' : location.pathname); + } + renderView(true); + return; + } + + var copyBtn = e.target.closest('[data-copy]'); + if (copyBtn && navigator.clipboard) { + var val = copyBtn.getAttribute('data-copy') || ''; + navigator.clipboard.writeText(val).then(function () { + copyBtn.innerHTML = '已复制Copied'; + setTimeout(function () { + copyBtn.innerHTML = '复制Copy'; + }, 1600); + }).catch(function () { /* noop */ }); + } + }); + + fetchReleaseFeed() + .then(function (list) { + var groups = classifyReleases(list); + state.launchers = groups.launchers; + state.packs = groups.packs; + updateCounts(); + renderView(false); + }) + .catch(function () { + host.innerHTML = + '
' + + '

' + + '未能加载实时版本清单,请稍后刷新或前往 GitHub Releases 下载。' + + 'Could not load the release catalog right now. Please refresh or visit GitHub Releases.' + + '

' + + '' + + '
'; + }); + })(); +})(); diff --git a/site/tokens.css b/site/tokens.css new file mode 100644 index 0000000..1d4bae5 --- /dev/null +++ b/site/tokens.css @@ -0,0 +1,85 @@ +/* ============================================================ + * WTOffline Homepage Design Tokens + * Aligned with the launcher ordnance palette: dark slate base, + * signal crimson primary actions, subtle tactical cyan glow. + * Supports dark (default) and light modes via [data-mode]. + * ============================================================ */ + +:root { + color-scheme: dark; + + --font-display: 'Bahnschrift', 'DIN Alternate', 'Roboto Condensed', 'Microsoft YaHei UI', 'PingFang SC', sans-serif; + --font-ui: 'Segoe UI', 'Microsoft YaHei UI', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif; + --font-mono: Consolas, ui-monospace, SFMono-Regular, Menlo, monospace; + + --ease: cubic-bezier(0.16, 1, 0.3, 1); + + /* Spacing scale */ + --s1: 6px; + --s2: 10px; + --s3: 16px; + --s4: 22px; + --s5: 28px; + --s6: 44px; + + /* Corner radii */ + --r-xs: 4px; + --r-sm: 6px; + --r-md: 10px; + --r-lg: 14px; + + /* Dark ordnance palette (default) */ + --page: #0b0f11; + --canvas: radial-gradient(circle at 18% 0%, #172026 0%, #0b0f11 58%); + --surface: rgba(20, 27, 31, 0.72); + --card: rgba(22, 29, 34, 0.84); + --elev: rgba(18, 24, 28, 0.90); + --glass-2: rgba(255, 255, 255, 0.035); + + --border: rgba(255, 255, 255, 0.09); + --border-2: rgba(255, 255, 255, 0.20); + --grid-line: rgba(207, 216, 220, 0.09); + + --text: #e8eef1; + --text-dim: rgba(207, 216, 220, 0.72); + --text-faint: rgba(207, 216, 220, 0.46); + + --accent: #e53935; + --accent-hover: #f04a46; + --accent-soft: rgba(229, 57, 53, 0.16); + --accent-2: #31e3ee; + --ok: #7bd88f; + + --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.28); + --shadow-md: 0 18px 42px rgba(0, 0, 0, 0.44); + --shadow-accent: 0 10px 28px rgba(229, 57, 53, 0.28); +} + +:root[data-mode='light'] { + color-scheme: light; + + --page: #eef2f5; + --canvas: radial-gradient(circle at 18% 0%, #ffffff 0%, #e7edf2 62%); + --surface: rgba(255, 255, 255, 0.76); + --card: rgba(255, 255, 255, 0.88); + --elev: rgba(255, 255, 255, 0.94); + --glass-2: rgba(19, 25, 27, 0.035); + + --border: rgba(19, 25, 27, 0.10); + --border-2: rgba(19, 25, 27, 0.22); + --grid-line: rgba(19, 25, 27, 0.08); + + --text: #161d21; + --text-dim: rgba(22, 29, 33, 0.70); + --text-faint: rgba(22, 29, 33, 0.48); + + --accent: #d32f2f; + --accent-hover: #b71c1c; + --accent-soft: rgba(211, 47, 47, 0.12); + --accent-2: #0097a7; + --ok: #2e7d32; + + --shadow-sm: 0 6px 20px rgba(19, 25, 27, 0.07); + --shadow-md: 0 18px 40px rgba(19, 25, 27, 0.12); + --shadow-accent: 0 10px 24px rgba(211, 47, 47, 0.22); +}