OK so i currently play a game that has a random "bot-check" pop up in the tab in the pop up it has a "OK" and "cancel" button and I'm trying to find or make a grease monkey script to auto click "cancel" when it pop's up and since its random it needs to be a always on type script
the prompt always shows up in the same x and y co-ordinates and button 1 is always OK and button 2 is always cancel hitting escape works just the same as hitting cancel
ive tried google and i cant find anything
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
$(".popup").bind('show',function(){
$(this).hide();
});
may work, depends on the popup type. if it doesn't work, try this:
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
$(".popup").bind('show',function(){
$(".popup .cancel).trigger("click");
});
[if JQuery wasn't successfully installed in your script previously, you'll need to uninstall your script and reinstall it]
edit: for imitation of pressing escape, use
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
var esc = $.Event("keydown", {
keyCode: 27
});
$(".popup").bind('show',function(){
$('body').trigger(esc);
});
来源:https://stackoverflow.com/questions/26052042/want-to-auto-click-cancel-in-prompt-in-firefox