diff --git a/Plans/08 WebKit engine/S058-ad-removal-animation.md b/Plans/08 WebKit engine/S058-ad-removal-animation.md new file mode 100644 index 0000000..91bbad4 --- /dev/null +++ b/Plans/08 WebKit engine/S058-ad-removal-animation.md @@ -0,0 +1,50 @@ +# S058 — Ads vanish before your eyes (Pie-style removal animation, port of the original) + +> Category 08 WebKit engine · Model: Opus · Effort: medium · Depends on: S057 · Size: S · Human: no · **cargo** (main target/) +> Files touched: src/inject.rs (`COSMETIC_JS` → zap script), src/adblock.rs / src/actions.rs (options to the page: colours, badge, timing, pause), src/theme.rs (badge colours), src/ui/pages/settings.rs (row text), tests/smoke/*, tests/smoke/pages/* + +## Goal +The user asked for this before and it got lost (user, 2026-11-14): ads you can see should go away **right before your +eyes**, like Pie Adblock: a cookie-shaped overlay with a shield and check mark covers the ad, squishes and spins away, +and the space closes up. The original Python Nacre had it (`adblock.animate`, default on: "removed ads squish away in a +Material animation (visible ones only)"); the Rust port kept only a 250 ms fade + scale (`src/inject.rs` `COSMETIC_JS` +`hide()`, setting row "Animate ad removal" in `settings.rs` ~826, `s.adblock.animate`). + +Port the original, which is the spec: `~/Documents/Apps/Nacre/nacre/services.py` `ZAP_JS` (~430–495) and +`zap_badge()` (~345), options from `window.py` ~1378–1390. Read them, don't change them (reference only). +- Detection: cosmetic rules don't hide directly; they give matches a 1 ms `__nz_detect` animation and the page's own + `animationstart` hands over each element as it renders (no selector scanning). Check WebKit fires it (it should). +- Overlay: an absolutely placed div over the ad's rect, background = the cookie badge (90-point polygon with 9 lobes, + shield, check mark; SVG data URI in the theme's primary/onPrimary) centred at `min(64px,40%)` over primaryContainer + at 92 %; keyframes `__nz_ov`: fade in, scale .97 with growing corner radius, then .72 rotated −4°, then 0 rotated + −14° with a circular clip; the ad fades out under it; then the slot collapses (height/width/margin/padding → 0 over + 340 ms) and gets `display:none`. +- Safety: never touch elements that are or contain `