want to auto click cancel in prompt in firefox

浪子不回头ぞ 提交于 2019-12-10 11:35:54

问题


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


回答1:


// @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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!