How to use @cliqz/adblocker-content - 6 common examples

To help you get started, we’ve selected a few @cliqz/adblocker-content 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-cosmetics / adblocker.ts View on Github external
const handleNodes = (nodes: Element[]) => {
        const { classes, ids, hrefs } = extractFeaturesFromDOM(nodes);
        const newIds: string[] = [];
        const newClasses: string[] = [];
        const newHrefs: string[] = [];

        // Update ids
        for (let i = 0; i < ids.length; i += 1) {
          const id = ids[i];
          if (knownIds.has(id) === false) {
            newIds.push(id);
            knownIds.add(id);
          }
        }

        for (let i = 0; i < classes.length; i += 1) {
          const cls = classes[i];
          if (knownClasses.has(cls) === false) {
github cliqz-oss / adblocker / packages / adblocker-electron / preload.ts View on Github external
const handleNodes = (nodes: Element[]) => {
        const { classes, ids, hrefs } = extractFeaturesFromDOM(nodes);
        const newIds: string[] = [];
        const newClasses: string[] = [];
        const newHrefs: string[] = [];

        // Update ids
        for (let i = 0; i < ids.length; i += 1) {
          const id = ids[i];
          if (knownIds.has(id) === false) {
            newIds.push(id);
            knownIds.add(id);
          }
        }

        for (let i = 0; i < classes.length; i += 1) {
          const cls = classes[i];
          if (knownClasses.has(cls) === false) {
github cliqz-oss / adblocker / packages / adblocker-puppeteer / adblocker.ts View on Github external
hostname,
      url,

      // DOM information
      classes,
      hrefs,
      ids,
    });

    // Abort if cosmetics are disabled
    if (active === true) {
      // Inject scripts
      for (let i = 0; i < scripts.length; i += 1) {
        frame
          .addScriptTag({
            content: autoRemoveScript(scripts[i]),
          })
          .catch(() => {
            // Ignore
          });
      }

      // Inject CSS
      if (styles.length !== 0) {
        frame
          .addStyleTag({
            content: styles,
          })
          .catch(() => {
            // Ignore
          });
      }
github cliqz-oss / adblocker / packages / adblocker-webextension-cosmetics / adblocker.ts View on Github external
      setTimeout(() => injectScript(scripts[i], window.document), 0);
    }
github cliqz-oss / adblocker / packages / adblocker-circumvention / src / helpers.ts View on Github external
return (window: Window, args: any[]) =>
    injectScript(wrapCallableInContext(autoCallFunction(fn, args), deps), window.document);
}

@cliqz/adblocker-content

Ghostery adblocker library (content-scripts helpers)

MPL-2.0
Latest version published 2 months ago

Package Health Score

56 / 100
Full package analysis

Similar packages