Console
[jscl.git] / test.html
index 7ef4cf5..322ccbf 100644 (file)
--- a/test.html
+++ b/test.html
@@ -1,6 +1,74 @@
 <!doctype html>
 <html>
+  <head>
+    <style>
+     /* The console container element */
+    body { background-color: black; font-size: 16px; font-family: Courier; }
+
+    #console {
+      position: absolute;
+      width: 100%;
+      height: 100%;
+      background-color:black;
+    }
+    /* The inner console element. */
+    .jqconsole {
+        padding: 10px;
+    }
+    /* The cursor. */
+    .jqconsole-cursor {
+        background-color: gray;
+    }
+    /* The cursor color when the console looses focus. */
+    .jqconsole-blurred .jqconsole-cursor {
+        background-color: #666;
+    }
+    /* The current prompt text color */
+    .jqconsole-prompt {
+        color: White;
+    }
+    /* The command history */
+    .jqconsole-old-prompt {
+        color: White;
+        font-weight: normal;
+    }
+    /* The text color when in input mode. */
+    .jqconsole-input {
+        color: White;
+    }
+    /* Previously entered input. */
+    .jqconsole-old-input {
+        color: White;
+        font-weight: normal;
+    }
+    /* The text color of the output. */
+    .jqconsole-output {
+        color: gray;
+    }
+    </style>
+  </head>
+
   <body>
-    <script type="text/javascript" src="test.js"></script>
+    <div id="console"></div>
+    <script src="test.js" type="text/javascript"></script>
+    <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
+    <script src="jqconsole.min.js" type="text/javascript" charset="utf-8"></script>
+    <script>
+      $(function () {
+        var jqconsole = $('#console').jqconsole('Hi\n', '> ');
+        var startPrompt = function () {
+          // Start the prompt with history enabled.
+          jqconsole.Prompt(true, function (input) {
+            // Output input with the class jqconsole-output.
+            if (input[0] == ',')
+                jqconsole.Write(JSON.stringify(lisp.evalString(input)) + '\n', 'jqconsole-output');
+                jqconsole.Write(JSON.stringify(lisp.compileString(input)) + '\n', 'jqconsole-output');
+            // Restart the prompt.
+            startPrompt();
+          });
+        };
+        startPrompt();
+      });
+    </script>
   </body>
 </html>