dsh-rank-scan 0.3.0 → 0.4.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/README.md +5 -4
- package/lib/client.js +250 -144
- package/lib/index.js +195 -30
- package/lib/index.js.map +1 -1
- package/lib/scan/freshness.js +26 -0
- package/lib/scan/freshness.js.map +1 -1
- package/lib/scan/types.js.map +1 -1
- package/lib/scan/view.js +64 -2
- package/lib/scan/view.js.map +1 -1
- package/lib/types/scan/freshness.d.ts +32 -0
- package/lib/types/scan/types.d.ts +5 -0
- package/lib/types/scan/view.d.ts +18 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -145,49 +145,120 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
145
145
|
return true
|
|
146
146
|
} catch (e) { return false }
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* 设计令牌:全面板唯一的颜色/间距/字号来源,其余地方不许写色值。
|
|
150
|
+
* 颜色优先读 DSH 宿主的 --dsw-alias-*(亮/暗主题各自解析),再退到旧版 --dsh-* 与静态兜底;
|
|
151
|
+
* 兜底只为了在宿主变量缺失时不至于透明或白底白字,不是第二套主题。
|
|
152
|
+
*/
|
|
153
|
+
const T = {
|
|
154
|
+
surface: 'var(--dsw-alias-bg-layer-1, var(--dsh-surface, #fff))',
|
|
155
|
+
surface2: 'var(--dsw-alias-bg-layer-2, var(--dsh-fill, rgba(128,128,128,.06)))',
|
|
156
|
+
fg: 'var(--dsw-alias-label-primary, var(--dsh-text, currentColor))',
|
|
157
|
+
muted: 'var(--dsw-alias-label-secondary, var(--dsh-text-secondary, rgba(128,128,128,.9)))',
|
|
158
|
+
border: 'var(--dsw-alias-border-l3, var(--dsh-border, rgba(128,128,128,.28)))',
|
|
159
|
+
subtle: 'var(--dsw-alias-interactive-bg-hover, var(--dsh-fill, rgba(128,128,128,.07)))',
|
|
160
|
+
accent: 'var(--dsw-alias-state-business-primary, var(--dsh-accent, #2f6feb))',
|
|
161
|
+
onAccent: 'var(--dsw-alias-label-primary-foreground, #fff)',
|
|
162
|
+
primary: 'var(--dsw-alias-button-primary-fill, #2f6feb)',
|
|
163
|
+
onPrimary: 'var(--dsw-alias-label-primary-foreground, #fff)',
|
|
164
|
+
ok: 'var(--dsw-alias-state-success-primary, #2e9e5b)',
|
|
165
|
+
warn: 'var(--dsw-alias-state-warn-primary, #c98a1a)',
|
|
166
|
+
bad: 'var(--dsw-alias-state-error-primary, #d6453d)',
|
|
167
|
+
// 涨跌口径沿用现有行为:名次前进(好)= 绿,后退(坏)= 红;箭头符号仍在,不靠颜色单打
|
|
168
|
+
up: 'var(--dsw-alias-state-success-primary, #2e9e5b)',
|
|
169
|
+
down: 'var(--dsw-alias-state-error-primary, #d6453d)',
|
|
170
|
+
sp: [0, 4, 8, 12, 16],
|
|
171
|
+
fs: { s: '12px', m: '13px', l: '15px' },
|
|
172
|
+
r: { s: '6px', m: '10px' },
|
|
173
|
+
shadowWin: '0 10px 30px rgba(0,0,0,.20)',
|
|
174
|
+
shadowMenu: '0 8px 20px rgba(0,0,0,.18)',
|
|
175
|
+
shadowBar: '0 -8px 12px -8px rgba(0,0,0,.28)',
|
|
176
|
+
}
|
|
177
|
+
/** 语义色低透明度底:用于提示条/未保存条(color-mix 不可用时退化为透明,不影响可读性) */
|
|
178
|
+
const wash = function (color, pct) { return 'color-mix(in srgb, ' + color + ' ' + pct + '%, transparent)' }
|
|
179
|
+
/**
|
|
180
|
+
* 作用域样式表:内联 style 写不了 :hover / :focus-visible / :disabled,
|
|
181
|
+
* 按钮与提示条改用 rs- 前缀的 class。只注入一次;选择器全部带前缀,不污染宿主。
|
|
182
|
+
*/
|
|
183
|
+
const ensureStyle = function () {
|
|
184
|
+
if (typeof document === 'undefined' || !document.head) return
|
|
185
|
+
// 测试/受限环境可能只有半截 document:缺 DOM API 就静默跳过,不影响功能
|
|
186
|
+
if (typeof document.getElementById !== 'function' || typeof document.createElement !== 'function') return
|
|
187
|
+
if (typeof document.head.appendChild !== 'function') return
|
|
188
|
+
if (document.getElementById('rank-scan-style')) return
|
|
189
|
+
const el = document.createElement('style')
|
|
190
|
+
el.id = 'rank-scan-style'
|
|
191
|
+
el.textContent = [
|
|
192
|
+
'.rs-btn{padding:4px 10px;font-size:' + T.fs.s + ';border-radius:' + T.r.s + ';border:1px solid ' + T.border + ';background:transparent;color:inherit;cursor:pointer;line-height:1.4;font-family:inherit}',
|
|
193
|
+
'.rs-btn:hover:not(:disabled){background:' + T.subtle + '}',
|
|
194
|
+
'.rs-btn:focus-visible{outline:2px solid ' + T.accent + ';outline-offset:1px}',
|
|
195
|
+
'[data-rank-scan-win] button:focus-visible{outline:2px solid ' + T.accent + ';outline-offset:1px}',
|
|
196
|
+
'.rs-btn:disabled{opacity:.45;cursor:not-allowed}',
|
|
197
|
+
'.rs-btn.is-primary{background:' + T.primary + ';border-color:' + T.primary + ';color:' + T.onPrimary + ';font-weight:600}',
|
|
198
|
+
'.rs-btn.is-primary:hover:not(:disabled){background:' + T.primary + ';opacity:.88}',
|
|
199
|
+
'.rs-btn.is-ghost{border-color:transparent}',
|
|
200
|
+
'.rs-btn.is-danger{color:' + T.bad + ';border-color:' + T.bad + '}',
|
|
201
|
+
'.rs-btn.is-on{background:' + T.subtle + ';font-weight:600}',
|
|
202
|
+
'.rs-menu-item{text-align:left;width:100%;border-color:transparent;background:transparent}',
|
|
203
|
+
'.rs-section-toggle{border:none;background:transparent;padding:0;font-weight:600;font-size:' + T.fs.m + ';width:100%;text-align:left;cursor:pointer;color:inherit;font-family:inherit}',
|
|
204
|
+
'.rs-section-toggle:focus-visible{outline:2px solid ' + T.accent + ';outline-offset:2px}',
|
|
205
|
+
'.rs-banner{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0;padding:8px 10px;border-radius:' + T.r.s + ';border:1px solid;border-left-width:3px;color:inherit}',
|
|
206
|
+
'.rs-banner.is-info{border-color:' + T.accent + ';background:' + wash(T.accent, 8) + '}',
|
|
207
|
+
'.rs-banner.is-warn{border-color:' + T.warn + ';background:' + wash(T.warn, 10) + '}',
|
|
208
|
+
'.rs-banner.is-error{border-color:' + T.bad + ';background:' + wash(T.bad, 8) + '}',
|
|
209
|
+
'.rs-banner .rs-banner-body{flex:1 1 100%;min-width:0}',
|
|
210
|
+
'[data-rank-scan-win] tbody tr:hover td{background:' + T.subtle + '}',
|
|
211
|
+
'[data-rank-scan-win] a:focus-visible{outline:2px solid ' + T.accent + ';outline-offset:1px}',
|
|
212
|
+
].join('\n')
|
|
213
|
+
document.head.appendChild(el)
|
|
214
|
+
}
|
|
148
215
|
const C = {
|
|
149
|
-
win: { position: 'fixed', zIndex: 60, background:
|
|
150
|
-
|
|
216
|
+
win: { position: 'fixed', zIndex: 60, background: T.surface, color: T.fg,
|
|
217
|
+
border: '1px solid ' + T.border, borderRadius: T.r.m,
|
|
218
|
+
boxShadow: T.shadowWin, fontSize: T.fs.m, lineHeight: 1.5,
|
|
151
219
|
display: 'flex', flexDirection: 'column', overflow: 'hidden' },
|
|
152
220
|
titlebar: { display: 'flex', alignItems: 'center', gap: '6px', padding: '6px 8px 6px 10px',
|
|
153
|
-
borderBottom: '1px solid
|
|
154
|
-
title: { fontWeight: 600, fontSize:
|
|
155
|
-
body: { padding: '
|
|
221
|
+
borderBottom: '1px solid ' + T.border, cursor: 'move', userSelect: 'none', background: T.subtle },
|
|
222
|
+
title: { fontWeight: 600, fontSize: T.fs.m, marginRight: '2px' },
|
|
223
|
+
body: { padding: '12px', overflow: 'auto', flex: '1 1 auto' },
|
|
156
224
|
row: { display: 'flex', flexWrap: 'wrap', gap: '6px', alignItems: 'center', margin: '5px 0' },
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
table: { width: '100%', borderCollapse: 'collapse', fontSize: '12px' },
|
|
165
|
-
th: { textAlign: 'left', padding: '2px 5px', borderBottom: '1px solid rgba(128,128,128,.3)', whiteSpace: 'nowrap', fontWeight: 600, position: 'sticky', top: 0, zIndex: 3, background: 'var(--dsh-surface, #fff)' },
|
|
166
|
-
td: { padding: '2px 5px', borderBottom: '1px solid rgba(128,128,128,.1)', verticalAlign: 'top' },
|
|
225
|
+
tabs: { display: 'flex', gap: '4px', borderBottom: '1px solid ' + T.border, marginBottom: '6px' },
|
|
226
|
+
tab: (on) => ({ padding: '3px 9px', cursor: 'pointer', border: 'none', background: 'transparent',
|
|
227
|
+
color: on ? T.fg : T.muted,
|
|
228
|
+
borderBottom: '2px solid ' + (on ? T.accent : 'transparent'), fontWeight: on ? 600 : 400 }),
|
|
229
|
+
table: { width: '100%', borderCollapse: 'collapse', fontSize: T.fs.m },
|
|
230
|
+
th: { textAlign: 'left', padding: '6px 8px', borderBottom: '1px solid ' + T.border, whiteSpace: 'nowrap', fontWeight: 600, position: 'sticky', top: 0, zIndex: 3, background: T.surface },
|
|
231
|
+
td: { padding: '6px 8px', borderBottom: '1px solid ' + wash(T.border, 50), verticalAlign: 'top' },
|
|
167
232
|
/**
|
|
168
233
|
* ★ 2026-10-17(易用性 P0):数字列以前会折行(「退 1」被拆成两行、20 个榜的表拉高一倍)。
|
|
169
234
|
* num 给数字列用(不折行 + 等宽数字,扫一眼就能对齐比大小)。
|
|
170
235
|
*/
|
|
171
236
|
num: { whiteSpace: 'nowrap', fontVariantNumeric: 'tabular-nums' },
|
|
172
237
|
/* 涨跌配色:绿涨红跌,与 dot('ok'/'bad') 同一套语义;符号仍然保留,不靠颜色单打 */
|
|
173
|
-
up: { color:
|
|
174
|
-
down: { color:
|
|
238
|
+
up: { color: T.up, whiteSpace: 'nowrap' },
|
|
239
|
+
down: { color: T.down, whiteSpace: 'nowrap' },
|
|
175
240
|
/* 长榜名单行省略(全名放 title 里)——避免「签约榜 × 轻小说(移动端口径)」撑成两行 */
|
|
176
241
|
ellip: { display: 'inline-block', maxWidth: '232px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', verticalAlign: 'bottom' },
|
|
177
|
-
muted: {
|
|
178
|
-
siteBar: { marginTop: '8px', fontWeight: 600, fontSize:
|
|
242
|
+
muted: { color: T.muted, fontSize: T.fs.s },
|
|
243
|
+
siteBar: { marginTop: '8px', fontWeight: 600, fontSize: T.fs.m, display: 'flex', gap: '6px', alignItems: 'center' },
|
|
179
244
|
dot: (tone) => ({ display: 'inline-block', width: '7px', height: '7px', borderRadius: '50%',
|
|
180
|
-
background: tone === 'bad' ?
|
|
245
|
+
background: tone === 'bad' ? T.bad : tone === 'warn' ? T.warn : T.ok }),
|
|
181
246
|
handle: { position: 'absolute', right: '0', bottom: '0', width: '16px', height: '16px', cursor: 'nwse-resize',
|
|
182
|
-
background: 'linear-gradient(135deg, transparent 46%,
|
|
183
|
-
detail: { marginTop: '6px', padding: '6px 8px', border: '1px solid
|
|
247
|
+
background: 'linear-gradient(135deg, transparent 46%, ' + T.muted + ' 46%, ' + T.muted + ' 54%, transparent 54%, transparent 70%, ' + T.muted + ' 70%, ' + T.muted + ' 78%, transparent 78%)' },
|
|
248
|
+
detail: { marginTop: '6px', padding: '6px 8px', border: '1px solid ' + T.border, borderRadius: '8px', background: T.subtle },
|
|
184
249
|
// 书签(用户数据):星标按钮与卡片
|
|
185
|
-
bmOn: { padding: '0 2px', border: 'none', background: 'transparent', cursor: 'pointer', color:
|
|
186
|
-
bmOff: { padding: '0 2px', border: 'none', background: 'transparent', cursor: 'pointer', opacity: 0.32, fontSize:
|
|
187
|
-
card: { margin: '7px 0', padding: '7px 9px', border: '1px solid
|
|
188
|
-
cardTitle: { fontWeight: 600, fontSize:
|
|
189
|
-
chip: { display: 'inline-block', marginRight: '4px', padding: '0 5px', borderRadius: '8px', background:
|
|
190
|
-
input: { padding: '3px 6px', fontSize:
|
|
250
|
+
bmOn: { padding: '0 2px', border: 'none', background: 'transparent', cursor: 'pointer', color: T.warn, fontSize: T.fs.m, lineHeight: 1 },
|
|
251
|
+
bmOff: { padding: '0 2px', border: 'none', background: 'transparent', cursor: 'pointer', opacity: 0.32, fontSize: T.fs.m, lineHeight: 1 },
|
|
252
|
+
card: { margin: '7px 0', padding: '7px 9px', border: '1px solid ' + T.border, borderRadius: '8px', background: T.subtle },
|
|
253
|
+
cardTitle: { fontWeight: 600, fontSize: T.fs.m },
|
|
254
|
+
chip: { display: 'inline-block', marginRight: '4px', padding: '0 5px', borderRadius: '8px', background: T.subtle, fontSize: T.fs.s },
|
|
255
|
+
input: { padding: '3px 6px', fontSize: T.fs.s, borderRadius: T.r.s, border: '1px solid ' + T.border, background: 'transparent', color: 'inherit' },
|
|
256
|
+
}
|
|
257
|
+
/** 统一提示条:三种语气只差颜色,形状一致;错误用 role=alert 让读屏器打断 */
|
|
258
|
+
function Banner(props) {
|
|
259
|
+
const role = props.live === false ? null : (props.tone === 'error' ? 'alert' : 'status')
|
|
260
|
+
return h('div', { className: 'rs-banner is-' + (props.tone || 'info'), role: role },
|
|
261
|
+
props.title ? h('strong', null, props.title) : null, props.children)
|
|
191
262
|
}
|
|
192
263
|
/**
|
|
193
264
|
* ★ 2026-10-17(易用性 P0):哪些列算「数字列」—— 只有它们套 C.num(不折行 + 等宽数字)。
|
|
@@ -478,7 +549,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
478
549
|
return h('span', { ref: wrapRef, style: { position: 'relative', display: 'inline-block' }, onKeyDown: onKey },
|
|
479
550
|
h('button', {
|
|
480
551
|
ref: btnRef,
|
|
481
|
-
|
|
552
|
+
className: 'rs-btn is-ghost' + (open ? ' is-on' : ''),
|
|
482
553
|
title: props.title || '',
|
|
483
554
|
'aria-haspopup': 'menu',
|
|
484
555
|
'aria-expanded': open ? 'true' : 'false',
|
|
@@ -492,18 +563,18 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
492
563
|
visibility: pos ? 'visible' : 'hidden',
|
|
493
564
|
minWidth: (props.width || 230) + 'px', maxWidth: 'min(420px, calc(100vw - 12px))',
|
|
494
565
|
maxHeight: (pos ? pos.maxH : 420) + 'px', overflowY: 'auto', overflowX: 'hidden',
|
|
495
|
-
padding: '5px', borderRadius: '8px', border: '1px solid
|
|
496
|
-
boxShadow:
|
|
566
|
+
padding: '5px', borderRadius: '8px', border: '1px solid ' + T.border, background: T.surface, color: T.fg,
|
|
567
|
+
boxShadow: T.shadowMenu, display: 'flex', flexDirection: 'column', gap: '4px' },
|
|
497
568
|
}, items.map(function (it, i) {
|
|
498
569
|
if (!it) return null
|
|
499
|
-
if (it && it.sep) return h('div', { key: 's' + i, style: { height: '1px', background:
|
|
570
|
+
if (it && it.sep) return h('div', { key: 's' + i, style: { height: '1px', background: T.border, margin: '3px 0' } })
|
|
500
571
|
if (it && it.rows) return h('div', { key: 'r' + i, style: { padding: '2px 2px 4px' } }, it.rows)
|
|
501
572
|
return h('button', {
|
|
502
573
|
key: 'i' + i,
|
|
503
574
|
role: 'menuitem',
|
|
504
575
|
disabled: !!it.disabled,
|
|
505
576
|
title: it.title || '',
|
|
506
|
-
|
|
577
|
+
className: 'rs-btn rs-menu-item', style: { opacity: it.disabled ? 0.45 : 1 },
|
|
507
578
|
onClick: function () { if (it.disabled) return; close(); if (it.onClick) it.onClick() },
|
|
508
579
|
}, it.label)
|
|
509
580
|
})) : null)
|
|
@@ -513,9 +584,9 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
513
584
|
const st = React.useState(props.defaultOpen !== false)
|
|
514
585
|
const open = st[0]
|
|
515
586
|
const setOpen = st[1]
|
|
516
|
-
return h('div', { style: { margin: '8px 0', padding: '6px 8px', border: '1px solid
|
|
587
|
+
return h('div', { style: { margin: '8px 0', padding: '6px 8px', border: '1px solid ' + T.border, borderRadius: '8px', background: T.surface2 } },
|
|
517
588
|
h('button', {
|
|
518
|
-
|
|
589
|
+
className: 'rs-section-toggle',
|
|
519
590
|
'aria-expanded': open ? 'true' : 'false',
|
|
520
591
|
onClick: function () { setOpen(!open) },
|
|
521
592
|
}, (open ? '▾ ' : '▸ ') + (props.title || '')),
|
|
@@ -815,7 +886,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
815
886
|
return h('div', { style: C.titlebar, onMouseDown: start },
|
|
816
887
|
h('span', { style: C.title }, '扫榜面板'),
|
|
817
888
|
h('span', { style: { flex: 1 } }),
|
|
818
|
-
h('button', {
|
|
889
|
+
h('button', { className: 'rs-btn is-ghost', onClick: props.onCollapse, title: '收起面板(Esc 也可以)' }, '收起'))
|
|
819
890
|
}
|
|
820
891
|
|
|
821
892
|
function ResizeHandle(props) {
|
|
@@ -845,10 +916,11 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
845
916
|
componentDidCatch(err) { try { console.error('[rank-scan] 页签渲染失败:' + (this.props.name || ''), err) } catch (e) {} }
|
|
846
917
|
render() {
|
|
847
918
|
if (this.state.err) {
|
|
848
|
-
return h(
|
|
849
|
-
h('div', { style: {
|
|
850
|
-
|
|
851
|
-
|
|
919
|
+
return h(Banner, { tone: 'error' },
|
|
920
|
+
h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: '8px', alignItems: 'center', width: '100%' } },
|
|
921
|
+
h('div', { style: { fontWeight: 600, flex: '1 1 100%' } }, '这个页签渲染出错了(面板其余部分仍可用)'),
|
|
922
|
+
h('div', { style: { ...C.muted, wordBreak: 'break-all', flex: '1 1 320px' } }, String((this.state.err && this.state.err.message) || this.state.err)),
|
|
923
|
+
h('button', { className: 'rs-btn', onClick: function () { this.setState({ err: null }) }.bind(this) }, '重试')))
|
|
852
924
|
}
|
|
853
925
|
return this.props.children
|
|
854
926
|
}
|
|
@@ -1057,21 +1129,21 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1057
1129
|
h('span', { style: C.muted }, '·'),
|
|
1058
1130
|
h('span', null, '已采集 ' + (c.ok || 0) + '/' + total),
|
|
1059
1131
|
waitingRows.length ? h('span', { style: C.muted, title: '这些站今天还没到自己的抓取时刻:不是失败' }, '· 未到计划 ' + waitingRows.length) : null,
|
|
1060
|
-
dueRows.length ? h('span', { style: { color:
|
|
1061
|
-
h('span', { style: issues.length ? { color:
|
|
1132
|
+
dueRows.length ? h('span', { style: { color: T.warn }, title: '已过计划时刻但还没抓到:等兜底,或点「扫描已选榜」马上跑' }, '· 待补跑 ' + dueRows.length) : null,
|
|
1133
|
+
h('span', { style: issues.length ? { color: T.warn, fontWeight: 600 } : { color: T.ok } },
|
|
1062
1134
|
issues.length ? '待处理 ' + issues.length + ' 项' : '无待处理'),
|
|
1063
1135
|
ov.hiddenCount ? h('span', { style: C.muted }, '· 未显示 ' + ov.hiddenCount + ' 个榜') : null),
|
|
1064
1136
|
/* ② 主动作:扫描(联网)与重新载入(只读本地)分开写清 */
|
|
1065
1137
|
h('div', { style: C.row },
|
|
1066
1138
|
h('button', {
|
|
1067
|
-
|
|
1139
|
+
className: 'rs-btn is-primary',
|
|
1068
1140
|
disabled: scanBusy,
|
|
1069
1141
|
title: '按「设置 → 抓取范围」里勾选的榜逐个扫描(会联网)',
|
|
1070
1142
|
onClick: function () { props.act('/scan') },
|
|
1071
1143
|
}, scanBtnText),
|
|
1072
|
-
scanBusy ? h('button', {
|
|
1073
|
-
badRows.length ? h('button', {
|
|
1074
|
-
h('button', {
|
|
1144
|
+
scanBusy ? h('button', { className: 'rs-btn is-danger', onClick: function () { props.act('/cancel') } }, '停止本次(保留已完成)') : null,
|
|
1145
|
+
badRows.length ? h('button', { className: 'rs-btn', disabled: scanBusy, onClick: function () { props.act('/retry') } }, '重试失败 ' + badRows.length + ' 个榜') : null,
|
|
1146
|
+
h('button', { className: 'rs-btn is-ghost', onClick: props.reload, title: '只重新读取本地数据:不联网、不采集' }, '重新载入'),
|
|
1075
1147
|
// 运行中不显示「上次 …」:那一轮还没结束,进度只放在主按钮一处(否则会同时出现两条「扫描中」)
|
|
1076
1148
|
scanRunning ? null : h('span', { style: C.muted }, '上次 ' + scanLabel(scan))),
|
|
1077
1149
|
/* 补全进度:面板顶部只有这一条(三态:跑着 / 还能续跑 / 当日已试满) */
|
|
@@ -1088,12 +1160,11 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1088
1160
|
: retryable === 0
|
|
1089
1161
|
? '补全已尽力:还缺 ' + left + ' 个榜(当日已试满,明天自动续跑)'
|
|
1090
1162
|
: '补全未完成:还缺 ' + left + ' 个榜(后台会继续补,也可进榜点「补全缺失字段」)'
|
|
1091
|
-
return h(
|
|
1163
|
+
return h(Banner, { tone: active ? 'info' : 'warn', live: false }, label)
|
|
1092
1164
|
})(),
|
|
1093
1165
|
/* ③ 需要处理:仅有问题时出现 */
|
|
1094
|
-
issues.length ? h(
|
|
1095
|
-
h('div', { style: {
|
|
1096
|
-
issues.map(function (it) {
|
|
1166
|
+
issues.length ? h(Banner, { tone: issues.some(function (it) { return it.status !== 'stale' && it.status !== 'enrich' }) ? 'error' : 'warn', title: '需要处理' },
|
|
1167
|
+
h('div', { className: 'rs-banner-body', style: { display: 'flex', flexDirection: 'column', gap: '2px' } }, issues.map(function (it) {
|
|
1097
1168
|
/**
|
|
1098
1169
|
* Spec S5:一条问题要给「榜名 + 发生时间 + 影响 + 可执行动作」。
|
|
1099
1170
|
* 以前只有一个泛化「重试失败 N 个榜」,看不出是哪次尝试、也没法直接进榜看。
|
|
@@ -1104,9 +1175,9 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1104
1175
|
it.at ? h('span', { style: C.muted }, fmtLocalHM(it.at)) : null,
|
|
1105
1176
|
h('span', null, it.why),
|
|
1106
1177
|
it.detail ? h('span', { style: C.muted }, '(' + String(it.detail).slice(0, 80) + ')') : null,
|
|
1107
|
-
it.boardId ? h('button', {
|
|
1108
|
-
it.boardId ? h('button', {
|
|
1109
|
-
})) : null,
|
|
1178
|
+
it.boardId ? h('button', { className: 'rs-btn', disabled: props.busy, onClick: function () { props.onOpenBoard && props.onOpenBoard(it.boardId) }, title: '在「榜单」页打开这一榜(保上下文)' }, '查看本榜') : null,
|
|
1179
|
+
it.boardId ? h('button', { className: 'rs-btn', disabled: props.busy, onClick: function () { props.onRescanBoard && props.onRescanBoard(it.boardId) }, title: '只重扫这一榜(会联网)' }, '重扫本榜') : null)
|
|
1180
|
+
}))) : null,
|
|
1110
1181
|
/* ④ 今天的变化 */
|
|
1111
1182
|
h('div', { style: C.siteBar }, '今天的变化' + (chgRealTotal ? '(' + chgRealTotal + ' 条)' : '')),
|
|
1112
1183
|
chg && chg.note ? h('div', { style: C.muted }, chg.note) : null,
|
|
@@ -1116,7 +1187,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1116
1187
|
[{ label: '全部', value: '' }].concat(groupNames.map(function (g) { return { label: g, value: g } })).map(function (o) {
|
|
1117
1188
|
return h('button', {
|
|
1118
1189
|
key: 'f-' + (o.value || 'all'),
|
|
1119
|
-
|
|
1190
|
+
className: chgFilter === o.value ? 'rs-btn is-on' : 'rs-btn',
|
|
1120
1191
|
onClick: function () { setChgFilter(o.value) },
|
|
1121
1192
|
}, o.label + ' ' + (o.value ? groupCount(o.value) : chgRealTotal))
|
|
1122
1193
|
})) : null,
|
|
@@ -1151,7 +1222,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1151
1222
|
h('thead', null, h('tr', null, ['分组', '榜', '书名', '变化'].map(function (t) { return h('th', { key: t, style: C.th }, t) }))),
|
|
1152
1223
|
h('tbody', null, shownBySite.flatMap(function (g) {
|
|
1153
1224
|
const head = h('tr', { key: 'ch-' + g.site },
|
|
1154
|
-
h('td', { style: { ...C.td, paddingTop: '7px', fontWeight: 600, color:
|
|
1225
|
+
h('td', { style: { ...C.td, paddingTop: '7px', fontWeight: 600, color: T.muted }, colSpan: 4 },
|
|
1155
1226
|
g.siteName + ' · ' + g.items.length + ' 条'))
|
|
1156
1227
|
const body = g.items.map(function (e, i) {
|
|
1157
1228
|
return h('tr', {
|
|
@@ -1172,7 +1243,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1172
1243
|
/* ⑤ 全部榜单(可折叠) */
|
|
1173
1244
|
h('div', { style: { ...C.row, marginTop: '8px' } },
|
|
1174
1245
|
h('button', {
|
|
1175
|
-
|
|
1246
|
+
className: 'rs-btn is-ghost',
|
|
1176
1247
|
'aria-expanded': showAll ? 'true' : 'false',
|
|
1177
1248
|
onClick: function () { setShowAll(!showAll) },
|
|
1178
1249
|
}, (showAll ? '▾ ' : '▸ ') + '全部榜单(' + total + ')')),
|
|
@@ -1189,20 +1260,28 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1189
1260
|
' ' + s.siteName,
|
|
1190
1261
|
h('span', { style: C.muted }, ' ' + s.boards.length + ' 个榜 · 已采集 ' + okN + (headTime ? ' · 抓取 ' + headTime : ''))))
|
|
1191
1262
|
const rowsOut = s.boards.map(function (b) {
|
|
1192
|
-
|
|
1263
|
+
/**
|
|
1264
|
+
* ★ 2026-10-25(批次榜):这一格不写「涨/新/退」——整批换新,涨新退没有意义,
|
|
1265
|
+
* 改写成「第 479 期 · 17 本」;没有批次信息的老数据才退回「—」。
|
|
1266
|
+
*/
|
|
1267
|
+
const batchCell = b.batch ? ((b.batch.label || ('批 ' + (b.batch.key || '—'))) + (b.batch.count != null ? ' · ' + b.batch.count + ' 本' : '')) : null
|
|
1268
|
+
const noBase = !batchCell && b.up === null && b.newCount === null && b.out === null
|
|
1193
1269
|
const label = b.name + (b.derived ? ' · 本地派生' : b.displayed ? '' : ' · 未显示')
|
|
1194
1270
|
return h('tr', { key: b.boardId },
|
|
1195
1271
|
h('td', { style: { ...C.td, paddingLeft: '16px', maxWidth: Math.max(140, Math.round(avail * 0.5)) } },
|
|
1196
1272
|
h('span', { style: { ...C.ellip, maxWidth: Math.max(120, Math.round(avail * 0.46)) + 'px' }, title: label }, label),
|
|
1197
1273
|
// 窄面板不单开「备注」列(会被压成一字一行),备注改到榜名下面
|
|
1198
1274
|
hasNoteCol && chgNarrow && b.note ? h('div', { style: { ...C.muted, whiteSpace: 'normal' } }, dash(b.note)) : null),
|
|
1199
|
-
h('td', { style: { ...C.td, ...C.num } },
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1275
|
+
h('td', { style: { ...C.td, ...C.num } },
|
|
1276
|
+
batchCell
|
|
1277
|
+
? h('span', { style: { whiteSpace: 'nowrap' }, title: '批次榜:整批换新,不比较变化(在「榜单」页按期看)' }, batchCell)
|
|
1278
|
+
: noBase ? '—' : h('span', { style: { whiteSpace: 'nowrap' } },
|
|
1279
|
+
'涨 ', h('span', { style: b.up > 0 ? C.up : null }, dash(b.up)), ' / ',
|
|
1280
|
+
'新 ', h('span', { style: { fontWeight: 600 } }, dash(b.newCount)), ' / ',
|
|
1281
|
+
'退 ', h('span', { style: b.out > 0 ? C.down : null }, dash(b.out)))),
|
|
1203
1282
|
h('td', { style: C.td }, b.status === 'ok'
|
|
1204
1283
|
? (headTime ? h('span', { style: C.muted }, '—') : (b.lastCapture ? fmtLocalHM(b.lastCapture) : '—'))
|
|
1205
|
-
: h('span', { style: { color: b.status === 'stale' ?
|
|
1284
|
+
: h('span', { style: { color: b.status === 'stale' ? T.warn : T.bad } }, statusText(b.status))),
|
|
1206
1285
|
hasNoteCol && !chgNarrow ? h('td', { style: C.td }, dash(b.note)) : null)
|
|
1207
1286
|
})
|
|
1208
1287
|
return [head].concat(rowsOut)
|
|
@@ -1421,17 +1500,17 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1421
1500
|
* 「有未保存的改动」和保存按钮(改了半天以为已经生效)。
|
|
1422
1501
|
* 保持原语义:保存只落抓取集 + 两个补全开关,计划时刻仍由「保存计划」单独保存。
|
|
1423
1502
|
*/
|
|
1424
|
-
const saveBar = h('div', { style: { position: 'sticky', bottom: '0', zIndex: 4, marginTop: '6px', padding: '
|
|
1425
|
-
border: '1px solid ' + (dirty ?
|
|
1426
|
-
background:
|
|
1427
|
-
backgroundImage: dirty ? 'linear-gradient(
|
|
1428
|
-
boxShadow:
|
|
1503
|
+
const saveBar = h('div', { style: { position: 'sticky', bottom: '0', zIndex: 4, marginTop: '6px', padding: '6px 8px',
|
|
1504
|
+
border: '1px solid ' + (dirty ? wash(T.warn, 60) : T.border), borderRadius: T.r.s,
|
|
1505
|
+
background: T.surface,
|
|
1506
|
+
backgroundImage: dirty ? 'linear-gradient(' + wash(T.warn, 16) + ',' + wash(T.warn, 16) + ')' : 'none',
|
|
1507
|
+
boxShadow: T.shadowBar } },
|
|
1429
1508
|
h('div', { style: C.row },
|
|
1430
|
-
h('button', {
|
|
1509
|
+
h('button', { className: 'rs-btn is-primary', disabled: busy || !dirty, onClick: save }, dirty ? '保存设置(' + picked.length + ' 个榜)' : '已保存(' + picked.length + ' 个榜)'),
|
|
1431
1510
|
// 放弃改动 = 真的丢掉草稿(否则 load 会按草稿再恢复一遍,等于没放弃)
|
|
1432
|
-
dirty ? h('button', {
|
|
1433
|
-
dirty ? h('span', { style: { color:
|
|
1434
|
-
h('button', {
|
|
1511
|
+
dirty ? h('button', { className: 'rs-btn', disabled: busy, onClick: function () { DRAFTS.settings = null; dirtyGuard.set('settings', false); setNote('已放弃改动'); load() } }, '放弃改动') : null,
|
|
1512
|
+
dirty ? h('span', { style: { color: T.warn } }, '有未保存的改动') : null,
|
|
1513
|
+
h('button', { className: 'rs-btn', disabled: busy, onClick: restoreDefaults, title: '把勾选恢复成插件默认抓取集(只改草稿,保存后生效)' }, '恢复默认'),
|
|
1435
1514
|
note ? h('span', { style: C.muted }, String(note).slice(0, 100)) : null))
|
|
1436
1515
|
return h('div', null,
|
|
1437
1516
|
h(Section, { title: '抓取范围(' + picked.length + ' 个榜)', defaultOpen: true },
|
|
@@ -1439,8 +1518,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1439
1518
|
h('div', { style: C.row }, sites.map(function (s) {
|
|
1440
1519
|
return h('span', { key: s, style: { ...C.row, margin: 0 } },
|
|
1441
1520
|
h('span', { style: C.muted }, siteNameOf(s) + ' ' + pickedOf(s) + '/' + siteTotal(s)),
|
|
1442
|
-
h('button', {
|
|
1443
|
-
h('button', {
|
|
1521
|
+
h('button', { className: 'rs-btn is-ghost', onClick: function () { setAll(s, true) } }, '全选'),
|
|
1522
|
+
h('button', { className: 'rs-btn is-ghost', onClick: function () { setAll(s, false) } }, '全不选'),
|
|
1444
1523
|
h(PopMenu, { label: '更多', width: 190, items: [
|
|
1445
1524
|
{ label: '补齐该站缺失字段', onClick: function () { enrichSite(s) }, title: '把该站已勾选的榜逐个补全(逐本 1 请求,很慢)' },
|
|
1446
1525
|
] }))
|
|
@@ -1481,18 +1560,18 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1481
1560
|
return h('div', { key: key, style: { ...C.row, marginTop: '2px' } },
|
|
1482
1561
|
h('span', { style: { width: '46px', flex: '0 0 auto' } }, s[1]),
|
|
1483
1562
|
h('input', {
|
|
1484
|
-
type: 'time', style: { ...C.
|
|
1563
|
+
type: 'time', style: { ...C.input, width: '92px' }, value: (tTimes || {})[key] || '',
|
|
1485
1564
|
onChange: function (e) { const nx = Object.assign({}, tTimes); nx[key] = e.target.value; setTTimes(nx) },
|
|
1486
1565
|
}),
|
|
1487
1566
|
h('span', { style: C.muted }, why))
|
|
1488
1567
|
})),
|
|
1489
1568
|
h('div', { style: { ...C.row, marginTop: '2px' } },
|
|
1490
1569
|
h('span', { style: { width: '46px', flex: '0 0 auto' } }, '兜底'),
|
|
1491
|
-
h('input', { type: 'time', style: { ...C.
|
|
1570
|
+
h('input', { type: 'time', style: { ...C.input, width: '92px' }, value: tFall, onChange: function (e) { setTFall(e.target.value) } }),
|
|
1492
1571
|
h('span', { style: C.muted }, '当天失败或内容待核对的站,到这个点再补一次(每站每天一次)')),
|
|
1493
1572
|
timesDirty ? h('div', { style: C.row },
|
|
1494
|
-
h('button', {
|
|
1495
|
-
h('span', { style: { color:
|
|
1573
|
+
h('button', { className: 'rs-btn', onClick: savePlan }, '保存计划'),
|
|
1574
|
+
h('span', { style: { color: T.warn } }, '时刻有改动,未保存')) : null,
|
|
1496
1575
|
h('div', { style: C.muted }, '状态更新于 ' + ((planLive && planLive.now) || '—') + (planLive && planLive.installedToday ? ' · 今天刚安装:安装当天不自动跑,明天起按上面的时刻执行' : '')),
|
|
1497
1576
|
tNote ? h('div', { style: C.muted }, String(tNote).slice(0, 140)) : null),
|
|
1498
1577
|
h(Section, { title: '数据与性能', defaultOpen: false, summary: (ov && ov.storage ? '数据目录 ' + fmtBytes(ov.storage.totalBytes) + ' · 保留 ' + retention + ' 天' : '') },
|
|
@@ -1522,8 +1601,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1522
1601
|
h('span', { style: C.muted }, '起点收藏补全'),
|
|
1523
1602
|
h('input', { type: 'checkbox', checked: qdEnrich, onChange: function (e) { setQdEnrich(e.target.checked); setDirty(true) } }),
|
|
1524
1603
|
h('span', { style: C.muted }, qdEnrich ? '已开启' : '已关闭(默认关)'),
|
|
1525
|
-
h('button', {
|
|
1526
|
-
h('button', {
|
|
1604
|
+
h('button', { className: 'rs-btn', disabled: busy, onClick: function () { setBusy(true); jpost('/qidianEnrich').then(function (r) { setNote((r && r.note) || '起点补全完成'); return load() }).catch(function (e) { setNote(String(e)) }).then(function () { setBusy(false) }) } }, '补全起点收藏'),
|
|
1605
|
+
h('button', { className: 'rs-btn', disabled: busy, onClick: function () { setBusy(true); jpost('/qidianCache', { clear: true }).then(function (r) { setNote((r && r.note) || '缓存已清'); return load() }).catch(function (e) { setNote(String(e)) }).then(function () { setBusy(false) }) } }, '清空书页缓存')),
|
|
1527
1606
|
h('div', { style: C.muted }, '起点书页缓存 ' + (qdCache && qdCache.cache ? qdCache.cache.books : 0) + ' 本 · 有效期 ' + ((qdCache && qdCache.ttlDays) || 7) + ' 天' +
|
|
1528
1607
|
(cat.bookCache ? ' · 通用书页缓存 ' + ((cat.bookCache.stat && cat.bookCache.stat.entries) || 0) + ' 本 · 有效期 ' + (cat.bookCache.ttlDays || 7) + ' 天' : '')),
|
|
1529
1608
|
h(Section, { title: '高级:请求间隔', defaultOpen: false, summary: '当前 ' + fmtIntervalText(intervalMs) },
|
|
@@ -1535,14 +1614,14 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1535
1614
|
},
|
|
1536
1615
|
[200, 500, 1000, 2000, 5000].map(function (v) { return h('option', { key: v, value: String(v) }, v + ' ms' + (v === 1000 ? '(默认)' : '')) }),
|
|
1537
1616
|
h('option', { key: 0, value: '0' }, '不限速(仅本地测试)')),
|
|
1538
|
-
h('button', {
|
|
1617
|
+
h('button', { className: 'rs-btn', disabled: busy, onClick: function () { setBusy(true); jpost('/select', { requestIntervalMs: intervalMs }).then(function () { setNote('请求间隔已改为 ' + (intervalMs === 0 ? '不限速' : intervalMs + 'ms')); return load() }).catch(function (e) { setNote(String(e)) }).then(function () { setBusy(false) }) } }, '应用'),
|
|
1539
1618
|
h('span', { style: C.muted }, '1s 是本项目自定的保守值(不是站点要求);调小更快,也更容易被站点注意到')))),
|
|
1540
1619
|
h(Section, { title: '关于与诊断', defaultOpen: false, summary: (sv.webServer ? '服务正常' : 'webServer 未注册') + ' · 自动扫描' + (sv.timerArmed ? '已生效' : '未生效') },
|
|
1541
1620
|
h(VersionRow, { setNote: setNote }),
|
|
1542
1621
|
h('div', { style: C.muted }, '服务:webServer ' + (sv.webServer ? '✓' : '✗') + ' · timer ' + (sv.timerService ? '✓' : '✗') + ' · 定时任务' + (sv.timerArmed ? '已启用' : '未启用')),
|
|
1543
1622
|
note ? h('div', { style: C.muted }, '最近提示:' + String(note).slice(0, 160)) : null,
|
|
1544
1623
|
h('div', { style: C.row },
|
|
1545
|
-
h('button', {
|
|
1624
|
+
h('button', { className: 'rs-btn', onClick: function () { try { navigator.clipboard.writeText(diag()); setNote('诊断信息已复制(不含凭证)') } catch (e) { setNote('复制失败:' + e) } } }, '复制诊断信息'))), saveBar)
|
|
1546
1625
|
}
|
|
1547
1626
|
/**
|
|
1548
1627
|
* ★ 版本区(2026-10-16):显示当前版本 + 「一键更新」。
|
|
@@ -1614,13 +1693,13 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1614
1693
|
? '当前 ' + chk.current + ':未发布到 npm,请用 Release 附件或仓库链接更新'
|
|
1615
1694
|
: '当前 ' + chk.current + '(' + (chk.reason || '更新检查不可用') + ')' + (chk.latest ? ';registry 最新 ' + chk.latest : '')
|
|
1616
1695
|
const canClick = !!(chk && (chk.canUpdateInPlace || chk.action === 'refresh' || chk.action === 'restart'))
|
|
1617
|
-
return h('div', { style: { margin: '8px 0', padding: '7px 9px'
|
|
1696
|
+
return h('div', { style: { ...C.card, margin: '8px 0', padding: '7px 9px' } },
|
|
1618
1697
|
h('div', { style: { fontWeight: 600, marginBottom: '4px' } }, '版本'),
|
|
1619
1698
|
h('div', { style: C.muted }, line),
|
|
1620
1699
|
(info && info.name && info.version) ? h('div', { style: C.muted }, info.name + ' v' + info.version) : null,
|
|
1621
1700
|
h('div', { style: C.row },
|
|
1622
1701
|
h('button', {
|
|
1623
|
-
|
|
1702
|
+
className: 'rs-btn',
|
|
1624
1703
|
disabled: busy !== '' || !canClick,
|
|
1625
1704
|
onClick: function () {
|
|
1626
1705
|
if (!chk) return
|
|
@@ -1636,7 +1715,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1636
1715
|
else refresh()
|
|
1637
1716
|
},
|
|
1638
1717
|
}, busy !== '' ? '处理中…' : (!chk ? '检查中…' : chk.buttonLabel)),
|
|
1639
|
-
h('button', {
|
|
1718
|
+
h('button', { className: 'rs-btn', disabled: busy !== '', onClick: function () { setNote(''); refresh() } }, '重新检查')),
|
|
1640
1719
|
note ? h('div', { style: C.muted }, note) : null)
|
|
1641
1720
|
}
|
|
1642
1721
|
|
|
@@ -1778,8 +1857,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1778
1857
|
h('div', { style: C.row },
|
|
1779
1858
|
h('span', { style: C.muted }, '书签夹'),
|
|
1780
1859
|
h('input', { style: { ...C.input, flex: 1, minWidth: '120px' }, value: folders, placeholder: '空格分隔,可属于多个夹', onChange: function (e) { setFolders(e.target.value) } }),
|
|
1781
|
-
h('button', {
|
|
1782
|
-
msg ? h('div', { style: { ...C.muted, color: String(msg).indexOf('失败') >= 0 ?
|
|
1860
|
+
h('button', { className: 'rs-btn is-primary', disabled: busy || !loaded, onClick: save }, busy ? '保存中…' : '保存')),
|
|
1861
|
+
msg ? h('div', { style: { ...C.muted, color: String(msg).indexOf('失败') >= 0 ? T.bad : null } }, msg) : null)
|
|
1783
1862
|
}
|
|
1784
1863
|
|
|
1785
1864
|
/**
|
|
@@ -1988,12 +2067,12 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
1988
2067
|
h('option', { value: '' }, '全部站'), sites.map(function (s) { return h('option', { key: s, value: s }, siteLabel(s)) })),
|
|
1989
2068
|
h('select', { style: C.input, value: f.folder, onChange: function (e) { setF({ folder: e.target.value }) } },
|
|
1990
2069
|
h('option', { value: '' }, '全部夹'), (store.folders || []).map(function (x) { return h('option', { key: x, value: x }, x) })),
|
|
1991
|
-
h('button', {
|
|
2070
|
+
h('button', { className: filtersOpen ? 'rs-btn is-on' : 'rs-btn', onClick: function () { setFiltersOpen(!filtersOpen) }, 'aria-expanded': filtersOpen ? 'true' : 'false' }, '筛选'),
|
|
1992
2071
|
h(PopMenu, { label: '更多', items: moreItems, width: 200 })),
|
|
1993
|
-
filtersOpen ? h('div', { style: { ...C.row, padding: '4px 6px', border: '1px solid
|
|
2072
|
+
filtersOpen ? h('div', { style: { ...C.row, padding: '4px 6px', border: '1px solid ' + T.border, borderRadius: '6px' } },
|
|
1994
2073
|
h('span', { style: C.muted }, '标签'),
|
|
1995
2074
|
h('input', { style: { ...C.input, width: '120px' }, placeholder: '#标签', value: f.tag || '', onChange: function (e) { setF({ tag: String(e.target.value).replace(/^#/, '') }) } }),
|
|
1996
|
-
(f.q || f.site || f.folder || f.tag) ? h('button', {
|
|
2075
|
+
(f.q || f.site || f.folder || f.tag) ? h('button', { className: 'rs-btn', onClick: function () { setF({ q: '', site: '', folder: '', tag: '' }) } }, '清除筛选') : null,
|
|
1997
2076
|
h('span', { style: C.muted }, '备注里写的 #标签 会自动出现在这里')) : null,
|
|
1998
2077
|
addOpen ? h('div', { style: { ...C.card, marginTop: '4px' } },
|
|
1999
2078
|
h('div', { style: C.row },
|
|
@@ -2002,22 +2081,22 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2002
2081
|
h('select', { style: C.input, value: manualSite, onChange: function (e) { setManualSite(e.target.value) } },
|
|
2003
2082
|
h('option', { value: '' }, '(URL 可自动识别)'),
|
|
2004
2083
|
h('option', { value: 'qidian' }, '起点'), h('option', { value: 'qidiantu' }, '起点图'), h('option', { value: 'ciweimao' }, '刺猬猫'), h('option', { value: 'sfacg' }, '菠萝包'), h('option', { value: 'fanqie' }, '番茄')),
|
|
2005
|
-
h('button', {
|
|
2006
|
-
h('button', {
|
|
2007
|
-
switchAsk ? h(
|
|
2008
|
-
h('div', { style: { fontWeight: 600 } }, '「' + (switchAsk.label || switchAsk.bookKey) + '」还开着没保存的备注/夹'),
|
|
2084
|
+
h('button', { className: 'rs-btn', disabled: !String(manual || '').trim(), onClick: addManual }, '加入书签'),
|
|
2085
|
+
h('button', { className: 'rs-btn', onClick: function () { setAddOpen(false) } }, '收起'))) : null,
|
|
2086
|
+
switchAsk ? h(Banner, { tone: 'warn' },
|
|
2087
|
+
h('div', { style: { fontWeight: 600, flex: '1 1 100%' } }, '「' + (switchAsk.label || switchAsk.bookKey) + '」还开着没保存的备注/夹'),
|
|
2009
2088
|
h('div', { style: C.row },
|
|
2010
|
-
h('button', {
|
|
2011
|
-
h('button', {
|
|
2089
|
+
h('button', { className: 'rs-btn is-primary', onClick: function () { setSwitchAsk(null) } }, '继续编辑'),
|
|
2090
|
+
h('button', { className: 'rs-btn', onClick: function () { applyEdit(switchAsk) } }, '放弃并切换')),
|
|
2012
2091
|
h('div', { style: C.muted }, '继续编辑:刚才写的内容还在。放弃并切换:只丢当前这条的未保存改动。')) : null,
|
|
2013
2092
|
h('div', { style: C.muted }, (store.list === null ? '加载中…' : '共 ' + list.length + ' 条' + (store.total && store.total !== list.length ? '(全部 ' + store.total + ' 条,已按筛选)' : '') + ' · 不含回收站')),
|
|
2014
|
-
store.health && store.health.error ? h('div', { style: { ...C.muted, color:
|
|
2015
|
-
selectMode ? h('div', { style: { ...C.row, padding: '4px 6px', border: '1px solid
|
|
2093
|
+
store.health && store.health.error ? h('div', { style: { ...C.muted, color: T.bad } }, '⚠ ' + store.health.error) : null,
|
|
2094
|
+
selectMode ? h('div', { style: { ...C.row, padding: '4px 6px', border: '1px solid ' + T.border, borderRadius: '6px', background: T.subtle } },
|
|
2016
2095
|
h('span', null, '已选 ' + sel.length + ' 条'),
|
|
2017
|
-
h('button', {
|
|
2018
|
-
h('button', {
|
|
2019
|
-
h('button', {
|
|
2020
|
-
h('button', {
|
|
2096
|
+
h('button', { className: 'rs-btn', onClick: function () { setSel(list.map(function (b) { return b.bookKey })) } }, '全选当前筛选(' + list.length + ')'),
|
|
2097
|
+
h('button', { className: 'rs-btn', disabled: !sel.length, onClick: function () { setSel([]) } }, '取消选择'),
|
|
2098
|
+
h('button', { className: 'rs-btn', disabled: !sel.length, onClick: function () { setScope('selected'); setExportOpen(true) } }, '导出已选'),
|
|
2099
|
+
h('button', { className: 'rs-btn', onClick: function () { setSelectMode(false); setSel([]) } }, '退出批量选择')) : null,
|
|
2021
2100
|
exportOpen ? h('div', { style: { ...C.card, marginTop: '4px' } },
|
|
2022
2101
|
h('div', { style: { fontWeight: 600 } }, '导出书签'),
|
|
2023
2102
|
h('div', { style: C.row },
|
|
@@ -2030,9 +2109,9 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2030
2109
|
h('select', { style: C.input, value: fmt, onChange: function (e) { setFmt(e.target.value) } },
|
|
2031
2110
|
h('option', { value: 'csv' }, 'CSV'), h('option', { value: 'json' }, 'JSON'), h('option', { value: 'md' }, 'Markdown')),
|
|
2032
2111
|
h('input', { style: { ...C.input, flex: 1, minWidth: '150px' }, placeholder: '导出目录(留空 = 默认目录)', value: dest, onChange: function (e) { setDest(e.target.value) } }),
|
|
2033
|
-
h('button', {
|
|
2034
|
-
h('button', {
|
|
2035
|
-
h('button', {
|
|
2112
|
+
h('button', { className: 'rs-btn', disabled: exporting || scopeCount() === 0, title: scopeCount() === 0 ? '这个范围没有条目' : '', onClick: doExport }, exporting ? '导出中…' : '导出 ' + scopeCount() + ' 条'),
|
|
2113
|
+
h('button', { className: 'rs-btn', onClick: function () { jpost('/bookmark/open-folder', { path: String(dest || '').trim() || undefined }).then(function (r) { setExMsg('已打开 ' + ((r && r.opened) || '')) }).catch(function (e) { setExMsg('打不开:' + e) }) } }, '打开文件夹'),
|
|
2114
|
+
h('button', { className: 'rs-btn', onClick: function () { setExportOpen(false) } }, '收起')),
|
|
2036
2115
|
exMsg ? h('div', { style: C.muted }, String(exMsg).slice(0, 140)) : null) : null,
|
|
2037
2116
|
list.length === 0 ? h('div', { style: C.muted }, store.list === null ? '' : (f.q || f.site || f.folder || f.tag ? '没有符合筛选条件的书签' : '还没有书签:在「榜单」里点书名旁的 ☆ 就能加')) : null,
|
|
2038
2117
|
list.map(function (b) {
|
|
@@ -2053,11 +2132,11 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2053
2132
|
oldMetric != null ? h('span', { style: { ...C.chip, opacity: 0.8 }, title: '书签记录:最近一次自动更新时该榜的' + lab + '(与上面的实时值不是同一时点)' }, '书签记录 ' + fmtRead(oldMetric)) : null,
|
|
2054
2133
|
metricText ? h('span', { style: C.chip }, metricText) : null,
|
|
2055
2134
|
b.capturedAt ? h('span', { style: C.muted, title: '这张卡的数据截止到这一天' }, '截止 ' + mdOf(b.capturedAt) + (b.ageDays != null ? '(' + b.ageDays + ' 天前)' : '')) : null,
|
|
2056
|
-
b.ageDays != null && b.ageDays >= 7 ? h('span', { style: { ...C.chip, color:
|
|
2135
|
+
b.ageDays != null && b.ageDays >= 7 ? h('span', { style: { ...C.chip, color: T.warn }, title: '超过 7 天没有变新:点「更新本书数据」试试;仍不变则这个来源可能取不到数了' }, '数据已 ' + b.ageDays + ' 天未更新') : null,
|
|
2057
2136
|
b.valueFrom === 'manual' ? h('span', { style: C.chip }, '待补') : null),
|
|
2058
2137
|
h('div', { style: C.row },
|
|
2059
2138
|
h('button', {
|
|
2060
|
-
|
|
2139
|
+
className: 'rs-btn', style: { borderStyle: 'dashed', textAlign: 'left', maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
|
|
2061
2140
|
title: noteText ? '编辑备注' : '加备注',
|
|
2062
2141
|
onClick: function () { startEdit(b) },
|
|
2063
2142
|
}, noteText ? noteText.slice(0, 60) : '+ 备注'),
|
|
@@ -2078,15 +2157,15 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2078
2157
|
onChange: function (e) { setDraft({ ...draft, folders: e.target.value }) },
|
|
2079
2158
|
})),
|
|
2080
2159
|
h('div', { style: C.row },
|
|
2081
|
-
h('button', {
|
|
2082
|
-
h('button', {
|
|
2160
|
+
h('button', { className: switchAsk ? 'rs-btn' : 'rs-btn is-primary', disabled: editBusy, onClick: function () { saveEdit(b) } }, editBusy ? '保存中…' : '保存'),
|
|
2161
|
+
h('button', { className: 'rs-btn', disabled: editBusy, onClick: function () { cancelEdit(b) } }, '取消'),
|
|
2083
2162
|
discardAsk
|
|
2084
|
-
? h('span', { style: { ...C.row, color:
|
|
2163
|
+
? h('span', { style: { ...C.row, color: T.warn } },
|
|
2085
2164
|
h('span', null, '放弃这些改动?'),
|
|
2086
|
-
h('button', {
|
|
2087
|
-
h('button', {
|
|
2165
|
+
h('button', { className: 'rs-btn', onClick: function () { closeEdit() } }, '放弃'),
|
|
2166
|
+
h('button', { className: 'rs-btn', onClick: function () { setDiscardAsk(false) } }, '继续编辑'))
|
|
2088
2167
|
: null,
|
|
2089
|
-
editErr ? h('span', { style: { color:
|
|
2168
|
+
editErr ? h('span', { style: { color: T.bad } }, editErr) : null)) : null,
|
|
2090
2169
|
h('div', { style: C.row },
|
|
2091
2170
|
h('a', { href: b.url || '#', style: { color: 'inherit', padding: '3px 8px' }, title: '在 DSH 侧栏浏览器打开', onClick: function (e) { e.preventDefault(); (props.openLink || function (u) { window.open(u, '_blank', 'noopener,noreferrer') })(b.url) } }, '打开'),
|
|
2092
2171
|
h(PopMenu, { label: '更多', width: 190, items: [
|
|
@@ -2106,27 +2185,27 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2106
2185
|
: null,
|
|
2107
2186
|
h('div', { style: C.muted }, '备注与夹只由你改:任何自动更新都不会覆盖。')) : null)
|
|
2108
2187
|
}),
|
|
2109
|
-
undo ? h(
|
|
2188
|
+
undo ? h(Banner, { tone: 'warn' },
|
|
2110
2189
|
h('span', null, '已删除「' + undo.label + '」'),
|
|
2111
|
-
h('button', {
|
|
2190
|
+
h('button', { className: 'rs-btn', onClick: doUndo }, '撤销'),
|
|
2112
2191
|
h('span', { style: C.muted }, '(8 秒内;之后可在回收站找回)')) : null,
|
|
2113
|
-
showTrash ? h('div', { style: { marginTop: '8px', padding: '6px 8px', border: '1px solid
|
|
2192
|
+
showTrash ? h('div', { style: { marginTop: '8px', padding: '6px 8px', border: '1px solid ' + T.border, borderRadius: '8px' } },
|
|
2114
2193
|
h('div', { style: C.row },
|
|
2115
2194
|
h('span', { style: { fontWeight: 600 } }, '回收站(' + trash.length + ')'),
|
|
2116
2195
|
trash.length
|
|
2117
2196
|
? (confirmPurge
|
|
2118
2197
|
? h('span', { style: C.row },
|
|
2119
|
-
h('span', { style: { color:
|
|
2120
|
-
h('button', {
|
|
2121
|
-
h('button', {
|
|
2122
|
-
: h('button', {
|
|
2198
|
+
h('span', { style: { color: T.bad } }, '清空后不可恢复,确定?'),
|
|
2199
|
+
h('button', { className: 'rs-btn is-danger', onClick: function () { jpost('/bookmark', { action: 'purge', bookKeys: trash.map(function (b) { return b.bookKey }) }).then(function () { setConfirmPurge(false); load() }) } }, '确认清空'),
|
|
2200
|
+
h('button', { className: 'rs-btn', onClick: function () { setConfirmPurge(false) } }, '取消'))
|
|
2201
|
+
: h('button', { className: 'rs-btn', onClick: function () { setConfirmPurge(true) } }, '清空回收站'))
|
|
2123
2202
|
: null),
|
|
2124
2203
|
trash.length === 0 ? h('div', { style: C.muted }, '回收站是空的') : trash.map(function (b) {
|
|
2125
2204
|
return h('div', { key: 'tr' + b.bookKey, style: { ...C.card, opacity: 0.8 } },
|
|
2126
2205
|
h('div', { style: C.row },
|
|
2127
2206
|
h('span', { style: C.cardTitle }, b.label),
|
|
2128
2207
|
h('span', { style: C.muted }, '删除于 ' + String(b.deletedAt).slice(0, 10) + ' 还可找回 ' + b.daysLeft + ' 天'),
|
|
2129
|
-
h('button', {
|
|
2208
|
+
h('button', { className: 'rs-btn', onClick: function () { store.act({ action: 'restore', bookKey: b.bookKey }).then(function () { load() }).catch(function () {}) } }, '恢复')))
|
|
2130
2209
|
})) : null,
|
|
2131
2210
|
exMsg && !exportOpen ? h('div', { style: C.muted }, String(exMsg).slice(0, 140)) : null,
|
|
2132
2211
|
store.msg ? h('div', { style: C.muted }, store.msg) : null,
|
|
@@ -2183,7 +2262,19 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2183
2262
|
.filter(function (o) { return !o.value || o.value === 'rank' || colKeys.indexOf(o.value) >= 0 })
|
|
2184
2263
|
// 日期下拉只用**这个榜自己**有快照的日期(/board 回的 data.dates)
|
|
2185
2264
|
const allDates = (data && data.dates && data.dates.length ? data.dates : [])
|
|
2186
|
-
|
|
2265
|
+
/**
|
|
2266
|
+
* ★ 2026-10-25(批次榜):下拉换成「批」。
|
|
2267
|
+
* 刺猬猫首订一期跨 7 个数据日、内容雷同 ⇒ 按日期列会重复 7 次;
|
|
2268
|
+
* 起点图首订一天一批,标签写「上架日」比写数据日期准确。
|
|
2269
|
+
* 选项 value 仍是**代表快照日**,宿主按它取快照(协议不变)。
|
|
2270
|
+
*/
|
|
2271
|
+
const periods = (data && data.periods) || []
|
|
2272
|
+
const batchShown = !!(data && data.batch)
|
|
2273
|
+
const dateOpts = batchShown
|
|
2274
|
+
? [{ value: '', label: '最新一批' }].concat(periods.slice().reverse().map(function (p) {
|
|
2275
|
+
return { value: p.date, label: (p.label || p.date) + (p.untrusted ? '(不可信)' : '') }
|
|
2276
|
+
}))
|
|
2277
|
+
: [{ value: '', label: '最新' }].concat(allDates.slice().reverse().map(function (d) { return { value: d, label: d } }))
|
|
2187
2278
|
React.useEffect(function () {
|
|
2188
2279
|
const my = ++catSeqRef.current
|
|
2189
2280
|
jget('/catalog').then(function (c) {
|
|
@@ -2229,7 +2320,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2229
2320
|
}, [props.rev, reloadBoard, directQ])
|
|
2230
2321
|
const selXS = function (label, value, options, onChange) {
|
|
2231
2322
|
return h('label', { style: C.row }, h('span', { style: C.muted }, label),
|
|
2232
|
-
h('select', { value: value, onChange: function (e) { onChange(e.target.value) }, style: C.
|
|
2323
|
+
h('select', { value: value, onChange: function (e) { onChange(e.target.value) }, style: C.input },
|
|
2233
2324
|
options.map(function (o) { return h('option', { key: o.value, value: o.value }, o.label) })))
|
|
2234
2325
|
}
|
|
2235
2326
|
const pickBoard = function (v) { sel.set({ board: v }); setBt(v); setSd(sel.pref(v, 'date')); setSs(sel.pref(v, 'sort')); setPick(null) }
|
|
@@ -2341,6 +2432,19 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2341
2432
|
const band = (function () {
|
|
2342
2433
|
if (!data) return null
|
|
2343
2434
|
const bits = []
|
|
2435
|
+
/**
|
|
2436
|
+
* ★ 2026-10-25(批次榜):这一屏是「第 479 期 / 上架日 2026-10-24」,
|
|
2437
|
+
* 不是「10-25 的榜 · 对比 10-23」——批次榜不比较变化,写日期只会误导。
|
|
2438
|
+
*/
|
|
2439
|
+
if (data.batch) {
|
|
2440
|
+
const bt = data.batch
|
|
2441
|
+
bits.push(bt.label || (bt.key ? String(bt.key) : '批次未知'))
|
|
2442
|
+
if (bt.kind === 'issue' && bt.saleStart) bits.push('上架 ' + bt.saleStart + (bt.saleEnd && bt.saleEnd !== bt.saleStart ? ' ~ ' + bt.saleEnd : ''))
|
|
2443
|
+
bits.push('共 ' + (bt.count == null ? '—' : bt.count) + ' 本')
|
|
2444
|
+
if (bt.snapshotDate) bits.push('快照 ' + bt.snapshotDate)
|
|
2445
|
+
bits.push('批次榜:整批换新,不比较变化')
|
|
2446
|
+
return bits.join(' · ')
|
|
2447
|
+
}
|
|
2344
2448
|
const src = data._contentDate || (data.rows && data.rows[0] && data.rows[0].extra && data.rows[0].extra.showDate) || null
|
|
2345
2449
|
bits.push('数据日期 ' + (data.dataDate || '—'))
|
|
2346
2450
|
// 首订是 n-1 口径:直查时「内容日期(上架日)」与「数据日期」必须分开写清楚
|
|
@@ -2374,8 +2478,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2374
2478
|
style: { width: '58px', fontSize: '12px', padding: '2px 4px' },
|
|
2375
2479
|
}),
|
|
2376
2480
|
h('span', { style: C.muted }, info.can ? '条(上限 ' + info.max + ')' : '条 · ' + info.hint),
|
|
2377
|
-
h('button', {
|
|
2378
|
-
h('button', {
|
|
2481
|
+
h('button', { className: 'rs-btn', disabled: !info.can || busy, onClick: function () { saveDepth(false) }, title: '只保存,下次扫描生效' }, '保存'),
|
|
2482
|
+
h('button', { className: 'rs-btn', disabled: !info.can || busy, onClick: function () { saveDepth(true) }, title: '保存后立刻抓一次这一榜(会联网)' }, '保存并扫描本榜'))),
|
|
2379
2483
|
},
|
|
2380
2484
|
{ sep: true },
|
|
2381
2485
|
{
|
|
@@ -2394,8 +2498,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2394
2498
|
h('div', { style: { ...C.muted, marginBottom: '3px' } }, '按上架日回看(仅本榜支持核对)'),
|
|
2395
2499
|
h('div', { style: C.row },
|
|
2396
2500
|
h('input', { type: 'date', value: qDate, onChange: function (e) { setQDate(e.target.value) }, style: { fontSize: '12px', padding: '2px 4px' } }),
|
|
2397
|
-
h('button', {
|
|
2398
|
-
h('button', {
|
|
2501
|
+
h('button', { className: 'rs-btn', disabled: busy || !qDate, onClick: function () { queryDay(false) } }, '查看'),
|
|
2502
|
+
h('button', { className: 'rs-btn', disabled: busy || !qDate, onClick: function () { queryDay(true) }, title: '抓取该上架日并存为本地快照(已有快照不覆盖)' }, '存入本地')),
|
|
2399
2503
|
h('div', { style: { ...C.muted, marginTop: '2px' } }, '首订按 n-1 锚:选上架日 X ⇒ 请求数据日期 X+1(页面内容日期就是 X);保存后快照记在 X+1 名下。站点给的日期对不上会被拒绝,不写任何文件。')),
|
|
2400
2504
|
})
|
|
2401
2505
|
}
|
|
@@ -2447,14 +2551,14 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2447
2551
|
h('div', { style: C.row },
|
|
2448
2552
|
h(BookmarkStar, { bookKey: bookKeyOf(curBoard, r.key), row: r, boardId: curBoard, dataDate: data && data.dataDate }),
|
|
2449
2553
|
h(DetailBookmarkEditor, { bookKey: bookKeyOf(curBoard, r.key) }),
|
|
2450
|
-
h('button', {
|
|
2554
|
+
h('button', { className: 'rs-btn', onClick: function (e) { e.stopPropagation(); if (props.openLink) props.openLink(r.url); else window.open(r.url, '_blank', 'noopener,noreferrer') } }, '在 DSH 侧栏浏览器打开'),
|
|
2451
2555
|
h('a', { href: r.url || '#', target: '_blank', rel: 'noreferrer', style: { color: 'inherit', padding: '3px 8px' }, onClick: function (e) { e.stopPropagation() } }, '新标签打开'),
|
|
2452
|
-
h('button', {
|
|
2453
|
-
h('button', {
|
|
2556
|
+
h('button', { className: 'rs-btn', onClick: function (e) { e.stopPropagation(); try { navigator.clipboard.writeText(r.url || '') } catch (err) {} } }, '复制链接'),
|
|
2557
|
+
h('button', { className: 'rs-btn', onClick: function (e) { e.stopPropagation(); setPick(null) } }, '关闭')),
|
|
2454
2558
|
ex.qidiantuUrl || ex.sourceUrl
|
|
2455
2559
|
? h('div', { style: C.row },
|
|
2456
|
-
(ex.qidiantuUrl ? h('button', {
|
|
2457
|
-
(ex.sourceUrl ? h('button', {
|
|
2560
|
+
(ex.qidiantuUrl ? h('button', { className: 'rs-btn', onClick: function (e) { e.stopPropagation(); (props.openLink || window.open)(ex.qidiantuUrl) } }, '看起点图原始页') : null),
|
|
2561
|
+
(ex.sourceUrl ? h('button', { className: 'rs-btn', onClick: function (e) { e.stopPropagation(); (props.openLink || window.open)(ex.sourceUrl) } }, '看原数据来源页') : null),
|
|
2458
2562
|
h('span', { style: C.muted }, '(数据口径以来源页为准)'))
|
|
2459
2563
|
: null)
|
|
2460
2564
|
}
|
|
@@ -2475,8 +2579,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2475
2579
|
key: r.key || ('row' + i),
|
|
2476
2580
|
tabIndex: 0,
|
|
2477
2581
|
style: { ...C.card, padding: '5px 8px', margin: '5px 0', cursor: 'pointer',
|
|
2478
|
-
borderColor: open ?
|
|
2479
|
-
background: open ?
|
|
2582
|
+
borderColor: open ? T.border : undefined,
|
|
2583
|
+
background: open ? T.subtle : undefined },
|
|
2480
2584
|
onClick: function () { setPick(open ? null : r) },
|
|
2481
2585
|
onKeyDown: function (e) { if (e && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); setPick(open ? null : r) } },
|
|
2482
2586
|
},
|
|
@@ -2501,10 +2605,10 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2501
2605
|
band ? h('div', { style: { ...C.muted, marginTop: '2px' } }, band) : null,
|
|
2502
2606
|
/* Spec 4.2:补全缺多少条要**就近可见**,别只藏在「更多」菜单里 */
|
|
2503
2607
|
enrichMissing ? h('div', { style: { ...C.row, marginTop: '2px' } },
|
|
2504
|
-
h('span', { style: { color:
|
|
2505
|
-
h('button', {
|
|
2608
|
+
h('span', { style: { color: T.warn } }, '补全未完成:还缺 ' + enrichMissing + ' 条字段'),
|
|
2609
|
+
h('button', { className: 'rs-btn', disabled: busy, onClick: doEnrich }, '补全'),
|
|
2506
2610
|
h('span', { style: C.muted }, '(榜页没给收藏/字数,要进书页取;1 秒/本)')) : null,
|
|
2507
|
-
viewDate ? h(
|
|
2611
|
+
viewDate ? h(Banner, { tone: 'warn' },
|
|
2508
2612
|
h('span', { style: { fontWeight: 600 } }, '正在查看历史:' + viewDate),
|
|
2509
2613
|
h('span', { style: C.muted }, data && data._queryDate ? '(直查站点,未落盘)' : '(本地快照)'),
|
|
2510
2614
|
/**
|
|
@@ -2513,7 +2617,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2513
2617
|
* 现在显式清直查视图 + 清本地日期偏好 + 递增 nonce ⇒ **一定**重发一次无 date 的 GET。
|
|
2514
2618
|
*/
|
|
2515
2619
|
h('button', {
|
|
2516
|
-
|
|
2620
|
+
className: 'rs-btn',
|
|
2517
2621
|
onClick: function () {
|
|
2518
2622
|
setSs('')
|
|
2519
2623
|
setSd('')
|
|
@@ -2525,9 +2629,9 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2525
2629
|
}, '回到最新')) : null,
|
|
2526
2630
|
data && data.fallbackFrom ? h('div', { style: C.muted }, '当天(' + data.requestedDate + ')没有快照 ⇒ 回落到 ' + data.fallbackFrom) : null,
|
|
2527
2631
|
data && data.source ? h('div', { style: C.muted }, '来源:' + data.source) : null,
|
|
2528
|
-
err ? h('div', { style: { ...C.row, color:
|
|
2632
|
+
err ? h('div', { style: { ...C.row, color: T.bad } },
|
|
2529
2633
|
h('span', null, '⚠ 读取失败:' + String(err).slice(0, 120)),
|
|
2530
|
-
h('button', {
|
|
2634
|
+
h('button', { className: 'rs-btn', onClick: function () { reloadBoard(false) } }, '重试')) : null,
|
|
2531
2635
|
note ? h('div', { style: C.muted }, note) : null,
|
|
2532
2636
|
data && data.rows && data.rows.length
|
|
2533
2637
|
? (cards
|
|
@@ -2553,7 +2657,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2553
2657
|
: [tr]
|
|
2554
2658
|
}))))
|
|
2555
2659
|
: h('div', { style: C.muted }, data ? dash(data.note || '没有条目') : '加载中…'),
|
|
2556
|
-
h('div', { style: { ...C.muted, marginTop: '6px' } }, '
|
|
2660
|
+
h('div', { style: { ...C.muted, marginTop: '6px' } }, '列随榜变化:该站没有的字段整列不出现;有字段但这条没抓到显示「—」(批次榜不出「变化」列)。面板变窄时列会按宽度自动收起(先收作者/分类/字数这类次级列,名次/书名与该榜主指标一直在),再窄就换成卡片行;点行看详情。'))
|
|
2557
2661
|
}
|
|
2558
2662
|
|
|
2559
2663
|
/**
|
|
@@ -2773,7 +2877,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2773
2877
|
if (!open) return null
|
|
2774
2878
|
const narrow = rect.w < 720
|
|
2775
2879
|
const rev = revOf(ov)
|
|
2776
|
-
return h('div', { 'data-rank-scan-win': '1', style: { ...C.win, left: rect.x + 'px', top: rect.y + 'px', width: rect.w + 'px', height: rect.h + 'px'
|
|
2880
|
+
return h('div', { 'data-rank-scan-win': '1', style: { ...C.win, left: rect.x + 'px', top: rect.y + 'px', width: rect.w + 'px', height: rect.h + 'px' } },
|
|
2777
2881
|
h(DragBar, {
|
|
2778
2882
|
rect: rect, setRect: setRect,
|
|
2779
2883
|
onCollapse: function () {
|
|
@@ -2788,11 +2892,11 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2788
2892
|
h('button', { style: C.tab(tab === 'bm'), onClick: function () { switchTab('bm') } }, '书签'),
|
|
2789
2893
|
h('button', { style: C.tab(tab === 'pick'), onClick: function () { switchTab('pick') } }, '设置')),
|
|
2790
2894
|
msg ? h('div', { style: C.muted }, msg) : null,
|
|
2791
|
-
leaveAsk ? h(
|
|
2895
|
+
leaveAsk ? h(Banner, { tone: 'warn' },
|
|
2792
2896
|
h('span', null, '有未保存的改动(' + (leaveAsk.keys || []).map(function (k) { return LEAVE_LABEL[k] || k }).join('、') + ')'),
|
|
2793
2897
|
h('span', { style: C.muted }, '草稿会保留,下次进来还在'),
|
|
2794
|
-
h('button', {
|
|
2795
|
-
h('button', {
|
|
2898
|
+
h('button', { className: 'rs-btn', onClick: doLeave }, '仍然离开'),
|
|
2899
|
+
h('button', { className: 'rs-btn is-primary', onClick: function () { setLeaveAsk(null) } }, '继续编辑')) : null,
|
|
2796
2900
|
h(TabBoundary, { name: tab },
|
|
2797
2901
|
tab === 'ov' ? h(Overview, {
|
|
2798
2902
|
ov: ov, busy: busy || scanActBusy, act: act, reload: reload, narrow: narrow, width: rect.w, rev: rev,
|
|
@@ -2855,6 +2959,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
|
|
|
2855
2959
|
|
|
2856
2960
|
const inject = ['slots']
|
|
2857
2961
|
function apply(ctx) {
|
|
2962
|
+
// 样式表只注入一次;选择器都带 rs- 前缀(见 ensureStyle)
|
|
2963
|
+
ensureStyle()
|
|
2858
2964
|
// ★ 首次安装自动弹一次:认领点从「模块求值期」移到这里(apply 真的跑到了才算数)
|
|
2859
2965
|
if (claimAutoOpen()) panelOpen.set(true)
|
|
2860
2966
|
// 可选依赖晚绑定:侧栏浏览器服务可用后捕获(不在 inject 列表里,避免服务缺失时整个面板挂不上)
|