// ==UserScript==
// @name gamefaqs.com - Remove iframes and clean links
// @author CrazyTerabyte 
// @namespace http://userjs.org/ 
// @version 1.0.1
// @description  Prevents obscuring of content on the gamefaqs.com web
//			site, and removes redirect urls
// @ujs:category site: enhancements
// @ujs:published 2005-11-04 10:31
// @ujs:modified 2005-11-07 19:08
// @ujs:documentation http://userjs.org/scripts/site/enhancements/gamefaqs-com-frames-redirection 
// @ujs:download http://userjs.org/scripts/download/site/enhancements/gamefaqs-com-frames-redirection.js 
// @include http://www.gamefaqs.com/*
// @include http://boards.gamefaqs.com/*
// ==/UserScript==


/* 
 * = 
 */

document.addEventListener("load",
function () {
  var i, j, v = document.getElementsByTagName('iframe'),len;
  for( i = j = v.length-1, j++; i >= 0; i-- ) {
    v[i].parentNode.removeChild( v[i] );
  }

  /* Change redirection URLs for FAQs to direct URLs. */
  if( location.href.indexOf("/game/") > -1 ) {
    for( var i = 0, pos = 0, elm; elm = document.links[i]; i++ ) {
      if( ( pos = elm.href.indexOf('destURL=') ) > -1 ) {
        // 'destURL='.length = 8, which is used in line below
        elm.href = unescape( elm.href.substring( pos + 8, elm.href.length ) );
      }
    }
  }
},false);