JSFiddle - React, Tailwind, and code Playground

by Nick Karnik

HTML

<script src="http://terminal.jcubic.pl/js/jquery.terminal-0.8.8.min.js"></script>
<link rel="stylesheet" href="http://terminal.jcubic.pl/css/jquery.terminal.css">
<script src="https://dl.dropboxusercontent.com/u/28584686/jquery-mousewheel-3.1.12/jquery.mousewheel.min.js"></script>
<div id=term_demo></div>

CSS

`

JavaScript

jQuery(function ($, undefined) {
    $('#term_demo').terminal(function (command, term) {
        if (command == 'test') {
            term.echo('test');
        } else if (command !== '') {
            try {
                var result = window.eval(command);
                if (result !== undefined) {
                    term.echo(new String(result));
                }
            } catch (e) {
                term.error(new String(e));
            }
        } else {
            term.echo('');
        }
    }, {
        greetings: 'Welcome to the COMPS console v1.0',
        name: 'COMPS',
        height: 200,
        prompt: 'COMPS> ',
        tabcompletion: true,
        completion: function (terminal, command, callback) {

                //callback(['campaign', 'config', 'demographics']);   
            //if (command==="create") {
                //console.log('callback');
                debugger;
                callback(['create campaign', 'create config', 'demographics']);
            //}
        }
    });
});