dsh-ui-alt 0.2.249 → 0.2.401
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 +24 -9
- package/client.js +874 -126
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -6,8 +6,8 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
|
|
7
7
|
const STORAGE_KEY = 'dsh-ui-alt:prefs:v1';
|
|
8
8
|
/* 发版时与 package.json 的 version 一起改:设置页底部会显示这两个值 */
|
|
9
|
-
const VERSION = '0.2.
|
|
10
|
-
const UPDATED = '2026-11-
|
|
9
|
+
const VERSION = '0.2.401';
|
|
10
|
+
const UPDATED = '2026-11-15';
|
|
11
11
|
const DEFAULTS = {
|
|
12
12
|
radiusDensity: true,
|
|
13
13
|
invertNewSession: true,
|
|
@@ -19,10 +19,12 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
uiTransition: true,
|
|
20
20
|
disableMenuBlur: true,
|
|
21
21
|
sessionDot: false,
|
|
22
|
-
settingsFullscreen:
|
|
22
|
+
settingsFullscreen: false,
|
|
23
23
|
hideHoverCard: true,
|
|
24
24
|
hideRowButtons: true,
|
|
25
|
+
headerFade: true,
|
|
25
26
|
compactHeader: true,
|
|
27
|
+
compactAlwaysShow: false,
|
|
26
28
|
navCollapse: true,
|
|
27
29
|
optimizeStatsLayout: true,
|
|
28
30
|
showBalance: true,
|
|
@@ -69,7 +71,9 @@ window.__ModuleLoader__.load({
|
|
|
69
71
|
root.dataset.dccFull = prefs.settingsFullscreen ? 'on' : 'off';
|
|
70
72
|
root.dataset.dccHover = prefs.hideHoverCard ? 'off' : 'on';
|
|
71
73
|
root.dataset.dccRowButtons = prefs.hideRowButtons ? 'on' : 'off';
|
|
74
|
+
root.dataset.dccHeaderFade = prefs.headerFade ? 'on' : 'off';
|
|
72
75
|
root.dataset.dccCompactHeader = prefs.compactHeader ? 'on' : 'off';
|
|
76
|
+
root.dataset.dccAlwaysShow = prefs.compactAlwaysShow ? 'on' : 'off';
|
|
73
77
|
root.dataset.dccCollapse = prefs.navCollapse ? 'on' : 'off';
|
|
74
78
|
root.dataset.dccStats = prefs.optimizeStatsLayout ? 'on' : 'off';
|
|
75
79
|
root.dataset.dccBalance = prefs.showBalance ? 'on' : 'off';
|
|
@@ -113,6 +117,11 @@ html[data-dcc-font="on"][data-windows-titlebar] body {
|
|
|
113
117
|
.dcc-group { display: flex; flex-direction: column; padding: 6px 20px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-1); }
|
|
114
118
|
/* 分组标题统一降为次要色:它是分区标签,不该和设置项标题抢注意力 */
|
|
115
119
|
.dcc-group-title { padding: 14px 2px 4px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-secondary); }
|
|
120
|
+
/* 依赖项未开启时置灰 */
|
|
121
|
+
.dcc-row-disabled {
|
|
122
|
+
opacity: .45;
|
|
123
|
+
pointer-events: none;
|
|
124
|
+
}
|
|
116
125
|
.dcc-row { display: flex; align-items: center; gap: 16px; padding: 14px 2px; border-top: 1px solid var(--dsw-alias-border-l1); }
|
|
117
126
|
.dcc-group-title + .dcc-row { border-top: none; }
|
|
118
127
|
/* 无组名的组(总开关那一块)没有标题,首行同样不该有分隔线 */
|
|
@@ -139,10 +148,6 @@ body[data-ds-dark-theme] .dcc-boot-cover {
|
|
|
139
148
|
width: 64px;
|
|
140
149
|
height: auto;
|
|
141
150
|
opacity: .3;
|
|
142
|
-
color: #ffffff;
|
|
143
|
-
}
|
|
144
|
-
body:not([data-ds-dark-theme]) .dcc-boot-fish {
|
|
145
|
-
color: #000000;
|
|
146
151
|
}
|
|
147
152
|
.dcc-boot-cover-out { opacity: 0; }
|
|
148
153
|
/* 纯告知行:无右侧控件,用列表承载多条说明 */
|
|
@@ -204,7 +209,7 @@ body:not([data-ds-dark-theme]) .dcc-boot-fish {
|
|
|
204
209
|
border-radius: var(--dsw-radius-lg, 12px);
|
|
205
210
|
background: var(--dsw-alias-bg-layer-1);
|
|
206
211
|
box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
|
|
207
|
-
animation: dcc-plain-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
212
|
+
animation: dcc-plain-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) !important;
|
|
208
213
|
}
|
|
209
214
|
.dcc-modal-content {
|
|
210
215
|
padding: 18px 20px 4px;
|
|
@@ -307,13 +312,13 @@ html[data-dcc-radius="on"][data-windows-titlebar] [class*="_frame"] {
|
|
|
307
312
|
--dsh-windows-content-radius: 6px !important;
|
|
308
313
|
}
|
|
309
314
|
/* 选择题:选中项的序号用高亮反色(和勾选框一致) */
|
|
310
|
-
html [class*="_optionRow"][class*="_optionSelected"] [class*="_number"] {
|
|
315
|
+
html[data-dcc-enabled="on"] [class*="_optionRow"][class*="_optionSelected"] [class*="_number"] {
|
|
311
316
|
background-color: var(--dsw-alias-label-primary) !important;
|
|
312
317
|
color: var(--dsw-alias-label-primary-foreground) !important;
|
|
313
318
|
font-weight: 600 !important;
|
|
314
319
|
}
|
|
315
320
|
/* 悬停选项时序号数字更明显,但序号底色不变(选中项由上面的反色规则接管) */
|
|
316
|
-
html [class*="_optionRow"]:not([class*="_optionSelected"]):hover [class*="_number"] {
|
|
321
|
+
html[data-dcc-enabled="on"] [class*="_optionRow"]:not([class*="_optionSelected"]):hover [class*="_number"] {
|
|
317
322
|
color: var(--dsw-alias-label-primary) !important;
|
|
318
323
|
}
|
|
319
324
|
|
|
@@ -364,6 +369,18 @@ html[data-dcc-radius="on"] [class*="_media_"] {
|
|
|
364
369
|
html[data-dcc-new="on"] button[data-dcc-original] {
|
|
365
370
|
display: none !important;
|
|
366
371
|
}
|
|
372
|
+
/* 原版按钮被隐藏后,它外面那层容器仍然占着高度,形成一块空白。
|
|
373
|
+
用克隆行时把整层一并收掉;侧栏收窄到只剩图标时再放出来。 */
|
|
374
|
+
html[data-dcc-new="on"] div[class*="_newSessionRow"] {
|
|
375
|
+
display: none !important;
|
|
376
|
+
}
|
|
377
|
+
html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"]) div[class*="_newSessionRow"] {
|
|
378
|
+
display: block !important;
|
|
379
|
+
}
|
|
380
|
+
/* 用克隆行时,宿主给滚动区留的 4px 上边距也没有意义了 */
|
|
381
|
+
html[data-dcc-new="on"] [class*="_scrollRegion"] {
|
|
382
|
+
margin-top: 0 !important;
|
|
383
|
+
}
|
|
367
384
|
html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"]) button[data-dcc-original] {
|
|
368
385
|
display: flex !important;
|
|
369
386
|
}
|
|
@@ -422,6 +439,7 @@ html[data-dcc-collapse="on"][data-dcc-logo="shown"] [class*="_logoRow"] {
|
|
|
422
439
|
padding-bottom: 2px !important;
|
|
423
440
|
}
|
|
424
441
|
|
|
442
|
+
|
|
425
443
|
/* 克隆出来的新会话行在 nav 里,滚动时要固定;
|
|
426
444
|
原按钮不在这里处理——它在 nav 外面本来就固定,加 sticky 和背景
|
|
427
445
|
反而会让关闭开关后的外观和宿主原版不一样。 */
|
|
@@ -583,6 +601,10 @@ html[data-dcc-menu-blur="on"] [role="menu"] {
|
|
|
583
601
|
from { opacity: 1; }
|
|
584
602
|
to { opacity: 0; }
|
|
585
603
|
}
|
|
604
|
+
@keyframes dcc-fade-in {
|
|
605
|
+
from { opacity: 0; }
|
|
606
|
+
to { opacity: 1; }
|
|
607
|
+
}
|
|
586
608
|
@keyframes dcc-plain-in {
|
|
587
609
|
from {
|
|
588
610
|
opacity: 0;
|
|
@@ -606,13 +628,13 @@ html[data-dcc-menu-blur="on"] [role="menu"] {
|
|
|
606
628
|
|
|
607
629
|
/* 兜底色:动画期间顶替失效的毛玻璃。各弹层的实际背景不一样,
|
|
608
630
|
统一一个 token 会对不齐,所以按「浅色/深色 × 是否带毛玻璃」分档微调。 */
|
|
609
|
-
body:not([data-ds-dark-theme]) {
|
|
631
|
+
html[data-dcc-enabled="on"] body:not([data-ds-dark-theme]) {
|
|
610
632
|
--dcc-menu-fallback: color-mix(in oklab, var(--dsw-alias-bg-layer-1) 88%, #000);
|
|
611
633
|
}
|
|
612
|
-
body[data-ds-dark-theme] [data-menu-material] {
|
|
634
|
+
html[data-dcc-enabled="on"] body[data-ds-dark-theme] [data-menu-material] {
|
|
613
635
|
--dcc-menu-fallback: color-mix(in oklab, var(--dsw-alias-bg-layer-1) 88%, #000);
|
|
614
636
|
}
|
|
615
|
-
body[data-ds-dark-theme] :where([role="dialog"], [role="listbox"], [role="menu"]):not([data-menu-material]) {
|
|
637
|
+
html[data-dcc-enabled="on"] body[data-ds-dark-theme] :where([role="dialog"], [role="listbox"], [role="menu"]):not([data-menu-material]) {
|
|
616
638
|
--dcc-menu-fallback: color-mix(in oklab, var(--dsw-alias-bg-layer-1) 82%, #fff);
|
|
617
639
|
}
|
|
618
640
|
|
|
@@ -624,16 +646,30 @@ html[data-dcc-hover="off"] [class*="_card_"][data-closing] {
|
|
|
624
646
|
display: none !important;
|
|
625
647
|
}
|
|
626
648
|
|
|
649
|
+
/* 快照里的遮罩不要重播淡入——它是退场快照的一部分,
|
|
650
|
+
应该跟着外层一起淡出,否则看起来遮罩一直不消失。 */
|
|
651
|
+
/* 特异性必须压过下面那条入场规则,否则快照里的遮罩会重播淡入、闪出白底。
|
|
652
|
+
不要改它的定位——原遮罩只盖标题栏以下,铺满视口会盖住标题区。 */
|
|
653
|
+
html[data-dcc-transition="on"] [data-dcc-dialog-clone] [class*="_mask"] {
|
|
654
|
+
animation: none !important;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/* 压暗遮罩的入场:从透明淡到实,时长与退场的 dcc-fade-out 对齐。
|
|
658
|
+
带 !important,避免被其他插件的通配符动效规则压平。 */
|
|
659
|
+
html[data-dcc-transition="on"] [class*="_mask"] {
|
|
660
|
+
animation: dcc-fade-in .2s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) !important;
|
|
661
|
+
}
|
|
662
|
+
|
|
627
663
|
/* 菜单出现/消失:整体从点击处缩放。
|
|
628
664
|
transform 会让同元素的 backdrop-filter 在动画期间失效,所以动画期间
|
|
629
665
|
用一层近似底色的背景兜住,避免那 130ms 出现「透明」的观感。 */
|
|
630
666
|
html[data-dcc-transition="on"] [data-menu-material][data-menu-phase="enter"] {
|
|
631
667
|
transform-origin: var(--dcc-menu-origin, 50% 50%);
|
|
632
|
-
animation: dcc-menu-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
668
|
+
animation: dcc-menu-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) !important;
|
|
633
669
|
}
|
|
634
670
|
html[data-dcc-transition="on"] [data-menu-material][data-menu-phase="dismiss"] {
|
|
635
671
|
transform-origin: var(--dcc-menu-origin, 50% 50%);
|
|
636
|
-
animation: dcc-menu-out .12s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) forwards;
|
|
672
|
+
animation: dcc-menu-out .12s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) forwards !important;
|
|
637
673
|
}
|
|
638
674
|
/* 子菜单、列表选择器这些没有 data-menu-phase 的弹出层,
|
|
639
675
|
用 role 单独命中,套同一组入场动画。对话框单独处理:
|
|
@@ -641,11 +677,11 @@ html[data-dcc-transition="on"] [data-menu-material][data-menu-phase="dismiss"] {
|
|
|
641
677
|
html[data-dcc-transition="on"] [role="menu"]:not([data-menu-phase]),
|
|
642
678
|
html[data-dcc-transition="on"] [role="listbox"]:not([data-menu-phase]) {
|
|
643
679
|
transform-origin: var(--dcc-menu-origin, left center);
|
|
644
|
-
animation: dcc-menu-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
680
|
+
animation: dcc-menu-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) !important;
|
|
645
681
|
}
|
|
646
682
|
html[data-dcc-transition="on"] [role="dialog"]:not([data-menu-phase]) {
|
|
647
683
|
transform-origin: 50% 50%;
|
|
648
|
-
animation: dcc-menu-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
684
|
+
animation: dcc-menu-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) !important;
|
|
649
685
|
}
|
|
650
686
|
/* animation 简写会把 name 重置回 dcc-menu-in,所以这条必须写在它之后 */
|
|
651
687
|
html[data-dcc-menu-blur="on"] [data-menu-material][data-menu-phase="enter"],
|
|
@@ -653,14 +689,15 @@ html[data-dcc-menu-blur="on"] [data-menu-material][data-menu-phase="dismiss"],
|
|
|
653
689
|
html[data-dcc-menu-blur="on"] [role="menu"]:not([data-menu-phase]),
|
|
654
690
|
html[data-dcc-menu-blur="on"] [role="listbox"]:not([data-menu-phase]),
|
|
655
691
|
html[data-dcc-menu-blur="on"] [role="dialog"]:not([data-menu-phase]) {
|
|
656
|
-
animation-name: dcc-plain-in;
|
|
692
|
+
animation-name: dcc-plain-in !important;
|
|
657
693
|
}
|
|
658
694
|
html[data-dcc-menu-blur="on"] [data-menu-material][data-menu-phase="dismiss"] {
|
|
659
|
-
animation-name: dcc-plain-out;
|
|
695
|
+
animation-name: dcc-plain-out !important;
|
|
660
696
|
}
|
|
661
697
|
|
|
662
698
|
|
|
663
699
|
@keyframes dcc-menu-in {
|
|
700
|
+
/* 缩放幅度保持 6%:再大宿主按 rect 算子菜单位置就会偏出去 */
|
|
664
701
|
from {
|
|
665
702
|
opacity: 0;
|
|
666
703
|
transform: scale(.94);
|
|
@@ -668,9 +705,9 @@ html[data-dcc-menu-blur="on"] [data-menu-material][data-menu-phase="dismiss"] {
|
|
|
668
705
|
}
|
|
669
706
|
to {
|
|
670
707
|
opacity: 1;
|
|
708
|
+
/* 必须是 none 而不是 scale(1):任何非 none 的 transform 都会创建包含块,
|
|
709
|
+
position: fixed 的后代(子菜单)会改为相对它定位,长菜单因此错位。 */
|
|
671
710
|
transform: none;
|
|
672
|
-
/* 保持兜底到最后一帧:动画没有 forwards,结束即自动回到元素自身样式,
|
|
673
|
-
那时 transform 也消失、backdrop-filter 恢复,衔接无痕。 */
|
|
674
711
|
background-color: var(--dcc-menu-fallback, var(--dsw-alias-bg-layer-1));
|
|
675
712
|
}
|
|
676
713
|
}
|
|
@@ -703,7 +740,7 @@ html[data-dcc-dot="on"] [class*="_sessionRow"] {
|
|
|
703
740
|
html[data-dcc-dot="on"] [class*="_sessionRow"]::before {
|
|
704
741
|
content: "";
|
|
705
742
|
position: absolute;
|
|
706
|
-
left: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + var(--dsh-workspace-indent, 0px) + 8px -
|
|
743
|
+
left: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + var(--dsh-workspace-indent, 0px) + 8px - 5px);
|
|
707
744
|
top: 50%;
|
|
708
745
|
width: 4px;
|
|
709
746
|
height: 4px;
|
|
@@ -713,18 +750,45 @@ html[data-dcc-dot="on"] [class*="_sessionRow"]::before {
|
|
|
713
750
|
opacity: .35;
|
|
714
751
|
pointer-events: none;
|
|
715
752
|
}
|
|
753
|
+
|
|
754
|
+
/* slot 里已经有状态图标(运行中的加载圈、结束标记之类)时,
|
|
755
|
+
不再画会话前圆点,避免两个标记并排叠在一起。 */
|
|
756
|
+
html[data-dcc-dot="on"] [class*="_sessionRow"]:has([class*="_slot"] svg)::before {
|
|
757
|
+
display: none !important;
|
|
758
|
+
}
|
|
716
759
|
/* 与 archive-manager 的收藏星标共存:星标占用的正是同一个 16px 前导位置。
|
|
717
760
|
星标在行悬停时总会出现(未收藏是空心、可点),已收藏则常驻,
|
|
718
761
|
两种情况下都不再画自身的小圆点,避免与星标叠在一起。 */
|
|
719
|
-
|
|
762
|
+
/* 悬停规避只在「隐藏会话悬停多余按钮」关着时才需要——
|
|
763
|
+
那个开关打开后,未收藏的星标根本不会出现,圆点不必让位。
|
|
764
|
+
已收藏的星标是常驻的,所以这一条不受开关影响。 */
|
|
765
|
+
html[data-dcc-dot="on"][data-dcc-row-buttons="off"] [class*="_sessionRow"]:hover:has(.dsham_starSlot)::before,
|
|
720
766
|
html[data-dcc-dot="on"] [class*="_sessionRow"]:has(.dsham_starSlot[data-favorited="true"])::before {
|
|
721
767
|
display: none;
|
|
722
768
|
}
|
|
723
|
-
/*
|
|
724
|
-
|
|
725
|
-
html [class*="_sessionRow"] .dsham_starSlot
|
|
726
|
-
|
|
769
|
+
/* 收藏星标是绝对定位(left: 8px),要左移 1px 必须写 7px——
|
|
770
|
+
直接写 left: -1px 会替换掉原来的基准,把它甩到行外。 */
|
|
771
|
+
html[data-dcc-radius="on"] [class*="_sessionRow"] .dsham_starSlot {
|
|
772
|
+
left: 7px !important;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/* 悬停时才出现的收藏按钮(未收藏的空心星)跟着「隐藏会话悬停多余按钮」一起隐藏,
|
|
776
|
+
已收藏的实心星保持显示——那是用户自己点亮的状态,不应该藏起来。 */
|
|
777
|
+
html[data-dcc-row-buttons="on"] [class*="_sessionRow"] .dsham_starSlot:not([data-favorited="true"]) {
|
|
778
|
+
display: none !important;
|
|
727
779
|
}
|
|
780
|
+
/* 工作区行和会话行左侧的图标统一左移 2px。
|
|
781
|
+
宿主用 padding-inline-start + gap 排列行内图标,所以调行的起始内边距
|
|
782
|
+
就能一次对齐这一列——文件夹、圆点、加载圈、星标、第三方插件加的图标
|
|
783
|
+
全都跟着走,不用逐个类名去点。 */
|
|
784
|
+
html[data-dcc-radius="on"] [class*="_projectRow"],
|
|
785
|
+
html[data-dcc-radius="on"] [class*="_sessionRow"] {
|
|
786
|
+
padding-inline-start: calc(
|
|
787
|
+
var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset)
|
|
788
|
+
+ var(--dsh-workspace-indent, 0px) - 2px
|
|
789
|
+
) !important;
|
|
790
|
+
}
|
|
791
|
+
|
|
728
792
|
/* 「展开其余 N 个会话 / 收起」比工作区标题更淡 */
|
|
729
793
|
html[data-dcc-dim="on"] [class*="_sessionOverflowButton"] {
|
|
730
794
|
color: var(--dsw-alias-label-tertiary) !important;
|
|
@@ -734,12 +798,31 @@ html[data-dcc-dim="on"] [class*="_sessionOverflowButton"]:hover {
|
|
|
734
798
|
opacity: .9 !important;
|
|
735
799
|
}
|
|
736
800
|
|
|
801
|
+
/* 工作区行左侧的图标统一尺寸和位置,跟着「减小圆角与间距」走。
|
|
802
|
+
宿主的文件夹图标是 16px,行高 32px,缩到 14px 后与 13px 的标题更协调。
|
|
803
|
+
其他插件在这个位置放的图标(自定义 svg、img、字符等)也一并按同一套
|
|
804
|
+
尺寸和偏移处理,保证整列左边缘对齐。 */
|
|
805
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_folder"] svg,
|
|
806
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_folder"] img,
|
|
807
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_leading"] svg,
|
|
808
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_leading"] img,
|
|
809
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_iconSlot"] svg,
|
|
810
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_iconSlot"] img {
|
|
811
|
+
width: 14px !important;
|
|
812
|
+
height: 14px !important;
|
|
813
|
+
/* 位置上移 1px 与文字基线对齐(横向由行的 padding 统一处理) */
|
|
814
|
+
position: relative !important;
|
|
815
|
+
top: -1px !important;
|
|
816
|
+
/* 非正方形图标按比例缩,不拉伸 */
|
|
817
|
+
object-fit: contain !important;
|
|
818
|
+
}
|
|
819
|
+
|
|
737
820
|
/* ---------- 工作区行:悬停时不换成展开箭头,保持文件夹图标 ---------- */
|
|
738
821
|
/* 宿主默认:hover 时 .chevron 显示、.folder 隐藏(Rows.module.css)。这里反着压回去。 */
|
|
739
|
-
html [class*="_projectRow"]:hover [class*="_folder"] {
|
|
822
|
+
html[data-dcc-enabled="on"] [class*="_projectRow"]:hover [class*="_folder"] {
|
|
740
823
|
display: inline-flex !important;
|
|
741
824
|
}
|
|
742
|
-
html [class*="_projectRow"]:hover [class*="_chevron"] {
|
|
825
|
+
html[data-dcc-enabled="on"] [class*="_projectRow"]:hover [class*="_chevron"] {
|
|
743
826
|
display: none !important;
|
|
744
827
|
}
|
|
745
828
|
|
|
@@ -797,6 +880,12 @@ html[data-dcc-hover="off"] [class*="_bridge_bgejw"] {
|
|
|
797
880
|
html[data-dcc-row-buttons="on"] [class*="_sessionRow"] [class*="_rowActions"] button[data-dcc-hidden] {
|
|
798
881
|
display: none !important;
|
|
799
882
|
}
|
|
883
|
+
/* 兜底:不等脚本标记,按按钮身份直接隐藏。
|
|
884
|
+
悬停行时「菜单」和「置顶」保留,其余立刻不可见——
|
|
885
|
+
脚本晚一拍也不会先闪出一排按钮。 */
|
|
886
|
+
html[data-dcc-row-buttons="on"] [class*="_sessionRow"]:hover [class*="_rowActions"] button:not([data-context-menu-trigger]):not([aria-label*="置顶"]):not([aria-label*="pin" i]):not([aria-label*="取消置顶"]):not([aria-label*="unpin" i]) {
|
|
887
|
+
display: none !important;
|
|
888
|
+
}
|
|
800
889
|
|
|
801
890
|
/* ---------- 会话标题栏紧凑化:标签行并入顶部工具区 ---------- */
|
|
802
891
|
/* 注意不能 display:none:宿主按标签行的 clientWidth 计算「能显示几个视图」,
|
|
@@ -825,70 +914,254 @@ html[data-dcc-compact-header="on"] [class*="_header"]:has([data-conversation-tab
|
|
|
825
914
|
这一条不受「会话标题栏紧凑化」开关控制——用户关掉「轨迹」后标题栏本来就矮,
|
|
826
915
|
没有标签行可压,但那根线依然不该出现。用 headerUtilities 而不是 tabs 定位,
|
|
827
916
|
保证两种形态(有/无标签行)都能命中。 */
|
|
828
|
-
|
|
917
|
+
/* 标题栏去掉硬分割线,改用内容顶部的柔边过渡 */
|
|
918
|
+
html[data-dcc-enabled="on"][data-dcc-header-fade="on"] [class*="_header"]:has([class*="_headerUtilities"]) {
|
|
829
919
|
border-bottom: none !important;
|
|
830
920
|
}
|
|
831
921
|
/* 顶部柔边只给「对话」用:轨迹视图整块都是界面,渐隐会吃掉它自己的表头。
|
|
832
922
|
轨道上没有 data-view 之类的标记,只能借标签页的选中态判断——
|
|
833
923
|
第一个 tab 就是「对话」,它 aria-selected 时才挂 mask。 */
|
|
834
|
-
html:has([data-conversation-tabs] [role="tab"]:first-child[aria-selected="true"]) [data-conversation-scroll] {
|
|
924
|
+
html[data-dcc-enabled="on"][data-dcc-header-fade="on"]:has([data-conversation-tabs] [role="tab"]:first-child[aria-selected="true"]) [data-conversation-scroll] {
|
|
835
925
|
-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
|
|
836
926
|
mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
|
|
837
927
|
}
|
|
838
|
-
|
|
928
|
+
/* 宿主自带的「更多」按钮:只在紧凑化开启时隐藏——那时标签行被本插件的
|
|
929
|
+
下拉按钮取代,宿主这个按钮用不上。紧凑化关闭时标签行是原版的,
|
|
930
|
+
这个按钮必须留着,否则视图被裁掉后无法访问。 */
|
|
931
|
+
html[data-dcc-enabled="on"][data-dcc-compact-header="on"] [class*="_viewsMoreAnchor"] {
|
|
839
932
|
display: none !important;
|
|
840
933
|
}
|
|
841
934
|
/* 开关关掉时,自绘的分段控件不出现,标签行恢复原样 */
|
|
842
935
|
html[data-dcc-compact-header="off"] .dcc-segmented {
|
|
843
936
|
display: none !important;
|
|
844
937
|
}
|
|
845
|
-
/*
|
|
846
|
-
圆角用 sm(8px) 而不是 md(12px),描边用更浅的 l1。 */
|
|
938
|
+
/* 视图控件:一个普通的下拉按钮(当前视图名 + 箭头),点整块展开菜单。 */
|
|
847
939
|
.dcc-segmented {
|
|
848
940
|
box-sizing: border-box;
|
|
849
|
-
transition: opacity .35s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
850
941
|
display: inline-flex;
|
|
851
942
|
align-items: stretch;
|
|
852
943
|
height: 24px;
|
|
853
|
-
/* 视图变多时向左长:不让自己被压缩,宽度由内容决定 */
|
|
854
944
|
flex: none;
|
|
855
|
-
/* 宿主给 headerUtilities 的 gap 是 8px;我们这层带 0.5px 描边和圆角,
|
|
856
|
-
视觉上边界内缩、显得比别的元素远一点,补 2px 回来 */
|
|
857
945
|
margin-right: 2px;
|
|
858
|
-
|
|
946
|
+
opacity: 0;
|
|
947
|
+
transition: opacity .2s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
948
|
+
}
|
|
949
|
+
/* 悬停整个标题栏区域时浮现;鼠标直接落在控件上也保持可见 */
|
|
950
|
+
[class*="_header"]:hover .dcc-segmented,
|
|
951
|
+
.dcc-segmented:hover,
|
|
952
|
+
.dcc-segmented:focus-within {
|
|
953
|
+
opacity: 1;
|
|
954
|
+
}
|
|
955
|
+
/* 不在「对话」视图时,控件常驻显示当前视图名 */
|
|
956
|
+
/* 开关打开时,对话视图下也不再自动隐藏 */
|
|
957
|
+
html[data-dcc-always-show="on"] .dcc-segmented {
|
|
958
|
+
opacity: 1;
|
|
959
|
+
}
|
|
960
|
+
.dcc-segmented[data-pinned="true"] {
|
|
961
|
+
opacity: 1;
|
|
962
|
+
}
|
|
963
|
+
.dcc-trigger {
|
|
964
|
+
display: inline-flex;
|
|
965
|
+
align-items: center;
|
|
966
|
+
gap: 6px;
|
|
967
|
+
height: 24px;
|
|
968
|
+
/* 左边多给 2px:右侧有箭头撑着,等宽内边距会让左边缘显得更挤 */
|
|
969
|
+
padding: 0 6px 0 8px;
|
|
859
970
|
border: 0.5px solid var(--dsw-alias-border-l4);
|
|
860
971
|
border-radius: var(--dsw-radius-sm, 8px);
|
|
861
972
|
background: var(--dsw-alias-bg-layer-1);
|
|
973
|
+
color: var(--dsw-alias-label-secondary);
|
|
974
|
+
font: inherit;
|
|
975
|
+
font-size: 12px;
|
|
976
|
+
line-height: 1;
|
|
977
|
+
white-space: nowrap;
|
|
978
|
+
cursor: pointer;
|
|
979
|
+
transition: background-color .12s, color .12s;
|
|
980
|
+
}
|
|
981
|
+
.dcc-trigger:hover {
|
|
982
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
983
|
+
color: var(--dsw-alias-label-primary);
|
|
984
|
+
}
|
|
985
|
+
.dcc-trigger[data-open="true"] {
|
|
986
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
987
|
+
color: var(--dsw-alias-label-primary);
|
|
988
|
+
}
|
|
989
|
+
.dcc-trigger-label {
|
|
990
|
+
max-width: 120px;
|
|
862
991
|
overflow: hidden;
|
|
992
|
+
text-overflow: ellipsis;
|
|
863
993
|
}
|
|
864
|
-
|
|
865
|
-
|
|
994
|
+
.dcc-trigger-arrow {
|
|
995
|
+
display: block;
|
|
996
|
+
width: 12px;
|
|
997
|
+
height: 12px;
|
|
866
998
|
flex: none;
|
|
867
|
-
|
|
868
|
-
|
|
999
|
+
transition: transform .15s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
1000
|
+
}
|
|
1001
|
+
.dcc-trigger[data-open="true"] .dcc-trigger-arrow {
|
|
1002
|
+
transform: rotate(180deg);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/* 溢出菜单:对齐宿主菜单的尺寸与层级(圆角 12、内距 6、项高 32、项圆角 8) */
|
|
1006
|
+
/* 会话正文渐显:切换会话后,正文列和轮次标记一起淡入。
|
|
1007
|
+
由脚本在加载提示消失后重播——容器本身不重建,单靠 CSS 动画只播一次。
|
|
1008
|
+
归在「优化加载界面」里,属始终开启项,不受动画开关控制。 */
|
|
1009
|
+
html[data-dcc-enabled="on"] [data-dcc-fade-in] {
|
|
1010
|
+
animation: dcc-content-in .26s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
1011
|
+
}
|
|
1012
|
+
@keyframes dcc-content-in {
|
|
1013
|
+
from { opacity: 0; }
|
|
1014
|
+
to { opacity: 1; }
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/* ===== BOOT-HINT: 宿主加载页适配(高耦合,见 installBootHint 的注释)=====
|
|
1018
|
+
只藏旋转圈。hint 居中和 HARNESS 隐藏必须在同一帧完成,放在脚本里做。
|
|
1019
|
+
宿主加载页若改版,整块删掉即可,不影响其它样式。 */
|
|
1020
|
+
/* 脚本处理完之前先整体不可见:宿主第一帧渲染的是原始布局,
|
|
1021
|
+
如果直接可见会露出一瞬的 HARNESS + Loading 并排。空一帧比错一帧好。
|
|
1022
|
+
处理完由脚本打上 data-dcc-boot-ready,恢复正常显示。 */
|
|
1023
|
+
html[data-dcc-enabled="on"] [data-dsh-boot]:not([data-dcc-boot-ready]) {
|
|
1024
|
+
visibility: hidden;
|
|
1025
|
+
}
|
|
1026
|
+
/* 兜底:万一脚本没跑(插件未加载等),两秒后无论如何都显示出来,
|
|
1027
|
+
避免加载页永久不可见。 */
|
|
1028
|
+
html[data-dcc-enabled="on"] [data-dsh-boot] {
|
|
1029
|
+
animation: dcc-boot-reveal 0s linear 2s forwards;
|
|
1030
|
+
}
|
|
1031
|
+
@keyframes dcc-boot-reveal {
|
|
1032
|
+
to { visibility: visible; }
|
|
1033
|
+
}
|
|
1034
|
+
html[data-dcc-enabled="on"] [data-dsh-boot] [data-dsh-boot-spinner],
|
|
1035
|
+
html[data-dcc-enabled="on"] [data-dsh-boot] [class*="_spinner"] {
|
|
1036
|
+
display: none !important;
|
|
1037
|
+
}
|
|
1038
|
+
/* ===== BOOT-HINT END ===== */
|
|
1039
|
+
|
|
1040
|
+
/* 会话切换时的「载入历史」提示:挪到正文中心,鲸鱼在上、文字在下。
|
|
1041
|
+
文字内容由宿主写入,这里只改排版,不替换文案。 */
|
|
1042
|
+
html[data-dcc-enabled="on"] [class*="_hint"] {
|
|
1043
|
+
position: fixed !important;
|
|
1044
|
+
/* left/top 由脚本按正文区域的中心算出来写上去 */
|
|
1045
|
+
transform: translate(-50%, -50%) !important;
|
|
1046
|
+
display: flex !important;
|
|
1047
|
+
flex-direction: column !important;
|
|
1048
|
+
align-items: center !important;
|
|
1049
|
+
gap: 10px !important;
|
|
1050
|
+
margin: 0 !important;
|
|
1051
|
+
color: var(--dsw-alias-label-tertiary) !important;
|
|
1052
|
+
font-size: 13px !important;
|
|
1053
|
+
white-space: nowrap !important;
|
|
1054
|
+
pointer-events: none !important;
|
|
1055
|
+
}
|
|
1056
|
+
html[data-dcc-enabled="on"] [data-dcc-hint-fish] {
|
|
1057
|
+
width: 56px;
|
|
1058
|
+
height: auto;
|
|
1059
|
+
opacity: .32;
|
|
1060
|
+
flex: none;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/* 追加到宿主菜单末尾的「重载前端界面」:外观对齐宿主自己的菜单项,
|
|
1064
|
+
高度、内边距、字号都按它的规格来。 */
|
|
1065
|
+
.dcc-menu-extra {
|
|
1066
|
+
display: flex;
|
|
869
1067
|
align-items: center;
|
|
1068
|
+
gap: 6px;
|
|
1069
|
+
width: 100%;
|
|
1070
|
+
min-height: 32px;
|
|
1071
|
+
padding: 0 10px;
|
|
870
1072
|
border: 0;
|
|
1073
|
+
border-radius: var(--dsw-radius-sm, 8px);
|
|
871
1074
|
background: transparent;
|
|
872
|
-
color: var(--dsw-alias-label-
|
|
1075
|
+
color: var(--dsw-alias-label-primary);
|
|
873
1076
|
font: inherit;
|
|
874
|
-
font-size:
|
|
875
|
-
|
|
876
|
-
|
|
1077
|
+
font-size: 13px;
|
|
1078
|
+
text-align: left;
|
|
1079
|
+
white-space: nowrap;
|
|
877
1080
|
cursor: pointer;
|
|
878
|
-
transition: background-color .12s, color .12s;
|
|
879
1081
|
}
|
|
880
|
-
.dcc-
|
|
881
|
-
border-left: 0.5px solid var(--dsw-alias-border-l4);
|
|
882
|
-
}
|
|
883
|
-
.dcc-seg:hover:not([data-active="true"]) {
|
|
1082
|
+
.dcc-menu-extra:hover {
|
|
884
1083
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
885
|
-
color: var(--dsw-alias-label-primary);
|
|
886
1084
|
}
|
|
887
|
-
.dcc-
|
|
1085
|
+
.dcc-menu-extra > span {
|
|
1086
|
+
/* 图标左移后文字跟着走一点,和宿主菜单项的文字左边缘对齐 */
|
|
1087
|
+
position: relative;
|
|
1088
|
+
left: -2px;
|
|
1089
|
+
}
|
|
1090
|
+
.dcc-menu-extra-icon {
|
|
1091
|
+
display: block;
|
|
1092
|
+
width: 16px;
|
|
1093
|
+
height: 16px;
|
|
1094
|
+
flex: none;
|
|
1095
|
+
/* 和宿主菜单项的图标左边缘对齐(宿主的图标比 16px 小的会儿再偏一点) */
|
|
1096
|
+
position: relative;
|
|
1097
|
+
left: -2px;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
.dcc-seg-menu {
|
|
1101
|
+
position: fixed;
|
|
1102
|
+
z-index: 2147483000;
|
|
1103
|
+
min-width: 140px;
|
|
1104
|
+
padding: 6px;
|
|
1105
|
+
border-radius: var(--dsw-radius-md, 12px);
|
|
1106
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
1107
|
+
box-shadow:
|
|
1108
|
+
0 0 0 1px var(--dsw-alias-border-l2),
|
|
1109
|
+
0 10px 32px rgba(0, 0, 0, .24);
|
|
1110
|
+
display: flex;
|
|
1111
|
+
flex-direction: column;
|
|
1112
|
+
gap: 2px;
|
|
1113
|
+
}
|
|
1114
|
+
.dcc-seg-menu-item {
|
|
1115
|
+
display: flex;
|
|
1116
|
+
align-items: center;
|
|
1117
|
+
justify-content: space-between;
|
|
1118
|
+
gap: 16px;
|
|
1119
|
+
height: 32px;
|
|
1120
|
+
padding: 0 12px;
|
|
1121
|
+
border: 0;
|
|
1122
|
+
border-radius: var(--dsw-radius-sm, 8px);
|
|
888
1123
|
background: transparent;
|
|
1124
|
+
color: var(--dsw-alias-label-primary);
|
|
1125
|
+
font: inherit;
|
|
1126
|
+
font-size: 13px;
|
|
1127
|
+
line-height: 32px;
|
|
1128
|
+
text-align: left;
|
|
1129
|
+
white-space: nowrap;
|
|
1130
|
+
cursor: pointer;
|
|
1131
|
+
}
|
|
1132
|
+
.dcc-seg-menu-label {
|
|
1133
|
+
min-width: 0;
|
|
1134
|
+
overflow: hidden;
|
|
1135
|
+
text-overflow: ellipsis;
|
|
1136
|
+
}
|
|
1137
|
+
.dcc-seg-menu-check {
|
|
1138
|
+
flex: none;
|
|
1139
|
+
width: 14px;
|
|
1140
|
+
height: 14px;
|
|
1141
|
+
opacity: 0;
|
|
1142
|
+
color: var(--dsw-alias-state-business-primary);
|
|
1143
|
+
}
|
|
1144
|
+
.dcc-seg-menu-check::before {
|
|
1145
|
+
content: '';
|
|
1146
|
+
display: block;
|
|
1147
|
+
width: 100%;
|
|
1148
|
+
height: 100%;
|
|
1149
|
+
background-color: currentColor;
|
|
1150
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5 6.2 11.7 13 4.9' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1151
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5 6.2 11.7 13 4.9' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1152
|
+
-webkit-mask-size: contain;
|
|
1153
|
+
mask-size: contain;
|
|
1154
|
+
}
|
|
1155
|
+
.dcc-seg-menu-item[data-active="true"] .dcc-seg-menu-check {
|
|
1156
|
+
opacity: 1;
|
|
1157
|
+
}
|
|
1158
|
+
.dcc-seg-menu-item[data-active="true"] {
|
|
889
1159
|
color: var(--dsw-alias-state-business-primary);
|
|
890
1160
|
font-weight: 500;
|
|
891
1161
|
}
|
|
1162
|
+
.dcc-seg-menu-item:hover {
|
|
1163
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
1164
|
+
}
|
|
892
1165
|
|
|
893
1166
|
/* ---------- 输入框下方状态行:速率/缓存靠左,上下文环推到最右 ---------- */
|
|
894
1167
|
/* 宿主的 _dock 只有 280px 宽且居中,里面是两个子项:左边的胶囊组和包着环的
|
|
@@ -1085,7 +1358,7 @@ html[data-dcc-select="on"] body [class*="_crumb"] * {
|
|
|
1085
1358
|
}
|
|
1086
1359
|
|
|
1087
1360
|
/* ---------- 已归档会话:标题画删除线 ---------- */
|
|
1088
|
-
html [class*="_sessionRow"][class*="_archived"] [class*="_title"] {
|
|
1361
|
+
html[data-dcc-enabled="on"] [class*="_sessionRow"][class*="_archived"] [class*="_title"] {
|
|
1089
1362
|
text-decoration: line-through;
|
|
1090
1363
|
text-decoration-thickness: 1px;
|
|
1091
1364
|
}
|
|
@@ -1101,23 +1374,23 @@ html[data-dcc-dot="on"] body[data-ds-dark-theme] [class*="_sessionRow"]::before
|
|
|
1101
1374
|
}
|
|
1102
1375
|
/* 浅色主题下导航 hover 与新会话常规底色略微加强 */
|
|
1103
1376
|
/* 浅色主题下选中会话的背景再强一点 */
|
|
1104
|
-
body:not([data-ds-dark-theme]) [class*="_sessionRow"][class*="_selected"] {
|
|
1377
|
+
html[data-dcc-enabled="on"] body:not([data-ds-dark-theme]) [class*="_sessionRow"][class*="_selected"] {
|
|
1105
1378
|
box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .04) !important;
|
|
1106
1379
|
}
|
|
1107
1380
|
|
|
1108
1381
|
/* 导航行:悬停弱、选中强。
|
|
1109
1382
|
宿主的激活标记不在行类名上,而是按钮的 aria-current="page",
|
|
1110
1383
|
所以悬停作用在 :hover、选中作用在 [aria-current="page"],两者叠出来才有层次。 */
|
|
1111
|
-
body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"]:hover {
|
|
1384
|
+
html[data-dcc-enabled="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"]:hover {
|
|
1112
1385
|
box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .05) !important;
|
|
1113
1386
|
}
|
|
1114
|
-
body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"][aria-current="page"] {
|
|
1387
|
+
html[data-dcc-enabled="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"][aria-current="page"] {
|
|
1115
1388
|
box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .16) !important;
|
|
1116
1389
|
}
|
|
1117
|
-
body:not([data-ds-dark-theme]) nav[class*="_panelList"] [class*="_panelRow"]:hover {
|
|
1390
|
+
html[data-dcc-enabled="on"] body:not([data-ds-dark-theme]) nav[class*="_panelList"] [class*="_panelRow"]:hover {
|
|
1118
1391
|
box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .025) !important;
|
|
1119
1392
|
}
|
|
1120
|
-
body:not([data-ds-dark-theme]) nav[class*="_panelList"] [class*="_panelRow"][aria-current="page"] {
|
|
1393
|
+
html[data-dcc-enabled="on"] body:not([data-ds-dark-theme]) nav[class*="_panelList"] [class*="_panelRow"][aria-current="page"] {
|
|
1121
1394
|
box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .07) !important;
|
|
1122
1395
|
}
|
|
1123
1396
|
|
|
@@ -1488,9 +1761,9 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1488
1761
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
1489
1762
|
document.addEventListener('click', onClick, true);
|
|
1490
1763
|
document.addEventListener('mousemove', onMove, true);
|
|
1491
|
-
/*
|
|
1764
|
+
/* 设置面板全屏 / 窗口模式切换后,返回按钮要重新对齐位置 */
|
|
1492
1765
|
const onPrefs = (event) => {
|
|
1493
|
-
if (event.detail && event.detail.key === '
|
|
1766
|
+
if (event.detail && event.detail.key === 'settingsFullscreen') ensure();
|
|
1494
1767
|
};
|
|
1495
1768
|
window.addEventListener('dcc-prefs-changed', onPrefs);
|
|
1496
1769
|
|
|
@@ -1585,6 +1858,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1585
1858
|
let lastRowHoverAt = 0;
|
|
1586
1859
|
|
|
1587
1860
|
const onOver = (event) => {
|
|
1861
|
+
if (document.documentElement.dataset.dccEnabled !== 'on') return;
|
|
1588
1862
|
if (document.documentElement.dataset.dccHover !== 'off') return;
|
|
1589
1863
|
const target = event.target;
|
|
1590
1864
|
if (!(target instanceof Element)) return;
|
|
@@ -1662,17 +1936,44 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1662
1936
|
|
|
1663
1937
|
const findTabs = () => document.querySelector('[data-conversation-tabs]');
|
|
1664
1938
|
const findHost = () => document.querySelector('[class*="_headerUtilities"]');
|
|
1939
|
+
/* 视图控件始终折叠:只显示「当前激活」+「⋯」,其余收进菜单。 */
|
|
1940
|
+
let segMenu = null;
|
|
1941
|
+
let segMenuGuard = null;
|
|
1942
|
+
let segMenuAnchor = null;
|
|
1943
|
+
const closeSegMenu = () => {
|
|
1944
|
+
if (segMenu !== null) {
|
|
1945
|
+
segMenu.remove();
|
|
1946
|
+
segMenu = null;
|
|
1947
|
+
}
|
|
1948
|
+
if (segMenuAnchor !== null) {
|
|
1949
|
+
segMenuAnchor.removeAttribute('data-open');
|
|
1950
|
+
/* 主动移除焦点:否则 :focus-within 会一直成立,鼠标移走后控件还留在那里 */
|
|
1951
|
+
if (typeof segMenuAnchor.blur === 'function') segMenuAnchor.blur();
|
|
1952
|
+
segMenuAnchor = null;
|
|
1953
|
+
}
|
|
1954
|
+
if (segMenuGuard !== null) {
|
|
1955
|
+
document.removeEventListener('pointerdown', segMenuGuard, true);
|
|
1956
|
+
segMenuGuard = null;
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1665
1959
|
|
|
1666
1960
|
const syncActive = () => {
|
|
1667
1961
|
if (bar === null) return;
|
|
1668
1962
|
const tabs = findTabs();
|
|
1669
1963
|
if (tabs === null) return;
|
|
1670
1964
|
const sources = Array.from(tabs.querySelectorAll('button[role="tab"]'));
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1965
|
+
const activeIndex = sources.findIndex((el) => el.getAttribute('aria-selected') === 'true');
|
|
1966
|
+
/* 按钮上显示当前视图名 */
|
|
1967
|
+
const label = bar.querySelector('.dcc-trigger-label');
|
|
1968
|
+
if (label !== null && sources[activeIndex] !== undefined) {
|
|
1969
|
+
const text = (sources[activeIndex].textContent || '').trim();
|
|
1970
|
+
if (label.textContent !== text) label.textContent = text;
|
|
1971
|
+
}
|
|
1972
|
+
/* 第一个视图(对话)之外的页面,控件要常驻显示当前视图名。
|
|
1973
|
+
宿主切视图的中间态可能一个选中项都没有(activeIndex 为 -1),
|
|
1974
|
+
这时保持上一次的状态,不要误判成「回到对话」而闪一下隐藏。 */
|
|
1975
|
+
if (activeIndex >= 0) {
|
|
1976
|
+
bar.dataset.pinned = activeIndex > 0 ? 'true' : 'false';
|
|
1676
1977
|
}
|
|
1677
1978
|
};
|
|
1678
1979
|
|
|
@@ -1683,7 +1984,11 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1683
1984
|
const rect = old.getBoundingClientRect();
|
|
1684
1985
|
/* 控件已经被宿主摘掉时 rect 全是 0,照着定位会把它摆到窗口左上角。
|
|
1685
1986
|
这种情况直接丢掉,不做淡出。 */
|
|
1686
|
-
|
|
1987
|
+
/* 控件平时是隐藏的(opacity:0),只有标题栏被悬停时才可见。
|
|
1988
|
+
不可见时做淡出没有意义,反而会凭空闪一下,所以直接丢掉。 */
|
|
1989
|
+
const visible = old.isConnected && rect.width > 0
|
|
1990
|
+
&& window.getComputedStyle(old).opacity !== '0';
|
|
1991
|
+
if (!visible) {
|
|
1687
1992
|
old.remove();
|
|
1688
1993
|
} else {
|
|
1689
1994
|
/* 把旧控件固定到原位置、脱离布局流再淡出——
|
|
@@ -1708,32 +2013,114 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1708
2013
|
}
|
|
1709
2014
|
bar = document.createElement('div');
|
|
1710
2015
|
bar.className = 'dcc-segmented';
|
|
1711
|
-
|
|
2016
|
+
closeSegMenu();
|
|
1712
2017
|
const sources = Array.from(tabs.querySelectorAll('button[role="tab"]'));
|
|
1713
|
-
sources.
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
2018
|
+
const activeIndex = sources.findIndex((el) => el.getAttribute('aria-selected') === 'true');
|
|
2019
|
+
|
|
2020
|
+
/* 把点击转发给宿主对应的标签按钮 */
|
|
2021
|
+
const forward = (index) => {
|
|
2022
|
+
const current = findTabs();
|
|
2023
|
+
if (current === null) return;
|
|
2024
|
+
const target = current.querySelectorAll('button[role="tab"]')[index];
|
|
2025
|
+
if (target !== undefined) target.click();
|
|
2026
|
+
};
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
/* 控件就是一个普通的下拉按钮:当前视图名 + 箭头,点整块展开菜单 */
|
|
2030
|
+
{
|
|
2031
|
+
const activeIdx = activeIndex >= 0 ? activeIndex : 0;
|
|
2032
|
+
const trigger = document.createElement('button');
|
|
2033
|
+
trigger.type = 'button';
|
|
2034
|
+
trigger.className = 'dcc-trigger';
|
|
2035
|
+
trigger.setAttribute('aria-haspopup', 'menu');
|
|
2036
|
+
const textNode = document.createElement('span');
|
|
2037
|
+
textNode.className = 'dcc-trigger-label';
|
|
2038
|
+
textNode.textContent = sources[activeIdx] === undefined
|
|
2039
|
+
? ''
|
|
2040
|
+
: (sources[activeIdx].textContent || '').trim();
|
|
2041
|
+
trigger.appendChild(textNode);
|
|
2042
|
+
|
|
2043
|
+
const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
2044
|
+
arrow.setAttribute('class', 'dcc-trigger-arrow');
|
|
2045
|
+
arrow.setAttribute('viewBox', '0 0 16 16');
|
|
2046
|
+
arrow.setAttribute('aria-hidden', 'true');
|
|
2047
|
+
const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2048
|
+
arrowPath.setAttribute('d', 'M4 6.5 8 10.5 12 6.5');
|
|
2049
|
+
arrowPath.setAttribute('fill', 'none');
|
|
2050
|
+
arrowPath.setAttribute('stroke', 'currentColor');
|
|
2051
|
+
arrowPath.setAttribute('stroke-width', '1.6');
|
|
2052
|
+
arrowPath.setAttribute('stroke-linecap', 'round');
|
|
2053
|
+
arrowPath.setAttribute('stroke-linejoin', 'round');
|
|
2054
|
+
arrow.appendChild(arrowPath);
|
|
2055
|
+
trigger.appendChild(arrow);
|
|
2056
|
+
bar.appendChild(trigger);
|
|
2057
|
+
|
|
2058
|
+
const more = trigger;
|
|
2059
|
+
more.addEventListener('click', (event) => {
|
|
2060
|
+
event.stopPropagation();
|
|
2061
|
+
if (segMenu !== null) { closeSegMenu(); return; }
|
|
2062
|
+
const rect = bar.getBoundingClientRect();
|
|
2063
|
+
const menu = document.createElement('div');
|
|
2064
|
+
menu.className = 'dcc-seg-menu';
|
|
2065
|
+
/* 先插进 DOM 再量宽度,右边缘对齐到按钮右侧 —— 菜单宽度由内容决定,
|
|
2066
|
+
不能用固定值估算,否则会对不齐。 */
|
|
2067
|
+
/* 用 right 对齐按钮右边缘,不需要先量宽度——
|
|
2068
|
+
量宽度要读一次布局,会强制重排,表现为点击后慢半拍。 */
|
|
2069
|
+
menu.style.right = (window.innerWidth - rect.right) + 'px';
|
|
2070
|
+
menu.style.top = rect.bottom + 6 + 'px';
|
|
2071
|
+
const live = findTabs();
|
|
2072
|
+
const list = live === null ? [] : Array.from(live.querySelectorAll('button[role="tab"]'));
|
|
2073
|
+
const act = list.findIndex((el) => el.getAttribute('aria-selected') === 'true');
|
|
2074
|
+
/* 列出全部视图,当前选中的那项做标记——和标准下拉菜单一致 */
|
|
2075
|
+
list.forEach((source, index) => {
|
|
2076
|
+
const entry = document.createElement('button');
|
|
2077
|
+
entry.type = 'button';
|
|
2078
|
+
entry.className = 'dcc-seg-menu-item';
|
|
2079
|
+
const label = document.createElement('span');
|
|
2080
|
+
label.className = 'dcc-seg-menu-label';
|
|
2081
|
+
label.textContent = (source.textContent || '').trim();
|
|
2082
|
+
const check = document.createElement('span');
|
|
2083
|
+
check.className = 'dcc-seg-menu-check';
|
|
2084
|
+
check.setAttribute('aria-hidden', 'true');
|
|
2085
|
+
entry.append(label, check);
|
|
2086
|
+
if (index === act) {
|
|
2087
|
+
entry.dataset.active = 'true';
|
|
2088
|
+
entry.setAttribute('aria-current', 'true');
|
|
2089
|
+
}
|
|
2090
|
+
entry.addEventListener('click', () => {
|
|
2091
|
+
closeSegMenu();
|
|
2092
|
+
if (index === act) return;
|
|
2093
|
+
forward(index);
|
|
2094
|
+
});
|
|
2095
|
+
menu.appendChild(entry);
|
|
2096
|
+
});
|
|
2097
|
+
document.body.appendChild(menu);
|
|
2098
|
+
menu.style.transformOrigin = 'top right';
|
|
2099
|
+
menu.style.animation = 'dcc-plain-in .13s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1))';
|
|
2100
|
+
segMenu = menu;
|
|
2101
|
+
segMenuAnchor = more;
|
|
2102
|
+
more.setAttribute('data-open', 'true');
|
|
2103
|
+
window.setTimeout(() => {
|
|
2104
|
+
const onDown = (ev) => {
|
|
2105
|
+
if (segMenu !== menu) return;
|
|
2106
|
+
if (menu.contains(ev.target) || more.contains(ev.target)) return;
|
|
2107
|
+
closeSegMenu();
|
|
2108
|
+
};
|
|
2109
|
+
document.addEventListener('pointerdown', onDown, true);
|
|
2110
|
+
segMenuGuard = onDown;
|
|
2111
|
+
}, 0);
|
|
1729
2112
|
});
|
|
1730
|
-
|
|
1731
|
-
});
|
|
2113
|
+
}
|
|
1732
2114
|
host.insertBefore(bar, host.firstChild);
|
|
1733
|
-
window.requestAnimationFrame(() => {
|
|
1734
|
-
if (bar !== null) bar.style.opacity = '';
|
|
1735
|
-
});
|
|
1736
2115
|
syncActive();
|
|
2116
|
+
/* 重建后如果这一页需要常驻显示(非对话视图),让它淡入而不是直接跳出来 */
|
|
2117
|
+
if (bar.dataset.pinned === 'true') {
|
|
2118
|
+
const fresh = bar;
|
|
2119
|
+
fresh.style.opacity = '0';
|
|
2120
|
+
window.requestAnimationFrame(() => {
|
|
2121
|
+
if (fresh.isConnected) fresh.style.opacity = '';
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
1737
2124
|
};
|
|
1738
2125
|
|
|
1739
2126
|
const ensure = () => {
|
|
@@ -1761,11 +2148,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1761
2148
|
if (bar !== null && bar.isConnected && bar.parentElement !== host) {
|
|
1762
2149
|
host.insertBefore(bar, host.firstChild);
|
|
1763
2150
|
}
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
syncActive();
|
|
2151
|
+
/* 控件固定只有两项(激活项 + ⋯),不能拿它和标签总数比,
|
|
2152
|
+
否则每次都会判定「数量不一致」→ 反复重建 → 看起来一直在闪。 */
|
|
2153
|
+
if (bar === null || !bar.isConnected) build(tabs, host);
|
|
2154
|
+
else syncActive();
|
|
1769
2155
|
};
|
|
1770
2156
|
|
|
1771
2157
|
const schedule = () => {
|
|
@@ -1777,7 +2163,20 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1777
2163
|
};
|
|
1778
2164
|
|
|
1779
2165
|
ensure();
|
|
1780
|
-
|
|
2166
|
+
/* 切视图时 aria-selected 一变就立刻同步,不走 350ms 防抖:
|
|
2167
|
+
否则非对话视图下要等半拍控件才常驻出来。 */
|
|
2168
|
+
const onSelect = () => {
|
|
2169
|
+
if (timer !== null) {
|
|
2170
|
+
clearTimeout(timer);
|
|
2171
|
+
timer = null;
|
|
2172
|
+
}
|
|
2173
|
+
ensure();
|
|
2174
|
+
};
|
|
2175
|
+
observer = new MutationObserver((records) => {
|
|
2176
|
+
const selected = records.some((record) => record.type === 'attributes');
|
|
2177
|
+
if (selected) onSelect();
|
|
2178
|
+
else schedule();
|
|
2179
|
+
});
|
|
1781
2180
|
observer.observe(document.body, {
|
|
1782
2181
|
childList: true,
|
|
1783
2182
|
subtree: true,
|
|
@@ -1785,15 +2184,323 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1785
2184
|
attributeFilter: ['aria-selected'],
|
|
1786
2185
|
});
|
|
1787
2186
|
|
|
2187
|
+
/* 紧凑化和完整模式这两个开关变化时重建控件。
|
|
2188
|
+
属性由 applyPrefs 在重渲染时写入,因此延后两帧再建,
|
|
2189
|
+
否则 ensure 读到的还是旧属性值。 */
|
|
2190
|
+
const onPrefs = (event) => {
|
|
2191
|
+
if (!event.detail) return;
|
|
2192
|
+
const key = event.detail.key;
|
|
2193
|
+
if (key !== 'compactHeader' && key !== 'compactHeaderFull') return;
|
|
2194
|
+
window.setTimeout(() => window.requestAnimationFrame(() => ensure()), 0);
|
|
2195
|
+
};
|
|
2196
|
+
window.addEventListener('dcc-prefs-changed', onPrefs);
|
|
2197
|
+
|
|
1788
2198
|
return () => {
|
|
2199
|
+
window.removeEventListener('dcc-prefs-changed', onPrefs);
|
|
1789
2200
|
observer.disconnect();
|
|
1790
2201
|
if (timer !== null) clearTimeout(timer);
|
|
2202
|
+
closeSegMenu();
|
|
1791
2203
|
if (bar !== null) bar.remove();
|
|
1792
2204
|
for (const ghost of ghosts) ghost.remove();
|
|
1793
2205
|
ghosts.clear();
|
|
1794
2206
|
};
|
|
1795
2207
|
}
|
|
1796
2208
|
|
|
2209
|
+
/**
|
|
2210
|
+
* 切换会话时正文会短暂显示一行「载入历史」提示(宿主的 _hint)。
|
|
2211
|
+
* 它默认贴在左上角,这里把它挪到正文中心,并在文字上方加一个鲸鱼图标,
|
|
2212
|
+
* 和启动遮罩的观感统一。文字内容不写死——只包一层容器,原文照读。
|
|
2213
|
+
*/
|
|
2214
|
+
function installHistoryHint() {
|
|
2215
|
+
let observer = null;
|
|
2216
|
+
let rafId = 0;
|
|
2217
|
+
|
|
2218
|
+
const decorate = () => {
|
|
2219
|
+
const hint = document.querySelector('[class*="_hint"]');
|
|
2220
|
+
if (hint === null) return;
|
|
2221
|
+
/* 加载页的 hint 归 installBootHint 管,这里跳过,避免两个模块
|
|
2222
|
+
对同一个元素各改一半。 */
|
|
2223
|
+
if (hint.closest('[data-dsh-boot]') !== null) return;
|
|
2224
|
+
if (hint.querySelector('[data-dcc-hint-fish]') !== null) return;
|
|
2225
|
+
|
|
2226
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
2227
|
+
svg.setAttribute('viewBox', '0 0 23.16 17.04');
|
|
2228
|
+
svg.setAttribute('data-dcc-hint-fish', '');
|
|
2229
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
2230
|
+
const shape = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2231
|
+
shape.setAttribute('d', FISH_LOGO_PATH);
|
|
2232
|
+
const darkNow = document.body.hasAttribute('data-ds-dark-theme')
|
|
2233
|
+
|| document.documentElement.hasAttribute('data-ds-dark-theme');
|
|
2234
|
+
shape.setAttribute('fill', darkNow ? '#ffffff' : '#000000');
|
|
2235
|
+
svg.appendChild(shape);
|
|
2236
|
+
hint.insertBefore(svg, hint.firstChild);
|
|
2237
|
+
|
|
2238
|
+
/* 宿主加载页的适配在 installBootHint 里独立处理,这里只负责会话界面的情况 */
|
|
2239
|
+
center(hint);
|
|
2240
|
+
};
|
|
2241
|
+
/* 按正文区域(而不是视口)的中心定位:侧栏展开时两者差一截。 */
|
|
2242
|
+
const center = (hint) => {
|
|
2243
|
+
/* 加载页里的 hint 由 installBootHint 单独居中,这里跳过。 */
|
|
2244
|
+
if (hint.closest('[data-dsh-boot]') !== null) return;
|
|
2245
|
+
const host = document.querySelector('[data-conversation-scroll]');
|
|
2246
|
+
if (host === null) return;
|
|
2247
|
+
const rect = host.getBoundingClientRect();
|
|
2248
|
+
if (rect.width === 0 || rect.height === 0) return;
|
|
2249
|
+
hint.style.left = rect.left + rect.width / 2 + 'px';
|
|
2250
|
+
/* 正文区的几何中心偏下——底部有输入框占位,视觉中心要高一些 */
|
|
2251
|
+
hint.style.top = rect.top + rect.height / 2 - 64 + 'px';
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
/* 切换会话时正文是整体换掉的,但容器本身常驻,
|
|
2255
|
+
animation 只播一次,之后再切就看不到了。这里在提示消失后
|
|
2256
|
+
手动重播一次:先摘掉动画类、强制重排、再挂回去。 */
|
|
2257
|
+
let lastHadHint = false;
|
|
2258
|
+
const replayFade = () => {
|
|
2259
|
+
|
|
2260
|
+
const targets = [
|
|
2261
|
+
document.querySelector('[class*="_column"]'),
|
|
2262
|
+
document.querySelector('[class*="_marks"]'),
|
|
2263
|
+
].filter((el) => el !== null && el.getBoundingClientRect().height > 0);
|
|
2264
|
+
if (targets.length === 0) return;
|
|
2265
|
+
for (const el of targets) el.removeAttribute('data-dcc-fade-in');
|
|
2266
|
+
/* 读一次布局,让移除生效,再挂回去才会重播 */
|
|
2267
|
+
void document.body.offsetHeight;
|
|
2268
|
+
for (const el of targets) el.setAttribute('data-dcc-fade-in', '');
|
|
2269
|
+
};
|
|
2270
|
+
|
|
2271
|
+
const watchHint = () => {
|
|
2272
|
+
/* 只看会话界面里的提示——加载页也有同一个 _hint,它消失不表示
|
|
2273
|
+
正文就位,跟着触发会白跑一次(虽然 targets 为空会直接返回)。 */
|
|
2274
|
+
const hint = document.querySelector('[class*="_hint"]');
|
|
2275
|
+
const hasHint = hint !== null && hint.closest('[data-dsh-boot]') === null;
|
|
2276
|
+
/* 由「有提示」变成「没提示」,说明这一轮内容已经就位 */
|
|
2277
|
+
if (lastHadHint && !hasHint) replayFade();
|
|
2278
|
+
lastHadHint = hasHint;
|
|
2279
|
+
};
|
|
2280
|
+
|
|
2281
|
+
const schedule = () => {
|
|
2282
|
+
if (rafId !== 0) return;
|
|
2283
|
+
rafId = window.requestAnimationFrame(() => {
|
|
2284
|
+
rafId = 0;
|
|
2285
|
+
if (document.documentElement.dataset.dccEnabled !== 'on') return;
|
|
2286
|
+
decorate();
|
|
2287
|
+
watchHint();
|
|
2288
|
+
});
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2291
|
+
observer = new MutationObserver(schedule);
|
|
2292
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
2293
|
+
|
|
2294
|
+
return () => {
|
|
2295
|
+
observer.disconnect();
|
|
2296
|
+
if (rafId !== 0) window.cancelAnimationFrame(rafId);
|
|
2297
|
+
for (const el of document.querySelectorAll('[data-dcc-hint-fish]')) el.remove();
|
|
2298
|
+
for (const el of document.querySelectorAll('[data-dcc-fade-in]')) el.removeAttribute('data-dcc-fade-in');
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* 宿主加载页(开机时的 "Loading plugins…" 那一屏)的外观适配。
|
|
2304
|
+
*
|
|
2305
|
+
* ⚠️ 这是一块**高耦合**的补丁,和下面这些宿主实现细节绑死:
|
|
2306
|
+
*
|
|
2307
|
+
* | 依赖 | 用途 |
|
|
2308
|
+
* | ------------------------ | -------------------------------- |
|
|
2309
|
+
* | [data-dsh-boot] | 加载页根节点,用来界定作用范围 |
|
|
2310
|
+
* | [class*="_hint"] | 提示文字,和会话界面的载入提示共用 |
|
|
2311
|
+
* | [data-dsh-boot-spinner] | 旋转圈 |
|
|
2312
|
+
* | [class*="_spinner"] | 旋转圈(备用选择器) |
|
|
2313
|
+
* | 文本含 "HARNESS" | 要隐藏的品牌字样 |
|
|
2314
|
+
*
|
|
2315
|
+
* 做两件事:
|
|
2316
|
+
* 1. 把提示文字挪到视口正中(宿主原本让它和 HARNESS 并排)
|
|
2317
|
+
* 2. 隐藏 HARNESS 字样和旋转圈,只留鲸鱼 + 提示文字
|
|
2318
|
+
*
|
|
2319
|
+
* 第 1 点必须和 HARNESS 的隐藏**同一帧**完成——如果只把文字改成
|
|
2320
|
+
* fixed 居中、HARNESS 晚一帧才藏,中间会露出两者叠在屏幕中间一瞬间。
|
|
2321
|
+
*
|
|
2322
|
+
* 失效表现:宿主改版后,加载页恢复原样,不报错,也不影响其它功能。
|
|
2323
|
+
*
|
|
2324
|
+
* 要整体移除时:删掉本函数 + 调用处 removeBootHint + 下面对应的
|
|
2325
|
+
* CSS(搜 BOOT-HINT),不会牵连别的模块。
|
|
2326
|
+
*/
|
|
2327
|
+
function installBootHint() {
|
|
2328
|
+
let observer = null;
|
|
2329
|
+
let rafId = 0;
|
|
2330
|
+
|
|
2331
|
+
const apply = () => {
|
|
2332
|
+
const boot = document.querySelector('[data-dsh-boot]');
|
|
2333
|
+
if (boot === null) return;
|
|
2334
|
+
|
|
2335
|
+
const hint = boot.querySelector('[class*="_hint"]');
|
|
2336
|
+
if (hint !== null && hint.getAttribute('data-dcc-boot-hint') === null) {
|
|
2337
|
+
hint.setAttribute('data-dcc-boot-hint', '');
|
|
2338
|
+
|
|
2339
|
+
/* 鲸鱼图标放在提示文字上方,和会话界面的载入提示同一套做法 */
|
|
2340
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
2341
|
+
svg.setAttribute('viewBox', '0 0 23.16 17.04');
|
|
2342
|
+
svg.setAttribute('data-dcc-hint-fish', '');
|
|
2343
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
2344
|
+
const shape = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2345
|
+
shape.setAttribute('d', FISH_LOGO_PATH);
|
|
2346
|
+
const darkNow = document.body.hasAttribute('data-ds-dark-theme')
|
|
2347
|
+
|| document.documentElement.hasAttribute('data-ds-dark-theme');
|
|
2348
|
+
shape.setAttribute('fill', darkNow ? '#ffffff' : '#000000');
|
|
2349
|
+
svg.appendChild(shape);
|
|
2350
|
+
hint.insertBefore(svg, hint.firstChild);
|
|
2351
|
+
|
|
2352
|
+
hint.style.position = 'fixed';
|
|
2353
|
+
hint.style.top = '50%';
|
|
2354
|
+
hint.style.left = '50%';
|
|
2355
|
+
hint.style.transform = 'translate(-50%, -50%)';
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
/* HARNESS 按文字内容匹配,不认类名——它没有稳定的类名可用。
|
|
2359
|
+
用正则而非全等:实际的 textContent 常带空格或标点。 */
|
|
2360
|
+
for (const el of boot.querySelectorAll('*')) {
|
|
2361
|
+
if (el.getAttribute('data-dcc-boot-brand') !== null) continue;
|
|
2362
|
+
if (!/HARNESS/i.test(el.textContent || '')) continue;
|
|
2363
|
+
/* 只藏最内层那个,避免把整块容器一起藏掉 */
|
|
2364
|
+
const inner = [...el.querySelectorAll('*')].filter(
|
|
2365
|
+
(c) => /HARNESS/i.test(c.textContent || ''),
|
|
2366
|
+
);
|
|
2367
|
+
if (inner.length > 0) continue;
|
|
2368
|
+
el.setAttribute('data-dcc-boot-brand', '');
|
|
2369
|
+
el.style.display = 'none';
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
/* 处理完了,放行显示 */
|
|
2373
|
+
boot.setAttribute('data-dcc-boot-ready', '');
|
|
2374
|
+
};
|
|
2375
|
+
|
|
2376
|
+
const schedule = () => {
|
|
2377
|
+
if (rafId !== 0) return;
|
|
2378
|
+
rafId = window.requestAnimationFrame(() => {
|
|
2379
|
+
rafId = 0;
|
|
2380
|
+
if (document.documentElement.dataset.dccEnabled !== 'on') return;
|
|
2381
|
+
apply();
|
|
2382
|
+
});
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
observer = new MutationObserver(schedule);
|
|
2386
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
2387
|
+
|
|
2388
|
+
return () => {
|
|
2389
|
+
observer.disconnect();
|
|
2390
|
+
if (rafId !== 0) window.cancelAnimationFrame(rafId);
|
|
2391
|
+
/* 还原被本模块改过的东西,避免卸载后留下半截样式 */
|
|
2392
|
+
for (const el of document.querySelectorAll('[data-dcc-boot-hint]')) {
|
|
2393
|
+
el.removeAttribute('data-dcc-boot-hint');
|
|
2394
|
+
el.style.position = '';
|
|
2395
|
+
el.style.top = '';
|
|
2396
|
+
el.style.left = '';
|
|
2397
|
+
el.style.transform = '';
|
|
2398
|
+
}
|
|
2399
|
+
for (const el of document.querySelectorAll('[data-dcc-boot-brand]')) {
|
|
2400
|
+
el.removeAttribute('data-dcc-boot-brand');
|
|
2401
|
+
el.style.display = '';
|
|
2402
|
+
}
|
|
2403
|
+
for (const el of document.querySelectorAll('[data-dcc-boot-ready]')) {
|
|
2404
|
+
el.removeAttribute('data-dcc-boot-ready');
|
|
2405
|
+
}
|
|
2406
|
+
for (const el of document.querySelectorAll('[data-dcc-hint-fish]')) el.remove();
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* 在会话标题栏右上角的「⋯」菜单末尾追加一项「重载前端界面」。
|
|
2412
|
+
* 那个菜单是宿主 React 渲染的,插不进去子节点,只能在它打开后
|
|
2413
|
+
* 往 DOM 里补一个外观一致的按钮,点击等价于 location.reload()。
|
|
2414
|
+
*/
|
|
2415
|
+
function installReloadMenuItem() {
|
|
2416
|
+
const MENU = '[role="menu"]';
|
|
2417
|
+
let observer = null;
|
|
2418
|
+
let timer = null;
|
|
2419
|
+
|
|
2420
|
+
const findMenu = () => {
|
|
2421
|
+
const host = document.querySelector('[class*="_headerUtilities"]');
|
|
2422
|
+
if (host === null) return null;
|
|
2423
|
+
const hostRect = host.getBoundingClientRect();
|
|
2424
|
+
const menus = document.querySelectorAll(MENU);
|
|
2425
|
+
for (let i = 0; i < menus.length; i += 1) {
|
|
2426
|
+
const menu = menus[i];
|
|
2427
|
+
if (menu.querySelector('[data-dcc-reload-item]') !== null) continue;
|
|
2428
|
+
/* 只认贴在标题栏下方展开的那个菜单:它的顶边要落在工具区的下方附近。
|
|
2429
|
+
头像菜单、子菜单的顶边都在其它位置,会被排除掉。 */
|
|
2430
|
+
const rect = menu.getBoundingClientRect();
|
|
2431
|
+
if (rect.width === 0 || rect.height === 0) continue;
|
|
2432
|
+
if (rect.top < hostRect.top - 4) continue;
|
|
2433
|
+
if (rect.top > hostRect.bottom + 24) continue;
|
|
2434
|
+
if (rect.right < hostRect.left - 8) continue;
|
|
2435
|
+
return menu;
|
|
2436
|
+
}
|
|
2437
|
+
return null;
|
|
2438
|
+
};
|
|
2439
|
+
|
|
2440
|
+
const addItem = () => {
|
|
2441
|
+
const menu = findMenu();
|
|
2442
|
+
if (menu === null) return;
|
|
2443
|
+
if (menu.querySelector('[data-dcc-reload-item]') !== null) return;
|
|
2444
|
+
|
|
2445
|
+
const item = document.createElement('button');
|
|
2446
|
+
item.type = 'button';
|
|
2447
|
+
item.setAttribute('data-dcc-reload-item', '');
|
|
2448
|
+
item.className = 'dcc-menu-extra';
|
|
2449
|
+
|
|
2450
|
+
/* 刷新图标:一个带箭头的圆,和工具栏那个刷新按钮同一套语义 */
|
|
2451
|
+
const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
2452
|
+
icon.setAttribute('viewBox', '0 0 16 16');
|
|
2453
|
+
icon.setAttribute('class', 'dcc-menu-extra-icon');
|
|
2454
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
2455
|
+
const arc = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2456
|
+
arc.setAttribute('d', 'M13 8a5 5 0 1 1-1.46-3.54');
|
|
2457
|
+
arc.setAttribute('fill', 'none');
|
|
2458
|
+
arc.setAttribute('stroke', 'currentColor');
|
|
2459
|
+
arc.setAttribute('stroke-width', '1.4');
|
|
2460
|
+
arc.setAttribute('stroke-linecap', 'round');
|
|
2461
|
+
const tip = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2462
|
+
tip.setAttribute('d', 'M13 2.6V5.2h-2.6');
|
|
2463
|
+
tip.setAttribute('fill', 'none');
|
|
2464
|
+
tip.setAttribute('stroke', 'currentColor');
|
|
2465
|
+
tip.setAttribute('stroke-width', '1.4');
|
|
2466
|
+
tip.setAttribute('stroke-linecap', 'round');
|
|
2467
|
+
tip.setAttribute('stroke-linejoin', 'round');
|
|
2468
|
+
icon.append(arc, tip);
|
|
2469
|
+
|
|
2470
|
+
const label = document.createElement('span');
|
|
2471
|
+
label.textContent = isZh() ? '重载前端界面' : 'Reload frontend';
|
|
2472
|
+
item.append(icon, label);
|
|
2473
|
+
item.addEventListener('click', (event) => {
|
|
2474
|
+
event.stopPropagation();
|
|
2475
|
+
window.setTimeout(() => window.location.reload(), 0);
|
|
2476
|
+
});
|
|
2477
|
+
/* 宿主的菜单项都在内层滚动容器里,加在外层会错位。 */
|
|
2478
|
+
const viewport = menu.querySelector('[class*="_viewport"]') || menu;
|
|
2479
|
+
viewport.appendChild(item);
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2482
|
+
/* 用 rAF 而不是延时:菜单一出现,下一帧就把项补上,
|
|
2483
|
+
不会出现「菜单先显示、项晚半拍才冒出来」的情况。 */
|
|
2484
|
+
let rafId = 0;
|
|
2485
|
+
const schedule = () => {
|
|
2486
|
+
if (rafId !== 0) return;
|
|
2487
|
+
rafId = window.requestAnimationFrame(() => {
|
|
2488
|
+
rafId = 0;
|
|
2489
|
+
if (document.documentElement.dataset.dccEnabled !== 'on') return;
|
|
2490
|
+
addItem();
|
|
2491
|
+
});
|
|
2492
|
+
};
|
|
2493
|
+
|
|
2494
|
+
observer = new MutationObserver(schedule);
|
|
2495
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
2496
|
+
|
|
2497
|
+
return () => {
|
|
2498
|
+
observer.disconnect();
|
|
2499
|
+
if (rafId !== 0) window.cancelAnimationFrame(rafId);
|
|
2500
|
+
for (const el of document.querySelectorAll('[data-dcc-reload-item]')) el.remove();
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
|
|
1797
2504
|
/**
|
|
1798
2505
|
* 在输入框下方的状态行里显示账户余额,走宿主的账户接口
|
|
1799
2506
|
* (ctx.remote.account.getBalance)。取不到就静默不显示,不影响其他功能。
|
|
@@ -1871,14 +2578,17 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1871
2578
|
}
|
|
1872
2579
|
};
|
|
1873
2580
|
|
|
2581
|
+
|
|
1874
2582
|
window.addEventListener('dcc-balance-threshold', onThreshold);
|
|
1875
2583
|
/* 开关切换后立刻按已拿到的数据重算,不必等下一次轮询 */
|
|
1876
2584
|
const onPrefs = (event) => {
|
|
1877
|
-
if (event.detail
|
|
2585
|
+
if (!event.detail) return;
|
|
2586
|
+
/* 小数位数变化也要立刻重算,否则要关掉设置面板才看到效果 */
|
|
2587
|
+
if (event.detail.key === 'showBalance' || event.detail.key === 'balanceDecimals') recalc();
|
|
1878
2588
|
};
|
|
1879
2589
|
window.addEventListener('dcc-prefs-changed', onPrefs);
|
|
1880
2590
|
load();
|
|
1881
|
-
refresh = window.setInterval(load,
|
|
2591
|
+
refresh = window.setInterval(load, 40000);
|
|
1882
2592
|
|
|
1883
2593
|
return () => {
|
|
1884
2594
|
window.removeEventListener('dcc-balance-threshold', onThreshold);
|
|
@@ -1997,6 +2707,11 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1997
2707
|
/* 导航折叠开关本身切换后也要立刻重算,否则箭头和布局要等 400ms 防抖 */
|
|
1998
2708
|
const onNavPref = (event) => {
|
|
1999
2709
|
if (event.detail && event.detail.key === 'navCollapse') {
|
|
2710
|
+
/* 重新打开导航折叠时,默认回到收起状态——
|
|
2711
|
+
否则会沿用上一次的展开状态,看起来像开关没生效。 */
|
|
2712
|
+
if (document.documentElement.dataset.dccCollapse === 'on') {
|
|
2713
|
+
document.documentElement.dataset.dccNav = 'collapsed';
|
|
2714
|
+
}
|
|
2000
2715
|
window.setTimeout(() => ensure(), 0);
|
|
2001
2716
|
}
|
|
2002
2717
|
};
|
|
@@ -2036,6 +2751,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2036
2751
|
if (menu.hasAttribute('data-dcc-menu-seq')) continue;
|
|
2037
2752
|
seq += 1;
|
|
2038
2753
|
menu.setAttribute('data-dcc-menu-seq', String(seq));
|
|
2754
|
+
if (document.documentElement.dataset.dccEnabled !== 'on') continue;
|
|
2039
2755
|
if (document.documentElement.dataset.dccTransition !== 'on') continue;
|
|
2040
2756
|
const rect = menu.getBoundingClientRect();
|
|
2041
2757
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
@@ -2102,6 +2818,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2102
2818
|
};
|
|
2103
2819
|
|
|
2104
2820
|
const playExit = (dialog) => {
|
|
2821
|
+
if (document.documentElement.dataset.dccEnabled !== 'on') return;
|
|
2105
2822
|
if (document.documentElement.dataset.dccTransition !== 'on') return;
|
|
2106
2823
|
/* 快照自己也是 role="dialog",不排除的话它的移除会再触发一轮快照,无限循环 */
|
|
2107
2824
|
/* 标记打在克隆的遮罩层上,卡片只是它的子孙,所以用 closest 向上找 */
|
|
@@ -2123,14 +2840,16 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2123
2840
|
? 'dcc-plain-out'
|
|
2124
2841
|
: 'dcc-menu-out';
|
|
2125
2842
|
/* 整层统一淡出:这样压暗层和卡片一定同步,不依赖 mask 的类名是否命中 */
|
|
2126
|
-
|
|
2843
|
+
/* 必须带 important:CSS 里的入场动画是 !important 的,
|
|
2844
|
+
内联样式不加同级就盖不过去,退场会反着放成入场。 */
|
|
2845
|
+
clone.style.setProperty('animation', 'dcc-fade-out .2s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) forwards', 'important');
|
|
2127
2846
|
/* 卡片在这之上再加缩放 */
|
|
2128
2847
|
const inner = clone.querySelector('[role="dialog"]');
|
|
2129
2848
|
if (inner !== null) {
|
|
2130
|
-
inner.style.animation
|
|
2849
|
+
inner.style.setProperty('animation', `${exitAnim} .2s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) forwards`, 'important');
|
|
2131
2850
|
}
|
|
2132
2851
|
document.body.appendChild(clone);
|
|
2133
|
-
window.setTimeout(() => clone.remove(),
|
|
2852
|
+
window.setTimeout(() => clone.remove(), 300);
|
|
2134
2853
|
};
|
|
2135
2854
|
|
|
2136
2855
|
observer = new MutationObserver((records) => {
|
|
@@ -2213,7 +2932,11 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2213
2932
|
svg.setAttribute('aria-hidden', 'true');
|
|
2214
2933
|
const shape = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2215
2934
|
shape.setAttribute('d', FISH_LOGO_PATH);
|
|
2216
|
-
|
|
2935
|
+
/* 直接按主题写死填充色,不依赖 CSS 选择器:
|
|
2936
|
+
之前靠 body:not([...]) 反色,浅色下没生效就会变成白鱼压在白底上。 */
|
|
2937
|
+
const darkNow = document.body.hasAttribute('data-ds-dark-theme')
|
|
2938
|
+
|| document.documentElement.hasAttribute('data-ds-dark-theme');
|
|
2939
|
+
shape.setAttribute('fill', darkNow ? '#ffffff' : '#000000');
|
|
2217
2940
|
svg.appendChild(shape);
|
|
2218
2941
|
cover.appendChild(svg);
|
|
2219
2942
|
document.documentElement.appendChild(cover);
|
|
@@ -2277,11 +3000,15 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2277
3000
|
}
|
|
2278
3001
|
|
|
2279
3002
|
function Row(props) {
|
|
2280
|
-
return h('div', { className: 'dcc-row' },
|
|
3003
|
+
return h('div', { className: props.disabled ? 'dcc-row dcc-row-disabled' : 'dcc-row' },
|
|
2281
3004
|
h('div', { className: 'dcc-row-text' },
|
|
2282
3005
|
h('div', { className: 'dcc-row-title' }, props.title),
|
|
2283
3006
|
props.desc ? h('div', { className: 'dcc-row-desc' }, props.desc) : null),
|
|
2284
|
-
h(Switch, {
|
|
3007
|
+
h(Switch, {
|
|
3008
|
+
checked: props.checked,
|
|
3009
|
+
onChange: props.disabled ? () => {} : props.onChange,
|
|
3010
|
+
title: props.title,
|
|
3011
|
+
}));
|
|
2285
3012
|
}
|
|
2286
3013
|
|
|
2287
3014
|
/* 纯告知行:右侧没有任何控件,内容按纯文本渲染(换行由 pre-line 处理) */
|
|
@@ -2354,7 +3081,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2354
3081
|
h('div', { className: 'dcc-group dcc-primary' },
|
|
2355
3082
|
h(Row, {
|
|
2356
3083
|
title: zh ? '总开关' : 'Master switch',
|
|
2357
|
-
desc: zh ? '
|
|
3084
|
+
desc: zh ? '关闭后将禁用全部修改,包括始终启用的基础改进。\n打开和关闭会重载前端界面,不影响正在运行的任务。' : 'Turning it off disables every change, including the always-on base fixes.\nToggling it reloads the UI; running tasks are not affected.',
|
|
2358
3085
|
checked: prefs.enabled,
|
|
2359
3086
|
onChange: update('enabled'),
|
|
2360
3087
|
}),
|
|
@@ -2372,12 +3099,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2372
3099
|
checked: prefs.radiusDensity,
|
|
2373
3100
|
onChange: update('radiusDensity'),
|
|
2374
3101
|
}),
|
|
2375
|
-
h(Row, {
|
|
2376
|
-
title: zh ? 'Windows 默认微软雅黑字体' : 'Microsoft YaHei on Windows',
|
|
2377
|
-
desc: zh ? '将 Windows 端默认字体改为微软雅黑。微软雅黑带有 hinting,使文字在显示设置低于 200% 缩放比例下,更加锐利清晰。\n若手动设置了字体,或使用 macOS 端,则不受影响。' : 'Use Microsoft YaHei as the default Windows font. It carries hinting, which keeps text sharp below 200% display scaling.\nHas no effect if you set a font manually, or on macOS.',
|
|
2378
|
-
checked: prefs.winFont,
|
|
2379
|
-
onChange: update('winFont'),
|
|
2380
|
-
}),
|
|
2381
3102
|
h(Row, {
|
|
2382
3103
|
title: zh ? '降低深色模式文字亮度' : 'Soften dark-mode text',
|
|
2383
3104
|
desc: zh ? '略微降低深色模式文字亮度,避免纯白文字过于刺眼。' : 'Slightly dims text in dark mode so pure white is less harsh.',
|
|
@@ -2401,7 +3122,14 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2401
3122
|
desc: zh ? '使用非窗口化的设置页面。' : 'Use a non-windowed settings page.',
|
|
2402
3123
|
checked: prefs.settingsFullscreen,
|
|
2403
3124
|
onChange: update('settingsFullscreen'),
|
|
2404
|
-
})
|
|
3125
|
+
}),
|
|
3126
|
+
h(Row, {
|
|
3127
|
+
title: zh ? 'Windows 默认使用微软雅黑字体' : 'Use Microsoft YaHei by default on Windows',
|
|
3128
|
+
desc: zh ? '将 Windows 端默认字体改为微软雅黑。微软雅黑带有 hinting,使文字在显示设置低于 200% 缩放比例下,更加锐利清晰。\n若手动设置了字体,或使用 macOS 端,则不受影响。' : 'Use Microsoft YaHei as the default Windows font. It carries hinting, which keeps text sharp below 200% display scaling.\nHas no effect if you set a font manually, or on macOS.',
|
|
3129
|
+
checked: prefs.winFont,
|
|
3130
|
+
onChange: update('winFont'),
|
|
3131
|
+
}),
|
|
3132
|
+
),
|
|
2405
3133
|
h('div', { className: 'dcc-group' },
|
|
2406
3134
|
h('div', { className: 'dcc-group-title' }, zh ? '导航和工作区' : 'Navigation and workspace'),
|
|
2407
3135
|
h(Row, {
|
|
@@ -2428,12 +3156,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2428
3156
|
checked: prefs.dimSessions,
|
|
2429
3157
|
onChange: update('dimSessions'),
|
|
2430
3158
|
}),
|
|
2431
|
-
h(Row, {
|
|
2432
|
-
title: zh ? '会话前圆点' : 'Session leading dot',
|
|
2433
|
-
desc: zh ? '会话前显示一个圆点。' : 'Show a dot before each session.',
|
|
2434
|
-
checked: prefs.sessionDot,
|
|
2435
|
-
onChange: update('sessionDot'),
|
|
2436
|
-
}),
|
|
2437
3159
|
h(Row, {
|
|
2438
3160
|
title: zh ? '移除工作区与会话悬停详情卡片' : 'Remove workspace and session hover cards',
|
|
2439
3161
|
desc: zh ? '悬停在侧栏工作区、会话上时,不再显示详情卡片。使滚动更流畅。' : 'Hovering a workspace or session no longer shows a details card, which keeps scrolling smooth.',
|
|
@@ -2445,14 +3167,34 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2445
3167
|
desc: zh ? '隐藏会话悬停时除了菜单和置顶之外的其他按钮,避免拥挤遮盖过多标题。\n正常情况下这些按钮都已经在右键菜单中包含。若其他插件添加的按钮未在右键菜单包含,可以关闭此功能。' : 'Hide every button on a hovered session row except the "…" menu and pin, so they stop crowding the title.\nThese actions are normally in the right-click menu too; turn this off if a plugin adds a button that is not.',
|
|
2446
3168
|
checked: prefs.hideRowButtons,
|
|
2447
3169
|
onChange: update('hideRowButtons'),
|
|
2448
|
-
})
|
|
3170
|
+
}),
|
|
3171
|
+
h(Row, {
|
|
3172
|
+
title: zh ? '会话前圆点' : 'Session leading dot',
|
|
3173
|
+
desc: zh ? '在侧栏工作区会话前显示一个圆点标记。' : 'Show a dot marker before each session in the sidebar.',
|
|
3174
|
+
checked: prefs.sessionDot,
|
|
3175
|
+
onChange: update('sessionDot'),
|
|
3176
|
+
}),
|
|
3177
|
+
),
|
|
2449
3178
|
h('div', { className: 'dcc-group' },
|
|
2450
3179
|
h('div', { className: 'dcc-group-title' }, zh ? '会话标题栏' : 'Session header'),
|
|
3180
|
+
h(Row, {
|
|
3181
|
+
title: zh ? '柔化标题栏与会话区域过渡' : 'Soften the header-to-conversation transition',
|
|
3182
|
+
desc: zh ? '移除分割线,使用柔化边缘过渡标题栏和会话正文。' : 'Remove the divider and use a soft edge to ease the transition between the header and the conversation.',
|
|
3183
|
+
checked: prefs.headerFade,
|
|
3184
|
+
onChange: update('headerFade'),
|
|
3185
|
+
}),
|
|
2451
3186
|
h(Row, {
|
|
2452
3187
|
title: zh ? '会话标题栏紧凑化' : 'Compact session header',
|
|
2453
|
-
desc: zh ? '
|
|
3188
|
+
desc: zh ? '将视图切换按钮移到右上工具按钮处。使会话内容可视范围更大。\n此按钮在对话模式下默认隐藏,鼠标位于标题栏区域时才会显示。' : 'Move the view switcher button to the toolbar buttons in the top-right, giving the conversation more room.\nIn the conversation view it is hidden by default and only appears when the pointer is over the header.',
|
|
2454
3189
|
checked: prefs.compactHeader,
|
|
2455
3190
|
onChange: update('compactHeader'),
|
|
3191
|
+
}),
|
|
3192
|
+
h(Row, {
|
|
3193
|
+
title: zh ? '紧凑标题栏始终显示视图切换控件' : 'Always show view switcher',
|
|
3194
|
+
desc: zh ? '在对话视图下不自动隐藏视图切换控件。' : 'Keep the view switcher visible in the conversation view instead of hiding it until hover.',
|
|
3195
|
+
checked: prefs.compactAlwaysShow,
|
|
3196
|
+
disabled: !prefs.compactHeader,
|
|
3197
|
+
onChange: update('compactAlwaysShow'),
|
|
2456
3198
|
})),
|
|
2457
3199
|
h('div', { className: 'dcc-group' },
|
|
2458
3200
|
h('div', { className: 'dcc-group-title' }, zh ? '性能与用量信息' : 'Performance and usage'),
|
|
@@ -2519,28 +3261,28 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2519
3261
|
'- 左侧导航栏部分布局细节优化。',
|
|
2520
3262
|
'- 工作区文件夹悬停时保留图标。',
|
|
2521
3263
|
'- 已归档会话显示删除线。',
|
|
2522
|
-
'- 会话标题栏与正文间去除分割线,柔化过渡。',
|
|
2523
3264
|
'- 选择题弹窗细节优化。',
|
|
2524
|
-
'-
|
|
3265
|
+
'- 优化加载界面,正文切换时渐显。',
|
|
2525
3266
|
'- 修复二级右键菜单消失延迟。',
|
|
3267
|
+
'- 顶栏更多菜单添加"重载前端界面"按钮,卡顿时可重载界面,不会中断任务。',
|
|
2526
3268
|
].join('\n')
|
|
2527
3269
|
: [
|
|
2528
3270
|
'These small fixes and improvements are always on unless the master switch is off.',
|
|
2529
3271
|
'- Layout details refined in the left navigation.',
|
|
2530
3272
|
'- Workspace folder icons stay visible on hover.',
|
|
2531
3273
|
'- Archived sessions show a strikethrough.',
|
|
2532
|
-
'- No divider between the session header and the body; softened transition.',
|
|
2533
3274
|
'- Multiple-choice dialog details refined.',
|
|
2534
|
-
'-
|
|
3275
|
+
'- Refined the loading screen and added a fade-in when the conversation content changes.',
|
|
2535
3276
|
'- Fixed the delay when closing a second-level context menu.',
|
|
3277
|
+
'- Added a "Reload frontend" button to the top-bar overflow menu; reloads the UI when it lags, without interrupting tasks.',
|
|
2536
3278
|
].join('\n'),
|
|
2537
3279
|
})),
|
|
2538
3280
|
h('div', { className: 'dcc-meta-row' },
|
|
2539
3281
|
h('p', { className: 'dcc-meta' },
|
|
2540
3282
|
/* 中文之间用一个全角空格(\u3000)分隔,比两个半角空格更稳 */
|
|
2541
3283
|
zh
|
|
2542
|
-
? `版本:${VERSION}\u3000更新日期:${UPDATED}\n此版本基于 DSH v0.2.2-
|
|
2543
|
-
: `Version: ${VERSION} Updated: ${UPDATED}\nTested on DSH v0.2.2-
|
|
3284
|
+
? `版本:${VERSION}\u3000更新日期:${UPDATED}\n此版本基于 DSH v0.2.2-rc.3 测试`
|
|
3285
|
+
: `Version: ${VERSION} Updated: ${UPDATED}\nTested on DSH v0.2.2-rc.3`),
|
|
2544
3286
|
h('button', {
|
|
2545
3287
|
type: 'button',
|
|
2546
3288
|
className: 'dcc-reset',
|
|
@@ -2598,6 +3340,9 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2598
3340
|
const removeBootCover = installBootCover(readPrefs());
|
|
2599
3341
|
const removePluginPin = installNavToggle();
|
|
2600
3342
|
const removeMenuOrigin = installMenuOrigin();
|
|
3343
|
+
const removeReloadItem = installReloadMenuItem();
|
|
3344
|
+
const removeHistoryHint = installHistoryHint();
|
|
3345
|
+
const removeBootHint = installBootHint();
|
|
2601
3346
|
const removeDialogExit = installDialogExit();
|
|
2602
3347
|
return () => {
|
|
2603
3348
|
removeCss();
|
|
@@ -2610,6 +3355,9 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2610
3355
|
removeBootCover();
|
|
2611
3356
|
removePluginPin();
|
|
2612
3357
|
removeMenuOrigin();
|
|
3358
|
+
removeReloadItem();
|
|
3359
|
+
removeHistoryHint();
|
|
3360
|
+
removeBootHint();
|
|
2613
3361
|
removeDialogExit();
|
|
2614
3362
|
const root = document.documentElement;
|
|
2615
3363
|
delete root.dataset.dccRadius;
|