From 180b93dded234e057fe8fc0aeeecaf348c6254ee Mon Sep 17 00:00:00 2001 From: XianYuDaXian Date: Sat, 14 Mar 2026 08:39:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20PC=E7=AB=AF=E9=9A=90=E8=97=8F=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=BB=84=E4=BB=B6=EF=BC=8CJS=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=88=A4=E6=96=AD=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=9E=84NSFW=E6=8C=89=E9=92=AE=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/public/css/imagine.css | 14 ++++++++ app/static/public/css/nsfw.css | 33 +++++++++++++++++ app/static/public/js/imagine.js | 2 ++ app/static/public/js/nsfw.js | 43 ++++++++++++++++------ app/static/public/pages/imagine.html | 4 +-- app/static/public/pages/nsfw.html | 54 +++++++++++----------------- 6 files changed, 103 insertions(+), 47 deletions(-) diff --git a/app/static/public/css/imagine.css b/app/static/public/css/imagine.css index 13bd723..d0aa7b7 100644 --- a/app/static/public/css/imagine.css +++ b/app/static/public/css/imagine.css @@ -1478,3 +1478,17 @@ html[data-theme='dark'] .im-settings-sheet { grid-row: auto !important; } } + +/* ============================ + PC 端隐藏 Imagine 移动端专属组件 + ============================ */ +.im-sticky-bar, +.im-settings-overlay { + display: none !important; +} + +@media (max-width: 900px) { + .im-sticky-bar { + display: flex !important; + } +} diff --git a/app/static/public/css/nsfw.css b/app/static/public/css/nsfw.css index 07be322..9b2dbbe 100644 --- a/app/static/public/css/nsfw.css +++ b/app/static/public/css/nsfw.css @@ -1119,3 +1119,36 @@ html[data-theme='dark'] .nsfw-settings-sheet { gap: 0; } } + +/* ============================ + PC 端隐藏移动端专属组件(默认隐藏) + ============================ */ +.nsfw-sticky-bar, +.nsfw-settings-overlay { + display: none !important; +} + +@media (max-width: 900px) { + /* Sticky Bar 移动端恢复显示 */ + .nsfw-sticky-bar { + display: flex !important; + flex-direction: column; + } + + /* 隐藏"操作"面板(按钮已由 Sticky Bar 承担) */ + .top-grid > .panel:nth-child(2) { + display: none; + } + + /* 第二行:整行始终可点击(垃圾桶不依赖选中),只文字颜色变化 */ + .nsfw-sticky-row--video { + opacity: 1 !important; + pointer-events: auto !important; + } + + /* 视频主按钮在禁用时自行淡化 */ + #imStartVideoBtn:disabled { + opacity: 0.38; + cursor: not-allowed; + } +} diff --git a/app/static/public/js/imagine.js b/app/static/public/js/imagine.js index 81a5b9d..41c1052 100644 --- a/app/static/public/js/imagine.js +++ b/app/static/public/js/imagine.js @@ -2308,6 +2308,8 @@ * 移动端 Sticky Bar 初始化 */ function initStickyBar() { + /* 移动端专属:PC 下直接退出,避免 DOM 被移动 */ + if (!window.matchMedia("(max-width: 900px)").matches) return; /* 图标按钮代理 */ const proxyMap = { imClearBtn: 'clearBtn', diff --git a/app/static/public/js/nsfw.js b/app/static/public/js/nsfw.js index 382a449..d0e49c2 100644 --- a/app/static/public/js/nsfw.js +++ b/app/static/public/js/nsfw.js @@ -1820,13 +1820,15 @@ updateVideoButtons(); /** - * NSFW 工作台 双行 Sticky Bar 初始化 + * NSFW 工作台 双行 Sticky Bar 初始化(移动端专属) */ function initNsfwStickyBar() { - /* --- 代理映射 --- */ + /* 仅移动端执行,PC 下退出避免干扰 */ + if (!window.matchMedia('(max-width: 900px)').matches) return; + + /* --- 代理映射(只代理两个垃圾桶,imNextBatchBtn 已移除) --- */ const proxyMap = { imClearImagesBtn: 'clearImagesBtn', - imNextBatchBtn: 'nextBatchBtn', imClearVideosBtn: 'clearVideosBtn', }; Object.entries(proxyMap).forEach(([sId, oId]) => { @@ -1835,7 +1837,7 @@ if (sEl && oEl) sEl.addEventListener('click', () => oEl.click()); }); - /* --- 候选图主按钮:生成6张/停止候选 --- */ + /* --- 候选图主按钮:生成6张 / 再来6张 / 停止候选 --- */ const imGenBtn = document.getElementById('imGenerateBtn'); const genPlayIcon = imGenBtn && imGenBtn.querySelector('.nsfw-btn-play'); const genStopIcon = imGenBtn && imGenBtn.querySelector('.nsfw-btn-stop'); @@ -1844,22 +1846,42 @@ function syncGenBtn() { if (!imGenBtn) return; const isRunning = generateBatchBtn && generateBatchBtn.dataset.running === '1'; + /* 判断是否已经有候选图:imageCount 不为 "0 张" */ + const hasImages = imageCount && String(imageCount.textContent || '').trim() !== '0 张'; imGenBtn.classList.toggle('is-stop', isRunning); if (genPlayIcon) genPlayIcon.style.display = isRunning ? 'none' : ''; if (genStopIcon) genStopIcon.style.display = isRunning ? '' : 'none'; - if (genLabel) genLabel.textContent = isRunning ? '停止候选' : '生成 6 张'; + if (genLabel) { + if (isRunning) { + genLabel.textContent = '停止候选'; + } else if (hasImages) { + genLabel.textContent = '再来 6 张'; + } else { + genLabel.textContent = '生成 6 张'; + } + } } if (imGenBtn) { imGenBtn.addEventListener('click', () => { const isRunning = generateBatchBtn && generateBatchBtn.dataset.running === '1'; - (isRunning ? stopBatchBtn : generateBatchBtn) && (isRunning ? stopBatchBtn : generateBatchBtn).click(); + if (isRunning) { + stopBatchBtn && stopBatchBtn.click(); + } else { + /* 再来一批 或 生成 6 张,都走 nextBatchBtn(已有图时) / generateBatchBtn(无图时) */ + const hasImages = imageCount && String(imageCount.textContent || '').trim() !== '0 张'; + (hasImages ? nextBatchBtn : generateBatchBtn) && (hasImages ? nextBatchBtn : generateBatchBtn).click(); + } }); } - /* 观察 generateBatchBtn 的 data-running 属性和 disabled 状态 */ + if (generateBatchBtn) { new MutationObserver(syncGenBtn).observe(generateBatchBtn, { attributes: true, attributeFilter: ['data-running', 'disabled'] }); } + /* 同时观察 imageCount 变化以切换按钮文字 */ + if (imageCount) { + new MutationObserver(syncGenBtn).observe(imageCount, { characterData: true, childList: true, subtree: true }); + } syncGenBtn(); /* --- 视频主按钮:生成视频/中断视频 --- */ @@ -1890,7 +1912,7 @@ } syncVideoBtn(); - /* --- 候选图已选状态同步 → 第二行高亮 --- */ + /* --- 候选图已选状态同步 → 第二行文字高亮(垃圾桶始终可点) --- */ const videoRow = document.getElementById('nsfwVideoRow'); const selectedLabel = document.getElementById('nsfwSelectedLabel'); @@ -1899,7 +1921,6 @@ const text = String(selectedMeta.textContent || '').trim(); const hasSelected = !text.includes('未选择'); videoRow.classList.toggle('has-selected', hasSelected); - // 截短显示 if (hasSelected) { selectedLabel.textContent = text.length > 22 ? text.slice(0, 22) + '…' : text; } else { @@ -1913,7 +1934,7 @@ syncSelected(); } - /* --- 设置 Bottom Sheet(画面比例、并发、分辨率、时长、NSFW) --- */ + /* --- 设置 Bottom Sheet --- */ const settingsBtn = document.getElementById('nsfwSettingsBtn'); const settingsOverlay = document.getElementById('nsfwSettingsOverlay'); @@ -1932,7 +1953,7 @@ titleEl.textContent = '生成参数'; settingsSheet.appendChild(titleEl); - // 将参数表单(画面比例、并发、分辨率、时长、NSFW 这些 field,不含 textarea)移入 sheet + /* 将非 textarea 的参数 field 移入 sheet */ const formGrid = document.querySelector('.form-grid'); if (formGrid) { const nonWideFields = formGrid.querySelectorAll('.field:not(.field-wide)'); diff --git a/app/static/public/pages/imagine.html b/app/static/public/pages/imagine.html index cfd5c60..4db39b6 100644 --- a/app/static/public/pages/imagine.html +++ b/app/static/public/pages/imagine.html @@ -19,7 +19,7 @@ - + @@ -351,7 +351,7 @@ - + \ No newline at end of file diff --git a/app/static/public/pages/nsfw.html b/app/static/public/pages/nsfw.html index b40c68c..59b9808 100644 --- a/app/static/public/pages/nsfw.html +++ b/app/static/public/pages/nsfw.html @@ -19,7 +19,7 @@ - + @@ -137,9 +137,8 @@
- +
- -
- -
- - - - -
- +
+