I’ve written a bookmarklet for clicking a controllable amount of times on a HTML element (for clicker games, the like). However, when I run it, it prompts “How many times do you want to click?” twice.
To the best of my knowledge, the second prompt doesn’t do anything. Is there a way I can get rid of it?
Code:
javascript:
var clicked = false
document.onclick= function(event) {
if (!clicked) {
var target= 'target' in event? event.target : event.srcElement;
var clickamount= parseInt(prompt("Enter time to click "+target.id))-1;
for (let i = 0; i < clickamount; i++) {
target.click();
}
clicked = true
}
};