Last active
September 25, 2025 10:39
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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