Skip to content

A Claude skill that turns vibecoded, AI-looking UI into a designed interface

JavaScript

Merge pull request #19 from TheGeekyM/feat-make-live-site-snapshots-faith

Damir97daa3eb3656
diff --cc skills/unslop/SKILL.md
index 1c4bf1e,5dab154..e743184
--- a/skills/unslop/SKILL.md
+++ b/skills/unslop/SKILL.md
@@@ -33,7 -33,7 +33,7 @@@ Which visual styles tend to work, and w
## Run it
1. **Look at the screen.** Find the files that render it. If you can run the app or open the file in a browser and take a screenshot, do it, so you judge what people see and not only the code.
- - Only a link to a live site, no code? Save the page with `node <skill folder>/scripts/snapshot.mjs <url> unslop/original.html` and work on a copy of that file. A local HTML file works in place of the URL. Add `--dark` or `--light` to match the theme the user sees. It also saves `original.live.png`, a screenshot of the live page, so render the saved copy and compare the two before you start. Animated backgrounds drawn by scripts do not survive, so describe them in the audit from the live page.
- - Only a link to a live site, no code? Save the page with `node <skill folder>/scripts/snapshot.mjs <url> unslop/original.html` and work on a copy of that file. Add `--dark` or `--light` to match the theme the user sees. It also saves `original.live.png`, a screenshot of the live page, so render the saved copy and compare the two before you start. The script scrolls through the page first, so lazy-loaded sections and images are captured. Animated backgrounds drawn by scripts do not survive, so describe them in the audit from the live page.
++ - Only a link to a live site, no code? Save the page with `node <skill folder>/scripts/snapshot.mjs <url> unslop/original.html` and work on a copy of that file. A local HTML file works in place of the URL. Add `--dark` or `--light` to match the theme the user sees. It also saves `original.live.png`, a screenshot of the live page, so render the saved copy and compare the two before you start. The script scrolls through the page first, so lazy-loaded sections and images are captured. Animated backgrounds drawn by scripts do not survive, so describe them in the audit from the live page.
- Only a screenshot? Rebuild the screen as one static HTML file first, matching it closely, and treat that as the original.
- In both cases the result is a redesigned page in code that the user can hand to whoever owns the real site, so say that in the report.
2. **Audit.** Go through [references/signs.md](references/signs.md) and list every sign you find, one line each with where it lives.
diff --cc skills/unslop/scripts/snapshot.mjs
index 9288450,59c3dba..ef226aa
--- a/skills/unslop/scripts/snapshot.mjs
+++ b/skills/unslop/scripts/snapshot.mjs
@@@ -59,9 -32,29 +59,29 @@@ const { chromium } = await browserKit()
const browser = await chromium.launch(chrome ? { executablePath: chrome } : {});
try {
const page = await browser.newPage({ viewport: { width: Number(width), height: Number(height) }, colorScheme: scheme });
- await page.goto(url, { waitUntil: "networkidle" });
+ await page.goto(target, { waitUntil: "networkidle" });
await page.evaluate(() => document.fonts.ready);
await page.waitForTimeout(600);
+ await page.evaluate(async () => {
+ const pause = (ms) => new Promise((done) => setTimeout(done, ms));
+ const root = document.scrollingElement || document.documentElement;
+ let last = root.scrollHeight;
+ for (let step = 0; step < 30 && root.scrollTop < 20_000; step++) {
+ window.scrollBy(0, window.innerHeight);
+ await pause(150);
+ const grown = root.scrollHeight;
+ if (grown <= last && root.scrollTop + window.innerHeight >= grown) break;
+ last = grown;
+ }
+ window.scrollTo(0, 0);
+ const loaded = (image) =>
+ new Promise((done) => {
+ image.addEventListener("load", done, { once: true });
+ image.addEventListener("error", done, { once: true });
+ });
+ const pending = [...document.images].filter((image) => !image.complete);
+ await Promise.race([Promise.all(pending.map(loaded)), pause(5000)]);
+ });
const html = await page.evaluate(async ([label, scheme]) => {
const LIMIT = 3_000_000;
const absolute = (value, base = location.href) => {