Last active
December 25, 2015 22:29
-
-
Save gdoteof/7049554 to your computer and use it in GitHub Desktop.
Reddit comment lottery. This is for those people that occasionally do lotteries in a reddit thread: "post here for a chance to ...." Known issues: doesn't include users that have comments now visible (ie.. if it says "load more comments" any users' comments that would have been loaded will not be included. this DOES however filter out users who …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var allusers = []; $('.author').map(function(key,item){if(allusers.indexOf(item.innerHTML) == -1) allusers.push(item.innerHTML);}); console.log(allusers.length + " users seen"); lucky_number = Math.floor(Math.random()*(allusers.length+1)); console.log("lucky number is " + lucky_number); lucky_user=allusers[lucky_number]; msg = "lucky user is " + lucky_user; console.log(msg); "http://www.reddit.com/u/" + lucky_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment