ZHIWEI666 commited on
Commit
611b39c
·
verified ·
1 Parent(s): f1b05a2

Upload 2 files

Browse files
移动端网页/index.html CHANGED
@@ -2,11 +2,11 @@
2
  <html lang="zh-CN">
3
  <head>
4
  <meta charset="UTF-8">
5
- <!-- 📱 移动端视口:禁止双击缩放,适配刘海屏安全区 -->
6
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover">
7
  <!-- 空 icon 链接:抑制浏览器默认 favicon 请求产生的 404 -->
8
  <link rel="icon" href="data:,">
9
- <title>ComfyUI 社区精选</title>
10
  <style>
11
  /* 🎨 补齐 ComfyUI 同名 CSS 变量(前端组件统一引用这些变量渲染暗色主题) */
12
  :root {
@@ -30,6 +30,8 @@
30
  display: flex;
31
  flex-direction: column;
32
  }
 
 
33
  </style>
34
  <!-- ⚠️ 必须在任何 ES Module 求值前置位 Web 模式标记(全局配置.js 的 IS_WEB_MODE 在模块加载时读取) -->
35
  <script>window.__RANKING_WEB_MODE__ = true;</script>
 
2
  <html lang="zh-CN">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <!-- 📱 移动端视口与安全区 -->
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
7
  <!-- 空 icon 链接:抑制浏览器默认 favicon 请求产生的 404 -->
8
  <link rel="icon" href="data:,">
9
+ <title>ComfyUI</title>
10
  <style>
11
  /* 🎨 补齐 ComfyUI 同名 CSS 变量(前端组件统一引用这些变量渲染暗色主题) */
12
  :root {
 
30
  display: flex;
31
  flex-direction: column;
32
  }
33
+ #hub-web-root .web-startup-error { padding: 2.5rem; text-align: center; color: var(--rk-danger, #ef5350); font: inherit; line-height: 1.5; }
34
+ @media (forced-colors: active) { #hub-web-root .web-startup-error { color: CanvasText; } }
35
  </style>
36
  <!-- ⚠️ 必须在任何 ES Module 求值前置位 Web 模式标记(全局配置.js 的 IS_WEB_MODE 在模块加载时读取) -->
37
  <script>window.__RANKING_WEB_MODE__ = true;</script>
移动端网页/web_main.js CHANGED
@@ -1,23 +1,24 @@
1
- // 云端Space代码/移动端网页/web_main.js
2
- // ==========================================
3
- // 📱 移动端网页版引导模块
4
- // ==========================================
5
- // 复用 /m/assets/ 下的共享前端(与本地 ComfyUI 侧边栏同一套代码),
6
- // 直接调用主程序构建 DOM,不经过 侧边栏入口注册.js(该文件依赖 ComfyUI 扩展 API)。
7
- // window.__RANKING_WEB_MODE__ 已由 index.html 内联脚本在模块求值前置位。
8
- // ==========================================
9
-
10
- import { buildSidebarDOM } from "/m/assets/core/侧边栏主程序.js";
11
 
12
  const root = document.getElementById("hub-web-root");
 
 
 
 
 
 
 
 
 
 
13
  try {
14
- const dom = await buildSidebarDOM();
15
- root.appendChild(dom);
16
- } catch (e) {
17
- console.error("移动端网页加载失败:", e);
18
  const tip = document.createElement('div');
19
- tip.style.cssText = "text-align:center; padding:40px; color:#F44336;";
20
- tip.textContent = '⚠️ 加载失败,请刷新重试';
21
- root.textContent = '';
22
- root.appendChild(tip);
23
  }
 
1
+ import { initI18n, getLanguage, t } from "/m/assets/components/用户体验_国际化.js";
 
 
 
 
 
 
 
 
 
2
 
3
  const root = document.getElementById("hub-web-root");
4
+ const syncLanguage = () => {
5
+ document.documentElement.lang = getLanguage();
6
+ document.title = `ComfyUI ${t('nav.community')}`;
7
+ const error = root.querySelector('.web-startup-error');
8
+ if (error) error.textContent = t('common.sidebar_load_failed');
9
+ };
10
+ initI18n();
11
+ syncLanguage();
12
+ document.addEventListener('comfy-language-change', syncLanguage);
13
+
14
  try {
15
+ const { buildSidebarDOM } = await import("/m/assets/core/侧边栏主程序.js");
16
+ root.appendChild(await buildSidebarDOM());
17
+ } catch {
18
+ console.error("移动端网页加载失败");
19
  const tip = document.createElement('div');
20
+ tip.className = 'web-startup-error';
21
+ tip.setAttribute('role', 'alert');
22
+ tip.textContent = t('common.sidebar_load_failed');
23
+ root.replaceChildren(tip);
24
  }