Last active
September 18, 2019 16:09
-
-
Save btnwtn/47f9768da922599fcb46748a838a44ba to your computer and use it in GitHub Desktop.
Automat dat +50 clapping on Medium.com
This file contains 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
(() => { | |
const up$ = new MouseEvent("mouseup", { bubbles: true }); | |
const down$ = new MouseEvent("mousedown", { bubbles: true }); | |
const node = document.querySelector( | |
`.js-postActionsFooter button[data-action="multivote"]` | |
); | |
let attempts = 0; | |
const clap = window.setInterval(() => { | |
const countNode = document.querySelector(".js-floatingMultirecommendCount") | |
const count = parseInt( | |
countNode && countNode.textContent || -1, | |
10 | |
); | |
if (count === 50 || attempts > 100) { | |
node.dispatchEvent(up$); | |
window.clearInterval(clap); | |
} | |
attempts++ | |
}, 500); | |
node.dispatchEvent(down$); | |
})() |
This file contains 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
javascript:(()=>{const a=new MouseEvent("mouseup",{bubbles:!0}),b=new MouseEvent("mousedown",{bubbles:!0}),c=document.querySelector(`.js-postActionsFooter button[data-action="multivote"]`);let d=0;const e=window.setInterval(()=>{const f=document.querySelector(".js-floatingMultirecommendCount"),g=parseInt(f&&f.textContent||-1,10);(50===g||100<d)&&(c.dispatchEvent(a),window.clearInterval(e)),d++},500);c.dispatchEvent(b)})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment