如果您总是希望单击这些表单,请使用如下脚本。这种方法也适用于 AJAXified 表单/页面,例如您的:
// ==UserScript==
// @name _Submit either of 2 forms
// @include {{{Page_1}}}
// @include {{{Page_2}}}
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a major design change
introduced in GM 1.0.
It restores the sandbox.
*/
waitForKeyElements ("SUBMIT_BUTTON_1 CSS SELECTOR", clickOnSubmitButton);
waitForKeyElements ("SUBMIT_BUTTON_2 CSS SELECTOR", clickOnSubmitButton);
function clickOnSubmitButton (jNode) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
jNode[0].dispatchEvent (clickEvent);
}