修手機聊天整個畫不出來(日程新加的 dayLabel 蓋掉聊天的同名函式);加測試擋住手機頁面重複的名字;聊天裡的流程圖畫成圖;手機的圖表(SVG)不再破圖。

- 嚴重:89fb6a5(手機日程)在 mobile/index.html 新加了 function dayLabel(d, today),跟聊天畫「今天/昨天」分隔線的 dayLabel(ms) 同名;同一個全域、後宣告的蓋掉前面,renderMsgs 一碰到有時間的訊息就丟例外,聊天只剩空白(之後幾輪的截圖沒抓到:看到的是本機先畫的那一則)。改名 schedDay。
- 防再犯:remote::tests::the_phone_page_names_each_thing_once 掃 mobile/index.html 頂層的 function/const/let,同一個名字只准一次(把 schedDay 改回 dayLabel 會失敗:declared more than once: ["dayLabel"])。
- 聊天的流程圖:新 POST api/diagram {src, dark}(用 diagram::svg,跟頁面的圖同一個畫法;空的或超過 2 萬字回 400;團隊成員也可以,只畫圖不讀任何東西);手機的 pageMd 遇到 ```mermaid(聊天裡 id 是 0)放一格,畫好換成圖,畫不出來顯示原始碼;renderMsgs 畫完有圖就叫 loadCharts。
- 圖表破圖:safeBlob 為了安全把 SVG 當成下載檔,<img> 顯示不出來——頁面的圖原本就這樣。新 chartUrl:SVG 只做成 <img> 用的 SVG 圖片(<img> 裡不跑任何程式),其他照 safeBlob。

已驗證: cargo test 883 個、relay 27 個全過;scratch 手機:打開聊天,7 則訊息、1 條「今天」分隔線都畫出來;Bot 回一張 ```mermaid,聊天裡出現 266×337 的圖(之前是破圖、再之前是整個聊天空白)。
未驗證: 頁面裡的圖在手機上(同一個 chartUrl,沒有另外建頁面看)。經帳號連的手機要 make update-server 才是新頁面——在那之前它用的是帳號伺服器上的舊頁面,沒有這個 bug(bug 只在這個分支)。

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-22 09:56:10 +08:00
parent b594bfba4f
commit 1fcc251b0a
4 changed files with 61 additions and 7 deletions

View File

