// ==UserScript==
// @name wired.com - Fix FastForward
// @author Jordi Kroon 
// @namespace http://members.chello.nl/b.kroonspecker/opera/ 
// @version 2.0
// @description  Enables Opera's FastForward feature on wired.com
// @ujs:category site: enhancements
// @ujs:published 2005-08-26 14:15
// @ujs:modified 2005-09-19 09:19
// @ujs:documentation http://userjs.org/scripts/site/enhancements/wired-com-fastforward 
// @ujs:download http://userjs.org/scripts/download/site/enhancements/wired-com-fastforward.js
// ==/UserScript==


/* 
 * This script is licensed under CC-BY-NL 2.0:
 * http://creativecommons.org/licenses/by/2.0/nl/
 */

opera.addEventListener('BeforeScript',function(){
  if(location.hostname.match(/(^|\.)wired\.com$/)){
    var i=0, link, links=document.getElementsByTagName('a');
    while(link=links.item(i++)){
  	  if ((/next/i.test(link.href)) && (link.getAttribute('class') == 'next')) {
        var head = document.getElementsByTagName('head')[0];
        var next = document.createElement('link');
        next.setAttribute('rel', 'next');
        next.setAttribute('href', link.getAttribute('href'));
        head.appendChild(next);
        opera.removeEventListener('BeforeScript',arguments.callee,false);
        return; //to keep from adding multiple links
      }
    }
  }
},false);
