├── .travis.yml ├── .gitignore ├── example.policy ├── resources └── public │ ├── wtf.png │ ├── buttontdbg.png │ ├── clojure-logo.png │ ├── tutorial │ ├── end.html │ ├── page5.html │ ├── page2.html │ ├── page4.html │ ├── page6.html │ ├── page1.html │ ├── page11.html │ ├── page3.html │ ├── page7.html │ ├── page9.html │ ├── page8.html │ └── page10.html │ ├── javascript │ ├── jquery-console │ │ ├── .gitignore │ │ ├── README │ │ ├── demo.html │ │ ├── jquery.console.js │ │ └── jquery-1.4.2.min.js │ └── tryclojure.js │ └── css │ ├── gh-fork-ribbon.css │ └── tryclojure.css ├── Procfile ├── src └── tryclojure │ ├── views │ ├── tutorial.clj │ ├── eval.clj │ └── home.clj │ ├── server.clj │ └── models │ └── eval.clj ├── .gitmodules ├── README.md ├── test └── tryclojure │ └── eval_test.clj ├── project.clj └── epl-v10.html /.travis.yml: -------------------------------------------------------------------------------- 1 | language: clojure -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pom.xml 2 | *jar 3 | lib 4 | classes 5 | *~ 6 | .lein-deps-sum 7 | -------------------------------------------------------------------------------- /example.policy: -------------------------------------------------------------------------------- 1 | grant { 2 | permission java.security.AllPermission; 3 | }; 4 | -------------------------------------------------------------------------------- /resources/public/wtf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raynes/tryclojure/HEAD/resources/public/wtf.png -------------------------------------------------------------------------------- /resources/public/buttontdbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raynes/tryclojure/HEAD/resources/public/buttontdbg.png -------------------------------------------------------------------------------- /resources/public/clojure-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raynes/tryclojure/HEAD/resources/public/clojure-logo.png -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: java -Djava.security.policy=example.policy $JVM_OPTS -cp target/tryclojure-standalone.jar clojure.main -m tryclojure.server $PORT 2 | -------------------------------------------------------------------------------- /src/tryclojure/views/tutorial.clj: -------------------------------------------------------------------------------- 1 | (ns tryclojure.views.tutorial) 2 | 3 | (defn tutorial-html [page] 4 | (slurp (str "resources/public/tutorial/" page ".html"))) -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "resources/public/javascript/jquery-console"] 2 | path = resources/public/javascript/jquery-console 3 | url = https://github.com/chrisdone/jquery-console.git 4 | -------------------------------------------------------------------------------- /resources/public/tutorial/end.html: -------------------------------------------------------------------------------- 1 |
2 | Glad to know you're eager for more, but unfortunately this tutorial is over. 3 |
4 | 5 |6 | Maybe you can click the 'links' button above for more resources? 7 |
8 | -------------------------------------------------------------------------------- /resources/public/tutorial/page5.html: -------------------------------------------------------------------------------- 1 |Awesome!
2 | 3 |
4 | Many Clojure functions can take an arbitrary number of arguments.
5 | Try it out: type (+ 1 2 3 4 5 6) to continue.
6 |
2 | The first thing you may notice about Clojure is that common operations look... strange. 3 |
4 | 5 |
6 | For example, try typing (+ 3 3) in the REPL.
7 |
2 | Now, that was a bit surprising: Clojure has a built in Rational type.
3 | You can still force Clojure to do floating point division by making one of the operands floating point: type (/ 10 3.0) to continue.
4 |
2 | That's enough math. Let's do some fun stuff, like defining functions.
3 | You can do that in Clojure with defn.
4 |
7 | Type (defn square [x] (* x x)) to define a "square" function that takes a single number and squares it.
8 |
2 | I'll take you on a 5-minutes tour of Clojure, but feel free to experiment on your own along the road! 3 |
4 | 5 |
6 | You can type next to skip forward, back to return to the previous step, and restart to get back to the beginning. Let's get started: type next.
7 |
Great job!
2 | 3 |4 | We've only scratched the surface of Clojure and its mind-bending power. 5 | This tutorial is still a work in progress, and I'm working on more steps. 6 | Meanwhile, you can learn more about Clojure by visiting the 'links' page. 7 |
8 | 9 |10 | Welcome to your adventures in Clojure, and be prepared to be surprised and delighted every step of the way! 11 |
12 | -------------------------------------------------------------------------------- /resources/public/tutorial/page3.html: -------------------------------------------------------------------------------- 1 |2 | That was a strange way to say "three plus three", wasn't it? 3 |
4 | 5 |
6 | A Clojure program is made of lists.
7 | (+ 3 3) is a list that contains an operator, and then the operands.
8 | Try out the same concept with the * and - operators.
9 |
12 | Division might surprise you. When you're ready to move forward, try (/ 10 3).
13 |
](http://travis-ci.org/Raynes/tryclojure)
6 |
7 | ## Usage
8 |
9 | http://tryclj.com
10 |
11 | To run it locally, use `lein ring server`.
12 |
13 | ## Credits
14 |
15 | apgwoz: Design
16 |
17 | ## License
18 |
19 | Licensed under the same thing Clojure is licensed under: the EPL, of which you can find a copy at the root of this directory.
20 |
--------------------------------------------------------------------------------
/test/tryclojure/eval_test.clj:
--------------------------------------------------------------------------------
1 | (ns tryclojure.eval-test
2 | (:use tryclojure.models.eval
3 | clojure.test)
4 | (:require noir.session))
5 |
6 | (def sb (make-sandbox))
7 |
8 | (deftest eval-form-test
9 | (let [form "(do (println 10) (+ 3 3))"
10 | result (eval-string form sb)]
11 | (is (= "10\n" (-> result :result first str)))
12 | (is (= "6" (-> result :result second str)))
13 | (is (= (read-string form) (-> result :expr)))))
14 |
15 | (alter-var-root #'noir.session/*noir-session* (constantly (atom {})))
16 |
17 | (deftest eval-request-test
18 | (is (= "Execution Timed Out!" (:message (eval-request "(while true)")))))
--------------------------------------------------------------------------------
/project.clj:
--------------------------------------------------------------------------------
1 | (defproject tryclojure "0.1.0-SNAPSHOT"
2 | :description "A simple web-based Clojure REPL for trying out Clojure without having to install it."
3 | :dependencies [[org.clojure/clojure "1.4.0"]
4 | [lib-noir "0.8.1"]
5 | [compojure "1.1.6"]
6 | [ring-server "0.3.1"]
7 | [commons-lang/commons-lang "2.5"]
8 | [clojail "1.0.6"]]
9 | :jvm-opts ["-Djava.security.policy=example.policy" "-Xmx80M"]
10 | :min-lein-version "2.0.0"
11 | :uberjar-name "tryclojure-standalone.jar"
12 | :plugins [[lein-ring "0.8.10"]]
13 | :ring {:handler tryclojure.server/app :port 8801})
14 |
--------------------------------------------------------------------------------
/resources/public/tutorial/page7.html:
--------------------------------------------------------------------------------
1 | Congratulations - you just defined your first Clojure function. Many more will follow!
2 | 3 |
4 | defn takes the name of the function, then the list of arguments, and then the body of the function.
5 | I told you that a Clojure program is made of lists, right?
6 | The entire defn is a list, and the function body is also a list.
7 | (Even the arguments are collected in a vector, which is similar to a list - we'll talk about vectors soon).
8 |
11 | Oh, sorry for talking so long - you probably want to try out your brand new function!
12 | Type (square 10).
13 |
2 | Let's see what you just did: you evaluated a list where the first element is the function itself, defined on the spot - and the other elements are the arguments that you pass to the function.
3 | That's exactly the same syntax that you used earlier on to call functions like square or even +.
4 | The only difference is that now you defined the function in the same place where you called it.
5 |
8 | Remember defn?
9 | Now I can tell you a secret: defn is actually just a bit of syntactic sugar around def and fn.
10 | You've just seen fn at work: it defines a new function.
11 | def binds the newly defined function to a name.
12 |
15 | If you want, you can create a named function without using defn: type (def square (fn [x] (* x x))) to continue.
16 |
Yay! It works!
2 | 3 |4 | By now, you probably think that Clojure is very different from the programming languages you already know. 5 | Indeed, it belongs to a different family than most popular languages' - the family of "functional" programming languages. 6 | Like most functional languages, Clojure can define a function without even giving it a name: 7 |
8 | 9 |(fn [x] (* x x))
10 |
11 |
12 | If you run this code, you'll see some cryptic output.
13 | In Clojure, functions are just normal values like numbers or strings.
14 | fn defines a function and then returns it.
15 | What you're seeing is simply what a function looks like when you print it on the screen.
16 |
19 | But wait - an anonymous function isn't very useful if you can't call it. Try to define a new anonymous function and call it straight away: ((fn [x] (* x x)) 10).
20 |
2 | Success! Now you can call this new square function just like you called the old square function.
3 |
6 | By now, you know that lists are quite important in Clojure. 7 | But Clojure also has other data structures: 8 |
9 | 10 |
11 | Vectors: [1 2 3 4]
12 | Maps: {:foo "bar" 3 4}
13 | Sets: #{1 2 3 4}
14 |
17 | Vectors and lists are sequential and ordered collections.
18 | Sets are not ordered, and they cannot contain duplicate elements.
19 | Maps are key-value collections, where the keys can be any object.
20 | Here, we've used what Clojure calls a keyword (:foo) for one of the keys, and a number for the other key.
21 |
24 | Now I'll tell you another thing that may surprise you: Clojure collections are immutable - they can never change. 25 | When you do anything on a list, including adding and removing elements, you actually get a brand new list. 26 | (Fortunately, Clojure is amazingly efficient at creating new lists). 27 | In general, Clojure encourages you to have as little mutable state as possible. 28 | For example, instead of "for" loops and other state-changing constructs, most of the time you'll see functions doing transformations on immutable data and returning new collections, without changing the old one. 29 |
30 | 31 |
32 | A prime example of this is map. map is a higher order function, which means that it takes another function as an argument.
33 | For example, you can ask map to increment each number in a vector by passing it the inc function, followed by the vector.
34 | Try it for yourself: type (map inc [1 2 3 4]) to continue.
35 |
next in the REPL to begin." ]))
38 |
39 | (defn root-html []
40 | (html5
41 | [:head
42 | [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
43 | (include-css "/css/tryclojure.css"
44 | "/css/gh-fork-ribbon.css")
45 | (include-js "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
46 | "/javascript/jquery-console/jquery.console.js"
47 | "/javascript/tryclojure.js")
48 | [:title "Try Clojure"]]
49 | [:body
50 | [:div#wrapper
51 | [:div.github-fork-ribbon-wrapper.right
52 | [:div.github-fork-ribbon
53 | (link-to "https://github.com/Raynes/tryclojure" "Fork me on GitHub")]]
54 | [:div#content
55 | [:div#header
56 | [:h1
57 | [:span.logo-try "Try"] " "
58 | [:span.logo-clojure "Clo" [:em "j"] "ure"]]]
59 | [:div#container
60 | [:div#console.console]
61 | [:div#buttons
62 | [:a#links.buttons "links"]
63 | [:a#about.buttons.last "about"]]
64 | [:div#changer (home-html)]]
65 | [:div.footer
66 | [:p.bottom "©2011-2012 Anthony Grimes and numerous contributors."]]
67 | (javascript-tag
68 | "var _gaq = _gaq || [];
69 | _gaq.push(['_setAccount', 'UA-27340918-1']);
70 | _gaq.push(['_trackPageview']);
71 |
72 | (function() {
73 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
74 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
75 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
76 | })();")]]]))
77 |
78 |
--------------------------------------------------------------------------------
/resources/public/javascript/jquery-console/README:
--------------------------------------------------------------------------------
1 | INTRODUCTION
2 |
3 | See demo.html. Or here: http://chrisdone.com/jquery-console/
4 |
5 | Options available:
6 |
7 | autofocus bool Autofocus the terminal, rather than
8 | having to click on it.
9 |
10 | promptHistory bool Provide history support (kind of crappy,
11 | needs doing properly.)
12 |
13 | historyPreserveColumn bool Preserve the column you were one when
14 | switching between history.
15 |
16 | welcomeMessage string Just a first message to display on the
17 | terminal.
18 |
19 | promptLabel string Prompt string like 'JavaScript> '.
20 |
21 | cols integer the number of cols, this value is only
22 | used by the command completion to format
23 | the list of results.
24 |
25 | commandValidate function When user hits return, validate
26 | whether to trigger commandHandle and
27 | re-prompt.
28 |
29 | commandHandle function Handle the command line, return a
30 | string, boolean, or list
31 | of {msg:"foo",className:"my-css-class"}.
32 | commandHandle(line,report) is
33 | called. Report function is for you
34 | to report a result of the command
35 | asynchronously.
36 |
37 | commandComplete function Handle the command completion when the
38 | tab key is pressed. It returns a list
39 | of string completion suffixes.
40 |
41 | animateScroll bool Whether to animate the scroll to
42 | top. Currently disabled.
43 |
44 | charInsertTrigger function Predicate for whether to allow
45 | character insertion.
46 | charInsertTrigger(char,line) is called.
47 |
48 | cancelHandle function Handle a user-signaled interrupt.
49 |
50 | fadeOnReset bool Whether to trigger a fade in/out when
51 | the console is reset. Defaults to true.
52 |
53 | LICENSE
54 |
55 | Copyright 2010 Chris Done, Simon David Pratt. All rights reserved.
56 |
57 | Redistribution and use in source and binary forms, with or without
58 | modification, are permitted provided that the following conditions
59 | are met:
60 |
61 | 1. Redistributions of source code must retain the above
62 | copyright notice, this list of conditions and the following
63 | disclaimer.
64 |
65 | 2. Redistributions in binary form must reproduce the above
66 | copyright notice, this list of conditions and the following
67 | disclaimer in the documentation and/or other materials
68 | provided with the distribution.
69 |
70 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
71 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
72 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
73 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
74 | COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
75 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
76 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
77 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
78 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
79 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
80 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
81 | POSSIBILITY OF SUCH DAMAGE.
82 |
--------------------------------------------------------------------------------
/resources/public/css/tryclojure.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: #F7F7F7;
3 | text-align: center;
4 | font-family: Helvetica, sans-serif;
5 | color: #6C7B89;
6 | }
7 |
8 | #wrapper {
9 | text-align: left;
10 | width: 620px;
11 | margin: 0 auto;
12 | }
13 |
14 | #header {
15 | margin: 20px 0px 20px 190px;
16 | }
17 |
18 | #header h1 {
19 | height: 72px;
20 | line-height: 72px;
21 | background: url(../clojure-logo.png) no-repeat;
22 | padding: 0px 0px 0px 80px;
23 | font-weight: normal;
24 | font-size: 36px;
25 | }
26 |
27 | #header h1 span.logo-try {
28 | color: #63b132;
29 | display:inline;
30 | }
31 |
32 | #header h1 span.logo-clojure {
33 | color: #2B4A8B;
34 | display:inline
35 | }
36 |
37 | #container {
38 | margin-bottom: 40px;
39 | }
40 |
41 | #console {
42 | height: 220px;
43 | padding: 10px;
44 | background: #FFFFFF;
45 | font-family: monospace;
46 | font-size: 14px;
47 | color: #6C7B89;
48 | margin-bottom: 10px;
49 | }
50 |
51 | #console textarea {
52 | /* Use a largish font to ensure iOS doesn't zoom in on focus */
53 | font-size: 2em;
54 | }
55 |
56 | #console div.jquery-console-inner {
57 | width:580px;
58 | height:200px;
59 | margin: 10px 10px;
60 | overflow:auto;
61 | text-align:left;
62 | }
63 |
64 | #console div.jquery-console-message-value {
65 | color:#63b132;
66 | }
67 |
68 | #console div.jquery-console-prompt-box {
69 | color: #6C7B89;
70 | }
71 |
72 | #console div.jquery-console-focus span.jquery-console-cursor {
73 | background:#6C7B89;
74 | color: #FFFFFF;
75 | }
76 |
77 | #console div.jquery-console-message-error {
78 | color:#FD713B;
79 | }
80 |
81 | #console div.jquery-console-message-success {
82 | color:#63b132;
83 | }
84 |
85 | #console span.jquery-console-prompt-label {
86 | font-weight:bold;
87 | }
88 |
89 | #buttons {
90 | background: transparent;
91 | text-align: center;
92 | margin-bottom: 10px;
93 | }
94 |
95 | #buttons a {
96 | display: inline-block;
97 | color: #2B4A8B;
98 | padding: 2px 2px;
99 | border-bottom: 2px solid #2B4A8B;
100 | text-transform: uppercase;
101 | margin: 10px;
102 | font-family: Helvetica, sans-serif;
103 | font-size: 16px;
104 | transition: all 100ms;
105 | }
106 |
107 | #buttons a.last {
108 | margin-right: 0;
109 | }
110 |
111 | #buttons a:hover {
112 | cursor: pointer;
113 | }
114 |
115 | #changer {
116 | line-height: 1.3em;
117 | padding: 20px;
118 | background: #D6DADD;
119 | margin-bottom: 10px;
120 | }
121 |
122 | #changer p {
123 | margin: 0.6em;
124 | }
125 |
126 | #changer a {
127 | color: #2B4A8B;
128 | }
129 |
130 | #changer a:visited {
131 | color: #60749E;
132 | }
133 |
134 | #changer code {
135 | background-color: #eee;
136 | border: 1px solid #aaa;
137 | color: #555;
138 | font-family: courier, monospace;
139 | padding: 0.1em 0.25em 0.1em 0.25em;
140 | }
141 |
142 | #changer ul {
143 | margin: 0px;
144 | padding: 0px;
145 | list-style: none;
146 | }
147 |
148 | #tuttext {
149 | }
150 |
151 | .continue {
152 | width: 100%;
153 | text-align: center;
154 | padding-top: 0.5em;
155 | }
156 |
157 | .footer {
158 | text-align: center;
159 | }
160 |
161 | /* Coderay alpha style */
162 | code {
163 | display: inline-block;
164 | }
165 |
166 | .code {
167 | color: #000;
168 | }
169 |
170 | .code pre { margin: 0px; }
171 |
172 | span.code { white-space: pre; border: 0px; padding: 2px; }
173 | span.code:hover { cursor: pointer; }
174 |
175 | table.code { border-collapse: collapse; width: 100%; padding: 2px; }
176 | table.code td { padding: 2px 4px; vertical-align: top; }
177 |
178 | .code .line_numbers, .code .no {
179 | background-color: #def;
180 | color: gray;
181 | text-align: right;
182 | }
183 |
184 | /* keywords */
185 | #changer .code span.r {
186 | color: #0000ff;
187 | font-weight: bold;
188 | }
189 |
190 | /* symbols */
191 | #changer .code span.sy {
192 | color: #318495;
193 | }
194 |
195 | /* strings */
196 | #changer .code span.s {
197 | color: #008800;
198 | }
199 |
200 | /* paren */
201 | #changer .code span.of {
202 | color: #222;
203 | font-weight: bold;
204 | }
205 |
206 | /* comment */
207 | #changer .code span.c {
208 | color: #ccc;
209 | }
210 |
211 | /* operator */
212 | #changer .code span.cl {
213 |
214 | }
215 |
216 | /* number */
217 | #changer .code span.i {
218 | color: #ff0000;
219 | }
220 |
221 | @media (max-width: 619px) {
222 |
223 | #wrapper {
224 | width: 100%;
225 | }
226 | #header {
227 | margin: 20px auto;
228 | }
229 | #console div.jquery-console-inner {
230 | width: auto;
231 | }
232 |
233 | }
234 |
--------------------------------------------------------------------------------
/resources/public/javascript/tryclojure.js:
--------------------------------------------------------------------------------
1 | var currentPage = -1;
2 | var pages = [
3 | "page1",
4 | "page2",
5 | "page3",
6 | "page4",
7 | "page5",
8 | "page6",
9 | "page7",
10 | "page8",
11 | "page9",
12 | "page10",
13 | "page11",
14 | "end"
15 | ];
16 | var pageExitConditions = [
17 | {
18 | verify: function(data) { return false; }
19 | },
20 | {
21 | verify: function(data) { return data.expr == "(+ 3 3)"; }
22 | },
23 | {
24 | verify: function(data) { return data.expr == "(/ 10 3)"; }
25 | },
26 | {
27 | verify: function(data) { return data.expr == "(/ 10 3.0)"; }
28 | },
29 | {
30 | verify: function(data) { return data.expr == "(+ 1 2 3 4 5 6)"; }
31 | },
32 | {
33 | verify: function (data) { return data.expr == "(defn square [x] (* x x))"; }
34 | },
35 | {
36 | verify: function (data) { return data.expr == "(square 10)"; }
37 | },
38 | {
39 | verify: function (data) { return data.expr == "((fn [x] (* x x)) 10)"; }
40 | },
41 | {
42 | verify: function (data) { return data.expr == "(def square (fn [x] (* x x)))"; }
43 | },
44 | {
45 | verify: function (data) { return data.expr == "(map inc [1 2 3 4])"; }
46 | },
47 | {
48 | verify: function (data) { return false; }
49 | },
50 | {
51 | verify: function (data) { return false; }
52 | }
53 | ];
54 |
55 | function goToPage(pageNumber) {
56 | if (pageNumber == currentPage || pageNumber < 0 || pageNumber >= pages.length) {
57 | return;
58 | }
59 |
60 | currentPage = pageNumber;
61 |
62 | var block = $("#changer");
63 | block.fadeOut(function(e) {
64 | block.load("/tutorial", { 'page' : pages[pageNumber] }, function() {
65 | block.fadeIn();
66 | changerUpdated();
67 | });
68 | });
69 | }
70 |
71 | function setupLink(url) {
72 | return function(e) { $("#changer").load(url, function(data) { $("#changer").html(data); }); }
73 | }
74 |
75 | function setupExamples(controller) {
76 | $(".code").click(function(e) {
77 | controller.promptText($(this).text());
78 | });
79 | }
80 |
81 | function getStep(n, controller) {
82 | $("#tuttext").load("tutorial", { step: n }, function() { setupExamples(controller); });
83 | }
84 |
85 | function eval_clojure(code) {
86 | var data;
87 | $.ajax({
88 | url: "eval.json",
89 | data: { expr : code },
90 | async: false,
91 | success: function(res) { data = res; }
92 | });
93 | return data;
94 | }
95 |
96 | function html_escape(val) {
97 | var result = val;
98 | result = result.replace(/\n/g, "Tested on:
214 |THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 33 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR 34 | DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS 35 | AGREEMENT.
36 | 37 |1. DEFINITIONS
38 | 39 |"Contribution" means:
40 | 41 |a) in the case of the initial Contributor, the initial 42 | code and documentation distributed under this Agreement, and
43 |b) in the case of each subsequent Contributor:
44 |i) changes to the Program, and
45 |ii) additions to the Program;
46 |where such changes and/or additions to the Program 47 | originate from and are distributed by that particular Contributor. A 48 | Contribution 'originates' from a Contributor if it was added to the 49 | Program by such Contributor itself or anyone acting on such 50 | Contributor's behalf. Contributions do not include additions to the 51 | Program which: (i) are separate modules of software distributed in 52 | conjunction with the Program under their own license agreement, and (ii) 53 | are not derivative works of the Program.
54 | 55 |"Contributor" means any person or entity that distributes 56 | the Program.
57 | 58 |"Licensed Patents" mean patent claims licensable by a 59 | Contributor which are necessarily infringed by the use or sale of its 60 | Contribution alone or when combined with the Program.
61 | 62 |"Program" means the Contributions distributed in accordance 63 | with this Agreement.
64 | 65 |"Recipient" means anyone who receives the Program under 66 | this Agreement, including all Contributors.
67 | 68 |2. GRANT OF RIGHTS
69 | 70 |a) Subject to the terms of this Agreement, each 71 | Contributor hereby grants Recipient a non-exclusive, worldwide, 72 | royalty-free copyright license to reproduce, prepare derivative works 73 | of, publicly display, publicly perform, distribute and sublicense the 74 | Contribution of such Contributor, if any, and such derivative works, in 75 | source code and object code form.
76 | 77 |b) Subject to the terms of this Agreement, each 78 | Contributor hereby grants Recipient a non-exclusive, worldwide, 79 | royalty-free patent license under Licensed Patents to make, use, sell, 80 | offer to sell, import and otherwise transfer the Contribution of such 81 | Contributor, if any, in source code and object code form. This patent 82 | license shall apply to the combination of the Contribution and the 83 | Program if, at the time the Contribution is added by the Contributor, 84 | such addition of the Contribution causes such combination to be covered 85 | by the Licensed Patents. The patent license shall not apply to any other 86 | combinations which include the Contribution. No hardware per se is 87 | licensed hereunder.
88 | 89 |c) Recipient understands that although each Contributor 90 | grants the licenses to its Contributions set forth herein, no assurances 91 | are provided by any Contributor that the Program does not infringe the 92 | patent or other intellectual property rights of any other entity. Each 93 | Contributor disclaims any liability to Recipient for claims brought by 94 | any other entity based on infringement of intellectual property rights 95 | or otherwise. As a condition to exercising the rights and licenses 96 | granted hereunder, each Recipient hereby assumes sole responsibility to 97 | secure any other intellectual property rights needed, if any. For 98 | example, if a third party patent license is required to allow Recipient 99 | to distribute the Program, it is Recipient's responsibility to acquire 100 | that license before distributing the Program.
101 | 102 |d) Each Contributor represents that to its knowledge it 103 | has sufficient copyright rights in its Contribution, if any, to grant 104 | the copyright license set forth in this Agreement.
105 | 106 |3. REQUIREMENTS
107 | 108 |A Contributor may choose to distribute the Program in object code 109 | form under its own license agreement, provided that:
110 | 111 |a) it complies with the terms and conditions of this 112 | Agreement; and
113 | 114 |b) its license agreement:
115 | 116 |i) effectively disclaims on behalf of all Contributors 117 | all warranties and conditions, express and implied, including warranties 118 | or conditions of title and non-infringement, and implied warranties or 119 | conditions of merchantability and fitness for a particular purpose;
120 | 121 |ii) effectively excludes on behalf of all Contributors 122 | all liability for damages, including direct, indirect, special, 123 | incidental and consequential damages, such as lost profits;
124 | 125 |iii) states that any provisions which differ from this 126 | Agreement are offered by that Contributor alone and not by any other 127 | party; and
128 | 129 |iv) states that source code for the Program is available 130 | from such Contributor, and informs licensees how to obtain it in a 131 | reasonable manner on or through a medium customarily used for software 132 | exchange.
133 | 134 |When the Program is made available in source code form:
135 | 136 |a) it must be made available under this Agreement; and
137 | 138 |b) a copy of this Agreement must be included with each 139 | copy of the Program.
140 | 141 |Contributors may not remove or alter any copyright notices contained 142 | within the Program.
143 | 144 |Each Contributor must identify itself as the originator of its 145 | Contribution, if any, in a manner that reasonably allows subsequent 146 | Recipients to identify the originator of the Contribution.
147 | 148 |4. COMMERCIAL DISTRIBUTION
149 | 150 |Commercial distributors of software may accept certain 151 | responsibilities with respect to end users, business partners and the 152 | like. While this license is intended to facilitate the commercial use of 153 | the Program, the Contributor who includes the Program in a commercial 154 | product offering should do so in a manner which does not create 155 | potential liability for other Contributors. Therefore, if a Contributor 156 | includes the Program in a commercial product offering, such Contributor 157 | ("Commercial Contributor") hereby agrees to defend and 158 | indemnify every other Contributor ("Indemnified Contributor") 159 | against any losses, damages and costs (collectively "Losses") 160 | arising from claims, lawsuits and other legal actions brought by a third 161 | party against the Indemnified Contributor to the extent caused by the 162 | acts or omissions of such Commercial Contributor in connection with its 163 | distribution of the Program in a commercial product offering. The 164 | obligations in this section do not apply to any claims or Losses 165 | relating to any actual or alleged intellectual property infringement. In 166 | order to qualify, an Indemnified Contributor must: a) promptly notify 167 | the Commercial Contributor in writing of such claim, and b) allow the 168 | Commercial Contributor to control, and cooperate with the Commercial 169 | Contributor in, the defense and any related settlement negotiations. The 170 | Indemnified Contributor may participate in any such claim at its own 171 | expense.
172 | 173 |For example, a Contributor might include the Program in a commercial 174 | product offering, Product X. That Contributor is then a Commercial 175 | Contributor. If that Commercial Contributor then makes performance 176 | claims, or offers warranties related to Product X, those performance 177 | claims and warranties are such Commercial Contributor's responsibility 178 | alone. Under this section, the Commercial Contributor would have to 179 | defend claims against the other Contributors related to those 180 | performance claims and warranties, and if a court requires any other 181 | Contributor to pay any damages as a result, the Commercial Contributor 182 | must pay those damages.
183 | 184 |5. NO WARRANTY
185 | 186 |EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS 187 | PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 188 | OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 189 | ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY 190 | OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely 191 | responsible for determining the appropriateness of using and 192 | distributing the Program and assumes all risks associated with its 193 | exercise of rights under this Agreement , including but not limited to 194 | the risks and costs of program errors, compliance with applicable laws, 195 | damage to or loss of data, programs or equipment, and unavailability or 196 | interruption of operations.
197 | 198 |6. DISCLAIMER OF LIABILITY
199 | 200 |EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT 201 | NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 202 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING 203 | WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF 204 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 205 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR 206 | DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 207 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
208 | 209 |7. GENERAL
210 | 211 |If any provision of this Agreement is invalid or unenforceable under 212 | applicable law, it shall not affect the validity or enforceability of 213 | the remainder of the terms of this Agreement, and without further action 214 | by the parties hereto, such provision shall be reformed to the minimum 215 | extent necessary to make such provision valid and enforceable.
216 | 217 |If Recipient institutes patent litigation against any entity 218 | (including a cross-claim or counterclaim in a lawsuit) alleging that the 219 | Program itself (excluding combinations of the Program with other 220 | software or hardware) infringes such Recipient's patent(s), then such 221 | Recipient's rights granted under Section 2(b) shall terminate as of the 222 | date such litigation is filed.
223 | 224 |All Recipient's rights under this Agreement shall terminate if it 225 | fails to comply with any of the material terms or conditions of this 226 | Agreement and does not cure such failure in a reasonable period of time 227 | after becoming aware of such noncompliance. If all Recipient's rights 228 | under this Agreement terminate, Recipient agrees to cease use and 229 | distribution of the Program as soon as reasonably practicable. However, 230 | Recipient's obligations under this Agreement and any licenses granted by 231 | Recipient relating to the Program shall continue and survive.
232 | 233 |Everyone is permitted to copy and distribute copies of this 234 | Agreement, but in order to avoid inconsistency the Agreement is 235 | copyrighted and may only be modified in the following manner. The 236 | Agreement Steward reserves the right to publish new versions (including 237 | revisions) of this Agreement from time to time. No one other than the 238 | Agreement Steward has the right to modify this Agreement. The Eclipse 239 | Foundation is the initial Agreement Steward. The Eclipse Foundation may 240 | assign the responsibility to serve as the Agreement Steward to a 241 | suitable separate entity. Each new version of the Agreement will be 242 | given a distinguishing version number. The Program (including 243 | Contributions) may always be distributed subject to the version of the 244 | Agreement under which it was received. In addition, after a new version 245 | of the Agreement is published, Contributor may elect to distribute the 246 | Program (including its Contributions) under the new version. Except as 247 | expressly stated in Sections 2(a) and 2(b) above, Recipient receives no 248 | rights or licenses to the intellectual property of any Contributor under 249 | this Agreement, whether expressly, by implication, estoppel or 250 | otherwise. All rights in the Program not expressly granted under this 251 | Agreement are reserved.
252 | 253 |This Agreement is governed by the laws of the State of New York and 254 | the intellectual property laws of the United States of America. No party 255 | to this Agreement will bring a legal action under this Agreement more 256 | than one year after the cause of action arose. Each party waives its 257 | rights to a jury trial in any resulting litigation.
258 | 259 | 260 | 261 | -------------------------------------------------------------------------------- /resources/public/javascript/jquery-console/jquery.console.js: -------------------------------------------------------------------------------- 1 | // JQuery Console 1.0 2 | // Sun Feb 21 20:28:47 GMT 2010 3 | // 4 | // Copyright 2010 Chris Done, Simon David Pratt. All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // 1. Redistributions of source code must retain the above 11 | // copyright notice, this list of conditions and the following 12 | // disclaimer. 13 | // 14 | // 2. Redistributions in binary form must reproduce the above 15 | // copyright notice, this list of conditions and the following 16 | // disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 25 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | // POSSIBILITY OF SUCH DAMAGE. 31 | 32 | // TESTED ON 33 | // Internet Explorer 6 34 | // Opera 10.01 35 | // Chromium 4.0.237.0 (Ubuntu build 31094) 36 | // Firefox 3.5.8, 3.6.2 (Mac) 37 | // Safari 4.0.5 (6531.22.7) (Mac) 38 | // Google Chrome 5.0.375.55 (Mac) 39 | 40 | (function($){ 41 | var isWebkit = !!~navigator.userAgent.indexOf(' AppleWebKit/'); 42 | 43 | $.fn.console = function(config){ 44 | //////////////////////////////////////////////////////////////////////// 45 | // Constants 46 | // Some are enums, data types, others just for optimisation 47 | var keyCodes = { 48 | // left 49 | 37: moveBackward, 50 | // right 51 | 39: moveForward, 52 | // up 53 | 38: previousHistory, 54 | // down 55 | 40: nextHistory, 56 | // backspace 57 | 8: backDelete, 58 | // delete 59 | 46: forwardDelete, 60 | // end 61 | 35: moveToEnd, 62 | // start 63 | 36: moveToStart, 64 | // return 65 | 13: commandTrigger, 66 | // tab 67 | 18: doNothing, 68 | // tab 69 | 9: doComplete 70 | }; 71 | var ctrlCodes = { 72 | // C-a 73 | 65: moveToStart, 74 | // C-e 75 | 69: moveToEnd, 76 | // C-d 77 | 68: forwardDelete, 78 | // C-n 79 | 78: nextHistory, 80 | // C-p 81 | 80: previousHistory, 82 | // C-b 83 | 66: moveBackward, 84 | // C-f 85 | 70: moveForward, 86 | // C-k 87 | 75: deleteUntilEnd 88 | }; 89 | if(config.ctrlCodes) { 90 | $.extend(ctrlCodes, config.ctrlCodes); 91 | } 92 | var altCodes = { 93 | // M-f 94 | 70: moveToNextWord, 95 | // M-b 96 | 66: moveToPreviousWord, 97 | // M-d 98 | 68: deleteNextWord 99 | }; 100 | var shiftCodes = { 101 | // return 102 | 13: newLine, 103 | }; 104 | var cursor = ' '; 105 | 106 | //////////////////////////////////////////////////////////////////////// 107 | // Globals 108 | var container = $(this); 109 | var inner = $(''); 110 | // erjiang: changed this from a text input to a textarea so we 111 | // can get pasted newlines 112 | var typer = $(''); 113 | // Prompt 114 | var promptBox; 115 | var prompt; 116 | var promptLabel = config && config.promptLabel? config.promptLabel : "> "; 117 | var continuedPromptLabel = config && config.continuedPromptLabel? 118 | config.continuedPromptLabel : "> "; 119 | var column = 0; 120 | var promptText = ''; 121 | var restoreText = ''; 122 | var continuedText = ''; 123 | var fadeOnReset = config.fadeOnReset !== undefined ? config.fadeOnReset : true; 124 | // Prompt history stack 125 | var history = []; 126 | var ringn = 0; 127 | // For reasons unknown to The Sword of Michael himself, Opera 128 | // triggers and sends a key character when you hit various 129 | // keys like PgUp, End, etc. So there is no way of knowing 130 | // when a user has typed '#' or End. My solution is in the 131 | // typer.keydown and typer.keypress functions; I use the 132 | // variable below to ignore the keypress event if the keydown 133 | // event succeeds. 134 | var cancelKeyPress = 0; 135 | // When this value is false, the prompt will not respond to input 136 | var acceptInput = true; 137 | // When this value is true, the command has been canceled 138 | var cancelCommand = false; 139 | 140 | // External exports object 141 | var extern = {}; 142 | 143 | //////////////////////////////////////////////////////////////////////// 144 | // Main entry point 145 | (function(){ 146 | container.append(inner); 147 | inner.append(typer); 148 | typer.css({position:'absolute',top:0,left:'-9999px'}); 149 | if (config.welcomeMessage) 150 | message(config.welcomeMessage,'jquery-console-welcome'); 151 | newPromptBox(); 152 | if (config.autofocus) { 153 | inner.addClass('jquery-console-focus'); 154 | typer.focus(); 155 | setTimeout(function(){ 156 | inner.addClass('jquery-console-focus'); 157 | typer.focus(); 158 | },100); 159 | } 160 | extern.inner = inner; 161 | extern.typer = typer; 162 | extern.scrollToBottom = scrollToBottom; 163 | })(); 164 | 165 | //////////////////////////////////////////////////////////////////////// 166 | // Reset terminal 167 | extern.reset = function(){ 168 | var welcome = (typeof config.welcomeMessage != 'undefined'); 169 | 170 | var removeElements = function() { 171 | inner.find('div').each(function(){ 172 | if (!welcome) { 173 | $(this).remove(); 174 | } else { 175 | welcome = false; 176 | } 177 | }); 178 | }; 179 | 180 | var focusConsole = function() { 181 | inner.addClass('jquery-console-focus'); 182 | typer.focus(); 183 | }; 184 | 185 | if (fadeOnReset) { 186 | inner.parent().fadeOut(function() { 187 | removeElements(); 188 | newPromptBox(); 189 | inner.parent().fadeIn(focusConsole); 190 | }); 191 | } 192 | else { 193 | removeElements(); 194 | newPromptBox(); 195 | focusConsole(); 196 | } 197 | }; 198 | 199 | //////////////////////////////////////////////////////////////////////// 200 | // Reset terminal 201 | extern.notice = function(msg,style){ 202 | var n = $('').append($('').text(msg)) 203 | .css({visibility:'hidden'}); 204 | container.append(n); 205 | var focused = true; 206 | if (style=='fadeout') 207 | setTimeout(function(){ 208 | n.fadeOut(function(){ 209 | n.remove(); 210 | }); 211 | },4000); 212 | else if (style=='prompt') { 213 | var a = $('=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, 80 | CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, 81 | g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, 82 | text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, 83 | setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= 84 | h[3];l=0;for(m=h.length;l =0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== 86 | "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, 87 | h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l ";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& 90 | q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; 91 | if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); 92 | (function(){var g=s.createElement("div");g.innerHTML="";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: 93 | function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q =0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f
0)for(var j=d;j 0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= 96 | {},i;if(f&&a.length){e=0;for(var o=a.length;e -1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== 97 | "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", 98 | d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? 99 | a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== 100 | 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"+d+">"},F={option:[1,""],legend:[1,""],thead:[1," ","
"],tr:[2,"","
"],td:[3,""],col:[2,"
"," "],area:[1,""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
"," ",""];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= 102 | c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, 103 | wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, 104 | prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, 105 | this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); 106 | return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, 107 | ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); 111 | return this}else{e=0;for(var j=d.length;e 0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", 112 | ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===" "&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= 113 | c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? 114 | c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= 115 | function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= 116 | Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, 117 | "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= 118 | a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= 119 | a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/