跳到正文
Skillpedia
通用编程75k · #2829

element-hiding

它能做什么

这项技能检查网站中广告拦截器常会隐藏的名称,例如 banner 或 ad,并建议更安全的替代名称。适用于需要让重要通知保持可见的网站所有者。

适用场景

  • ✓当 Cookie 提示或横幅没有出现在部分访客面前的时候。
  • ✓当开启广告拦截器后,促销或通知内容消失的时候。
  • ✓当你为新的页面元素选择 class 或 ID 名称的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/element-hiding/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/element-hiding/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我检查我的 Cookie 横幅是否会被广告拦截器隐藏?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查 class 和 ID 名称,看它们是否符合常见广告过滤规则。对于 Cookie 同意提示等重要元素,它会建议更具体的名称。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Adblock Element Hiding

If your cookie consent banner has class .cookie-banner or ID #consent-popup, adblockers may hide it — users never see the consent notice, which can cause GDPR compliance issues and broken UX for ~30-40% of desktop users.

Quick Reference

  • Adblockers use EasyList filter rules to hide elements with class names, IDs, or patterns associated with ads
  • Common blocked names: .ad, .ads, .advertisement, .banner, #ad, #ads, #banner, .sponsor
  • Affected elements: legitimate banners, notification bars, promotional sections, and cookie consent notices
  • Test your site with uBlock Origin enabled — check for missing content, broken layouts, or hidden consent banners
  • Rename affected elements using semantic, content-specific class names to avoid false-positive blocking

Check

Review the HTML source for element IDs and class names that match common adblocker patterns: .ad, .ads, .advertisement, .banner, .sponsor, #ad, #banner, .cookie-notice, .consent. Test the page with uBlock Origin enabled in a browser to identify elements that are hidden.

Fix

Rename affected elements using specific, content-focused class names that do not match adblocker patterns. For cookie consent banners specifically, use class names like .privacy-controls or .cookie-preferences instead of .cookie-banner or .gdpr-notice.

Explain

Explain how adblocker filter lists work, which HTML class names and IDs are commonly blocked, and how to rename elements to avoid false-positive blocking while maintaining their function.

Code Review

Review server config, headers, forms, and integration points related to Adblock Element Hiding. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/security/element-hiding

常见问题

为什么广告拦截器会隐藏正常内容?

它们的过滤列表会针对 ad、banner、sponsor 等名称,因此名称相似的无害元素也可能被误拦。

应该如何测试?

这项技能建议在开启 uBlock Origin 的情况下加载页面,并检查是否有内容缺失。

它会建议什么名称?

例如用 privacy-controls 或 cookie-preferences 代替 cookie-banner。

详情

作者的原始描述

Use when reviewing a website for layout and functionality issues caused by adblocker filter rules targeting common ad-related class names and IDs.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2829
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能