手機畫面像原生 App:上下不再浮出色塊。Jenny 更新後的截圖(16:00,首頁)量顏色:0–79pt 是 (246,245,241)、79pt 起是首頁的 (240,239,236)、793pt 以下系統那條是 (250,249,246)——上面一塊是 iOS 的霧面蓋在首頁較深的底色上(變亮、79pt 硬邊),下面一塊是系統那條用頁面色(#faf9f6,跟 manifest 一樣)而首頁是較深的 --side。對照第一張(聊天頁,標題列是頁面色):霧面下面跟沒蓋的差 ≤ 1,看不出來。所以只有首頁(全頁面唯一用 --side 的)會浮出上下兩塊。

- 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
This commit is contained in:
王性驊 2026-11-21 16:05:52 +08:00
parent faece409f8
commit 5261834ecc
2 changed files with 43 additions and 7 deletions

View File

@ -5,9 +5,9 @@
## 子功能 ## 子功能
- `phonefit-measure` 量:打開、回到前面、轉向、離開輸入框時,比螢幕高度、這頁看得到的高度和上下留白(狀態列、底部手勢條)。只看 iPhone 加入主畫面的 App;iPad、瀏覽器裡的不動。 - `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-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` 代替手機量到的數字(只在那一頁有效)。 - 基本前提和「手機已登入」(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 看不到)。 - **量尺**(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`):指令:走不到——要實機:主畫面打開、打字再收鍵盤、看上面糊不糊、下面空不空,打開量尺截圖。看到:實機上標題列清楚、輸入框貼近手勢條,量尺那行是實機的數字。 - **鍵盤收起、真的 iPhone**(covers `phonefit-keyboard`、`phonefit-short`):指令:走不到——要實機:主畫面打開、打字再收鍵盤、看上面糊不糊、下面空不空,打開量尺截圖。看到:實機上標題列清楚、輸入框貼近手勢條,量尺那行是實機的數字。
- 自動測試:`cargo test featuremap::`。 - 自動測試:`cargo test featuremap::`。
@ -30,5 +30,6 @@
## 陷阱 ## 陷阱
- 下面那條是系統畫的,網頁畫不到:只能讓顏色一樣,輸入框不會跑進去(不切到)。 - 下面那條是系統畫的,網頁畫不到:只能讓顏色一樣,輸入框不會跑進去(不切到)。
- 霧面往下多深是量 iPhone 15 Pro 的截圖估的(狀態列的 1.55 倍);別的機型、別的 iOS 版本用量尺確認後再調。 - 霧面往下多深是量 iPhone 15 Pro 的截圖(狀態列 59pt,霧面到 79pt);別的機型、別的 iOS 版本用量尺確認後再調 `FROST_PAST`。
- 深色模式下系統那條是什麼顏色還沒量過(manifest 的底色是淺的):用量尺看那條跟不跟著強調色變。
- 用帳號連線時,手機頁面是帳號伺服器發的:改了要更新帳號伺服器;更新後第一次打開還是存著的舊頁面,再打開一次才換新的。 - 用帳號連線時,手機頁面是帳號伺服器發的:改了要更新帳號伺服器;更新後第一次打開還是存著的舊頁面,再打開一次才換新的。

View File

@ -1102,6 +1102,8 @@ function barColor() {
const c = getComputedStyle(top).backgroundColor; const c = getComputedStyle(top).backgroundColor;
if (!c || c === "rgba(0, 0, 0, 0)") return; if (!c || c === "rgba(0, 0, 0, 0)") return;
document.querySelectorAll('meta[name="theme-color"]').forEach((m) => m.setAttribute("content", c)); 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) { function go(v, arg = {}, replace = false) {
S.dir = replace ? "" : "in-fwd"; S.dir = replace ? "" : "in-fwd";
@ -4428,15 +4430,43 @@ function fit() {
const mode = lost >= 20 && lost <= 90 ? (safeT >= 20 ? "short" : "topbar") : ""; const mode = lost >= 20 && lost <= 90 ? (safeT >= 20 ? "short" : "topbar") : "";
const root = document.documentElement; const root = document.documentElement;
if (mode === "short") { 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"); 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"); root.classList.add("fit-short");
} else { } else {
root.style.removeProperty("--safe-t"); root.style.removeProperty("--safe-t");
root.style.removeProperty("--safe-b"); root.style.removeProperty("--safe-b");
root.style.removeProperty("--side");
root.classList.remove("fit-short"); root.classList.remove("fit-short");
} }
Object.assign(FIT, {mode, lost, safeT, safeB, screenW: landscape ? Math.max(sw, sh) : Math.min(sw, sh), screenH, innerH}); 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. // A text box let go: the keyboard bug leaves the page short — laid out again once, scroll kept.
function heal() { function heal() {
@ -4479,10 +4509,15 @@ function ruler() {
const tick = (side, y) => `<i style="position:absolute;${side}:${y}px;${side === "top" ? "left" : "right"}:0;width:${y % 50 ? 12 : 26}px;height:1px;min-height:0;padding:0;background:var(--text)"></i>` + const tick = (side, y) => `<i style="position:absolute;${side}:${y}px;${side === "top" ? "left" : "right"}:0;width:${y % 50 ? 12 : 26}px;height:1px;min-height:0;padding:0;background:var(--text)"></i>` +
(y % 20 ? "" : `<i style="position:absolute;${side}:${y - 7}px;${side === "top" ? "left" : "right"}:30px;font:600 var(--fs-caption)/1.2 var(--font);font-style:normal;background:var(--pane);padding:0 3px">${y}</i>`); (y % 20 ? "" : `<i style="position:absolute;${side}:${y - 7}px;${side === "top" ? "left" : "right"}:30px;font:600 var(--fs-caption)/1.2 var(--font);font-style:normal;background:var(--pane);padding:0 3px">${y}</i>`);
for (let y = 0; y <= 140; y += 10) h += tick("top", y) + tick("bottom", y); for (let y = 0; y <= 140; y += 10) h += tick("top", y) + tick("bottom", y);
h += `<div class="info">${esc(fitWords().split(";").join("\n"))}\n\n上面糊到哪一格、下面最後看得到哪一格?截圖給我們。點一下關掉。</div>`; h += `<div class="info">${esc(fitWords().split(";").join("\n"))}\n\n上面糊到哪一格、下面最後看得到哪一格?最下面那條有沒有變成強調色?截圖給我們。點一下關掉。</div>`;
h += `<div class="past">看到這條紅色=最下面還能畫</div>`; h += `<div class="past">看到這條紅色=最下面還能畫</div>`;
r.innerHTML = 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); document.body.appendChild(r);
} }
// iOS: the keyboard floats over the page instead of shrinking it; measure it and lift the composer. // iOS: the keyboard floats over the page instead of shrinking it; measure it and lift the composer.