// Copyright (c) 2005 trixiedev@gmail.com
// This script is licensed under the MIT license.  See
// http://opensource.org/licenses/mit-license.php for more details.
//
// ==UserScript==
// @name          Subscribe via Bloglines
// @namespace     http://www.bhelpuri.net/Trixie
// @description	  Changes RSS links to subscribe via Bloglines links
// @include       *
// ==/UserScript==

//
// Discussion forum: http://groups.yahoo.com/group/trixieUsers/
//

(function()
{
	var hyperlinks = document.getElementsByTagName("a");

	for (var i = 0; i < hyperlinks.length; ++i)
	{
		var node = hyperlinks[i];
		var href = node.getAttribute("href");
		
        if (href.match(/.*\/feeds\/.*\.xml/) ||
            href.match(/.*\/rss.xml$/) ||
            href.match(/.*\.rss$/) ||
            href.match(/.*\.rdf$/) ||
            href.match(/.*\atom.xml$/) ||
            href.match(/.*\/index\.xml$/))
        {
            node.setAttribute("href", "http://www.bloglines.com/sub/" + href);
        }
    }
})();