NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Rioters posts on reddit 2
// @description Load variables
// @match http://www.reddit.com/r/leagueoflegends/comments/*
// @version 2
// ==/UserScript==
function parse() {
var total = 0;
var linkiterator = 1;
var linksarray = [];
var namesarray = [];
$("a.author").each(function() {
var str = $(this).text();
if ($(this).next().hasClass("flair-riot")) {
var idname = "rioterlink" + linkiterator;
$(this).attr("id", idname);
linksarray.push(idname);
namesarray.push(str);
linkiterator++;
total++;
}
});
var style = "position: fixed;top: 160px;border: 1px solid black;background-color: white;z-index: 999;padding: 15px 10px 10px 10px;right: 100px;";
var styleclose ="position: absolute; top: 0; left: 0;cursor:pointer;";
if (total >= 1) {
$('body').append("<div style='" + style + "' id='rioterlinkstable'><div style='" + styleclose + "' id='closeriotertable'>[X]</div>" + total + " rioter posts found ! <br/><br/></div>");
var list = "<ul>";
$.each(linksarray, function(index, value) {
var linkid = "ul_link" + index;
list += "<li ><a href='#" + value + "' id='" + linkid + "' >" + namesarray[index] + "</a></li>";
});
$("#rioterlinkstable").append(list);
} else {
$('body').append("<div style='" + style + "' id='rioterlinkstable'> No rioter posted here :( </div>");
}
$("#closeriotertable").click(function(){$("#rioterlinkstable").remove();});
}
function updatemorecommentslinks() {
$("a.button").click(function() {
setTimeout(function() {
$("#rioterlinkstable").remove();
}, 2000);
setTimeout(function() {
parse();
updatemorecommentslinks();
}, 2500);
});
}
$(document).ready(function() {
parse();
updatemorecommentslinks();
});