Files

38 lines
1.1 KiB
JavaScript

// 探针脚本:点击车库,等待 HEAD 切到子页面状态,然后抓 HEAD 节点。
(async () => {
const link = [...document.querySelectorAll('[data-go]')].find(
(e) => e.getAttribute('data-go') === 'garage',
);
if (link) link.click();
await new Promise((r) => setTimeout(r, 2500));
const root = document.getElementById('head-root');
const nodes = [...root.querySelectorAll('[data-ui]')].map((el) => {
const r = el.getBoundingClientRect();
const c = getComputedStyle(el);
return {
ui: el.getAttribute('data-ui'),
tag: el.tagName,
rect: [Math.round(r.x), Math.round(r.y), Math.round(r.width), Math.round(r.height)],
style: {
display: c.display,
position: c.position,
width: c.width,
height: c.height,
border: c.border,
borderLeft: c.borderLeft,
borderRight: c.borderRight,
background: c.background,
opacity: c.opacity,
transform: c.transform,
},
};
});
return {
text: document.body.innerText.slice(0, 200),
hasGarage: !!document.querySelector('.g3'),
nodes,
};
})()