Skip to content

Instantly share code, notes, and snippets.

@dreygur
Last active September 25, 2025 10:39
Show Gist options
  • Select an option

  • Save dreygur/4d20321fb0248f14e493ed21359beea4 to your computer and use it in GitHub Desktop.

Select an option

Save dreygur/4d20321fb0248f14e493ed21359beea4 to your computer and use it in GitHub Desktop.
I have some weird peoples as friends from college, who loves to keep poking me on FB. This is for those MFs
class Poke {
constructor(interval) {
if (interval) this.INTERVAL = interval;
else this.INTERVAL = 10000;
this.timer = null;
}
set interval(seconds) {
if (!seconds || typeof seconds !== 'number') throw new Error('Interval must be in number of seconds');
this.INTERVAL = seconds * 1000;
}
start() {
if (this.timer) return;
this.timer = setInterval(this.poker, this.INTERVAL);
}
stop() {
if (!this.timer) return;
clearInterval(this.timer);
}
poker() {
console.table(['Poke Back']);
const { singleNodeValue: pokeBtn } = document.evaluate("//span[contains(text(),'Poke Back')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
pokeBtn?.click();
}
}
const pokeBack = new Poke();
pokeBack.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment