LoginSignup
10
19

More than 3 years have passed since last update.

uBlock Origin/Adblock Plus 用フィルタの書き方まとめチートシート

Last updated at Posted at 2020-01-28

uBlock Origin/Adblock Plus 用フィルタの書き方について長々とした記事ばかりなのでシンプルにまとめました。
おそらく最も多くの人が使用している uBlock Origin は Adblock Plus のフィルタ形式をサポートしているため、Adblock Plus のガイドを参考にします。

uBlock Origin ("uBO") supports Adblock Plus ("ABP") filter syntax, so you can refer to existing filter syntax documentation from Adblock Plus web site and ABP's filter cheatsheet. For quick overview you can also check Introduction to basic filtering syntax in this wiki.
https://github.com/gorhill/uBlock/wiki/Static-filter-syntax

なお、インストールするのは Adblock Plus ではなく uBlock Origin を推奨します。
https://gigazine.net/news/20160314-ublock-vs-abp/

フィルタのシンタックスについての詳細:
https://github.com/gorhill/uBlock/wiki/Static-filter-syntax
https://adblockplus.org/filter-cheatsheet
https://help.eyeo.com/en/adblockplus/how-to-write-filters

CSSセレクタについて:
https://webliker.info/css-selector-cheat-sheet/
https://shge.github.io/docs/css.html

シンタックス

* はワイルドカード(すべての数字・文字)

ドメイン単位でブロック

||example.com^
||example.*^

タイプ指定ブロック

||example.com^$script,image

要素ブロック(非表示)

###id_name
##.class_name
example.*###id-name
example.com###id-name
example.com##.class-name
example.com##a[href="https://example.com"]
example.com##footer
example.com##div > p
example.com##div(p:has-text(/^Ad$/))

ホワイトリスト

@@||example.com^

コメント

! This is a comment
10
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
19