From ea6373846d09540b8b1dfe11a828aac31bfbf9c8 Mon Sep 17 00:00:00 2001 From: kicer Date: Wed, 2 Sep 2026 15:22:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=8D=A1=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=85=A5=E6=8A=98=E5=8F=A0=E4=BD=93=E3=80=81=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=87=AA=E5=8A=A8=E5=B1=95=E5=BC=80=E5=B9=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=8C=E6=8C=87=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/css/style.css | 4 +++- app/server/public/index.html | 10 +++++----- app/server/public/js/tasks.js | 30 ++++++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/app/server/public/css/style.css b/app/server/public/css/style.css index 351bc43..ebe3cba 100644 --- a/app/server/public/css/style.css +++ b/app/server/public/css/style.css @@ -172,7 +172,7 @@ body { #fs-body .msg-bubble { box-shadow: none; font-size: 15.5px; } #fs-body .tool-card { max-width: 100%; } #fs-body .tool-card pre { max-height: 65vh; } -#fs-viewer { position: fixed; inset: 0; z-index: 130; background: rgba(8,10,20,0.88); padding: 40px 14px 24px; overflow-y: auto; } +#fs-viewer { position: fixed; inset: 0; z-index: 130; background: rgba(8,10,20,0.88); padding: 40px 14px 24px; overflow: auto; /* 缩放后支持横纵滚动 */ } #fs-viewer.hidden { display: none; } .fs-panel { max-width: 860px; margin: 0 auto; background: #fff; border-radius: 14px; padding: 18px 20px; font-size: 15.5px; } .fs-close { @@ -196,6 +196,8 @@ body { white-space: pre-wrap; overflow-x: auto; max-height: 300px; overflow-y: auto; font-size: 12px; color: #55492a; } +/* 时间行在折叠体内,展开才可见;作卡片尾注 */ +.tool-card .tool-time { color: #b3a97f; margin-top: 6px; } .tool-card.error { background: #fdecea; border-color: #f2c4bd; color: #a3352a; } .tool-card .spin { display: inline-block; width: 1em; text-align: center; } .tool-card .tool-args-full { color: #6b5b2a; } diff --git a/app/server/public/index.html b/app/server/public/index.html index fc2d680..6051912 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -301,10 +301,10 @@ - - - - - + + + + + diff --git a/app/server/public/js/tasks.js b/app/server/public/js/tasks.js index 73ffc50..d431fe7 100644 --- a/app/server/public/js/tasks.js +++ b/app/server/public/js/tasks.js @@ -318,8 +318,9 @@ function renderToolCard(id, name, argsStr, createdAt) { '' + esc(name) + '' + '' + esc(toolArgsSummary(name, argsStr)) + '' + '
' + esc(toolArgsFull(argsStr)) + '
' + - '
执行中…
' + - '
' + fmtTime(createdAt || Date.now()) + '
'; + '
执行中…
' + + // 时间行/复制按钮在折叠体内:展开卡片才可见 + '
' + fmtTime(createdAt || Date.now()) + '
'; return div; } @@ -633,10 +634,13 @@ const ui = { openFullscreen(el) { const body = $('fs-body'); body.innerHTML = ''; + body.style.zoom = ''; // 深拷贝并去掉 id:保留原类名使气泡/工具卡样式在查看器内照常生效,且避免 id 重复 const clone = el.cloneNode(true); clone.removeAttribute('id'); clone.querySelectorAll('[id]').forEach(function (n) { n.removeAttribute('id'); }); + // 全屏查看直接展开参数/结果,方便观看 + clone.querySelectorAll('details').forEach(function (d) { d.open = true; }); body.appendChild(clone); $('fs-viewer').classList.remove('hidden'); }, @@ -862,6 +866,28 @@ document.getElementById('messages').addEventListener('dblclick', function (e) { if (el) ui.openFullscreen(el); }); +// 全屏查看器双指缩放:页面 viewport 是 user-scalable=no(原生捏合被禁), +// 在查看器内接管双指手势,用 CSS zoom 缩放内容(1~4 倍,关闭时重置)。 +(function () { + const viewer = document.getElementById('fs-viewer'); + if (!viewer) return; + let startDist = 0, startZoom = 1, pinching = false; + const tdist = t => Math.hypot(t[0].clientX - t[1].clientX, t[0].clientY - t[1].clientY); + viewer.addEventListener('touchstart', function (e) { + if (e.touches.length !== 2) { pinching = false; return; } + pinching = true; + startDist = tdist(e.touches) || 1; + startZoom = Number($('fs-body').style.zoom) || 1; + }, { passive: true }); + viewer.addEventListener('touchmove', function (e) { + if (!pinching || e.touches.length < 2) return; + e.preventDefault(); // 双指期间阻止滚动,手势归缩放 + $('fs-body').style.zoom = Math.min(4, Math.max(1, startZoom * tdist(e.touches) / startDist)) || ''; + }, { passive: false }); + viewer.addEventListener('touchend', function (e) { if (e.touches.length < 2) pinching = false; }, { passive: true }); + viewer.addEventListener('touchcancel', function () { pinching = false; }, { passive: true }); +})(); + // ---------- Tab 注册 ---------- window.tabModules = window.tabModules || {}; tabModules.tasks = {