Class: ElemHide

elemHide~ElemHide

elemHide implementation.

Source:

Members

(private, nullable) _commonStyleSheet :string

The common style sheet that applies on all unknown domains.

This is a concatenation of the default style sheet and an additional style sheet based on selectors from all generic filters that are not in the _unconditionalSelectors list.

Type:
  • string
Source:

(private, nullable) _defaultStyleSheet :string

The default style sheet that applies on all domains.

This is based on the value of _unconditionalSelectors.

Type:
  • string
Source:

(private) _exceptionDomains :Set.<string>

All domains known to occur in exceptions

Type:
  • Set.<string>
Source:

(private) _filterBySelector :Map.<string, Filter>

Lookup table, filter by selector.

(Only used for selectors that are unconditionally matched for all domains.)

Type:
  • Map.<string, Filter>
Source:

(private) _filters :Set.<module:filterClasses.ElemHideFilter>

Set containing known element hiding filters

Type:
Source:

(private) _filtersByDomain :FiltersByDomain

Lookup table, active flag, by filter by domain.

(Only contains filters that aren't unconditionally matched for all domains.)

Type:
  • FiltersByDomain
Source:

(private) _styleSheetCache :Cache.<string, string>

Cache of generated domain-specific style sheets.

This contains entries for only known domains. If a domain is unknown, it gets _commonStyleSheet.

Type:
  • Cache.<string, string>
Source:

(private, nullable) _unconditionalSelectors :Array.<string>

This array caches the keys of _filterBySelector (selectors which unconditionally apply on all domains).

It will be null if the cache needs to be rebuilt.

Type:
  • Array.<string>
Source:

Methods

(private) _getCommonStyleSheet() → {string}

Returns the common style sheet that applies on all unknown domains.

Source:
Returns:
Type
string

(private) _getConditionalSelectors(domain, specificOnly) → {Array.<string>}

Returns the list of selectors that apply on a given domain from the subset of filters that do not apply unconditionally on all domains.

Parameters:
Name Type Description
domain string

The domain.

specificOnly boolean

Whether selectors from generic filters should be included.

Source:
Returns:

The list of selectors.

Type
Array.<string>

(private) _getConditionalSelectorsWithExceptions(domain, specificOnly) → {Object}

Returns the list of selectors and the list of exceptions that apply on a given domain from the subset of filters that do not apply unconditionally on all domains.

Parameters:
Name Type Description
domain string

The domain.

specificOnly boolean

Whether selectors from generic filters should be included.

Source:
Returns:

An object containing the lists of selectors and exceptions.

Type
Object

(private) _getDefaultStyleSheet() → {string}

Returns the default style sheet that applies on all domains.

Source:
Returns:
Type
string

(private) _getDomainSpecificStyleSheet(domain) → {string}

Returns the domain-specific style sheet that applies on a given domain.

Parameters:
Name Type Description
domain string
Source:
Returns:
Type
string

(private) _getKnownSuffix(domainnullable) → {string}

Returns the suffix of the given domain that is known.

If no suffix is known, an empty string is returned.

Parameters:
Name Type Attributes Description
domain string <nullable>
Source:
Returns:
Type
string

(private) _getUnconditionalSelectors() → {Array.<string>}

Returns a list of selectors that apply on each website unconditionally.

Source:
Returns:
Type
Array.<string>

add(filter)

Add a new element hiding filter.

Parameters:
Name Type Description
filter module:filterClasses.ElemHideFilter
Source:

clear()

Removes all known element hiding filters.

Source:

generateStyleSheetForDomain(domain, specificOnlyopt, includeSelectorsopt, includeExceptionsopt) → {module:elemHide~ElemHideStyleSheet}

Returns a style sheet for a given domain based on the current set of filters.

Parameters:
Name Type Attributes Default Description
domain string

The domain.

specificOnly boolean <optional>
false

Whether selectors from generic filters should be included.

includeSelectors boolean <optional>
false

Whether the return value should include a separate list of selectors.

includeExceptions boolean <optional>
false

Whether the return value should include a separate list of exceptions.

Deprecated:
Source:
See:
Returns:

An object containing the CSS code and the list of selectors.

Type
module:elemHide~ElemHideStyleSheet

getStyleSheet(domain, specificOnlyopt, includeSelectorsopt, includeExceptionsopt) → {module:elemHide~ElemHideStyleSheet}

Returns a style sheet for a given domain based on the current set of filters.

Parameters:
Name Type Attributes Default Description
domain string

The domain.

specificOnly boolean <optional>
false

Whether selectors from generic filters should be included.

includeSelectors boolean <optional>
false

Whether the return value should include a separate list of selectors.

includeExceptions boolean <optional>
false

Whether the return value should include a separate list of exceptions.

Source:
Returns:

An object containing the CSS code and the list of selectors.

Type
module:elemHide~ElemHideStyleSheet

has(filter) → {boolean}

Checks whether an element hiding filter exists.

Parameters:
Name Type Description
filter module:filterClasses.ElemHideFilter
Source:
Returns:
Type
boolean

remove(filter)

Removes an existing element hiding filter.

Parameters:
Name Type Description
filter module:filterClasses.ElemHideFilter
Source: