Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
chore(branding): reword position-mapping comments (#5107)
Abimael Martell02c95b9c7759
diff --git a/apps/api/src/__tests__/lib/branding/branding-script-buttons.test.ts b/apps/api/src/__tests__/lib/branding/branding-script-buttons.test.tsindex 180700ddd..9554540d9 100644--- a/apps/api/src/__tests__/lib/branding/branding-script-buttons.test.ts+++ b/apps/api/src/__tests__/lib/branding/branding-script-buttons.test.ts@@ -115,8 +115,8 @@ describe("branding script button detection", () => {});it("reports positions in a very tall window as they would be on a screen", () => {- // Branding scrapes render 100,000px tall: a hero sized to the window is- // that tall, with its centered button halfway down.+ // A hero sized to the window is as tall as it, with its centered button+ // halfway down.const snaps = scan(`<section data-top="0" data-w="1920" data-h="100000"><button data-top="40">Log in</button>diff --git a/apps/api/src/scraper/scrapeURL/engines/fire-engine/branding-script/buttons.ts b/apps/api/src/scraper/scrapeURL/engines/fire-engine/branding-script/buttons.tsindex 30d7148a1..33fa72a19 100644--- a/apps/api/src/scraper/scrapeURL/engines/fire-engine/branding-script/buttons.ts+++ b/apps/api/src/scraper/scrapeURL/engines/fire-engine/branding-script/buttons.ts@@ -42,10 +42,9 @@ export const isViewportAnchored = (el: Element): boolean => {return false;};-// Branding scrapes render in a very tall window (100,000px), which stretches-// anything sized to the window: a hero with `min-height: 100vh` is 100,000px-// tall, with its centered button 50,000px down. In such a window, positions-// are reported as they would be on a screen of this height.+// In a window much taller than a screen, anything sized to the window+// stretches with it. Positions are then reported as they would be on a screen+// of this height.const SCREEN_PX = 1080;const isTallWindow = (): boolean => window.innerHeight > 10 * SCREEN_PX;@@ -87,7 +86,7 @@ const toScreenOffset = (offset: number): number =>? offset: (offset * SCREEN_PX) / window.innerHeight;-/** A page position in the tall window, mapped to a page of real screens. */+/** A page position in a tall window, mapped to a page of real screens. */const toScreenPosition = (top: number): number => {const scale = SCREEN_PX / window.innerHeight;let removed = 0;