bookmarklet autoclicker
CoolGuy27 (68)

does anyone know a bookmarklet autoclicker?

You are viewing a single comment. View All
xxpertHacker (931)

@CoolGuy27 Oh, then ig all you'll need is this:

clicker: {
	"use strict";

	const { Number } = self;

	const milliseconds = Number.parseInt(
		self.prompt(
			"How many milliseconds do you want to wait before clicking again?",
			'1'
		), 10
	);

	if (false === Number.isSafeInteger(milliseconds)) {
		self.alert("Input was not an integer");

		break clicker;
	}

	// mouse coordinates
	let clientX = 0,
		clientY = 0;

	const { document } = self;

	self.setInterval(
		() => {
			// document.elementFromPoint should probably never return null, but I'm not sure
			// not all elements have #click
			document.elementFromPoint(
				clientX,
				clientY
			)?.click?.();
		},
		milliseconds
	);

	document.addEventListener(
		"mousemove",
		event => {
			({ clientX, clientY } = event);
		}, {
			passive: true
		}
	);
}

Tested it myself.

And the minified bookmarklet:

javascript:clicker:{"use strict";const{Number}=self;const milliseconds=Number.parseInt(self.prompt("How many seconds do you want to wait before clicking again?",'1'),10);if(false===Number.isSafeInteger(milliseconds)){self.alert("Input was not an integer");break clicker;}let clientX=0,clientY=0;const{document}=self;self.setInterval(()=>{document.elementFromPoint(clientX,clientY)?.click?.();},milliseconds);document.addEventListener("mousemove",event=>{({clientX,clientY}=event);},{passive:true});}