Script Summary: Hides ads from Facebook
Facebook is constantly changing, they did a huge restyling lately and I really have no more time to keep the script up to date. I did my best since some months ago, but I don't use facebook anymore, at least not as much as I used before. I hope someone else is doing a better job here on userscripts, and that you'll find elsewhere what you're looking for here. The problem is that the ads are heavily coupled with the platform now, if you hide them you miss something about facebook. This is, among other facts, why I decided to remove facebook from life.
Simply hides/removes ads at all from facebook pages. it's like many other ones but it's much more reliable and up to date.
The main features are:
- hides the avertisments sidebar on the profile page
- removes(!) every box on every page that could contain a banner
- IFrames where the src attribute matches a pattern
- removes(!) sponsored feeds on the home section
- Divs where the class attribute matches a pattern
- in the home section removes the sponsor area inside the sidebar, commonly the "Invite your friends" banner but eventually other ads.
please leave some comments to help me (and you) improve the script, I'll be there in minutes. It's been a long time since I use it regularly, I fixed little problems and added new functionality over time. It's now out of beta.
reviews appreciated, thanks! ;)
further ideas- new ways of detecting banners
- I often update the script so I'm going to add an auto-update feature in the future to make life easier to everyone.
- Instead of removing iframes that match a pattern I could remove every iframes except the ones that match a pattern.
change log4.4 - huge step backward, I can't hide all iframes because some apps use them. So I restored the previous version. So the problem is still the pattern to be up to date. 4.3 - it's really awkward, I was trying with all my efforts to find a generic pattern to identify the ads. I realized that almost every iframes was actually an ad container. The other ones are useful in some other ways but there's no need to show them. So I don't match patterns anymore, simply I added a new selector to hide ALL the iframes. In this form this could be a simple stylish script. Anyway this situation could not last forever and in the future I may need to add some js logic. A rifenement could be removing the label ADVERTISMENT on top of the ads.
4.2 - the pattern evolved. and it's going to evolve in the future. I found some Ads IFrame to be nested and my strategy still don't go so deep. For now I modified the pattern to catch the root nodes, especially in the social calendar application. Everything is arranged for the pattern to scale in the future till I decide a smarter solution.
4.1 - more specific remove function, setInterval calls anonymous function, css selectors changed, use of GM_addStyle, no more main function
4.0 - big change! as avg suggested before I applied css style to make it faster and avoid the bumpy effect. I used an hybrid approach, the generic adKiller is still there to detect and remove even unknown ads using generic patterns.
3.1 - just a minor change, just a better regexp
3.0 - small refactor based on avg suggestion, better pattern to identify ads
2.3 - less generic pattern...now no more problems with the trip advisor.
2.2 - updated the pattern
2.1 - The ad-recognition strategy evolved. Now I use regular expressions and complex patterns to match unwanted stuff. The patterns are smarter, now it shouldn't delete legitimate boxes too while still hiding most of the ads. Now I always remove the nodes and not only hide them except for the sidebar. The code became tinier and easier to mantain. In the future I'll still need your help updating the pattern, please leave comments if you find problems.
2.0 - I was updating the list too often so I decided to choose an universal word that should always work ... it's a bit dangerous, if some problems arise I'll go back to the previous version
1.13 - updated keywords again, I'm working on it
1.12 - updated keywords again
1.11 - updated keywords, but I still need to make it smarter
1.1 - updated keywords list
1.0 - left the beta...I finally added the string to recognize the sponsor in the home section.
0.6b - now completely removes nodes with className containing some special words, mainly sponsored feeds in the home section [asked by dennis3484]
0.5b - updated the keywords list. Maybe I'm going to try a different approach for the next versions. this is a step in that direction.
0.4b - I found my ads detection strategy to be sensitive to unpredictable site variations. Now I improved it so it uses a list of known keywords to detect an iframe as actually an ad container. Anyway in the near future I'll need to update periodically the list untill I find a better way of doing the same thing.
0.3b - added some comments, now hides the sidebar ads and every box on the page that could contain a banner. So now it completely removes EVERY ads. I only need to cut the timerInterval once it's successful to make it lighter.
0.2b - cut an unnecessary check, added one so it always works and set a recurrent interval to apply the patch ever during the page life.