javascript:(async()=>{const CSS=`@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Noto+Sans+JP:wght@400;500&display=swap');#pr-ovly,#pr-msg{position:fixed;inset:0;background:rgba(10,10,15,0.85);z-index:999999;display:flex;align-items:center;justify-content:center;font-family:'Noto Sans JP',sans-serif}#pr-msg{cursor:pointer}#pr-mdl{background:#111118;color:#e8e8f0;padding:24px;width:90%;max-width:800px;max-height:90vh;overflow-y:auto;border-radius:16px;border:1px solid #2a2a3a;box-shadow:0 20px 50px rgba(0,0,0,0.5);cursor:default}#pr-msg-box{background:#111118;color:#ff6a8a;padding:20px 40px;border-radius:12px;border:1px solid #ff6a8a;font-family:'Space Mono',monospace;font-weight:700}.pr-blk{background:#111118;border:1px solid #2a2a3a;border-radius:12px;margin-bottom:16px;overflow:hidden}.pr-hdr{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#1a1a24;border-bottom:1px solid #2a2a3a;cursor:pointer}.pr-lbl{font-family:'Space Mono',monospace;font-size:12px;font-weight:700;display:flex;align-items:center;gap:8px;user-select:none}.pr-dot{width:8px;height:8px;border-radius:50%}.dot-pos{background:#4fffb0;box-shadow:0 0 6px #4fffb0}.dot-neg{background:#ff6a8a;box-shadow:0 0 6px #ff6a8a}.dot-oth{background:#7c6aff;box-shadow:0 0 6px #7c6aff}.dot-chr{background:#ffcc33;box-shadow:0 0 6px #ffcc33}.pr-txt{padding:16px;font-family:'Space Mono',monospace;font-size:13px;white-space:pre-wrap;word-break:break-all;color:#e8e8f0;border-top:1px solid #2a2a3a}.pr-cpy{background:transparent;border:1px solid #ffffff;color:#ffffff;font-family:'Space Mono',monospace;font-size:10px;padding:4px 8px;border-radius:4px;cursor:pointer;transition:0.2s}.pr-cpy:hover{background:rgba(255,255,255,0.1)}.pr-tgl{font-family:monospace;margin-left:auto;margin-right:12px;color:#6a6a80}`;if(!document.getElementById('pr-style')){const s=document.createElement('style');s.id='pr-style';s.textContent=CSS;document.head.appendChild(s)}const readPNG=async(b)=>{const v=new DataView(b);const c={};let o=8;while(o{const u=new Uint8Array(b);let i=0;while(i{if(!r)return null;try{const j=JSON.parse(r);if(j.prompt||j.uc){return{p:j.prompt||'',n:j.uc||'',e:JSON.stringify(j,null,2),c:j.v4_prompt?.caption?.char_captions?.map(c=>c.char_caption?.trim()).filter(Boolean)}}const ps=[],ns=[];const nodes=j.nodes||Object.values(j);nodes.forEach(n=>{if(n?.class_type==='CLIPTextEncode'){const t=n.inputs?.text||'';if((n._meta?.title||'').toLowerCase().includes('neg'))ns.push(t);else ps.push(t)}});if(ps.length||ns.length)return{p:ps.join('\n'),n:ns.join('\n'),e:'ComfyUI Workflow'};return{e:JSON.stringify(j,null,2)}}catch(e){}const nm=r.match(/\nNegative prompt:\s*/i),sm=r.match(/\n(Steps|Sampler|CFG|Seed|Size|Model)[:s]/i);let p='',n='',ex='';if(nm){p=r.slice(0,nm.index).trim();const an=r.slice(nm.index+nm[0].length);if(sm){const si=an.search(/\n(Steps|Sampler|CFG|Seed|Size|Model)[:s]/i);if(si>=0){n=an.slice(0,si).trim();ex=an.slice(si).trim()}else n=an.trim()}else n=an.trim()}else if(sm){const si=r.search(/\n(Steps|Sampler|CFG|Seed|Size|Model)[:s]/i);p=r.slice(0,si).trim();ex=r.slice(si).trim()}else p=r.trim();return{p,n,e:ex}};const makeB=(l,t,tp)=>{const b=document.createElement('div');b.className='pr-blk';b.innerHTML=`
${l}
${tp==='oth'?'[ + ]':'[ - ]'}
`;const txt=b.querySelector('.pr-txt');const tgl=b.querySelector('.pr-tgl');txt.textContent=t;if(tp==='oth')txt.style.display='none';b.querySelector('.pr-hdr').onclick=(e)=>{if(e.target.classList.contains('pr-cpy'))return;const h=txt.style.display==='none';txt.style.display=h?'block':'none';tgl.textContent=h?'[ - ]':'[ + ]'};b.querySelector('.pr-cpy').onclick=(e)=>{e.stopPropagation();navigator.clipboard.writeText(t);e.target.textContent='DONE';setTimeout(()=>e.target.textContent='COPY',1500)};return b};const pop=(res)=>{const o=document.createElement('div');o.id='pr-ovly';const m=document.createElement('div');m.id='pr-mdl';if(res.c?.length)res.c.forEach((t,i)=>m.appendChild(makeB(`CHAR ${i+1}`,t,'chr')));if(res.p)m.appendChild(makeB('POSITIVE PROMPT',res.p,'pos'));if(res.n)m.appendChild(makeB('NEGATIVE PROMPT',res.n,'neg'));if(res.e)m.appendChild(makeB('GENERATION INFO',res.e,'oth'));o.onclick=()=>o.remove();m.onclick=e=>e.stopPropagation();document.body.appendChild(o).appendChild(m)};const msg=(t)=>{const o=document.createElement('div');o.id='pr-msg';o.innerHTML=`
${t}
`;o.onclick=()=>o.remove();document.body.appendChild(o);setTimeout(()=>{if(document.body.contains(o))o.remove()},1000)};const check=async(u)=>{try{const ab=await(await fetch(u)).arrayBuffer();const c=await readPNG(ab);const raw=c['parameters']||c['Comment']||Object.values(c)[0]||readExif(ab);const res=parseP(raw);return(res?.p||res?.n||res?.e)?res:null}catch(e){return null}};if(/\.(png|jpg|webp)$/i.test(location.href)){const res=await check(location.href);res?pop(res):msg('メタデータ無し');return}document.querySelectorAll(".thre a:first-of-type,.c9-14 a:first-of-type,.rtd a:last-of-type,.c9-10 a:last-of-type").forEach(async t=>{if(!t.dataset.pr&&/\.(png|jpg|webp)$/i.test(t.href)){t.dataset.pr=1;const res=await check(t.href);if(res){const b=document.createElement('button');b.innerText='Info';b.style.cssText='margin:4px;cursor:pointer;padding:2px 8px;font-size:12px;border-radius:4px;border:1px solid #ccc;background:#ffffff;color:#000000;font-family:monospace;font-weight:bold;';b.onclick=e=>{e.preventDefault();pop(res)};const bq=t.parentElement.querySelector('blockquote');bq?bq.before(b):t.after(b)}}});})();