Skip to content

Instantly share code, notes, and snippets.

@jk195417
Last active November 21, 2017 14:38
Show Gist options
  • Save jk195417/36ea514a6330a4e93540a2eef55fc9ed to your computer and use it in GitHub Desktop.
Save jk195417/36ea514a6330a4e93540a2eef55fc9ed to your computer and use it in GitHub Desktop.
poke 翻那些想要 poke 你的朋友們

Facebook 自動回戳

  1. 用 chrome 登入 facebook
  2. 連到 https://www.facebook.com/pokes
  3. 滑鼠在網頁上按 右鍵 > 檢查 > Console
  4. 複製下面的 javascript 程式貼入 Console 中
function pokeBack() {
  var btns = [...document.querySelectorAll('a[ajaxify^="/pokes/inline/?"]')]
  var pokeBackBtns = btns.filter(btn => btn.textContent === "戳回去");
  pokeBackBtns.forEach(btn => btn.click());
}

window.setInterval(pokeBack, 1000);
  1. poke 爆那些膽敢挑戰你的人

演示圖

改良

想要不那麼機械式秒回的人可以複製這個版本 5 ~ 14 秒不等的時間戳回,減少秒回的機械性

function pokeBack() {
  var btns = [...document.querySelectorAll('a[ajaxify^="/pokes/inline/?"]')]
  var pokeBackBtns = btns.filter(btn => btn.textContent === "戳回去");
  pokeBackBtns.forEach(btn => btn.click());
  setNextPoke();
}

function randomTime(min = 5000, max = 14000) {
  return Math.random() * (max - min) + min;
}

function setNextPoke() {
  var time = randomTime();
  console.log(`wait ${time} ms for next poke`);
  window.setTimeout(pokeBack, time);
}

pokeBack();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment