From dcc18d5231af6253b0e991bf04a4c764982fe262 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 Jul 2026 12:28:23 -0700 Subject: [PATCH] Remove in-game CrazyGames banner ad (#4567) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Remove the bottom-left 300×250 CrazyGames banner ad shown during gameplay (created when the spawn phase ends in `InGamePromo`), including its cleanup path in `hideAd()` - Remove the now-unused `createBottomLeftAd()` / `clearBottomLeftAd()` wrappers and the `banner` portion of the CrazyGames SDK type declaration On CrazyGames, `window.adsEnabled` is already forced to `false` (Main.ts), so the Playwire in-game path can't activate there — with this change the game screen shows no ads at all on the CrazyGames platform. Midgame video interstitials (singleplayer start, game exit) are unchanged. ## Test plan - [x] `npx tsc --noEmit` passes - [x] ESLint passes on touched files - [ ] On CrazyGames: no banner appears bottom-left after spawn phase ends 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 --- src/client/CrazyGamesSDK.ts | 74 ---------------------------- src/client/hud/layers/InGamePromo.ts | 35 ------------- 2 files changed, 109 deletions(-) diff --git a/src/client/CrazyGamesSDK.ts b/src/client/CrazyGamesSDK.ts index 5c938fcdd..fcdca19fc 100644 --- a/src/client/CrazyGamesSDK.ts +++ b/src/client/CrazyGamesSDK.ts @@ -27,16 +27,6 @@ declare global { }, ) => void; }; - banner: { - requestBanner: (options: { - id: string; - width: number; - height: number; - }) => Promise; - requestResponsiveBanner: (containerId: string) => Promise; - clearBanner: (containerId: string) => void; - clearAllBanners: () => void; - }; game: { gameplayStart: () => Promise; gameplayStop: () => Promise; @@ -387,70 +377,6 @@ export class CrazyGamesSDK { } } - private bottomLeftContainerId = "cg-bottom-left-ad"; - private bottomLeftAdVisible = false; - - createBottomLeftAd(): void { - console.log( - `[CrazyGames] createBottomLeftAd called, isReady=${this.isReady()}`, - ); - if (!this.isReady()) { - console.log("[CrazyGames] SDK not ready, skipping bottom-left ad"); - return; - } - - if (this.bottomLeftAdVisible) { - console.log("[CrazyGames] Bottom-left ad already visible"); - return; - } - - // Remove existing container if any - document.getElementById(this.bottomLeftContainerId)?.remove(); - - const container = document.createElement("div"); - container.id = this.bottomLeftContainerId; - container.style.cssText = ` - position: fixed; - bottom: 0; - left: 0; - width: 300px; - height: 250px; - z-index: 9999; - pointer-events: auto; - `; - document.body.appendChild(container); - console.log("[CrazyGames] Created bottom-left ad container"); - - (async () => { - try { - await window.CrazyGames!.SDK.banner.requestBanner({ - id: this.bottomLeftContainerId, - width: 300, - height: 250, - }); - console.log("[CrazyGames] Bottom-left banner loaded"); - } catch (e) { - console.log("[CrazyGames] Bottom-left banner error:", e); - } - })(); - - this.bottomLeftAdVisible = true; - } - - clearBottomLeftAd(): void { - if (!this.bottomLeftAdVisible) return; - - try { - window.CrazyGames!.SDK.banner.clearBanner(this.bottomLeftContainerId); - } catch (e) { - console.error("[CrazyGames] Error clearing bottom-left banner:", e); - } - - document.getElementById(this.bottomLeftContainerId)?.remove(); - this.bottomLeftAdVisible = false; - console.log("[CrazyGames] Bottom-left ad cleared"); - } - requestMidgameAd(): Promise { return new Promise((resolve) => { if (!this.isReady()) { diff --git a/src/client/hud/layers/InGamePromo.ts b/src/client/hud/layers/InGamePromo.ts index 60f9cff32..2d2e3bfeb 100644 --- a/src/client/hud/layers/InGamePromo.ts +++ b/src/client/hud/layers/InGamePromo.ts @@ -1,7 +1,6 @@ import { LitElement, html } from "lit"; import { customElement } from "lit/decorators.js"; import { Controller } from "../../Controller"; -import { crazyGamesSDK } from "../../CrazyGamesSDK"; import { GameView } from "../../view"; const AD_TYPES = [ @@ -52,17 +51,9 @@ export class InGamePromo extends LitElement implements Controller { } private showAd(): void { - console.log( - `[InGamePromo] showAd called, isOnCrazyGames=${crazyGamesSDK.isOnCrazyGames()}`, - ); if (window.innerWidth < 1100) return; if (window.innerHeight < 750) return; - if (crazyGamesSDK.isOnCrazyGames()) { - this.showCrazyGamesAd(); - return; - } - if (!window.adsEnabled) return; this.shouldShow = true; @@ -74,25 +65,6 @@ export class InGamePromo extends LitElement implements Controller { }); } - private showCrazyGamesAd(): void { - console.log( - `[InGamePromo] showCrazyGamesAd called, isReady=${crazyGamesSDK.isReady()}, width=${window.innerWidth}, height=${window.innerHeight}`, - ); - if (!crazyGamesSDK.isReady()) { - console.log( - "[InGamePromo] CrazyGames SDK not ready, skipping in-game ad", - ); - return; - } - - this.requestUpdate(); - - this.updateComplete.then(() => { - console.log("[InGamePromo] DOM updated, calling createBottomLeftAd"); - crazyGamesSDK.createBottomLeftAd(); - }); - } - private checkForAds(): void { if (this.adCheckInterval) { clearInterval(this.adCheckInterval); @@ -146,13 +118,6 @@ export class InGamePromo extends LitElement implements Controller { this.adsVisible = false; this.destroyBottomRail(); - if (crazyGamesSDK.isOnCrazyGames()) { - crazyGamesSDK.clearBottomLeftAd(); - this.shouldShow = false; - this.requestUpdate(); - return; - } - if (!window.ramp) { console.warn("Playwire RAMP not available for in-game ad"); return;