How to use @cliqz/adblocker-webextension-cosmetics - 2 common examples

To help you get started, we’ve selected a few @cliqz/adblocker-webextension-cosmetics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cliqz-oss / adblocker / packages / adblocker-webextension-example / content-script.ts View on Github external
*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

import { injectCosmetics } from '@cliqz/adblocker-webextension-cosmetics';

/**
 * `injectCosmetics` is in charge of all ad-blocking logic on the content-script
 * side. It handles the following:
 * - Inject scripts into the page, which might be used to defuse anti-adblockers.
 * - Block the execution of some scripts in the page (only if the
 * 'beforescriptexecute' event is available, currently only on Firefox).
 */
injectCosmetics(window, true /* MutationObserver */);
github remusao / blockrz / content-script.ts View on Github external
* All the filters and matching logic lives in the background of the extension,
 * the content script needs a way to request relevant cosmetic filters for each
 * frame. This communication can be handled in several ways (e.g.: `connect` or
 * `sendMessage`). By default, `sendMessage` is used.
 *
 * The background should listen to these messages and answer back with lists of
 * filters to be injected in the page, as well as scriplets (small
 * self-contained programs) which should be injected.
 *
 * `injectCosmetics` is in charge of all ad-blocking logic on the content-script
 * side. It handles the following:
 * - Requests information from background
 * - Monitor DOM changes and informs background
 * - Injects scriplets returned by background into frames
 */
injectCosmetics(window, true /* observe DOM mutations */);

@cliqz/adblocker-webextension-cosmetics

Enable cosmetics in WebExtension content blocker using Cliqz adblocker

MPL-2.0
Latest version published 9 days ago

Package Health Score

79 / 100
Full package analysis

Popular @cliqz/adblocker-webextension-cosmetics functions

Similar packages