hide-if-contains-visible-text

hide-if-contains-visible-text

The hide-if-contains-visible-text snippet hides any HTML element that matches a CSS selector if the element's visible text content contains a given string. It can check CSS attributes to locate a string even when a website employs methods to obscure the text.

Parameters

Name

Description

Mandatory

search

The string to match against visible text. Enclose in / for regex.

Yes

selector

The CSS selector that an HTML element must match to be hidden.

Yes

searchSelector

CSS selector for elements containing the string. Defaults to selector.

No

optionalParameters

CSS attributes a computed style map should have to consider a node hidden. Syntax: 'key:value'.

No

Default parameters

Name

Description

Default Value

-wait-until

Event to wait for before executing.

'-wait-until:'

-disable-font-check

Disable the font visibility check.

'-disable-font-check:false'

-snippet-box-margin

Expand bounding box of overflow parent (pixels).

'-snippet-box-margin:2'

-disable-bg-color-check

Disable check for same text/background color.

'-disable-bg-color-check:false'

-check-is-contained

Categorize elements pushed outside a parent.

'-check-is-contained:false'

opacity

Check for transparent gibberish text.

'opacity:0'

font-size

Check for zero-size gibberish text.

'font-size:0'

color

Check for same-color gibberish text.

'color:rgba(0, 0, 0, 0)'

Filter examples

Filter

Result

hide-if-contains-visible-text FAQ nav

Hides any nav element whose visible text contains "FAQ".

hide-if-contains-visible-text FAQ nav a

Hides nav elements that have an a element with "FAQ" visible text.

hide-if-contains-visible-text /.*/ li.serp-item 'li.serp-item div.label'

Hides matching list items.

hide-if-contains-visible-text /.*/ li.serp-item 'li.serp-item div.label' 'color:rgb(255, 255, 255)'

Hides items whose font color is not white.