Skip to content

Commit 599591e

Browse files
He ChenyuHe Chenyu
authored andcommitted
add +
1 parent 00aa73d commit 599591e

8 files changed

Lines changed: 322 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
# [1.3.4] - 2025-11-06
4+
### Fixed
5+
- 输出前导空格丢失:运行结果区域不再对完整输出调用 `trim()`,保留行首空格,仅收敛结尾多余换行;本地模拟输出同样保留原样,解决“开头是空格则不能正确输出空格”的问题。
6+
7+
### Added
8+
- 顶部导航新增“赛事/Contest”入口,直达 `competition/index.html`
9+
- 分享弹窗新增“参赛”选项:
10+
- 输入题目编码(如 `week-1`)生成参赛提交数据。
11+
- 首次参赛弹出 `DataCollect.html` 采集参赛人信息,保存到本地后自动继续。
12+
- 打开 `competition/submit.html` 预填代码,并提供一键跳转到 GitHub 在 `submissions/week-<n>/<handle>/solution.c` 路径新建文件。
13+
- 赛事系统(静态方案,适配 GitHub Pages):
14+
- 页面:`competition/index.html`(入口),`competition/1.html`(题面),`competition/rank/1.html`(周榜),`competition/rank/index.html`(总榜),`competition/submit.html`(提交落地页)。
15+
- 数据:`competition/data/week-1.json`、`competition/data/total.json`(占位,CI 填充)。
16+
- 脚本:`scripts/compute_ranks.mjs`(计算字节数、按提交时间打破并列、生成 JSON),`scripts/compute_rank.js`(JS 包装器)。
17+
- 工作流:`.github/workflows/compute-rank.yml`(自动计算并提交榜单)。
18+
- 提交说明:`submissions/README.md` 与 `submissions/week-1/README.md`。
19+
- 题面优化(Week 1):新增“输入格式/输出格式”小节;示例改为两组并支持“展开/收起”动态折叠;“本地快速测试”改为按钮打开主编辑器新标签页。
20+
21+
### Changed
22+
- 分享弹窗 UI 扩展,加入参赛编码输入与跳转逻辑;相关文案支持中英文切换。
23+
- 头部“赛事/Contest”链接文本随语言切换。
24+
25+
### Notes
26+
- 赛事 Changelog 独立记录于 `competition/CHANGELOG.md`(当前为 0.0.1)。
27+
- 排名规则:字节数升序;同字节数按提交时间先后;总榜按全局最好成绩与参与期数聚合。
28+
329
# [1.3.3] - 2025-11-06
430
### Fixed
531
- 修复“度量”按钮点击无反应:延迟查询弹窗元素并在点击时绑定,确保按钮可用。

about.html

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ <h1 id="heroTitle"><i class="fas fa-code"></i> 在线 C 编译器</h1>
5757
<div class="card" id="cardPrivacy"><h3><i class="fas fa-shield-halved"></i> 数据与隐私</h3><p id="privacyDesc">编辑内容保存在浏览器本地(localStorage)。另存为将下载到你的设备;提交到 Wandbox 的代码仅用于编译运行。</p></div>
5858
</div>
5959

60+
<div id="versions" class="section">
61+
<h2 id="versionTitle"><i class="fas fa-code-branch"></i> 版本信息</h2>
62+
<ul class="list">
63+
<li id="editorVersionItem"><span id="editorVersionLabel">编辑器版本</span><b id="editorVersionValue">v1.3.4</b></li>
64+
<li id="competitionVersionItem"><span id="competitionVersionLabel">赛事系统版本</span><b id="competitionVersionValue">c0.0.1</b></li>
65+
</ul>
66+
</div>
67+
6068
<div id="advantages" class="section">
6169
<h2 id="advTitle"><i class="fas fa-star"></i> 最大优势</h2>
6270
<ol class="list">
@@ -113,6 +121,16 @@ <h2 id="shareTitle"><i class="fas fa-share-nodes"></i> 分享与协作</h2>
113121
</ul>
114122
</div>
115123

