// Open all links on RedBubble in new window/tab.
// Version 0.1
// 2008-03-13
// Copyright (c) 2008, Dave Pearson <http://www.davep.org/>
// Released under the GPL
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.  To install it, you need
// Greasemonkey: http://www.greasespot.net/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "RedBubble Links in New Window/Tab", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          RedBubble Links in New Window/Tab
// @namespace     http://www.davep.org/
// @description   Open all links on RedBubble in new window/tab.
// @include       http://www.redbubble.com/*
// ==/UserScript==

// First we grab all the anchors in the page.
var anchors = document.getElementsByTagName( 'a' );

// Now we loop over them looking for those that have an href.
for ( i = 0; i < anchors.length; i++ )
{
   // If we've found one...
   if ( anchors[ i ].hasAttribute( 'href' ) )
   {
      // ...add a target attribute.
      anchors[ i ].setAttribute( 'target', '_blank' );
   }
}
