fix: view-level webview scale, close menu on outside tap/page switch

This commit is contained in:
2026-08-17 20:16:32 +08:00
parent 69bd90d23a
commit a1b65ad4c6
3 changed files with 21 additions and 6 deletions
@@ -174,3 +174,11 @@ window.HearthEvents.webappUpdated = function () {
if (page.classList.contains('active')) window.loadWebAppList();
}
};
// 点击菜单外部关闭长按菜单(touchstart 更及时,移动端可靠)
// Close the long-press menu when tapping outside (touchstart fires promptly on mobile)
document.addEventListener('touchstart', (e) => {
document.querySelectorAll('.wapp-menu').forEach((m) => {
if (!m.contains(e.target)) m.remove();
});
}, { passive: true });
+3
View File
@@ -36,6 +36,9 @@ const router = {
// 移除 webapp-activewebapp 已丢后台,恢复 webapp 列表显示
// Remove webapp-active: the webapp is backgrounded, restore the list display
document.body.classList.remove('webapp-active');
// 关闭长按菜单(切页时)
// Close the long-press menu on page switch
document.querySelectorAll('.wapp-menu').forEach((m) => m.remove());
// 非首页时侧边栏顶部显示小时间(容器始终占位,仅切换可见性避免撑动图标)
// Show the small clock at the sidebar top when not on home (the container
// always occupies space; only toggle visibility to avoid shifting icons)