This time I will share jQuery Plugin and tutorial about jQuery Command Line Interpreter Plugin – Terminal Emulator, hope it will help you in programming stack.
A simple jQuery based terminal emulator that makes it easy to create command line interpreter for your website or web application.
Command Line Interpreter is a blanket term for a certain class of programs designed to read lines of text entered by a user, thus implementing a command-line interface.(More info about Command Line Interpreter on WIKI).
Licensed under GNU LGPL Version 3 license.
You might also like:
Main Features:
- Automatically call JSON-RPC service.
- You can provide your own function in which you can parse user command.
- Command Tree supported
- Command line history supported
- Tab completion supported
- Keyboard shortcut like CTRL+A, CTRL+D, CTRL+E etc, supported
- Authentication supported
- Multiple Command Line Interpreters on one page supported
Installation:
2 |
$ npm install jquery.terminal |
5 |
$ bower install jquery.terminal |
Basic Usage:
1. Include jQuery JavaScript library and the terminal emulator plugin’s files on your page.
1 |
< link href = "css/jquery.terminal.min.css" rel = "stylesheet" /> |
2 |
< script src = "/path/to/cdn/jquery.min.js" ></ script > |
3 |
< script src = "js/jquery.terminal.min.js" ></ script > |
2. Or from a CDN.
3. Include the Mouse Wheel plugin for the mousewheel support (for legacy browsers).
1 |
< script src = "/path/to/jquery.mousewheel-min.js" ></ script > |
4. Include the optional polyfills for legacy browsers.
5. Include optional extensions as per your needs.
- ascii_table.js: renders simple ascii table, like the one from mysql cli tool
- autocomplete_menu.js: create autocomplete menu in Terminal
- dterm.js: jQuery UI dialog extension for Terminal
- echo_newline.js: add newlinew option for echo method inside Terminal
- emoji.js: add support for emoji
- less.js: create less like command in Terminal
- pipe.js: add pipe operator and redirects to commands
- prism.js: formatter to be used with PrismJS
- unix_formatting.js: convert UNIX ANSI escapes to terminal and display them as html
- xml_formatting.js: allow to use xml like syntax with colors as tags
01 |
< script src = "js/ascii_table.js" ></ script > |
02 |
< script src = "js/autocomplete_menu.js" ></ script > |
03 |
< script src = "js/dterm.js" ></ script > |
04 |
< script src = "js/echo_newline.js" ></ script > |
05 |
< script src = "js/emoji.js" ></ script > |
06 |
< script src = "js/less.js" ></ script > |
07 |
< script src = "js/pipe.js" ></ script > |
08 |
< script src = "js/prism.js" ></ script > |
09 |
< script src = "js/unix_formatting.js" ></ script > |
10 |
< script src = "js/xml_formatting.js" ></ script > |
6. Create an element for the terminal and generate a basic terminal using the following JS codes.
1 |
< div id = "example" ></ div > |
01 |
jQuery( function ($, undefined) { |
02 |
$( '#example' ).terminal( function (command) { |
05 |
var result = window.eval(command); |
06 |
if (result !== undefined) { |
07 |
this .echo( new String(result)); |
10 |
this .error( new String(e)); |
7. Config the terminal with the following options and callbacks.
032 |
invokeMethods: false , |
035 |
exceptionHandler: null , |
047 |
cancelableAjax: true , |