124+
<div id="contest" class="section">
125+
<h2 id="contestTitle"><i class="fas fa-flag-checkered"></i> 每周挑战赛事</h2>
126+
<ul class="list">
127+
<li class="contestItem" data-i18n-key="contest1">提供每周挑战题与周榜/总榜页面,纯静态适配 GitHub Pages:<code>competition/index.html</code><code>competition/1.html</code><code>competition/rank/1.html</code><code>competition/rank/index.html</code></li>
128+
<li class="contestItem" data-i18n-key="contest2">排名规则:按代码字节数升序;若相同,按提交时间先后;总榜按全局最佳与参与期数聚合。</li>
129+
<li class="contestItem" data-i18n-key="contest3">提交流程:在分享弹窗选择“参赛”,首次填写参赛信息后,打开提交页复制代码并在 GitHub 新建 <code>submissions/week-&lt;n&gt;/&lt;handle&gt;/solution.c</code> 发起 PR;CI 自动更新 JSON 榜单。</li>
130+
</ul>
131+
<div class="cta"><a class="btn primary" id="contestEntry" href="./competition/index.html"><i class="fas fa-flag-checkered"></i> 进入赛事</a></div>
132+
</div>
133+
116134
<div class="section">
117135
<h2 id="faqTitle"><i class="fas fa-list-check"></i> 常见问题(FAQ)</h2>
118136
<ul class="list">
@@ -143,6 +161,23 @@ <h2 id="sceneTitle"><i class="fas fa-bullhorn"></i> 适用场景</h2>
143161
<button id="themeToggle" class="theme-toggle"><i class="fas fa-moon"></i> 主题</button>
144162
<button id="langToggle" class="theme-toggle" style="right:160px"><i class="fas fa-globe"></i> EN</button>
145163
<script>
164+
// 引入统一版本脚本(若首页已加载也可从缓存中获取)
165+
(function loadVersion(){
166+
if(window.__VERSION__) return;
167+
var s=document.createElement('script');
168+
s.src='./scripts/version.js';
169+
s.onload=function(){
170+
try{
171+
if(window.__VERSION__){
172+
var v=window.__VERSION__;
173+
// 如 i18n 已准备则覆盖显示值;否则稍后 applyLang 会继续设置
174+
var ev=document.getElementById('editorVersionValue'); if(ev) ev.textContent=v.editor;
175+
var cv=document.getElementById('competitionVersionValue'); if(cv) cv.textContent=v.competition;
176+
}
177+
}catch(e){}
178+
};
179+
document.head.appendChild(s);
180+
})();
146181
const btn = document.getElementById('themeToggle');
147182
const langBtn = document.getElementById('langToggle');
148183
const i18n = {
@@ -156,7 +191,10 @@ <h2 id="sceneTitle"><i class="fas fa-bullhorn"></i> 适用场景</h2>
156191
moreAdvTitle:'更多优势', madv1:'纯前端 · 零安装:无需登录与插件,打开即用;PWA 支持可安装到桌面,图标为自适应 maskable。', madv2:'离线友好:首次加载后缓存资源;断网仍可编辑与分享,运行会提示不可执行。', madv3:'极速交互:撤销/复制/自动缩进响应迅速。', madv4:'易用细节:文件名脏标记、主题记忆、移动端 I/O 面板、统一动画阴影。', madv5:'可靠最小集:仅运行时才调用远端,不可用回退模拟。', madv6:'可分享与复现:代码压缩进链接,一键还原。',
157192
helpTitle:'使用帮助', help1:'打开在线编译器,在编辑区域编写 C 代码。', help2:'左侧“输入 (stdin)”填入标准输入(可选)。', help3:'点击“运行”:在线优先 Wandbox;失败回退本地;离线弹窗提示不可运行。', help4:'格式排版用“自动缩进”;复制全部代码用“复制”;下载用“另存为”。', help5:'用“主题”切换明亮/暗色;撤销/重做在可用时自动启用。',
158193
shortcutTitle:'键盘快捷键', sc1:'运行:Ctrl/Cmd + Enter', sc2:'自动缩进:Ctrl/Cmd + I', sc3:'另存为:Ctrl/Cmd + S', sc4:'切换行注释:Ctrl/Cmd + /', sc5:'命令面板:Ctrl/Cmd + Shift + P(Esc 关闭)',
159-
shareTitle:'分享与协作', share1:'支持一键分享:代码压缩进链接 (URL hash),对方打开即还原。', share2:'分享增强:可选包含输入与测试用例,完整复现环境。', share3:'打开分享链接后自动恢复代码及输入/用例。',
194+
shareTitle:'分享与协作', share1:'支持一键分享:代码压缩进链接 (URL hash),对方打开即还原。', share2:'分享增强:可选包含输入与测试用例,完整复现环境。', share3:'打开分享链接后自动恢复代码及输入/用例。',
195+
versionTitle:'版本信息', editorVersionLabel:'编辑器版本', competitionVersionLabel:'赛事系统版本', editorVersionValue:'v1.3.4', competitionVersionValue:'c0.0.1',
196+
contestTitle:'每周挑战赛事', contest1:'提供每周挑战题与周榜/总榜页面,纯静态适配 GitHub Pages:competition/index.html、competition/1.html、competition/rank/1.html、competition/rank/index.html。', contest2:'排名规则:按代码字节数升序;若相同,按提交时间先后;总榜按全局最佳与参与期数聚合。', contest3:'提交流程:在分享弹窗选择“参赛”,首次填写参赛信息后,打开提交页复制代码并在 GitHub 新建 submissions/week-<n>/<handle>/solution.c 发起 PR;CI 自动更新 JSON 榜单。', contestEntry:'进入赛事',
197+
contest4:'系统会在提交前自动评测样例,若输出不匹配显示 WA 阻止上传;通过后对参赛元数据(handle, bytes, ts)做简单加密并生成提交页。',
160198
faqTitle:'常见问题(FAQ)', faq1:'Q: 是否支持 C++? A: 打开 .cpp/.hpp 会启用 C++ 语法高亮;运行暂用 C 编译器。', faq2:'Q: 代码会丢失吗? A: 保存在 localStorage;建议定期另存为。', faq3:'Q: WASM 运行器可用吗? A: 预留能力,当前不启用;运行优先 Wandbox。', faq4:'Q: 查看历史更新? A: 点击底部版本或打开 CHANGELOG.md。',
161199
sceneTitle:'适用场景', scene1:'课堂/培训演示:免安装、跨平台。', scene2:'题解/算法草稿:快速验证逻辑。', scene3:'示例/文档附代码:一键运行和复制。',
162200
themeLight:'明亮', themeDark:'暗色', themeLabel:'主题', langToggle:'EN', langToggleZh:'中',
@@ -172,7 +210,10 @@ <h2 id="sceneTitle"><i class="fas fa-bullhorn"></i> 适用场景</h2>
172210
moreAdvTitle:'More Advantages', madv1:'Pure front-end: zero install; PWA installable with maskable icon.', madv2:'Offline friendly: cached assets allow editing & sharing (run disabled offline).', madv3:'Responsive interactions: undo/copy/indent are instant.', madv4:'Usability details: file dirty mark, theme memory, mobile I/O toggle, consistent animations.', madv5:'Resilient minimal set: remote only when running; fallback simulation on failure.', madv6:'Share & reproduce: code packed into URL hash.',
173211
helpTitle:'Usage Help', help1:'Open the compiler and write C code.', help2:'Fill left Input (stdin) if needed.', help3:'Click Run: Wandbox first; fallback simulation if online fails; offline shows a warning.', help4:'Use Format for indentation; Copy for all code; Save As to download.', help5:'Use Theme to switch light/dark; undo/redo auto enable when possible.',
174212
shortcutTitle:'Keyboard Shortcuts', sc1:'Run: Ctrl/Cmd + Enter', sc2:'Format: Ctrl/Cmd + I', sc3:'Save As: Ctrl/Cmd + S', sc4:'Toggle Line Comment: Ctrl/Cmd + /', sc5:'Command Palette: Ctrl/Cmd + Shift + P (Esc close)',
175-
shareTitle:'Sharing & Collaboration', share1:'One-click share: code compressed into URL hash.', share2:'Enhanced share: optionally include stdin & test cases.', share3:'Opening a share link restores code and inputs/cases.',
213+
shareTitle:'Sharing & Collaboration', share1:'One-click share: code compressed into URL hash.', share2:'Enhanced share: optionally include stdin & test cases.', share3:'Opening a share link restores code and inputs/cases.',
214+
versionTitle:'Versions', editorVersionLabel:'Editor Version', competitionVersionLabel:'Competition Version', editorVersionValue:'v1.3.4', competitionVersionValue:'c0.0.1',
215+
contestTitle:'Weekly Challenge', contest1:'Weekly problem and leaderboards, static and Pages-friendly: competition/index.html, competition/1.html, competition/rank/1.html, competition/rank/index.html.', contest2:'Ranking: bytes ascending; tie by earlier submission; overall aggregates best result and participation count.', contest3:'Submission: in Share modal choose "Contest"; on first time fill profile, then open submission page, paste code and create submissions/week-<n>/<handle>/solution.c on GitHub via PR; CI updates JSON.', contestEntry:'Open Competition',
216+
contest4:'Before submission the system auto-judges sample tests; WA blocks upload. On AC it encrypts metadata (handle, bytes, ts) and opens the submit page.',
176217
faqTitle:'FAQ', faq1:'Q: C++ supported? A: Opening .cpp/.hpp enables C++ syntax highlighting; runs currently use C compiler.', faq2:'Q: Will code vanish? A: Stored in localStorage; back up with Save As.', faq3:'Q: WASM runner? A: Reserved capability; Wandbox preferred; fallback simulation.', faq4:'Q: View history? A: Click footer version or open CHANGELOG.md.',
177218
sceneTitle:'Use Cases', scene1:'Classroom/training demos', scene2:'Algorithm scratch/testing', scene3:'Docs/examples with instant run & copy',
178219
themeLight:'Light', themeDark:'Dark', themeLabel:'Theme', langToggle:'中', langToggleZh:'EN',
@@ -203,6 +244,29 @@ <h2 id="sceneTitle"><i class="fas fa-bullhorn"></i> 适用场景</h2>
203244
document.querySelectorAll('.shortcutItem').forEach(li=>{ const k=li.getAttribute('data-i18n-key'); li.textContent=t(k); });
204245
document.getElementById('shareTitle').innerHTML='<i class="fas fa-share-nodes"></i> '+t('shareTitle');
205246
document.querySelectorAll('.shareItem').forEach(li=>{ const k=li.getAttribute('data-i18n-key'); li.innerHTML=t(k); });
247+
// versions
248+
document.getElementById('versionTitle').innerHTML='<i class="fas fa-code-branch"></i> '+t('versionTitle');
249+
document.getElementById('editorVersionLabel').textContent=t('editorVersionLabel');
250+
document.getElementById('competitionVersionLabel').textContent=t('competitionVersionLabel');
251+
// 若统一版本常量已加载则优先使用它的值,否则回退到 i18n 默认
252+
if(window.__VERSION__){
253+
document.getElementById('editorVersionValue').textContent=window.__VERSION__.editor;
254+
document.getElementById('competitionVersionValue').textContent=window.__VERSION__.competition;
255+
}else{
256+
document.getElementById('editorVersionValue').textContent=t('editorVersionValue');
257+
document.getElementById('competitionVersionValue').textContent=t('competitionVersionValue');
258+
}
259+
// contest
260+
document.getElementById('contestTitle').innerHTML='<i class="fas fa-flag-checkered"></i> '+t('contestTitle');
261+
document.querySelectorAll('.contestItem').forEach(li=>{ const k=li.getAttribute('data-i18n-key'); li.innerHTML=t(k); });
262+
const contestEntry=document.getElementById('contestEntry'); if(contestEntry) contestEntry.innerHTML='<i class="fas fa-flag-checkered"></i> '+t('contestEntry');
263+
// add dynamic item for new rule if missing
264+
const contestList=document.querySelectorAll('#contest ul.list, #contest .list');
265+
const items=document.querySelectorAll('#contest .contestItem');
266+
if(items.length===3){
267+
const li=document.createElement('li'); li.className='contestItem'; li.setAttribute('data-i18n-key','contest4'); li.innerHTML=t('contest4');
268+
const ul=document.querySelector('#contest ul.list')||document.querySelector('#contest .list'); if(ul) ul.appendChild(li);
269+
}
206270
document.getElementById('faqTitle').innerHTML='<i class="fas fa-list-check"></i> '+t('faqTitle');
207271
document.querySelectorAll('.faqItem').forEach(li=>{ const k=li.getAttribute('data-i18n-key'); li.innerHTML=t(k); });
208272
document.getElementById('sceneTitle').innerHTML='<i class="fas fa-bullhorn"></i> '+t('sceneTitle');

0 commit comments

Comments
 (0)