A simple javascript library that tries to act like readline.
Given a DOM element for showing the current command and a callback function, you can introduce a commandline prompt into your webpage, if that is something you would like.
new Readline($('#input'), this, this.execline)
or
new Readline($('#input'), this, this.execline, $('#term'))
"Make a new Readline
object, using the #input
DOM element as the command
buffer, sending completed commands to this.execline
, with this
as the object
to be referenced by "this
" inside that function (see Function.call
).
Optionally, only accept input when the #term
DOM element has focus."
See adlaiff6@github:jsh for an example of its usage. There is also an example, if you just want to see the end result, here.
Yes. Email me (leif.walsh@gmail.com).
I have only tested this on Firefox and Chromium (latest-ish Gentoo build). I also tried it on Uzbl, and couldn't get Backspace to work right. I think it's the same problem I found with Chromium (they're both WebKit-based), but I have yet to confirm that. If you find problems in other browsers, please let me know, but also know that I probably won't be able to reproduce or fix them, so you might have to provide me with a solution on your own.
Fork and send pull requests.