dsh-ui-alt 0.2.401 → 0.2.424
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 +3 -1
- package/client.js +128 -69
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ dsh-ui-alt/
|
|
|
129
129
|
|
|
130
130
|
- 预置数据:`STORAGE_KEY`、`DEFAULTS`、`readPrefs()` / `applyPrefs()` / `savePrefs()`。
|
|
131
131
|
- 一大段 `css` 字符串,全部按 `html[data-dcc-*]` 条件生效;设置页自身样式用 `.dcc-*` 前缀。
|
|
132
|
-
-
|
|
132
|
+
- 十三个 DOM 注入函数,各自带总开关守卫;需要跟随宿主重渲染的还带一个监听 `body` 的 `MutationObserver`(350–400ms 防抖):
|
|
133
133
|
- `installNewSessionRow()`:克隆宿主的「新会话」按钮成导航行,点击转发给原按钮。
|
|
134
134
|
- `installNavToggle()`:导航下方插入展开/收起箭头,点击切换 `data-dcc-nav` 并写回偏好。
|
|
135
135
|
- `installSettingsBackButton()`:设置面板左上角插入返回按钮,点击触发原关闭按钮。
|
|
@@ -141,6 +141,8 @@ dsh-ui-alt/
|
|
|
141
141
|
- `installDialogExit()`:接管对话框移除,补一段退场动画。
|
|
142
142
|
- `installBootCover()`:启动时的过渡遮罩。
|
|
143
143
|
- `installReloadMenuItem()`:在标题栏三点菜单末尾追加「重载前端界面」项。
|
|
144
|
+
- `installHistoryHint()`:会话切换时把「载入历史」提示移到正文中心,并在文字上方加鲸鱼图标。
|
|
145
|
+
- `installBootHint()`:宿主加载页适配——提示文字居中、隐藏品牌字样与旋转圈。
|
|
144
146
|
- 设置页组件:`Section`(标题 + 说明 + 开关行)、`Switch`、`Row`、`SectionIcon`。
|
|
145
147
|
|
|
146
148
|
## 开发
|
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.424';
|
|
10
|
+
const UPDATED = '2026-11-17';
|
|
11
11
|
const DEFAULTS = {
|
|
12
12
|
radiusDensity: true,
|
|
13
13
|
invertNewSession: true,
|
|
@@ -335,13 +335,10 @@ html[data-dcc-radius="on"] [class*="_trailing"] > [class*="_primary"] svg {
|
|
|
335
335
|
}
|
|
336
336
|
/* 输入框左下角的「+」:宿主是 999px 圆形,同样收成小圆角方形;
|
|
337
337
|
底色也去掉,只在悬停时给出来(宿主的原始底色就是这一档)。 */
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
html[data-dcc-radius="on"] button[class*="_add"]:hover {
|
|
343
|
-
background: var(--dsw-specific-selector) !important;
|
|
344
|
-
}
|
|
338
|
+
/* 输入框左下角「+」按钮的圆角与底色收尾已移除。
|
|
339
|
+
_add 这个片段太泛滥:宿主的工具栏用的是 _addGroup / _addPrimary / _addMore,
|
|
340
|
+
全都含 _add,逐个排除既啰嗦又容易漏(_addMore 就漏过一次)。
|
|
341
|
+
这个按钮只是个小细节,不值得为它承担误伤工具栏的风险。
|
|
345
342
|
|
|
346
343
|
/* 主内容区左上角的大圆角(Windows 标题栏) */
|
|
347
344
|
html[data-dcc-radius="on"][data-windows-titlebar] [class*="_centerCol"] {
|
|
@@ -384,30 +381,26 @@ html[data-dcc-new="on"] [class*="_scrollRegion"] {
|
|
|
384
381
|
html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"]) button[data-dcc-original] {
|
|
385
382
|
display: flex !important;
|
|
386
383
|
}
|
|
387
|
-
html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"])
|
|
384
|
+
html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"]) [data-dcc-newrow-wrap] {
|
|
388
385
|
display: none !important;
|
|
389
386
|
}
|
|
390
|
-
html[data-dcc-new="off"]
|
|
387
|
+
html[data-dcc-new="off"] [data-dcc-newrow-wrap] {
|
|
391
388
|
display: none !important;
|
|
392
389
|
}
|
|
393
|
-
/*
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
html[data-dcc-new="on"] button[data-dcc-newrow] {
|
|
397
|
-
|
|
390
|
+
/* 原版新会话的图标是 14px,其它导航项是 16px。
|
|
391
|
+
图标小、包裹层就窄,整行的图标和文字都跟着左移或右偏。
|
|
392
|
+
最省事的办法就是把图标放大到 16px,尺寸和别的行完全一致。 */
|
|
393
|
+
html[data-dcc-new="on"] button[data-dcc-newrow] svg {
|
|
394
|
+
width: 16px !important;
|
|
395
|
+
height: 16px !important;
|
|
398
396
|
}
|
|
399
|
-
.dcc-newrow-
|
|
400
|
-
display: flex;
|
|
397
|
+
.dcc-newrow-glyph {
|
|
398
|
+
display: inline-flex;
|
|
401
399
|
align-items: center;
|
|
402
|
-
justify-content:
|
|
403
|
-
gap: calc(var(--dsh-sidebar-label-gap) + 2px);
|
|
404
|
-
flex: 1;
|
|
405
|
-
min-width: 0;
|
|
406
|
-
}
|
|
407
|
-
.dcc-newrow-content svg {
|
|
408
|
-
width: 16px;
|
|
409
|
-
height: 16px;
|
|
400
|
+
justify-content: center;
|
|
410
401
|
flex: none;
|
|
402
|
+
}
|
|
403
|
+
.dcc-newrow-glyph svg {
|
|
411
404
|
color: inherit;
|
|
412
405
|
}
|
|
413
406
|
.dcc-newrow-label {
|
|
@@ -440,14 +433,15 @@ html[data-dcc-collapse="on"][data-dcc-logo="shown"] [class*="_logoRow"] {
|
|
|
440
433
|
}
|
|
441
434
|
|
|
442
435
|
|
|
443
|
-
/*
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
436
|
+
/* sticky 只在「导航折叠」开启时生效。
|
|
437
|
+
那时 _panelList 不参与滚动(滚动收在 _listArea 里),这一行本来也不会跑掉,
|
|
438
|
+
sticky 只是保险。折叠关闭时侧栏整块滚动,而这一行没有自己的背景
|
|
439
|
+
(底色交给宿主的 _panelEntry),sticky 会让下方内容从它下面穿过去——
|
|
440
|
+
那种情况下让它跟着滚,和宿主原版行为一致。 */
|
|
441
|
+
html[data-dcc-collapse="on"] [data-dcc-newrow-wrap] {
|
|
447
442
|
position: sticky;
|
|
448
443
|
top: 0;
|
|
449
444
|
z-index: 3;
|
|
450
|
-
background: var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-layer-1));
|
|
451
445
|
}
|
|
452
446
|
|
|
453
447
|
/* 侧栏滚动下放:整块滚动容器不再滚动,改成纵向布局;
|
|
@@ -928,7 +922,9 @@ html[data-dcc-enabled="on"][data-dcc-header-fade="on"]:has([data-conversation-ta
|
|
|
928
922
|
/* 宿主自带的「更多」按钮:只在紧凑化开启时隐藏——那时标签行被本插件的
|
|
929
923
|
下拉按钮取代,宿主这个按钮用不上。紧凑化关闭时标签行是原版的,
|
|
930
924
|
这个按钮必须留着,否则视图被裁掉后无法访问。 */
|
|
931
|
-
|
|
925
|
+
/* 限定在会话标题栏内:_viewsMoreAnchor 是宿主标签行专用的类,
|
|
926
|
+
但同一套渲染也可能被别处复用,加上 :has 限定确保只作用于有标签行的标题栏。 */
|
|
927
|
+
html[data-dcc-enabled="on"][data-dcc-compact-header="on"] [class*="_header"]:has([data-conversation-tabs]) [class*="_viewsMoreAnchor"] {
|
|
932
928
|
display: none !important;
|
|
933
929
|
}
|
|
934
930
|
/* 开关关掉时,自绘的分段控件不出现,标签行恢复原样 */
|
|
@@ -973,7 +969,9 @@ html[data-dcc-always-show="on"] .dcc-segmented {
|
|
|
973
969
|
color: var(--dsw-alias-label-secondary);
|
|
974
970
|
font: inherit;
|
|
975
971
|
font-size: 12px;
|
|
976
|
-
|
|
972
|
+
/* 行高不能是 1:中文字体的下方部分会超出行盒,被 label 的
|
|
973
|
+
overflow: hidden 裁掉一截。留一点余量。 */
|
|
974
|
+
line-height: 1.35;
|
|
977
975
|
white-space: nowrap;
|
|
978
976
|
cursor: pointer;
|
|
979
977
|
transition: background-color .12s, color .12s;
|
|
@@ -1035,11 +1033,28 @@ html[data-dcc-enabled="on"] [data-dsh-boot] [data-dsh-boot-spinner],
|
|
|
1035
1033
|
html[data-dcc-enabled="on"] [data-dsh-boot] [class*="_spinner"] {
|
|
1036
1034
|
display: none !important;
|
|
1037
1035
|
}
|
|
1036
|
+
/* 加载页的提示也改成纵向:鲸鱼在上、文字在下,和会话页的观感一致。
|
|
1037
|
+
宿主的原始排布是横向的,去掉 HARNESS 之后如果不改方向,
|
|
1038
|
+
鲸鱼会和文字并排站着。 */
|
|
1039
|
+
html[data-dcc-enabled="on"] [data-dsh-boot] [class*="_hint"] {
|
|
1040
|
+
display: flex !important;
|
|
1041
|
+
flex-direction: column !important;
|
|
1042
|
+
align-items: center !important;
|
|
1043
|
+
gap: 10px !important;
|
|
1044
|
+
margin: 0 !important;
|
|
1045
|
+
white-space: nowrap !important;
|
|
1046
|
+
}
|
|
1038
1047
|
/* ===== BOOT-HINT END ===== */
|
|
1039
1048
|
|
|
1040
1049
|
/* 会话切换时的「载入历史」提示:挪到正文中心,鲸鱼在上、文字在下。
|
|
1041
|
-
文字内容由宿主写入,这里只改排版,不替换文案。
|
|
1042
|
-
|
|
1050
|
+
文字内容由宿主写入,这里只改排版,不替换文案。
|
|
1051
|
+
|
|
1052
|
+
_hint 这个类名在宿主的其它地方也复用(内置插件的详情页就有一处),
|
|
1053
|
+
所以这里用白名单限定,只处理两个容器内的:
|
|
1054
|
+
· [data-conversation-scroll] 会话正文区
|
|
1055
|
+
· [data-dsh-boot] 宿主加载页(那条在 BOOT-HINT 段里单独处理)
|
|
1056
|
+
其它位置的 _hint 一律不碰。 */
|
|
1057
|
+
html[data-dcc-enabled="on"] [data-conversation-scroll] [class*="_hint"] {
|
|
1043
1058
|
position: fixed !important;
|
|
1044
1059
|
/* left/top 由脚本按正文区域的中心算出来写上去 */
|
|
1045
1060
|
transform: translate(-50%, -50%) !important;
|
|
@@ -1053,7 +1068,8 @@ html[data-dcc-enabled="on"] [class*="_hint"] {
|
|
|
1053
1068
|
white-space: nowrap !important;
|
|
1054
1069
|
pointer-events: none !important;
|
|
1055
1070
|
}
|
|
1056
|
-
html[data-dcc-enabled="on"] [data-dcc-hint-fish]
|
|
1071
|
+
html[data-dcc-enabled="on"] [data-conversation-scroll] [data-dcc-hint-fish],
|
|
1072
|
+
html[data-dcc-enabled="on"] [data-dsh-boot] [data-dcc-hint-fish] {
|
|
1057
1073
|
width: 56px;
|
|
1058
1074
|
height: auto;
|
|
1059
1075
|
opacity: .32;
|
|
@@ -1488,6 +1504,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1488
1504
|
const findNav = () => document.querySelector('nav[class*="_panelList"]');
|
|
1489
1505
|
const findOriginal = () => document.querySelector('button[class*="_newSession"]');
|
|
1490
1506
|
let clone = null;
|
|
1507
|
+
/* 宿主的导航项是两层:外层 _panelEntry 负责悬停底色和圆角,
|
|
1508
|
+
内层 _panelRow 是按钮本体。克隆必须保持同样的层级,
|
|
1509
|
+
把两层的类压在同一个元素上市,悬停底色会画错位置。 */
|
|
1510
|
+
let wrapper = null;
|
|
1491
1511
|
let observer = null;
|
|
1492
1512
|
let timer = null;
|
|
1493
1513
|
let rafId = 0;
|
|
@@ -1495,38 +1515,59 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1495
1515
|
const build = (nav, orig) => {
|
|
1496
1516
|
const row = nav.querySelector('button[class*="_panelRow"]');
|
|
1497
1517
|
if (row === null) return false;
|
|
1518
|
+
if (wrapper !== null) wrapper.remove();
|
|
1498
1519
|
if (clone !== null) clone.remove();
|
|
1520
|
+
|
|
1521
|
+
/* 外层:完整照抄宿主导航项外层的类。
|
|
1522
|
+
之前排除了 panelEntryActive(怕常亮)和 panelEntryWide(以为没用),
|
|
1523
|
+
结果是布局对不上——panelEntryWide 决定了行的宽度和右侧留白,
|
|
1524
|
+
少了它整行都错位。active 类只在别处加,克隆时本来就不会有。 */
|
|
1525
|
+
const entry = row.parentElement;
|
|
1526
|
+
wrapper = document.createElement('div');
|
|
1527
|
+
if (entry !== null) {
|
|
1528
|
+
for (const name of entry.classList) wrapper.classList.add(name);
|
|
1529
|
+
}
|
|
1530
|
+
wrapper.setAttribute('data-dcc-newrow-wrap', '');
|
|
1531
|
+
|
|
1532
|
+
/* 内层:完整照抄按钮本体的类 */
|
|
1499
1533
|
clone = document.createElement('button');
|
|
1500
1534
|
clone.type = 'button';
|
|
1501
1535
|
clone.setAttribute('data-dcc-newrow', '');
|
|
1502
|
-
|
|
1503
|
-
克隆行是裸 button,少了这层包裹,悬停就会比别的导航行浅一档,
|
|
1504
|
-
所以把父级的 panelEntry 类一并复制过来。 */
|
|
1505
|
-
const entry = row.parentElement;
|
|
1506
|
-
const entryClasses = entry === null
|
|
1507
|
-
? []
|
|
1508
|
-
: [...entry.classList].filter((name) => name.includes('_panelEntry'));
|
|
1509
|
-
clone.className = [...row.classList].join(' ')
|
|
1510
|
-
+ ' dcc-newrow'
|
|
1511
|
-
+ (entryClasses.length > 0 ? ' ' + entryClasses.join(' ') : '');
|
|
1536
|
+
clone.className = [...row.classList].join(' ') + ' dcc-newrow';
|
|
1512
1537
|
const aria = orig.getAttribute('aria-label');
|
|
1513
1538
|
if (aria !== null) clone.setAttribute('aria-label', aria);
|
|
1514
|
-
|
|
1515
|
-
content.className = 'dcc-newrow-content';
|
|
1539
|
+
/* 图标包裹层:完整照抄 panelGlyph 的类,尺寸和居中都在它身上 */
|
|
1516
1540
|
const icon = orig.querySelector('svg');
|
|
1517
|
-
if (icon !== null)
|
|
1541
|
+
if (icon !== null) {
|
|
1542
|
+
const source = row.querySelector('[class*="_panelGlyph"]');
|
|
1543
|
+
const glyph = document.createElement('span');
|
|
1544
|
+
if (source !== null) {
|
|
1545
|
+
for (const name of source.classList) glyph.classList.add(name);
|
|
1546
|
+
} else {
|
|
1547
|
+
glyph.className = 'dcc-newrow-glyph';
|
|
1548
|
+
}
|
|
1549
|
+
glyph.setAttribute('aria-hidden', 'true');
|
|
1550
|
+
glyph.appendChild(icon.cloneNode(true));
|
|
1551
|
+
clone.appendChild(glyph);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
/* 标题也用宿主的 panelTitle 类——字号、颜色、溢出省略都在它身上 */
|
|
1518
1555
|
const label = document.createElement('span');
|
|
1519
|
-
|
|
1556
|
+
const titleSource = row.querySelector('[class*="_panelTitle"]');
|
|
1557
|
+
if (titleSource !== null) {
|
|
1558
|
+
for (const name of titleSource.classList) label.classList.add(name);
|
|
1559
|
+
}
|
|
1560
|
+
if (label.classList.length === 0) label.className = 'dcc-newrow-label';
|
|
1520
1561
|
const text = orig.querySelector('[class*="_newSessionLabel"]');
|
|
1521
1562
|
label.textContent = text !== null && text.textContent !== '' ? text.textContent : (isZh() ? '新会话' : 'New session');
|
|
1522
|
-
|
|
1523
|
-
clone.appendChild(content);
|
|
1563
|
+
clone.appendChild(label);
|
|
1524
1564
|
clone.addEventListener('click', (event) => {
|
|
1525
1565
|
event.preventDefault();
|
|
1526
1566
|
const current = findOriginal();
|
|
1527
1567
|
if (current !== null) current.click();
|
|
1528
1568
|
});
|
|
1529
|
-
|
|
1569
|
+
wrapper.appendChild(clone);
|
|
1570
|
+
nav.insertBefore(wrapper, nav.firstElementChild);
|
|
1530
1571
|
return true;
|
|
1531
1572
|
};
|
|
1532
1573
|
|
|
@@ -1537,6 +1578,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1537
1578
|
/* 开关关掉时彻底还原:移除克隆行、去掉原按钮上的标记,
|
|
1538
1579
|
让它回到宿主本来的样子,而不是仅靠 CSS 隐藏 */
|
|
1539
1580
|
if (document.documentElement.dataset.dccEnabled !== 'on' || document.documentElement.dataset.dccNew !== 'on') {
|
|
1581
|
+
if (wrapper !== null) {
|
|
1582
|
+
wrapper.remove();
|
|
1583
|
+
wrapper = null;
|
|
1584
|
+
}
|
|
1540
1585
|
if (clone !== null) {
|
|
1541
1586
|
clone.remove();
|
|
1542
1587
|
clone = null;
|
|
@@ -1545,8 +1590,8 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1545
1590
|
return false;
|
|
1546
1591
|
}
|
|
1547
1592
|
if (orig.getAttribute('data-dcc-original') === null) orig.setAttribute('data-dcc-original', '');
|
|
1548
|
-
if (clone === null || !
|
|
1549
|
-
if (!nav.contains(
|
|
1593
|
+
if (wrapper === null || clone === null || !wrapper.isConnected) return build(nav, orig);
|
|
1594
|
+
if (!nav.contains(wrapper)) nav.insertBefore(wrapper, nav.firstElementChild);
|
|
1550
1595
|
/* 宿主文字(语言切换等)变化时,克隆行跟着更新 */
|
|
1551
1596
|
const label = clone.querySelector('.dcc-newrow-label');
|
|
1552
1597
|
const text = orig.querySelector('[class*="_newSessionLabel"]');
|
|
@@ -1589,6 +1634,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1589
1634
|
window.removeEventListener('dcc-newsession-pref', onPref);
|
|
1590
1635
|
if (timer !== null) clearTimeout(timer);
|
|
1591
1636
|
if (rafId !== 0) window.cancelAnimationFrame(rafId);
|
|
1637
|
+
if (wrapper !== null) wrapper.remove();
|
|
1592
1638
|
if (clone !== null) clone.remove();
|
|
1593
1639
|
const orig = findOriginal();
|
|
1594
1640
|
if (orig !== null) orig.removeAttribute('data-dcc-original');
|
|
@@ -1931,6 +1977,8 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
1931
1977
|
let bar = null;
|
|
1932
1978
|
let observer = null;
|
|
1933
1979
|
let timer = null;
|
|
1980
|
+
let prefTimer = null;
|
|
1981
|
+
let rafId = 0;
|
|
1934
1982
|
/* 正在淡出的旧控件被临时挂到 body 上,卸载时要一起收走 */
|
|
1935
1983
|
const ghosts = new Set();
|
|
1936
1984
|
|
|
@@ -2191,7 +2239,14 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2191
2239
|
if (!event.detail) return;
|
|
2192
2240
|
const key = event.detail.key;
|
|
2193
2241
|
if (key !== 'compactHeader' && key !== 'compactHeaderFull') return;
|
|
2194
|
-
|
|
2242
|
+
if (prefTimer !== null) clearTimeout(prefTimer);
|
|
2243
|
+
prefTimer = window.setTimeout(() => {
|
|
2244
|
+
prefTimer = null;
|
|
2245
|
+
rafId = window.requestAnimationFrame(() => {
|
|
2246
|
+
rafId = 0;
|
|
2247
|
+
ensure();
|
|
2248
|
+
});
|
|
2249
|
+
}, 0);
|
|
2195
2250
|
};
|
|
2196
2251
|
window.addEventListener('dcc-prefs-changed', onPrefs);
|
|
2197
2252
|
|
|
@@ -2199,6 +2254,8 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2199
2254
|
window.removeEventListener('dcc-prefs-changed', onPrefs);
|
|
2200
2255
|
observer.disconnect();
|
|
2201
2256
|
if (timer !== null) clearTimeout(timer);
|
|
2257
|
+
if (prefTimer !== null) clearTimeout(prefTimer);
|
|
2258
|
+
if (rafId !== 0) window.cancelAnimationFrame(rafId);
|
|
2202
2259
|
closeSegMenu();
|
|
2203
2260
|
if (bar !== null) bar.remove();
|
|
2204
2261
|
for (const ghost of ghosts) ghost.remove();
|
|
@@ -2216,11 +2273,13 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2216
2273
|
let rafId = 0;
|
|
2217
2274
|
|
|
2218
2275
|
const decorate = () => {
|
|
2219
|
-
|
|
2276
|
+
/* 白名单:只在会话正文区里找 _hint。
|
|
2277
|
+
宿主在别处也用了同一个类名(内置插件详情页就有一处),
|
|
2278
|
+
全局 querySelector 会抓错地方。 */
|
|
2279
|
+
const host = document.querySelector('[data-conversation-scroll]');
|
|
2280
|
+
if (host === null) return;
|
|
2281
|
+
const hint = host.querySelector('[class*="_hint"]');
|
|
2220
2282
|
if (hint === null) return;
|
|
2221
|
-
/* 加载页的 hint 归 installBootHint 管,这里跳过,避免两个模块
|
|
2222
|
-
对同一个元素各改一半。 */
|
|
2223
|
-
if (hint.closest('[data-dsh-boot]') !== null) return;
|
|
2224
2283
|
if (hint.querySelector('[data-dcc-hint-fish]') !== null) return;
|
|
2225
2284
|
|
|
2226
2285
|
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -2240,8 +2299,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2240
2299
|
};
|
|
2241
2300
|
/* 按正文区域(而不是视口)的中心定位:侧栏展开时两者差一截。 */
|
|
2242
2301
|
const center = (hint) => {
|
|
2243
|
-
/* 加载页里的 hint 由 installBootHint 单独居中,这里跳过。 */
|
|
2244
|
-
if (hint.closest('[data-dsh-boot]') !== null) return;
|
|
2245
2302
|
const host = document.querySelector('[data-conversation-scroll]');
|
|
2246
2303
|
if (host === null) return;
|
|
2247
2304
|
const rect = host.getBoundingClientRect();
|
|
@@ -2256,10 +2313,12 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2256
2313
|
手动重播一次:先摘掉动画类、强制重排、再挂回去。 */
|
|
2257
2314
|
let lastHadHint = false;
|
|
2258
2315
|
const replayFade = () => {
|
|
2259
|
-
|
|
2316
|
+
/* 同样限定在正文区内——_column / _marks 这些名字在别处也可能出现 */
|
|
2317
|
+
const area = document.querySelector('[data-conversation-scroll]');
|
|
2318
|
+
if (area === null) return;
|
|
2260
2319
|
const targets = [
|
|
2261
|
-
|
|
2262
|
-
|
|
2320
|
+
area.querySelector('[class*="_column"]'),
|
|
2321
|
+
area.querySelector('[class*="_marks"]'),
|
|
2263
2322
|
].filter((el) => el !== null && el.getBoundingClientRect().height > 0);
|
|
2264
2323
|
if (targets.length === 0) return;
|
|
2265
2324
|
for (const el of targets) el.removeAttribute('data-dcc-fade-in');
|
|
@@ -2269,10 +2328,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
2269
2328
|
};
|
|
2270
2329
|
|
|
2271
2330
|
const watchHint = () => {
|
|
2272
|
-
/*
|
|
2273
|
-
|
|
2274
|
-
const hint =
|
|
2275
|
-
const hasHint = hint !== null
|
|
2331
|
+
/* 和 decorate 一样只看正文区的提示 */
|
|
2332
|
+
const host = document.querySelector('[data-conversation-scroll]');
|
|
2333
|
+
const hint = host === null ? null : host.querySelector('[class*="_hint"]');
|
|
2334
|
+
const hasHint = hint !== null;
|
|
2276
2335
|
/* 由「有提示」变成「没提示」,说明这一轮内容已经就位 */
|
|
2277
2336
|
if (lastHadHint && !hasHint) replayFade();
|
|
2278
2337
|
lastHadHint = hasHint;
|