Console
[jscl.git] / test.html
1 <!doctype html>
2 <html>
3   <head>
4     <style>
5      /* The console container element */
6     body { background-color: black; font-size: 16px; font-family: Courier; }
7
8     #console {
9       position: absolute;
10       width: 100%;
11       height: 100%;
12       background-color:black;
13     }
14     /* The inner console element. */
15     .jqconsole {
16         padding: 10px;
17     }
18     /* The cursor. */
19     .jqconsole-cursor {
20         background-color: gray;
21     }
22     /* The cursor color when the console looses focus. */
23     .jqconsole-blurred .jqconsole-cursor {
24         background-color: #666;
25     }
26     /* The current prompt text color */
27     .jqconsole-prompt {
28         color: White;
29     }
30     /* The command history */
31     .jqconsole-old-prompt {
32         color: White;
33         font-weight: normal;
34     }
35     /* The text color when in input mode. */
36     .jqconsole-input {
37         color: White;
38     }
39     /* Previously entered input. */
40     .jqconsole-old-input {
41         color: White;
42         font-weight: normal;
43     }
44     /* The text color of the output. */
45     .jqconsole-output {
46         color: gray;
47     }
48     </style>
49   </head>
50
51   <body>
52     <div id="console"></div>
53     <script src="test.js" type="text/javascript"></script>
54     <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
55     <script src="jqconsole.min.js" type="text/javascript" charset="utf-8"></script>
56     <script>
57       $(function () {
58         var jqconsole = $('#console').jqconsole('Hi\n', '> ');
59         var startPrompt = function () {
60           // Start the prompt with history enabled.
61           jqconsole.Prompt(true, function (input) {
62             // Output input with the class jqconsole-output.
63             if (input[0] == ',')
64                 jqconsole.Write(JSON.stringify(lisp.evalString(input)) + '\n', 'jqconsole-output');
65                 jqconsole.Write(JSON.stringify(lisp.compileString(input)) + '\n', 'jqconsole-output');
66             // Restart the prompt.
67             startPrompt();
68           });
69         };
70         startPrompt();
71       });
72     </script>
73   </body>
74 </html>