Permalink
Browse files

Made examples clickable.

  • Loading branch information...
Raynes committed May 29, 2010
1 parent ce51c46 commit f5b5897ddb7bbd59cdf61ad94965675ce01d98f3
@@ -419,6 +419,17 @@
return true;
} else return false;
};
extern.promptText = function(text){
if (text) {
promptText = text;
if (column > promptText.length)
column = promptText.length;
updatePromptDisplay();
}
return promptText;
};
////////////////////////////////////////////////////////////////////////
// Update the prompt display
@@ -2,17 +2,19 @@ function setupLink(url) {
return function(e) { $("#changer").load(url, function(data) { $("#changer").html(data); }); }
}
function getStep(n) {
$("#tuttext").load("tutorial", { step: n });
function setupExamples(controller) {
$(".code").click(function(e) {
controller.promptText($(this).html().replace(/<\/?([^>]+)>/g, ""));
});
}
function setupExamples() {
$("span").click(function(e) { alert($("this").html()); });
function getStep(n, controller) {
$("#tuttext").load("tutorial", { step: n }, function() { setupExamples(controller); });
}
$(document).ready(
function() {
$("#console").console({
var controller = $("#console").console({
promptLabel: 'Clojure> ',
commandValidate:function(line){
if (line == "") return false;
@@ -41,13 +43,12 @@ $(document).ready(
var step = 1;
$("#continue").click(function(e) {
if(step < 6 ) { step += 1; }
getStep(step);
getStep(step, controller);
$("#tuttext").scrollTop(0);
//setupExamples();
});
$("#back").click(function(e) {
if(step > 1) { step -= 1; }
getStep(step);
getStep(step, controller);
$("#tuttext").scrollTop(0);
});
});
@@ -19,6 +19,13 @@
"Above, you have your REPL. Please try the examples as we go along, and by all means experiment"
" with concepts indpendently. Should you refuse, you will promptly be IP banned from this website, and a teddy "
"bear will eat your candies. ;-)"[:br] [:br] "Don't make teddy eat your candy."]
[:p.bottom
"All of the examples (pretty colored text) are clickable. If you click them, they will be copied"
" into the REPL prompt above. This is for convenience, so you don't have to type tedious things like a "
"backwards string (you'll see). Copy and pasting is not allowed in the REPL, because I and the creator of "
"JQuery-console, which powers the REPL above, believe that copying and pasting isn't so great for learning."
" While these examples are clickable, I urge you to type out the examples by hand. If you type them out, "
"they will sink in better. Enjoy the tutorial."]
[:p.bottom "Hit the pretty little 'Next' button to continue for the love of Pete!"]))
(def tutorial1-text

0 comments on commit f5b5897

Please sign in to comment.