-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapse empty ad spaces (element hiding) #508
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jonathanKingston
approved these changes
Oct 6, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you.
jonathanKingston
pushed a commit
to duckduckgo/content-scope-scripts
that referenced
this pull request
Oct 6, 2022
This PR adds the element-hiding.js content script, which is injected into pages to hide empty ad spaces. This is similar functionality to what most ad blockers call 'cosmetic filtering' with one key caveat: we are only hiding spaces where ads didn't load due to blocked tracker requests. To accomplish this we use a heuristic to check each ad container selector for visible content, and only hide if no visible content (eg non-tracking ads) is found. Initially this feature will only be enabled in the macOS app, with other client support to come as follow ups. This feature is v1, we will likely follow up with a more sophisticated approach in the near future. This script functions based on Privacy Configuration rules so that coverage may be expanded remotely without requiring updates to this repo or clients. To see this functionality in action, navigate to a site that has a large blank space at the top of the page where a tracking banner ad didn't load, and see that the empty space is hidden shortly after page load. A few example sites to check are bloomberg.com, cyclingtips.com, and fandom.com. Asana link: https://app.asana.com/0/0/1203092629639220/f Corresponding privacy config PR: duckduckgo/privacy-configuration#508
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Asana Tasks:
Description
This PR establishes a new config for the element hiding feature, which hides empty ad spaces where tracking ads were blocked. This will initially only be enabled in the macOS app, with other client support coming soon.
Config details
exceptions
key contains a list of hostnames where this element hiding is disabledsettings
key contains:hide-empty
- checks if element contains visible content, if not hides elementclosest-empty
- same as hide-empty, but recursively moves up the DOM tree hiding empty elements until it reaches a non-empty elementhide
- hides matching elements without checking if empty first. Should only be used if we know for certain that matching elements always contain blocked adsoverride
- disables matching global rule, allows us to turn off a global rule on a specific domain if we find it's causing breakage there