Skip to content

Instantly share code, notes, and snippets.

@sagz
Last active April 21, 2016 00:43
Show Gist options
  • Save sagz/1301765bab6634f230cf63e1dc915f76 to your computer and use it in GitHub Desktop.
Save sagz/1301765bab6634f230cf63e1dc915f76 to your computer and use it in GitHub Desktop.
Auto pokeback your Facebook Friends. Works on Greasemonkey, Vivaldi, Chromium, Chrome, Opera
// ==UserScript==
// @name Facebook Poke Bot
// @namespace http://sagz.in/
// @version 1.1
// @description Return FB Pokes
// @author Sagar Savla
// @match https://mtouch.facebook.com/pokes/*
// @grant none
// ==/UserScript==
function updatePoke(){
let pokebuttonclass = "_56bz _54k8 _56bs _56bu"; // mtouch.facebook.com
//let pokebuttonclass = "_42ft _4jy0 _4jy3 _4jy1 selected _51sy"; //www.facebook.com
var gg = document.getElementsByClassName(pokebuttonclass).length
if(gg>0){
for (var i in document.getElementsByClassName(pokebuttonclass)){
let pbutton = document.getElementsByClassName(pokebuttonclass)[i];
if (pbutton.innerHTML && pbutton.innerHTML.includes('Back')){
pbutton.click();
//console.log(pbutton.innerHTML);
}
}
}
}
function randomIntFromInterval(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}
// Randomize how quick to Poke back to make it seem human
(function loop() {
var rand = randomIntFromInterval(10,1000)*1000;
console.log(rand);
setTimeout(function() {
updatePoke();
loop();
}, rand);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment