grahampheath / Open feedspot links

// ==UserScript==
// @name       Open feedspot links
// @namespace  http://splintor.userscripts.org
// @version    0.2
// @description  Opens "Visit Website" links in feedspot.com iFrame urls, without the need for clicking. Fixes Reddit.
// @match      http://www.feedspot.com/*
// @include    http://www.feedspot.com/*
// @copyright  2014+, splintor@gmail.com, except that dude didnt update this, so now its free, bitches.
// ==/UserScript==

var maxAttempts = 15;
var count = 0;
function checkPopupLink() {
  var btn = document.querySelector('a .fsel-btn');
  if (btn) {
    btn = btn.parentElement;
    console.log("Open Feedpost script: Found link. opening " + btn.attributes.getNamedItem('href').value);

//    btn.click();
    window.top.location.href = btn.attributes.getNamedItem('href').value;
  } else {
    console.log("Open Feedpost script: Didn't find link. Will try atain in 1 second");
    if(count++<maxAttempts){
      setTimeout(checkPopupLink, 1000);
    }
  }
}

checkPopupLink();