Linux Today "Complete story" Redirect

By jeansagi Last update Sep 22, 2005 — Installed 1,115 times.
/******************************************************************************
 * Linux Today "Complete Story" redirect
 * version 0.1
 * 2005-sep-21
 * Copyright (c) 2005, Jean Sagi
 * Released under the GPL license, version 2
 * http://www.gnu.org/copyleft/gpl.html
 * Inspired by Denis McLaughlin's "Linux Today Butler" and
 *             Fabricio Zuardi's "Wired News Printer Friendly Redirect"
 * See: http://denism.homeip.net/software/greasemonkey/lt.user.js
 *      http://www.mamata.com.br/greasemonkey/wired.printer-friendly.redirect.user.js
 * Donations: Contactme at jeansagi at [myrealbox|gmail] dot com (you never know ;)
 *
 * Please don't sue|blame me (Linux Today) I'm just learning javascript.
 ******************************************************************************
 * Use "Linux Today Butler", it is usefull if you read Linux today regularly.
 * Use Sage to read RSS feeds from Linux Today.
 * 
 * If onload there are links whose inner html is 'Complete Story' then:
 *   - The first (Complete story) link is redirected to its respective link
 *     in the actual window.
 *   - The rest (Complete stories) links are redirect to their respective sites
 *     in new tabs.
 *
 * This script asumes linux today stories contains the text "Complete Story"
 * in the link to the article. If this changes, obviously this script will fail.
 *
 * Jean Sagi
 * jeansagi at [myrealbox|gmail] dot com
 *
 * It works (is tested) with:
 *  - Firefox 1.0.6 - Linux / Windows   - Greasemonkey 0.5.3	http://greasemonkey.mozdev.org/
 *  - Firefox 1.5 - Linux / Windows     - Greasemonkey 0.6.4	http://greasemonkey.mozdev.org/
 *
 * To Install:
 *  - like any greasemonkey script: install greasemonkey, restart FF, open
 *    this script in a browser window, go to Tools/Install User Script
 *
 * To Uninstall:
 *  - like any greasemonkey script: Tools/Manage User Scripts, select "Linux
 *    Today "Complete story" Redirect, click the Uninstall button
 *
 * Changelog:
 *  ver 0.2
 *    2006-Jan-2
 *    Jean Sagi
 *    - Change evaluation for "Complete Story" to a pattern match
 *    - Tested with Firefox 1.5 and GreaseMonkey 0.6.4
 *
 *  ver 0.1
 *    2005-Sep-21
 *    Jean Sagi
 *    - First release.
 *    - Works for me
 */

// ==UserScript==
// @name          Linux Today "Complete story" Redirect
// @description   Automatically redirect to Linux Today's stories
// @namespace     http://jeansagi-links-por-ver.blogspot.com/
// @include       http://*linuxtoday.com/*
// by Jean Sagi   (http://jeansagi-links-por-ver.blogspot.com/)
// ==/UserScript==

(function() {
    try {
        textLink="Complete Story";
        nPage=-1;
        
        for( i=0; i < document.links.length; i++ )
            if( document.links[ i ].innerHTML.match( textLink ) )
                if( ++nPage )   GM_openInTab( document.links[i].href );
                else            window.location.href=document.links[i].href;
    }
    catch (e) {
        GM_log( 'Linuxtoday "Complete story" Redirect - script exception: ' + e );
        alert ( 'Linuxtoday "Complete story" Redirect - script exception: ' + e );
    }
}
)();