From faece409f84dfda2f72f1d8d76dbd32fbc0ec823 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 15:50:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=A9=9F=E7=95=AB=E9=9D=A2=E8=B2=BC?= =?UTF-8?q?=E9=BD=8A=EF=BC=88=E9=A0=82=E5=A4=A9=E7=AB=8B=E5=9C=B0=EF=BC=89?= =?UTF-8?q?=EF=BC=9AiPhone=20=E4=B8=BB=E7=95=AB=E9=9D=A2=20App=20=E4=B8=8A?= =?UTF-8?q?=E9=9D=A2=E7=B3=8A=E3=80=81=E4=B8=8B=E9=9D=A2=E7=A9=BA=E4=B8=80?= =?UTF-8?q?=E5=A1=8A=E3=80=82=E9=87=8F=E4=BA=86=20Jenny=20=E5=82=B3?= =?UTF-8?q?=E4=BE=86=E7=9A=84=E6=88=AA=E5=9C=96=EF=BC=881179=C3=972556?= =?UTF-8?q?=EF=BC=9DiPhone=2015/16=20Pro=20393=C3=97852pt=EF=BC=89?= =?UTF-8?q?=EF=BC=9A=E9=A0=81=E9=9D=A2=E5=9C=A8=20793pt=20=E5=B0=B1?= =?UTF-8?q?=E7=B5=90=E6=9D=9F=EF=BC=8C=E4=B8=8B=E9=9D=A2=2059pt=EF=BC=88?= =?UTF-8?q?=E5=89=9B=E5=A5=BD=E4=B8=80=E5=80=8B=E7=8B=80=E6=85=8B=E5=88=97?= =?UTF-8?q?=E9=AB=98=EF=BC=89=E6=98=AF=E7=B3=BB=E7=B5=B1=E7=95=AB=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E6=A2=9D=EF=BC=9B=E6=88=91=E5=80=91=E5=8F=88=E5=9C=A8?= =?UTF-8?q?=E8=BC=B8=E5=85=A5=E6=A1=86=E4=B8=8B=E5=A4=9A=E7=95=99=E4=BA=86?= =?UTF-8?q?=E6=89=8B=E5=8B=A2=E6=A2=9D=E7=9A=84=2034pt=EF=BC=8B8=EF=BC=8C?= =?UTF-8?q?=E8=BC=B8=E5=85=A5=E6=A1=86=E5=BA=95=E5=9C=A8=20750pt=EF=BC=8C?= =?UTF-8?q?=E6=AF=94=E8=A9=B2=E5=9C=A8=E7=9A=84=E5=9C=B0=E6=96=B9=E9=AB=98?= =?UTF-8?q?=E4=BA=86=E5=B0=87=E8=BF=91=20100pt=E3=80=82=E4=B8=8A=E9=9D=A2?= =?UTF-8?q?=E6=95=B4=E6=A2=9D=E6=A8=99=E9=A1=8C=E5=88=97=EF=BC=88=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E3=80=81=E9=A0=AD=E5=83=8F=E3=80=81=E5=90=8D=E5=AD=97?= =?UTF-8?q?=E3=80=81=E9=89=9B=E7=AD=86=E3=80=81=E2=8B=AF=EF=BC=89=E9=83=BD?= =?UTF-8?q?=E7=B3=8A=EF=BC=8C=E8=B6=8A=E4=B8=8A=E9=9D=A2=E8=B6=8A=E7=B3=8A?= =?UTF-8?q?=EF=BC=88=E9=8A=B3=E5=88=A9=E5=BA=A6=EF=BC=9A=E7=8B=80=E6=85=8B?= =?UTF-8?q?=E5=88=97=E6=99=82=E9=96=93=20245=E3=80=81=E6=A8=99=E9=A1=8C?= =?UTF-8?q?=E5=88=97=2044=E2=80=9384=E3=80=81=E7=AC=AC=E4=BA=8C=E8=A1=8C?= =?UTF-8?q?=20155=E3=80=81=E5=8D=A1=E7=89=87=20208=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E9=9C=A7=E9=9D=A2=E5=A4=A7=E7=B4=84=E8=93=8B=E5=88=B0=2090pt?= =?UTF-8?q?=E3=80=82=E6=88=91=E5=80=91=E7=9A=84=20CSS=20=E6=B2=92=E6=9C=89?= =?UTF-8?q?=E4=BB=BB=E4=BD=95=E6=A8=A1=E7=B3=8A=EF=BC=9A=E9=80=99=E6=98=AF?= =?UTF-8?q?=20iOS=2026.1=E3=80=8126.5=20=E4=BB=A5=E5=BE=8C=E5=92=8C=2027?= =?UTF-8?q?=20=E7=9A=84=20WebKit=20=E5=95=8F=E9=A1=8C=20301994=E2=80=94?= =?UTF-8?q?=E2=80=94=E4=B8=BB=E7=95=AB=E9=9D=A2=20App=20=E5=B0=91=E7=B5=A6?= =?UTF-8?q?=E4=B8=80=E5=80=8B=E7=8B=80=E6=85=8B=E5=88=97=E9=AB=98=EF=BC=88?= =?UTF-8?q?=E9=82=A3=E6=A2=9D=E7=B3=BB=E7=B5=B1=E7=95=AB=E3=80=81=E7=B6=B2?= =?UTF-8?q?=E9=A0=81=E7=95=AB=E4=B8=8D=E5=88=B0=EF=BC=89=EF=BC=8C=E4=B8=8A?= =?UTF-8?q?=E9=9D=A2=E5=86=8D=E8=93=8B=E4=B8=80=E5=B1=A4=E9=9C=A7=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E7=B3=BB=E7=B5=B1=E5=88=97=EF=BC=9B=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E5=80=8B=E5=95=8F=E9=A1=8C=E7=9A=84=E5=8F=A6=E4=B8=80=E7=A8=AE?= =?UTF-8?q?=E6=98=AF=E7=8B=80=E6=85=8B=E5=88=97=E4=BD=94=E4=B8=8A=E9=9D=A2?= =?UTF-8?q?=EF=BC=88=E4=B8=8A=E9=9D=A2=E7=95=99=E7=99=BD=E8=AE=8A=200?= =?UTF-8?q?=EF=BC=89=E3=80=82=E9=82=84=E6=9C=89=20iOS=20=E4=B8=BB=E7=95=AB?= =?UTF-8?q?=E9=9D=A2=20App=20=E7=9A=84=E9=8D=B5=E7=9B=A4=E8=80=81=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=EF=BC=9A=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=89=93=E9=96=8B?= =?UTF-8?q?=E9=8D=B5=E7=9B=A4=E5=BE=8C=E7=95=AB=E9=9D=A2=E5=B0=91=E4=B8=80?= =?UTF-8?q?=E6=88=AA=EF=BC=8C=E9=97=9C=E6=8E=89=20App=20=E6=89=8D=E5=A5=BD?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 沒有一個 CSS 值在每個 iOS 都對,所以手機頁面自己量(打開、回到前面、轉向、離開輸入框時):比螢幕高度、看得到的高度、上下留白,只看 iPhone 主畫面 App(iPad 視窗、瀏覽器不動)。 - 少給下面一條(少 20–90pt、上面留白還在):上面留白改成狀態列的 1.55 倍,標題列讓開霧面;底部留白扣掉被拿走的(手勢條在系統那條裡,不再多留);輸入框和工具列底下改成頁面的顏色,跟系統那條一樣。輸入框永遠在看得到的範圍裡,不會被切到。 - 狀態列佔上面(上面留白 0):不動。正常(iOS 18、26.0、26.2):不動。 - 鍵盤收起後還比量過最高的矮:整頁重新排一次(捲動位置留著),再量。 - 設定 › 更新 ›「這支手機」›「畫面」:一行寫量到的(螢幕、看得到多高、上/下、哪一種、iOS 版本、主畫面 App 或瀏覽器),點了打開量尺(上下每 10 一格、中間是數字、頁面底外一條紅色=下面也能畫),實機截一張就知道是哪一種、霧面到哪。 - 全部走 --safe-t/--safe-b 兩個變數(.pager 原本直接用 env() 的也改成變數),量完只改這兩個。量尺的刻度全用 inline style(頁面上別的規則把 div 撐成 24px 高的黑塊,截圖看到後改的)。 功能地圖新的一區 phonefit.md(phone.md 已滿 9000 字)。 已驗證: cargo test 838 過(featuremap:: 含新的一區、theme 的設計檢查掃手機頁面);scratch 手機頁面(無頭 Chrome,用 window.FIT_TEST 代替手機的數字)照 phonefit.md 跑:iPhone 15 Pro 少給下面 59 → short、標題列上留白 95px、輸入框底 8px、底色換成頁面色;iPhone 17 Pro(874/812、上 62)→ 標題列 100px;正常 852 → 不動;狀態列佔上面(上 0)→ topbar 不動;iPad 視窗、瀏覽器 → 不動;截圖標題列往下、輸入框貼底;設定 › 更新 › 畫面那行和量尺都畫對(換程式後要開兩次,第一次是 service worker 存著的舊頁面)。 未驗證: 真的 iPhone(無頭 Chrome 不是 iOS 主畫面 App:霧面多深、系統那條的顏色從哪來、下面那條網頁到底畫不畫得到、鍵盤重排有沒有用,都要 Jenny 的手機實測+量尺截圖);帳號伺服器還沒更新——Jenny 的手機頁面是 ai 上的帳號伺服器發的,現在還是 11/20 22:25 那版(5676341),要 make update-server 才會換上。 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm --- docs/feature-map/README.md | 1 + docs/feature-map/phonefit.md | 34 +++++++++++ mobile/index.html | 109 ++++++++++++++++++++++++++++++++++- src/featuremap.rs | 1 + 4 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 docs/feature-map/phonefit.md diff --git a/docs/feature-map/README.md b/docs/feature-map/README.md index 76a9eb2..2553db5 100644 --- a/docs/feature-map/README.md +++ b/docs/feature-map/README.md @@ -110,6 +110,7 @@ Bot 讀得到的是開頭、子功能、使用者怎麼到、Bot 那一行和沒 - [apps](apps.md):Mac 的郵件、備忘錄、訊息,電話、簡訊、X、手機的行事曆與聯絡人。 - [channels](channels.md):Slack、Discord、Telegram、Teams。 - [phone](phone.md):手機頁面、手機上的卡、長相與顏色、裝成 App。 +- [phonefit](phonefit.md):手機畫面貼齊:主畫面 App 自己量螢幕,iOS 少給下面一條時讓開上面的霧面、不重複留底;鍵盤收起沒長回來就重排;設定 › 更新 › 畫面的量尺。 - [account](account.md):AnyBot 帳號、備份、大腦、同一個網路直接連、推播通知。 ### 管住它、調整它 diff --git a/docs/feature-map/phonefit.md b/docs/feature-map/phonefit.md new file mode 100644 index 0000000..294f7d7 --- /dev/null +++ b/docs/feature-map/phonefit.md @@ -0,0 +1,34 @@ +# 手機畫面貼齊 + +加到主畫面的 AnyBot 要從螢幕最上面到最下面都是自己的:不被切到、不被霧面蓋到、下面不空一塊。每支 iPhone、每個 iOS 版本給網頁的空間不一樣,所以手機頁面打開時自己量,照量到的排,不靠一個寫死的數字。 + +## 子功能 + +- `phonefit-measure` 量:打開、回到前面、轉向、離開輸入框時,比螢幕高度、這頁看得到的高度和上下留白(狀態列、底部手勢條)。只看 iPhone 加入主畫面的 App;iPad、瀏覽器裡的不動。 +- `phonefit-short` iOS 少給下面一條(iOS 26.1、26.5 以後、27;WebKit 問題 301994):看得到的比螢幕少一個狀態列高,那條由系統畫、網頁畫不到,上面還多一層霧面。這時標題列往下讓開霧面(上面留白改成狀態列的 1.55 倍),底部不再多留手勢條的空間(它已經在系統那條裡),輸入框底下的顏色改成跟頁面一樣(系統那條也是這個顏色)。狀態列佔了上面的那種(上面留白是 0)不動。 +- `phonefit-keyboard` 鍵盤收起後畫面沒長回來(iOS 主畫面 App 的老問題,要關掉 App 才好):離開輸入框 0.14 秒後還比量過最高的矮,就把整頁重新排一次(捲到哪裡留著),再量一次。 +- `phonefit-ruler` 設定 › 更新 ›「這支手機」›「畫面」:一行寫量到的——螢幕寬×高、看得到多高、上/下留白、是哪一種、iOS 版本、主畫面 App 還是瀏覽器。點了打開量尺:上面、下面每 10 一格的刻度,中間是那幾個數字,頁面底下外面一條紅色(看得到=下面那條也能畫);點一下關掉。 + +## 使用者怎麼到 + +- iPhone:Safari 分享 ›「加入主畫面」,從主畫面打開;量是自動的。 +- 設定(帳戶選單)›「更新」›「畫面」。 + +## 怎麼操作(verify-anybot) + +- Bot:沒有專門的工具;使用者說手機畫面被切到、上面糊糊的、下面空一塊,請他到 設定 › 更新 ›「畫面」打開量尺截圖。 + +前提: + +- 基本前提和「手機已登入」(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)。 +- **量尺**(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::`。 + +## 陷阱 + +- 下面那條是系統畫的,網頁畫不到:只能讓顏色一樣,輸入框不會跑進去(不切到)。 +- 霧面往下多深是量 iPhone 15 Pro 的截圖估的(狀態列的 1.55 倍);別的機型、別的 iOS 版本用量尺確認後再調。 +- 用帳號連線時,手機頁面是帳號伺服器發的:改了要更新帳號伺服器;更新後第一次打開還是存著的舊頁面,再打開一次才換新的。 diff --git a/mobile/index.html b/mobile/index.html index 365d79d..810ba38 100644 --- a/mobile/index.html +++ b/mobile/index.html @@ -532,7 +532,7 @@ textarea.field{min-height:96px;line-height:1.5} .fmedia{padding:28px 18px;display:grid;gap:12px;place-items:center} .fmedia audio,.fmedia video{width:100%;max-width:560px;border-radius:var(--r-m)} .fdl{display:grid;place-items:center;gap:14px;padding:64px 24px;color:var(--text2);text-align:center;line-height:1.6} -.pager{display:flex;align-items:center;justify-content:center;gap:14px;padding:8px 12px;padding-bottom:max(8px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--pane);flex:none} +.pager{display:flex;align-items:center;justify-content:center;gap:14px;padding:8px 12px;padding-bottom:max(8px,var(--safe-b));border-top:1px solid var(--line);background:var(--pane);flex:none} .pager span{font-size:var(--fs-small);color:var(--text2);min-width:72px;text-align:center} .boxwrap{position:fixed;inset:0;z-index:50;background:var(--stage);display:none} .boxwrap iframe{width:100%;height:100%;border:0;display:block} @@ -578,6 +578,14 @@ textarea.field{min-height:96px;line-height:1.5} .pair-line{display:block;font:var(--fs-caption)/1.5 var(--mono);background:var(--hover);padding:10px;border-radius:var(--r-m);margin:6px 16px;word-break:break-all} /* ---- feels installed (a PWA on every phone) ---- */ :root{--safe-l:env(safe-area-inset-left,0px);--safe-r:env(safe-area-inset-right,0px)} +/* 頂天立地 (fit() below): on an iPhone that gives a home-screen app a status bar less at the bottom + (the system draws that strip, in the page's colour), what meets it is the page's colour too. */ +html.fit-short .dock{background:linear-gradient(to bottom,transparent,var(--pane) 40%)} +html.fit-short .tools{background:var(--pane)} +/* 畫面量尺 (設定 › 更新 › 畫面): where the frost ends at the top, where the page ends at the bottom. */ +#ruler{position:fixed;inset:0;z-index:99;background:color-mix(in srgb,var(--pane) 55%,transparent);font:var(--fs-caption)/1.3 var(--font);color:var(--text)} +#ruler .info{position:absolute;left:16px;right:16px;top:40%;transform:translateY(-50%);background:var(--elev);border:1px solid var(--line);border-radius:var(--r-l);padding:14px 16px;white-space:pre-wrap} +#ruler .past{position:absolute;left:0;right:0;bottom:-80px;height:80px;background:var(--danger);color:var(--on-color);display:grid;place-items:center;font-weight:600} /* No font inflation when the phone turns sideways. */ html{-webkit-text-size-adjust:100%;text-size-adjust:100%} /* A phone on its side with a notch: every screen paints edge to edge, its content stays clear of it. */ @@ -3247,8 +3255,11 @@ function drawSettings(kind, quiet) { if (kind === "updates") { h += group("", item({icon: "info", k: "版本", v: st.built ? `${stamp(st.built)} 建置` : "", r: st.version || ""}) + (st.newer ? item({icon: "download", k: "有新版", v: "電腦上的 AnyBot 已經下載新版,重新啟動就會換上"}) : item({icon: "circle-check", k: "已是最新版"}))); h += `
Bot 的電腦的更新在「電腦」裡。
`; + h += group("這支手機", item({icon: "smartphone", k: "畫面", v: fitWords(), tap: 1, data: 'data-ruler="1"'})); + h += `
畫面看起來被切到、上面糊糊的、下面空一塊時,按「畫面」打開量尺截圖給我們。
`; } el.innerHTML = h + `
`; + el.querySelectorAll("[data-ruler]").forEach((x) => x.onclick = ruler); if (quiet) el.scrollTop = sc; wireSettings(kind, st); } @@ -4378,6 +4389,102 @@ if ("serviceWorker" in navigator) navigator.serviceWorker.addEventListener("mess } if (d.bot && S.token) go("chat", {bot: +d.bot}); else if (d.bot) S.open = +d.bot; }); +// ── 頂天立地: what the phone really gives the page, measured (no one CSS value is right on every iOS) ── +// · Most phones and iOS versions: the whole screen, drawn under a clear status bar — nothing to do. +// · iOS 26.1, 26.5 and later, 27 (WebKit bug 301994): a home-screen app still starts under the +// status bar but is a status bar short at the bottom — the system draws that strip, the page +// can't — and a frosted system bar lies over the top (measured on an iPhone 15 Pro: down to +// about the status bar and a half). Then the header moves below the frost, the home-indicator +// room isn't added again (it is inside the system's strip), and what meets the strip is the +// page's colour. +// · The status bar taking its room at the top (the inset is 0 then): nothing to do. +// · The keyboard bug (after the first keyboard the page stays a status bar short until the app is +// closed): when a text box lets go the page is laid out again once (that undoes it), then measured. +// (window.FIT_TEST stands in for the phone in the scratch checks: {iphone, standalone, screenW, +// screenH, innerH, safeT, safeB}.) +const FIT = {mode: "", lost: 0, safeT: 0, safeB: 0, screenW: 0, screenH: 0, innerH: 0, tallest: {}, healed: 0}; +function insets() { + const p = document.createElement("div"); + p.style.cssText = "position:fixed;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)"; + document.body.appendChild(p); + const cs = getComputedStyle(p), v = [parseFloat(cs.paddingTop) || 0, parseFloat(cs.paddingBottom) || 0]; + p.remove(); + return v; +} +function fit() { + if (!document.body) return; + const T = window.FIT_TEST || {}; + const iphone = T.iphone ?? /iPhone/.test(navigator.userAgent); + const standalone = T.standalone ?? installed(); + const [safeT, safeB] = T.safeT != null ? [T.safeT, T.safeB || 0] : insets(); + const sw = T.screenW ?? screen.width, sh = T.screenH ?? screen.height; + const landscape = matchMedia("(orientation: landscape)").matches; + const screenH = landscape ? Math.min(sw, sh) : Math.max(sw, sh), innerH = T.innerH ?? innerHeight; + const key = landscape ? "l" : "p"; + FIT.tallest[key] = Math.max(FIT.tallest[key] || 0, innerH); + // Only an iPhone's home-screen app, and only about a status bar's worth (an iPad in a window + // is much shorter than its screen, and that is not this). + const lost = iphone && standalone ? Math.round(screenH - innerH) : 0; + 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"); + root.style.setProperty("--safe-b", Math.max(0, Math.round(safeB - lost)) + "px"); + root.classList.add("fit-short"); + } else { + root.style.removeProperty("--safe-t"); + root.style.removeProperty("--safe-b"); + root.classList.remove("fit-short"); + } + Object.assign(FIT, {mode, lost, safeT, safeB, screenW: landscape ? Math.max(sw, sh) : Math.min(sw, sh), screenH, innerH}); +} +// A text box let go: the keyboard bug leaves the page short — laid out again once, scroll kept. +function heal() { + const app = document.querySelector(".app"); + if (!app) return; + const keep = [...document.querySelectorAll(".scroll")].map((x) => [x, x.scrollTop]); + app.style.display = "none"; void app.offsetHeight; app.style.display = ""; + keep.forEach(([x, y]) => { x.scrollTop = y; }); + FIT.healed++; +} +document.addEventListener("focusout", (e) => { + if (!e.target || !e.target.matches || !e.target.matches("input,textarea,[contenteditable]")) return; + setTimeout(() => { + const key = matchMedia("(orientation: landscape)").matches ? "l" : "p"; + if (installed() && innerHeight < (FIT.tallest[key] || 0) - 4) heal(); + requestAnimationFrame(fit); + }, 140); +}); +addEventListener("resize", fit); +addEventListener("orientationchange", () => setTimeout(fit, 300)); +addEventListener("pageshow", fit); +document.addEventListener("visibilitychange", () => { if (!document.hidden) fit(); }); +fit(); +// 設定 › 更新 › 畫面: what was measured, in words. +function fitWords() { + const f = FIT, ios = (navigator.userAgent.match(/OS (\d+)_(\d+)/) || []).slice(1).join("."); + const what = f.mode === "short" ? `iOS 少給了下面 ${f.lost} pt(系統自己畫),上面讓開霧面` : f.mode === "topbar" ? `狀態列佔了上面 ${f.lost} pt` : "整個螢幕都是 AnyBot 的"; + return `${f.screenW}×${f.screenH},看得到 ${f.innerH};上 ${f.safeT}/下 ${f.safeB};${what}${ios ? `;iOS ${ios}` : ""}${installed() ? ";主畫面 App" : ";瀏覽器"}`; +} +// The ruler: tick marks every 10 pt from the top and from the bottom, the numbers in the middle, +// and a red band just past the page's bottom (seen: the strip below can be drawn on). A tap closes it. +function ruler() { + const old = $("ruler"); + if (old) { old.remove(); return; } + fit(); + const r = document.createElement("div"); + r.id = "ruler"; + let h = ""; + // (Every mark in its own inline style: nothing else on the page may size it.) + 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 += `
看到這條紅色=最下面還能畫
`; + r.innerHTML = h; + r.onclick = () => r.remove(); + document.body.appendChild(r); +} // iOS: the keyboard floats over the page instead of shrinking it; measure it and lift the composer. if (window.visualViewport) { const kb = () => { diff --git a/src/featuremap.rs b/src/featuremap.rs index 65af9b1..2ea1f8f 100644 --- a/src/featuremap.rs +++ b/src/featuremap.rs @@ -63,6 +63,7 @@ pub const AREAS: &[Area] = &[ area!("apps", "Mac App 與電話"), area!("channels", "訊息管道"), area!("phone", "手機頁面"), + area!("phonefit", "手機畫面貼齊"), area!("account", "帳號與直接連線"), area!("safety", "安全與核准"), area!("sandbox", "安全規則與沙盒"),