@ -2324,7 +2324,7 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
- 手機與帳號:直接連線的手機清單,可以登出別支手機; - 手機與帳號:直接連線的手機清單,可以登出別支手機;
- 更新:版本和有沒有新版。 - 更新:版本和有沒有新版。
- 個人資料與用量:見「個人資料與用量」。 - 個人資料與用量:見「個人資料與用量」。
- 手機補上的(以前只有電腦有):搜尋聊天裡的訊息和檔名;Bot 設定的「執行步驟用的模型」「思考模式」;釘選的 Bot 在 ⋯ ›「更多…」往前、往後移,分區的 ⋯「往上移/往下移」;「匯出 Bot 檔案(.anybot)」「匯出文字記錄(.md)」「匯入 Bot 檔案」(iPhone 跳分享選單,可以存到「檔案」或 AirDrop);每個 Bot 各自的草稿(切換 Bot、關掉頁面都留著,存在這支手機);程式碼塊右上的「複製」;頁面 ⋯ 的「存成檔案(.md)」。之後又補:設定 › 一般「電腦的外觀」(電腦的主題、聊天的顏色)和「其他時區…」自己打;Bot 設定技能「全選/全不選」、模型可讀長度 400K;稽核的「只看沒人看著時做的」;首頁上面一排「日程」「工作流」「檔案」(見各節)。再補:權限頁「一律放行」開關(跟 /always-approve 同一件事)和「智慧模式:卡片沒人回答時」幾秒後自己回答;聊天上方「一律放行開著」一條,擁有者可以「關閉」;一般「記憶與文件」(用意思找記憶、Bot 可以翻的資料夾);更新頁「你不在時自動更新」「園丁報告」;模型的服務網址、測試連線並取得模型清單、本機模型的看圖小幫手;設定 ›「語音」整頁;Bot 設定的備用模型、起始資料夾、自訂頭像顏色(手機自己的選色器)、語音(朗讀每個回答、聲音、速度、語言)。同一個網路直接連的手機照樣只能收緊:打開一律放行、縮短智慧模式等待、加資料夾、換起始資料夾、打開看圖小幫手都被擋,說明「請在電腦上改,或用帳號連線」。 - 手機補上的(以前只有電腦有):搜尋聊天裡的訊息和檔名;Bot 設定的「執行步驟用的模型」「思考模式」;釘選的 Bot 在 ⋯ ›「更多…」往前、往後移,分區的 ⋯「往上移/往下移」;「匯出 Bot 檔案(.anybot)」「匯出文字記錄(.md)」「匯入 Bot 檔案」(iPhone 跳分享選單,可以存到「檔案」或 AirDrop);每個 Bot 各自的草稿(切換 Bot、關掉頁面都留著,存在這支手機);程式碼塊右上的「複製」;頁面 ⋯ 的「存成檔案(.md)」。之後又補:設定 › 一般「電腦的外觀」(電腦的主題、聊天的顏色)和「其他時區…」自己打;Bot 設定技能「全選/全不選」、模型可讀長度 400K;稽核的「只看沒人看著時做的」;首頁上面一排「日程」「工作流」「檔案」(見各節)。聊天裡的流程圖(```mermaid)由大腦畫成圖(`api/diagram`,跟頁面的圖同一個畫法),畫不出來時顯示原始碼;圖表的 SVG 只放在 <img> 裡顯示(以前被當成下載檔,頁面和聊天的圖都破圖)。再補:權限頁「一律放行」開關(跟 /always-approve 同一件事)和「智慧模式:卡片沒人回答時」幾秒後自己回答;聊天上方「一律放行開著」一條,擁有者可以「關閉」;一般「記憶與文件」(用意思找記憶、Bot 可以翻的資料夾);更新頁「你不在時自動更新」「園丁報告」;模型的服務網址、測試連線並取得模型清單、本機模型的看圖小幫手;設定 ›「語音」整頁;Bot 設定的備用模型、起始資料夾、自訂頭像顏色(手機自己的選色器)、語音(朗讀每個回答、聲音、速度、語言)。同一個網路直接連的手機照樣只能收緊:打開一律放行、縮短智慧模式等待、加資料夾、換起始資料夾、打開看圖小幫手都被擋,說明「請在電腦上改,或用帳號連線」。
- 看電腦畫面: - 看電腦畫面:
- 「Bot 的電腦」每秒更新一次畫面;在休眠時按「叫醒」。 - 「Bot 的電腦」每秒更新一次畫面;在休眠時按「叫醒」。
- 「這台 Mac」要先在設定裡打開才會出現。 - 「這台 Mac」要先在設定裡打開才會出現。

View File

@ -4,7 +4,7 @@
## 子功能 ## 子功能
- `phone-pages` 頁面:Bot 清單(分區、工作中/等你)、聊天(附檔、拍照、語音輸入、插話、停止;叫醒 Bot 的訊息上方標是什麼叫醒的;各 Bot 自己的草稿;程式碼塊的「複製」)、允許請求卡片(「一律允許」「允許一次」、「這輪都准」(智慧模式,一直開著;它是主按鈕)、「拒絕」、「全部允許,之後直接操作」;卡片太高時卡在內面自己捲,輸入框不會被頂出螢幕)、問題卡、「需要處理」與接管、Bot 設定、例行任務(詳細頁有最近幾次執行和送出證據)、頁面、記憶、檔案預覽、Bot 的電腦畫面、設定(一般、個人資料與用量、模型、權限、整合、電腦、保險庫、語音、手機與帳號、更新;開著的設定頁跟著電腦那邊的改變重讀,不用重新整理;直接連線只能收緊、不能放寬,見 [autonomy](autonomy.md))、傳送到其他裝置。智慧模式一直開著,輸入列沒有它的晶片。 - `phone-pages` 頁面:Bot 清單(分區、工作中/等你)、聊天(附檔、拍照、語音輸入、插話、停止;叫醒 Bot 的訊息上方標是什麼叫醒的;各 Bot 自己的草稿;程式碼塊的「複製」;流程圖畫成圖)、允許請求卡片(「一律允許」「允許一次」、「這輪都准」(智慧模式,一直開著;它是主按鈕)、「拒絕」、「全部允許,之後直接操作」;卡片太高時卡在內面自己捲,輸入框不會被頂出螢幕)、問題卡、「需要處理」與接管、Bot 設定、例行任務(詳細頁有最近幾次執行和送出證據)、頁面、記憶、檔案預覽、Bot 的電腦畫面、設定(一般、個人資料與用量、模型、權限、整合、電腦、保險庫、語音、手機與帳號、更新;開著的設定頁跟著電腦那邊的改變重讀,不用重新整理;直接連線只能收緊、不能放寬,見 [autonomy](autonomy.md))、傳送到其他裝置。智慧模式一直開著,輸入列沒有它的晶片。
- `phone-cards` 手機上的卡(允許、需要處理、問題卡)只答它畫出來的那一張:那張已經在電腦或另一支手機上回答、被停止、或換成下一張時,按了不算,聊天裡寫「手機上的回答沒有用上…」;開了很久沒重新整理的舊頁面也一樣。螢幕電腦上的卡也是;比大腦舊的螢幕電腦答不了任何卡,要在那台 設定 › 更新 換新版(重新整理沒用)。支線的卡沒用上時,寫在主線的聊天。 - `phone-cards` 手機上的卡(允許、需要處理、問題卡)只答它畫出來的那一張:那張已經在電腦或另一支手機上回答、被停止、或換成下一張時,按了不算,聊天裡寫「手機上的回答沒有用上…」;開了很久沒重新整理的舊頁面也一樣。螢幕電腦上的卡也是;比大腦舊的螢幕電腦答不了任何卡,要在那台 設定 › 更新 換新版(重新整理沒用)。支線的卡沒用上時,寫在主線的聊天。
- `phone-look` 長相(和電腦版同一份設計規格:字級、間距、圓角都是同一組數字):Bot 的回答不放在泡泡裡,像文件一樣直接排在畫面上,跟介面同一種字(iPhone 是 SF Pro 加蘋方)、16px、行距寬;裡面的表格只有橫向細線、數字欄靠右,提示框([!NOTE] 等)同一種淡底、只有圖示依種類上色,程式碼是淡底圓角塊。標題用半粗體。手機沒有字型選項。 - `phone-look` 長相(和電腦版同一份設計規格:字級、間距、圓角都是同一組數字):Bot 的回答不放在泡泡裡,像文件一樣直接排在畫面上,跟介面同一種字(iPhone 是 SF Pro 加蘋方)、16px、行距寬;裡面的表格只有橫向細線、數字欄靠右,提示框([!NOTE] 等)同一種淡底、只有圖示依種類上色,程式碼是淡底圓角塊。標題用半粗體。手機沒有字型選項。
- `phone-colors` 顏色跟電腦版一樣:電腦上 設定 › 一般 › 外觀 的主題(淺色/深色/跟隨系統)、底色、強調色、對比,手機照著穿;手機自己的「外觀」可以選「跟著電腦」(預設)、「跟著手機」、「淺色」、「深色」。狀態列的顏色跟著畫面。舊版的電腦沒送顏色時,手機用內建的「紙」。 - `phone-colors` 顏色跟電腦版一樣:電腦上 設定 › 一般 › 外觀 的主題(淺色/深色/跟隨系統)、底色、強調色、對比,手機照著穿;手機自己的「外觀」可以選「跟著電腦」(預設)、「跟著手機」、「淺色」、「深色」。狀態列的顏色跟著畫面。舊版的電腦沒送顏色時,手機用內建的「紙」。

View File

@ -2288,6 +2288,8 @@ function renderMsgs() {
h += `<div class="m user sending${x.failed ? " failed" : ""}${held ? " held" : ""}" data-unsent="${esc(x.id)}">${x.text ? `<div class="bub">${esc(x.text)}</div>` : ""}${names}<div class="sn">${said}</div></div>`; h += `<div class="m user sending${x.failed ? " failed" : ""}${held ? " held" : ""}" data-unsent="${esc(x.id)}">${x.text ? `<div class="bub">${esc(x.text)}</div>` : ""}${names}<div class="sn">${said}</div></div>`;
}); });
$("msgs").innerHTML = h; $("msgs").innerHTML = h;
// (Diagrams in the answers: drawn by the brain once they are on the page.)
if ($("msgs").querySelector(".chart[data-mermaid]")) loadCharts();
renderSendBtn(); renderSendBtn();
loadFiles(); loadFiles();
seenWatch(); seenWatch();
@ -3465,7 +3467,7 @@ async function listSchedule(el) {
S.sched = v; S.sched = v;
drawSchedule(el); drawSchedule(el);
} }
function dayLabel(d, today) { function schedDay(d, today) {
const [y, m, dd] = d.split("-").map(Number), t = new Date(y, m - 1, dd), [ty, tm, td] = today.split("-").map(Number); const [y, m, dd] = d.split("-").map(Number), t = new Date(y, m - 1, dd), [ty, tm, td] = today.split("-").map(Number);
const diff = Math.round((t - new Date(ty, tm - 1, td)) / 864e5); const diff = Math.round((t - new Date(ty, tm - 1, td)) / 864e5);
const wd = "日一二三四五六"[t.getDay()]; const wd = "日一二三四五六"[t.getDay()];
@ -3475,7 +3477,7 @@ function drawSchedule(el) {
const v = S.sched || {}, items = v.items || [], today = v.today || ""; const v = S.sched || {}, items = v.items || [], today = v.today || "";
const row = (i, showDay) => { const row = (i, showDay) => {
const b = bot(i.bot) || {}, [cls, icon, word] = SCH_MARK[i.status] || ["", "clock", ""]; const b = bot(i.bot) || {}, [cls, icon, word] = SCH_MARK[i.status] || ["", "clock", ""];
const right = showDay ? (i.day === today ? "今天 " : dayLabel(i.day, today).replace(/(.)$/, "") + " ") + i.clock : word; const right = showDay ? (i.day === today ? "今天 " : schedDay(i.day, today).replace(/(.)$/, "") + " ") + i.clock : word;
return `<button class="item sch ${cls}" data-sch="${i.kind}:${i.id}:${i.bot}"><span class="sch-t">${showDay ? `<span class="av sm">${b.shape ? avatarSvg(b.shape, b.color) : ic("workflow", 14)}</span>` : esc(i.clock)}</span><div class="mid"><div class="k">${i.kind === "workflow" ? ic("workflow", 13) + " " : ""}${esc(i.title)}</div><div class="v">${esc((showDay ? "" : (b.name ? b.name + " · " : "")) + i.when)}</div></div><div class="r ${cls}">${showDay ? esc(right) : ic(icon, 16) + (word ? " " + esc(word) : "")}</div></button>`; return `<button class="item sch ${cls}" data-sch="${i.kind}:${i.id}:${i.bot}"><span class="sch-t">${showDay ? `<span class="av sm">${b.shape ? avatarSvg(b.shape, b.color) : ic("workflow", 14)}</span>` : esc(i.clock)}</span><div class="mid"><div class="k">${i.kind === "workflow" ? ic("workflow", 13) + " " : ""}${esc(i.title)}</div><div class="v">${esc((showDay ? "" : (b.name ? b.name + " · " : "")) + i.when)}</div></div><div class="r ${cls}">${showDay ? esc(right) : ic(icon, 16) + (word ? " " + esc(word) : "")}</div></button>`;
}; };
let h = group("即將執行", (v.coming || []).map((i) => row(i, true)).join("") || `<div class="note" style="padding:12px 16px">接下來兩週沒有排定的事</div>`); let h = group("即將執行", (v.coming || []).map((i) => row(i, true)).join("") || `<div class="note" style="padding:12px 16px">接下來兩週沒有排定的事</div>`);
@ -3485,7 +3487,7 @@ function drawSchedule(el) {
for (const d of days) { for (const d of days) {
const list = items.filter((i) => i.day === d); const list = items.filter((i) => i.day === d);
if (!list.length && d !== today) continue; if (!list.length && d !== today) continue;
h += group(dayLabel(d, today), list.map((i) => row(i, false)).join("") || `<div class="note" style="padding:12px 16px">這一天沒有排定的事</div>`); h += group(schedDay(d, today), list.map((i) => row(i, false)).join("") || `<div class="note" style="padding:12px 16px">這一天沒有排定的事</div>`);
} }
h += `<div class="note">只放排程或事件自己跑的;你按的「立即執行」在各自的執行紀錄裡。新增:在聊天裡跟 Bot 說「每天早上 9 點幫我…」。</div><div style="height:calc(var(--safe-b) + 24px)"></div>`; h += `<div class="note">只放排程或事件自己跑的;你按的「立即執行」在各自的執行紀錄裡。新增:在聊天裡跟 Bot 說「每天早上 9 點幫我…」。</div><div style="height:calc(var(--safe-b) + 24px)"></div>`;
const sc = el.scrollTop; const sc = el.scrollTop;
@ -4233,13 +4235,27 @@ function saveFile(path, name, att, bot) {
$("b-filesave").innerHTML = ic("download", 20); $("b-filesave").innerHTML = ic("download", 20);
$("b-filesave").onclick = () => { if (S.file) saveFile(S.file.path, S.file.name, S.file.att, S.file.bot); }; $("b-filesave").onclick = () => { if (S.file) saveFile(S.file.path, S.file.name, S.file.att, S.file.bot); };
const isDark = () => document.documentElement.dataset.theme === "dark" || (!document.documentElement.dataset.theme && matchMedia("(prefers-color-scheme: dark)").matches); const isDark = () => document.documentElement.dataset.theme === "dark" || (!document.documentElement.dataset.theme && matchMedia("(prefers-color-scheme: dark)").matches);
// A drawn chart as a picture: an SVG kept as an SVG image — only ever shown in an <img>, where it
// runs nothing (safeBlob turns SVG into a download, so the picture showed broken).
async function chartUrl(r) {
if (/^image\/svg\+xml/i.test(r.headers.get("Content-Type") || "")) return URL.createObjectURL(new Blob([await r.text()], {type: "image/svg+xml"}));
return URL.createObjectURL(await safeBlob(r));
}
async function loadCharts() { async function loadCharts() {
for (const el of document.querySelectorAll(".chart[data-mermaid]")) {
const src = el.dataset.mermaid; el.removeAttribute("data-mermaid");
try {
const r = await api(base() + "api/diagram", {json: {src, dark: isDark()}, raw: true});
if (!r.ok) throw new Error();
el.innerHTML = `<img alt="圖表" src="${await chartUrl(r)}">`;
} catch (_) { el.innerHTML = `<pre><code>${esc(src)}</code></pre>`; }
}
for (const el of document.querySelectorAll(".chart[data-src]")) { for (const el of document.querySelectorAll(".chart[data-src]")) {
const src = el.dataset.src; el.removeAttribute("data-src"); const src = el.dataset.src; el.removeAttribute("data-src");
try { try {
const r = await api(base() + src + (src.includes("?") ? "&" : "?") + "dark=" + (isDark() ? 1 : 0), {raw: true}); const r = await api(base() + src + (src.includes("?") ? "&" : "?") + "dark=" + (isDark() ? 1 : 0), {raw: true});
if (!r.ok) throw new Error(); if (!r.ok) throw new Error();
el.innerHTML = `<img alt="圖表" src="${URL.createObjectURL(await safeBlob(r))}">`; el.innerHTML = `<img alt="圖表" src="${await chartUrl(r)}">`;
} catch (_) { el.innerHTML = `<div class="wait">這張圖畫不出來</div>`; } } catch (_) { el.innerHTML = `<div class="wait">這張圖畫不出來</div>`; }
} }
} }
@ -4509,6 +4525,8 @@ function pageMd(text, id, rev) {
while (i < L.length && !L[i].trim().startsWith("```")) body.push(L[i++]); while (i < L.length && !L[i].trim().startsWith("```")) body.push(L[i++]);
i++; i++;
if (lang === "mermaid" && id) { out.push(`<div class="chart" data-src="api/pages/${id}/chart/${chart++}${rev ? "?rev=" + rev : ""}"><div class="wait">圖表載入中…</div></div>`); continue; } if (lang === "mermaid" && id) { out.push(`<div class="chart" data-src="api/pages/${id}/chart/${chart++}${rev ? "?rev=" + rev : ""}"><div class="wait">圖表載入中…</div></div>`); continue; }
// (A diagram in a chat: drawn by the brain from its words, as the computer draws it.)
if (lang === "mermaid") { out.push(`<div class="chart" data-mermaid="${esc(body.join("\n"))}"><div class="wait">圖表載入中…</div></div>`); continue; }
// ```details <title>: folded under one quiet line (細節 without a title); the inside is the page's Markdown. // ```details <title>: folded under one quiet line (細節 without a title); the inside is the page's Markdown.
if (lang === "details") { const title = t.replace(/^```\s*details/i, "").trim() || "細節"; out.push(`<details class="dt"><summary>${esc(title)}</summary><div class="dt-in">${pageMd(body.join("\n"), id, rev)}</div></details>`); continue; } if (lang === "details") { const title = t.replace(/^```\s*details/i, "").trim() || "細節"; out.push(`<details class="dt"><summary>${esc(title)}</summary><div class="dt-in">${pageMd(body.join("\n"), id, rev)}</div></details>`); continue; }
if (lang === "chart") { const html = chartMd(body); if (html) { out.push(html); continue; } } if (lang === "chart") { const html = chartMd(body); if (html) { out.push(html); continue; } }

View File

@ -776,6 +776,19 @@ pub fn handle(req: Req, via_relay: bool) -> Resp {
out["latest"] = json!(cur.revision); out["latest"] = json!(cur.revision);
Resp::json(&out) Resp::json(&out)
} }
// A Mermaid diagram in a chat (a page's have their own path above): drawn here, the same
// way, from the words the phone holds (nothing else is read).
("POST", ["api", "diagram"]) => {
let v = req.json();
let src = v["src"].as_str().unwrap_or("");
if src.trim().is_empty() || src.len() > 20_000 {
return Resp::error(400, "這張圖太大或是空的");
}
match crate::diagram::svg(src, v["dark"].as_bool().unwrap_or(false)) {
Ok(svg) => Resp::bytes("image/svg+xml", svg.into_bytes()),
Err(e) => Resp::error(422, &e),
}
}
("GET", ["api", "pages", id, "chart", n]) => { ("GET", ["api", "pages", id, "chart", n]) => {
let id: u64 = id.parse().unwrap_or(0); let id: u64 = id.parse().unwrap_or(0);
let n: usize = n.parse().unwrap_or(0); let n: usize = n.parse().unwrap_or(0);
@ -1364,7 +1377,7 @@ pub fn role_allows(role: &str, method: &str, path: &[&str]) -> bool {
// 大腦: the owner's other AnyBots showing this one's bots. // 大腦: the owner's other AnyBots showing this one's bots.
"mirror" => sync, "mirror" => sync,
"owner" | "admin" => !device && !sync, "owner" | "admin" => !device && !sync,
"member" => matches!((method, path), ("GET", ["api", "state"]) | ("GET", ["api", "bots", _]) | ("GET", ["api", "pages", ..]) | ("GET", ["api", "file"]) | ("GET", ["api", "preview", ..]) | ("POST", ["api", "bots", _, "send" | "read" | "seen" | "upload"]) | ("POST", ["api", "voice", "transcribe" | "speech"])), "member" => matches!((method, path), ("GET", ["api", "state"]) | ("GET", ["api", "bots", _]) | ("GET", ["api", "pages", ..]) | ("GET", ["api", "file"]) | ("GET", ["api", "preview", ..]) | ("POST", ["api", "bots", _, "send" | "read" | "seen" | "upload"]) | ("POST", ["api", "voice", "transcribe" | "speech"]) | ("POST", ["api", "diagram"])),
_ => false, _ => false,
} }
} }
@ -3620,6 +3633,29 @@ pub fn page(req: &Req) -> Resp {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
/// The phone page is one file of plain scripts sharing one global scope: a function or a
/// top-level name declared twice silently replaces the first (a second `dayLabel`, for the
/// 日程, once replaced the chat's — every chat on the phone drew empty). Each name once.
#[test]
fn the_phone_page_names_each_thing_once() {
let mut seen: HashMap<String, usize> = HashMap::new();
for line in PAGE.lines() {
let l = line.strip_prefix("async ").unwrap_or(line);
let name = if let Some(r) = l.strip_prefix("function ") {
r.split('(').next()
} else if let Some(r) = l.strip_prefix("const ").or_else(|| l.strip_prefix("let ")) {
r.split([' ', '=']).next()
} else {
None
};
if let Some(n) = name.map(str::trim).filter(|n| !n.is_empty() && n.chars().all(|c| c.is_alphanumeric() || c == '_' || c == '$')) {
*seen.entry(n.to_string()).or_default() += 1;
}
}
let twice: Vec<&String> = seen.iter().filter(|(_, n)| **n > 1).map(|(k, _)| k).collect();
assert!(twice.is_empty(), "declared more than once in mobile/index.html: {twice:?}");
}
/// 虛擬觸控板 (mobile/trackpad.js): a tap clicks, one finger moves the pointer, two fingers /// 虛擬觸控板 (mobile/trackpad.js): a tap clicks, one finger moves the pointer, two fingers
/// scroll or right-click, double tap and slide drags, a long press right-clicks; the key /// scroll or right-click, double tap and slide drags, a long press right-clicks; the key
/// bar's modifiers hold for one key or lock. Run in node when it is there (the gestures are /// bar's modifiers hold for one key or lock. Run in node when it is there (the gestures are