Quote
Do you know how to define and use a macro? The following code should work.
No, not yet, but I'm getting there!
Okay, in accel.cfg I added:
CTRL ; = macros(First_Text_Field)
This was the key sequence used with the Firefox extension. I thought I'd keep the same hotkey.
In macros.cfg I added the following:
First_Text_Field {
open("javascript: (function() { var es = document.getElementsByTagName('input'); var len = es.length; for (var i = 0; i < len; i++) { var e = es; if (e.type == 'text') { e.focus(); break } } })()");
}
I restarted K-M. Pressing
Ctrl-; did nothing. I then enabled JavaScript and reloaded the page. The macro then worked. Thank you, but Bummer.
I do NOT want JavaScript enabled full time. I suspect the Firefox extension worked without JavaScript externally enabled because the extension code was intercepted at the lower code level. Probably another XUL thingie where JavaScript can be executed internally but not externally.
For this handy K-M macro to function, I need to enable JavaScript externally and I don't like that. For safety reasons against malicious people and script kiddies, I have always surfed with JavaScript disabled.
Is there a way to assign a hotkey without externally enabling JavaScript?