Rename project to JSCL
[jscl.git] / jscl.html
diff --git a/jscl.html b/jscl.html
new file mode 100644 (file)
index 0000000..656af67
--- /dev/null
+++ b/jscl.html
@@ -0,0 +1,110 @@
+<!doctype html>
+<html>
+  <head>
+    <style>
+     /* The console container element */
+    body { background-color: black; font-size: 16px; font-family: Courier; overflow: hidden; padding: 0 0 0 0;}
+    #console {
+      position: absolute;
+      top: 0px;
+      bottom: 0px;
+      left: 0px;
+      right: 0px;
+      background-color:black;
+    }
+
+    .parents {
+        font-weight: bold;
+    }
+
+    /* 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: green;
+    }
+    .jqconsole-return, .jqconsole-header {
+        color: gray;
+    }
+    .jqconsole-error {
+        color: red;
+    }
+</style>
+  </head>
+
+  <body>
+    <div id="console"></div>
+    <script src="jscl.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('Welcome to JSCL!\n\n', '');
+        jqconsole.RegisterMatching('(', ')', 'parents');
+
+        lisp.write = function(str){
+           jqconsole.Write(str, 'jqconsole-output', false);
+           return str;
+        }
+
+        var startPrompt = function () {
+          // Start the prompt with history enabled.
+          jqconsole.Write(lisp.evalString(pv, '(CL:PACKAGE-NAME CL:*PACKAGE*)') + '> ', 'jqconsole-prompt');
+          jqconsole.Prompt(true, function (input) {
+            // Output input with the class jqconsole-return.
+            if (input[0] != ','){
+                try {
+                    var vs = lisp.evalInput(mv, input);
+                    for (var i=0; i<vs.length; i++){
+                       jqconsole.Write(lisp.print(pv, vs[i]) + '\n', 'jqconsole-return');
+                    }
+                } catch(error) {
+                    jqconsole.Write('ERROR: ' + (error.message || error) + '\n', 'jqconsole-error');
+                }
+            } else {
+                jqconsole.Write(lisp.compileString(pv, input.slice(1)) + '\n', 'jqconsole-return');
+            }
+            // Restart the prompt.
+            startPrompt();
+          }, function(input){
+            try {
+                lisp.read(pv, input[0]==','? input.slice(1): input);
+            } catch(error) {
+                return 0;
+            }
+            return false;
+          });
+        };
+        startPrompt();
+      });
+    </script>
+  </body>
+</html>