TypeSafe AdBlock
Chrome extension that asks Jev whether each DOM element is an ad and removes the ones that are.
# TypeSafe Fun AdBlocker 🧹
A Chrome extension (Manifest V3) that spots ads on any website in real time and pops
their DOM elements out of the page. The semantic call, "is this element an ad?", is made
by [TypeSafe AI](https://docs.typesafe.ai)'s System One model **Jev**. Everything else
is plain code.
> **This is a fun side project, not a real ad blocker.** It costs API tokens per page,
> it will miss ads, it will occasionally eat something that is not an ad, and it does
> nothing about tracking, malware, or video ads. If you want a real ad blocker, use uBlock
> Origin. If you want to see a tiny decision model judge DOM elements, read on.
**BYOK: bring your own key.** There is no backend. You paste your own TypeSafe API key
into the popup; it is stored in `chrome.storage.sync` in your browser and sent only to
`https://api.typesafe.ai`. You pay for your own usage.
## How it works
1. **Find candidates (code)** – `src/content.js` looks for ad-shaped elements:
`iframe` / `ins`, id and class tokens like `ad`, `sponsored`, `banner`, `data-ad-*`
attributes, links to ad networks, and short labels such as "Sponsored", "Advertisement",
"Anzeige", "Werbung". Tight wrappers are collapsed into one candidate. Anything too
big (half the viewport, contains `main` or `h1`) is skipped. Teaser cards are climbed
from the label up to the whole card (`article` / `li`), stopping at page-level
containers, at 35 % of the viewport, at 1500 characters of text, or when the parent
holds a second label (then it is a feed, not a card).
2. **Describe compactly (code)** – each candidate becomes a small JSON object: tag,
classes, label, text excerpt, link hosts, iframe host, shape ("wide horizontal
banner"), whether it has a standard IAB size, and any recognized ad netwo