Port meetups, discussions, gigs, dating/chat, VIP pay (ZPay/XorPay), MiroTalk live, digital academy, and ebook reader. Add persistent community_store, git-first deploy docs, and env template for production secrets. Co-authored-by: Cursor <cursoragent@cursor.com>
56 lines
2.1 KiB
JavaScript
56 lines
2.1 KiB
JavaScript
const { chromium } = require('playwright');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
(async () => {
|
|
const outDir = path.join(__dirname, '..', 'tmp-screenshots');
|
|
fs.mkdirSync(outDir, { recursive: true });
|
|
const browser = await chromium.launch({ headless: true });
|
|
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
|
|
|
async function shot(url, name) {
|
|
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 });
|
|
await page.waitForTimeout(1500);
|
|
const file = path.join(outDir, name);
|
|
await page.screenshot({ path: file, fullPage: false });
|
|
// measure content vs sidebar
|
|
const metrics = await page.evaluate(() => {
|
|
const sidebar = document.querySelector('.chapter-sidebar');
|
|
const main = document.querySelector('.scroll-reader-main') || document.querySelector('main');
|
|
const paper = document.querySelector('.reader-paper');
|
|
const content = document.querySelector('.scroll-reader-content');
|
|
const wrap = document.querySelector('.reader-center-wrap');
|
|
const box = (el) => {
|
|
if (!el) return null;
|
|
const r = el.getBoundingClientRect();
|
|
return { left: Math.round(r.left), right: Math.round(r.right), width: Math.round(r.width), top: Math.round(r.top) };
|
|
};
|
|
const sb = box(sidebar);
|
|
const mn = box(main);
|
|
const ct = box(content);
|
|
const leftGap = sb && mn ? mn.left - sb.right : null;
|
|
const rightGap = mn ? window.innerWidth - mn.right : null;
|
|
return {
|
|
viewport: window.innerWidth,
|
|
sidebar: sb,
|
|
contentCol: ct,
|
|
main: mn,
|
|
paper: box(paper),
|
|
wrap: box(wrap),
|
|
leftGap,
|
|
rightGap,
|
|
delta: leftGap != null && rightGap != null ? Math.abs(leftGap - rightGap) : null,
|
|
};
|
|
});
|
|
console.log(name, JSON.stringify(metrics));
|
|
console.log('saved', file);
|
|
}
|
|
|
|
await shot('https://nomadweb.nomadro.com/book/read#00-preface', 'nomadweb-read.png');
|
|
await shot('https://book.nomadro.com/read#00-preface', 'book-read.png');
|
|
await browser.close();
|
|
})().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|