Ublock origin doesnt use javascript. The script just involves a tree traversal of the dom and removal of any node that says ad.
The issue is facebook obfuscates selectors so you cant easily do it the way ublock prefers.