dsh-happy-reader 0.2.4 → 0.2.6
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 +2 -2
- package/lib/client.js +18 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
收起会话标题栏,阅读区域更大。
|
|
22
22
|
- 只作用于应用内的标题栏;Windows 最上方的系统窗口标题条(拖动窗口、
|
|
23
23
|
最小化/最大化/关闭)不受影响
|
|
24
|
-
-
|
|
25
|
-
|
|
24
|
+
- **只收会话标题栏本身**(v0.2.6 起):插件页("添加插件"入口所在)、"查询用量"等
|
|
25
|
+
嵌入页(顶部唯一的"返回"按钮)、弹出对话框——这些页面的头部一律不受影响
|
|
26
26
|
|
|
27
27
|
### 3. 字号 10–40px
|
|
28
28
|
面板里 −/+ 步进调节,突破官方 22px 的调整上限:
|
package/lib/client.js
CHANGED
|
@@ -29,7 +29,7 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
var exports = module.exports
|
|
30
30
|
|
|
31
31
|
// ── 常量 ────────────────────────────────────────────────────────────
|
|
32
|
-
const VERSION = '0.2.
|
|
32
|
+
const VERSION = '0.2.6'
|
|
33
33
|
const STATE_KEY = 'dsh.reader-boost.v1'
|
|
34
34
|
const FAB_ID = 'dsrb-fab'
|
|
35
35
|
const PANEL_ID = 'dsrb-panel'
|
|
@@ -135,9 +135,12 @@ window.__ModuleLoader__.load({
|
|
|
135
135
|
`
|
|
136
136
|
// 隐藏输入区(关键:height:0 而非 display:none —— 官方滚动锚定依赖该元素的几何信息)
|
|
137
137
|
const HIDE_CSS = '[data-composer-seat]{height:0!important;min-height:0!important;overflow:hidden!important}'
|
|
138
|
-
// 隐藏上边栏(会话标题栏)——
|
|
139
|
-
//
|
|
140
|
-
|
|
138
|
+
// 隐藏上边栏(会话标题栏)—— 正向判据:官方 "conversation.header" 槽位宿主带
|
|
139
|
+
// data-conversation-header-leading,全应用仅此一处;其余 header[data-window-drag]
|
|
140
|
+
// 各带关键控件(插件页标题含"添加插件"按钮、嵌入页头含唯一返回按钮),不得误伤
|
|
141
|
+
// (v0.2.6 修:旧写法"匹配全部再排除对话框"曾把插件页标题整条隐藏,安装入口消失)。
|
|
142
|
+
// 对话框排除条款保留:弹出层内永不隐藏(防锁死返回,v0.10.4)。
|
|
143
|
+
const HIDE_TOP_CSS = 'header[data-window-drag]:has(> [data-conversation-header-leading]):not([role="dialog"] *){display:none!important}'
|
|
141
144
|
// 字号缩放层(!important 样式表仅在需要缩放时启用;官方内联值原样保留在其下)
|
|
142
145
|
const FONT_CSS = `body{--dsh-content-font-size:calc(var(--dsrb-font-base,14px)*var(--dsrb-font-scale,1))!important}`
|
|
143
146
|
// 全屏补偿层:不归零官方定位变量 —— --dsh-windows-titlebar-height(=40px)是
|
|
@@ -319,13 +322,17 @@ window.__ModuleLoader__.load({
|
|
|
319
322
|
let next = value
|
|
320
323
|
if (famNames.length && next.indexOf('var(--dsw-font-family)') !== -1) next = next.split('var(--dsw-font-family)').join(fam)
|
|
321
324
|
if (code && next.indexOf('var(--ds-font-family-code)') !== -1) next = next.split('var(--ds-font-family-code)').join(cod)
|
|
322
|
-
// 行距:官方行高 token
|
|
323
|
-
|
|
325
|
+
// 行距:官方行高 token 有两种真实形态(简写里的 "/ 行高" 段,均出自 asar 实测)——
|
|
326
|
+
// 正文/标题:"/ calc(Npx + var(--dsh-content-font-delta))"(增量由官方自管、随字号缩放)
|
|
327
|
+
// 代码类: "/ Npx"(纯 px,不随字号)
|
|
328
|
+
// 两种都按倍率放大;calc 形先行(其产物不含 "/数字px" 段,两步互不误伤)
|
|
324
329
|
if (lineH !== null) {
|
|
325
|
-
next = next
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
330
|
+
next = next
|
|
331
|
+
.replace(
|
|
332
|
+
/(\/\s*)calc\((\d+(?:\.\d+)?)px \+ var\(--dsh-content-font-delta\)\)/g,
|
|
333
|
+
(m, lead, n) => lead + 'calc((' + n + 'px + var(--dsh-content-font-delta)) * ' + lineH + ')',
|
|
334
|
+
)
|
|
335
|
+
.replace(/(\/\s*)(\d+(?:\.\d+)?)px/g, (m, lead, n) => lead + Math.round(Number(n) * lineH * 2) / 2 + 'px')
|
|
329
336
|
}
|
|
330
337
|
if (next !== value) parts.push(name + ':' + next)
|
|
331
338
|
}
|
|
@@ -1426,7 +1433,7 @@ window.__ModuleLoader__.load({
|
|
|
1426
1433
|
window.addEventListener('resize', onResize)
|
|
1427
1434
|
|
|
1428
1435
|
// 会话 DOM 迟现/被替换 → 轻量定时器持续核对(同节点零开销),顺带漂移兜底与
|
|
1429
|
-
//
|
|
1436
|
+
// 面板宽度行刷新;列宽突变由 columnObserver 即时处理,定时器只兜底重挂。
|
|
1430
1437
|
attachWidthObserver()
|
|
1431
1438
|
attachColumnObserver()
|
|
1432
1439
|
const retryTimer = setInterval(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-happy-reader",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Happy Reader(阅读增强):隐藏输入框 / 上边栏、全屏切换、字号 10–40px、行距/字距微调、面板可拖动可拉高、复制为 Markdown(公式→LaTeX)、内容宽度扩展、中英文分别选正文字体 + 代码字体(仅列本机已装)—— 与官方设置协同,不冲突",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|