Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • A adblockpluscore
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 80
    • Issues 80
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Jira
    • Jira
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • eyeoeyeo
  • adblockplus
  • abc
  • adblockpluscore
  • Issues
  • #369
Closed
Open
Issue created Sep 20, 2021 by peace2000@peace2000

Inversing element hiding emulation using `:not()`

Background

I noticed that ABP cannot inverse :-abp-has and :-abp-contains selectors. Could you consider adding support for this syntax? It's supported by uBO and AG too.

Couple of use cases:

I wanted to make a filter, that would hide a cookie banner notification on yle.fi, if an article doesn't contain embedded tweets. That's because embedded tweets won't work unless you accept cookies. And if you hide that banner, you cannot accept them. But as only few/some articles have embedded tweets, there's no reason why the banner couldn't be hid if the article doesn't contain embedded tweets.

Article having a tweet: https://yle.fi/uutiset/3-11972567

Article not having one: https://yle.fi/uutiset/3-12107126

The rule I made for this purpose:

yle.fi#?##yle-consent-sdk-container:not(:-abp-has(~ .yle__app a[href^="https://twitter.com/"]))

Another use case: I could use a filter reska.fi##[class|="ml-adverts"] on https://reska.fi/ to remove some ads. But I don't want to use that rule because it will remove a widget:

image

That widget is a tool to find local lunch places - so it's not an ad. Annoyance, maybe but not an ad. So, in this case, a rule like this would do the trick:

reska.fi#?#[class|="ml-adverts"]:not(:-abp-has(a[href="https://reska.fi/lounasreska/"]))

I think that combining :not with :-abp-has or :-abp-contains is something that, in my opinion, anyone would consider useful. :)

Opened this now, @mile-ne

What to change

  • Change the element hiding emulation content script to handle :not() around the advanced selectors.
  • Add tests
  • Coordinate with QA for a new testpage.

Testing Notes

The two above use cases should work as expected. For example, when navigating to https://reska.fi/ with the custom filter reska.fi#?#[class|="ml-adverts"]:not(:-abp-has(a[href="https://reska.fi/lounasreska/"])), adverts should be hidden but the widget highlighted in the screenshot above should not be removed.

Release Notes

When this is in a released version of ABP, the filter documentation should be updated by merging eyeo/websites/help.eyeo.com!123 (merged)

Edited Jan 06, 2022 by Justin Wernick
Assignee
Assign to
Time tracking