javascript:(async function(){const e=document.createElement("div");e.style.cssText="position:fixed;top:20px;left:50%;transform:translateX(-50%);background:#000;color:#fff;padding:15px 30px;border-radius:8px;z-index:9999;font-size:16px;",e.textContent="📊 正在检测图片...",document.body.appendChild(e);const t=()=>{let t=document.title||"豆包对话备份";const n=document.querySelector("h1")||document.querySelector('div[class*="title"]')||document.querySelector('span[class*="title"]');return n&&(t=n.textContent.trim()),t.slice(0,200)};const n=t();e.textContent=`📝 检测到对话标题:${n}`,await new Promise(e=>setTimeout(e,1500)),window.scrollTo(0,document.body.scrollHeight),await new Promise(e=>setTimeout(e,2e3)),e.textContent="📥 开始分批加载图片...";const o=Array.from(document.querySelectorAll("img")),a=o.length;let i=0,r=50;e.textContent=`🔄 共 ${a} 张图片,分批处理中...`;const l=(t,n=3e4)=>new Promise(o=>{const a=setTimeout(()=>{console.warn(`⏱️ 图片加载超时: ${t.src}`),o(!1)},n);t.complete?(clearTimeout(a),o(!0)):(t.onload=()=>{clearTimeout(a),o(!0)},t.onerror=()=>{clearTimeout(a),o(!1)})});for(let d=0;d<o.length;d+=r){const s=o.slice(d,d+r);e.textContent=`🔄 处理批次 ${Math.floor(d/r)+1}/${Math.ceil(a/r)} | 已完成 ${i}/${a}`,await Promise.all(s.map(t=>l(t))),i+=s.length}e.textContent="🎉 图片加载完成,开始生成备份...";let c=document.querySelector("main")||document.body;if(!c)return void(e.textContent="❌ 找不到对话区域",setTimeout(()=>e.remove(),3e3));const m=c.cloneNode(!0);e.textContent="🖼️ 正在处理图片为Base64...";i=0;const g=Array.from(m.querySelectorAll("img"));for(const t of g){try{if(!t.src)continue;const n=await fetch(t.src,{headers:{"Accept":"image/*"}}),o=await n.blob(),a=await new Promise(e=>{const n=new FileReader;n.onloadend=()=>e(n.result),n.readAsDataURL(o)});t.src=a,i++,i%50==0&&(e.textContent=`🖼️ 转码中:${i}/${g.length}`)}catch(e){console.error("图片处理失败",e)}}e.textContent="📄 正在生成离线文件...";const p=document.createElement("a"),s=URL.createObjectURL(new Blob([`<!DOCTYPE html><html><head><meta charset="UTF-8"><title>${n}_${new Date().toISOString().slice(0,10)}</title><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css"><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;max-width:800px;margin:0 auto;padding:20px;}img{max-width:100%;height:auto;}</style></head><body><h1>${n}</h1><p>导出时间:${new Date().toLocaleString()}</p><hr>${m.innerHTML}</body></html>`.trim()],{type:"text/html;charset=utf-8"}));p.href=s,p.download=`${n}_${new Date().toISOString().slice(0,10)}.html`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(s),e.textContent=`✅ 导出完成!文件:${n}.html`,setTimeout(()=>e.remove(),5e3),console.log(`✅ 已导出对话备份:${n}`)})();