Not every button works off a click event. Also, it's not clear if this is a statically loaded button, or if it's loaded by AJAX. (Link to the target page!)
A general approach is given in Choosing and activating the right controls on an AJAX-driven site.
Something like this complete script will work in 99% of the cases:
// ==UserScript==
// @name _YOUR_SCRIPT_NAME
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/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 design change
introduced in GM 1.0. It restores the sandbox.
*/
waitForKeyElements ("#dispatchOnJobButton", triggerMostButtons);
function triggerMostButtons (jNode) {
triggerMouseEvent (jNode[0], "mouseover");
triggerMouseEvent (jNode[0], "mousedown");
triggerMouseEvent (jNode[0], "mouseup");
triggerMouseEvent (jNode[0], "click");
}
function triggerMouseEvent (node, eventType) {
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initEvent (eventType, true, true);
node.dispatchEvent (clickEvent);
}
If it doesn't work for you, Link to the target page, or post an SSCCE!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…