Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions apps/site/app/_components/ad-unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useEffect, useRef } from "react";
import { usePathname } from "next/navigation";

/**
* One CrawlProof ad unit, at the top of the main content on public pages.
* One low-profile CrawlProof text-link ad, at the top of the main content on
* public pages. The homepage carries no ad.
* Manage the slot at https://crawlproof.com/ads/slots
*/
const AD_SLOT = "5500e925-8ab1-4dd9-b89d-eaafa3554f68";
Expand All @@ -23,9 +24,6 @@ const EXCLUDED_PREFIXES = [
"/play",
];

/** 728x90 needs the full row; anything narrower gets the 300x250 rectangle. */
const LEADERBOARD_QUERY = "(min-width: 768px)";

const SCAN_RETRY_MS = 200;
const SCAN_MAX_TRIES = 25;

Expand All @@ -36,6 +34,7 @@ declare global {
}

function isExcluded(pathname: string): boolean {
if (pathname === "/") return true;
return EXCLUDED_PREFIXES.some((p) => pathname === p || pathname.startsWith(`${p}/`));
}

Expand All @@ -54,11 +53,9 @@ function AdSlot() {
const el = ref.current;
if (!el) return;
// The server renders the element without data-slot, so ad.js's own
// DOMContentLoaded pass skips it; the format is chosen here from the real
// viewport and the unit fills exactly once.
el.dataset.format = window.matchMedia(LEADERBOARD_QUERY).matches
? "banner_728x90"
: "banner_300x250";
// DOMContentLoaded pass skips it; the unit fills exactly once, as a thin
// fluid text link.
el.dataset.format = "text_link";
el.dataset.slot = AD_SLOT;

// ad.js scans once at DOMContentLoaded and may not have loaded yet, so
Expand Down
13 changes: 2 additions & 11 deletions apps/site/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -1731,8 +1731,7 @@ a {
/*
* CrawlProof ad unit: zero height until ad.js starts a fill (it sets
* data-cp-filled, and removes it again on an empty response), so an unsold or
* blocked slot leaves no hole. The reserved height is the format plus the
* "Advertisement" caption ad.js draws above banners.
* blocked slot leaves no hole. The unit is a thin text_link line.
*/
.cp-ad {
display: flex;
Expand All @@ -1745,13 +1744,5 @@ a {

.cp-ad[data-cp-filled] {
height: auto;
margin: 2rem 0;
}

.cp-ad[data-cp-filled][data-format="banner_728x90"] {
min-height: 106px;
}

.cp-ad[data-cp-filled][data-format="banner_300x250"] {
min-height: 266px;
margin: 10px 0;
}
9 changes: 5 additions & 4 deletions apps/site/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,11 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</nav>
{/* Required fiction disclaimer (PRD 搂32), with the photosensitivity notice. */}
<p className="disclaimer">
NIGHTCELL 7 is a fictional work set in an invented near-future crisis. Its organizations,
facilities, operations, and characters are fictional. The game does not depict or endorse
any real government, military operation, political movement, or current event. It contains
flashing lights and can be played with flash reduction enabled.
NIGHTCELL 7 is a fictional work set in an invented near-future crisis. Its
organizations, facilities, operations, and characters are fictional. The game does not
depict or endorse any real government, military operation, political movement, or
current event. It contains flashing lights and can be played with flash reduction
enabled.
</p>
<p className="footer__badges">
<a href="https://built.indie.pit.world/p/nightcell-7?ref=badge">
Expand Down
Loading