-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
367 lines (336 loc) · 12.6 KB
/
Copy pathindex.html
File metadata and controls
367 lines (336 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>kjudge Documentation</title>
<!-- Use marked.js to render markdown client-side so Live Preview works perfectly! -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<style>
body {
font-family: Verdana, Geneva, sans-serif;
font-size: 13px;
color: #222;
background-color: #ffffff;
margin: 0;
padding: 0;
line-height: 1.5;
}
#nav {
background-color: #3b5998;
color: white;
padding: 8px 12px;
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-between;
position: sticky;
top: 0;
z-index: 1000;
}
#nav .logo-area {
display: flex;
align-items: center;
}
#nav a {
color: white;
text-decoration: none;
margin-right: 15px;
font-weight: normal;
font-size: 12px;
}
#nav a:hover {
text-decoration: underline;
}
#search-box {
background: #fff;
border: 1px solid #ccc;
padding: 2px 5px;
font-size: 11px;
width: 150px;
border-radius: 2px;
}
#hamburger {
display: none;
cursor: pointer;
font-size: 20px;
margin-right: 10px;
user-select: none;
}
#container {
background-color: #f6f6ef;
max-width: 940px;
margin: 0 auto;
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
min-height: 100vh;
padding: 20px 40px;
position: relative;
}
.content h1, .content h2, .content h3 {
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
color: #000;
}
.content h1 { font-size: 22px; border-bottom: 2px solid #ff6600; padding-bottom: 5px; margin-top: 0; }
.content h2 { font-size: 18px; margin-top: 30px; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
.content h3 { font-size: 15px; margin-top: 20px; }
.content a { color: #0000ee; text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content pre, .content code {
font-family: Consolas, 'Courier New', monospace;
background-color: #f0f0f0;
padding: 2px 4px;
font-size: 12px;
border-radius: 2px;
}
.content pre {
padding: 12px;
display: block;
border: 1px solid #ddd;
overflow-x: auto;
background-color: #fdfdfd;
}
.content pre code {
background-color: transparent;
padding: 0;
border-radius: 0;
}
.footer {
margin-top: 60px;
border-top: 2px solid #ff6600;
padding: 15px 0;
font-size: 11px;
color: #828282;
text-align: center;
}
/* Mobile Side Panel */
#side-panel {
position: fixed;
left: -280px;
top: 0;
width: 260px;
height: 100%;
background: #f6f6ef;
border-right: 1px solid #ddd;
box-shadow: 2px 0 5px rgba(0,0,0,0.1);
transition: left 0.3s ease;
z-index: 2000;
padding: 20px;
overflow-y: auto;
}
#side-panel.open {
left: 0;
}
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3);
display: none;
z-index: 1500;
}
#side-panel h3 { font-size: 14px; margin-bottom: 10px; border-bottom: 1px solid #ddd; padding-bottom: 5px; }
#side-panel ul { list-style: none; padding: 0; margin: 0 0 20px 0; }
#side-panel li { margin-bottom: 5px; }
#side-panel a { color: #000; text-decoration: none; font-size: 12px; display: block; padding: 3px 0; }
#side-panel a:hover { color: #ff6600; }
#search-wrapper {
position: relative;
}
#search-results {
position: absolute;
top: 100%;
right: 0;
width: 250px;
background: #fff;
border: 1px solid #ddd;
border-top: none;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
display: none;
z-index: 3000;
max-height: 300px;
overflow-y: auto;
}
#search-results a {
display: block;
padding: 8px 12px;
color: #222;
text-decoration: none;
border-bottom: 1px solid #eee;
font-size: 11px;
}
#search-results a:last-child {
border-bottom: none;
}
#search-results a:hover {
background-color: #f6f6ef;
color: #ff6600;
}
@media (max-width: 768px) {
#hamburger { display: block; }
.desktop-nav { display: none; }
#container { padding: 15px 20px; border: none; }
#search-box { width: 120px; }
#nav { padding: 10px; }
#search-results { width: 100%; left: 0; right: 0; }
}
</style>
</head>
<body>
<div id="side-panel">
<h3>Documentation</h3>
<ul id="nav-list">
<li><a href="#home">Main Page</a></li>
<li><strong>Tutorials</strong></li>
<li><a href="#docs/tutorials/getting-started">Getting Started</a></li>
<li><strong>How-to Guides</strong></li>
<li><a href="#docs/how-to/handle-contests">Handle Contests</a></li>
<li><a href="#docs/how-to/manual-test-management">Manual Tests</a></li>
<li><strong>Reference</strong></li>
<li><a href="#docs/reference/cli">CLI Commands</a></li>
<li><a href="#docs/reference/config-schema">Config Schema</a></li>
<li><strong>Explanation</strong></li>
<li><a href="#docs/explanation/architecture">Architecture</a></li>
</ul>
<div style="font-size: 11px; color: #888; margin-top: 40px;">
kJudge v1.2.0
</div>
</div>
<div id="overlay"></div>
<div id="container">
<div id="nav">
<div class="logo-area">
<div id="hamburger">☰</div>
<img src="true_logo.png" width="24" height="24" style="margin-right: 8px;" alt="logo">
<a href="#home" style="font-size: 16px; font-weight: bold; margin-right: 20px;">kjudge</a>
<span class="desktop-nav">
<a href="#docs/tutorials/getting-started">Tutorials</a>
<a href="#docs/how-to/handle-contests">Guides</a>
<a href="#docs/reference/cli">Reference</a>
<a href="#docs/explanation/architecture">Architecture</a>
</span>
</div>
<div id="search-wrapper">
<input type="text" id="search-box" placeholder="Search docs..." autocomplete="off">
<div id="search-results"></div>
</div>
</div>
<div class="content" id="content">
<p class="loading">Loading documentation...</p>
</div>
<div class="footer">
kjudge — Local Judge CLI. peak efficiency, zero friction.
</div>
</div>
<script>
// Search Data
const DOCS_INDEX = [
{ title: 'Home', path: 'home', meta: 'main landing' },
{ title: 'Getting Started', path: 'docs/tutorials/getting-started', meta: 'tutorial install setup' },
{ title: 'Handle Contests', path: 'docs/how-to/handle-contests', meta: 'guide codeforces cf fetch' },
{ title: 'Manual Test Management', path: 'docs/how-to/manual-test-management', meta: 'guide add manual tests' },
{ title: 'CLI Reference', path: 'docs/reference/cli', meta: 'commands flags options api' },
{ title: 'Config Schema', path: 'docs/reference/config-schema', meta: 'settings json template' },
{ title: 'Architecture', path: 'docs/explanation/architecture', meta: 'isolation verdict design logic' },
];
// Configure marked to handle internal links correctly
const renderer = new marked.Renderer();
const originalLink = renderer.link.bind(renderer);
renderer.link = ({ href, title, text }) => {
// If it's an internal link (e.g., ends in .md or doesn't have a protocol)
if (href && !href.startsWith('http') && !href.startsWith('#') && !href.startsWith('//')) {
let currentPage = window.location.hash.substring(1) || 'home';
let currentDir = currentPage.split('/').slice(0, -1).join('/');
let newHref = href;
if (!href.startsWith('/')) {
let parts = [...currentDir.split('/'), ...href.split('/')].filter(p => p && p !== '.');
let resolvedParts = [];
for (let part of parts) {
if (part === '..') resolvedParts.pop();
else resolvedParts.push(part);
}
newHref = resolvedParts.join('/');
} else {
newHref = href.substring(1);
}
if (newHref.endsWith('.md')) {
newHref = newHref.slice(0, -3);
}
return `<a href="#${newHref}" title="${title || ''}">${text}</a>`;
}
return originalLink({ href, title, text });
};
marked.use({ renderer });
// Search function
const searchBox = document.getElementById('search-box');
const searchResults = document.getElementById('search-results');
searchBox.addEventListener('keyup', (e) => {
const query = searchBox.value.toLowerCase().trim();
if (!query) {
searchResults.style.display = 'none';
return;
}
const matches = DOCS_INDEX.filter(doc =>
doc.title.toLowerCase().includes(query) ||
doc.meta.toLowerCase().includes(query)
);
if (matches.length > 0) {
searchResults.innerHTML = matches.map(match =>
`<a href="#${match.path}" onclick="closeSearch()">${match.title}<br><span style="font-size:9px;color:#888">${match.path}</span></a>`
).join('');
searchResults.style.display = 'block';
} else {
searchResults.innerHTML = '<div style="padding:10px;font-size:11px;color:#888">No results found</div>';
searchResults.style.display = 'block';
}
});
function closeSearch() {
searchBox.value = '';
searchResults.style.display = 'none';
}
// Close on click outside
document.addEventListener('click', (e) => {
if (!searchBox.contains(e.target) && !searchResults.contains(e.target)) {
searchResults.style.display = 'none';
}
});
// Toggle Mobile Menu
const hamburger = document.getElementById('hamburger');
const sidePanel = document.getElementById('side-panel');
const overlay = document.getElementById('overlay');
function toggleMenu() {
sidePanel.classList.toggle('open');
overlay.style.display = sidePanel.classList.contains('open') ? 'block' : 'none';
}
hamburger.addEventListener('click', toggleMenu);
overlay.addEventListener('click', toggleMenu);
// Close menu when clicking a link
sidePanel.querySelectorAll('a').forEach(link => {
link.addEventListener('click', () => {
if (sidePanel.classList.contains('open')) toggleMenu();
});
});
// Simple SPA Router
async function loadContent() {
let page = window.location.hash.substring(1);
if (!page) page = 'home';
if (page.endsWith('.md')) page = page.slice(0, -3);
let path = page + '.md';
try {
const res = await fetch(path);
if (!res.ok) throw new Error("Not found");
const md = await res.text();
document.getElementById('content').innerHTML = marked.parse(md);
window.scrollTo(0, 0);
} catch (e) {
console.error(e);
document.getElementById('content').innerHTML = `<h1>404 Not Found</h1><p>Could not load <code>${path}</code>.</p><p><a href="#home">Back to Home</a></p>`;
}
}
window.addEventListener('hashchange', loadContent);
loadContent();
</script>
</body>
</html>