Permalink
Browse files

Created hiji

git-svn-id: https://haskelltolkinjavascript.googlecode.com/svn/trunk@21 db4f5c52-0a63-11df-b76f-33ad6b24dacb
  • Loading branch information...
1 parent 4e16f30 commit bafafcb3f22f9bf4db80da871c37bd27250acf4e phyrex1an@hotmail.com committed Feb 8, 2010
Showing with 95 additions and 12 deletions.
  1. +16 −12 ghci.html
  2. +38 −0 haskell.hiji.js
  3. +41 −0 hiji.css
View
@@ -2,18 +2,22 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
- <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
- <title>HIJi (GHCi like)</title>
- <script src="lib/jsparse.js" type="text/javascript"></script>
- <script src="haskell.js" type="text/javascript"></script>
- <script src="haskell.parser.js" type="text/javascript"></script>
- <script src="haskell.interpreter.js" type="text/javascript"></script>
- <script src="haskell.hiji.js" type="text/javascript"></script>
- <script type="text/javascript">
- hiji.startOn(document.getElementById("hiji"));
- </script>
-</head>
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
+ <title>HIJi (GHCi like)</title>
+ <script src="lib/jsparse.js" type="text/javascript"></script>
+ <script src="haskell.js" type="text/javascript"></script>
+ <script src="haskell.parser.js" type="text/javascript"></script>
+ <script src="haskell.interpreter.js" type="text/javascript"></script>
+ <script src="http://code.jquery.com/jquery-latest.js"></script>
+ <script src="haskell.hiji.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ $(document).ready(function(){
+ $('#hiji').startHiji();
+ });
+ </script>
+ <link rel="stylesheet" type="text/css" href="hiji.css">
+</head>22
<body>
- <div id="hiji"></div>
+ <div id="hiji" class="ghci-look"></div>
</body>
</html>
View
@@ -0,0 +1,38 @@
+(function($){
+ var evaluateHaskell = function(line, env)
+ {
+ return "Not implemented";
+ };
+ var makeModules = function(modules){
+ return "<ul class='modules'><li>" + modules.join("</li><li>") + "</li></ul>";
+ };
+ var makeEntered = function(modules, entered){
+ return $("<li class='entered'>" + makeModules(modules) + "<span class='line'>" + entered + "</span></li>");1
+ };
+ var makeResponse = function(response){
+
+ };
+ var makeInput = function(modules){
+ return "<li class='input'>" + makeModules(modules) + "<input type='text'></li>";
+ };
+ var makeOutput = function(output) {
+ return $("<li class='output'></li>").text(output);
+ };
+ $.fn.startHiji = function() {
+ var modules = new Array();
+ modules[0] = "Prelude";
+ modules[1] = "Control.Monad";
+ this.html("<ol>" + makeInput(modules) + "</ol>");
+ this.keypress(function(e){
+ if (e.keyCode=='13'){
+ var input = $('input', this);
+ var line = input.attr("value");
+ input.attr("value","");
+ var newLine = makeEntered(modules, line);
+ var output = makeOutput(evaluateHaskell(line,{}));
+ $('.input', this).after(output).replaceWith(newLine);
+ $("ol",this).append(makeInput(modules));
+ }
+ });
+ };
+})(jQuery);
View
@@ -0,0 +1,41 @@
+.ghci-look * {
+ margin:0;
+ padding:0;
+ font-family:monospace;
+}
+
+.ghci-look {
+ cursor:text;
+}
+
+.ghci-look ol{
+ width:800px;
+ height:400px;
+ overflow-x:auto;
+ overflow-y:scroll;
+ list-style-type:none;
+}
+
+.ghci-look .input input {
+ border:none;
+ display:inline-block;
+ margin-left:-1px;
+}
+
+.ghci-look .modules {
+ display:inline;
+}
+
+.ghci-look .modules li {
+ display:inline;
+ padding-right:0.5em;
+}
+
+.ghci-look .modules li:last-child {
+ padding-right:0;
+}
+
+.ghci-look .modules:after {
+ content:">";
+ padding-right:0.5em;
+}

0 comments on commit bafafcb

Please sign in to comment.