// ==UserScript== // @name 漫映AI官网增强脚本 (Manying AI Enhancer) // @namespace http://tampermonkey.net/ // @version 1.2.0 // @description 为漫映AI官网提供快速导航、IP数据导出、创作进度追踪及界面优化功能 // @author AI Assistant // @match https://www.m-ying.com/* // @match https://m-ying.com/* // @grant GM_setClipboard // @grant GM_notification // @grant GM_addStyle // @grant GM_download // @run-at document-idle // @license MIT // ==/UserScript== (function() { 'use strict'; // =================配置区域================= const CONFIG = { themeColor: '#3b82f6', // 主色调 panelPosition: 'top-left', // 面板位置: top-left, top-right autoTrackProgress: true // 是否自动追踪进度 }; // =================样式注入================= const styles = ` #manying-toolbox { position: fixed; ${CONFIG.panelPosition === 'top-left' ? 'top: 100px; left: 20px;' : 'top: 100px; right: 20px;'} z-index: 99999; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); padding: 15px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); width: 240px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; transition: all 0.3s ease; border: 1px solid #e5e7eb; } #manying-toolbox:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.15); transform: translateY(-2px); } .mt-title { font-size: 14px; font-weight: 700; color: #1f2937; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid ${CONFIG.themeColor}; display: flex; justify-content: space-between; align-items: center; } .mt-btn { display: block; width: 100%; padding: 10px 12px; margin-bottom: 8px; background: #f3f4f6; border: none; border-radius: 6px; color: #374151; font-size: 13px; text-align: left; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 8px; } .mt-btn:hover { background: ${CONFIG.themeColor}; color: white; } .mt-btn svg { width: 16px; height: 16px; fill: currentColor; } .mt-status { font-size: 12px; color: #6b7280; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e7eb; } /* 模态框样式 */ .mt-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 100000; display: none; justify-content: center; align-items: center; } .mt-modal { background: white; padding: 20px; border-radius: 12px; width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.2); } .mt-modal-header { font-weight: bold; font-size: 16px; margin-bottom: 15px; display: flex; justify-content: space-between; } .mt-modal-close { cursor: pointer; color: #9ca3af; } .mt-textarea { width: 100%; height: 200px; padding: 10px; border: 1px solid #d1d5db; border-radius: 6px; font-family: monospace; font-size: 12px; resize: vertical; } .mt-modal-actions { margin-top: 15px; display: flex; gap: 10px; justify-content: flex-end; } .mt-primary-btn { background: ${CONFIG.themeColor}; color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; } .mt-secondary-btn { background: #e5e7eb; color: #374151; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; } `; GM_addStyle(styles); // =================图标SVG================= const icons = { workflow: '', database: '', chart: '', contact: '' }; // =================核心逻辑================= // 1. 创建工具箱UI function createToolbox() { const toolbox = document.createElement('div'); toolbox.id = 'manying-toolbox'; toolbox.innerHTML = `
漫映AI 助手 v1.2
就绪
`; document.body.appendChild(toolbox); // 绑定事件 document.getElementById('btn-workflow').onclick = goToWorkflow; document.getElementById('btn-export-ip').onclick = showIPExportModal; document.getElementById('btn-progress').onclick = showProgress; document.getElementById('btn-contact').onclick = scrollToContact; } // 2. 功能:直达工作流 function goToWorkflow() { updateStatus('正在跳转至工作流...'); // 尝试寻找常见的工作流入口ID或Class,如果找不到则滚动到特定区域 const workflowSection = document.querySelector('#workflow') || document.querySelector('.workflow-section') || document.querySelector('[id*="create"]'); if (workflowSection) { workflowSection.scrollIntoView({ behavior: 'smooth' }); updateStatus('已定位到工作流区域'); } else { // fallback: 假设首页底部或特定路径 window.location.href = '/create'; // 假设路径,实际需根据网站结构调整 updateStatus('正在前往创作页面...'); } } // 3. 功能:IP资源导出模拟 // 注意:由于跨域和动态加载限制,这里使用模拟数据展示功能逻辑 // 在实际使用中,如果网站有API,应替换为 fetch API 调用 const mockIPData = [ { title: "《小幸运》", author: "打伞的蘑菇", type: "都市言情", words: "12.9万字" }, { title: "《盗尽君心》", author: "打伞的蘑菇", type: "仙侠言情", words: "13.0万字" }, { title: "《乌云下的橘子树》", author: "一零九六", type: "青春校园", words: "16.0万字" }, { title: "《此去共浮生》", author: "晏生", type: "青春校园", words: "11.3万字" } ]; function showIPExportModal() { updateStatus('生成IP数据...'); // 创建模态框 let modal = document.getElementById('ip-export-modal'); if (!modal) { modal = document.createElement('div'); modal.id = 'ip-export-modal'; modal.className = 'mt-modal-overlay'; modal.innerHTML = `
IP资源数据导出

注:以下为演示数据。若网站开放API,此处将显示实时抓取的最新签约IP列表。

`; document.body.appendChild(modal); // 绑定模态框内按钮事件 document.getElementById('btn-copy-ip').onclick = () => { const text = document.getElementById('ip-data-area').value; GM_setClipboard(text); GM_notification({ title: '成功', text: 'IP数据已复制到剪贴板' }); }; document.getElementById('btn-download-ip').onclick = () => { const text = document.getElementById('ip-data-area').value; const blob = new Blob([text], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `Manying_IP_List_${new Date().toISOString().slice(0,10)}.txt`; a.click(); URL.revokeObjectURL(url); }; } // 填充数据 let content = "作品名称\t作者\t题材\t字数\n"; mockIPData.forEach(ip => { content += `${ip.title}\t${ip.author}\t${ip.type}\t${ip.words}\n`; }); document.getElementById('ip-data-area').value = content; modal.style.display = 'flex'; updateStatus('IP数据已准备就绪'); } // 4. 功能:创作进度追踪 function showProgress() { const lastStep = localStorage.getItem('manying_last_step') || '未开始'; const lastTime = localStorage.getItem('manying_last_time') || '未知时间'; GM_notification({ title: '创作进度追踪', text: `上次操作: ${lastStep}\n时间: ${lastTime}`, timeout: 5000 }); updateStatus(`上次进度: ${lastStep}`); } // 自动追踪逻辑(简单示例) function trackActivity() { if (!CONFIG.autoTrackProgress) return; // 监听URL变化或特定按钮点击来更新进度 // 这里仅做演示,实际需根据网站DOM结构绑定具体事件 const observer = new MutationObserver((mutations) => { // 简单检测页面标题变化或特定元素出现来推断步骤 // 实际开发中应更精确地绑定到“下一步”按钮 }); observer.observe(document.body, { childList: true, subtree: true }); } // 5. 功能:联系咨询 function scrollToContact() { const contactSection = document.querySelector('#contact') || document.querySelector('.footer'); if (contactSection) { contactSection.scrollIntoView({ behavior: 'smooth' }); updateStatus('已滚动至底部联系区域'); } else { window.open('https://www.m-ying.com/contact', '_blank'); // 假设链接 } } // 辅助函数:更新状态栏 function updateStatus(text) { const statusEl = document.getElementById('mt-status-text'); if (statusEl) statusEl.textContent = text; } // =================初始化================= window.addEventListener('load', () => { createToolbox(); trackActivity(); console.log('Manying AI Enhancer Loaded'); }); })();