dsh-aupdate 0.7.3 → 0.7.4
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 +30 -5
- package/client.js +82 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,8 +219,18 @@ stargazers)与「分享」(复制项目地址到剪贴板,任何环境都
|
|
|
219
219
|
关掉「发现更新时提醒我」就完全不弹,日志和设置页照常记录——提醒只是别让它装完你
|
|
220
220
|
还不知道,不是唯一的告知渠道。
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
提醒卡照 `dsh-cost-meter` 的「峰/谷切换提醒」做:最上面是**圆点徽标**(已更新 / 可更新),
|
|
223
|
+
下面标题行带 `×`,再一句正文说明「装好就地生效,不用重启」,然后是可滚动的插件清单和
|
|
224
|
+
右对齐的「知道了」主按钮;按 Esc 也能关,`prefers-reduced-motion` 下不播进场动画。
|
|
225
|
+
|
|
226
|
+
**「已更新」只在真的装完之后说**。`lastRun.updates` 记的是「发现了哪些新版本」——自动安装
|
|
227
|
+
被关掉、被空闲门槛让开、或者装失败时它照样有值。所以徽标、标题和「上一次」的统计卡都改看
|
|
228
|
+
`installed`(去掉带 `!failed` 的条目)算出来的「真装成了几个」:装成了说「已更新 N 个」,
|
|
229
|
+
只查到不动手说「可更新 N 个」,两个数字不会互相冒充。
|
|
230
|
+
|
|
231
|
+
「上一次」里的时间显示成 `26/11/26 12:38`(两位年/月/日 + 时:分,本地时区)。秒不显示,
|
|
232
|
+
因为统计卡里它只会把数字挤窄;年月日的顺序也写死成「年/月/日」,不跟 `Intl` 的
|
|
233
|
+
区域顺序走,中文环境下不会跳成 `2026/11/26`。
|
|
224
234
|
|
|
225
235
|
提醒用的是原生 DOM 浮层,不是新的槽位:槽位只在宿主页挂载时才渲染,而提醒要能在
|
|
226
236
|
会话、插件页、设置页都出现。
|
|
@@ -460,9 +470,24 @@ When a check finds updates, a notice appears in the bottom-right corner listing
|
|
|
460
470
|
plugin and its current → new version; past eight it adds "and N more", and it closes
|
|
461
471
|
itself after 15 seconds. Long package names are truncated on the name side so the
|
|
462
472
|
versions stay visible, and past six entries the list scrolls. The Last run card on the
|
|
463
|
-
settings page lists the same plugins and version pairs. The notice
|
|
464
|
-
|
|
465
|
-
|
|
473
|
+
settings page lists the same plugins and version pairs. The notice follows the
|
|
474
|
+
`dsh-cost-meter` peak/off-peak switch alert: a **dot badge** at the top (Updated /
|
|
475
|
+
Update available), a title row with `×`, one body line saying it was applied in place
|
|
476
|
+
without a restart, then the scrollable plugin list and a right-aligned primary "Got it"
|
|
477
|
+
button. `Esc` closes it too, and the entrance animation is skipped under
|
|
478
|
+
`prefers-reduced-motion`.
|
|
479
|
+
|
|
480
|
+
**"Updated" is only claimed once an install actually happened.** `lastRun.updates` records
|
|
481
|
+
which new versions were *found* — it is populated even when auto-install is off, when the
|
|
482
|
+
idle gate holds the run back, or when an install fails. The badge, the notice title and the
|
|
483
|
+
Last run stat card therefore read `installed` (minus entries ending in `!failed`): a real
|
|
484
|
+
install says "N updated", a check-only run says "N can update", and neither number
|
|
485
|
+
impersonates the other.
|
|
486
|
+
|
|
487
|
+
The Last run timestamp renders as `26/11/26 12:38` — two-digit year/month/day plus
|
|
488
|
+
hour:minute in local time. Seconds are dropped because they only squeeze the stat card, and
|
|
489
|
+
the field order is fixed to year/month/day rather than following `Intl`'s locale order, so a
|
|
490
|
+
Chinese locale does not produce `2026/11/26`.
|
|
466
491
|
Each batch is announced once — the signature is kept in
|
|
467
492
|
`localStorage` — and turning "Tell me when updates are found" off silences it entirely
|
|
468
493
|
while the log and settings page keep recording.
|
package/client.js
CHANGED
|
@@ -70,6 +70,7 @@ window.__ModuleLoader__.load({
|
|
|
70
70
|
secSchedule: '调度与范围',
|
|
71
71
|
lastChecked: '上次检查',
|
|
72
72
|
lastUpdates: '可更新',
|
|
73
|
+
lastUpdated: '已更新',
|
|
73
74
|
unavailable: '读不到设置:后端路由没起来(插件仍会按默认设置自动更新)',
|
|
74
75
|
retry: '重试',
|
|
75
76
|
save: '保存',
|
|
@@ -90,6 +91,8 @@ window.__ModuleLoader__.load({
|
|
|
90
91
|
checked: '检查了',
|
|
91
92
|
packages: '个包',
|
|
92
93
|
updates: '个可更新',
|
|
94
|
+
updatedUnit: '个已更新',
|
|
95
|
+
updatedHint: '个插件',
|
|
93
96
|
upToDate: '全部都是最新的',
|
|
94
97
|
enabled: '启用定时检查',
|
|
95
98
|
enabledHint: '关掉之后不再自动跑,设置页仍然可用',
|
|
@@ -162,7 +165,12 @@ window.__ModuleLoader__.load({
|
|
|
162
165
|
langAuto: '跟随系统',
|
|
163
166
|
langZh: '中文',
|
|
164
167
|
langEn: 'English',
|
|
165
|
-
toastTitle: '{n}
|
|
168
|
+
toastTitle: '{n} 个插件已更新',
|
|
169
|
+
toastTitleFound: '{n} 个插件可更新',
|
|
170
|
+
toastBadge: '已更新',
|
|
171
|
+
toastBadgeFound: '可更新',
|
|
172
|
+
toastBody: '装好就地生效,不用重启;下面是这一轮换掉的版本。',
|
|
173
|
+
toastBodyFound: '下面是能升级到的新版本;自动安装关掉时只会检查,不会动手。',
|
|
166
174
|
toastMore: '还有 {n} 个',
|
|
167
175
|
toastDismiss: '知道了',
|
|
168
176
|
keepTitle: '保留期限',
|
|
@@ -185,6 +193,7 @@ window.__ModuleLoader__.load({
|
|
|
185
193
|
rolledBack: '已回滚',
|
|
186
194
|
policy: '更新策略',
|
|
187
195
|
minutes: '分钟',
|
|
196
|
+
min: '分钟',
|
|
188
197
|
scope: '这些设置只影响本机这个 profile',
|
|
189
198
|
about: '关于 aupdate',
|
|
190
199
|
aboutVersion: '版本',
|
|
@@ -208,6 +217,7 @@ window.__ModuleLoader__.load({
|
|
|
208
217
|
secSchedule: 'Schedule and scope',
|
|
209
218
|
lastChecked: 'Last check',
|
|
210
219
|
lastUpdates: 'Updates',
|
|
220
|
+
lastUpdated: 'Updated',
|
|
211
221
|
unavailable: 'Cannot read settings: the backend route is not up (defaults still apply)',
|
|
212
222
|
retry: 'Retry',
|
|
213
223
|
save: 'Save',
|
|
@@ -228,6 +238,8 @@ window.__ModuleLoader__.load({
|
|
|
228
238
|
checked: 'checked',
|
|
229
239
|
packages: 'packages',
|
|
230
240
|
updates: 'updates',
|
|
241
|
+
updatedUnit: 'updated',
|
|
242
|
+
updatedHint: 'plugins',
|
|
231
243
|
upToDate: 'everything is current',
|
|
232
244
|
enabled: 'Scheduled checks',
|
|
233
245
|
enabledHint: 'Turn off to stop automatic runs; this page keeps working',
|
|
@@ -300,7 +312,12 @@ window.__ModuleLoader__.load({
|
|
|
300
312
|
langAuto: 'Follow the system',
|
|
301
313
|
langZh: '中文',
|
|
302
314
|
langEn: 'English',
|
|
303
|
-
toastTitle: '{n} plugin(s)
|
|
315
|
+
toastTitle: '{n} plugin(s) updated',
|
|
316
|
+
toastTitleFound: '{n} plugin(s) can update',
|
|
317
|
+
toastBadge: 'Updated',
|
|
318
|
+
toastBadgeFound: 'Update available',
|
|
319
|
+
toastBody: 'Applied in place, no restart needed. Here is what changed this round.',
|
|
320
|
+
toastBodyFound: 'Newer versions are available. With auto-install off this only checks; nothing is installed.',
|
|
304
321
|
toastMore: 'and {n} more',
|
|
305
322
|
toastDismiss: 'Got it',
|
|
306
323
|
keepTitle: 'Retention',
|
|
@@ -322,6 +339,7 @@ window.__ModuleLoader__.load({
|
|
|
322
339
|
rollbackFailed: 'Rollback failed',
|
|
323
340
|
rolledBack: 'rolled back',
|
|
324
341
|
policy: 'Update policy',
|
|
342
|
+
minutes: 'minutes',
|
|
325
343
|
min: 'min',
|
|
326
344
|
scope: 'These settings apply to this profile only',
|
|
327
345
|
about: 'About aupdate',
|
|
@@ -408,17 +426,12 @@ window.__ModuleLoader__.load({
|
|
|
408
426
|
if (typeof iso !== 'string' || iso === '') return ''
|
|
409
427
|
const when = new Date(iso)
|
|
410
428
|
if (Number.isNaN(when.getTime())) return iso
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
} catch {
|
|
418
|
-
const pad = (n) => String(n).padStart(2, '0')
|
|
419
|
-
return when.getFullYear() + '-' + pad(when.getMonth() + 1) + '-' + pad(when.getDate()) +
|
|
420
|
-
' ' + pad(when.getHours()) + ':' + pad(when.getMinutes()) + ':' + pad(when.getSeconds())
|
|
421
|
-
}
|
|
429
|
+
// 26/11/26 12:38:两位年/月/日 + 时:分,秒不显示。
|
|
430
|
+
// 「上一次检查」这类时间看到分就够,秒只会把统计卡挤窄;
|
|
431
|
+
// 走本地时区取值,不用 Intl 的日期顺序(中文环境会排成 2026/11/26)。
|
|
432
|
+
const pad = (n) => String(n).padStart(2, '0')
|
|
433
|
+
return pad(when.getFullYear() % 100) + '/' + pad(when.getMonth() + 1) + '/' + pad(when.getDate()) +
|
|
434
|
+
' ' + pad(when.getHours()) + ':' + pad(when.getMinutes())
|
|
422
435
|
}
|
|
423
436
|
|
|
424
437
|
/**
|
|
@@ -572,11 +585,10 @@ window.__ModuleLoader__.load({
|
|
|
572
585
|
.dsh-au-badge.run{color:var(--dsw-alias-state-business-primary,#4d6bfe);border-color:color-mix(in oklch,var(--dsw-alias-state-business-primary,#4d6bfe),transparent 55%);background:color-mix(in oklch,var(--dsw-alias-state-business-primary,#4d6bfe),transparent 90%)}
|
|
573
586
|
|
|
574
587
|
.dsh-au-input{width:96px;padding:4px 8px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.32));background:var(--dsw-alias-bg-layer-2,transparent);color:inherit;font:inherit;font-size:13px;text-align:right;transition:border-color .15s}
|
|
575
|
-
.dsh-au-area{width:100%;min-height:58px;padding:6px 8px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.32));background:var(--dsw-alias-bg-layer-2,transparent);color:inherit;font:inherit;font-size:12.5px;resize:vertical;transition:border-color .15s}
|
|
576
588
|
.dsh-au-select{padding:4px 8px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.32));background:var(--dsw-alias-bg-layer-2,transparent);color:inherit;font:inherit;font-size:13px;min-width:132px;transition:border-color .15s}
|
|
577
589
|
.dsh-au-search{padding:4px 8px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.32));background:var(--dsw-alias-bg-layer-2,transparent);color:inherit;font:inherit;font-size:12.5px;transition:border-color .15s}
|
|
578
|
-
.dsh-au-input:focus,.dsh-au-
|
|
579
|
-
.dsh-au-input:disabled,.dsh-au-select:disabled
|
|
590
|
+
.dsh-au-input:focus,.dsh-au-select:focus,.dsh-au-search:focus{outline:none;border-color:var(--dsw-alias-state-business-primary,#4d6bfe)}
|
|
591
|
+
.dsh-au-input:disabled,.dsh-au-select:disabled{opacity:.55}
|
|
580
592
|
|
|
581
593
|
.dsh-au-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
582
594
|
.dsh-au-btn{display:inline-flex;align-items:center;gap:4px;padding:4px 11px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.32));background:transparent;color:inherit;font:inherit;font-size:12.5px;cursor:pointer;transition:background .15s,border-color .15s,opacity .15s}
|
|
@@ -605,18 +617,24 @@ window.__ModuleLoader__.load({
|
|
|
605
617
|
.dsh-au-link:hover{color:var(--dsw-alias-state-business-primary,#4d6bfe);border-color:currentColor}
|
|
606
618
|
.dsh-au-linkext{margin-left:3px;opacity:.5}
|
|
607
619
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
.dsh-au-toast-
|
|
620
|
+
/* 通知卡:照 dsh-cost-meter 的「峰/谷切换提醒」做。
|
|
621
|
+
* 那张卡是「圆点徽标 + 标题 + 正文 + 右对齐按钮」,并按事件换主色;
|
|
622
|
+
* 这里同一结构用于「发现可更新」,主色取 business 蓝,边框和投影都走主题。 */
|
|
623
|
+
.dsh-au-toast{--au-toast-accent:var(--dsw-alias-state-business-primary,#4d6bfe);position:fixed;right:16px;bottom:16px;z-index:2147483000;display:flex;flex-direction:column;gap:9px;box-sizing:border-box;width:340px;max-width:calc(100vw - 32px);padding:14px 16px;border-radius:14px;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.28));background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-toast-bg,#f7f7f8));color:var(--dsw-alias-label-primary,#1f2328);box-shadow:0 14px 36px #00000038;font:13px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;animation:dsh-au-in .22s cubic-bezier(.2,.8,.2,1)}
|
|
624
|
+
.dsh-au-toast-badge{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:600;letter-spacing:.4px;text-transform:uppercase;color:var(--au-toast-accent)}
|
|
625
|
+
.dsh-au-toast-badge:before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor;box-shadow:0 0 0 4px color-mix(in srgb,currentColor 16%,transparent);flex:0 0 auto}
|
|
626
|
+
.dsh-au-toast-head{display:flex;align-items:flex-start;gap:8px}
|
|
627
|
+
.dsh-au-toast-title{flex:1 1 auto;min-width:0;font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary,#1f2328);line-height:1.4}
|
|
628
|
+
.dsh-au-toast-x{flex:0 0 auto;width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;padding:0;margin:-2px -4px 0 0;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:16px;line-height:1;opacity:.6;cursor:pointer;transition:background .15s,opacity .15s}
|
|
612
629
|
.dsh-au-toast-x:hover{opacity:1;background:var(--dsw-alias-bg-mask-2,rgba(128,128,128,.14))}
|
|
630
|
+
.dsh-au-toast-body{color:var(--dsw-alias-label-secondary,rgba(128,128,128,1));line-height:1.55;font-size:12.5px}
|
|
613
631
|
.dsh-au-toast-list{display:flex;flex-direction:column;gap:2px;max-height:190px;overflow:auto;margin:0 -4px}
|
|
614
632
|
.dsh-au-toast-item{display:flex;align-items:baseline;gap:8px;padding:3px 6px;border-radius:6px;background:var(--dsw-alias-bg-mask-1,rgba(128,128,128,.08))}
|
|
615
|
-
.dsh-au-toast-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
633
|
+
.dsh-au-toast-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary,inherit)}
|
|
616
634
|
.dsh-au-toast-ver{flex:0 0 auto;font-size:11.5px;color:var(--dsw-alias-label-tertiary,rgba(128,128,128,.95));font-variant-numeric:tabular-nums}
|
|
617
635
|
.dsh-au-toast-more{font-size:11.5px;color:var(--dsw-alias-label-caption,rgba(128,128,128,.85))}
|
|
618
|
-
.dsh-au-toast-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px}
|
|
619
|
-
@keyframes dsh-au-in{from{opacity:0;transform:translateY(
|
|
636
|
+
.dsh-au-toast-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding-top:2px}
|
|
637
|
+
@keyframes dsh-au-in{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
|
|
620
638
|
@media (prefers-reduced-motion:reduce){.dsh-au-toast{animation:none}}
|
|
621
639
|
`
|
|
622
640
|
|
|
@@ -648,7 +666,6 @@ window.__ModuleLoader__.load({
|
|
|
648
666
|
label: 'dsh-au-label',
|
|
649
667
|
hint: 'dsh-au-hint',
|
|
650
668
|
input: 'dsh-au-input',
|
|
651
|
-
area: 'dsh-au-area',
|
|
652
669
|
select: 'dsh-au-select',
|
|
653
670
|
search: 'dsh-au-search',
|
|
654
671
|
actions: 'dsh-au-actions',
|
|
@@ -661,7 +678,6 @@ window.__ModuleLoader__.load({
|
|
|
661
678
|
stat: 'dsh-au-stat',
|
|
662
679
|
statK: 'dsh-au-stat-k',
|
|
663
680
|
statV: 'dsh-au-stat-v',
|
|
664
|
-
badge: 'dsh-au-badge',
|
|
665
681
|
check: 'dsh-au-check',
|
|
666
682
|
logBox: 'dsh-au-log',
|
|
667
683
|
logTime: 'dsh-au-logtime',
|
|
@@ -1146,6 +1162,7 @@ window.__ModuleLoader__.load({
|
|
|
1146
1162
|
}
|
|
1147
1163
|
|
|
1148
1164
|
const last = state?.lastRun
|
|
1165
|
+
const applied = appliedCount(last)
|
|
1149
1166
|
|
|
1150
1167
|
return h('div', { className: S.wrap },
|
|
1151
1168
|
h('div', { className: S.head },
|
|
@@ -1286,9 +1303,12 @@ window.__ModuleLoader__.load({
|
|
|
1286
1303
|
h('span', { className: S.hint }, T.packages),
|
|
1287
1304
|
),
|
|
1288
1305
|
h('div', { className: S.stat },
|
|
1289
|
-
h('span', { className: S.statK }, T.lastUpdates),
|
|
1290
|
-
h('span', { className: S.statV }, String(last.updates?.length ?? 0)),
|
|
1291
|
-
|
|
1306
|
+
h('span', { className: S.statK }, applied > 0 ? T.lastUpdated : T.lastUpdates),
|
|
1307
|
+
h('span', { className: S.statV }, String(applied > 0 ? applied : (last.updates?.length ?? 0))),
|
|
1308
|
+
// 卡片里标题已经是「已更新」,副标题只补量词,不再重复一遍「已更新」。
|
|
1309
|
+
h('span', { className: S.hint }, applied > 0
|
|
1310
|
+
? T.updatedHint
|
|
1311
|
+
: (last.updates?.length ?? 0) > 0 ? T.updates : T.upToDate),
|
|
1292
1312
|
),
|
|
1293
1313
|
),
|
|
1294
1314
|
// 原因只说一遍:徽标承接状态词,正文承接句子,两者不重复同一句话。
|
|
@@ -1457,9 +1477,11 @@ window.__ModuleLoader__.load({
|
|
|
1457
1477
|
? (T.enabled + ':' + T.off)
|
|
1458
1478
|
: last === null || last === undefined
|
|
1459
1479
|
? T.never
|
|
1460
|
-
: (last
|
|
1461
|
-
? (last
|
|
1462
|
-
:
|
|
1480
|
+
: appliedCount(last) > 0
|
|
1481
|
+
? appliedCount(last) + ' ' + T.updatedUnit
|
|
1482
|
+
: (last.updates?.length ?? 0) > 0
|
|
1483
|
+
? (last.updates?.length ?? 0) + ' ' + T.updates
|
|
1484
|
+
: T.upToDate
|
|
1463
1485
|
return h('span', { className: S.status }, text)
|
|
1464
1486
|
}
|
|
1465
1487
|
|
|
@@ -1507,6 +1529,19 @@ window.__ModuleLoader__.load({
|
|
|
1507
1529
|
return { name, versions: from + ' → ' + to }
|
|
1508
1530
|
}
|
|
1509
1531
|
|
|
1532
|
+
/**
|
|
1533
|
+
* 这一轮「真的换掉了几个版本」。
|
|
1534
|
+
*
|
|
1535
|
+
* lastRun.updates 是「发现了哪些新版本」,安装被关掉、被让开、装失败时它照样有值。
|
|
1536
|
+
* 界面上说「已更新 N 个」就必须是装成了的,否则把「查到 4 个」写成「更新了 4 个」
|
|
1537
|
+
* 是在撒谎。installed 里失败的条目带 ' !failed',要减掉。
|
|
1538
|
+
*/
|
|
1539
|
+
function appliedCount(last) {
|
|
1540
|
+
if (last === null || last === undefined) return 0
|
|
1541
|
+
const rows = Array.isArray(last.installed) ? last.installed : []
|
|
1542
|
+
return rows.filter((row) => typeof row === 'string' && !row.endsWith('!failed')).length
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1510
1545
|
function updateSignature(updates) {
|
|
1511
1546
|
return (Array.isArray(updates) ? updates : [])
|
|
1512
1547
|
.map((item) => describeUpdate(item))
|
|
@@ -1516,7 +1551,7 @@ window.__ModuleLoader__.load({
|
|
|
1516
1551
|
.join('|')
|
|
1517
1552
|
}
|
|
1518
1553
|
|
|
1519
|
-
function showUpdateToast(updates) {
|
|
1554
|
+
function showUpdateToast(updates, applied) {
|
|
1520
1555
|
if (toastOpen) return
|
|
1521
1556
|
const doc = typeof document === 'undefined' ? null : document
|
|
1522
1557
|
if (doc === null || doc.body === null) return
|
|
@@ -1531,12 +1566,19 @@ window.__ModuleLoader__.load({
|
|
|
1531
1566
|
box.setAttribute('role', 'status')
|
|
1532
1567
|
box.setAttribute('aria-live', 'polite')
|
|
1533
1568
|
|
|
1534
|
-
//
|
|
1569
|
+
// 结构与 cost-meter 的「峰/谷切换提醒」一致:圆点徽标 → 标题行(含 ×)
|
|
1570
|
+
// → 一句正文 → 清单 → 右对齐按钮。徽标是那张卡最好认的一处,这里复用它。
|
|
1571
|
+
const badge = doc.createElement('div')
|
|
1572
|
+
badge.className = 'dsh-au-toast-badge'
|
|
1573
|
+
badge.textContent = applied > 0 ? T.toastBadge : T.toastBadgeFound
|
|
1574
|
+
box.appendChild(badge)
|
|
1575
|
+
|
|
1535
1576
|
const head = doc.createElement('div')
|
|
1536
1577
|
head.className = 'dsh-au-toast-head'
|
|
1537
1578
|
const title = doc.createElement('div')
|
|
1538
1579
|
title.className = 'dsh-au-toast-title'
|
|
1539
|
-
|
|
1580
|
+
// 真的装完了才说「已更新」;只查到、没动手时说「可更新」,别把「发现」说成「装了」。
|
|
1581
|
+
title.textContent = (applied > 0 ? T.toastTitle : T.toastTitleFound).replace('{n}', String(rows.length))
|
|
1540
1582
|
const xBtn = doc.createElement('button')
|
|
1541
1583
|
xBtn.type = 'button'
|
|
1542
1584
|
xBtn.className = 'dsh-au-toast-x'
|
|
@@ -1546,6 +1588,11 @@ window.__ModuleLoader__.load({
|
|
|
1546
1588
|
head.appendChild(xBtn)
|
|
1547
1589
|
box.appendChild(head)
|
|
1548
1590
|
|
|
1591
|
+
const body = doc.createElement('div')
|
|
1592
|
+
body.className = 'dsh-au-toast-body'
|
|
1593
|
+
body.textContent = applied > 0 ? T.toastBody : T.toastBodyFound
|
|
1594
|
+
box.appendChild(body)
|
|
1595
|
+
|
|
1549
1596
|
const list = doc.createElement('div')
|
|
1550
1597
|
list.className = 'dsh-au-toast-list'
|
|
1551
1598
|
// 超过 12 条就在框内滚动:提醒不该占掉半屏。
|
|
@@ -1620,7 +1667,7 @@ window.__ModuleLoader__.load({
|
|
|
1620
1667
|
const sig = updateSignature(updates)
|
|
1621
1668
|
if (sig !== notifiedMark()) {
|
|
1622
1669
|
markNotified(sig)
|
|
1623
|
-
showUpdateToast(updates)
|
|
1670
|
+
showUpdateToast(updates, appliedCount(state?.lastRun))
|
|
1624
1671
|
}
|
|
1625
1672
|
}
|
|
1626
1673
|
}
|
package/package.json
CHANGED