const sleep = ms => new Promise(r => setTimeout(r, ms)); let leg=null; for (const el of document.querySelectorAll('legend')) if ((el.textContent||'').trim()==='忽略网络' && el.offsetParent!==null) leg=el; if(!leg) return {err:'no legend'}; const fs = leg.parentElement; const dump=[]; const walk=(el,d)=>{ if(d>12) return; const own=Array.from(el.childNodes).filter(n=>n.nodeType===3).map(n=>n.textContent.trim()).join('|'); const cls=(typeof el.className==='string'?el.className:''); dump.push({d,tag:el.tagName,cls:cls.slice(0,60),txt:own.slice(0,30),ttl:(el.getAttribute&&el.getAttribute('title'))||''}); for(const c of el.children) walk(c,d+1); }; walk(fs,0); return {html: fs.outerHTML.slice(0,2500), n:dump.length};