Last active
June 4, 2021 20:32
-
-
Save sbolel/50afa30c6bd1b2da8e5907f90491b2b7 to your computer and use it in GitHub Desktop.
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
(function(_document, key, btn, delay, multiplier){ | |
const _plusOrMinus = () => Math.random() < 0.5 ? -1 : 1 | |
const _randomTimeout = () => (_plusOrMinus() * Math.floor((Math.random() * multiplier))) + delay | |
this.run = false | |
const toggle = () => { | |
this.run = !this.run | |
if (this.run) setNext() | |
} | |
const setNext = () => { | |
setTimeout(() => { | |
if (this.run) { | |
btn.click() | |
setNext(_randomTimeout()) | |
} | |
}, _randomTimeout()) | |
} | |
_document.body.onkeydown = function(e){ | |
if (e.keyCode === key) toggle() | |
} | |
})(window.document, 16, $('.recsGamepad__button--like'), 1100, 200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment