Files

41 lines
1.3 KiB
JavaScript

// 探针脚本:进入车库,切到迷彩,检查专用选择位置。
(async () => {
const link = [...document.querySelectorAll('[data-go]')].find(
(e) => e.getAttribute('data-go') === 'garage',
);
if (link) link.click();
await new Promise((r) => setTimeout(r, 1800));
const tab = [...document.querySelectorAll('.g3-tab')].find((e) =>
e.textContent.includes('迷彩'),
);
if (tab) tab.click();
await new Promise((r) => setTimeout(r, 1200));
const box = (s) => {
const e = document.querySelector(s);
if (!e) return null;
const r = e.getBoundingClientRect();
const c = getComputedStyle(e);
return {
rect: [Math.round(r.x), Math.round(r.y), Math.round(r.width), Math.round(r.height)],
display: c.display,
overflow: c.overflow,
position: c.position,
};
};
return {
hasPaint: !!document.querySelector('.g3-paints'),
paintCount: document.querySelectorAll('.g3-paint').length,
paints: box('.g3-paints'),
info: box('.g3-paint-info'),
carousel: box('.g3-carousel'),
left: box('.g3-left'),
right: box('.g3-right'),
actions: box('.g3-actions'),
tabs: [...document.querySelectorAll('.g3-tab')].map((e) => e.textContent.trim()),
menuKeys: [...document.querySelectorAll('.g3-key')].map((e) => e.textContent.trim()),
};
})()