NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Hacker News Automatated Surfer
// @version 0.2
// @description Open a link automatically every 10 second to surf when browsed into https://news.ycombinator.com
// @author Chamoda Pandithage
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @match https://news.ycombinator.com/
// @grant none
// ==/UserScript==
console.log("Tampermonkey execution started ...");
var tdElements = $('td[class="title"]').not('td[align="right"]');
function timeout(start, end, miliseconds){
setTimeout(function(){
//Run script here
var i = start;
var td = tdElements.get(i);
var link = $(td).find('a').attr('href')
console.log("Opening " + link + " ...");
window.open(link);
if(end > start){
start += 1;
timeout(start, end, miliseconds);
}
}, miliseconds);
}
timeout(0, $(tdElements).size() - 1, 10 * 1000);