Greasemonkey Script to Bypass the Add to Google Homepage or Google Reader page

I have just created a quick Greasemonkey script to bypass the Add to Google page and add feeds straight to Google Reader.

The Add to Google page offers you the choice of adding a feed to your Google homepage or Google Reader and, seeing as I don’t really use my iGoogle page, adding them straight to Google Reader makes more sense and elimates that extra click.

Now, I know Google make a Subscribe… bookmarklet available to “subscribe as you surf” (via Manage Subscriptions -> Goodies in Google Reader). But since I have been using the NoScript Firefox extension this bookmarklet often does not work for me, as the site I am on typically will not be on my NoScript whitelist.

So instead of using the bookmarklet I started subscribing to feeds directly through Firefox:

  1. Click the feed icon in the address bar
  2. Select Google on the Firefox subscribe page and click the button
  3. Select Add to Reader on the Add to Google page

After a while though, clicking Add to Reader everytime was causing some friction. So I came up with my Straight to Reader Greasemonkey script: the Add to Google page loads before you are redirected straight to Google Reader and subscribed to the feed.

If you want to give it a try you can install it here: straighttoreader.user.js.

Alternatively you can view the script and install it from userscripts.org.

UPDATE: I have fixed a bug in the original version so that, if you are not currently logged in to your Google Account, you still get forwarded on to the Add to Reader page (via the Google Account sign in page).

Posted in javascript at April 24th, 2009. No Comments.

jQuery fadeOut() Then slideUp()

After hastily answering a question on stackoverflow.com regarding calling jQuery’s slideUp() method after fadeOut(), what I thought to be a good answer turned out to be not quite so good afterall.  After reading the comments on my answer I decided to investigate to see what was wrong with my original solution. Now, the problem that needed to be solved was the element below the faded-out element jumping up during the slide up: a nice smooth slide up was required. I initially thought you could accomplish this by calling fadeOut() with a callback function as the second parameter which would handle the slideUp(). Something like this:

$('elementAbove').fadeOut(500, function() {
    $('elementBelow').slideUp();
});

But you still get the jump up, rather than the nice smooth slide up that is desired. In the comments to my answer it was suggested fading the element out to an opacity of 1%, then doing the slide up, would work. After checking the documentation, jQuery has a fadeTo( speed, opacity, [callback] ) method which lets us do exactly this, then execute the slide up in our callback function. So, given the following HTML:

<ul id="menu">
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">News &amp; Events</a></li>
    <li><a href="#">Downloads</a></li>
    <li><a href="#">Contact Us</a></li>
</ul>

We can achieve our desired effect like this:

$(document).ready(function() {
    $('#menu a').click(function() {
        var $theParent = $(this).parent();
        $(this).fadeTo(500, 0.1, function() {
            $theParent.slideUp(750);
        });
 	return false;
    });
});

You can see this in action here.

Posted in javascript at April 9th, 2009. 1 Comment.

Permanent Redirect

I have moved my blog over from http://ianoxley.wordpress.com to here and thought I would celebrate with a blog post :-)

Posted in Uncategorized at April 2nd, 2009. No Comments.