mirror of
https://github.com/Coldsmiles/infstarweb.git
synced 2026-04-23 02:30:41 +08:00
3.7 KiB
3.7 KiB
Project Guidelines
Code Style
- This repo is framework-free: plain HTML + CSS + vanilla JavaScript (
index.html,sponsor.html,stats.html,script.js,sponsor_script.js,stats_script.js,components.js). - Keep existing naming style:
camelCasefor JS functions/variables and descriptive DOM ids/classes (for examplefetchCrowdfunding,setupMobileMenu,#players-grid). - Preserve current formatting patterns: 4-space indentation in HTML/CSS, simple function-based JS (no classes/modules/build tooling).
- Reuse shared tokens in
style.css(:rootvariables such as--bg-color,--accent-color) instead of introducing new ad-hoc styles. - Keep page-local style overrides scoped to their page blocks; avoid broad visual refactors unless explicitly requested.
- Keep user-facing copy in Chinese unless the surrounding section is already English.
Architecture
- Public pages are static entry points:
index.html+script.js: landing page, sponsors, fundraising progress, live server status.sponsor.html+sponsor_script.js: donation total, sponsor list, search/filter, donation modal.stats.html+stats_script.js: player leaderboard + searchable player cards + modal details.
- Shared structure is injected by
components.jsinto#navbar-component/#footer-componentand handles mobile menu/current-link highlighting. - Shared visual system lives in
style.css;stats.htmlandsponsor.htmlcontain page-specific inline<style>overrides. - Data flow for stats:
statsprocess.pyfetches raw player JSON files and writes normalized outputs tostats/.- It generates
stats/summary.jsonconsumed bystats_script.jsviafetch('stats/summary.json'). stats_script.jslazy-loadsstats/{uuid}.jsonwhen opening player details.
Build and Test
- No package manager/build step exists in this workspace.
- Local static preview:
python3 -m http.server 8000- open
http://localhost:8000/
- Regenerate player summary data:
python3 statsprocess.py
- Python script dependencies are runtime imports in
statsprocess.py(not pinned):requests,tqdm.
Project Conventions
- Prefer progressive enhancement with
DOMContentLoadedinitializers (all page scripts andcomponents.js). - Keep network fetch paths relative for local assets (
fund_progress.txt,sponsors.txt,stats/summary.json,stats/{uuid}.json). - For unavailable remote APIs, follow existing behavior: log errors and render fallback text instead of throwing.
- Preserve current text-data contracts:
sponsors.txtis parsed as comma-separated fields (name, project, amount, [date]), andfund_progress.txtis line-parsed by frontend scripts. - Do not introduce bundlers/framework migrations unless explicitly requested.
Integration Points
- External APIs/services currently used:
- Server status:
https://api.mcstatus.io/v2/status/java/mcpure.lunadeer.cn - Avatars:
https://minotar.net/...andhttps://crafatar.com/... - Player name resolution in pipeline: Ashcon + Mojang Session APIs (
statsprocess.py). - Source stats endpoint:
http://x2.sjcmc.cn:15960/stats/.
- Server status:
- Navbar external links are centralized in
components.js(outline docs, map, photo, QQ group). - External assets are loaded directly from CDNs (Google Fonts, Font Awesome) and image hosts.
Security
- Treat player UUID/name datasets in
stats/as production content; avoid destructive bulk edits. - Preserve SEO/verification metadata in page
<head>blocks unless a task explicitly targets SEO. - Avoid adding secrets/tokens to repository files; keep any future credentials out of static HTML/JS.
- Frontend rendering uses
innerHTMLwith fetched txt/json content in several views; keep those data sources trusted or sanitize before accepting untrusted input.