MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / ensureReportsDom

Function ensureReportsDom

deployments/desktop/static/reports.js:12–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 const byId = (id) => document.getElementById(id);
11
12 function ensureReportsDom() {
13 const nav = document.querySelector('[data-view="reports"]');
14 if (nav) {
15 nav.textContent = "报告阅读";
16 nav.onclick = () => {
17 showReportsView().catch(console.error);
18 };
19 } else {
20 const readingNav = document.querySelector('[data-view="reading"]');
21 if (readingNav?.parentElement) {
22 const button = document.createElement("button");
23 button.className = "nav-item";
24 button.dataset.view = "reports";
25 button.textContent = "报告阅读";
26 button.onclick = () => {
27 showReportsView().catch(console.error);
28 };
29 readingNav.insertAdjacentElement("afterend", button);
30 }
31 }
32
33 if (byId("reports")) return;
34
35 const wikiSection = byId("wiki");
36 if (!wikiSection) return;
37
38 const section = document.createElement("section");
39 section.id = "reports";
40 section.className = "view";
41 section.innerHTML = `
42 <div class="panel">
43 <div class="panel-head">
44 <div>
45 <h3>报告阅读</h3>
46 <p>在 GUI 中浏览和阅读本地 Markdown 精读报告。</p>
47 </div>
48 <div class="actions">
49 <select id="reportDays" title="时间范围">
50 <option value="7">最近 7 天</option>
51 <option value="30" selected>最近 30 天</option>
52 <option value="90">最近 90 天</option>
53 <option value="365">全部</option>
54 </select>
55 <button id="reportTodayBtn" type="button">今天</button>
56 <button id="refreshReportsBtn" type="button">刷新</button>
57 </div>
58 </div>
59
60 <div class="reports-toolbar">
61 <input id="reportQuery" placeholder="搜索标题、arXiv ID 或路径">
62 <input id="reportDate" type="date" aria-label="精确日期筛选">
63 <label class="checkline subtle-check">
64 <input id="reportsCurrentOnly" type="checkbox" checked>
65 仅看当前用户
66 </label>
67 </div>
68
69 <div id="reportSources" class="meta-line">报告目录尚未加载。</div>

Callers 4

showReportsViewFunction · 0.85
refreshReportsFunction · 0.85
jumpToReportFunction · 0.85
initFunction · 0.85

Calls 2

showReportsViewFunction · 0.85
byIdFunction · 0.85

Tested by

no test coverage detected