Created
June 27, 2013 08:21
-
-
Save worldeggplant/5874846 to your computer and use it in GitHub Desktop.
Draws n random instagram followers for competitions etc.
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
/** | |
* Draws random winners from followers on Instagram | |
* To be used on Statigram's My Followers page | |
* @author Jonas Skovmand ([email protected]) | |
* @usage Paste the code in to your browser console and let it rip. | |
* You will have to scroll to the bottom of your followers list as well. | |
**/ | |
var followers = $('.detailUser'), | |
winner_count = 5, | |
winners = []; | |
console.log('@instagramaccount has ' + followers.length + ' followers!'); | |
console.log('Picking ' + winner_count + ' winners...'); | |
console.log(''); | |
for (var temp_i=0; temp_i < winner_count; temp_i++){ | |
console.log('#' + (temp_i+1) + '...'); | |
var winner = Math.floor(Math.random()*followers.length); | |
var winner_username = followers.eq(winner).find('.name').text(); | |
winners.push(winner_username); | |
console.log('@' + winner_username.toUpperCase()); | |
console.log(''); | |
} | |
console.log(''); | |
console.log('All winners have been drawn! Congratulations to those who won, and better luck next time for everyone else'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment