Skip to content

Instantly share code, notes, and snippets.

@xandris
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xandris/67990d8631cfd25e1fe4 to your computer and use it in GitHub Desktop.
Save xandris/67990d8631cfd25e1fe4 to your computer and use it in GitHub Desktop.
Facebook autopoker
(function(w,d){
var x = function(n,p) { return d.createExpression(p).evaluate(n).iterateNext(); };
w.pokeBack = function() {
pokeBack.id && window.clearTimeout(pokeBack.id);
delete pokeBack.id;
if(pokeBack.stopped) return;
var a = x(d,'//a[contains(@class, "_4jy1") and contains(.,"Poke Back")]');
if(a && ! a.pokedBack) {
a.pokedBack = true;
var who = x(a,'../../following-sibling::*[1]//a').innerText;
a.click();
console.log(who + ' -> ' + a.innerText);
}
pokeBack.id = w.setTimeout(pokeBack, a ? 1000: 3000);
};
pokeBack.stop = function() { this.stopped = true; }
})(window,document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment