Class: ContentFilter

(private) filterClasses.ContentFilter(text, domainsopt, body)

Base class for content filters

Constructor

(private) new ContentFilter(text, domainsopt, body)

Parameters:
Name Type Attributes Description
text string

see Filter()

domains string <optional>

Host names or domains the filter should be restricted to

body string

The body of the filter or the script that should be executed or the CSS selector for the HTML elements that should be hidden

Source:

Extends

Members

disabled :boolean

Defines whether the filter is disabled globally.

Type:
  • boolean
Overrides:
Deprecated:
Source:

disabledSubscriptions :Set.<string>

Defines which subscriptions the filter is disabled for. See module:filterClasses.ActiveFilter#isDisabledForSubscription and module:filterClasses.ActiveFilter#setDisabledForSubscription for disabling and enabling filters.

Type:
  • Set.<string>
Overrides:
Source:

(nullable) domains :Map.<string, boolean>

Map containing domains that this filter should match on/not match on or null if the filter should match on all domains

Type:
  • Map.<string, boolean>
Overrides:
Source:

domainSeparator :string

Separator character used in domainSource property

Type:
  • string
Overrides:
Source:

(nullable) domainSource :string

String that the domains property should be generated from

Type:
  • string
Overrides:
Source:

hitCount :number

Number of hits on the filter since the last reset

Type:
  • number
Overrides:
Source:

lastHit :number

Last time the filter had a hit (in milliseconds since the beginning of the epoch)

Type:
  • number
Overrides:
Source:

requiresPrivilegedSubscription :bool

True if filter should only be loaded if it comes from a privileged subscription (circumvention subscriptions or special subscriptions).

Type:
  • bool
Overrides:
Source:

(nullable) sitekeys :Array.<string>

Array containing public keys of websites that this filter should apply to

Type:
  • Array.<string>
Overrides:
Source:

(nullable) sitekeySource :string

String that the sitekey property should be generated from

Type:
  • string
Overrides:
Source:

size :number

Number of filters contained, will always be 1 (required to optimize Matcher).

Type:
  • number
Overrides:
Source:

type :string

Filter type as a string, e.g. "blocking".

Can be blocking, allowing, elemhide, elemhideexception, elemhideemulation, snippet, comment or invalid.

Type:
  • string
Overrides:
Source:

Methods

(static) fromText(text, domainsopt, typeopt, body) → {module:filterClasses.ElemHideFilter|module:filterClasses.ElemHideException|module:filterClasses.ElemHideEmulationFilter|module:filterClasses.SnippetFilter|module:filterClasses.InvalidFilter}

Creates a content filter from a pre-parsed text representation

Parameters:
Name Type Attributes Description
text string

same as in Filter()

domains string <optional>

domains part of the text representation

type string <optional>

rule type, either: * "" for an element hiding filter * "@" for an element hiding exception filter * "?" for an element hiding emulation filter * "$" for a snippet filter

body string

body part of the text representation, either a CSS selector or a snippet script

Source:
Returns:
Type
module:filterClasses.ElemHideFilter | module:filterClasses.ElemHideException | module:filterClasses.ElemHideEmulationFilter | module:filterClasses.SnippetFilter | module:filterClasses.InvalidFilter

isActiveOnDomain(docDomainopt, nullable, sitekeyopt) → {boolean}

Checks whether this filter is active on a domain.

Parameters:
Name Type Attributes Description
docDomain string <optional>
<nullable>

domain name of the document that loads the URL

sitekey string <optional>

public key provided by the document

Overrides:
Source:
Returns:

true in case of the filter being active

Type
boolean

isActiveOnlyOnDomain(docDomainopt, nullable) → {boolean}

Checks whether this filter is active only on a domain and its subdomains.

Parameters:
Name Type Attributes Description
docDomain string <optional>
<nullable>
Overrides:
Source:
Returns:
Type
boolean

isDisabledForSubscription(subscriptionUrl) → {boolean}

Checks whether this filter is disabled.

Parameters:
Name Type Description
subscriptionUrl string

The subscription to check for enabled / disabled state.

Overrides:
Source:
Returns:

true if the filter is disabled

Type
boolean

isGeneric() → {boolean}

Checks whether this filter is generic or specific

Overrides:
Source:
Returns:
Type
boolean

setDisabledForSubscription(subscriptionUrlopt, valueopt)

Disables or enables the filter.

Parameters:
Name Type Attributes Description
subscriptionUrl string <optional>

The subscription on which to disable / enable the filter.

value boolean <optional>

new disabled value, true for disabled and false for enabled

Overrides:
Source: