1. JavaScript Terminal
JavaScript Terminal is a terminal-like application to execute JavaScript interactively. The function to display HTML is also provided.
Tested environment: Firefox 1.5 (Linux), Safari 2.0.3 (Mac), IE 6.0 (Win), Firefox is recommended.
Additional libraries: SVGDoc library
Open the terminal
- Open it in this window.
- Open it in a subwindow.
Tutorial
- Output text.
% puts("Hello World!") Hello World!
- Output HTML. (the command is interpreted as HTML when head of it is "<".)
% <span style="background-color:green;">hoge hoge</span> hoge hoge
- Read an external JavaScript file.
% require("prototype-1.4.0.js")
It seems to be able to read even if the file is in a different server.% require("http://prototype.conio.net/dist/prototype-1.4.0.js")
- Set startup script.
% RC.set( "require(\"prototype-1.4.0.js\")" )
- Edit text.
% a="hoge hoge fuga" % Editor.open(a) // you can edit the text by using an opened editor. % a=Editor.get()
- Shake the window. (This depends on the environment.)
% for(var i=0;i<30;i++){window.moveBy(-10,0);window.moveBy(10,0);}
Outline of library
terminal.js
name | type | description |
---|---|---|
Terminal | object | The object to mount the terminal |
Terminal.init() | function | Initialization function of the terminal. It is called from "onload" of the BODY tag usually. |
Terminal.history() | function | The array of the input history strings is acquired. |
jsterm.js
name | type | description |
---|---|---|
JSTerm | object | The object offered when JavaScript is executed. |
JSTerm.write(string) | function | The string is output to the terminal. |
JSTerm.puts(string) | function | The string with return-character is output to the terminal. |
JSTerm.writeln(string) | function | It is same as "puts". |
JSTerm.require(string) | function | A JavaScript file given as the string of URL is read. |
JSTerm.RC | object | The object to store and execute the startup script in cookie. |
JSTerm.RC.get() | function | The startup script is acquired from cookie. |
JSTerm.RC.set(string) | function | The startup script is stored in cookie. |
JSTerm.RC.run() | function | The startup script in cookie is executed. When the terminal is initialized, it is called. |
JSTerm.Editor | object | The object to operate editor driven by TEXTAREA. |
JSTerm.Editor.open(string) | function | The editor is opened. If the string is given, it is displayed. |
JSTerm.Editor.close() | function | The editor is shut. |
JSTerm.Editor.get() | function | The displayed string is acquired from the editor. Even after the editor is shut, it is possible to acquire it. |
Even if "JSTerm." is not put, the above-mentioned can be executed because the command line is evaluated under "with(JSTerm)" environment on the terminal.
from: http://www.genome.ist.i.kyoto-u.ac.jp/~ichinose/jsterm/
2. JQuery Terminal Emulator
JQuery Terminal Emulator is a plugin for creating command line interpreters in your applications. It can automatically call JSON-RPC service when user type commands or you can provide an object with methods, each method will be invoke on user command. Object can have nested objects which will create nested interpreter. You can also use a function in which you can parse user command by your own. It′s ideal if you want to provide additional functionality for power users. It can also be used as debuging tool.
- You can create interpreter for your JSON-RPC service with one line of code.
- Support for authentication (you can provide function when user enter login and password or if you use JSON-RPC it can automatically call login function on the server and pass token to all functions)
- Stack of interpreters - you can create commands that trigger additional interpreters (eg. you can use couple of JSON-RPC service and run them when user type command)
- Command Tree - you can use nested objects each command will invoke a function if the value is an object it will create new interpreter and use function from that object as commands. You can use as much nested commands as you like. if the value is a string it will create JSON-RPC service.
- Tab completion with TAB key.
- Support for command line history (it use Local Storage if posible or cookies)
- Include keyboard shortcut from bash like CTRL+A, CTRL+D, CTRL+E etc.
- Multiply terminals on one page (every terminal can have different command, it′s own authentication function and it′s own command history) - you can swich between them with CTRL+TAB
- It catch all exceptions and display error messages in terminal (you can see errors in your javascript and php code in terminal if they are in interpreter function)
- Support for basic text formating (color, background, underline, bold, italic) inside echo function
- You can create and overwrite existing keyboard shortcuts
form: http://terminal.jcubic.pl/
check : http://www.masswerk.at/jsuix/index.html
4. learn javascropt via terminal
check : http://www.codecademy.com/#!/exercises/0