Hack 85. Automatically Display Unread Items in Bloglines

 < Day Day Up > 

Bloglines already defines a function to display unread items. Save yourself a click and call it automatically.

Bloglines (http://www.bloglines.com) is a web-based aggregator for syndicated feeds. It has a two-pane interface; the left pane displays your subscriptions, and the right pane displays the content from those subscriptions. The only thing I dislike about this nice interface is that I always use it the same way: every time I visit Bloglines, I want to see everything I haven't seen before that is, all the unread items.

In Bloglines, displaying all unread items is just one click away. Clicking on the root level of your subscriptions in the left pane displays the unread items in the right pane. But since I always want to do this, I wrote a user script to automate that one click.

10.2.1. The Code

This user script runs on Bloglines. Since Bloglines already defines the JavaScript function we want to call to display unread items, the script is simply one line of code. There's one little wrinkle: Bloglines uses frames, so this script will end up being executed on each frame. Only the top frame defines the function we want to call, so we simply check whether it is defined before calling it.

Save the following user script as bloglines-autoload.user.js:

 // ==UserScript== // @name   Bloglines Autoloader // @namespace   http://diveintomark.org/projects/greasemonkey/ // @description   Auto-display unread items in Bloglines // @include   http://bloglines.com/myblogs* // @include   http://www.bloglines.com/myblogs* // ==/UserScript== if (typeof doLoadAll != 'undefined') { doLoadAll(); } 

10.2.2. Running the Hack

To see this script in action, you will need a Bloglines account and at least one subscription. You can sign up for a free account at http://www.bloglines.com.

After installing the user script (Tools Install This User Script), go to http://www.bloglines.com/myblogs. Instead of simply displaying your list of subscriptions with the number of unread items next to each subscription, Bloglines will automatically jump to displaying all the unread items in all your subscriptions, as shown in Figure 10-1.

If there are no unread items, Bloglines displays a message "There are no new items to display" in the pane on the right.

Figure 10-1. Autodisplaying unread items in Bloglines


     < Day Day Up > 


    Greasemonkey Hacks
    Greasemonkey Hacks: Tips & Tools for Remixing the Web with Firefox
    ISBN: 0596101651
    EAN: 2147483647
    Year: 2005
    Pages: 168
    Authors: Mark Pilgrim

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net