(Text updated 2006-07-05 15:53 GMT)
(Code updated 2006-07-05 05:12 GMT)
Add to OnLoad:
open("javascript: var SePEqUyH; function uHUgqBYT() { function trackFocus(e) { SePEqUyH = e.target } function trackBlur(e) { SePEqUyH = undefined } function injectFocusTracker(node) { if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) { node.addEventListener('focus', trackFocus, false); node.addEventListener('blur', trackBlur, false) } for (var i = 0; i < node.childNodes.length; i++) injectFocusTracker(node.childNodes[i]) } injectFocusTracker(document) } uHUgqBYT()");
Outside:
Submit { open("javascript: if (SePEqUyH) { if (SePEqUyH.form.submit instanceof HTMLInputElement) SePEqUyH.form.submit.click(); else SePEqUyH.form.submit() }"); }
Here's the human-friendly version of this code. You don't need to read this if you don't want to know how the code works.
The OnLoad handler:
var focused function trackFocus(e) { focused = e.target } function trackBlur(e) { focused = undefined } function injectFocusTracker(node) { if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) { node.addEventListener('focus', trackFocus, false) node.addEventListener('blur', trackBlur, false) } for (var i = 0; i < node.childNodes.length; i++) injectFocusTracker(node.childNodes[i]) } injectFocusTracker(document)
The Submit macro:
if (focused) { if (focused.form.submit instanceof HTMLInputElement) focused.form.submit.click() else focused.form.submit() }
For browsers without the convenience of accel.cfg, this event handler can be attached to onkeydown/onkeypress to bind the submission to Alt-s.
function submit(e) { if (e.altKey && e.which == 115) { if (focused.form.submit instanceof HTMLInputElement) focused.form.submit.click() else focused.form.submit() } }