UNPKG

@cliqz/autoconsent

Version:

This is a library of rules for navigating through common consent popups on the web. These rules can be run in a Firefox webextension, or in a puppeteer orchestrated headless browser. Using these rules, opt-in and opt-out options can be selected automatica

17 lines (14 loc) 638 B
import { AutoCMP, TabActor } from './types'; // hide rules not specific to a single CMP rule const globalHidden = [ "#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium", ] export default async function prehideElements(tab: TabActor, rules: AutoCMP[]): Promise<void> { const selectors = rules.reduce((selectorList, rule) => { if (rule.prehideSelectors) { return [...selectorList, ...rule.prehideSelectors]; } return selectorList; }, globalHidden); await tab.hideElements(selectors); }