dsh-ui-alt 0.2.422 → 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.
Files changed (2) hide show
  1. package/client.js +37 -17
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -6,7 +6,7 @@ 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.422';
9
+ const VERSION = '0.2.424';
10
10
  const UPDATED = '2026-11-17';
11
11
  const DEFAULTS = {
12
12
  radiusDensity: true,
@@ -1033,11 +1033,28 @@ html[data-dcc-enabled="on"] [data-dsh-boot] [data-dsh-boot-spinner],
1033
1033
  html[data-dcc-enabled="on"] [data-dsh-boot] [class*="_spinner"] {
1034
1034
  display: none !important;
1035
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
+ }
1036
1047
  /* ===== BOOT-HINT END ===== */
1037
1048
 
1038
1049
  /* 会话切换时的「载入历史」提示:挪到正文中心,鲸鱼在上、文字在下。
1039
- 文字内容由宿主写入,这里只改排版,不替换文案。 */
1040
- html[data-dcc-enabled="on"] [class*="_hint"] {
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"] {
1041
1058
  position: fixed !important;
1042
1059
  /* left/top 由脚本按正文区域的中心算出来写上去 */
1043
1060
  transform: translate(-50%, -50%) !important;
@@ -1051,7 +1068,8 @@ html[data-dcc-enabled="on"] [class*="_hint"] {
1051
1068
  white-space: nowrap !important;
1052
1069
  pointer-events: none !important;
1053
1070
  }
1054
- 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] {
1055
1073
  width: 56px;
1056
1074
  height: auto;
1057
1075
  opacity: .32;
@@ -2255,11 +2273,13 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2255
2273
  let rafId = 0;
2256
2274
 
2257
2275
  const decorate = () => {
2258
- const hint = document.querySelector('[class*="_hint"]');
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"]');
2259
2282
  if (hint === null) return;
2260
- /* 加载页的 hint 归 installBootHint 管,这里跳过,避免两个模块
2261
- 对同一个元素各改一半。 */
2262
- if (hint.closest('[data-dsh-boot]') !== null) return;
2263
2283
  if (hint.querySelector('[data-dcc-hint-fish]') !== null) return;
2264
2284
 
2265
2285
  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -2279,8 +2299,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2279
2299
  };
2280
2300
  /* 按正文区域(而不是视口)的中心定位:侧栏展开时两者差一截。 */
2281
2301
  const center = (hint) => {
2282
- /* 加载页里的 hint 由 installBootHint 单独居中,这里跳过。 */
2283
- if (hint.closest('[data-dsh-boot]') !== null) return;
2284
2302
  const host = document.querySelector('[data-conversation-scroll]');
2285
2303
  if (host === null) return;
2286
2304
  const rect = host.getBoundingClientRect();
@@ -2295,10 +2313,12 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2295
2313
  手动重播一次:先摘掉动画类、强制重排、再挂回去。 */
2296
2314
  let lastHadHint = false;
2297
2315
  const replayFade = () => {
2298
-
2316
+ /* 同样限定在正文区内——_column / _marks 这些名字在别处也可能出现 */
2317
+ const area = document.querySelector('[data-conversation-scroll]');
2318
+ if (area === null) return;
2299
2319
  const targets = [
2300
- document.querySelector('[class*="_column"]'),
2301
- document.querySelector('[class*="_marks"]'),
2320
+ area.querySelector('[class*="_column"]'),
2321
+ area.querySelector('[class*="_marks"]'),
2302
2322
  ].filter((el) => el !== null && el.getBoundingClientRect().height > 0);
2303
2323
  if (targets.length === 0) return;
2304
2324
  for (const el of targets) el.removeAttribute('data-dcc-fade-in');
@@ -2308,10 +2328,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2308
2328
  };
2309
2329
 
2310
2330
  const watchHint = () => {
2311
- /* 只看会话界面里的提示——加载页也有同一个 _hint,它消失不表示
2312
- 正文就位,跟着触发会白跑一次(虽然 targets 为空会直接返回)。 */
2313
- const hint = document.querySelector('[class*="_hint"]');
2314
- const hasHint = hint !== null && hint.closest('[data-dsh-boot]') === 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;
2315
2335
  /* 由「有提示」变成「没提示」,说明这一轮内容已经就位 */
2316
2336
  if (lastHadHint && !hasHint) replayFade();
2317
2337
  lastHadHint = hasHint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ui-alt",
3
- "version": "0.2.422",
3
+ "version": "0.2.424",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "在保持原版 UI 大体布局不变的情况下,进行减小圆角、紧凑化、整洁化、高效化改进,使 UI 视觉更加冷静、专业、高效。同时添加余额显示。大部分改动可在设置中单独开关。",