Fork jQuery Terminal Emulator on GitHub

Summary

jQuery Terminal Emulator is a plugin for creating command line interpreters in your applications. It can automatically call an JSON-RPC service when the user types commands. Alternatively, you can provide an object with methods; each method will be invoked on the user's command. An object can have nested objects which will create a nested interpreter. You can also use a function in which you can parse user commands on your own. It's ideal if you want to provide additional functionality for power users. It can also be used as debugging tool.

Features

Demo

This is a simple demo, using a JavaScript interpreter. (If the cursor is not blinking, click on the terminal to activate it.) You can type any JavaScript expression, there are two debug function dir (like in Python).

You can use jQuery's "$" method to manipulate the page. You also have access to this terminal in the "term" variable. Try "dir(term)" or "term.signature()".

JavaScript code:

jQuery(function($, undefined) {
    $('#term_demo').terminal(function(command) {
        if (command !== '') {
            try {
                var result = window.eval(command);
                if (result !== undefined) {
                    this.echo(new String(result));
                }
            } catch(e) {
                this.error(new String(e));
            }
        } else {
           this.echo('');
        }
    }, {
        greetings: 'JavaScript Interpreter',
        name: 'js_demo',
        height: 200,
        prompt: 'js> '
    });
});

Download

Complete source with examples from github

Or just the files:

Installation

You can download files locally or use:

Bower:

bower install jquery.terminal

NPM:

npm install --save jquery.terminal

Then you can include the scripts in your HTML

:
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script src="js/jquery.terminal-1.15.0.min.js"></script>
<-- With modern browsers, jQuery mousewheel is not actually needed; scrolling will still work -->
<script src="js/jquery.mousewheel-min.js"></script>
<link href="css/jquery.terminal-1.15.0.min.css" rel="stylesheet"/>

You can also grab the files using a CDN (Content Distribution Network):

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.15.0/js/jquery.terminal.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.15.0/css/jquery.terminal.min.css" rel="stylesheet"/>

or

<script src="https://cdn.jsdelivr.net/npm/jquery.terminal/js/jquery.terminal.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/jquery.terminal/css/jquery.terminal.min.css" rel="stylesheet"/>

And if you want:

<script src="https://cdn.rawgit.com/inexorabletash/polyfill/master/keyboard.js"></script>
<script src="https://cdn.rawgit.com/jcubic/leash/master/lib/wcwidth.js"></script>

If you always want the latest version, you can grab the files from GitHub using rawgit.com

<script src="https://cdn.rawgit.com/jcubic/jquery.terminal/master/js/jquery.terminal.min.js"></script>
<link href="https://cdn.rawgit.com/jcubic/jquery.terminal/master/css/jquery.terminal.min.css" rel="stylesheet"/>

License

The jQuery Terminal Emulator plugin is released under the MIT license.

It contains:

Comments

You can use the terminal below to leave a comment. Click to activate. If you have a question, you can create an issue on github, ask on stackoverflow (you can use the "jquery-terminal" tag). You can also send email with SO question or jump to the chat.

If you have a feature request, you can also add a GitHub issue.

If you've found an issue with this website, you can add issue to the jquery.terminal-www repo.