// ==UserScript== // @name 0.7.18珠宝AI 移动端适配 // @namespace https://zbai.art/ // @version 0.7.18 // @description 真机移动端生成路径修复:接管原站立即创作点击,底部生成直接走真实生成逻辑 // @author Sulong // @match https://zbai.art/* // @match https://www.zbai.art/* // @match https://jew.haistudio.ai/* // @run-at document-start // @grant none // ==/UserScript== (function () { 'use strict'; const STYLE_ID = 'zbai-mobile-adapter-style'; const ROOT_ID = 'zbai-mobile-root'; const CLASS_READY = 'zbai-mobile-adapted'; const HOME_SHELL_ID = 'zbai-mobile-home-shell'; const WORK_DETAIL_FALLBACK_ID = 'zbai-mobile-work-detail-fallback'; const MOBILE_QUERY = '(max-width: 768px), (pointer: coarse), (max-device-width: 820px)'; const ASSETS_URL = '/index/mine-homepage'; const VERSION = '0.7.18'; const DESKTOP_COMPAT_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36'; const GENERATE_TEXT_RE = /立即创作|开始创作|立即生成|创作|生成/; const PRIMARY_GENERATE_TEXT_RE = /立即创作|开始创作|立即生成/; const PAYMENT_ACTION_RE = /开通|升级|我要升级|续费|购买|支付|充值|去开通|去升级|会员升级|升级会员|购买套餐|开通会员/; const DIRECT_PAYMENT_ACTION_RE = /^(立即|马上|去|前往)?(开通|升级|我要升级|续费|购买|支付|充值|去开通|去升级|购买套餐|开通会员|会员升级|升级会员)$/i; const PAYMENT_CONTEXT_RE = /套餐|会员(?!模型)|权益|订阅|入门版|个人版|专业版|旗舰版|商业授权|收银台|订单|支付方式|连续包月|连续包年|个人创作者/; const PAYMENT_CLASS_RE = /vip|member|pay|payment|subscribe|subscription|price|pricing|plan|package|checkout|order/i; const NON_PAYMENT_MODEL_TEXT_RE = /高阶模型|商业模型|商业级模型|会员模型|会员专属模型|旗舰版模型/g; const CLASS = { enabled: 'zbai-mobile-enabled', compose: 'zbai-mobile-compose-source', composeOpen: 'zbai-mobile-compose-open', formatChoice: 'zbai-mobile-format-choice', formatLabel: 'zbai-mobile-format-label', formatRow: 'zbai-mobile-format-row', duplicateTitle: 'zbai-mobile-duplicate-title', templateTextMode: 'zbai-mobile-template-text-mode', history: 'zbai-mobile-history-source', historyOpen: 'zbai-mobile-history-open', historyParent: 'zbai-mobile-history-parent', uploadArmed: 'zbai-mobile-upload-armed', lock: 'zbai-mobile-lock', }; const EDITOR_ROOT_SELECTOR = '#pictureEditor'; const HOME_TOOL_ACTIONS = [ { key: 'image', label: '图片创作', eyebrow: 'Image', href: '/create/module/image', desc: '生成首饰海报、商品图和创意画面' }, { key: 'video', label: '视频创作', eyebrow: 'Video', href: '/create/module/video', desc: '制作运镜展示、旋转视频和短片素材' }, ]; const TEMPLATE_ACTIONS = [ { label: '珠宝海报', href: '/create/ai-effects/jewelry-poster', tag: '海报', desc: '快速生成东方美学商品海报' }, { label: '道具展示', href: '/create/ai-effects/jewelry-display', tag: '展示', desc: '为首饰匹配托盘、布景与道具' }, { label: '社交媒体图', href: '/create/ai-effects/social-media', tag: '种草', desc: '小红书、朋友圈风格内容图' }, { label: '大片模特', href: '/create/ai-effects/jewelry-models-display', tag: '模特', desc: '真人佩戴与商业大片画面' }, { label: '珠宝纯净图', href: '/create/ai-effects/jewelry-background', tag: '底图', desc: '白底、黑底和纯净背景图' }, { label: '精致摄影', href: '/create/ai-effects/finephotograph', tag: '摄影', desc: '高级光影、倒影和质感摄影' }, { label: '布料与珠宝', href: '/create/ai-effects/jewelry-cloth', tag: '布料', desc: '丝绸、天鹅绒等材质布景' }, { label: '珠宝多视角', href: '/create/ai-effects/jewelry-multiview', tag: '视角', desc: '多角度展示结构与细节' }, { label: '珠宝详情页', href: '/create/ai-effects/product-details-page', tag: '详情', desc: '电商详情页视觉图' }, { label: '珠宝视频', href: '/create/ai-effects/jewelry-360-display', tag: '视频', desc: '旋转展示与火彩展示视频' }, ]; window.__ZBAI_DEBUG__ = window.__ZBAI_DEBUG__ === true; window.__ZBAI_MOBILE_ADAPTER_VERSION__ = VERSION; window.__ZBAI_MOBILE_ADAPTER_MERGE__ = '0.7.5-ui+0.2.3-actions'; window.__ZBAI_MOBILE_ADAPTER_DIAGNOSE__ = collectDiagnostics; window.ZBAI_MOBILE_ADAPTER_DIAGNOSE = collectDiagnostics; const media = window.matchMedia(MOBILE_QUERY); let activeSurface = ''; let toastTimer = 0; let authRefreshScheduled = false; let generateActivationInProgress = false; installDesktopGenerateCompatibility(); injectStyles(); waitForBody(boot); function boot() { if (document.getElementById(ROOT_ID)) return; const root = buildRoot(); document.body.append(root); syncMode(); installListeners(root); scheduleAuthRefreshes(); const observer = new MutationObserver(throttle(() => { syncMode(); }, 180)); observer.observe(document.body, { attributes: true, childList: true, subtree: true }); } function installDesktopGenerateCompatibility() { const state = {