papersearch 0.7.3 → 0.8.0
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/LICENSE-paper-search-mcp-nodejs +24 -0
- package/NOTICE +8 -37
- package/README.en.md +7 -3
- package/README.fr.md +268 -0
- package/README.ja.md +268 -0
- package/README.ko.md +268 -0
- package/README.md +7 -3
- package/README.zh-Hant.md +268 -0
- package/dist/capabilities/download/batch/batch.d.ts +16 -1
- package/dist/capabilities/download/batch/batch.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batch.js +389 -56
- package/dist/capabilities/download/batch/batch.js.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.d.ts.map +1 -1
- package/dist/capabilities/download/batch/batchFolder.js +3 -2
- package/dist/capabilities/download/batch/batchFolder.js.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.d.ts +11 -2
- package/dist/capabilities/download/batch/networkLoss.d.ts.map +1 -1
- package/dist/capabilities/download/batch/networkLoss.js +24 -3
- package/dist/capabilities/download/batch/networkLoss.js.map +1 -1
- package/dist/capabilities/download/batch/resume.d.ts +7 -0
- package/dist/capabilities/download/batch/resume.d.ts.map +1 -1
- package/dist/capabilities/download/batch/resume.js +50 -9
- package/dist/capabilities/download/batch/resume.js.map +1 -1
- package/dist/capabilities/download/content/markdown/pro.d.ts +6 -0
- package/dist/capabilities/download/content/markdown/pro.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/pro.js.map +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.d.ts +8 -5
- package/dist/capabilities/download/content/markdown/shortfall.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/shortfall.js +22 -10
- package/dist/capabilities/download/content/markdown/shortfall.js.map +1 -1
- package/dist/capabilities/download/content/markdown/step.d.ts +9 -0
- package/dist/capabilities/download/content/markdown/step.d.ts.map +1 -1
- package/dist/capabilities/download/content/markdown/step.js +42 -2
- package/dist/capabilities/download/content/markdown/step.js.map +1 -1
- package/dist/capabilities/download/content/markdown/types.d.ts +10 -1
- package/dist/capabilities/download/content/markdown/types.d.ts.map +1 -1
- package/dist/capabilities/download/handler.d.ts.map +1 -1
- package/dist/capabilities/download/handler.js +13 -5
- package/dist/capabilities/download/handler.js.map +1 -1
- package/dist/capabilities/download/outputLayout.d.ts.map +1 -1
- package/dist/capabilities/download/outputLayout.js +3 -1
- package/dist/capabilities/download/outputLayout.js.map +1 -1
- package/dist/capabilities/download/tools.js +2 -2
- package/dist/capabilities/download/tools.js.map +1 -1
- package/dist/capabilities/download/types.d.ts +9 -1
- package/dist/capabilities/download/types.d.ts.map +1 -1
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.d.ts +7 -0
- package/dist/infrastructure/runlog/RunLedger.d.ts.map +1 -1
- package/dist/infrastructure/runlog/RunLedger.js +13 -0
- package/dist/infrastructure/runlog/RunLedger.js.map +1 -1
- package/dist/infrastructure/runlog/failureClass.d.ts +2 -1
- package/dist/infrastructure/runlog/failureClass.d.ts.map +1 -1
- package/dist/infrastructure/runlog/failureClass.js +27 -4
- package/dist/infrastructure/runlog/failureClass.js.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.d.ts +11 -0
- package/dist/infrastructure/school/SchoolAttempt.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolAttempt.js +48 -5
- package/dist/infrastructure/school/SchoolAttempt.js.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.d.ts +1 -0
- package/dist/infrastructure/school/SchoolMcpClient.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolMcpClient.js +18 -6
- package/dist/infrastructure/school/SchoolMcpClient.js.map +1 -1
- package/dist/infrastructure/school/SchoolProgress.d.ts +2 -0
- package/dist/infrastructure/school/SchoolProgress.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolProgress.js +2 -0
- package/dist/infrastructure/school/SchoolProgress.js.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.d.ts +2 -0
- package/dist/infrastructure/school/SchoolReadiness.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolReadiness.js +2 -0
- package/dist/infrastructure/school/SchoolReadiness.js.map +1 -1
- package/dist/infrastructure/school/SchoolResultNormalizer.d.ts.map +1 -1
- package/dist/infrastructure/school/SchoolResultNormalizer.js +4 -0
- package/dist/infrastructure/school/SchoolResultNormalizer.js.map +1 -1
- package/dist/infrastructure/school/index.d.ts +2 -2
- package/dist/infrastructure/school/index.d.ts.map +1 -1
- package/dist/infrastructure/school/index.js +1 -1
- package/dist/infrastructure/school/index.js.map +1 -1
- package/dist/infrastructure/school/types.d.ts +42 -0
- package/dist/infrastructure/school/types.d.ts.map +1 -1
- package/dist/infrastructure/school/types.js.map +1 -1
- package/dist/management/failures/index.d.ts +23 -0
- package/dist/management/failures/index.d.ts.map +1 -1
- package/dist/management/failures/index.js +63 -18
- package/dist/management/failures/index.js.map +1 -1
- package/package.json +7 -2
- package/school/NOTICE +3 -2
- package/school/paper_search_school/adapters/__init__.py +2 -0
- package/school/paper_search_school/adapters/aps/__init__.py +3 -6
- package/school/paper_search_school/adapters/base.py +16 -2
- package/school/paper_search_school/adapters/copernicus/__init__.py +2 -7
- package/school/paper_search_school/adapters/elsevier/__init__.py +50 -1
- package/school/paper_search_school/adapters/frontiers/__init__.py +41 -2
- package/school/paper_search_school/adapters/ieee/__init__.py +6 -4
- package/school/paper_search_school/adapters/iop/__init__.py +8 -0
- package/school/paper_search_school/adapters/jama/__init__.py +8 -0
- package/school/paper_search_school/adapters/lww/__init__.py +14 -6
- package/school/paper_search_school/adapters/mdpi/__init__.py +12 -7
- package/school/paper_search_school/adapters/neurology/__init__.py +5 -2
- package/school/paper_search_school/adapters/optica/__init__.py +2 -9
- package/school/paper_search_school/adapters/oup/__init__.py +7 -4
- package/school/paper_search_school/adapters/platforms/__init__.py +4 -1
- package/school/paper_search_school/adapters/platforms/atypon/__init__.py +8 -0
- package/school/paper_search_school/adapters/platforms/jstage/__init__.py +64 -0
- package/school/paper_search_school/adapters/taylor_francis/__init__.py +0 -3
- package/school/paper_search_school/adapters/thieme/__init__.py +2 -9
- package/school/paper_search_school/api_keys.py +63 -13
- package/school/paper_search_school/assets/api_keys.json +14 -0
- package/school/paper_search_school/assets/capsule.html +156 -116
- package/school/paper_search_school/assets/capsule_en.json +69 -46
- package/school/paper_search_school/assets/capsule_fr.json +70 -47
- package/school/paper_search_school/assets/capsule_ja.json +69 -46
- package/school/paper_search_school/assets/capsule_ko.json +69 -46
- package/school/paper_search_school/assets/capsule_zh-Hant.json +68 -45
- package/school/paper_search_school/browser/batch_session.py +1 -1
- package/school/paper_search_school/browser/challenge/__init__.py +12 -9
- package/school/paper_search_school/browser/challenge/continuation.py +65 -0
- package/school/paper_search_school/browser/challenge/handlers/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/handlers/aws_waf.py +260 -0
- package/school/paper_search_school/browser/challenge/handlers/recaptcha_hcaptcha.py +167 -0
- package/school/paper_search_school/browser/challenge/handlers/text_captcha.py +100 -0
- package/school/paper_search_school/browser/challenge/handlers/turnstile.py +174 -0
- package/school/paper_search_school/browser/challenge/kinds.py +203 -0
- package/school/paper_search_school/browser/challenge/local/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/{interaction.py → local/interaction.py} +94 -13
- package/school/paper_search_school/browser/challenge/{pointer.py → local/pointer.py} +2 -2
- package/school/paper_search_school/browser/challenge/local/prompt.py +283 -0
- package/school/paper_search_school/browser/challenge/local/submission.py +33 -0
- package/school/paper_search_school/browser/challenge/services/__init__.py +1 -0
- package/school/paper_search_school/browser/challenge/services/solver.py +272 -0
- package/school/paper_search_school/cli_config.py +10 -5
- package/school/paper_search_school/config.py +11 -10
- package/school/paper_search_school/download_diagnostics.py +7 -2
- package/school/paper_search_school/engine/access_rules.py +12 -3
- package/school/paper_search_school/engine/batch.py +43 -11
- package/school/paper_search_school/engine/batch_access.py +38 -12
- package/school/paper_search_school/engine/batch_capture.py +215 -18
- package/school/paper_search_school/engine/batch_common.py +3 -0
- package/school/paper_search_school/engine/batch_diagnostics.py +25 -5
- package/school/paper_search_school/engine/batch_institution.py +38 -3
- package/school/paper_search_school/engine/batch_login.py +223 -16
- package/school/paper_search_school/engine/batch_pdf_urls.py +38 -7
- package/school/paper_search_school/engine/batch_waits.py +179 -12
- package/school/paper_search_school/engine/bridge.py +28 -4
- package/school/paper_search_school/engine/fulltext_page.py +45 -7
- package/school/paper_search_school/engine/router.py +16 -1
- package/school/paper_search_school/entitlements.py +1 -1
- package/school/paper_search_school/pdf_utils.py +25 -16
- package/school/paper_search_school/progress_capsule.py +36 -6
- package/school/paper_search_school/progress_reporter.py +54 -5
- package/school/paper_search_school/progress_view.py +63 -43
- package/school/paper_search_school/publishers/builtin/iop.json +2 -1
- package/school/paper_search_school/publishers/builtin/neurology.json +4 -2
- package/school/paper_search_school/publishers/site.py +12 -4
- package/school/paper_search_school/school_test.py +1 -1
- package/school/paper_search_school/server.py +17 -6
- package/school/paper_search_school/user_settings.py +13 -0
- package/school/pyproject.toml +1 -0
- package/skills/paper-search/SKILL.md +107 -107
- package/skills/paper-search/references/browser-download.md +102 -99
- package/skills/paper-search/references/capability-routing.md +89 -89
- package/skills/paper-search/references/cli-contract.md +78 -78
- package/skills/paper-search/references/federation-support.md +172 -172
- package/skills/paper-search/references/management-layer.md +78 -78
- package/skills/paper-search/references/publisher-support.md +38 -38
- package/skills/paper-search/references/school-setup.md +56 -55
- package/skills/paper-search/references/setup.md +20 -20
- package/skills/paper-search/references/troubleshooting.md +12 -12
- package/school/paper_search_school/browser/challenge/prompt.py +0 -154
|
@@ -96,6 +96,9 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
96
96
|
.head .text { flex: 1; min-width: 0; }
|
|
97
97
|
.head .title { font-weight: 600; font-size: 14px; }
|
|
98
98
|
.head .sub { font-size: 12px; color: var(--dim); }
|
|
99
|
+
.head .sub.noted { position: relative; }
|
|
100
|
+
.head .sub.noted .was { visibility: hidden; }
|
|
101
|
+
.head .sub.noted .note { position: absolute; left: 0; right: 0; top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
99
102
|
/* The head's buttons close together (user, 2026-11-17): the pin's room comes from their gaps, not the text's. */
|
|
100
103
|
.tools { display: flex; align-items: center; gap: 0; margin-right: -3px; flex: none; }
|
|
101
104
|
/* Each a 32 px target, drawn where it was (user, 2026-11-21: 最小化 was hard to hit): the margins take back what the
|
|
@@ -140,30 +143,6 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
140
143
|
.unverified-note .btn.link { display: inline; padding: 0; margin-left: 2px; font-size: inherit; }
|
|
141
144
|
.unverified-actions { margin-top: 6px; }
|
|
142
145
|
.stats { display: flex; padding: 12px 0; border-top: 0.5px solid var(--line); border-bottom: 0.5px solid var(--line); }
|
|
143
|
-
/* Markdown by rules not listed for its site: a dot beside 成功 and, pointed at, a card above the
|
|
144
|
-
counts (user, 2026-11-17: no yellow line for pages that were fine). */
|
|
145
|
-
.stats-wrap { position: relative; }
|
|
146
|
-
/* Pointing at the dot is not pointing at the count. */
|
|
147
|
-
.stats .stat:has(.rules-dot:hover) span { color: var(--dim); }
|
|
148
|
-
/* Up beside its label, taking no room: 成功, 失败 and 剩余 stay under their counts. */
|
|
149
|
-
.stats .stat > span { position: relative; }
|
|
150
|
-
.stats .rules-dot { position: absolute; left: 100%; top: -1px; margin-left: 3px; width: 6px; height: 6px; border-radius: 50%;
|
|
151
|
-
background: #8b9cf7; cursor: help; }
|
|
152
|
-
/* Its text in line with 成功 below: the card reaches past the counts by its own padding. */
|
|
153
|
-
.rules-pop { display: none; position: absolute; left: -11px; right: -11px; bottom: calc(100% + 6px); z-index: 5; padding: 9px 11px;
|
|
154
|
-
background: var(--bg); color: var(--fg); border-radius: 10px; font-size: 11.5px; line-height: 1.55;
|
|
155
|
-
/* Its edge drawn, not a border: a border pushed its text 1 px off 成功 (Windows, 2026-11-17). */
|
|
156
|
-
box-shadow: 0 0 0 0.5px var(--line), 0 6px 20px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08); }
|
|
157
|
-
.rules-pop.show { display: block; }
|
|
158
|
-
/* The way down to the dot keeps it open. */
|
|
159
|
-
.rules-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; }
|
|
160
|
-
.rules-pop .h { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; margin-bottom: 2px; }
|
|
161
|
-
/* The heading's dot hangs in the margin: every line starts in line with 成功. */
|
|
162
|
-
.rules-pop .h i { width: 6px; height: 6px; border-radius: 50%; background: #8b9cf7; flex: none; margin-left: -10px; }
|
|
163
|
-
.rules-pop .r { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
164
|
-
.rules-pop .r.counts { white-space: normal; }
|
|
165
|
-
.rules-pop .issue { display: block; margin-top: 6px; padding: 6px 0 0; width: 100%; text-align: left; border: none;
|
|
166
|
-
border-top: 0.5px solid var(--line); background: none; font: inherit; color: var(--accent); cursor: pointer; }
|
|
167
146
|
.stats div, .stats .stat { flex: 1; }
|
|
168
147
|
.stats .stat { padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
|
|
169
148
|
.stats .stat:hover span, .stats .stat:focus-visible span { color: var(--accent); }
|
|
@@ -221,6 +200,13 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
221
200
|
.mini-wrap:hover .mini-tip, .mini-wrap:focus-within .mini-tip { display: block; }
|
|
222
201
|
.mini-tip b { font-weight: 600; }
|
|
223
202
|
.mini-tip .k { color: var(--dim); display: inline-block; min-width: 2em; }
|
|
203
|
+
/* A label's small info icon (失败后自动重试): its tip under the row, from its left, inside the window in every language. */
|
|
204
|
+
.tip-row { position: relative; }
|
|
205
|
+
.tip-label { display: inline-flex; align-items: center; }
|
|
206
|
+
/* Pointed at, only its note shows: the cursor stays an arrow, no question mark (user, 2026-11-24). */
|
|
207
|
+
.mini-wrap.info { position: static; margin-left: 4px; color: var(--faint); cursor: default; }
|
|
208
|
+
.mini-wrap.info svg.i { width: 14px; height: 14px; }
|
|
209
|
+
.mini-tip.left { right: auto; left: 0; top: calc(100% - 4px); }
|
|
224
210
|
.foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 0.5px solid var(--line); }
|
|
225
211
|
/* Settings: a home list of three pages, each row with its current values; then the page itself. */
|
|
226
212
|
.nav-row, .key-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border: none; border-top: 0.5px solid var(--line);
|
|
@@ -346,6 +332,8 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
346
332
|
.key-row.editing:hover .nav-title { color: inherit; }
|
|
347
333
|
.key-set { font-size: 12px; color: var(--ok); white-space: nowrap; }
|
|
348
334
|
.key-row .btn { pointer-events: none; }
|
|
335
|
+
/* What a service is for, whole: on a second line where a language says it longer, not cut (user, 2026-11-25). */
|
|
336
|
+
.key-row .nav-sub { white-space: normal; }
|
|
349
337
|
.key-edit { background: var(--hover); border-radius: 8px; padding: 8px 10px; margin: 0 0 6px; }
|
|
350
338
|
/* The school sign-in page (PaperSearch Pro): the schools saved, one the default for downloads, each with its
|
|
351
339
|
account; the fields beside their names, close together (user, 2026-11-20). */
|
|
@@ -355,9 +343,6 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
355
343
|
.login-school { position: relative; border-radius: 10px; background: var(--fill); padding: 0 10px; }
|
|
356
344
|
.login-school.open { background: var(--bg); box-shadow: 0 0 0 1px var(--edge), 0 2px 8px rgba(17, 24, 39, 0.06); padding-bottom: 10px; }
|
|
357
345
|
.login-school.add { background: none; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
|
|
358
|
-
/* The open card's head: no masked account (its field is under it), room kept for ⋯ before the chevron. */
|
|
359
|
-
.login-row .ls-end { flex: none; width: 0; margin-left: auto; }
|
|
360
|
-
.login-row .ls-end.with-menu { width: 24px; }
|
|
361
346
|
.ls-dots { position: absolute; right: 29px; top: 7px; width: 24px; height: 24px; margin: 0; border-radius: 6px; background: var(--hover); }
|
|
362
347
|
.ls-dots svg.i { width: 15px; height: 15px; }
|
|
363
348
|
.ls-menu { position: absolute; right: 29px; top: 34px; z-index: 6; min-width: 120px; padding: 4px 0; border-radius: 8px; background: var(--bg);
|
|
@@ -382,6 +367,13 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
382
367
|
.settings .switch-row { border-top: none; border-bottom: 0.5px solid var(--line); }
|
|
383
368
|
.login-row .ls-acct { margin-left: auto; font-size: 11.5px; color: var(--dim); white-space: nowrap; }
|
|
384
369
|
.login-row svg.i { width: 13px; height: 13px; flex: none; color: var(--faint); }
|
|
370
|
+
/* A school's name whole (user, 2026-11-25, 乙): with its tags on one line where they fit, as before; where not (English and
|
|
371
|
+
French names, a long Chinese one) the name wraps and its tags go to the next line, not the name cut to "Hongmulan …". The
|
|
372
|
+
chevron, and on the open card the room for ⋯, stay at the top right. */
|
|
373
|
+
.ls-head { flex-wrap: wrap; row-gap: 4px; position: relative; padding-right: 20px; box-sizing: border-box; }
|
|
374
|
+
.ls-head.with-menu { padding-right: 49px; }
|
|
375
|
+
.ls-head > svg.i:last-child { position: absolute; right: 0; top: 13px; }
|
|
376
|
+
.login-row.ls-head .ls-name { flex: 0 1 auto; max-width: calc(100% - 18px); overflow: visible; white-space: normal; overflow-wrap: anywhere; }
|
|
385
377
|
.tag.fill { background: rgba(22, 163, 74, 0.12); color: var(--ok); }
|
|
386
378
|
.tag.trial { background: var(--hover); color: var(--accent); }
|
|
387
379
|
.tag.default { background: var(--accent); color: #fff; }
|
|
@@ -463,6 +455,11 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
463
455
|
.login-add .err { text-align: left; margin: 6px 0 0; }
|
|
464
456
|
.login-add .err:empty { display: none; }
|
|
465
457
|
.settings .key-edit input { width: 100%; text-align: left; background: var(--bg); }
|
|
458
|
+
.key-field + .key-field { margin-top: 7px; }
|
|
459
|
+
.key-field label { display: block; margin-bottom: 3px; font-size: 11px; color: var(--dim); }
|
|
460
|
+
.key-input { position: relative; }
|
|
461
|
+
.key-input .iconbtn { position: absolute; right: 8px; top: 50%; margin: 0; transform: translateY(-50%); }
|
|
462
|
+
.settings .key-input input[data-secret] { padding-right: 30px; }
|
|
466
463
|
.key-note { font-size: 11px; line-height: 1.5; color: var(--dim); margin-bottom: 8px; }
|
|
467
464
|
.key-edit .err { text-align: left; margin: 6px 0 0; }
|
|
468
465
|
.key-edit .err:empty { display: none; }
|
|
@@ -471,6 +468,11 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
471
468
|
.key-links, .key-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
|
|
472
469
|
.key-actions { gap: 6px; }
|
|
473
470
|
.key-links .grow, .key-actions .grow { flex: 1; }
|
|
471
|
+
/* The editor's buttons on one line where they fit; where a language's words are longer (French on the Mac), 清除 取消 保存
|
|
472
|
+
together on the next line at the right, not cut off at the window's edge (user, 2026-11-25). */
|
|
473
|
+
.key-actions.wraps { flex-wrap: wrap; row-gap: 6px; }
|
|
474
|
+
.key-actions-end { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
|
|
475
|
+
.key-actions.wraps .btn { white-space: nowrap; }
|
|
474
476
|
.key-links .iconbtn { margin: 0; }
|
|
475
477
|
.iconbtn[aria-pressed="true"] { color: var(--accent); }
|
|
476
478
|
.strip { display: flex; align-items: center; gap: 6px; width: 100%; box-sizing: border-box; margin: 10px 0 2px; padding: 6px 10px;
|
|
@@ -617,6 +619,8 @@ const ICONS = {
|
|
|
617
619
|
check: '<circle cx="12" cy="12" r="9"/><path d="M8 12.5l2.8 2.8L16 9.5"/>',
|
|
618
620
|
alert: '<circle cx="12" cy="12" r="9"/><path d="M12 7.5v5.5M12 16.5v.01"/>',
|
|
619
621
|
minimize: '<path d="M6 12h12"/>',
|
|
622
|
+
info: '<circle cx="12" cy="12" r="9"/><path d="M12 11v5.5M12 7.5v.01"/>',
|
|
623
|
+
download: '<path d="M12 4v11"/><path d="M7.5 10.5L12 15l4.5-4.5"/><path d="M5 20h14"/>',
|
|
620
624
|
pin: '<path d="M8 4h8"/><path d="M9.5 4v5.5L7 13h10l-2.5-3.5V4"/><path d="M12 13v7"/>',
|
|
621
625
|
close: '<path d="M7 7l10 10M17 7L7 17"/>',
|
|
622
626
|
folder: '<path d="M3.5 7.5a2 2 0 0 1 2-2h4l2 2h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z"/>',
|
|
@@ -684,6 +688,8 @@ function appIcon(size, pro) {
|
|
|
684
688
|
+ '<path d="M352 236 Q352 252 368 252 Q352 252 352 268 Q352 252 336 252 Q352 252 352 236Z" fill="#fff" opacity=".9"/></svg>';
|
|
685
689
|
}
|
|
686
690
|
const esc = (s) => String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]));
|
|
691
|
+
// The ring: the batch's progress in blue, one arc (user, 2026-11-24: its saved, failed and held parts in three colours
|
|
692
|
+
// were not pleasing; the counts say those).
|
|
687
693
|
function ring(pct, size, stroke, label) {
|
|
688
694
|
const r = (size - stroke) / 2, c = 2 * Math.PI * r, d = Math.max(0, Math.min(100, pct)) / 100 * c;
|
|
689
695
|
return '<svg class="ring" width="' + size + '" height="' + size + '" viewBox="0 0 ' + size + " " + size + '" aria-hidden="true">'
|
|
@@ -704,7 +710,7 @@ let flash = { text: "", until: 0 };
|
|
|
704
710
|
// 登录并继续 pressed: the held publishers then ({run, keys}); the button says so at once,
|
|
705
711
|
// as the papers go on only after the paper running, or within seconds (user, 2026-11-15).
|
|
706
712
|
let heldAsked = null;
|
|
707
|
-
let settings = null, settingsErrors = {}, notifyOn = true, hourlyNow = false;
|
|
713
|
+
let settings = null, settingsErrors = {}, notifyOn = true, hourlyNow = false, retryOn = false;
|
|
708
714
|
// What is typed on this settings page and not yet saved. Any redraw shows it instead of the
|
|
709
715
|
// saved value: a click on the card's background is a drag, and its end redraws the card
|
|
710
716
|
// (a typed hourly limit went back to the saved one, Windows, 2026-11-13).
|
|
@@ -846,7 +852,7 @@ function pill() {
|
|
|
846
852
|
}
|
|
847
853
|
if (v.mode === "running") {
|
|
848
854
|
const where = [v.part, v.publisher].filter(Boolean).join(" · ");
|
|
849
|
-
return '<div class="pillrow capsule-drag-region">' + ring(v.pct, 24, 3)
|
|
855
|
+
return '<div class="pillrow capsule-drag-region">' + ring(v.pct, 24, 3, "")
|
|
850
856
|
+ '<span class="count">' + (v.total ? v.done + "/" + v.total : v.done) + "</span>"
|
|
851
857
|
+ (where ? '<span class="dim">' + esc(where) + "</span>" : "") + '<span class="dot"></span>'
|
|
852
858
|
+ ((v.held || []).length ? heldTag() : "") + "</div>";
|
|
@@ -860,11 +866,16 @@ function pinButton() {
|
|
|
860
866
|
+ '" title="' + (pinned ? "已钉住,点一下取消" : "钉住:鼠标移开也不收起") + '">' + icon("pin") + "</button>";
|
|
861
867
|
}
|
|
862
868
|
|
|
863
|
-
|
|
869
|
+
// ``note``: said for a moment in the place of the line under the title (the next school), over it, one line whatever its
|
|
870
|
+
// length: the line stays, unseen, so the card keeps its height (a long school name wrapped, or the line wrapped in
|
|
871
|
+
// another language, would move the window twice).
|
|
872
|
+
function header(title, sub, closable, note) {
|
|
864
873
|
// Only the ring and the texts drag the window; the buttons stay clickable.
|
|
865
874
|
return '<div class="head"><div class="drag capsule-drag-region">'
|
|
866
875
|
+ (V.mode === "running" || V.mode === "attention" ? ring(V.pct, 40, 4, V.pct + "%") : "")
|
|
867
|
-
+ '<div class="text"><div class="title">' + esc(title) + '</div>' + (sub ? '<div class="sub
|
|
876
|
+
+ '<div class="text"><div class="title">' + esc(title) + '</div>' + (sub ? '<div class="sub' + (note ? ' noted' : "") + '">' + (note
|
|
877
|
+
? '<span class="was">' + esc(sub) + '</span><span class="note" title="' + esc(note) + '">' + esc(note) + "</span>" : esc(sub)) + "</div>" : "")
|
|
878
|
+
+ "</div></div>"
|
|
868
879
|
+ '<div class="tools">' + pinButton()
|
|
869
880
|
+ '<button class="iconbtn' + (newerVersion() ? " has-dot" : "") + '" data-act="settings" aria-label="设置">' + icon("gear") + "</button>"
|
|
870
881
|
+ '<button class="iconbtn" data-act="' + (closable ? "close" : "minimize") + '" aria-label="' + (closable ? "关闭" : "最小化")
|
|
@@ -924,8 +935,8 @@ function actionsBlock() {
|
|
|
924
935
|
}
|
|
925
936
|
|
|
926
937
|
// A count opens its list of papers once the batch has sent them (user, 2026-11-10).
|
|
927
|
-
function stat(list, value, label, color
|
|
928
|
-
const inner = "<b" + (color ? ' style="color:' + color + '"' : "") + ">" + value + "</b><span>" + label +
|
|
938
|
+
function stat(list, value, label, color) {
|
|
939
|
+
const inner = "<b" + (color ? ' style="color:' + color + '"' : "") + ">" + value + "</b><span>" + label + "</span>";
|
|
929
940
|
return V.lists && list ? '<button type="button" class="stat" data-act="papers" data-list="' + list + '">' + inner + "</button>"
|
|
930
941
|
: "<div>" + inner + "</div>";
|
|
931
942
|
}
|
|
@@ -956,38 +967,20 @@ function heldBlock() {
|
|
|
956
967
|
|
|
957
968
|
// Pages from sites not yet supported this batch: the site (or how many), how their Markdown
|
|
958
969
|
// went, and 查看 for those not kept, in the place of the held publishers' line (user, 2026-11-16).
|
|
959
|
-
//
|
|
960
|
-
//
|
|
961
|
-
//
|
|
962
|
-
//
|
|
963
|
-
//
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
const
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
function rulesCard() {
|
|
974
|
-
const s = rulesSites();
|
|
975
|
-
if (!s) return "";
|
|
976
|
-
const site = s.hosts.length === 1 ? s.hosts[0] : s.hosts.length + " 个网站";
|
|
977
|
-
// Whose rules were borrowed (user, 2026-11-17: "www.jacc.org · 采用 Atypon 规则").
|
|
978
|
-
const rules = s.rules && s.rules.length ? "采用 " + s.rules.join(" / ") + " 规则" : "没有适用的规则";
|
|
979
|
-
// Whether each one's Markdown came whole: only a complete one is saved.
|
|
980
|
-
const counts = ["完整已保存 " + s.saved + " 篇", "不完整未保存 " + s.unsaved + " 篇", s.skipped ? "未再尝试 " + s.skipped + " 篇" : ""]
|
|
981
|
-
.filter(Boolean).join(" · ");
|
|
982
|
-
// Saved or not, one way to have the site listed: the report goes with the issue (user, 2026-11-17).
|
|
983
|
-
const issue = '<button type="button" class="issue" data-act="markdown_issue">提 issue 纳入已登记网站</button>';
|
|
984
|
-
return '<div class="rules-pop' + (rulesShown ? " show" : "") + '"><div class="h"><i></i>' + esc(RULES_TITLE) + "</div>"
|
|
985
|
-
+ '<div class="r" title="' + esc(s.hosts.join("、")) + '">' + esc(site + " · " + rules) + '</div><div class="r counts">' + esc(counts) + "</div>" + issue + "</div>";
|
|
986
|
-
}
|
|
987
|
-
function showRules(on) {
|
|
988
|
-
rulesShown = on;
|
|
989
|
-
const pop = root.querySelector(".rules-pop");
|
|
990
|
-
if (pop) pop.classList.toggle("show", on);
|
|
970
|
+
// The papers held for a later try (V.later: without access, for the next school; 原因不明, once more at the end; their
|
|
971
|
+
// site blocked them, again at a time; their school login lapsed, after 登录并继续): 重试 beside
|
|
972
|
+
// 成功 and 失败 on the running card, its list naming them by why; 剩余 those not started (user, 2026-11-24: in place of
|
|
973
|
+
// the card the ring showed when pointed at). Without other saved schools (PaperSearch Pro) none waits for one.
|
|
974
|
+
// A batch that may hold papers for a later try (失败后自动重试 on, or 没权限时换下一所学校 with another school; user,
|
|
975
|
+
// 2026-11-24): otherwise no 重试, a paper paused for the school's login counted in 剩余.
|
|
976
|
+
const holding = () => V.holds !== false;
|
|
977
|
+
const retryCount = () => (holding() && V.later && V.later.total) || 0;
|
|
978
|
+
// The list behind 重试 from the counts alone, when the papers' list does not name them (a caller that sends no DOIs).
|
|
979
|
+
function retryCounts() {
|
|
980
|
+
const later = V.later || {};
|
|
981
|
+
const kinds = [["换学校再试 · 没权限", later.no_access], ["最后再试一次 · 原因不明", later.unexplained],
|
|
982
|
+
[(later.blocked_at ? later.blocked_at + " 再试 · " : "") + "被网站拦截", later.blocked], ["登录后继续 · 学校登录中途失效", later.login]];
|
|
983
|
+
return { count: retryCount(), groups: kinds.filter((kind) => kind[1] > 0).map(([label, count]) => ({ label, count, papers: [], counted: true })) };
|
|
991
984
|
}
|
|
992
985
|
|
|
993
986
|
// Under the group of pages from sites not yet supported: what that means, the sites with
|
|
@@ -1010,10 +1003,11 @@ function runningCard() {
|
|
|
1010
1003
|
// paper; once 登录并继续 is pressed, what comes next (user, 2026-11-15).
|
|
1011
1004
|
const asked = v.held_wait && resumeAsked();
|
|
1012
1005
|
const paper = v.held_wait ? '<div class="paper"><div class="line">' + esc(asked ? "如需登录,会打开学校登录页" : v.line) + "</div></div>" : paperBlock();
|
|
1013
|
-
return '<div class="card-body">' + header(asked ? "正在继续下载" : v.headline, sub, false) + paper + heldBlock()
|
|
1014
|
-
+ '<div class="stats
|
|
1015
|
-
+ stat("failed", v.bad, "失败", "var(--bad)"
|
|
1016
|
-
+ stat("
|
|
1006
|
+
return '<div class="card-body">' + header(asked ? "正在继续下载" : v.headline, sub, false, v.switch_note) + paper + heldBlock()
|
|
1007
|
+
+ '<div class="stats">' + stat("ok", v.ok, "成功", "var(--ok)")
|
|
1008
|
+
+ stat("failed", v.bad, "失败", "var(--bad)")
|
|
1009
|
+
+ (holding() ? stat(retryCount() ? "retry" : "", retryCount(), "重试", retryCount() ? "var(--warn-dot)" : "") : "")
|
|
1010
|
+
+ stat("left", v.left == null ? "—" : Math.max(0, v.left - retryCount()), "剩余") + "</div>"
|
|
1017
1011
|
+ actionsBlock() + "</div>";
|
|
1018
1012
|
}
|
|
1019
1013
|
|
|
@@ -1036,8 +1030,9 @@ function attentionCard() {
|
|
|
1036
1030
|
return html + "</div></div>";
|
|
1037
1031
|
}
|
|
1038
1032
|
|
|
1039
|
-
// The five failure classes by the names PaperSearch gives them everywhere (failureClass.ts, 2026-11-22
|
|
1040
|
-
|
|
1033
|
+
// The five failure classes by the names PaperSearch gives them everywhere (failureClass.ts, 2026-11-22;
|
|
1034
|
+
// 待适配 was 暂不支持 until 2026-11-25).
|
|
1035
|
+
const CLASS_TAGS = { no_access: "没权限", user_side: "要你处理", external: "外部原因", unsupported: "待适配",
|
|
1041
1036
|
unexplained: "原因不明", other: "其他", doubt: "待核对" };
|
|
1042
1037
|
let openGroups = null, groupsRun = ""; // null: each reason row as the view opens it
|
|
1043
1038
|
// Main-text rows first, then the supplementary files' rows, numbered on.
|
|
@@ -1077,6 +1072,7 @@ function reasonRow(g, i, brief) {
|
|
|
1077
1072
|
function doneCard() {
|
|
1078
1073
|
const v = V, s = v.summary;
|
|
1079
1074
|
let html = '<div class="card-body">' + header(v.headline, v.total ? "共 " + v.total + " 篇" : "", true)
|
|
1075
|
+
// 成功 green, as on the running card (user, 2026-11-24: the ring alone is blue, the batch's progress).
|
|
1080
1076
|
+ '<div class="stats done-stats">' + stat("ok", v.ok, "成功", "var(--ok)") + stat("failed", v.bad, "失败", v.bad ? "var(--bad)" : "")
|
|
1081
1077
|
// Papers the stop left undone in place of the time: their list opens from it (user, 2026-11-16).
|
|
1082
1078
|
+ (v.stopped ? stat("left", v.stopped, "已终止") : stat("", esc(v.elapsed || "—"), "用时")) + "</div>";
|
|
@@ -1113,15 +1109,21 @@ function doneCard() {
|
|
|
1113
1109
|
}
|
|
1114
1110
|
|
|
1115
1111
|
// The list behind a count: its groups (by way, by reason, by lane), each opened on its own.
|
|
1116
|
-
const LIST_TITLES = { ok: "成功", failed: "失败", left: "剩余" };
|
|
1112
|
+
const LIST_TITLES = { ok: "成功", failed: "失败", retry: "重试", left: "剩余" };
|
|
1117
1113
|
let papersKind = "", papersList = null, listOpen = null;
|
|
1118
|
-
function shownList() {
|
|
1114
|
+
function shownList() {
|
|
1115
|
+
const list = (papersList || {})[papersKind];
|
|
1116
|
+
if (papersKind === "retry" && !(list && list.groups.length) && retryCount()) return retryCounts();
|
|
1117
|
+
return list || { count: 0, groups: [] };
|
|
1118
|
+
}
|
|
1119
1119
|
function listGroupOpen(i) { return listOpen ? listOpen.has(i) : !!(shownList().groups[i] || {}).open; }
|
|
1120
1120
|
async function loadPapers() {
|
|
1121
1121
|
try { papersList = await api().paper_lists(); } catch (e) { papersList = papersList || {}; }
|
|
1122
1122
|
}
|
|
1123
1123
|
|
|
1124
1124
|
function listRow(g, i) {
|
|
1125
|
+
// 重试 from its counts alone: a line for each why, nothing to open.
|
|
1126
|
+
if (g.counted) return '<div class="grp"><div class="row"><span class="reason">' + esc(g.label) + '</span><span class="n">' + g.count + " 篇</span></div></div>";
|
|
1125
1127
|
const opened = listGroupOpen(i);
|
|
1126
1128
|
const unverified = g.unverified && shownList().groups.findIndex((other, j) => other.unverified && listGroupOpen(j)) === i;
|
|
1127
1129
|
let html = '<div class="grp"><button type="button" class="row" data-act="list_group" data-group="' + i + '" aria-expanded="' + opened + '">'
|
|
@@ -1136,7 +1138,7 @@ function listRow(g, i) {
|
|
|
1136
1138
|
if (papersKind === "ok") {
|
|
1137
1139
|
return '<li><button type="button" class="open-article" data-act="show_paper" data-index="' + p.index + '" title="打开所在文件夹">' + lines + "</button></li>";
|
|
1138
1140
|
}
|
|
1139
|
-
if ((papersKind === "failed" || papersKind === "left") && p.doi) {
|
|
1141
|
+
if ((papersKind === "failed" || papersKind === "retry" || papersKind === "left") && p.doi) {
|
|
1140
1142
|
return '<li><button type="button" class="open-article" data-act="open_article" data-doi="' + esc(p.doi)
|
|
1141
1143
|
+ '" title="在浏览器打开这篇文章">' + lines + "</button></li>";
|
|
1142
1144
|
}
|
|
@@ -1185,9 +1187,11 @@ function taskStrip() {
|
|
|
1185
1187
|
+ '<span class="grow">请重新登录学校</span><span>去处理 ›</span></button>';
|
|
1186
1188
|
}
|
|
1187
1189
|
if (V.mode === "running") {
|
|
1188
|
-
|
|
1190
|
+
// A download icon for 正在下载 and an arrow for 返回进度: the publisher's name has the room in every language (user, 2026-11-24:
|
|
1191
|
+
// "Downloading 11/71 · Spri… Back to progress ›"; its words on pointing at it).
|
|
1192
|
+
return '<button type="button" class="strip" data-act="progress" title="返回进度">' + icon("download") + '<span class="grow">'
|
|
1189
1193
|
+ esc(V.total ? V.done + "/" + V.total : V.done) + (V.publisher ? " · " + esc(V.publisher) : "")
|
|
1190
|
-
+ "</span><span
|
|
1194
|
+
+ "</span><span>›</span></button>";
|
|
1191
1195
|
}
|
|
1192
1196
|
return "";
|
|
1193
1197
|
}
|
|
@@ -1212,10 +1216,28 @@ const field = (name) => settings.fields.find((f) => f.name === name);
|
|
|
1212
1216
|
// The user's own folder as ~ on the home page's line (user, 2026-11-21: /Users/<name>/Downloads and the hourly limit
|
|
1213
1217
|
// did not fit one line in English); the download page shows the folder whole.
|
|
1214
1218
|
const shortPath = (path) => String(path || "").replace(/^(?:\/Users\/[^/]+|\/home\/[^/]+|[A-Za-z]:\\Users\\[^\\]+)(?=[\/\\]|$)/, "~");
|
|
1219
|
+
// The folder on that line whole when it fits; else its middle folders left out, the first ones first, then all but its
|
|
1220
|
+
// own name (user, 2026-11-24, 乙: D:\Project-XY\References and the hourly limit cut short in English). Measured once
|
|
1221
|
+
// the page is drawn and translated, at the card's own width.
|
|
1222
|
+
function fitPaths(node) {
|
|
1223
|
+
node.querySelectorAll(".nav-sub[data-path]").forEach((line) => {
|
|
1224
|
+
const whole = line.dataset.path, rest = tr(line.dataset.rest || "");
|
|
1225
|
+
const sep = whole.includes("\\") ? "\\" : "/";
|
|
1226
|
+
const path = whole.length > 3 ? whole.replace(/[\\/]+$/, "") : whole;
|
|
1227
|
+
const parts = path.split(sep), head = parts[0], last = parts[parts.length - 1], middle = parts.slice(1, -1);
|
|
1228
|
+
const tries = [path];
|
|
1229
|
+
for (let k = 1; k <= middle.length; k++) tries.push([head, "…", ...middle.slice(k), last].join(sep));
|
|
1230
|
+
if (parts.length > 1) tries.push("…" + sep + last);
|
|
1231
|
+
for (const each of tries) {
|
|
1232
|
+
line.textContent = rest ? each + " · " + rest : each;
|
|
1233
|
+
if (line.scrollWidth <= line.clientWidth) return;
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1215
1237
|
function settingsHome() {
|
|
1216
1238
|
const hourly = field("hourly"), login = field("login");
|
|
1217
1239
|
const rows = [
|
|
1218
|
-
["download", "folder", "下载", [shortPath(settings.download_dir), hourly ? "每家每小时 " + hourly.value + " 篇" : ""]],
|
|
1240
|
+
["download", "folder", "下载", [shortPath(settings.download_dir), hourly ? "每家每小时 " + hourly.value + " 篇" : ""], "", true],
|
|
1219
1241
|
["wait", "clock", "等待和提醒", [login ? "登录页 " + login.value + " 秒" : "", "系统通知" + (notifyOn ? "开" : "关")]],
|
|
1220
1242
|
["keys", "key", "API key", [apiKeys && apiKeys.ok ? "已填 " + apiKeys.filled + "/" + apiKeys.total : ""]],
|
|
1221
1243
|
];
|
|
@@ -1242,10 +1264,12 @@ function languageMenu() {
|
|
|
1242
1264
|
}
|
|
1243
1265
|
|
|
1244
1266
|
// A row that opens a page: its icon, its name, what it holds now.
|
|
1245
|
-
function navRow([page, glyph, title, sub, badge]) {
|
|
1267
|
+
function navRow([page, glyph, title, sub, badge, folderFirst]) {
|
|
1268
|
+
// folderFirst: its line begins with a folder, fitted to the line once drawn (fitPaths).
|
|
1269
|
+
const fitted = folderFirst && sub[0] ? ' data-path="' + esc(sub[0]) + '" data-rest="' + esc(sub.slice(1).filter(Boolean).join(" · ")) + '"' : "";
|
|
1246
1270
|
return '<button type="button" class="nav-row" data-act="settings_page" data-page="' + page + '">' + (glyph === "pro-app" ? appIcon(16, true) : icon(glyph))
|
|
1247
1271
|
+ '<span class="nav-text"><span class="nav-title">' + esc(title)
|
|
1248
|
-
+ (badge ? '<span class="pro-pill feature">' + esc(badge) + "</span>" : "") + '</span><span class="nav-sub">
|
|
1272
|
+
+ (badge ? '<span class="pro-pill feature">' + esc(badge) + "</span>" : "") + '</span><span class="nav-sub"' + fitted + ">"
|
|
1249
1273
|
+ esc(sub.filter(Boolean).join(" · ")) + "</span></span>" + icon("right") + "</button>";
|
|
1250
1274
|
}
|
|
1251
1275
|
|
|
@@ -1279,8 +1303,16 @@ function settingsDownload() {
|
|
|
1279
1303
|
+ fieldRows("download") + settingsFoot();
|
|
1280
1304
|
}
|
|
1281
1305
|
|
|
1306
|
+
// 失败后自动重试 (user, 2026-11-24): off by default; what it retries in a tip on its small icon, not on the page.
|
|
1307
|
+
function retryRow() {
|
|
1308
|
+
return '<div class="row tip-row"><span class="tip-label">失败后自动重试<span class="mini-wrap info" tabindex="0" aria-label="说明">' + icon("info")
|
|
1309
|
+
+ '<span class="mini-tip left" role="tooltip"><div>原因不明的失败,最后再重试</div><div>被网站拦截的,10 分钟后再重试</div></span></span></span>'
|
|
1310
|
+
+ '<button class="switch' + (retryOn ? " on" : "") + '" data-act="retry" role="switch" aria-checked="' + retryOn
|
|
1311
|
+
+ '" aria-label="失败后自动重试"></button></div>' + (settingsErrors.retry ? '<div class="err">' + esc(settingsErrors.retry) + "</div>" : "");
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1282
1314
|
function settingsWait() {
|
|
1283
|
-
return settingsHead("等待和提醒") + fieldRows("wait")
|
|
1315
|
+
return settingsHead("等待和提醒") + fieldRows("wait") + retryRow()
|
|
1284
1316
|
+ '<div class="row"><span>需要处理时发系统通知</span><span id="notify-test-button">' + notifyTestButton() + "</span>"
|
|
1285
1317
|
+ '<button class="switch' + (notifyOn ? " on" : "")
|
|
1286
1318
|
+ '" data-act="notify" role="switch" aria-checked="' + notifyOn + '" aria-label="系统通知"></button></div>'
|
|
@@ -1291,32 +1323,43 @@ function settingsWait() {
|
|
|
1291
1323
|
function keyRow(s) {
|
|
1292
1324
|
const name = '<span class="nav-text"><span class="nav-title">' + esc(s.name) + "</span>"
|
|
1293
1325
|
+ (s.use ? '<span class="nav-sub">' + esc(s.use) + "</span>" : "") + "</span>";
|
|
1326
|
+
const hasValues = s.keys.some((k) => k.set);
|
|
1294
1327
|
if (editing !== s.id) {
|
|
1295
1328
|
return '<button type="button" class="key-row" data-act="edit_key" data-service="' + esc(s.id) + '">' + name
|
|
1296
|
-
+ (s.set ? '<span class="key-set">' + esc(s.masked) + "</span>"
|
|
1329
|
+
+ (s.set ? '<span class="key-set">' + esc(s.masked) + "</span>"
|
|
1330
|
+
: '<span class="btn">' + (hasValues ? "补全" : "填写") + "</span>") + "</button>";
|
|
1297
1331
|
}
|
|
1298
1332
|
let html = '<div class="key-row editing">' + name
|
|
1299
|
-
+ (s.set ? '<span class="key-set">' + esc(s.masked) + "</span>"
|
|
1333
|
+
+ (s.set ? '<span class="key-set">' + esc(s.masked) + "</span>"
|
|
1334
|
+
: '<span class="dim" style="font-size:12px">' + (hasValues ? "待补全" : "未填") + "</span>")
|
|
1300
1335
|
+ '</div><div class="key-edit">';
|
|
1301
1336
|
// A saved key is in its field, hidden until the eye shows it.
|
|
1302
1337
|
// A contact email: what it is for above its field, and the field in plain text (user, 2026-11-11).
|
|
1303
1338
|
const emails = s.keys.every((k) => k.kind === "email");
|
|
1339
|
+
const labeled = s.keys.some((k) => k.kind === "zone");
|
|
1340
|
+
const eye = '<button class="iconbtn" data-act="reveal" aria-label="显示 key" aria-pressed="' + revealed + '">' + icon("eye") + "</button>";
|
|
1304
1341
|
if (s.note) html += '<div class="key-note">' + esc(s.note) + "</div>";
|
|
1305
1342
|
for (const k of s.keys) {
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1343
|
+
const id = "key-" + esc(k.key);
|
|
1344
|
+
const secret = k.kind !== "email" && k.kind !== "zone";
|
|
1345
|
+
const placeholder = k.kind === "zone" ? "填入“我的API”中的“名称”" : k.kind === "email" ? "填你常用的邮箱" : k.kind === "url" ? "服务地址" : "粘贴 key";
|
|
1346
|
+
if (labeled) html += '<div class="key-field"><label for="' + id + '">' + esc(k.label) + '</label><div class="key-input">';
|
|
1347
|
+
html += '<input id="' + id + '" data-key="' + esc(k.key) + '"' + (secret ? ' data-secret' : '')
|
|
1348
|
+
+ ' type="' + (secret && !revealed ? "password" : "text") + '" value="' + esc(editValues[k.key] || "")
|
|
1349
|
+
+ '" autocomplete="off" spellcheck="false"' + (labeled ? "" : ' aria-label="' + esc(s.name + " " + k.label) + '"')
|
|
1350
|
+
+ ' placeholder="' + placeholder + '">';
|
|
1351
|
+
if (labeled) html += (secret ? eye : "") + "</div></div>";
|
|
1309
1352
|
}
|
|
1310
1353
|
return html + '<div class="key-links">'
|
|
1311
1354
|
+ '<button class="btn link" data-act="signup" data-service="' + esc(s.id) + '">' + esc(s.signup_label || "去申请") + icon("external") + "</button>"
|
|
1312
1355
|
+ (s.guide ? '<button class="btn link" data-act="guide" data-service="' + esc(s.id) + '">' + esc(s.guide_label || "教程") + icon("external") + "</button>" : "")
|
|
1313
1356
|
+ '<span class="grow"></span>'
|
|
1314
|
-
+ (emails ? "" :
|
|
1315
|
-
+ '<div class="err" id="key-error" role="status"></div><div class="key-actions">'
|
|
1316
|
-
+ '<button class="btn" data-act="test_key" data-service="' + esc(s.id) + '">测试</button><span class="
|
|
1317
|
-
+ (
|
|
1357
|
+
+ (emails || labeled ? "" : eye) + "</div>"
|
|
1358
|
+
+ '<div class="err" id="key-error" role="status"></div><div class="key-actions wraps">'
|
|
1359
|
+
+ '<button class="btn" data-act="test_key" data-service="' + esc(s.id) + '">测试</button><span class="key-actions-end">'
|
|
1360
|
+
+ (hasValues ? '<button class="btn danger" data-act="clear_key" data-service="' + esc(s.id) + '">清除</button>' : "")
|
|
1318
1361
|
+ '<button class="btn" data-act="cancel_key">取消</button>'
|
|
1319
|
-
+ '<button class="btn primary" data-act="save_key" data-service="' + esc(s.id) + '">保存</button></div></div>';
|
|
1362
|
+
+ '<button class="btn primary" data-act="save_key" data-service="' + esc(s.id) + '">保存</button></span></div></div>';
|
|
1320
1363
|
}
|
|
1321
1364
|
|
|
1322
1365
|
function settingsKeys() {
|
|
@@ -1393,13 +1436,13 @@ const PRO_KEEPS = [["photo", "图片"], ["table", "表格"], ["formula", "公式
|
|
|
1393
1436
|
// said in full.
|
|
1394
1437
|
const PRO_MERITS = [
|
|
1395
1438
|
["file", "出版社原文", "取自出版社网页或 XML,不从 PDF 识别:章节、图注、表格(含合并单元格)和 LaTeX 公式按原文还原,避免识别错误。"],
|
|
1396
|
-
["check", "
|
|
1439
|
+
["check", "缺失会标明", "表格有缺失就不生成;图片没下到的在批量最后再取一次,仍缺就在原位置标明,清单里写明缺哪张图。"],
|
|
1397
1440
|
["link", "来源可追溯", "每篇保留出版社原始网页或 XML,以及来源清单:来源地址、DOI 核对结果和获取时间。"],
|
|
1398
1441
|
];
|
|
1399
1442
|
function proMerits() {
|
|
1400
1443
|
return '<button type="button" class="nav-row pro-row" data-act="pro_merits" aria-expanded="' + proMeritsOpen + '">' + icon("shield")
|
|
1401
1444
|
+ '<span class="nav-text"><span class="nav-title">' + esc("三项特点") + '</span><span class="nav-sub">'
|
|
1402
|
-
+ esc("出版社原文 ·
|
|
1445
|
+
+ esc("出版社原文 · 缺失会标明 · 来源可追溯") + "</span></span>" + icon(proMeritsOpen ? "down" : "right") + "</button>"
|
|
1403
1446
|
+ (proMeritsOpen ? '<div class="pro-merits">' + PRO_MERITS.map(([glyph, title, said]) => '<div class="pro-merit">' + icon(glyph)
|
|
1404
1447
|
+ "<div><b>" + esc(title) + "</b><span>" + esc(said) + "</span></div></div>").join("") + "</div>" : "");
|
|
1405
1448
|
}
|
|
@@ -1688,11 +1731,11 @@ function loginSchool(s, index) {
|
|
|
1688
1731
|
const shown = loginOpen === s.key, items = loginMenuItems(s);
|
|
1689
1732
|
// Their order, where there is more than one (user, 2026-11-21: 没权限时换下一所学校 goes down it; 1 the default).
|
|
1690
1733
|
const many = ((schoolLogin && schoolLogin.schools) || []).length > 1;
|
|
1691
|
-
const row = '<button type="button" class="login-row
|
|
1734
|
+
const row = '<button type="button" class="login-row ls-head' + (shown && items.length ? " with-menu" : "") + '" data-act="login_open" data-key="'
|
|
1735
|
+
+ esc(s.key) + '" aria-expanded="' + shown + '">'
|
|
1692
1736
|
+ (many ? '<span class="ls-n">' + (index + 1) + "</span>" : "") + '<span class="ls-name">' + esc(schoolName(s)) + "</span>"
|
|
1693
1737
|
+ (s.current ? '<span class="tag default">' + esc("默认") + "</span>" : "") + tagHtml(s.status)
|
|
1694
|
-
+ (shown ? '<span class="ls-
|
|
1695
|
-
: '<span class="ls-acct">' + esc(s.saved ? (s.enabled ? s.username : "已关闭") : "未填账号") + "</span>")
|
|
1738
|
+
+ (shown ? "" : '<span class="ls-acct">' + esc(s.saved ? (s.enabled ? s.username : "已关闭") : "未填账号") + "</span>")
|
|
1696
1739
|
+ icon(shown ? "down" : "right") + "</button>";
|
|
1697
1740
|
if (!shown) return '<div class="login-school">' + row + "</div>";
|
|
1698
1741
|
if (schoolTest.state === "running" && schoolTest.key === s.key) return '<div class="login-school open">' + row + loginTesting(schoolTest) + "</div>";
|
|
@@ -2058,7 +2101,7 @@ function updateStrip() {
|
|
|
2058
2101
|
}
|
|
2059
2102
|
|
|
2060
2103
|
async function loadSettings() {
|
|
2061
|
-
settings = await api().settings(); notifyOn = settings.notify; hourlyNow = settings.hourly_now === true; settingsErrors = {}; settingsDraft = {}; notifyCheck = null;
|
|
2104
|
+
settings = await api().settings(); notifyOn = settings.notify; hourlyNow = settings.hourly_now === true; retryOn = settings.retry === true; settingsErrors = {}; settingsDraft = {}; notifyCheck = null;
|
|
2062
2105
|
try { apiKeys = await api().api_keys(); } catch (error) { apiKeys = null; }
|
|
2063
2106
|
if (!proOn()) return;
|
|
2064
2107
|
try { proStatus = await api().pro_status(); } catch (error) { proStatus = null; }
|
|
@@ -2156,6 +2199,7 @@ function render(force) {
|
|
|
2156
2199
|
const list = root.querySelector(".papers-scroll, .keys-scroll");
|
|
2157
2200
|
if (list) list.scrollTop = scrolled;
|
|
2158
2201
|
localize(root);
|
|
2202
|
+
fitPaths(root);
|
|
2159
2203
|
if (panel === "settings") holdSettingsHeight();
|
|
2160
2204
|
if (attention) updateAttentionCountdown();
|
|
2161
2205
|
renderedAttention = attention ? V : null;
|
|
@@ -2302,11 +2346,7 @@ async function act(action, target) {
|
|
|
2302
2346
|
case "papers": {
|
|
2303
2347
|
papersKind = target.dataset.list; panel = "papers"; listOpen = null; papersList = null; render(true);
|
|
2304
2348
|
await loadPapers();
|
|
2305
|
-
// From the line on sites not yet supported: their group open, in view.
|
|
2306
|
-
const at = target.dataset.unverified ? shownList().groups.findIndex((g) => g.unverified) : -1;
|
|
2307
|
-
if (at >= 0) listOpen = new Set([at]);
|
|
2308
2349
|
render(true);
|
|
2309
|
-
if (at >= 0) { const shown = root.querySelector(".unverified-note"); if (shown) shown.closest(".grp").scrollIntoView({ block: "start" }); }
|
|
2310
2350
|
return;
|
|
2311
2351
|
}
|
|
2312
2352
|
case "markdown_issue": return say(await api().markdown_issue());
|
|
@@ -2388,7 +2428,7 @@ async function act(action, target) {
|
|
|
2388
2428
|
case "reveal":
|
|
2389
2429
|
revealed = !revealed;
|
|
2390
2430
|
target.setAttribute("aria-pressed", String(revealed));
|
|
2391
|
-
root.querySelectorAll(".key-edit input").forEach((input) => { input.type = revealed ? "text" : "password"; });
|
|
2431
|
+
root.querySelectorAll(".key-edit input[data-secret]").forEach((input) => { input.type = revealed ? "text" : "password"; });
|
|
2392
2432
|
return;
|
|
2393
2433
|
case "install_pro": {
|
|
2394
2434
|
try { proInstall = (await api().install_pro()) || { state: "idle" }; }
|
|
@@ -2606,6 +2646,21 @@ async function act(action, target) {
|
|
|
2606
2646
|
} finally { target.disabled = false; }
|
|
2607
2647
|
return;
|
|
2608
2648
|
}
|
|
2649
|
+
case "retry": {
|
|
2650
|
+
target.disabled = true;
|
|
2651
|
+
try {
|
|
2652
|
+
const result = await api().set_retry(!retryOn);
|
|
2653
|
+
if (!result.ok) throw new Error(result.error || "设置保存失败");
|
|
2654
|
+
retryOn = result.retry;
|
|
2655
|
+
settings.retry = retryOn;
|
|
2656
|
+
target.classList.toggle("on", retryOn);
|
|
2657
|
+
target.setAttribute("aria-checked", String(retryOn));
|
|
2658
|
+
} catch (error) {
|
|
2659
|
+
settingsErrors.retry = error.message || "设置保存失败";
|
|
2660
|
+
render(true);
|
|
2661
|
+
} finally { target.disabled = false; }
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2609
2664
|
case "hourly_now": {
|
|
2610
2665
|
target.disabled = true;
|
|
2611
2666
|
try {
|
|
@@ -2659,21 +2714,6 @@ async function act(action, target) {
|
|
|
2659
2714
|
// A paper list scrolls; pressing in it must not drag the window. Nor in 支持的学校's list (user, 2026-11-21: a press
|
|
2660
2715
|
// between its rows dragged, and the redraw after it went back to the top).
|
|
2661
2716
|
const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"], .paper-list, .papers-scroll, .keys-scroll, #support-list');
|
|
2662
|
-
// The dot's card: open while the pointer is on the dot or the card, a moment's grace between
|
|
2663
|
-
// them. Told by where the pointer moves, not by its leaving: the card is redrawn every second
|
|
2664
|
-
// and a dot redrawn under the pointer never says it was left.
|
|
2665
|
-
const RULES_PARTS = ".rules-dot, .rules-pop";
|
|
2666
|
-
function rulesPointer(over) {
|
|
2667
|
-
if (over) {
|
|
2668
|
-
clearTimeout(rulesTimer);
|
|
2669
|
-
rulesTimer = 0;
|
|
2670
|
-
if (!rulesShown) showRules(true);
|
|
2671
|
-
} else if (rulesShown && !rulesTimer) {
|
|
2672
|
-
rulesTimer = setTimeout(() => { rulesTimer = 0; showRules(false); }, 300);
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
document.addEventListener("pointermove", (event) => rulesPointer(!!(event.target.closest && event.target.closest(RULES_PARTS))));
|
|
2676
|
-
document.documentElement.addEventListener("pointerleave", () => rulesPointer(false));
|
|
2677
2717
|
root.addEventListener("pointerdown", (event) => {
|
|
2678
2718
|
if (event.button === 0 && api().activate_on_input) inputActivation = api().activate_on_input();
|
|
2679
2719
|
if (event.button === 0 && event.target.closest(".attention-target")) {
|