Remove Ketch consent banners

This commit is contained in:
2026-05-22 13:37:58 -07:00
parent 3569b11da4
commit 3339deb8e0
2 changed files with 35 additions and 0 deletions

View File

@@ -36,6 +36,10 @@ const COMMON_ANNOYANCE_SELECTORS = [
".iubenda-cs-container", ".iubenda-cs-container",
"#cmpwrapper", "#cmpwrapper",
"[id^=\"cmpbox\"]", "[id^=\"cmpbox\"]",
"#ketch-banner",
"#ketch-consent-banner",
"#lanyard_root:has(#ketch-banner)",
"[class*=\"ketch-\"][role=\"dialog\"][aria-label*=\"privacy\" i]",
".fc-consent-root", ".fc-consent-root",
".fc-dialog-container", ".fc-dialog-container",
"[aria-modal=\"true\"][id*=\"consent\" i]", "[aria-modal=\"true\"][id*=\"consent\" i]",
@@ -79,8 +83,11 @@ const COMMON_ANNOYANCE_TEXT_PATTERNS = [
"allowlist", "allowlist",
"continue using your ad blocker", "continue using your ad blocker",
"disable your ad blocker", "disable your ad blocker",
"non-essential cookies",
"reject non-essential cookies",
"support us by disabling", "support us by disabling",
"support the verge by allowing ads", "support the verge by allowing ads",
"tracking technologies",
"turn off your ad blocker", "turn off your ad blocker",
"you are using an ad blocker" "you are using an ad blocker"
]; ];

View File

@@ -100,6 +100,34 @@ test("renderPage removes common cookie consent overlays before snapshot", async
assert.doesNotMatch(rendered, /<body[^>]*class="[^"]*didomi-popup-open/i); assert.doesNotMatch(rendered, /<body[^>]*class="[^"]*didomi-popup-open/i);
}); });
test("renderPage removes Ketch consent banners before snapshot", async () => {
const html = `<!doctype html>
<html>
<body>
<main>Article text</main>
<div id="lanyard_root">
<div id="ketch-banner" style="position: fixed; bottom: 0; left: 0; right: 0; z-index: 2147483647;">
<div id="ketch-consent-banner" role="dialog" aria-label="privacy banner">
<p>We and our vendors use tracking technologies to recognize visitors.</p>
<button id="ketch-banner-button-tertiary" aria-label="Reject Non-Essential Cookies">
Reject Non-Essential Cookies
</button>
</div>
</div>
</div>
</body>
</html>`;
const rendered = await renderPage(`data:text/html,${encodeURIComponent(html)}`, {
userscriptDelay: 0
});
assert.match(rendered, /Article text/);
assert.doesNotMatch(rendered, /id="ketch-/);
assert.doesNotMatch(rendered, /Reject Non-Essential Cookies/);
assert.doesNotMatch(rendered, /tracking technologies/);
});
test("renderPage removes Admiral adblock walls before snapshot", async () => { test("renderPage removes Admiral adblock walls before snapshot", async () => {
const html = `<!doctype html> const html = `<!doctype html>
<html style="overflow: hidden;"> <html style="overflow: hidden;">