HTML
<script >
/**
* CoffeeScript Compiler v1.6.3
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
!function(root){var CoffeeScript=function(){function require(e){return require[e]}return require["./helpers"]=function(){var e={},t={exports:e};return function(){var t,n,i,s,r,o;e.starts=function(e,t,n){return t===e.substr(n,t.length)},e.ends=function(e,t,n){var i;return i=t.length,t===e.substr(e.length-i-(n||0),i)},e.repeat=r=function(e,t){var n;for(n="";t>0;)1&t&&(n+=e),t>>>=1,e+=e;return n},e.compact=function(e){var t,n,i,s;for(s=[],n=0,i=e.length;i>n;n++)t=e[n],t&&s.push(t);return s},e.count=function(e,t){var n,i;if(n=i=0,!t.length)return 1/0;for(;i=1+e.indexOf(t,i);)n++;return n},e.merge=function(e,t){return n(n({},e),t)},n=e.extend=function(e,t){var n,i;for(n in t)i=t[n],e[n]=i;return e},e.flatten=i=function(e){var t,n,s,r;for(n=[],s=0,r=e.length;r>s;s++)t=e[s],t instanceof Array?n=n.concat(i(t)):n.push(t);return n},e.del=function(e,t){var n;return n=e[t],delete e[t],n},e.last=s=function(e,t){return e[e.length-(t||0)-1]},e.some=null!=(o=Array.prototype.some)?o:function(e){var t,n,i;for(n=0,i=this.length;i>n;n++)if(t=this[n],e(t))return!0;return!1},e.invertLiterate=function(e){var t,n,i;return i=!0,n=function(){var n,s,r,o;for(r=e.split("\n"),o=[],n=0,s=r.length;s>n;n++)t=r[n],i&&/^([ ]{4}|[ ]{0,3}\t)/.test(t)?o.push(t):(i=/^\s*$/.test(t))?o.push(t):o.push("# "+t);return o}(),n.join("\n")},t=function(e,t){return t?{first_line:e.first_line,first_column:e.first_column,last_line:t.last_line,last_column:t.last_column}:e},e.addLocationDataFn=function(e,n){return function(i){return"object"==typeof i&&i.updateLocationDataIfMissing&&i.updateLocationDataIfMissing(t(e,n)),i}},e.locationDataToString=function(e){var t;return"2"in e&&"first_line"in e[2]?t=e[2]:"first_line"in e&&(t=e),t?""+(t.first_line+1)+":"+(t.first_column+1)+"-"+(""+(t.last_line+1)+":"+(t.last_column+1)):"No location...
JavaScript
if (window.URL) {
var ish, _eval,
_call = Function.prototype.call,
coffeeEx = 'kids =\n brother:\n name: "Max"\n age: 11\n sister:\n name: "Ida"\n age: 9'
console.log ("Initializing, press a key (we need to catch InjectedScriptHost)");
Function.prototype.call = function asd() {
if (arguments.length > 0 && this.name === "evaluate") {
ish = arguments[0];
_eval = ish.evaluate;
Function.prototype.call = _call;
console.log ("Found a reference to " + ish + ", hooking " + ish.evaluate);
ish.evaluate = function (expr) {
var rawExpr;
expr = expr || "";
expr = expr.split("\n")
if ("with (__commandLineAPI" === expr [0].slice (0,22)) {
rawExpr = expr.slice (1,-1)
if (rawExpr !== 'this') {
rawExpr = CoffeeScript.compile (rawExpr.join ("\n")).slice (13,-15);
}
expr.splice (1, expr.length - 2,rawExpr);
}
expr = expr.join ("\n");
return _eval.apply(this, arguments);
};
console.log ("Finished. forwarding every expression entered in the console to CoffeeScript.compile");
console.log("Try some CoffeeScript, e.g.");
console.log (coffeeEx)
console.log (ish.evaluate (coffeeEx));
return _call.apply(this, arguments);
}
};
} else {
console.log ("Fortunately this works only with Webkit");
document.getElementsByTagName ("h1") [0].appendChild (
document.createTextNode (", which yours, isn't")
);
}