Introduction to Cumfilter: A Full-Featured Ad Blocker Rule Language

Cumfilter is a rule language used in Porthos AdBlocker to filter out unwanted content from webpages. It is a full-featured language that allows for granular control over what content is allowed and what content is blocked. The name "cumfilter" is a play on words, with "cum" being short for "cumulative" and "filter" referring to the filtering of content.

Syntax of Cumfilter

Cumfilter uses a simple and intuitive syntax to define rules. Each rule consists of a domain and a set of filter options. The domain is the URL of the webpage that the rule applies to, and the filter options are a set of directives that specify what content to block.

Here is an example of a cumfilter rule that blocks all images on the example.com domain:

example.com {
    image
}

This rule tells Porthos AdBlocker to block all images on webpages with URLs that start with "example.com". The "image" directive is used to specify that only images should be blocked.

Cumfilter also supports more advanced filtering options, such as regular expressions and wildcards. Here is an example of a rule that blocks all URLs that match a regular expression:

.*\.example\.com/.* {
    script
}

This rule tells Porthos AdBlocker to block all scripts on webpages with URLs that match the regular expression "..example.com/.". The "script" directive is used to specify that only scripts should be blocked.

Use Cases of Cumfilter

Cumfilter is a powerful language that can be used for a variety of purposes. Here are some common use cases:

Conclusion

Cumfilter is a powerful rule language that can be used to filter out unwanted content from webpages. Its simple and intuitive syntax makes it easy to use, and its advanced filtering options provide granular control over what content is allowed and what content is blocked. With Porthos AdBlocker and cumfilter, users can enjoy a faster, safer, and more enjoyable browsing experience.