Modifying the Facebook Live Feed with Greasemonkey and jQuery

My wife recently expressed to me that she didn’t care for some of the events appearing in the Facebook Live Feed, namely the ones relating to her friends adding other people as friends or becoming fans of pages, because they tended to flood her feed and crowd out other events she was actually interested in.

Unfortunately, Facebook doesn’t provide any filtering for the feed outside of either entire applications or entire people. Upon inspecting the markup for the feed, I found that content was styled such that it was easy to refer to entire entries using CSS selectors. I then recalled that the Firefox web browser, which she uses, has available for it an extension called Greasemonkey that enables you to execute custom JavaScript for a specified set of web pages. I poked around for existing Greasemonkey user scripts to handle the task, but most seemed to try to do too much and I had trouble finding any that supported custom filtering of the Live Feed.

It had been a while since I looked at Greasemonkey, but apparently it’s gained some nice features since. One of these is the @require tag, which allows you to pull in a remote JavaScript file that Greasemonkey will smartly cache locally to be reused. I used this to add the jQuery library to my script using the copy hosted on Google AJAX Library APIs, at which point removing the feed entries my wife didn’t want only required a few lines of code.

I’ve pushed the user script to a github repository if you’d like to download it. I’ve made it extensible such that removing other entries by phrase only requires adding entries to an array at the top. If you have any improvements to make, please feel free to fork it. Enjoy!