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; }; const leaf = (txt) => { for (const el of document.querySelectorAll('*')) if (el.children.length===0 && (el.textContent||'').trim()===txt) return el; return null; }; fire(leaf('布线')); await sleep(900); fire(leaf('自动布线...')); await sleep(2500); // 布线网络 -> 所选网络 let done=false; for (const lab of document.querySelectorAll('span[class*="ratio-label_"]')) { if ((lab.innerText||'').trim() !== '布线网络') continue; for (const inp of lab.parentElement.querySelectorAll('input[type=radio]')) { const sp = inp.closest('label') || inp.parentElement; if ((sp.innerText||'').trim()==='所选网络') { fire(sp); done=true; } } } await sleep(600); // 图层:内层1/2 取消 const fsL = Array.from(document.querySelectorAll('fieldset')).find(x=>(x.querySelector('legend')||{}).textContent==='布线图层'); for (const name of ['内层1','内层2']) { const tr = Array.from(fsL.querySelectorAll('tr')).find(t=>(t.innerText||'').trim()===name); const cb = tr && tr.querySelector('i[class*="checkbox_"][class*="active_"]'); if (cb) { fire(cb); await sleep(400); } } const groups=[]; for (const lab of document.querySelectorAll('span[class*="ratio-label_"]')) { if (lab.offsetParent===null) continue; const on=[]; for (const inp of lab.parentElement.querySelectorAll('input[type=radio]')) { const sp = inp.closest('label') || inp.parentElement; if (inp.checked) on.push((sp.innerText||'').trim()); } groups.push((lab.innerText||'').trim()+'='+on.join('/')); } const fsI = Array.from(document.querySelectorAll('fieldset')).find(x=>(x.querySelector('legend')||{}).textContent==='忽略网络'); return {setSel:done, groups, layers: Array.from(fsL.querySelectorAll('tr')).map(tr=>((tr.innerText||'').trim())+':'+(!!tr.querySelector('i[class*="active_"]'))), ignore:(fsI.innerText||'').trim().replace(/\s+/g,' ').slice(0,200)};