Skip to content

Latest commit

 

History

History

uBO-sponsored-filter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

JavaScript code for building a "Sponsored" filter rule for use in uBlock Origin

How to use:

  • Copy the contents of the "sponsored-filter-builder.js" file
  • Switch to Facebook
  • In Facebook, scroll down until you see at least 1 sponsored posts (more would be better) and keep it visible
  • DO NOT move the mouse over the "Sponsored" post - if you did by mistake, refresh the page and look for a sponsored post
  • Press the key "F12" - this will bring up the DevTools window
  • Switch to the "Console" tab in the DevTools
  • Paste the contents of the "sponsored-filter-builder.js" file into the Console
  • If the code is successful in finding at least one sponsored post, it'll display a filter rule
  • If the code is not successful in finding at least one sponsored post, then either the sponsored post is not there or it uses a different HTML pattern

What do I do with this rule?

  • Copy the new rule into uBlock Origin (My filters' tab)
  • Reload Facebook and look for posts having a pink dotted border
  • If only the sponsored posts have the pink border, then update the rule as follows:
    • replace :style(border:5px dotted pink !important; width:66% !important;) with :style(width:0 !important; height:0 !important;)
  • If non-sponsored posts also have the pink border, then the rule needs to be "tightened" up - look for the 6 numbers in this format (##|##|##|##|##|##) and remove the first number, save, reload FB, check again. If non-sponsored posts still being marked, remove the last number and try again. Repeat one more time for first and last, until the middle 2 numbers remain. When done, follow the previous step in updating the rule.

Last updated

2022-11--01:

  • Updated News Feed sponsored detection code 2022-10-23:
  • Updated News Feed sponsored detection code 2022-10-21:
  • Updated News Feed sponsored detection code 2022-10-19:
  • Updated News Feed Sponsored detection code
  • Disabled Suggested detection code - too many false-positive hits. Waiting for FB to give me some suggestions (in news feed).