Skip to content

Commit

Permalink
Update to 1.4, get rid of leiningen tasks for fetching stuff.
Browse files Browse the repository at this point in the history
Updated all the dependencies and got rid of the Leiningen task for fetching
javascript files. Instead, we're going to use a git submodule to fetch
jquery-console and use a CDN for jquery itself.
  • Loading branch information
Raynes committed May 5, 2012
1 parent 91cb8c4 commit b2ebc38
Show file tree
Hide file tree
Showing 14 changed files with 1,112 additions and 41 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,3 @@ pom.xml
lib
classes
*~
resources/public/javascript/jquery*
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "resources/public/javascript/jquery-console"]
path = resources/public/javascript/jquery-console
url = https://github.com/chrisdone/jquery-console.git
7 changes: 2 additions & 5 deletions project.clj
@@ -1,13 +1,10 @@
(defproject tryclojure "0.1.0-SNAPSHOT"
:description "A simple web-based Clojure REPL for trying out Clojure without having to install it."
:dependencies [[org.clojure/clojure "1.3.0"]
[noir "1.2.1"]
:dependencies [[org.clojure/clojure "1.4.0"]
[noir "1.3.0-beta3"]
[commons-lang/commons-lang "2.5"]
[clojail "0.5.1"]]
;; For lein and Heroku compatibility. If you're using cake, add
;; this line to .cake/config: jvm.opts = -Djava.security.policy=example.policy
:jvm-opts ["-Djava.security.policy=example.policy""-Xmx80M"]
:hooks [leiningen.fetch-js]
:main tryclojure.server)


20 changes: 20 additions & 0 deletions resources/public/javascript/jquery-console/.gitignore
@@ -0,0 +1,20 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Logs and databases #
######################
*.log

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
72 changes: 72 additions & 0 deletions resources/public/javascript/jquery-console/README
@@ -0,0 +1,72 @@
INTRODUCTION

See demo.html. Or here: http://chrisdone.com/jquery-console/demo.html

Options available:

autofocus bool Autofocus the terminal, rather than
having to click on it.

promptHistory bool Provide history support (kind of crappy,
needs doing properly.)

historyPreserveColumn bool Preserve the column you were one when
switching between history.

welcomeMessage string Just a first message to display on the
terminal.

promptLabel string Prompt string like 'JavaScript> '.

commandValidate function When user hits return, validate
whether to trigger commandHandle and
re-prompt.

commandHandle function Handle the command line, return a
string, boolean, or list
of {msg:"foo",className:"my-css-class"}.
commandHandle(line,report) is
called. Report function is for you
to report a result of the command
asynchronously.

animateScroll bool Whether to animate the scroll to
top. Currently disabled.

charInsertTrigger function Predicate for whether to allow
character insertion.
charInsertTrigger(char,line) is called.

cancelHandle function Handle a user-signaled interrupt.

LICENSE

Copyright 2010 Chris Done, Simon David Pratt. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.

2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.


194 changes: 194 additions & 0 deletions resources/public/javascript/jquery-console/demo.html
@@ -0,0 +1,194 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>JQuery Console Demo</title>
<meta name="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery.console.js"></script>
<!-- Everything beyond this point is user-customized -->
<script type="text/javascript">
$(document).ready(function(){
/* First console */
var console1 = $('<div class="console1">');
$('body').append(console1);
var controller1 = console1.console({
promptLabel: 'Demo> ',
commandValidate:function(line){
if (line == "") return false;
else return true;
},
commandHandle:function(line){
return [{msg:"=> [12,42]",
className:"jquery-console-message-value"},
{msg:":: [a]",
className:"jquery-console-message-type"}]
},
autofocus:true,
animateScroll:true,
promptHistory:true,
charInsertTrigger:function(keycode,line){
// Let you type until you press a-z
// Never allow zero.
return !line.match(/[a-z]+/) && keycode != '0'.charCodeAt(0);
}
});
/* Second console */
var console2 = $('<div class="console2">');
$('body').append(console2);
var controller2 = console2.console({
promptLabel: 'JavaScript> ',
commandValidate:function(line){
if (line == "") return false;
else return true;
},
commandHandle:function(line){
try { var ret = eval(line);
if (typeof ret != 'undefined') return ret.toString();
else return true; }
catch (e) { return e.toString(); }
},
animateScroll:true,
promptHistory:true,
welcomeMessage:'Enter some JavaScript expressions to evaluate.'
});
controller2.promptText('5 * 4');
/* Third console */
var console3CancelFlag = false;
var console3 = $('<div class="console3">');
$('body').append(console3);
var controller3 = console3.console({
promptLabel: 'Echo> ',
commandValidate:function(line){
if (line == "") return false;
else return true;
},
commandHandle:function(line,report){
setTimeout(function() {
if(!console3CancelFlag)
report(line);
else {
report([{msg:"User interrupt",
className:"jquery-console-message-error"}]);
console3CancelFlag = false;
}
},1000);
},
cancelHandle:function() {
console3CancelFlag = true;
},
animateScroll:true,
promptHistory:true
});
/* Fourth console */
var console4 = $('<div class="console4">');
$('body').append(console4);
var controller4 = console4.console({
promptLabel: 'SQL> ',
continuedPromptLabel: ' -> ',
commandValidate:function(line){
if (line == "") return false;
else return true;
},
commandHandle:function(line,report){
if (line.match(/;$/)) {
controller4.continuedPrompt = false;
alert("Execute: " + line);
return true;
} else {
controller4.continuedPrompt = true;
return;
}
},
promptHistory:true
});
});
</script>
<style type="text/css" media="screen">
div.console1,div.console2,div.console3 { word-wrap: break-word; }
/* First console */
div.console1 { font-size: 14px }
div.console1 div.jquery-console-inner
{ width:900px; height:200px; background:#333; padding:0.5em;
overflow:auto }
div.console1 div.jquery-console-prompt-box
{ color:#fff; font-family:monospace; }
div.console1 div.jquery-console-focus span.jquery-console-cursor
{ background:#fefefe; color:#333; font-weight:bold }
div.console1 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
padding:0.1em; }
div.console1 div.jquery-console-message-value
{ color:#1ad027; font-family:monospace;
padding:0.1em; }
div.console1 div.jquery-console-message-type
{ color:#52666f; font-family:monospace;
padding:0.1em; }
div.console1 span.jquery-console-prompt-label { font-weight:bold }
/* Second console */
div.console2 { font-size: 14px; margin-top:1em }
div.console2 div.jquery-console-inner
{ width:900px; height:200px; background:#efefef; padding:0.5em;
overflow:auto }
div.console2 div.jquery-console-prompt-box
{ color:#444; font-family:monospace; }
div.console2 div.jquery-console-focus span.jquery-console-cursor
{ background:#333; color:#eee; font-weight:bold }
div.console2 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
padding:0.1em; }
div.console2 div.jquery-console-message-success
{ color:#187718; font-family:monospace;
padding:0.1em; }
div.console2 span.jquery-console-prompt-label { font-weight:bold }
/* Third console */
div.console3 { font-size: 14px; margin-top:1em }
div.console3 div.jquery-console-inner
{ width:900px; height:200px; background:#efefef; padding:0.5em;
overflow:auto }
div.console3 div.jquery-console-prompt-box
{ color:#444; font-family:monospace; }
div.console3 div.jquery-console-focus span.jquery-console-cursor
{ background:#333; color:#eee; font-weight:bold }
div.console3 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
padding:0.1em; }
div.console3 div.jquery-console-message-success
{ color:#187718; font-family:monospace;
padding:0.1em; }
div.console3 span.jquery-console-prompt-label {
font-weight:bold }
/* Fourth console */
div.console4 { font-size: 14px; margin-top:1em }
div.console4 div.jquery-console-inner
{ width:900px; height:200px; background:#efefef; padding:0.5em;
overflow:auto }
div.console4 div.jquery-console-prompt-box
{ color:#444; font-family:monospace; }
div.console4 div.jquery-console-focus span.jquery-console-cursor
{ background:#444; color:#eee; font-weight:bold }
div.console4 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
padding:0.1em; }
div.console4 div.jquery-console-message-success
{ color:#187718; font-family:monospace;
padding:0.1em; }
div.console4 span.jquery-console-prompt-label { font-weight:bold }
</style>
</head>
<body>
<noscript>
<p>
<strong>Please enable JavaScript or upgrade your browser.</strong>
</p>
</noscript>
<h1>Simple console demo</h1>
<p>Tested on:</p>
<ul>
<li>Internet Explorer 6</li>
<li>Opera 10.01</li>
<li>Chromium 4.0.237.0 (Ubuntu build 31094)</li>
<li>Firefox 3.5.8</li>
</ul>
</body>
</html>

0 comments on commit b2ebc38

Please sign in to comment.