Created
June 24, 2012 01:40
-
-
Save mohnish/2980958 to your computer and use it in GitHub Desktop.
Poke back everyone who pokes who and win the poke war.
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
// Setting up everything we need to attack the pokers ;-) | |
var listOfPokers = document.querySelectorAll('a[ajaxify^="/ajax/pokes/poke_inline.php?uid="]') | |
, poke = document.createEvent('MouseEvents') | |
, mouseOverPoker = document.createEvent('MouseEvents') | |
, pokeDialog = document.querySelector('.fbRemindersStory img[alt=Pokes]'); | |
// Setting up the poke itself | |
poke.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
// Fooling FB into thinking that it's actually done by a human and not a bot | |
mouseOverPoker.initMouseEvent('mouseover', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
// The bot opens the list of pokers dialog | |
pokeDialog.dispatchEvent(poke); | |
// Missiles away...poke-em-all!!!!111 | |
Array.prototype.forEach.call(listOfPokers, function(poker) { | |
poker.dispatchEvent(mouseOverPoker); | |
setTimeout(function() { | |
poker.dispatchEvent(poke); | |
}, 1000); | |
}); | |
// The bot closes the list of pokers dialog | |
pokeDialog.dispatchEvent(poke); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment