Skip to content

Instantly share code, notes, and snippets.

@btnwtn
Last active September 18, 2019 16:09
Show Gist options
  • Save btnwtn/47f9768da922599fcb46748a838a44ba to your computer and use it in GitHub Desktop.
Save btnwtn/47f9768da922599fcb46748a838a44ba to your computer and use it in GitHub Desktop.
Automat dat +50 clapping on Medium.com
(() => {
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$);
})()
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