I recommend NoScript: https://en.wikipedia.org/wiki/NoScript
It's GPL and it lets you block javascript from any number of sites. It also keeps a whitelist that you can easily change whenever you visit a web page. It helps you to avoid the javascript trap.