forked from duanyytop/agents-radar
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
564 lines (510 loc) · 20.8 KB
/
index.html
File metadata and controls
564 lines (510 loc) · 20.8 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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
<!DOCTYPE html>
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>📡 agents-radar</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap" rel="stylesheet">
<link rel="alternate" type="application/rss+xml" title="agents-radar RSS" href="./feed.xml">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dompurify@3/dist/purify.min.js"></script>
<style>
:root {
--bg: #0B0D14;
--bg-side: #080A10;
--bg-hover: #12151F;
--bg-active: #1A1E2E;
--border: #1E2235;
--text: #C9D1D9;
--muted: #636E82;
--dim: #2E3547;
--accent: #E8A03D;
--accent-bg: rgba(232,160,61,0.10);
--code-bg: #0D1017;
--link: #79B8FF;
}
[data-theme="light"] {
--bg: #FAFBFC;
--bg-side: #F0F2F5;
--bg-hover: #E8ECF1;
--bg-active: #DDE3EA;
--border: #D2D8E0;
--text: #1C1E26;
--muted: #5A6678;
--dim: #B8C2D0;
--accent: #B57200;
--accent-bg: rgba(181,114,0,0.08);
--code-bg: #F0F2F5;
--link: #0451A5;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
font-family: 'Space Mono', 'Courier New', monospace;
background: var(--bg);
color: var(--text);
line-height: 1.5;
overflow: hidden;
}
/* ── Layout ── */
#app { display: flex; flex-direction: column; height: 100vh; }
/* ── Header ── */
#hdr {
display: flex; align-items: center; justify-content: space-between;
padding: 0 20px; height: 50px;
background: var(--bg-side); border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.brand { font-size: 14px; font-weight: 700; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 18px; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 0%,100%{opacity:1} 50%{opacity:0.55} }
.brand em { color: var(--accent); font-style: normal; }
.hdr-right { display: flex; align-items: center; gap: 14px; }
.signal {
width: 6px; height: 6px; border-radius: 50%;
background: var(--accent); box-shadow: 0 0 6px var(--accent);
animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.25} }
#themeBtn, #rssLink {
background: none; border: 1px solid var(--border); color: var(--muted);
padding: 4px 12px; border-radius: 4px; cursor: pointer;
font-family: inherit; font-size: 10px; letter-spacing: 0.06em;
text-decoration: none; display: inline-block;
transition: border-color 0.15s, color 0.15s;
}
#themeBtn:hover, #rssLink:hover { border-color: var(--accent); color: var(--accent); }
/* ── Body ── */
#body { display: flex; flex: 1; overflow: hidden; }
/* ── Sidebar ── */
#sidebar {
width: 222px; flex-shrink: 0;
background: var(--bg-side); border-right: 1px solid var(--border);
overflow-y: auto; padding: 10px 0;
}
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 2px; }
.side-label {
font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
color: var(--dim); padding: 4px 16px 10px;
}
.search-wrap { padding: 0 12px 10px; }
#searchInput {
width: 100%; height: 28px; padding: 0 9px;
border: 1px solid var(--border); border-radius: 4px;
background: var(--bg); color: var(--text);
font-family: inherit; font-size: 11px;
}
#searchInput:focus {
outline: none; border-color: var(--accent);
box-shadow: 0 0 0 2px var(--accent-bg);
}
#searchStatus {
min-height: 14px; margin-top: 4px;
font-size: 9px; letter-spacing: 0.04em; color: var(--dim);
}
.date-hdr {
display: flex; align-items: center; justify-content: space-between;
padding: 5px 14px; cursor: pointer;
font-size: 11px; font-weight: 700; color: var(--muted);
letter-spacing: 0.04em; transition: color 0.15s; user-select: none;
}
.date-hdr:hover { color: var(--text); }
.date-hdr.lit { color: var(--accent); }
.date-hdr.search-hit {
color: var(--accent);
background: linear-gradient(90deg, var(--accent-bg), transparent);
}
.arr { font-size: 8px; transition: transform 0.2s; display: inline-block; }
.date-group.open .arr { transform: rotate(90deg); }
.rpt-list { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.date-group.open .rpt-list { max-height: 400px; }
.rpt-btn {
display: block; width: 100%; padding: 5px 14px 5px 26px;
background: none; border: none; border-left: 2px solid transparent;
text-align: left; cursor: pointer; font-family: inherit; font-size: 11px;
color: var(--muted); transition: color 0.1s, background 0.1s, border-color 0.1s;
}
.rpt-btn:hover { background: var(--bg-hover); color: var(--text); }
.rpt-btn.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-bg); }
.rpt-row { display: flex; align-items: center; padding: 5px 14px 5px 26px; }
.rpt-label { flex: 1; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-btns { display: flex; gap: 3px; flex-shrink: 0; }
.lang-btn {
background: none; border: 1px solid var(--dim); color: var(--dim);
padding: 1px 5px; border-radius: 3px; cursor: pointer;
font-family: inherit; font-size: 9px; letter-spacing: 0.06em;
transition: border-color 0.1s, color 0.1s;
}
.lang-btn:hover { border-color: var(--muted); color: var(--muted); }
.lang-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
/* ── Content ── */
#cwrap { flex: 1; overflow-y: auto; }
#cwrap::-webkit-scrollbar { width: 5px; }
#cwrap::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 3px; }
#content { max-width: 820px; margin: 0 auto; padding: 36px 48px 72px; }
.msg {
display: flex; flex-direction: column; align-items: center;
justify-content: center; gap: 12px;
height: 240px; color: var(--muted); font-size: 11px; letter-spacing: 0.05em;
}
.msg-icon { font-size: 36px; opacity: 0.35; }
@keyframes fadein { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }
.fade { animation: fadein 0.3s ease; }
/* ── Markdown ── */
.md {
font-family: 'Source Serif 4', Georgia, 'PingFang SC', 'Microsoft YaHei', serif;
font-size: 16px; line-height: 1.8; color: var(--text);
}
.md h1 { font-size: 22px; font-weight: 600; margin-bottom: 20px; line-height: 1.3; letter-spacing: -0.02em; }
.md h2 { font-size: 17px; font-weight: 600; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.md h4 { font-size: 13px; font-weight: 700; margin: 16px 0 6px; color: var(--muted); font-family: 'Space Mono', monospace; letter-spacing: 0.03em; }
.md p { margin-bottom: 12px; }
.md a { color: var(--link); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md strong { font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.md ul, .md ol { padding-left: 22px; margin-bottom: 12px; }
.md li { margin-bottom: 4px; }
.md li > ul, .md li > ol { margin-top: 4px; margin-bottom: 0; }
.md blockquote { border-left: 3px solid var(--accent); padding: 6px 16px; margin: 12px 0; color: var(--muted); font-style: italic; }
.md code {
font-family: 'Space Mono', monospace; font-size: 12.5px;
background: var(--code-bg); border: 1px solid var(--border);
padding: 1px 6px; border-radius: 3px;
}
.md pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 16px; overflow-x: auto; margin: 14px 0; }
.md pre code { background: none; border: none; padding: 0; font-size: 12px; }
.md table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; font-family: 'Space Mono', monospace; }
.md th { background: var(--code-bg); border: 1px solid var(--border); padding: 7px 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.md td { border: 1px solid var(--border); padding: 7px 12px; vertical-align: top; }
.md tr:nth-child(even) td { background: var(--bg-hover); }
.md details { border: 1px solid var(--border); border-radius: 6px; margin: 10px 0; overflow: hidden; }
.md summary {
cursor: pointer; padding: 8px 14px;
font-family: 'Space Mono', monospace; font-size: 12px; color: var(--muted);
background: var(--code-bg); user-select: none; list-style: none;
display: flex; align-items: center; gap: 8px; transition: color 0.15s;
}
.md summary::-webkit-details-marker { display: none; }
.md summary::before { content: '▶'; font-size: 8px; flex-shrink: 0; }
.md details[open] summary::before { content: '▼'; }
.md summary:hover { color: var(--text); }
.md details > *:not(summary) { padding: 12px 14px; }
/* ── Mobile ── */
#mob-toggle { display: none; }
@media (max-width: 680px) {
body { overflow: auto; }
#app { height: auto; min-height: 100vh; }
#body { flex-direction: column; overflow: visible; }
#cwrap { overflow: visible; }
#sidebar {
width: 100%; border-right: none; border-bottom: 1px solid var(--border);
max-height: 48px; overflow: hidden; padding: 0;
transition: max-height 0.3s ease;
}
#sidebar.open { max-height: 60vh; overflow-y: auto; padding: 0 0 8px; }
#mob-toggle {
display: flex; align-items: center; gap: 8px;
height: 48px; padding: 0 16px; cursor: pointer;
font-size: 11px; color: var(--muted); border-bottom: 1px solid transparent;
transition: color 0.15s;
}
#mob-toggle:hover { color: var(--text); }
#sidebar.open #mob-toggle { border-bottom-color: var(--border); }
.side-label { margin-top: 8px; }
#content { padding: 20px 16px 48px; }
.md { font-size: 15px; }
}
</style>
</head>
<body>
<div id="app">
<div id="hdr">
<div class="brand">
<span class="brand-icon">📡</span>
<span>agents-<em>radar</em></span>
</div>
<div class="hdr-right">
<div class="signal"></div>
<a id="rssLink" href="./feed.xml" title="RSS Feed">⊕ RSS</a>
<button id="themeBtn">◐ LIGHT</button>
</div>
</div>
<div id="body">
<div id="sidebar">
<div id="mob-toggle" onclick="document.getElementById('sidebar').classList.toggle('open')">
☰ Chọn báo cáo
</div>
<div class="side-label">REPORTS</div>
<div class="search-wrap">
<input id="searchInput" type="search" placeholder="Tìm kiếm, ví dụ Claude">
<div id="searchStatus"></div>
</div>
<div id="nav"></div>
</div>
<div id="cwrap">
<div id="content">
<div class="msg"><div class="msg-icon">📡</div><div>Đang tải…</div></div>
</div>
</div>
</div>
</div>
<script>
marked.use({ breaks: true, gfm: true });
// Allow <details> and <summary> which DOMPurify strips by default
DOMPurify.addHook('uponSanitizeElement', (node, data) => {
if (data.tagName === 'details' || data.tagName === 'summary') {
data.allowedTags[data.tagName] = true;
}
});
function renderMarkdown(raw) {
const html = marked.parse(raw);
return DOMPurify.sanitize(html, {
ADD_TAGS: ['details', 'summary'],
ADD_ATTR: ['open'],
});
}
const LABELS = {
'ai-cli': 'Công cụ AI CLI',
'ai-cli-en': 'AI CLI Tools',
'ai-cli-vi': 'Công cụ AI CLI',
'ai-agents': 'Hệ sinh thái AI Agents',
'ai-agents-en': 'AI Agents Ecosystem',
'ai-agents-vi': 'Hệ sinh thái AI Agents',
'ai-web': 'Cập nhật OpenAI & Anthropic',
'ai-web-en': 'OpenAI & Anthropic Updates',
'ai-web-vi': 'Cập nhật OpenAI & Anthropic',
'ai-trending': 'Xu hướng AI GitHub',
'ai-trending-en': 'GitHub AI Trends',
'ai-trending-vi': 'Xu hướng AI GitHub',
'ai-hn': 'Cộng đồng HN',
'ai-hn-en': 'HN Community Digest',
'ai-hn-vi': 'Cộng đồng HN',
};
// ── Theme ──
const htmlEl = document.documentElement;
const themeBtn = document.getElementById('themeBtn');
let theme = localStorage.getItem('ar-theme') || 'dark';
function applyTheme(t) {
theme = t;
htmlEl.dataset.theme = t;
themeBtn.textContent = t === 'dark' ? '◐ LIGHT' : '● DARK';
localStorage.setItem('ar-theme', t);
}
applyTheme(theme);
themeBtn.onclick = () => applyTheme(theme === 'dark' ? 'light' : 'dark');
// ── Routing ──
function getHash() {
const [date, report] = location.hash.slice(1).split('/');
return /^\d{4}-\d{2}-\d{2}$/.test(date) && report ? { date, report } : null;
}
// ── State ──
let currentKey = null;
let searchIndex = null;
let searchReady = false;
let searchQuery = '';
let searchDebounce = null;
const searchInput = document.getElementById('searchInput');
const searchStatus = document.getElementById('searchStatus');
function setSearchStatus(text) {
searchStatus.textContent = text || '';
}
function applyDateSearch(query) {
const needle = query.trim().toLowerCase();
let hits = 0;
document.querySelectorAll('.date-group').forEach((grp) => {
const hdr = grp.querySelector('.date-hdr');
if (!hdr) return;
if (!needle || !searchIndex) {
hdr.classList.remove('search-hit');
return;
}
const text = searchIndex.get(grp.dataset.date) || '';
const matched = text.includes(needle);
hdr.classList.toggle('search-hit', matched);
if (matched) hits += 1;
});
if (!needle) {
setSearchStatus('');
} else if (!searchReady) {
setSearchStatus('Đang tạo chỉ mục…');
} else {
setSearchStatus(`Khớp ${hits} ngày`);
}
}
async function buildSearchIndex(dates) {
const index = new Map();
await Promise.all(
dates.map(async ({ date, reports }) => {
const chunks = await Promise.all(
reports.map(async (report) => {
try {
const res = await fetch(`./digests/${date}/${report}.md`);
if (!res.ok) return '';
return await res.text();
} catch {
return '';
}
})
);
index.set(date, chunks.join('\n').toLowerCase());
})
);
return index;
}
function initSearch(dates) {
searchReady = false;
setSearchStatus('Đang chuẩn bị chỉ mục…');
buildSearchIndex(dates).then((index) => {
searchIndex = index;
searchReady = true;
applyDateSearch(searchQuery);
if (!searchQuery.trim()) setSearchStatus('');
});
}
searchInput.addEventListener('input', () => {
searchQuery = searchInput.value;
clearTimeout(searchDebounce);
searchDebounce = setTimeout(() => applyDateSearch(searchQuery), 120);
});
function setContent(html) {
document.getElementById('content').innerHTML = html;
}
async function loadReport(date, report, push = true) {
const key = `${date}/${report}`;
if (key === currentKey) return;
currentKey = key;
if (push) history.pushState(null, '', `#${key}`);
// Sync sidebar
document.querySelectorAll('.rpt-btn').forEach(b => b.classList.toggle('active', b.dataset.key === key));
document.querySelectorAll('.lang-btn').forEach(b => b.classList.toggle('active', b.dataset.key === key));
document.querySelectorAll('.date-hdr').forEach(h => {
const grp = h.closest('.date-group');
const hasActive = grp.querySelector('.rpt-btn.active') || grp.querySelector('.lang-btn.active');
h.classList.toggle('lit', !!hasActive);
});
document.querySelectorAll('.date-group').forEach(g => {
if (g.dataset.date === date) g.classList.add('open');
});
// Close mobile sidebar
document.getElementById('sidebar').classList.remove('open');
const cwrap = document.getElementById('cwrap');
setContent('<div class="msg"><div class="msg-icon">⏳</div><div>Loading…</div></div>');
cwrap.scrollTop = 0;
try {
const res = await fetch(`./digests/${date}/${report}.md`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const raw = await res.text();
const safe = renderMarkdown(raw);
setContent(`<div class="md fade">${safe}</div>`);
} catch (e) {
setContent(`<div class="msg"><div class="msg-icon">⚠️</div><div>Tải thất bại: ${e.message}</div></div>`);
}
}
function buildNav(dates) {
const nav = document.getElementById('nav');
dates.forEach(({ date, reports }, i) => {
const grp = document.createElement('div');
grp.className = 'date-group' + (i === 0 ? ' open' : '');
grp.dataset.date = date;
const hdr = document.createElement('div');
hdr.className = 'date-hdr';
const dateText = document.createTextNode(date + '\u00a0');
const arrSpan = document.createElement('span');
arrSpan.className = 'arr';
arrSpan.textContent = '▶';
hdr.appendChild(dateText);
hdr.appendChild(arrSpan);
hdr.onclick = () => grp.classList.toggle('open');
const list = document.createElement('div');
list.className = 'rpt-list';
// Filter out -en and -vi reports from base list, process as groups
const baseReports = reports.filter(r => !r.endsWith('-en') && !r.endsWith('-vi'));
baseReports.forEach(r => {
const enKey = r + '-en';
const viKey = r + '-vi';
const hasEn = reports.includes(enKey);
const hasVi = reports.includes(viKey);
if (hasEn || hasVi) {
// Render as a row with label + language buttons
const row = document.createElement('div');
row.className = 'rpt-row';
const label = document.createElement('span');
label.className = 'rpt-label';
const baseLabel = LABELS[r] || r;
label.textContent = baseLabel;
label.title = baseLabel;
const btns = document.createElement('div');
btns.className = 'lang-btns';
const zhBtn = document.createElement('button');
zhBtn.className = 'lang-btn';
zhBtn.dataset.key = `${date}/${r}`;
zhBtn.textContent = 'ZH';
zhBtn.onclick = () => loadReport(date, r);
btns.append(zhBtn);
if (hasEn) {
const enBtn = document.createElement('button');
enBtn.className = 'lang-btn';
enBtn.dataset.key = `${date}/${enKey}`;
enBtn.textContent = 'EN';
enBtn.onclick = () => loadReport(date, enKey);
btns.append(enBtn);
}
if (hasVi) {
const viBtn = document.createElement('button');
viBtn.className = 'lang-btn';
viBtn.dataset.key = `${date}/${viKey}`;
viBtn.textContent = 'VI';
viBtn.onclick = () => loadReport(date, viKey);
btns.append(viBtn);
}
row.append(label, btns);
list.appendChild(row);
} else {
// No variants — render as single button
const btn = document.createElement('button');
btn.className = 'rpt-btn';
btn.dataset.key = `${date}/${r}`;
btn.textContent = LABELS[r] || r;
btn.onclick = () => loadReport(date, r);
list.appendChild(btn);
}
});
grp.append(hdr, list);
nav.appendChild(grp);
});
}
window.addEventListener('popstate', () => {
const h = getHash();
if (h) loadReport(h.date, h.report, false);
});
// ── Init ──
(async () => {
try {
const res = await fetch('./manifest.json');
if (!res.ok) throw new Error('manifest.json not found');
const { dates } = await res.json();
if (!dates?.length) throw new Error('manifest is empty');
buildNav(dates);
initSearch(dates);
const hash = getHash();
const first = dates[0];
if (hash && dates.find(d => d.date === hash.date && d.reports.includes(hash.report))) {
loadReport(hash.date, hash.report, false);
} else if (first?.reports?.length) {
const r0 = first.reports.find(r => r.endsWith('-vi')) || first.reports[0];
history.replaceState(null, '', `#${first.date}/${r0}`);
loadReport(first.date, r0, false);
}
} catch (e) {
document.getElementById('nav').innerHTML =
'<div class="msg" style="height:80px;font-size:10px">⚠️ ' + e.message + '</div>';
setContent('<div class="msg"><div class="msg-icon">📡</div><div>Không thể tải manifest.json</div></div>');
}
})();
</script>
</body>
</html>