Posts tagged ‘jQuery’

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!

DomQuery Update

I think it’s mostly flown under the radar, but one of my smaller projects is a class called DomQuery that is built on top of DOM and the SPL ArrayObject. The functionality is provides is somewhat similar to jQuery, but it’s different in that it does so programmatically through the API rather than using an expression parser.

This post is mainly to inform anyone who might be interested that I’ve moved the project from its old home at Assembla to a new repository on github. I’ve been enjoying my use of git for version control of other projects and it seems an appropriate place to house DomQuery to allow other people to play with it. I haven’t had time recently to make many updates, but hope that will change in the short term. If you haven’t used DomQuery, why not try it today?