const sleep = ms => new Promise(r => setTimeout(r, ms)); const propsOf = el => { for (const k of Object.keys(el)) if (k.startsWith('__reactProps$')) return el[k]; return null; }; const fire = (el) => { let t = el; for (let i=0;i<8&&t;i++){const q=propsOf(t); if(q&&typeof q.onClick==='function'){q.onClick({target:t,currentTarget:t,stopPropagation(){},preventDefault(){},nativeEvent:{},button:0,detail:1});return true;} t=t.parentElement;} return false; }; // dialog already open? check let modal=null; for (const m of document.querySelectorAll('*')) { const t=(m.innerText||''); if (t.indexOf('布线网络')>=0 && t.indexOf('忽略网络')>=0 && m.offsetParent!==null) { if (!modal || (m.innerText||'').length < (modal.innerText||'').length) modal=m; } } if(!modal) return {err:'dialog not open'}; let add=null; for (const b of modal.querySelectorAll('button')) if((b.innerText||'').trim()==='新增' && b.offsetParent!==null) add=b; if(!add) return {err:'no 新增 button', btns: Array.from(modal.querySelectorAll('button')).map(b=>(b.innerText||'').trim())}; fire(add); await sleep(1200); const inputs=[]; for (const i of document.querySelectorAll('input')) if(i.offsetParent!==null) inputs.push({ph:i.placeholder, val:i.value, cls:(i.className||'').slice(0,50)}); // dump any popup list const pops=[]; for (const m of document.querySelectorAll('[class*="popup"],[class*="Popup"],[class*="dropdown"],[class*="Dropdown"],[class*="select"]')) { const t=(m.innerText||'').trim(); if (t.length>5 && m.offsetParent!==null) pops.push(t.slice(0,300)); } return {inputs, pops: pops.slice(0,5), modalTxt: (modal.innerText||'').slice(-400)};