papersearch 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +25 -23
- package/README.md +25 -23
- package/assets/ask-with-skill.png +0 -0
- package/carsi/paper_search_carsi/assets/api_keys.json +6 -4
- package/carsi/paper_search_carsi/assets/capsule.html +173 -21
- package/carsi/paper_search_carsi/assets/capsule_en.json +68 -5
- package/carsi/paper_search_carsi/browser/watchdog.py +6 -1
- package/carsi/paper_search_carsi/capsule_placement.py +8 -5
- package/carsi/paper_search_carsi/capsule_window.py +495 -0
- package/carsi/paper_search_carsi/cli.py +2 -2
- package/carsi/paper_search_carsi/engine/batch_capture.py +11 -3
- package/carsi/paper_search_carsi/engine/batch_login.py +3 -2
- package/carsi/paper_search_carsi/engine/batch_waits.py +28 -7
- package/carsi/paper_search_carsi/i18n.py +5 -0
- package/carsi/paper_search_carsi/progress_capsule.py +177 -426
- package/carsi/paper_search_carsi/progress_macos.py +53 -6
- package/carsi/paper_search_carsi/progress_reporter.py +132 -20
- package/carsi/paper_search_carsi/progress_view.py +95 -14
- package/carsi/paper_search_carsi/server.py +25 -3
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js +1 -1
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batch.d.ts +4 -3
- package/dist/capabilities/pdf-discovery/batch.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batch.js +217 -85
- package/dist/capabilities/pdf-discovery/batch.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batchPapers.d.ts +19 -0
- package/dist/capabilities/pdf-discovery/batchPapers.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/batchPapers.js +44 -0
- package/dist/capabilities/pdf-discovery/batchPapers.js.map +1 -0
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts +6 -1
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batchSummary.js +33 -8
- package/dist/capabilities/pdf-discovery/batchSummary.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts +13 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js +77 -25
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts +4 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js +5 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiResultNormalizer.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiResultNormalizer.js +4 -3
- package/dist/capabilities/pdf-discovery/carsi/CarsiResultNormalizer.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts +51 -2
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/handler.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/handler.js +2 -1
- package/dist/capabilities/pdf-discovery/handler.js.map +1 -1
- package/dist/capabilities/pdf-discovery/outputLayout.d.ts +27 -2
- package/dist/capabilities/pdf-discovery/outputLayout.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/outputLayout.js +133 -29
- package/dist/capabilities/pdf-discovery/outputLayout.js.map +1 -1
- package/dist/capabilities/pdf-discovery/types.d.ts +5 -0
- package/dist/capabilities/pdf-discovery/types.d.ts.map +1 -1
- package/dist/cli.js +1 -31
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.d.ts +4 -0
- package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.js +11 -3
- package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
- package/dist/management/carsi/autoUpdate.d.ts +2 -2
- package/dist/management/carsi/autoUpdate.d.ts.map +1 -1
- package/dist/management/carsi/autoUpdate.js +8 -2
- package/dist/management/carsi/autoUpdate.js.map +1 -1
- package/dist/management/carsi/cliProgress.d.ts +8 -0
- package/dist/management/carsi/cliProgress.d.ts.map +1 -0
- package/dist/management/carsi/cliProgress.js +38 -0
- package/dist/management/carsi/cliProgress.js.map +1 -0
- package/dist/management/carsi/installer.d.ts.map +1 -1
- package/dist/management/carsi/installer.js +3 -6
- package/dist/management/carsi/installer.js.map +1 -1
- package/dist/management/skills/nextSteps.js +1 -1
- package/dist/management/skills/nextSteps.js.map +1 -1
- package/dist/skills/SkillInstaller.d.ts +4 -0
- package/dist/skills/SkillInstaller.d.ts.map +1 -1
- package/dist/skills/SkillInstaller.js +20 -2
- package/dist/skills/SkillInstaller.js.map +1 -1
- package/package.json +2 -2
- package/skills/paper-search/SKILL.md +13 -9
- package/skills/paper-search/references/browser-download.md +4 -4
- package/skills/paper-search/references/cli-contract.md +2 -2
- package/skills/paper-search/references/management-layer.md +20 -10
- package/skills/paper-search/references/setup.md +3 -3
- package/skills/paper-search/references/troubleshooting.md +2 -1
- package/carsi/paper_search_carsi/progress_bar.py +0 -684
package/README.en.md
CHANGED
|
@@ -24,7 +24,7 @@ One sentence and your AI searches, verifies and downloads full texts and supplem
|
|
|
24
24
|
<a href="#demo-video">Demo video</a> · <a href="#quick-start">Quick start</a> · <a href="#1-school-subscription-downloads-carsi">School subscription downloads</a> · <a href="#2-api-keys">API keys</a> · <a href="docs/guide.en.md">Guide</a> · <a href="docs/ARCHITECTURE.zh.md">Architecture</a> · <a href="docs/ROADMAP.zh.md">Roadmap</a> · <a href="https://github.com/dr-dumpling/PaperSearch/issues/new/choose">Report an issue</a>
|
|
25
25
|
</p>
|
|
26
26
|
|
|
27
|
-
PaperSearch provides the `paper-search` command and a bundled Skill. Once installed, Claude Code, Codex,
|
|
27
|
+
PaperSearch provides the `paper-search` command and a bundled Skill. Once installed, Claude Code, Codex, DeepSeek, GLM, Kimi Code, Qwen Code, CodeBuddy and other AI tools that can run local commands can do this for you:
|
|
28
28
|
|
|
29
29
|
- **Search papers**: query more than 20 sources at once, including PubMed, Crossref, OpenAlex, Semantic Scholar and arXiv, with duplicates merged by DOI and DOIs verified.
|
|
30
30
|
- **Search full-text snippets**: search the paper bodies Semantic Scholar indexes for passages on methods or results, with their sources.
|
|
@@ -46,23 +46,23 @@ https://github.com/user-attachments/assets/9d54521b-bdb9-451c-89d8-889ec203bec1
|
|
|
46
46
|
|
|
47
47
|
## Quick start
|
|
48
48
|
|
|
49
|
-
### 1. Install
|
|
49
|
+
### 1. Install
|
|
50
50
|
|
|
51
|
-
Send your AI tool this sentence (
|
|
51
|
+
Send your AI tool this sentence (Claude Code, Codex, DeepSeek, GLM, Kimi Code, Qwen Code, CodeBuddy and others all work):
|
|
52
52
|
|
|
53
53
|
```text
|
|
54
|
-
Please install PaperSearch:
|
|
54
|
+
Please install the PaperSearch Skill: npx skills add dr-dumpling/PaperSearch -g -y
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
When you want to set it up, send it:
|
|
57
|
+
Once it is installed, mention the Skill and send:
|
|
60
58
|
|
|
61
59
|
```text
|
|
62
|
-
Start setup
|
|
60
|
+
$paper-search Start setup
|
|
63
61
|
```
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
Your AI first asks whether to install the PaperSearch command-line program; once you agree, it installs it and then walks you through school subscription downloads (CARSI) and API keys.
|
|
64
|
+
|
|
65
|
+
<p align="center"><img src="assets/install.en.webp" width="840" alt="Install demo: send your AI one sentence and it installs the Skill; mention the Skill and say Start setup, and it asks before installing the command-line program, lists what works, and goes on to setup"></p>
|
|
66
66
|
|
|
67
67
|
### 2. Add school subscription downloads during setup
|
|
68
68
|
|
|
@@ -80,17 +80,19 @@ After "Start setup", your AI first asks whether you want school subscription dow
|
|
|
80
80
|
- **With school subscription downloads**: API keys, the download folder, waiting times and notifications all go in the settings window, and every key has a Test button. To change them later, ask your AI to open the settings, or click the gear on the capsule.
|
|
81
81
|
- **Without**: your AI lists the missing keys and where to get them (also in [API keys](#2-api-keys)); you enter them by running `paper-search setup` in a terminal, where the input is hidden, and your AI then tests each one.
|
|
82
82
|
|
|
83
|
-
### 4.
|
|
83
|
+
### 4. Start using it
|
|
84
|
+
|
|
85
|
+
Once set up, mention the PaperSearch Skill and say what you want to search for, for example:
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
<p align="center"><img src="assets/ask-with-skill.png" width="645" alt="Mentioning the PaperSearch Skill in the message box: the request ends with a Paper Search tag"></p>
|
|
86
88
|
|
|
87
89
|
| To do | You can say |
|
|
88
90
|
|---|---|
|
|
89
|
-
| Search papers | Find randomized trials of SGLT2 inhibitors in heart failure since 2020, and verify the DOIs |
|
|
90
|
-
| Search full-text snippets | How did these trials define their primary endpoint? Quote a few passages |
|
|
91
|
-
| Look up journal IF and quartiles | Which journals were they published in, and what are their impact factors and quartiles? |
|
|
92
|
-
| Look up citations and references | Which studies have cited the DAPA-HF trial since it was published? |
|
|
93
|
-
| Download full texts and supplementary files | Download the full texts and supplementary files of these papers to ./downloads |
|
|
91
|
+
| Search papers | `$paper-search` Find randomized trials of SGLT2 inhibitors in heart failure since 2020, and verify the DOIs |
|
|
92
|
+
| Search full-text snippets | `$paper-search` How did these trials define their primary endpoint? Quote a few passages |
|
|
93
|
+
| Look up journal IF and quartiles | `$paper-search` Which journals were they published in, and what are their impact factors and quartiles? |
|
|
94
|
+
| Look up citations and references | `$paper-search` Which studies have cited the DAPA-HF trial since it was published? |
|
|
95
|
+
| Download full texts and supplementary files | `$paper-search` Download the full texts and supplementary files of these papers to ./downloads |
|
|
94
96
|
|
|
95
97
|
**Results:**
|
|
96
98
|
|
|
@@ -117,7 +119,7 @@ Feature comparison:
|
|
|
117
119
|
|  Open-access papers | ✅ | — | — |
|
|
118
120
|
|  Subscription papers | — | ✅ (Elsevier, Springer) | ✅ (30+ major publishers) |
|
|
119
121
|
|  Supplementary files | — | — | ✅ |
|
|
120
|
-
| **You need** | Node.js
|
|
122
|
+
| **You need** | Node.js 22 or later | Keys from each provider | Google Chrome, a school account |
|
|
121
123
|
| **How to turn it on** | Quick start step 1 | Settings window or terminal | Agree during setup |
|
|
122
124
|
|
|
123
125
|
### 1. School subscription downloads (CARSI)
|
|
@@ -165,21 +167,21 @@ paper-search carsi status --format text # check that it is ready
|
|
|
165
167
|
|
|
166
168
|
Keys fall into four groups by what they are for. Get the key you need and enter it any of the ways in [Quick start step 3](#3-add-api-keys-when-you-need-them).
|
|
167
169
|
|
|
168
|
-
#### Journal metrics and full-text snippets
|
|
170
|
+
#### Journal metrics and full-text snippets (recommended)
|
|
169
171
|
|
|
170
172
|
| Feature | Key | Where to get it |
|
|
171
173
|
|---|---|---|
|
|
172
|
-
| Look up impact factors and quartiles | `EASYSCHOLAR_KEY` | [EasyScholar](https://www.easyscholar.cc/) |
|
|
173
|
-
| Search full-text snippets | `SEMANTIC_SCHOLAR_API_KEY` | [Semantic Scholar](https://www.semanticscholar.org/product/api) |
|
|
174
|
+
| Look up impact factors and quartiles | `EASYSCHOLAR_KEY` | [EasyScholar](https://www.easyscholar.cc/) ([guide](https://docs.qq.com/aio/DTUxwZ3hUckVtZVJN), in Chinese) |
|
|
175
|
+
| Search full-text snippets | `SEMANTIC_SCHOLAR_API_KEY` | [Semantic Scholar](https://www.semanticscholar.org/product/api) ([guide](https://docs.qq.com/aio/DTW9RdFVHc2hJUmpx), in Chinese) |
|
|
174
176
|
|
|
175
|
-
#### Subscribed full texts through publisher APIs
|
|
177
|
+
#### Subscribed full texts through publisher APIs (optional)
|
|
176
178
|
|
|
177
179
|
| Publisher | Key | Where to get it |
|
|
178
180
|
|---|---|---|
|
|
179
181
|
| Elsevier | `ELSEVIER_API_KEY`; off campus, subscription articles also need `ELSEVIER_INSTTOKEN` | [Elsevier](https://dev.elsevier.com/apikey/manage) |
|
|
180
182
|
| Springer | `SPRINGER_API_KEY` | [Springer Nature](https://dev.springernature.com/) |
|
|
181
183
|
|
|
182
|
-
#### More search sources
|
|
184
|
+
#### More search sources (optional)
|
|
183
185
|
|
|
184
186
|
| Source | Key | Where to get it |
|
|
185
187
|
|---|---|---|
|
|
@@ -188,7 +190,7 @@ Keys fall into four groups by what they are for. Get the key you need and enter
|
|
|
188
190
|
| ScienceDirect, Scopus | `ELSEVIER_API_KEY` (the same key as above) | [Elsevier](https://dev.elsevier.com/apikey/manage) |
|
|
189
191
|
| Springer | `SPRINGER_API_KEY` (the same key as above) | [Springer Nature](https://dev.springernature.com/) |
|
|
190
192
|
|
|
191
|
-
#### Higher limits, steadier access
|
|
193
|
+
#### Higher limits, steadier access (optional)
|
|
192
194
|
|
|
193
195
|
| Source | Key | Where to get it |
|
|
194
196
|
|---|---|---|
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<a href="#演示视频">演示视频</a> · <a href="#快速开始">快速开始</a> · <a href="#1-学校订阅下载carsi">学校订阅下载</a> · <a href="#2-api-key">API key</a> · <a href="docs/guide.zh.md">使用说明</a> · <a href="docs/ARCHITECTURE.zh.md">架构说明</a> · <a href="docs/ROADMAP.zh.md">路线图</a> · <a href="https://github.com/dr-dumpling/PaperSearch/issues/new/choose">反馈问题</a>
|
|
25
25
|
</p>
|
|
26
26
|
|
|
27
|
-
PaperSearch 提供 `paper-search` 命令和一份随包 Skill。装好后,Claude Code、Codex、
|
|
27
|
+
PaperSearch 提供 `paper-search` 命令和一份随包 Skill。装好后,Claude Code、Codex、DeepSeek、GLM、Kimi Code、Qwen Code、CodeBuddy 等支持本机命令调用的 AI 工具,就能替你:
|
|
28
28
|
|
|
29
29
|
- **检索论文**:一次查 PubMed、Crossref、OpenAlex、Semantic Scholar、arXiv 等 20 多个数据源,按 DOI 合并重复,核对 DOI。
|
|
30
30
|
- **搜正文片段**:利用 Semantic Scholar 收录的论文正文,搜原句,找到方法、结果的原文和出处。
|
|
@@ -46,23 +46,23 @@ https://github.com/user-attachments/assets/7573a2a8-0778-4062-aa3e-4ccffb482b0b
|
|
|
46
46
|
|
|
47
47
|
## 快速开始
|
|
48
48
|
|
|
49
|
-
### 1.
|
|
49
|
+
### 1. 安装
|
|
50
50
|
|
|
51
|
-
把这句话发给你的 AI
|
|
51
|
+
把这句话发给你的 AI 工具(Claude Code、Codex、DeepSeek、GLM、Kimi Code、Qwen Code、CodeBuddy 等等都行):
|
|
52
52
|
|
|
53
53
|
```text
|
|
54
|
-
请帮我安装 PaperSearch:
|
|
54
|
+
请帮我安装 PaperSearch 的 Skill:npx skills add dr-dumpling/PaperSearch -g -y
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
需要配置时,发给它这句:
|
|
57
|
+
装好后引用 Skill,发这句:
|
|
60
58
|
|
|
61
59
|
```text
|
|
62
|
-
请开始配置
|
|
60
|
+
$paper-search 请开始配置
|
|
63
61
|
```
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
AI 会先问你要不要装 PaperSearch 的命令行程序,你同意后装好,再带你配置学校订阅下载(CARSI)和 API key。
|
|
64
|
+
|
|
65
|
+
<p align="center"><img src="assets/install.webp" width="840" alt="安装演示:把一句话发给 AI,它先装好 Skill;引用 Skill 说“请开始配置”,它先问再装命令行程序,列出能用的功能,接着带你配置"></p>
|
|
66
66
|
|
|
67
67
|
### 2. 配置时装上学校订阅下载
|
|
68
68
|
|
|
@@ -80,17 +80,19 @@ https://github.com/user-attachments/assets/7573a2a8-0778-4062-aa3e-4ccffb482b0b
|
|
|
80
80
|
- **用学校订阅下载**:API key、下载文件夹、等待时间和提醒都在设置窗口里填,每个 key 都能点“测试”。之后想改,让 AI 打开设置,或点胶囊上的齿轮。
|
|
81
81
|
- **不用**:AI 列出还缺的 key 和申请入口(也见 [API key](#2-api-key)),你在终端运行 `paper-search setup` 填入,输入时不显示;填完 AI 逐个测试能不能用。
|
|
82
82
|
|
|
83
|
-
### 4.
|
|
83
|
+
### 4. 开始使用
|
|
84
|
+
|
|
85
|
+
配置好后,引用 PaperSearch 的 Skill,说出你需要搜索的内容,比如:
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
<p align="center"><img src="assets/ask-with-skill.png" width="645" alt="在输入框里引用 PaperSearch 的 Skill:要做的事后面带着 Paper Search 标签"></p>
|
|
86
88
|
|
|
87
89
|
| 想做什么 | 可以这样说 |
|
|
88
90
|
|---|---|
|
|
89
|
-
| 检索论文 | 找 2020 年以来 SGLT2 抑制剂治疗心力衰竭的随机对照试验,核对 DOI |
|
|
90
|
-
| 搜正文片段 | 这些试验的主要终点,原文是怎么定义的?摘几段原文 |
|
|
91
|
-
| 查期刊 IF 与分区 | 它们发表在哪些期刊?影响因子和分区各是多少 |
|
|
92
|
-
| 查引文和参考文献 | DAPA-HF 试验发表后,有哪些研究引用了它 |
|
|
93
|
-
| 下载全文和补充材料 | 把这些论文的全文和补充材料下载到 ./downloads |
|
|
91
|
+
| 检索论文 | `$paper-search` 找 2020 年以来 SGLT2 抑制剂治疗心力衰竭的随机对照试验,核对 DOI |
|
|
92
|
+
| 搜正文片段 | `$paper-search` 这些试验的主要终点,原文是怎么定义的?摘几段原文 |
|
|
93
|
+
| 查期刊 IF 与分区 | `$paper-search` 它们发表在哪些期刊?影响因子和分区各是多少 |
|
|
94
|
+
| 查引文和参考文献 | `$paper-search` DAPA-HF 试验发表后,有哪些研究引用了它 |
|
|
95
|
+
| 下载全文和补充材料 | `$paper-search` 把这些论文的全文和补充材料下载到 ./downloads |
|
|
94
96
|
|
|
95
97
|
**拿到结果:**
|
|
96
98
|
|
|
@@ -117,7 +119,7 @@ https://github.com/user-attachments/assets/7573a2a8-0778-4062-aa3e-4ccffb482b0b
|
|
|
117
119
|
|  下载 OA 文章 | ✅ | — | — |
|
|
118
120
|
|  下载非 OA 文章 | — | ✅(Elsevier、Springer) | ✅(30+主流出版社) |
|
|
119
121
|
|  下载补充材料 | — | — | ✅ |
|
|
120
|
-
| **需要准备** | Node.js
|
|
122
|
+
| **需要准备** | Node.js 22 或以上 | 到各家网站申请 key | Google Chrome、学校账号 |
|
|
121
123
|
| **怎么开启** | 快速开始第 1 步 | 设置窗口或终端 | 配置时同意安装 |
|
|
122
124
|
|
|
123
125
|
### 1. 学校订阅下载(CARSI)
|
|
@@ -165,21 +167,21 @@ paper-search carsi status --format text # 查看是否装好
|
|
|
165
167
|
|
|
166
168
|
按用途分四类,需要哪类就申请对应的 key,再用[快速开始第 3 步](#3-按需填-api-key)里的任一方式填入。
|
|
167
169
|
|
|
168
|
-
####
|
|
170
|
+
#### 查期刊、搜正文(推荐配置)
|
|
169
171
|
|
|
170
172
|
| 功能 | 要填的 key | 去哪里申请 |
|
|
171
173
|
|---|---|---|
|
|
172
|
-
| 查影响因子和分区 | `EASYSCHOLAR_KEY` | [EasyScholar](https://www.easyscholar.cc/) |
|
|
173
|
-
| 搜正文片段 | `SEMANTIC_SCHOLAR_API_KEY` | [Semantic Scholar](https://www.semanticscholar.org/product/api) |
|
|
174
|
+
| 查影响因子和分区 | `EASYSCHOLAR_KEY` | [EasyScholar](https://www.easyscholar.cc/)([申请教程](https://docs.qq.com/aio/DTUxwZ3hUckVtZVJN)) |
|
|
175
|
+
| 搜正文片段 | `SEMANTIC_SCHOLAR_API_KEY` | [Semantic Scholar](https://www.semanticscholar.org/product/api)([申请教程](https://docs.qq.com/aio/DTW9RdFVHc2hJUmpx)) |
|
|
174
176
|
|
|
175
|
-
####
|
|
177
|
+
#### 下载订阅全文(出版社接口,非必须)
|
|
176
178
|
|
|
177
179
|
| 出版社 | 要填的 key | 去哪里申请 |
|
|
178
180
|
|---|---|---|
|
|
179
181
|
| Elsevier | `ELSEVIER_API_KEY`;校外下订阅文章还要 `ELSEVIER_INSTTOKEN` | [Elsevier](https://dev.elsevier.com/apikey/manage) |
|
|
180
182
|
| Springer | `SPRINGER_API_KEY` | [Springer Nature](https://dev.springernature.com/) |
|
|
181
183
|
|
|
182
|
-
####
|
|
184
|
+
#### 增加检索来源(非必须)
|
|
183
185
|
|
|
184
186
|
| 来源 | 要填的 key | 去哪里申请 |
|
|
185
187
|
|---|---|---|
|
|
@@ -188,7 +190,7 @@ paper-search carsi status --format text # 查看是否装好
|
|
|
188
190
|
| ScienceDirect、Scopus | `ELSEVIER_API_KEY`(和上面同一个) | [Elsevier](https://dev.elsevier.com/apikey/manage) |
|
|
189
191
|
| Springer | `SPRINGER_API_KEY`(和上面同一个) | [Springer Nature](https://dev.springernature.com/) |
|
|
190
192
|
|
|
191
|
-
####
|
|
193
|
+
#### 提高限额、更稳定(非必须)
|
|
192
194
|
|
|
193
195
|
| 来源 | 要填的 key | 去哪里申请 |
|
|
194
196
|
|---|---|---|
|
|
Binary file
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"groups": [
|
|
3
3
|
{
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "查期刊、搜正文(推荐配置)",
|
|
5
5
|
"services": [
|
|
6
6
|
{
|
|
7
7
|
"id": "easyscholar",
|
|
8
8
|
"name": "EasyScholar",
|
|
9
9
|
"use": "查影响因子和分区",
|
|
10
10
|
"url": "https://www.easyscholar.cc/",
|
|
11
|
+
"guide": "https://docs.qq.com/aio/DTUxwZ3hUckVtZVJN",
|
|
12
|
+
"guide_label": "申请教程",
|
|
11
13
|
"keys": [
|
|
12
14
|
{
|
|
13
15
|
"key": "EASYSCHOLAR_KEY",
|
|
@@ -32,7 +34,7 @@
|
|
|
32
34
|
]
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
|
-
"title": "
|
|
37
|
+
"title": "出版社接口(非必须)",
|
|
36
38
|
"services": [
|
|
37
39
|
{
|
|
38
40
|
"id": "elsevier",
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
]
|
|
62
64
|
},
|
|
63
65
|
{
|
|
64
|
-
"title": "
|
|
66
|
+
"title": "增加检索来源(非必须)",
|
|
65
67
|
"services": [
|
|
66
68
|
{
|
|
67
69
|
"id": "wos",
|
|
@@ -90,7 +92,7 @@
|
|
|
90
92
|
]
|
|
91
93
|
},
|
|
92
94
|
{
|
|
93
|
-
"title": "
|
|
95
|
+
"title": "提高限额(非必须)",
|
|
94
96
|
"services": [
|
|
95
97
|
{
|
|
96
98
|
"id": "pubmed",
|
|
@@ -5,19 +5,23 @@
|
|
|
5
5
|
<title>PaperSearch</title>
|
|
6
6
|
<style>
|
|
7
7
|
:root {
|
|
8
|
-
|
|
8
|
+
/* Opaque: a transparent window has nothing behind it to blur, and the desktop showed
|
|
9
|
+
through the card (user, 2026-11-10). */
|
|
10
|
+
--bg: #ffffff; --fg: #111827; --dim: #6b7280; --faint: #9ca3af;
|
|
9
11
|
--line: rgba(17, 24, 39, 0.10); --track: rgba(17, 24, 39, 0.10); --hover: rgba(17, 24, 39, 0.06);
|
|
10
12
|
--accent: #2563eb; --ok: #16a34a; --bad: #dc2626;
|
|
11
13
|
--warn: #92400e; --warn-bg: #fef3c7; --warn-line: #f3d27a; --warn-dot: #d97706;
|
|
12
|
-
|
|
14
|
+
/* Inside the window's 10 px margin (body.mac): a shadow running past it was cut off
|
|
15
|
+
square on the desktop (2026-11-10). */
|
|
16
|
+
--shadow: 0 3px 7px rgba(0, 0, 0, 0.14), 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
13
17
|
}
|
|
14
18
|
@media (prefers-color-scheme: dark) {
|
|
15
19
|
:root {
|
|
16
|
-
--bg:
|
|
20
|
+
--bg: #202124; --fg: #f3f4f6; --dim: #a1a1aa; --faint: #71717a;
|
|
17
21
|
--line: rgba(255, 255, 255, 0.12); --track: rgba(255, 255, 255, 0.14); --hover: rgba(255, 255, 255, 0.08);
|
|
18
22
|
--accent: #60a5fa; --ok: #4ade80; --bad: #f87171;
|
|
19
23
|
--warn: #fbbf24; --warn-bg: #3a2d10; --warn-line: #6b5216; --warn-dot: #fbbf24;
|
|
20
|
-
--shadow: 0
|
|
24
|
+
--shadow: 0 3px 7px rgba(0, 0, 0, 0.42), 0 1px 2px rgba(0, 0, 0, 0.32);
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
html, body { margin: 0; background: transparent; overflow: hidden; }
|
|
@@ -29,7 +33,7 @@ body {
|
|
|
29
33
|
body.mac { padding: 10px; } /* room for the shadow around a transparent window */
|
|
30
34
|
#root { position: relative; box-sizing: border-box; overflow: hidden; display: inline-block; background: var(--bg); border: 0.5px solid var(--line); cursor: default; }
|
|
31
35
|
#root.dragging, #root.dragging * { cursor: default; }
|
|
32
|
-
body.mac #root { box-shadow: var(--shadow);
|
|
36
|
+
body.mac #root { box-shadow: var(--shadow); }
|
|
33
37
|
#root.pill { border-radius: 999px; }
|
|
34
38
|
#root.card { border-radius: 16px; width: 330px; box-sizing: border-box; }
|
|
35
39
|
body:not(.mac) #root { border-radius: 8px; border: none; }
|
|
@@ -98,7 +102,10 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
98
102
|
.steps .label { font-size: 12px; color: var(--accent); white-space: nowrap; }
|
|
99
103
|
.line { font-size: 12px; color: var(--dim); margin-top: 8px; }
|
|
100
104
|
.stats { display: flex; padding: 12px 0; border-top: 0.5px solid var(--line); border-bottom: 0.5px solid var(--line); }
|
|
101
|
-
.stats div { flex: 1; }
|
|
105
|
+
.stats div, .stats .stat { flex: 1; }
|
|
106
|
+
.stats .stat { padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
|
|
107
|
+
.stats .stat:hover span, .stats .stat:focus-visible span { color: var(--accent); }
|
|
108
|
+
.stats .stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
|
|
102
109
|
.stats b { display: block; font-size: 18px; font-weight: 600; line-height: 1.2; }
|
|
103
110
|
.stats span { font-size: 11px; color: var(--dim); }
|
|
104
111
|
.actions { display: flex; align-items: center; gap: 6px; margin-top: 12px; position: relative; }
|
|
@@ -125,6 +132,18 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
125
132
|
background: var(--hover); border: 0.5px solid var(--line); border-radius: 6px; padding: 0 8px; }
|
|
126
133
|
.settings input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
|
|
127
134
|
.settings .err { color: var(--bad); font-size: 11px; text-align: right; margin: -6px 0 6px; }
|
|
135
|
+
/* The check of system notifications under its switch: a test, and what to change when they do not show. */
|
|
136
|
+
#notify-test-button { margin-left: auto; margin-right: 10px; }
|
|
137
|
+
#notify-test-button .btn { padding: 2px 9px; }
|
|
138
|
+
.nnote { font-size: 12px; color: var(--dim); margin: 2px 0 6px; }
|
|
139
|
+
.nnote.ok { color: var(--ok); }
|
|
140
|
+
.nnote.bad { color: var(--bad); }
|
|
141
|
+
.nnote .link-btn { border: none; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
|
|
142
|
+
.nbox { border-radius: 8px; padding: 9px 11px; margin: 4px 0 8px; font-size: 12px; line-height: 1.55;
|
|
143
|
+
background: var(--warn-bg); color: var(--warn); border: 0.5px solid var(--warn-line); }
|
|
144
|
+
.nbox b { display: block; font-size: 13px; margin-bottom: 3px; }
|
|
145
|
+
.nbox ol { margin: 4px 0 6px; padding-left: 18px; }
|
|
146
|
+
.nbox .btn { margin-top: 2px; color: var(--warn); border-color: var(--warn-line); }
|
|
128
147
|
.switch { width: 34px; height: 20px; border-radius: 10px; background: var(--track); position: relative; border: none; padding: 0; cursor: pointer; }
|
|
129
148
|
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
|
|
130
149
|
.switch.on { background: var(--accent); }
|
|
@@ -196,6 +215,9 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
196
215
|
.paper-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 196px; overflow-y: auto; }
|
|
197
216
|
.paper-list.scroll { -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent); mask-image: linear-gradient(to bottom, #000 80%, transparent); }
|
|
198
217
|
.paper-list li { font-size: 12px; padding: 3px 0; }
|
|
218
|
+
/* A list page scrolls as one, up to half the screen; its groups open in full inside it. */
|
|
219
|
+
.papers-scroll { overflow-y: auto; overscroll-behavior: contain; }
|
|
220
|
+
.papers-scroll .paper-list { max-height: none; overflow: visible; }
|
|
199
221
|
.paper-list .t, .paper-list .w { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
200
222
|
.paper-list .w, .paper-list .more { color: var(--faint); }
|
|
201
223
|
.paper-list .open-article { display: block; width: 100%; padding: 0; border: none; background: none; text-align: left;
|
|
@@ -219,17 +241,26 @@ const EN = /*CAPSULE_EN*/null;
|
|
|
219
241
|
const EN_PATTERNS = EN ? EN.patterns.map(([source, target]) => [new RegExp(source), target]) : [];
|
|
220
242
|
const HAN = /[\u4e00-\u9fff]/;
|
|
221
243
|
let lang = "zh";
|
|
244
|
+
const BRACKETS = /^(.+?)((.+))$/;
|
|
245
|
+
function trOne(core) {
|
|
246
|
+
if (!HAN.test(core)) return core;
|
|
247
|
+
let english = Object.hasOwn(EN.exact, core) ? EN.exact[core] : null;
|
|
248
|
+
if (english === null) {
|
|
249
|
+
const found = EN_PATTERNS.find(([pattern]) => pattern.test(core));
|
|
250
|
+
if (found) english = core.replace(found[0], found[1]);
|
|
251
|
+
}
|
|
252
|
+
const parts = english === null && BRACKETS.exec(core);
|
|
253
|
+
// "开放下载 18(出版社 API 3、预印本 1)": the text and what its brackets list, each on its own.
|
|
254
|
+
if (parts) english = trOne(parts[1]) + " (" + parts[2].split("、").map(trOne).join(", ") + ")";
|
|
255
|
+
return english === null ? core : english;
|
|
256
|
+
}
|
|
222
257
|
function tr(text) {
|
|
223
258
|
if (lang !== "en" || !EN || !text || !HAN.test(text)) return text;
|
|
224
259
|
return String(text).split(" · ").map((part) => {
|
|
225
260
|
const core = part.trim();
|
|
226
261
|
if (!core || !HAN.test(core)) return part;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const found = EN_PATTERNS.find(([pattern]) => pattern.test(core));
|
|
230
|
-
if (found) english = core.replace(found[0], found[1]);
|
|
231
|
-
}
|
|
232
|
-
return english === null ? part : part.replace(core, english);
|
|
262
|
+
const english = trOne(core);
|
|
263
|
+
return english === core ? part : part.replace(core, english);
|
|
233
264
|
}).join(" · ");
|
|
234
265
|
}
|
|
235
266
|
function localize(node) {
|
|
@@ -293,6 +324,7 @@ let open = false; // the card is showing
|
|
|
293
324
|
let panel = ""; // "", "menu", "report", "confirm", "settings": kept until the user leaves it
|
|
294
325
|
let flash = { text: "", until: 0 };
|
|
295
326
|
let settings = null, settingsErrors = {}, notifyOn = true;
|
|
327
|
+
let notifyCheck = null; // the notification check under the switch: {state: testing, sent, off, unseen or failed}
|
|
296
328
|
// Settings pages: "home" lists download, wait and keys. settingsOnly: this window was started
|
|
297
329
|
// just to show them (`paper-search-carsi settings`), so it closes with them unless a download runs.
|
|
298
330
|
const SETTINGS_PAGES = ["home", "download", "wait", "keys"];
|
|
@@ -355,6 +387,8 @@ function paperBlock() {
|
|
|
355
387
|
} else if (v.line) {
|
|
356
388
|
html += '<div class="line">' + esc(v.line) + "</div>";
|
|
357
389
|
}
|
|
390
|
+
// What each lane got (开放下载, 机构下载), on one line.
|
|
391
|
+
if (v.lanes) html += '<div class="line">' + esc(v.lanes) + "</div>";
|
|
358
392
|
return html + "</div>";
|
|
359
393
|
}
|
|
360
394
|
|
|
@@ -382,13 +416,19 @@ function actionsBlock() {
|
|
|
382
416
|
return html;
|
|
383
417
|
}
|
|
384
418
|
|
|
419
|
+
// A count opens its list of papers once the batch has sent them (user, 2026-11-10).
|
|
420
|
+
function stat(list, value, label, color) {
|
|
421
|
+
const inner = "<b" + (color ? ' style="color:' + color + '"' : "") + ">" + value + "</b><span>" + label + "</span>";
|
|
422
|
+
return V.lists && list ? '<button type="button" class="stat" data-act="papers" data-list="' + list + '">' + inner + "</button>"
|
|
423
|
+
: "<div>" + inner + "</div>";
|
|
424
|
+
}
|
|
425
|
+
|
|
385
426
|
function runningCard() {
|
|
386
427
|
const v = V;
|
|
387
428
|
const sub = [v.total ? v.done + "/" + v.total : "", v.part, v.elapsed ? "已用 " + v.elapsed : ""].filter(Boolean).join(" · ");
|
|
388
429
|
return '<div class="card-body">' + header(v.headline, sub, false) + paperBlock()
|
|
389
|
-
+ '<div class="stats"
|
|
390
|
-
+
|
|
391
|
-
+ "<div><b>" + (v.left == null ? "—" : v.left) + "</b><span>剩余</span></div></div>"
|
|
430
|
+
+ '<div class="stats">' + stat("ok", v.ok, "成功", "var(--ok)") + stat("failed", v.bad, "失败", "var(--bad)")
|
|
431
|
+
+ stat("left", v.left == null ? "—" : v.left, "剩余") + "</div>"
|
|
392
432
|
+ actionsBlock() + "</div>";
|
|
393
433
|
}
|
|
394
434
|
|
|
@@ -443,9 +483,8 @@ function reasonRow(g, i, brief) {
|
|
|
443
483
|
function doneCard() {
|
|
444
484
|
const v = V, s = v.summary;
|
|
445
485
|
let html = '<div class="card-body">' + header(v.headline, v.total ? "共 " + v.total + " 篇" : "", true)
|
|
446
|
-
+ '<div class="stats done-stats"
|
|
447
|
-
+
|
|
448
|
-
+ "<div><b>" + esc(v.elapsed || "—") + "</b><span>用时</span></div></div>";
|
|
486
|
+
+ '<div class="stats done-stats">' + stat("ok", v.ok, "成功", "var(--ok)") + stat("failed", v.bad, "失败", v.bad ? "var(--bad)" : "")
|
|
487
|
+
+ stat("", esc(v.elapsed || "—"), "用时") + "</div>";
|
|
449
488
|
if (s && s.groups.length) {
|
|
450
489
|
const apart = s.supplement_groups && s.supplement_groups.length;
|
|
451
490
|
html += '<div class="sec"><div class="sec-h"><b>' + (apart ? "正文未下到 " : "未完成 ") + v.bad + " 篇</b><span>按原因</span></div>"
|
|
@@ -465,6 +504,50 @@ function doneCard() {
|
|
|
465
504
|
+ "</div>";
|
|
466
505
|
}
|
|
467
506
|
|
|
507
|
+
// The list behind a count: its groups (by way, by reason, by lane), each opened on its own.
|
|
508
|
+
const LIST_TITLES = { ok: "成功", failed: "失败", left: "剩余" };
|
|
509
|
+
let papersKind = "", papersList = null, listOpen = null;
|
|
510
|
+
function shownList() { return (papersList || {})[papersKind] || { count: 0, groups: [] }; }
|
|
511
|
+
function listGroupOpen(i) { return listOpen ? listOpen.has(i) : !!(shownList().groups[i] || {}).open; }
|
|
512
|
+
async function loadPapers() {
|
|
513
|
+
try { papersList = await api().paper_lists(); } catch (e) { papersList = papersList || {}; }
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function listRow(g, i) {
|
|
517
|
+
const opened = listGroupOpen(i);
|
|
518
|
+
let html = '<div class="grp"><button type="button" class="row" data-act="list_group" data-group="' + i + '" aria-expanded="' + opened + '">'
|
|
519
|
+
+ (papersKind === "failed" ? '<span class="tag ' + esc(g.cls) + '">' + esc(CLASS_TAGS[g.cls] || "") + "</span>" : "")
|
|
520
|
+
+ '<span class="reason">' + esc(g.label) + '</span><span class="n">' + g.count + " 篇</span>" + icon(opened ? "down" : "right") + "</button>";
|
|
521
|
+
if (!opened) return html + "</div>";
|
|
522
|
+
return html + '<ul class="paper-list">'
|
|
523
|
+
+ g.papers.map((p) => {
|
|
524
|
+
const lines = '<div class="t">' + esc(p.title) + "</div>" + (p.where ? '<div class="w">' + esc(p.where) + "</div>" : "");
|
|
525
|
+
// A saved paper shows its PDF in its folder; a failed one opens its article page, to fetch it by hand.
|
|
526
|
+
if (papersKind === "ok") {
|
|
527
|
+
return '<li><button type="button" class="open-article" data-act="show_paper" data-index="' + p.index + '" title="打开所在文件夹">' + lines + "</button></li>";
|
|
528
|
+
}
|
|
529
|
+
if (papersKind === "failed" && p.doi) {
|
|
530
|
+
return '<li><button type="button" class="open-article" data-act="open_article" data-doi="' + esc(p.doi)
|
|
531
|
+
+ '" title="在浏览器打开这篇文章">' + lines + "</button></li>";
|
|
532
|
+
}
|
|
533
|
+
return "<li>" + lines + "</li>";
|
|
534
|
+
}).join("")
|
|
535
|
+
+ (g.more ? '<li class="more">另有 ' + g.more + " 篇未列出</li>" : "") + "</ul></div>";
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function papersCard() {
|
|
539
|
+
const list = shownList();
|
|
540
|
+
const note = flash.text && Date.now() < flash.until ? flash.text : "";
|
|
541
|
+
let html = '<div class="card-body"><div class="head"><button class="iconbtn" data-act="back" aria-label="返回">' + icon("left") + "</button>"
|
|
542
|
+
+ '<div class="drag capsule-drag-region"><div class="text"><div class="title">' + LIST_TITLES[papersKind] + " " + list.count + " 篇</div></div></div></div>";
|
|
543
|
+
if (note) html += '<div class="line">' + esc(note) + "</div>";
|
|
544
|
+
if (!list.groups.length) html += '<div class="line">' + (papersList ? "没有论文" : "正在读取…") + "</div>";
|
|
545
|
+
// Half the screen at most, the title staying in place above it (user, 2026-11-10).
|
|
546
|
+
const most = Math.max(240, Math.round((screen.availHeight || 900) / 2) - 64);
|
|
547
|
+
return html + '<div class="sec papers-scroll" style="max-height:' + most + 'px">'
|
|
548
|
+
+ list.groups.map((g, i) => listRow(g, i)).join("") + "</div></div>";
|
|
549
|
+
}
|
|
550
|
+
|
|
468
551
|
function idleCard() {
|
|
469
552
|
return '<div class="card-body">' + header("PaperSearch", "暂无下载任务", true) + "</div>";
|
|
470
553
|
}
|
|
@@ -541,8 +624,10 @@ function settingsDownload() {
|
|
|
541
624
|
|
|
542
625
|
function settingsWait() {
|
|
543
626
|
return settingsHead("等待和提醒") + fieldRows("wait")
|
|
544
|
-
+ '<div class="row"><span>需要处理时发系统通知</span><
|
|
627
|
+
+ '<div class="row"><span>需要处理时发系统通知</span><span id="notify-test-button">' + notifyTestButton() + "</span>"
|
|
628
|
+
+ '<button class="switch' + (notifyOn ? " on" : "")
|
|
545
629
|
+ '" data-act="notify" role="switch" aria-checked="' + notifyOn + '" aria-label="系统通知"></button></div>'
|
|
630
|
+
+ '<div id="notify-test">' + notifyTest() + "</div>"
|
|
546
631
|
+ '<div class="err" id="notify-error" role="status"></div>' + settingsFoot();
|
|
547
632
|
}
|
|
548
633
|
|
|
@@ -588,6 +673,50 @@ function settingsCard() {
|
|
|
588
673
|
return '<div class="card-body settings">' + page() + "</div>";
|
|
589
674
|
}
|
|
590
675
|
|
|
676
|
+
// The check of system notifications under the switch (user, 2026-11-10).
|
|
677
|
+
const NOTIFY_HELP = {
|
|
678
|
+
mac: { corner: "右上角", off: "macOS 没有允许 PaperSearch 发通知", button: "打开系统通知设置",
|
|
679
|
+
where: "在“系统设置 › 通知 › PaperSearch”里打开“允许通知”,提醒样式选“横幅”或“提醒”。",
|
|
680
|
+
checks: ["系统设置 › 通知 › PaperSearch:允许通知,样式选“横幅”", "勿扰或专注模式开着时,通知不会弹出"] },
|
|
681
|
+
win: { corner: "右下角", off: "Windows 关掉了 PaperSearch 的通知", button: "打开通知设置",
|
|
682
|
+
where: "通知以“Windows PowerShell”的名义发出:在“设置 › 系统 › 通知”里打开通知,并允许 Windows PowerShell。",
|
|
683
|
+
checks: ["设置 › 系统 › 通知:打开通知,并允许 Windows PowerShell", "勿扰模式开着时,通知不会弹出"] },
|
|
684
|
+
};
|
|
685
|
+
// The test sits on the switch's row (user, 2026-11-10); what it found goes under the row.
|
|
686
|
+
function notifyTestButton() {
|
|
687
|
+
return notifyOn ? '<button class="btn" data-act="test_notify"' + ((notifyCheck || {}).state === "testing" ? " disabled" : "") + ">测试</button>" : "";
|
|
688
|
+
}
|
|
689
|
+
function notifyTest() {
|
|
690
|
+
if (!notifyOn) return "";
|
|
691
|
+
const help = NOTIFY_HELP[document.body.classList.contains("mac") ? "mac" : "win"], c = notifyCheck || {};
|
|
692
|
+
let html = "";
|
|
693
|
+
if (c.state === "sent") {
|
|
694
|
+
html += '<div class="nnote ok">✓ 已发出,' + help.corner + "应弹出一条通知</div>"
|
|
695
|
+
+ '<div class="nnote">没看到?<button type="button" class="link-btn" data-act="notify_unseen">看看要改哪里</button></div>';
|
|
696
|
+
}
|
|
697
|
+
if (c.state === "failed") html += '<div class="nnote bad">' + esc(c.message || "测试通知没有发出") + "</div>";
|
|
698
|
+
const open = '<button class="btn" data-act="notify_settings">' + help.button + "</button>";
|
|
699
|
+
if (c.state === "off") html += '<div class="nbox"><b>' + help.off + "</b>" + help.where + "<br>" + open + "</div>";
|
|
700
|
+
if (c.state === "unseen") {
|
|
701
|
+
html += '<div class="nbox"><b>没看到通知时,检查这几处</b><ol>'
|
|
702
|
+
+ help.checks.concat(["改好后再点一次“测试”"]).map((line) => "<li>" + line + "</li>").join("") + "</ol>" + open + "</div>";
|
|
703
|
+
}
|
|
704
|
+
return html;
|
|
705
|
+
}
|
|
706
|
+
function updateNotifyTest() {
|
|
707
|
+
// Only this part, keeping what the user is typing in the fields above.
|
|
708
|
+
const box = root.querySelector("#notify-test"), button = root.querySelector("#notify-test-button");
|
|
709
|
+
if (!box || !button) return;
|
|
710
|
+
const previous = root.getBoundingClientRect();
|
|
711
|
+
box.innerHTML = notifyTest();
|
|
712
|
+
button.innerHTML = notifyTestButton();
|
|
713
|
+
localize(box); localize(button);
|
|
714
|
+
root.classList.remove("animating");
|
|
715
|
+
root.style.width = ""; root.style.height = "";
|
|
716
|
+
root.style.removeProperty("--content-max-height");
|
|
717
|
+
fit(previous);
|
|
718
|
+
}
|
|
719
|
+
|
|
591
720
|
function updateStrip() {
|
|
592
721
|
// Progress behind the settings: refresh only this line, keeping what the user is typing.
|
|
593
722
|
const strip = root.querySelector("#task-strip");
|
|
@@ -606,7 +735,7 @@ function updateStrip() {
|
|
|
606
735
|
}
|
|
607
736
|
|
|
608
737
|
async function loadSettings() {
|
|
609
|
-
settings = await api().settings(); notifyOn = settings.notify; settingsErrors = {};
|
|
738
|
+
settings = await api().settings(); notifyOn = settings.notify; settingsErrors = {}; notifyCheck = null;
|
|
610
739
|
try { apiKeys = await api().api_keys(); } catch (error) { apiKeys = null; }
|
|
611
740
|
}
|
|
612
741
|
|
|
@@ -663,6 +792,7 @@ function render(force) {
|
|
|
663
792
|
let html, shape = "card";
|
|
664
793
|
if (panel === "settings") html = settingsCard();
|
|
665
794
|
else if (!open) { html = pill(); shape = "pill"; }
|
|
795
|
+
else if (panel === "papers" && V.lists && (V.mode === "running" || V.mode === "done")) html = papersCard();
|
|
666
796
|
else if (V.mode === "attention") html = attentionCard();
|
|
667
797
|
else if (V.mode === "running") html = runningCard();
|
|
668
798
|
else if (V.mode === "done") html = doneCard();
|
|
@@ -763,6 +893,7 @@ async function tick() {
|
|
|
763
893
|
// A prompt only turns the capsule amber (with a system notification); hovering opens it.
|
|
764
894
|
// Once the prompt is handled an open card folds back unless the pointer is on it.
|
|
765
895
|
if (before === "attention" && V.mode !== "attention" && !hovering && !dragging && !panel) open = false;
|
|
896
|
+
if (panel === "papers" && open) await loadPapers(); // an open list follows the download
|
|
766
897
|
render(switched);
|
|
767
898
|
// Also detect a real pointer departure when clamping moved the window away
|
|
768
899
|
// from a stationary cursor (there may be no further native boundary event).
|
|
@@ -779,6 +910,15 @@ async function act(action, target) {
|
|
|
779
910
|
case "close": closing = true; ++fitGeneration; clearInterval(pollTimer); clearTimeout(hoverTimer); clearTimeout(leaveTimer); return api().request_close(); // no call left waiting on a closed page
|
|
780
911
|
case "folder": return api().open_folder();
|
|
781
912
|
case "open_article": return say(await api().open_article(target.dataset.doi));
|
|
913
|
+
case "papers": papersKind = target.dataset.list; panel = "papers"; listOpen = null; papersList = null; render(true);
|
|
914
|
+
await loadPapers(); return render(true);
|
|
915
|
+
case "list_group": {
|
|
916
|
+
const i = Number(target.dataset.group);
|
|
917
|
+
listOpen = new Set(shownList().groups.map((_, j) => j).filter(listGroupOpen));
|
|
918
|
+
if (!listOpen.delete(i)) listOpen.add(i);
|
|
919
|
+
return render(true);
|
|
920
|
+
}
|
|
921
|
+
case "show_paper": return say(await api().show_paper(Number(target.dataset.index)));
|
|
782
922
|
case "group": return toggleGroup(Number(target.dataset.group));
|
|
783
923
|
case "show_browser": {
|
|
784
924
|
try { await inputActivation; }
|
|
@@ -853,11 +993,23 @@ async function act(action, target) {
|
|
|
853
993
|
target.classList.toggle("on", notifyOn);
|
|
854
994
|
target.setAttribute("aria-checked", String(notifyOn));
|
|
855
995
|
root.querySelector('#notify-error').textContent = "";
|
|
996
|
+
// Turned on: say at once when the system keeps the notifications from showing.
|
|
997
|
+
notifyCheck = null;
|
|
998
|
+
if (notifyOn && (await api().check_notifications()).state === "off") notifyCheck = { state: "off" };
|
|
999
|
+
updateNotifyTest();
|
|
856
1000
|
} catch (error) {
|
|
857
1001
|
root.querySelector('#notify-error').textContent = error.message || "通知设置保存失败";
|
|
858
1002
|
} finally { target.disabled = false; }
|
|
859
1003
|
return;
|
|
860
1004
|
}
|
|
1005
|
+
case "test_notify": {
|
|
1006
|
+
notifyCheck = { state: "testing" };
|
|
1007
|
+
updateNotifyTest();
|
|
1008
|
+
try { notifyCheck = await api().test_notification(); } catch (e) { notifyCheck = { state: "failed" }; }
|
|
1009
|
+
return updateNotifyTest();
|
|
1010
|
+
}
|
|
1011
|
+
case "notify_unseen": notifyCheck = { state: "unseen" }; return updateNotifyTest();
|
|
1012
|
+
case "notify_settings": return api().open_notification_settings();
|
|
861
1013
|
case "choose_folder": {
|
|
862
1014
|
const selected = await api().choose_download_directory();
|
|
863
1015
|
if (selected) { settings.download_dir = selected; root.querySelector('#download-dir').value = selected; }
|
|
@@ -885,7 +1037,7 @@ async function act(action, target) {
|
|
|
885
1037
|
}
|
|
886
1038
|
|
|
887
1039
|
// A paper list scrolls; pressing in it must not drag the window.
|
|
888
|
-
const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"], .paper-list');
|
|
1040
|
+
const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"], .paper-list, .papers-scroll');
|
|
889
1041
|
root.addEventListener("pointerdown", (event) => {
|
|
890
1042
|
if (event.button === 0 && api().activate_on_input) inputActivation = api().activate_on_input();
|
|
891
1043
|
if (event.button === 0 && event.target.closest(".attention-target")) {
|