hide-if-canvas-contains
The hide-if-canvas-contains snippet conceals canvas elements or their parent containers by monitoring canvas rendering methods (fillText, strokeText, drawImage).
Parameters
|
Name |
Description |
Mandatory |
|---|---|---|
|
search |
A string or regex pattern to match against text rendered to canvas or image sources. |
Yes |
|
selector |
CSS selector identifying which element to hide. Defaults to the canvas element itself. |
No |
Examples
-
hide-if-canvas-contains /sponsored/— hides canvas elements containing "sponsored" text -
hide-if-canvas-contains /sponsored/ .canvas-parent— hides parent elements with the specified class -
hide-if-canvas-contains /AAAAoAAAAKCA/ .canvas-parent— image matching using regex