Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/probe_marks.mjs

1.4 KiB, 1 run

created by r2519314175:55, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1// probe_marks.mjs — measure the wordmark and the maker's badge where they now sit.
2import { open, shot } from './harness.mjs';
3const s = await open({ name: 'marks' });
4const { page } = s;
5await page.waitForTimeout(1200);
6const m = await page.evaluate(() => {
7 const px = (el) => { if (!el) return null; const r = el.getBoundingClientRect();
8 return { w: +r.width.toFixed(1), h: +r.height.toFixed(1), x: Math.round(r.x), y: Math.round(r.y) }; };
9 const badge = document.querySelector('.made-by img');
10 // The AI mark inside the plate, in rendered pixels: the right-hand half.
11 let ai = null;
12 if (badge) {
13 const r = badge.getBoundingClientRect();
14 ai = { plate: px(badge), markH: +(r.height * 0.74).toFixed(1) };
15 }
16 return {
17 wordmark: px(document.querySelector('.brand-wordmark:not([style*="display: none"])')),
18 badgeInTopBar: !!document.querySelector('.top-actions .made-by'),
19 badgeFoot: px(document.querySelector('.made-by-foot')),
20 badge: ai,
21 // Centred? Compare the gaps either side within its container.
22 centred: (() => {
23 const f = document.querySelector('.made-by-foot');
24 const b = document.querySelector('.made-by');
25 if (!f || !b) return null;
26 const fr = f.getBoundingClientRect(), br = b.getBoundingClientRect();
27 return { left: +(br.left - fr.left).toFixed(1), right: +(fr.right - br.right).toFixed(1) };
28 })(),
29 };
30});
31console.log(JSON.stringify(m, null, 1));
32await shot(s, 'marks-status-foot');
33await s.browser.close();