This commit is contained in:
33333-33333 2026-06-21 16:26:12 +09:00
commit 0b9ff1363b
45 changed files with 680 additions and 890 deletions

View file

@ -274,7 +274,23 @@ function bindUI() {
document.body.classList.toggle("mobile-mode-tool", mode === "tool");
document.body.classList.toggle("mobile-mode-family", mode === "family");
};
const updateTouchMobileUiClass = () => {
const ua = String(navigator.userAgent || "");
const coarse = Boolean(window.matchMedia && window.matchMedia("(pointer: coarse)").matches);
const noHover = Boolean(window.matchMedia && window.matchMedia("(hover: none)").matches);
const touchPoints = Number(navigator.maxTouchPoints || 0);
const w = window.innerWidth || 9999;
const h = window.innerHeight || 9999;
const mobileUa = /Android|iPhone|iPod|Mobile|Silk/i.test(ua);
const compactPhoneViewport = Math.min(w, h) <= 640 && Math.max(w, h) <= 980;
const enabled = Boolean(coarse && noHover && touchPoints > 0 && compactPhoneViewport && mobileUa);
document.body.classList.toggle("touch-mobile-ui", enabled);
if (ui.mobileModeControls) ui.mobileModeControls.hidden = !enabled;
};
const mobileInputMode = () => uiCache.mobileInputMode || "auto";
updateTouchMobileUiClass();
window.addEventListener("resize", updateTouchMobileUiClass, { passive: true });
window.matchMedia?.("(pointer: coarse)")?.addEventListener?.("change", updateTouchMobileUiClass);
setMobileInputMode(uiCache.mobileInputMode || "auto");
ui.mobileModeControls?.addEventListener("click", (e) => {
const btn = e.target.closest("[data-mobile-mode]");