Advertisement
Guest User

Facebook Auto Poker

a guest
Feb 9th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Usage: load facebook.com/pokes, paste script into console
  2.  *   To poke everyone, checking every second: auto(true, "", 1000);
  3.  *   To poke a specific person, every second: auto(false, "Some Name", 1000);
  4.  */
  5.  
  6. var auto = function(pokeAll, targetName, interval) {
  7.     var poker = function() {
  8.         var people = document.querySelectorAll('div[id^="poke_live_item"]');
  9.         if (pokeAll) {
  10.             for (var i = 0; i < people.length; i++) {
  11.                 var name = people[i].querySelectorAll('a[data-hovercard^="/ajax"]')[0].textContent;
  12.                 console.log("Poking ", name);
  13.                 var buttons = people[i].querySelectorAll('a[role^="button"]');
  14.                     for (var j = 0; j < buttons.length; j++) {
  15.                         if (buttons[j].textContent === "Poke Back")
  16.                             buttons[j].click();
  17.                     }
  18.             };
  19.         } else if (targetName !== "") {
  20.             for (var i = 0; i < people.length; i++) {
  21.                 var name = people[i].querySelectorAll('a[data-hovercard^="/ajax"]')[0].textContent;
  22.                 console.log("Poking ", name);
  23.                 if (targetName === name) {
  24.                     var buttons = people[i].querySelectorAll('a[role^="button"]');
  25.                     for (var j = 0; j < buttons.length; j++) {
  26.                         if (buttons[j].textContent === "Poke Back")
  27.                             buttons[j].click();
  28.                     }
  29.                 }
  30.             };     
  31.         }
  32.     };
  33.     var timer = setInterval(poker, interval);
  34. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement