{% extends base %}

{% block head %}
<style>
    #console {
        width:100%;
        height:30em;
        background: black;
    }
    .console_text {
        color:#fff;
        font-family: consolas;
        font-size:1em;
    }
    #cursor {
        margin: 0px;
        padding: 0px;
        background: blue;
        font-size: 1em;
    }
</style>

<link rel="stylesheet" type="text/css" href="{{_server_home}}/static/lib/jquery.terminal/jquery.terminal-1.3.1.min.css">
{% end %}

{% block body_left %}

<div class="card">
    {% set title = "在线终端" %}
    {% include common/base_title.html %}
</div>

<div class="card">
    <div id="console"></div>
</div>

<script type="text/javascript" src="/static/lib/jquery.terminal/jquery.terminal-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#console").terminal(function(command, term) {
        if (command.indexOf("calc ")>=0) {
            term.echo(eval(command.substring(4)));
        } else {            
            xnote.http.post("/system/command", {command: command}, function (data, status) {
                term.echo(data);
            }).fail(function (data) {
                console.log(data);
                term.exception("failed"+data, "error");
            });
        }
    });
});
</script>

{% end %}

{% block body_right %}
    {% include common/sidebar/default.html %}
{% end %}