From 5261834ecca6296c26d3613b1038cd7c096dcb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A7=E9=A9=8A?= Date: Sat, 21 Nov 2026 16:05:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=A9=9F=E7=95=AB=E9=9D=A2=E5=83=8F?= =?UTF-8?q?=E5=8E=9F=E7=94=9F=20App=EF=BC=9A=E4=B8=8A=E4=B8=8B=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E6=B5=AE=E5=87=BA=E8=89=B2=E5=A1=8A=E3=80=82Jenny=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=8C=E7=9A=84=E6=88=AA=E5=9C=96=EF=BC=88?= =?UTF-8?q?16:00=EF=BC=8C=E9=A6=96=E9=A0=81=EF=BC=89=E9=87=8F=E9=A1=8F?= =?UTF-8?q?=E8=89=B2=EF=BC=9A0=E2=80=9379pt=20=E6=98=AF=20(246,245,241)?= =?UTF-8?q?=E3=80=8179pt=20=E8=B5=B7=E6=98=AF=E9=A6=96=E9=A0=81=E7=9A=84?= =?UTF-8?q?=20(240,239,236)=E3=80=81793pt=20=E4=BB=A5=E4=B8=8B=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1=E9=82=A3=E6=A2=9D=E6=98=AF=20(250,249,246)=E2=80=94?= =?UTF-8?q?=E2=80=94=E4=B8=8A=E9=9D=A2=E4=B8=80=E5=A1=8A=E6=98=AF=20iOS=20?= =?UTF-8?q?=E7=9A=84=E9=9C=A7=E9=9D=A2=E8=93=8B=E5=9C=A8=E9=A6=96=E9=A0=81?= =?UTF-8?q?=E8=BC=83=E6=B7=B1=E7=9A=84=E5=BA=95=E8=89=B2=E4=B8=8A=EF=BC=88?= =?UTF-8?q?=E8=AE=8A=E4=BA=AE=E3=80=8179pt=20=E7=A1=AC=E9=82=8A=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E4=B8=8B=E9=9D=A2=E4=B8=80=E5=A1=8A=E6=98=AF=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1=E9=82=A3=E6=A2=9D=E7=94=A8=E9=A0=81=E9=9D=A2=E8=89=B2?= =?UTF-8?q?=EF=BC=88#faf9f6=EF=BC=8C=E8=B7=9F=20manifest=20=E4=B8=80?= =?UTF-8?q?=E6=A8=A3=EF=BC=89=E8=80=8C=E9=A6=96=E9=A0=81=E6=98=AF=E8=BC=83?= =?UTF-8?q?=E6=B7=B1=E7=9A=84=20--side=E3=80=82=E5=B0=8D=E7=85=A7=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=BC=B5=EF=BC=88=E8=81=8A=E5=A4=A9=E9=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=A8=99=E9=A1=8C=E5=88=97=E6=98=AF=E9=A0=81=E9=9D=A2=E8=89=B2?= =?UTF-8?q?=EF=BC=89=EF=BC=9A=E9=9C=A7=E9=9D=A2=E4=B8=8B=E9=9D=A2=E8=B7=9F?= =?UTF-8?q?=E6=B2=92=E8=93=8B=E7=9A=84=E5=B7=AE=20=E2=89=A4=201=EF=BC=8C?= =?UTF-8?q?=E7=9C=8B=E4=B8=8D=E5=87=BA=E4=BE=86=E3=80=82=E6=89=80=E4=BB=A5?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E9=A6=96=E9=A0=81=EF=BC=88=E5=85=A8=E9=A0=81?= =?UTF-8?q?=E9=9D=A2=E5=94=AF=E4=B8=80=E7=94=A8=20--side=20=E7=9A=84?= =?UTF-8?q?=EF=BC=89=E6=9C=83=E6=B5=AE=E5=87=BA=E4=B8=8A=E4=B8=8B=E5=85=A9?= =?UTF-8?q?=E5=A1=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - iOS 少給下面一條的那種手機上(fit-short),--side 改成頁面色:首頁跟其他頁一樣,霧面和系統那條都融進去。其他手機照舊。 - 標題列的字從狀態列下 26pt 開始(量到霧面停在 79pt=狀態列 59+20),不再是 1.55 倍(91):離狀態列近一點、更像原生。 - 網頁自己的底色跟著現在這頁(stripColor,換頁時 barColor 一起叫;遠端畫面那種黑底的頁面,系統那條若取網頁底色也會跟著黑)。 - 量尺開著時網頁底色換成強調色:實機截圖看最下面那條跟不跟著變,就知道那條的顏色從哪來;關掉就回來。 - barColor 在前面的 script,stripColor 在最後一個:先確認有這個函式再叫(第一次跑時還沒定義)。 已驗證: cargo test 838 過;scratch 手機頁面(FIT_TEST 代替手機數字):正常→首頁 rgb(240,239,236)、標題列 4px、網頁底色沒設;iPhone 15 Pro 少 59→short、首頁 rgb(250,249,246)、首頁標題列上 89px、網頁底色頁面色,截圖首頁整片同色;量尺開著網頁底色 rgb(192,98,68)(強調色),關掉回 rgb(250,249,246)、量尺消失;切回正常時首頁顏色和網頁底色都回來。 未驗證: 真的 iPhone(霧面硬邊在不在、系統那條會不會跟網頁底色變、深色模式那條的顏色)——要更新 ai 的帳號伺服器後在 Jenny 手機上看,打開量尺截圖。 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm --- docs/feature-map/phonefit.md | 9 ++++---- mobile/index.html | 41 +++++++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/docs/feature-map/phonefit.md b/docs/feature-map/phonefit.md index 294f7d7..5c245c7 100644 --- a/docs/feature-map/phonefit.md +++ b/docs/feature-map/phonefit.md @@ -5,9 +5,9 @@ ## 子功能 - `phonefit-measure` 量:打開、回到前面、轉向、離開輸入框時,比螢幕高度、這頁看得到的高度和上下留白(狀態列、底部手勢條)。只看 iPhone 加入主畫面的 App;iPad、瀏覽器裡的不動。 -- `phonefit-short` iOS 少給下面一條(iOS 26.1、26.5 以後、27;WebKit 問題 301994):看得到的比螢幕少一個狀態列高,那條由系統畫、網頁畫不到,上面還多一層霧面。這時標題列往下讓開霧面(上面留白改成狀態列的 1.55 倍),底部不再多留手勢條的空間(它已經在系統那條裡),輸入框底下的顏色改成跟頁面一樣(系統那條也是這個顏色)。狀態列佔了上面的那種(上面留白是 0)不動。 +- `phonefit-short` iOS 少給下面一條(iOS 26.1、26.5 以後、27;WebKit 問題 301994):看得到的比螢幕少一個狀態列高,那條由系統畫、網頁畫不到,上面還多一層霧面。這時標題列往下讓開霧面(量到霧面停在狀態列下 20pt,字從狀態列下 26pt 開始),底部不再多留手勢條的空間(它已經在系統那條裡)。像原生 App 一樣不出現色塊:霧面蓋在頁面色上、系統那條也是頁面色(#faf9f6,跟 manifest 一樣),兩者都看不出來(量過差 ≤ 1);Bot 清單原本較深的底色會讓上下各浮出一塊,這時改穿頁面色;輸入框底下也是頁面色;網頁自己的底色跟著現在這頁(遠端畫面的黑)。狀態列佔了上面的那種(上面留白是 0)不動。 - `phonefit-keyboard` 鍵盤收起後畫面沒長回來(iOS 主畫面 App 的老問題,要關掉 App 才好):離開輸入框 0.14 秒後還比量過最高的矮,就把整頁重新排一次(捲到哪裡留著),再量一次。 -- `phonefit-ruler` 設定 › 更新 ›「這支手機」›「畫面」:一行寫量到的——螢幕寬×高、看得到多高、上/下留白、是哪一種、iOS 版本、主畫面 App 還是瀏覽器。點了打開量尺:上面、下面每 10 一格的刻度,中間是那幾個數字,頁面底下外面一條紅色(看得到=下面那條也能畫);點一下關掉。 +- `phonefit-ruler` 設定 › 更新 ›「這支手機」›「畫面」:一行寫量到的——螢幕寬×高、看得到多高、上/下留白、是哪一種、iOS 版本、主畫面 App 還是瀏覽器。點了打開量尺:上面、下面每 10 一格的刻度,中間是那幾個數字,頁面底下外面一條紅色(看得到=下面那條也能畫);開著時網頁底色換成強調色(最下面那條跟著變=那條取網頁的底色);點一下關掉、底色回來。 ## 使用者怎麼到 @@ -22,7 +22,7 @@ - 基本前提和「手機已登入」(README)。無頭 Chrome 不是 iPhone 主畫面 App:用 `window.FIT_TEST` 代替手機量到的數字(只在那一頁有效)。 -- **iOS 少給下面一條**(covers `phonefit-measure`、`phonefit-short`):指令:`$CTL phone click '.row[data-bot="1"]' && $CTL phone js '(() => { window.FIT_TEST = {iphone:true,standalone:true,screenW:393,screenH:852,innerH:793,safeT:59,safeB:34}; fit(); const cs = (q) => getComputedStyle(document.querySelector(q)); return [FIT.mode, cs("#v-chat .bar").paddingTop, cs(".dock").paddingBottom].join(" "); })()' && $CTL phone shot phonefit-short`;再把 innerH 換成 852(正常)、safeT 換成 0(狀態列佔上面)、iphone 換成 false(iPad)各跑一次。看到:「short 95px 8px」,截圖標題列往下、輸入框貼近底部;另外三次 mode 是空的或 topbar,標題列 4px、底部 8px(Chrome 的留白是 0)。 +- **iOS 少給下面一條**(covers `phonefit-measure`、`phonefit-short`):指令:`$CTL phone click '.row[data-bot="1"]' && $CTL phone js '(() => { window.FIT_TEST = {iphone:true,standalone:true,screenW:393,screenH:852,innerH:793,safeT:59,safeB:34}; fit(); const cs = (q) => getComputedStyle(document.querySelector(q)); return [FIT.mode, cs("#v-chat .bar").paddingTop, cs(".dock").paddingBottom].join(" "); })()' && $CTL phone shot phonefit-short`;再把 innerH 換成 852(正常)、safeT 換成 0(狀態列佔上面)、iphone 換成 false(iPad)各跑一次。看到:「short 89px 8px」,截圖標題列往下、輸入框貼近底部;回首頁 `getComputedStyle(document.querySelector("#v-home")).backgroundColor` 是頁面色 rgb(250, 249, 246)(正常時是較深的那個);另外三次 mode 是空的或 topbar,標題列 4px、底部 8px(Chrome 的留白是 0)。 - **量尺**(covers `phonefit-ruler`):換過程式後要開兩次(第一次是存著的舊頁面)。指令:`$CTL phone open --listed && $CTL phone open --listed && $CTL phone click '#b-me' && $CTL phone click '#sheet-in .opt' --text 設定 && $CTL phone click '[data-go="updates"]' && $CTL phone wait '[data-ruler]' && $CTL phone click '[data-ruler]' && $CTL phone wait '#ruler' && $CTL phone shot phonefit-ruler`。看到:「畫面」那行「390×844,看得到 844;上 0/下 0;整個螢幕都是 AnyBot 的;iOS 18.0;瀏覽器」;量尺左上、右下各一排刻度(20、40…140),中間是那幾個數字;紅色那條在畫面外(Chrome 看不到)。 - **鍵盤收起、真的 iPhone**(covers `phonefit-keyboard`、`phonefit-short`):指令:走不到——要實機:主畫面打開、打字再收鍵盤、看上面糊不糊、下面空不空,打開量尺截圖。看到:實機上標題列清楚、輸入框貼近手勢條,量尺那行是實機的數字。 - 自動測試:`cargo test featuremap::`。 @@ -30,5 +30,6 @@ ## 陷阱 - 下面那條是系統畫的,網頁畫不到:只能讓顏色一樣,輸入框不會跑進去(不切到)。 -- 霧面往下多深是量 iPhone 15 Pro 的截圖估的(狀態列的 1.55 倍);別的機型、別的 iOS 版本用量尺確認後再調。 +- 霧面往下多深是量 iPhone 15 Pro 的截圖(狀態列 59pt,霧面到 79pt);別的機型、別的 iOS 版本用量尺確認後再調 `FROST_PAST`。 +- 深色模式下系統那條是什麼顏色還沒量過(manifest 的底色是淺的):用量尺看那條跟不跟著強調色變。 - 用帳號連線時,手機頁面是帳號伺服器發的:改了要更新帳號伺服器;更新後第一次打開還是存著的舊頁面,再打開一次才換新的。 diff --git a/mobile/index.html b/mobile/index.html index 810ba38..b4ed2c9 100644 --- a/mobile/index.html +++ b/mobile/index.html @@ -1102,6 +1102,8 @@ function barColor() { const c = getComputedStyle(top).backgroundColor; if (!c || c === "rgba(0, 0, 0, 0)") return; document.querySelectorAll('meta[name="theme-color"]').forEach((m) => m.setAttribute("content", c)); + // (stripColor is in the last script: not there yet while this one first runs.) + if (typeof stripColor === "function") stripColor(); } function go(v, arg = {}, replace = false) { S.dir = replace ? "" : "in-fwd"; @@ -4428,15 +4430,43 @@ function fit() { const mode = lost >= 20 && lost <= 90 ? (safeT >= 20 ? "short" : "topbar") : ""; const root = document.documentElement; if (mode === "short") { - root.style.setProperty("--safe-t", Math.round(safeT * 1.55) + "px"); + // The frost ends at the status bar + 20 (measured: 79 pt on a 59 pt bar); the header's words + // start a little below that. + root.style.setProperty("--safe-t", Math.round(safeT + FROST_PAST) + "px"); root.style.setProperty("--safe-b", Math.max(0, Math.round(safeB - lost)) + "px"); + // 像原生 App: no bands. The frost lightens what lies under it and the system's strip at the + // bottom is the page colour (#faf9f6 here, the manifest's too): on the page colour neither shows + // (measured: ≤ 1 level). The Bot list's own darker colour showed both as blocks — it wears the + // page colour here. + root.style.setProperty("--side", "var(--pane)"); root.classList.add("fit-short"); } else { root.style.removeProperty("--safe-t"); root.style.removeProperty("--safe-b"); + root.style.removeProperty("--side"); root.classList.remove("fit-short"); } Object.assign(FIT, {mode, lost, safeT, safeB, screenW: landscape ? Math.max(sw, sh) : Math.min(sw, sh), screenH, innerH}); + stripColor(); +} +// How far below the status bar the header's words start when the system frosts the top. +const FROST_PAST = 26; +// What meets the system's strip: the page's own background is the showing view's (the remote +// screen's black, the list's colour…), so if the strip takes the page's colour it matches. +function stripColor() { + const root = document.documentElement, body = document.body; + // (The ruler holds the accent while it shows.) + if ($("ruler") || !body) return; + if (!root.classList.contains("fit-short")) { + root.style.removeProperty("background-color"); + body.style.removeProperty("background-color"); + return; + } + const v = document.querySelector(".view.on"); + const c = v ? getComputedStyle(v).backgroundColor : ""; + if (!c || c === "rgba(0, 0, 0, 0)") return; + root.style.backgroundColor = c; + body.style.backgroundColor = c; } // A text box let go: the keyboard bug leaves the page short — laid out again once, scroll kept. function heal() { @@ -4479,10 +4509,15 @@ function ruler() { const tick = (side, y) => `` + (y % 20 ? "" : `${y}`); for (let y = 0; y <= 140; y += 10) h += tick("top", y) + tick("bottom", y); - h += `
${esc(fitWords().split(";").join("\n"))}\n\n上面糊到哪一格、下面最後看得到哪一格?截圖給我們。點一下關掉。
`; + h += `
${esc(fitWords().split(";").join("\n"))}\n\n上面糊到哪一格、下面最後看得到哪一格?最下面那條有沒有變成強調色?截圖給我們。點一下關掉。
`; h += `
看到這條紅色=最下面還能畫
`; r.innerHTML = h; - r.onclick = () => r.remove(); + // (Does the system's strip at the bottom take the page's colour? While the ruler shows, the + // page wears the accent: a strip that turns with it does.) + const root = document.documentElement, accent = getComputedStyle(root).getPropertyValue("--accent").trim() || "orange"; + root.style.backgroundColor = accent; + document.body.style.backgroundColor = accent; + r.onclick = () => { r.remove(); root.style.removeProperty("background-color"); document.body.style.removeProperty("background-color"); stripColor(); }; document.body.appendChild(r); } // iOS: the keyboard floats over the page instead of shrinking it; measure it and lift the composer.