feat: LLM 论文图书馆 — 初始提交
- FastAPI 后端: REST API + Bearer Token 鉴权 + PDF 代理 - 180 篇论文数据 (data/papers.json): 9 模块、32 子领域 - 前端: 数据驱动、卡片径向渐变光效、PDF 页面内阅读 - 底部状态栏: arXiv/HF 连通性检测 - PDF 加载: arXiv 优先(5s超时) → HK 本地兜底 - Docker 化部署 (Dockerfile + start.sh + nginx.conf) - arXiv + HF 批量下载器 (api/downloader.py)
This commit is contained in:
252
static/app.js
Normal file
252
static/app.js
Normal file
@@ -0,0 +1,252 @@
|
||||
/**
|
||||
* LLM 论文图书馆 — 前端 JS
|
||||
* 页面加载检测 arXiv/HF 连通性 → 底部状态条
|
||||
* 点击论文:arXiv 连通? → iframe 直连 arXiv → 5s 超时 → HK 兜底
|
||||
* IDM 拦就拦,不额外对抗
|
||||
*/
|
||||
|
||||
const API = '/api';
|
||||
|
||||
let modules = {};
|
||||
let moduleData = {};
|
||||
let pdfTimeout = null;
|
||||
let networkStatus = {};
|
||||
|
||||
const $ = (sel) => document.querySelector(sel);
|
||||
const $$ = (sel) => document.querySelectorAll(sel);
|
||||
const TAG_CLASS = { '起点':'tag-start','关键节点':'tag-milestone','前沿':'tag-frontier','前瞻':'tag-forward','支线':'tag-branch' };
|
||||
|
||||
// ══════════════════ INIT ═══════════════════════════════
|
||||
async function init() {
|
||||
buildStatusBar();
|
||||
try {
|
||||
const resp = await fetch(`${API}/modules`);
|
||||
const mods = await resp.json();
|
||||
for (const m of mods) modules[m.id] = m;
|
||||
renderCards(mods);
|
||||
attachGlowTracking();
|
||||
} catch (e) { console.error(e); }
|
||||
checkSources();
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Escape') {
|
||||
if ($('#pdfOverlay')?.classList.contains('open')) closePdf();
|
||||
else if ($('#overlay').classList.contains('open')) closeModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ══════════════════ STATUS BAR ════════════════════════
|
||||
function buildStatusBar() {
|
||||
const bar = document.createElement('div');
|
||||
bar.id = 'statusBar'; bar.className = 'status-bar';
|
||||
bar.innerHTML = `<span class="status-label">连通性检测</span>
|
||||
<span class="status-item" id="status-arxiv"><span class="status-dot"></span> arXiv <span class="status-ms" id="ms-arxiv">—</span></span>
|
||||
<span class="status-item" id="status-hf"><span class="status-dot"></span> HuggingFace <span class="status-ms" id="ms-hf">—</span></span>`;
|
||||
document.body.appendChild(bar);
|
||||
}
|
||||
|
||||
function setStatus(id, ok, ms, aborted) {
|
||||
networkStatus[id.replace('status-','')] = ok;
|
||||
const el = document.getElementById(id); if (!el) return;
|
||||
el.querySelector('.status-dot').className = 'status-dot ' + (ok ? 'status-ok' : 'status-fail');
|
||||
const msEl = document.getElementById('ms-'+id.replace('status-',''));
|
||||
if (msEl) {
|
||||
if (aborted) msEl.textContent = '超时';
|
||||
else if (ok) msEl.textContent = ms+'ms';
|
||||
else msEl.textContent = '—';
|
||||
}
|
||||
}
|
||||
|
||||
async function checkSource(name, url, statusId) {
|
||||
const start = performance.now();
|
||||
let aborted = false;
|
||||
const probeUrl = url + '?_=' + Date.now();
|
||||
try {
|
||||
const ctrl = new AbortController();
|
||||
setTimeout(() => { aborted = true; ctrl.abort(); }, 4000);
|
||||
await fetch(probeUrl, { mode: 'no-cors', signal: ctrl.signal, cache: 'no-store' });
|
||||
const ms = Math.round(performance.now() - start);
|
||||
setStatus(statusId, true, ms, false);
|
||||
} catch {
|
||||
const ms = Math.round(performance.now() - start);
|
||||
setStatus(statusId, false, ms, aborted);
|
||||
}
|
||||
}
|
||||
|
||||
function checkSources() {
|
||||
checkSource('arxiv', 'https://arxiv.org/favicon.ico', 'status-arxiv');
|
||||
checkSource('hf', 'https://huggingface.co/favicon.ico', 'status-hf');
|
||||
}
|
||||
|
||||
// ══════════════════ GLOW ══════════════════════════════
|
||||
function attachGlowTracking() {
|
||||
$$('.card').forEach(card => {
|
||||
card.addEventListener('mousemove', e => {
|
||||
const r = card.getBoundingClientRect();
|
||||
card.style.setProperty('--mx', (e.clientX-r.left)/r.width*100+'%');
|
||||
card.style.setProperty('--my', (e.clientY-r.top)/r.height*100+'%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ══════════════════ CARDS → MODAL → PAPERS ═══════════
|
||||
function renderCards(mods) {
|
||||
$('#moduleGrid').innerHTML = mods.map(m =>
|
||||
`<div class="card card-${m.id}" onclick="openModule('${m.id}')">
|
||||
<div class="card-header"><span class="card-icon">${m.icon}</span> ${m.name}</div>
|
||||
<div class="card-desc">${m.desc}</div>
|
||||
<div class="card-badge">${m.area_count} 子领域 · ${m.paper_count} 篇</div>
|
||||
</div>`).join('');
|
||||
}
|
||||
|
||||
async function openModule(modId) {
|
||||
let data = moduleData[modId];
|
||||
if (!data) {
|
||||
try { data = await (await fetch(`${API}/modules/${modId}`)).json(); moduleData[modId]=data; }
|
||||
catch { return; }
|
||||
}
|
||||
const mod = modules[modId];
|
||||
$('#modalTitle').innerHTML = `<span class="card-icon">${mod?.icon||''}</span> ${data.name}`;
|
||||
$('#modalSubtitle').textContent = data.desc||'';
|
||||
const areas = data.areas||[];
|
||||
$('#modalTabs').innerHTML = areas.map((a,i)=>`<button class="tab ${i?'':'active'}" onclick="switchArea(${i})">${a.name}</button>`).join('');
|
||||
if (areas.length) { $('#modalTabs').dataset.areaIdx='0'; renderPapers(areas[0]); }
|
||||
$('#overlay').classList.add('open');
|
||||
}
|
||||
|
||||
function switchArea(idx) {
|
||||
const data = Object.values(moduleData).find(d => d.areas && d.areas[idx]);
|
||||
if (!data) return;
|
||||
$$('#modalTabs .tab').forEach((t,i)=>t.classList.toggle('active',i===idx));
|
||||
renderPapers(data.areas[idx]);
|
||||
}
|
||||
|
||||
function closeModal() { $('#overlay').classList.remove('open'); }
|
||||
|
||||
function renderPapers(area) {
|
||||
const s = (l, ps, c) => ps.length ? `<div class="section-label ${c}">${l}</div>`+ps.map(renderPaper).join('') : '';
|
||||
$('#modalContent').innerHTML =
|
||||
s('📌 主线论文', area.mainline||[],'mainline') +
|
||||
s('🌿 支线论文', area.branches||[],'branch') +
|
||||
s('🔮 前瞻探索', area.forward||[],'forward') ||
|
||||
'<p style="color:var(--text-dim);padding:20px;">暂无论文数据</p>';
|
||||
}
|
||||
|
||||
function renderPaper(p) {
|
||||
const pdfUrl = getPdfLink(p);
|
||||
const tags = (p.tags||[]).map(t=>`<span class="paper-tag ${TAG_CLASS[t]||'tag-branch'}">${t}</span>`).join(' ');
|
||||
const links = [];
|
||||
if (pdfUrl) links.push(`<button class="paper-link" data-pdf="${encodeURIComponent(pdfUrl)}" data-title="${encodeURIComponent(p.title)}" onclick="openPdfBtn(this)">📄 阅读</button>`);
|
||||
else if (p.arxiv) links.push(`<a class="paper-link" href="https://arxiv.org/abs/${p.arxiv}" target="_blank">📋 arXiv</a>`);
|
||||
return `<div class="paper-item"><div class="paper-year">${p.year||'—'}</div><div class="paper-body">
|
||||
<div class="paper-title">${p.title}</div>
|
||||
<div class="paper-meta"><span>${p.authors||''}</span>${p.venue?`<span class="paper-venue">${p.venue}</span>`:''}${tags}</div>
|
||||
<div class="paper-links">${links.join('')}</div>
|
||||
</div></div>`;
|
||||
}
|
||||
|
||||
function getPdfLink(p) {
|
||||
// 有 pdf 字段 → 返回外部源 URL(arxiv 直连 / HF 直连)
|
||||
if (p.pdf) return p.pdf;
|
||||
// 只有 arxiv id → arXiv 直连
|
||||
if (p.arxiv) return `https://arxiv.org/pdf/${p.arxiv}.pdf`;
|
||||
return null;
|
||||
}
|
||||
|
||||
function openPdfBtn(btn) { openPdf(btn.dataset.pdf, btn.dataset.title); }
|
||||
|
||||
// ══════════════════ PDF VIEWER ════════════════════════
|
||||
function getLocalUrl(extUrl) {
|
||||
// arXiv
|
||||
const am = extUrl.match(/arxiv\.org\/pdf\/(\d+\.\d+)/);
|
||||
if (am) return `/papers/arxiv/${am[1]}.pdf`;
|
||||
// HuggingFace
|
||||
if (extUrl.includes('huggingface.co')) {
|
||||
const name = decodeURIComponent(extUrl).split('/').pop().replace('.pdf','');
|
||||
return `/papers/hf/${name}.pdf`;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function openPdf(url, title) {
|
||||
const decodedUrl = decodeURIComponent(url);
|
||||
const decodedTitle = decodeURIComponent(title);
|
||||
|
||||
// 构建 overlay
|
||||
if (!$('#pdfOverlay')) {
|
||||
const div = document.createElement('div'); div.id='pdfOverlay'; div.className='pdf-overlay';
|
||||
div.innerHTML = `<div class="pdf-container" id="pdfContainer">
|
||||
<div class="pdf-toolbar"><span id="pdfTitle">PDF</span><span id="pdfStatus" style="color:var(--orange);font-size:0.8em;margin-left:8px;"></span>
|
||||
<button onclick="window.open($('#pdfFrame').src || currentPdf,'_blank')">🔗 新窗口</button>
|
||||
<button class="pdf-close" onclick="closePdf()">×</button></div>
|
||||
<iframe class="pdf-frame" id="pdfFrame" src=""></iframe></div>`;
|
||||
document.body.appendChild(div);
|
||||
div.addEventListener('click', e => { if (e.target===div) closePdf(); });
|
||||
}
|
||||
|
||||
if (pdfTimeout) { clearTimeout(pdfTimeout); pdfTimeout=null; }
|
||||
$('#pdfTitle').textContent = decodedTitle;
|
||||
$('#pdfStatus').textContent = '';
|
||||
const frame = $('#pdfFrame');
|
||||
let loaded = false;
|
||||
frame.src = 'about:blank';
|
||||
frame.onload = ()=>{ loaded=true; if(pdfTimeout){clearTimeout(pdfTimeout);pdfTimeout=null;} $('#pdfStatus').textContent=''; };
|
||||
|
||||
const hkLocalUrl = getLocalUrl(decodedUrl);
|
||||
const isArxiv = decodedUrl.includes('arxiv.org');
|
||||
const isHF = decodedUrl.includes('huggingface.co');
|
||||
const isRemote = isArxiv || isHF;
|
||||
const sourceOk = isArxiv ? networkStatus['arxiv'] !== false
|
||||
: isHF ? networkStatus['hf'] !== false
|
||||
: false;
|
||||
|
||||
// 弹框先出
|
||||
$('#pdfOverlay').classList.add('open');
|
||||
|
||||
if (isRemote && sourceOk) {
|
||||
// 远程源 iframe 直连
|
||||
loaded = false;
|
||||
$('#pdfStatus').textContent = isArxiv ? '🌐 arXiv 加载中...' : '🤗 HuggingFace 加载中...';
|
||||
frame.src = decodedUrl;
|
||||
|
||||
pdfTimeout = setTimeout(() => {
|
||||
if (loaded) return;
|
||||
if (!hkLocalUrl) { $('#pdfStatus').textContent='⚠️ 超时'; return; }
|
||||
$('#pdfStatus').textContent = '⏳ 超时,走 HK 服务器...';
|
||||
frame.src = hkLocalUrl;
|
||||
}, 5000);
|
||||
} else {
|
||||
// 直接走 HK
|
||||
$('#pdfStatus').textContent = hkLocalUrl ? '📂 HK 服务器加载中...' : '⏳ 加载中...';
|
||||
frame.src = hkLocalUrl || decodedUrl;
|
||||
}
|
||||
}
|
||||
|
||||
function closePdf() {
|
||||
if (pdfTimeout) { clearTimeout(pdfTimeout); pdfTimeout=null; }
|
||||
$('#pdfOverlay').classList.remove('open');
|
||||
$('#pdfFrame').src = '';
|
||||
}
|
||||
|
||||
// ══════════════════ SEARCH ════════════════════════════
|
||||
function searchPapers(q) {
|
||||
q=(q||'').toLowerCase().trim();
|
||||
if (q.length<2) { $$('.card').forEach(c=>c.style.outline=''); return; }
|
||||
fetch(`${API}/papers?q=${encodeURIComponent(q)}&limit=10`).then(r=>r.json()).then(ps=>{
|
||||
const matched = new Set(ps.map(p=>p.module_id));
|
||||
$$('.card').forEach(c=>{
|
||||
const m=[...c.classList].find(x=>x.startsWith('card-'))?.replace('card-','');
|
||||
c.style.outline=matched.has(m)?'2px solid var(--green)':'';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ══════════════════ EVENTS ════════════════════════════
|
||||
if (typeof document !== 'undefined') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
init();
|
||||
$('.search-input').addEventListener('input', e => searchPapers(e.target.value));
|
||||
$('#modalClose').addEventListener('click', closeModal);
|
||||
$('#overlay').addEventListener('click', e => { if (e.target===$('#overlay')) closeModal(); });
|
||||
});
|
||||
}
|
||||
34
static/index.html
Normal file
34
static/index.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LLM 论文图书馆</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<h1>🧠 LLM 论文图书馆</h1>
|
||||
</div>
|
||||
|
||||
<div class="search-wrap">
|
||||
<span class="search-icon">🔍</span>
|
||||
<input class="search-input" placeholder="搜索论文标题、作者、关键词..." autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="grid" id="moduleGrid"></div>
|
||||
|
||||
<div class="overlay" id="overlay">
|
||||
<div class="modal" id="modal">
|
||||
<button class="modal-close" id="modalClose">×</button>
|
||||
<div class="modal-title" id="modalTitle"></div>
|
||||
<div class="modal-subtitle" id="modalSubtitle"></div>
|
||||
<div class="tabs" id="modalTabs"></div>
|
||||
<div id="modalContent"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
7
static/pdf.min.js
vendored
Normal file
7
static/pdf.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head><title>404 Not Found</title></head>
|
||||
<body>
|
||||
<center><h1>404 Not Found</h1></center>
|
||||
<hr><center>nginx</center>
|
||||
</body>
|
||||
</html>
|
||||
313
static/style.css
Normal file
313
static/style.css
Normal file
@@ -0,0 +1,313 @@
|
||||
/* LLM 论文图书馆 — 前端样式 (提取自 llm_library.html) */
|
||||
:root {
|
||||
--bg: #0a0e14;
|
||||
--bg-card: #12171f;
|
||||
--bg-modal: #0d1117;
|
||||
--border: #1e293b;
|
||||
--text: #c9d1d9;
|
||||
--text-dim: #8b949e;
|
||||
--text-bright: #e6edf3;
|
||||
--blue: #58a6ff; --blue-bg: #0d1b2a; --blue-border: #1a3a5c;
|
||||
--green: #3fb950; --green-bg: #0d1f14; --green-border: #1a3d1a;
|
||||
--red: #f85149; --red-bg: #1f0d0d; --red-border: #3d1a1a;
|
||||
--purple: #bc8cff; --purple-bg: #190d2a; --purple-border: #2d1a3d;
|
||||
--orange: #d2991d; --orange-bg: #1f160d; --orange-border: #3d2d1a;
|
||||
--cyan: #39d2c0; --cyan-bg: #0d1f1c; --cyan-border: #1a3d3a;
|
||||
--pink: #f778ba; --pink-bg: #1f0d1a; --pink-border: #3d1a2d;
|
||||
--yellow: #e3b341; --yellow-bg: #1f1a0d; --yellow-border: #3d3d1a;
|
||||
--teal: #79c0ff; --teal-bg: #0d1d2d; --teal-border: #1a2d3d;
|
||||
--radius: 10px; --radius-sm: 6px; --transition: 0.2s ease;
|
||||
}
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
background: var(--bg); color: var(--text);
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
|
||||
padding: 32px 24px 60px; min-height: 100vh;
|
||||
}
|
||||
|
||||
.header { text-align: center; margin-bottom: 32px; }
|
||||
.header h1 {
|
||||
font-size: 1.5em;
|
||||
background: linear-gradient(135deg, var(--blue), var(--purple), var(--pink));
|
||||
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
|
||||
}
|
||||
.header p { color: var(--text-dim); font-size: 0.85em; margin-top: 4px; }
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
||||
gap: 16px; max-width: 1400px; margin: 0 auto;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--bg-card); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); padding: 18px 16px;
|
||||
cursor: pointer; position: relative; overflow: hidden;
|
||||
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
||||
}
|
||||
.card::before {
|
||||
content: ''; position: absolute; inset: 0;
|
||||
background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
|
||||
rgba(88,166,255,0.12) 0%, transparent 60%);
|
||||
opacity: 0; transition: opacity 0.3s ease;
|
||||
pointer-events: none; z-index: 0;
|
||||
}
|
||||
.card:hover::before { opacity: 1; }
|
||||
.card:hover {
|
||||
border-color: rgba(88,166,255,0.4);
|
||||
box-shadow: 0 0 20px rgba(88,166,255,0.08), inset 0 0 20px rgba(88,166,255,0.03);
|
||||
}
|
||||
.card-header, .card-desc, .card-badge { position: relative; z-index: 1; }
|
||||
.card-icon { font-size: 1.3em; }
|
||||
.card-desc { font-size: 0.8em; color: var(--text-dim); line-height: 1.5; }
|
||||
.card-badge {
|
||||
position: absolute; top: 12px; right: 12px;
|
||||
font-size: 0.7em; background: rgba(255,255,255,.06);
|
||||
padding: 2px 8px; border-radius: 10px; color: var(--text-dim);
|
||||
}
|
||||
|
||||
.card-arch { border-left: 3px solid var(--blue); }
|
||||
.card-multi { border-left: 3px solid var(--cyan); }
|
||||
.card-data { border-left: 3px solid var(--green); }
|
||||
.card-pretrain { border-left: 3px solid var(--red); }
|
||||
.card-post { border-left: 3px solid var(--purple);}
|
||||
.card-compress { border-left: 3px solid var(--orange);}
|
||||
.card-deploy { border-left: 3px solid var(--teal); }
|
||||
.card-agent { border-left: 3px solid var(--pink); }
|
||||
.card-eval { border-left: 3px solid var(--yellow);}
|
||||
|
||||
.card-arch .card-header { color: var(--blue); }
|
||||
.card-multi .card-header { color: var(--cyan); }
|
||||
.card-data .card-header { color: var(--green); }
|
||||
.card-pretrain .card-header { color: var(--red); }
|
||||
.card-post .card-header { color: var(--purple);}
|
||||
.card-compress .card-header { color: var(--orange);}
|
||||
.card-deploy .card-header { color: var(--teal); }
|
||||
.card-agent .card-header { color: var(--pink); }
|
||||
.card-eval .card-header { color: var(--yellow);}
|
||||
|
||||
/* Modal */
|
||||
.overlay {
|
||||
display: none; position: fixed; inset: 0;
|
||||
background: rgba(0,0,0,.7); z-index: 100;
|
||||
justify-content: center; align-items: flex-start;
|
||||
padding: 40px 16px; overflow-y: auto;
|
||||
}
|
||||
.overlay.open { display: flex; }
|
||||
|
||||
.modal {
|
||||
background: var(--bg-modal); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); width: 100%; max-width: 960px;
|
||||
padding: 28px 24px; position: relative;
|
||||
animation: fadeIn 0.2s ease;
|
||||
}
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
|
||||
.modal-close {
|
||||
position: absolute; top: 16px; right: 16px;
|
||||
background: none; border: none; color: var(--text-dim);
|
||||
font-size: 1.4em; cursor: pointer;
|
||||
width: 36px; height: 36px; border-radius: 50%;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.modal-close:hover { background: rgba(255,255,255,.06); color: var(--text); }
|
||||
.modal-title { font-size: 1.2em; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
|
||||
.modal-subtitle { color: var(--text-dim); font-size: 0.85em; margin-bottom: 24px; }
|
||||
|
||||
/* Tabs */
|
||||
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
|
||||
.tab {
|
||||
padding: 8px 16px; font-size: 0.85em; color: var(--text-dim);
|
||||
cursor: pointer; border: none; background: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
transition: color var(--transition), border-color var(--transition);
|
||||
}
|
||||
.tab:hover { color: var(--text); }
|
||||
.tab.active { color: var(--text-bright); border-bottom-color: var(--blue); font-weight: 600; }
|
||||
|
||||
/* Section labels */
|
||||
.section-label {
|
||||
font-size: 0.78em; font-weight: 700; text-transform: uppercase;
|
||||
letter-spacing: 1px; margin: 16px 0 8px; padding: 4px 0;
|
||||
}
|
||||
.section-label.mainline { color: var(--blue); border-bottom: 1px solid var(--blue-border); }
|
||||
.section-label.branch { color: var(--orange); border-bottom: 1px solid var(--orange-border); }
|
||||
.section-label.forward { color: var(--purple); border-bottom: 1px solid var(--purple-border); }
|
||||
|
||||
/* Paper item */
|
||||
.paper-item {
|
||||
display: flex; align-items: flex-start; gap: 12px;
|
||||
padding: 10px 12px; border-radius: var(--radius-sm);
|
||||
margin-bottom: 4px; transition: background var(--transition);
|
||||
}
|
||||
.paper-item:hover { background: rgba(255,255,255,.03); }
|
||||
.paper-year { flex-shrink: 0; width: 42px; font-size: 0.75em; color: var(--text-dim); font-variant-numeric: tabular-nums; text-align: right; padding-top: 1px; }
|
||||
.paper-body { flex: 1; min-width: 0; }
|
||||
.paper-title { font-size: 0.9em; font-weight: 600; color: var(--text-bright); line-height: 1.4; margin-bottom: 2px; }
|
||||
.paper-meta { font-size: 0.75em; color: var(--text-dim); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
|
||||
.paper-venue { color: var(--green); font-weight: 500; }
|
||||
|
||||
/* Tags */
|
||||
.paper-tag { display: inline-block; font-size: 0.7em; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
|
||||
.tag-start { background: #1a3a5c; color: var(--blue); }
|
||||
.tag-milestone{ background: #3d1a1a; color: var(--red); }
|
||||
.tag-frontier { background: #1a3d1a; color: var(--green);}
|
||||
.tag-forward { background: #2d1a3d; color: var(--purple);}
|
||||
.tag-branch { background: #3d2d1a; color: var(--orange);}
|
||||
|
||||
/* Links */
|
||||
.paper-links { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
|
||||
.paper-link {
|
||||
font-size: 0.72em; color: var(--blue); text-decoration: none;
|
||||
padding: 2px 8px; border: 1px solid var(--blue-border);
|
||||
border-radius: 4px; transition: background var(--transition); cursor: pointer;
|
||||
}
|
||||
.paper-link:hover { background: var(--blue-bg); }
|
||||
|
||||
/* Search */
|
||||
.search-wrap { max-width: 600px; margin: 0 auto 28px; position: relative; }
|
||||
.search-input {
|
||||
width: 100%; padding: 10px 16px 10px 38px;
|
||||
background: var(--bg-card); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); color: var(--text); font-size: 0.9em; outline: none;
|
||||
}
|
||||
.search-input:focus { border-color: var(--blue); }
|
||||
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
|
||||
|
||||
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } .modal { padding: 20px 16px; } }
|
||||
|
||||
/* PDF viewer */
|
||||
.pdf-overlay {
|
||||
display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
|
||||
z-index: 200; justify-content: center; align-items: center;
|
||||
transition: justify-content 0.3s ease;
|
||||
}
|
||||
.pdf-overlay.open { display: flex; }
|
||||
.pdf-container {
|
||||
width: 90vw; height: 90vh; background: #fff; border-radius: var(--radius);
|
||||
display: flex; flex-direction: column; overflow: hidden;
|
||||
}
|
||||
.pdf-toolbar {
|
||||
display: flex; align-items: center; gap: 12px; padding: 10px 16px;
|
||||
background: #1a1a2e; color: #eee; font-size: 0.85em;
|
||||
}
|
||||
.pdf-toolbar button {
|
||||
background: rgba(255,255,255,.1); border: none; color: #eee;
|
||||
padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 0.85em;
|
||||
}
|
||||
.pdf-toolbar button:hover { background: rgba(255,255,255,.2); }
|
||||
.pdf-toolbar .pdf-close { margin-left: auto; font-size: 1.2em; }
|
||||
.pdf-frame { flex: 1; border: none; width: 100%; }
|
||||
|
||||
/* Translation */
|
||||
.trans-btn {
|
||||
font-size: 0.7em; color: var(--cyan); cursor: pointer;
|
||||
padding: 2px 6px; border: 1px solid var(--cyan-border);
|
||||
border-radius: 4px; background: transparent;
|
||||
margin-left: 4px; transition: background var(--transition);
|
||||
}
|
||||
.trans-btn:hover { background: var(--cyan-bg); }
|
||||
.trans-btn.loading { opacity: 0.5; pointer-events: none; }
|
||||
.paper-title-zh {
|
||||
font-size: 0.8em; color: var(--cyan); margin-top: 3px; line-height: 1.4;
|
||||
}
|
||||
|
||||
/* Status bar */
|
||||
.status-bar {
|
||||
position: fixed; bottom: 0; left: 0; right: 0;
|
||||
background: var(--bg-card); border-top: 1px solid var(--border);
|
||||
display: flex; gap: 20px; align-items: center; padding: 8px 20px;
|
||||
z-index: 50; font-size: 0.78em; color: var(--text-dim);
|
||||
}
|
||||
.status-label {
|
||||
color: var(--text-dim); font-weight: 600; margin-right: 4px;
|
||||
}
|
||||
.status-item {
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
}
|
||||
.status-ms {
|
||||
color: var(--text-dim); font-variant-numeric: tabular-nums;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.status-dot {
|
||||
width: 8px; height: 8px; border-radius: 50%;
|
||||
background: var(--text-dim); transition: background 0.3s;
|
||||
}
|
||||
.status-dot.status-ok { background: var(--green); }
|
||||
.status-dot.status-fail { background: var(--red); }
|
||||
|
||||
.pdf-container {
|
||||
width: 90vw; height: 90vh; background: #fff; border-radius: var(--radius);
|
||||
display: flex; flex-direction: column; overflow: hidden;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
.pdf-container.with-trans { width: 55vw; }
|
||||
|
||||
/* Translation panel (right sidebar) */
|
||||
.trans-panel {
|
||||
position: fixed; right: -50vw; top: 5vh; bottom: 5vh;
|
||||
width: 45vw; min-width: 380px; max-width: 650px;
|
||||
background: var(--bg-modal); border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
z-index: 201; display: flex; flex-direction: column;
|
||||
transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
|
||||
box-shadow: -4px 0 24px rgba(0,0,0,.5);
|
||||
overflow: hidden;
|
||||
}
|
||||
.trans-panel.open { right: 2vw; }
|
||||
.trans-panel-header {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
padding: 12px 16px; border-bottom: 1px solid var(--border);
|
||||
font-weight: 700; font-size: 1em; flex-shrink: 0;
|
||||
}
|
||||
.trans-panel-close {
|
||||
margin-left: auto; background: none; border: none;
|
||||
color: var(--text-dim); font-size: 1.3em; cursor: pointer;
|
||||
}
|
||||
.trans-panel-body {
|
||||
flex: 1; overflow-y: auto; padding: 16px;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
.trans-panel-footer {
|
||||
padding: 10px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
|
||||
}
|
||||
.trans-panel-footer button {
|
||||
background: var(--blue-bg); color: var(--blue);
|
||||
border: 1px solid var(--blue-border); padding: 6px 16px;
|
||||
border-radius: 4px; cursor: pointer; font-size: 0.85em;
|
||||
}
|
||||
.trans-panel-footer button:hover { background: #1a3a5c; }
|
||||
.trans-panel-footer button:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
.trans-para-group {
|
||||
margin-bottom: 18px; padding-bottom: 14px;
|
||||
border-bottom: 1px solid rgba(255,255,255,.04);
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
.trans-para-group.active {
|
||||
background: rgba(88,166,255,.06);
|
||||
border-left: 2px solid var(--blue);
|
||||
padding-left: 10px;
|
||||
margin-left: -12px;
|
||||
padding-right: 4px;
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
.trans-en, .trans-zh {
|
||||
font-size: 0.82em; line-height: 1.65;
|
||||
}
|
||||
.trans-page-badge {
|
||||
font-size: 0.65em; color: var(--text-dim); margin-bottom: 2px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.trans-en { color: var(--text); margin-bottom: 4px; }
|
||||
.trans-zh { color: var(--cyan); padding-left: 8px; border-left: 2px solid var(--cyan-border); }
|
||||
|
||||
/* Scroll sync highlight */
|
||||
.trans-para-group.highlight {
|
||||
background: rgba(88,166,255,.12);
|
||||
border-left: 3px solid var(--blue);
|
||||
padding-left: 9px;
|
||||
margin-left: -12px;
|
||||
padding-right: 4px;
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
Reference in New Issue
Block a user