Skip to content

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

JavaScript

Scroll through the page before snapshotting so lazy content is captured

Mohamed Emad19fa223edf09
diff --git a/skills/unslop/SKILL.md b/skills/unslop/SKILL.md
index 9a1c49e..5dab154 100644
--- a/skills/unslop/SKILL.md
+++ b/skills/unslop/SKILL.md
@@ -33,7 +33,7 @@ Which visual styles tend to work, and which fail, is in [references/visuals.md](
## 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. 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 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 --git a/skills/unslop/scripts/snapshot.mjs b/skills/unslop/scripts/snapshot.mjs
index f199b21..59c3dba 100644
--- a/skills/unslop/scripts/snapshot.mjs
+++ b/skills/unslop/scripts/snapshot.mjs
@@ -35,6 +35,26 @@ try {
await page.goto(url, { 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) => {