bookmarklet autoclicker
CoolGuy27 (68)

does anyone know a bookmarklet autoclicker?

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

This isn't too clear, do you mean something that clicks a bookmarklet, or a bookmarklet that clicks stuff?

If you're referring to the former, that isn't possible without native code.

As for the latter, that depends on what you want to be clicked.

CoolGuy27 (68)

@xxpertHacker i am referring to the latter, and I honestly don't know what I mean myself

xxpertHacker (931)

@CoolGuy27 Well, can you give a webpage, and an example of what you want clicked? I've made plenty auto clicker scripts.

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});}
xxpertHacker (931)

@RexGREEN Didn't design it with that in mind, it never does.