mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
rebuilt the site with some IE fixes.
This commit is contained in:
parent
3c848736a7
commit
e3ec325619
7 changed files with 55 additions and 83 deletions
|
@ -4,9 +4,10 @@ body {
|
||||||
color: #191933;
|
color: #191933;
|
||||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif !important;
|
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif !important;
|
||||||
}
|
}
|
||||||
div.container {
|
.container {
|
||||||
width: 950px;
|
width: 950px;
|
||||||
margin: 100px 0 50px 50px;
|
margin: 0;
|
||||||
|
padding: 80px 0px 50px 50px;
|
||||||
}
|
}
|
||||||
p, li {
|
p, li {
|
||||||
width: 625px;
|
width: 625px;
|
||||||
|
@ -75,6 +76,7 @@ div.code {
|
||||||
padding: 7px 0 10px 0;
|
padding: 7px 0 10px 0;
|
||||||
-moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;
|
-moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;
|
||||||
-webkit-box-shadow: 0px 0px 7px #cacaca;
|
-webkit-box-shadow: 0px 0px 7px #cacaca;
|
||||||
|
zoom: 1;
|
||||||
}
|
}
|
||||||
div.code button {
|
div.code button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -107,11 +109,10 @@ div.code {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
min-width: 490px;
|
min-width: 490px;
|
||||||
left: 40px; right: 40px; top: 25px;
|
left: 40px; right: 40px; top: 25px;
|
||||||
background: #ddd;
|
|
||||||
padding-left: 235px;
|
padding-left: 235px;
|
||||||
|
background: #eee;
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#d0d0d0));
|
background: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#d0d0d0));
|
||||||
background: -moz-linear-gradient(top, #f5f5f5, #d0d0d0);
|
background: -moz-linear-gradient(top, #f5f5f5, #d0d0d0);
|
||||||
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#F5F5F5', EndColorStr='#D0D0D0');
|
|
||||||
border: 1px solid #aaa;
|
border: 1px solid #aaa;
|
||||||
-webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;
|
-webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;
|
||||||
-webkit-box-shadow: 0 0 7px #aaa; -moz-box-shadow: 0 0 7px #aaa;
|
-webkit-box-shadow: 0 0 7px #aaa; -moz-box-shadow: 0 0 7px #aaa;
|
||||||
|
@ -126,7 +127,7 @@ div.code {
|
||||||
#error {
|
#error {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;
|
-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;
|
||||||
right: 15px; top: 15px; left: 722px;
|
right: 15px; top: 15px; left: 730px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
background: #fdcdcc;
|
background: #fdcdcc;
|
||||||
|
@ -157,10 +158,9 @@ div.code {
|
||||||
}
|
}
|
||||||
.navigation:hover,
|
.navigation:hover,
|
||||||
.navigation.active {
|
.navigation.active {
|
||||||
background: #d0d0d0;
|
background: #eee;
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#f0f0f0), to(#c0c0c0));
|
background: -webkit-gradient(linear, left top, left bottom, from(#f0f0f0), to(#c0c0c0));
|
||||||
background: -moz-linear-gradient(top, #f0f0f0, #c0c0c0);
|
background: -moz-linear-gradient(top, #f0f0f0, #c0c0c0);
|
||||||
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#F0F0F0', EndColorStr='#C0C0C0');
|
|
||||||
}
|
}
|
||||||
.navigation .button {
|
.navigation .button {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -171,6 +171,8 @@ div.code {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
top: 51px; left: 0;
|
top: 51px; left: 0;
|
||||||
padding: 5px 0;
|
padding: 5px 0;
|
||||||
|
margin-left: -1px;
|
||||||
|
border: 1px solid #aaa; border-top: 0;
|
||||||
-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
|
-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
|
||||||
-webkit-border-top-left-radius: 0; -moz-border-radius-topleft: 0;
|
-webkit-border-top-left-radius: 0; -moz-border-radius-topleft: 0;
|
||||||
-webkit-border-top-right-radius: 0; -moz-border-radius-topright: 0;
|
-webkit-border-top-right-radius: 0; -moz-border-radius-topright: 0;
|
||||||
|
@ -187,7 +189,7 @@ div.code {
|
||||||
body.full_screen .navigation .contents.repl_wrapper {
|
body.full_screen .navigation .contents.repl_wrapper {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: auto; height: auto;
|
width: auto; height: auto;
|
||||||
left: 60px; top: 75px; right: 60px; bottom: 30px;
|
left: 60px; top: 77px; right: 60px; bottom: 30px;
|
||||||
}
|
}
|
||||||
.navigation .contents.repl_wrapper .code {
|
.navigation .contents.repl_wrapper .code {
|
||||||
-webkit-box-shadow: none; -moz-box-shadow: none;
|
-webkit-box-shadow: none; -moz-box-shadow: none;
|
||||||
|
@ -202,13 +204,19 @@ div.code {
|
||||||
.navigation .code button {
|
.navigation .code button {
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
|
line-height: 14px;
|
||||||
|
left: auto; right: auto;
|
||||||
}
|
}
|
||||||
.navigation .full_screen, .navigation .minimize {
|
.navigation .code .run {
|
||||||
right: auto;
|
width: 40px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
.navigation .code .full_screen, .navigation .code .minimize {
|
||||||
left: 10px;
|
left: 10px;
|
||||||
display: none;
|
display: none;
|
||||||
|
width: 90px;
|
||||||
}
|
}
|
||||||
body.minimized .full_screen, body.full_screen .minimize {
|
body.minimized .code .full_screen, body.full_screen .code .minimize {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
.navigation .contents a {
|
.navigation .contents a {
|
||||||
|
@ -246,7 +254,7 @@ div.code {
|
||||||
}
|
}
|
||||||
#repl_source {
|
#repl_source {
|
||||||
width: 96%;
|
width: 96%;
|
||||||
height: 100%;
|
height: 250px;
|
||||||
border: 0;
|
border: 0;
|
||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
|
@ -265,6 +273,9 @@ div.code {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
top: 10px; left: 10px; right: 10px; bottom: 40px;
|
top: 10px; left: 10px; right: 10px; bottom: 40px;
|
||||||
}
|
}
|
||||||
|
body.full_screen #repl_source {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
body.full_screen #repl_source_wrap {
|
body.full_screen #repl_source_wrap {
|
||||||
right: 50%;
|
right: 50%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="contents repl_wrapper">
|
<div class="contents repl_wrapper">
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<div id="repl_source_wrap"><textarea id="repl_source">alert "Hello CoffeeScript!"</textarea></div>
|
<div id="repl_source_wrap"><textarea id="repl_source" rows="100">alert "Hello CoffeeScript!"</textarea></div>
|
||||||
<pre id="repl_results"></pre>
|
<pre id="repl_results"></pre>
|
||||||
<button class="full_screen">go full screen</button>
|
<button class="full_screen">go full screen</button>
|
||||||
<button class="minimize">minimize</button>
|
<button class="minimize">minimize</button>
|
||||||
|
@ -713,9 +713,9 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
|
||||||
<p>
|
<p>
|
||||||
<span id="switch" class="bookmark"></span>
|
<span id="switch" class="bookmark"></span>
|
||||||
<b class="header">Switch/When/Else</b>
|
<b class="header">Switch/When/Else</b>
|
||||||
<b>Switch</b> statements in JavaScript are a bit awkward. You need to
|
<b>Switch</b> statements in JavaScript are a bit awkward. You need to
|
||||||
remember to <b>break</b> at the end of every <b>case</b> statement to
|
remember to <b>break</b> at the end of every <b>case</b> statement to
|
||||||
avoid accidentally falling through to the default case.
|
avoid accidentally falling through to the default case.
|
||||||
CoffeeScript prevents accidental fall-through, and can convert the <tt>switch</tt>
|
CoffeeScript prevents accidental fall-through, and can convert the <tt>switch</tt>
|
||||||
into a returnable, assignable expression. The format is: <tt>switch</tt> condition,
|
into a returnable, assignable expression. The format is: <tt>switch</tt> condition,
|
||||||
<tt>when</tt> clauses, <tt>else</tt> the default case.
|
<tt>when</tt> clauses, <tt>else</tt> the default case.
|
||||||
|
@ -808,7 +808,7 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
|
||||||
<%= code_for('cake_tasks') %>
|
<%= code_for('cake_tasks') %>
|
||||||
<p>
|
<p>
|
||||||
If you need to invoke one task before another — for example, running
|
If you need to invoke one task before another — for example, running
|
||||||
<tt>build</tt> before <tt>test</tt>, you can use the <tt>invoke</tt> function:
|
<tt>build</tt> before <tt>test</tt>, you can use the <tt>invoke</tt> function:
|
||||||
<tt>invoke 'build'</tt>
|
<tt>invoke 'build'</tt>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -922,12 +922,12 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>chrislloyd</b>'s <a href="http://github.com/chrislloyd/roast">Roast</a>
|
<b>chrislloyd</b>'s <a href="http://github.com/chrislloyd/roast">Roast</a>
|
||||||
— a CoffeeScript compiler plug-in that allows you to include external
|
— a CoffeeScript compiler plug-in that allows you to include external
|
||||||
source files.
|
source files.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>mauricemach</b>'s <a href="http://github.com/mauricemach/coffeekup">CoffeeKup</a>
|
<b>mauricemach</b>'s <a href="http://github.com/mauricemach/coffeekup">CoffeeKup</a>
|
||||||
— Markup as CoffeeScript. After _why's
|
— Markup as CoffeeScript. After _why's
|
||||||
<a href="http://markaby.github.com/">Markaby</a>.
|
<a href="http://markaby.github.com/">Markaby</a>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -956,7 +956,7 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
|
||||||
<span id="change_log" class="bookmark"></span>
|
<span id="change_log" class="bookmark"></span>
|
||||||
Change Log
|
Change Log
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b class="header" style="margin-top: 20px;">0.9.4</b>
|
<b class="header" style="margin-top: 20px;">0.9.4</b>
|
||||||
CoffeeScript now uses appropriately-named temporary variables, and recycles
|
CoffeeScript now uses appropriately-named temporary variables, and recycles
|
||||||
|
@ -965,11 +965,11 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
|
||||||
single <tt>CoffeeScript</tt> object to global scope.
|
single <tt>CoffeeScript</tt> object to global scope.
|
||||||
Fixes for implicit object and block comment edge cases.
|
Fixes for implicit object and block comment edge cases.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b class="header" style="margin-top: 20px;">0.9.3</b>
|
<b class="header" style="margin-top: 20px;">0.9.3</b>
|
||||||
CoffeeScript <tt>switch</tt> statements now compile into JS <tt>switch</tt>
|
CoffeeScript <tt>switch</tt> statements now compile into JS <tt>switch</tt>
|
||||||
statements — they previously compiled into <tt>if/else</tt> chains
|
statements — they previously compiled into <tt>if/else</tt> chains
|
||||||
for JavaScript 1.3 compatibility.
|
for JavaScript 1.3 compatibility.
|
||||||
Soaking a function invocation is now supported. Users of the RubyMine
|
Soaking a function invocation is now supported. Users of the RubyMine
|
||||||
editor should now be able to use <tt>--watch</tt> mode.
|
editor should now be able to use <tt>--watch</tt> mode.
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
var eldest, grade;
|
var eldest, grade;
|
||||||
grade = function(student) {
|
grade = function(student) {
|
||||||
if (student.excellentWork) {
|
return student.excellentWork ? "A+" : (student.okayStuff ? (student.triedHard ? "B" : "B-") : "C");
|
||||||
return "A+";
|
|
||||||
} else if (student.okayStuff) {
|
|
||||||
return student.triedHard ? "B" : "B-";
|
|
||||||
} else {
|
|
||||||
return "C";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
eldest = 24 > 21 ? "Liz" : "Ike";
|
eldest = 24 > 21 ? "Liz" : "Ike";
|
|
@ -1,10 +1,9 @@
|
||||||
var _i, _ref, _result, globals, name;
|
var _ref, _result, globals, name;
|
||||||
var __hasProp = Object.prototype.hasOwnProperty;
|
var __hasProp = Object.prototype.hasOwnProperty;
|
||||||
globals = (function() {
|
globals = (function() {
|
||||||
_result = []; _ref = window;
|
_result = []; _ref = window;
|
||||||
for (name in _ref) {
|
for (name in _ref) {
|
||||||
if (!__hasProp.call(_ref, name)) continue;
|
if (!__hasProp.call(_ref, name)) continue;
|
||||||
_i = _ref[name];
|
|
||||||
_result.push(name);
|
_result.push(name);
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
var mobyDick;
|
var mobyDick;
|
||||||
mobyDick = "Call me Ishmael. Some years ago --\
|
mobyDick = "Call me Ishmael. Some years ago -- never mind how long precisely -- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world...";
|
||||||
never mind how long precisely -- having little\
|
|
||||||
or no money in my purse, and nothing particular\
|
|
||||||
to interest me on shore, I thought I would sail\
|
|
||||||
about a little and see the watery part of the\
|
|
||||||
world...";
|
|
|
@ -11,8 +11,7 @@ num = 6;
|
||||||
lyrics = (function() {
|
lyrics = (function() {
|
||||||
_result = [];
|
_result = [];
|
||||||
while (num -= 1) {
|
while (num -= 1) {
|
||||||
_result.push(num + " little monkeys, jumping on the bed.\
|
_result.push(num + " little monkeys, jumping on the bed. One fell out and bumped his head.");
|
||||||
One fell out and bumped his head.");
|
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
})();
|
})();
|
62
index.html
62
index.html
|
@ -58,7 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="contents repl_wrapper">
|
<div class="contents repl_wrapper">
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<div id="repl_source_wrap"><textarea id="repl_source">alert "Hello CoffeeScript!"</textarea></div>
|
<div id="repl_source_wrap"><textarea id="repl_source" rows="100">alert "Hello CoffeeScript!"</textarea></div>
|
||||||
<pre id="repl_results"></pre>
|
<pre id="repl_results"></pre>
|
||||||
<button class="full_screen">go full screen</button>
|
<button class="full_screen">go full screen</button>
|
||||||
<button class="minimize">minimize</button>
|
<button class="minimize">minimize</button>
|
||||||
|
@ -785,8 +785,7 @@ num <span class="Keyword">=</span> <span class="Number">6</span>;
|
||||||
lyrics <span class="Keyword">=</span> (<span class="Storage">function</span>() {
|
lyrics <span class="Keyword">=</span> (<span class="Storage">function</span>() {
|
||||||
_result <span class="Keyword">=</span> [];
|
_result <span class="Keyword">=</span> [];
|
||||||
<span class="Keyword">while</span> (num <span class="Keyword">-</span><span class="Keyword">=</span> <span class="Number">1</span>) {
|
<span class="Keyword">while</span> (num <span class="Keyword">-</span><span class="Keyword">=</span> <span class="Number">1</span>) {
|
||||||
_result.<span class="LibraryFunction">push</span>(num <span class="Keyword">+</span> <span class="String"><span class="String">"</span> little monkeys, jumping on the bed.\</span>
|
_result.<span class="LibraryFunction">push</span>(num <span class="Keyword">+</span> <span class="String"><span class="String">"</span> little monkeys, jumping on the bed. One fell out and bumped his head.<span class="String">"</span></span>);
|
||||||
<span class="String"> One fell out and bumped his head.<span class="String">"</span></span>);
|
|
||||||
}
|
}
|
||||||
<span class="Keyword">return</span> _result;
|
<span class="Keyword">return</span> _result;
|
||||||
})();
|
})();
|
||||||
|
@ -803,8 +802,7 @@ num = 6;
|
||||||
lyrics = (function() {
|
lyrics = (function() {
|
||||||
_result = [];
|
_result = [];
|
||||||
while (num -= 1) {
|
while (num -= 1) {
|
||||||
_result.push(num + " little monkeys, jumping on the bed.\
|
_result.push(num + " little monkeys, jumping on the bed. One fell out and bumped his head.");
|
||||||
One fell out and bumped his head.");
|
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
})();;alert(lyrics.join("\n"));'>run: lyrics.join("\n")</button><br class='clear' /></div>
|
})();;alert(lyrics.join("\n"));'>run: lyrics.join("\n")</button><br class='clear' /></div>
|
||||||
|
@ -1016,24 +1014,12 @@ numbers.splice.apply(numbers, [3, 6 - 3 + 1].concat([-3, -4, -5, -6]));;alert(nu
|
||||||
eldest <span class="Keyword">=</span> <span class="Keyword">if</span> <span class="Number">24</span> <span class="Keyword">></span> <span class="Number">21</span> <span class="Keyword">then</span> <span class="String"><span class="String">"</span>Liz<span class="String">"</span></span> <span class="Keyword">else</span> <span class="String"><span class="String">"</span>Ike<span class="String">"</span></span>
|
eldest <span class="Keyword">=</span> <span class="Keyword">if</span> <span class="Number">24</span> <span class="Keyword">></span> <span class="Number">21</span> <span class="Keyword">then</span> <span class="String"><span class="String">"</span>Liz<span class="String">"</span></span> <span class="Keyword">else</span> <span class="String"><span class="String">"</span>Ike<span class="String">"</span></span>
|
||||||
</pre><pre class="idle"><span class="Storage">var</span> eldest, grade;
|
</pre><pre class="idle"><span class="Storage">var</span> eldest, grade;
|
||||||
<span class="FunctionName">grade</span> = <span class="Storage">function</span>(<span class="FunctionArgument">student</span>) {
|
<span class="FunctionName">grade</span> = <span class="Storage">function</span>(<span class="FunctionArgument">student</span>) {
|
||||||
<span class="Keyword">if</span> (student.excellentWork) {
|
<span class="Keyword">return</span> student.excellentWork ? <span class="String"><span class="String">"</span>A+<span class="String">"</span></span> : (student.okayStuff ? (student.triedHard ? <span class="String"><span class="String">"</span>B<span class="String">"</span></span> : <span class="String"><span class="String">"</span>B-<span class="String">"</span></span>) : <span class="String"><span class="String">"</span>C<span class="String">"</span></span>);
|
||||||
<span class="Keyword">return</span> <span class="String"><span class="String">"</span>A+<span class="String">"</span></span>;
|
|
||||||
} <span class="Keyword">else</span> <span class="Keyword">if</span> (student.okayStuff) {
|
|
||||||
<span class="Keyword">return</span> student.triedHard ? <span class="String"><span class="String">"</span>B<span class="String">"</span></span> : <span class="String"><span class="String">"</span>B-<span class="String">"</span></span>;
|
|
||||||
} <span class="Keyword">else</span> {
|
|
||||||
<span class="Keyword">return</span> <span class="String"><span class="String">"</span>C<span class="String">"</span></span>;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
eldest <span class="Keyword">=</span> <span class="Number">24</span> <span class="Keyword">></span> <span class="Number">21</span> ? <span class="String"><span class="String">"</span>Liz<span class="String">"</span></span> : <span class="String"><span class="String">"</span>Ike<span class="String">"</span></span>;
|
eldest <span class="Keyword">=</span> <span class="Number">24</span> <span class="Keyword">></span> <span class="Number">21</span> ? <span class="String"><span class="String">"</span>Liz<span class="String">"</span></span> : <span class="String"><span class="String">"</span>Ike<span class="String">"</span></span>;
|
||||||
</pre><button onclick='javascript: var eldest, grade;
|
</pre><button onclick='javascript: var eldest, grade;
|
||||||
grade = function(student) {
|
grade = function(student) {
|
||||||
if (student.excellentWork) {
|
return student.excellentWork ? "A+" : (student.okayStuff ? (student.triedHard ? "B" : "B-") : "C");
|
||||||
return "A+";
|
|
||||||
} else if (student.okayStuff) {
|
|
||||||
return student.triedHard ? "B" : "B-";
|
|
||||||
} else {
|
|
||||||
return "C";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
eldest = 24 > 21 ? "Liz" : "Ike";;alert(eldest);'>run: eldest</button><br class='clear' /></div>
|
eldest = 24 > 21 ? "Liz" : "Ike";;alert(eldest);'>run: eldest</button><br class='clear' /></div>
|
||||||
<p>
|
<p>
|
||||||
|
@ -1059,24 +1045,22 @@ six = (one = 1) + (two = 2) + (three = 3);;alert(six);'>run: six</button><br cla
|
||||||
<div class='code'><pre class="idle"><span class="Comment"><span class="Comment">#</span> The first ten global properties.</span>
|
<div class='code'><pre class="idle"><span class="Comment"><span class="Comment">#</span> The first ten global properties.</span>
|
||||||
|
|
||||||
globals <span class="Keyword">=</span> (name <span class="Keyword">for</span> name <span class="Keyword">of</span> window)[<span class="Number">0</span>...<span class="Number">10</span>]
|
globals <span class="Keyword">=</span> (name <span class="Keyword">for</span> name <span class="Keyword">of</span> window)[<span class="Number">0</span>...<span class="Number">10</span>]
|
||||||
</pre><pre class="idle"><span class="Storage">var</span> _i, _ref, _result, globals, name;
|
</pre><pre class="idle"><span class="Storage">var</span> _ref, _result, globals, name;
|
||||||
<span class="Storage">var</span> __hasProp <span class="Keyword">=</span> <span class="LibraryClassType">Object</span>.<span class="LibraryConstant">prototype</span>.hasOwnProperty;
|
<span class="Storage">var</span> __hasProp <span class="Keyword">=</span> <span class="LibraryClassType">Object</span>.<span class="LibraryConstant">prototype</span>.hasOwnProperty;
|
||||||
globals <span class="Keyword">=</span> (<span class="Storage">function</span>() {
|
globals <span class="Keyword">=</span> (<span class="Storage">function</span>() {
|
||||||
_result <span class="Keyword">=</span> []; _ref <span class="Keyword">=</span> <span class="LibraryClassType">window</span>;
|
_result <span class="Keyword">=</span> []; _ref <span class="Keyword">=</span> <span class="LibraryClassType">window</span>;
|
||||||
<span class="Keyword">for</span> (name <span class="Keyword">in</span> _ref) {
|
<span class="Keyword">for</span> (name <span class="Keyword">in</span> _ref) {
|
||||||
<span class="Keyword">if</span> (<span class="Keyword">!</span>__hasProp.<span class="LibraryFunction">call</span>(_ref, name)) <span class="Keyword">continue</span>;
|
<span class="Keyword">if</span> (<span class="Keyword">!</span>__hasProp.<span class="LibraryFunction">call</span>(_ref, name)) <span class="Keyword">continue</span>;
|
||||||
_i <span class="Keyword">=</span> _ref[name];
|
|
||||||
_result.<span class="LibraryFunction">push</span>(name);
|
_result.<span class="LibraryFunction">push</span>(name);
|
||||||
}
|
}
|
||||||
<span class="Keyword">return</span> _result;
|
<span class="Keyword">return</span> _result;
|
||||||
})().<span class="LibraryFunction">slice</span>(<span class="Number">0</span>, <span class="Number">10</span>);
|
})().<span class="LibraryFunction">slice</span>(<span class="Number">0</span>, <span class="Number">10</span>);
|
||||||
</pre><button onclick='javascript: var _i, _ref, _result, globals, name;
|
</pre><button onclick='javascript: var _ref, _result, globals, name;
|
||||||
var __hasProp = Object.prototype.hasOwnProperty;
|
var __hasProp = Object.prototype.hasOwnProperty;
|
||||||
globals = (function() {
|
globals = (function() {
|
||||||
_result = []; _ref = window;
|
_result = []; _ref = window;
|
||||||
for (name in _ref) {
|
for (name in _ref) {
|
||||||
if (!__hasProp.call(_ref, name)) continue;
|
if (!__hasProp.call(_ref, name)) continue;
|
||||||
_i = _ref[name];
|
|
||||||
_result.push(name);
|
_result.push(name);
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
|
@ -1488,9 +1472,9 @@ hi = function() {
|
||||||
<p>
|
<p>
|
||||||
<span id="switch" class="bookmark"></span>
|
<span id="switch" class="bookmark"></span>
|
||||||
<b class="header">Switch/When/Else</b>
|
<b class="header">Switch/When/Else</b>
|
||||||
<b>Switch</b> statements in JavaScript are a bit awkward. You need to
|
<b>Switch</b> statements in JavaScript are a bit awkward. You need to
|
||||||
remember to <b>break</b> at the end of every <b>case</b> statement to
|
remember to <b>break</b> at the end of every <b>case</b> statement to
|
||||||
avoid accidentally falling through to the default case.
|
avoid accidentally falling through to the default case.
|
||||||
CoffeeScript prevents accidental fall-through, and can convert the <tt>switch</tt>
|
CoffeeScript prevents accidental fall-through, and can convert the <tt>switch</tt>
|
||||||
into a returnable, assignable expression. The format is: <tt>switch</tt> condition,
|
into a returnable, assignable expression. The format is: <tt>switch</tt> condition,
|
||||||
<tt>when</tt> clauses, <tt>else</tt> the default case.
|
<tt>when</tt> clauses, <tt>else</tt> the default case.
|
||||||
|
@ -1625,19 +1609,9 @@ dates = (new RegExp("\\d+" + (sep) + "\\d+" + (sep) + "\\d+", "g"));;alert(sente
|
||||||
|
|
||||||
|
|
||||||
</pre><pre class="idle"><span class="Storage">var</span> mobyDick;
|
</pre><pre class="idle"><span class="Storage">var</span> mobyDick;
|
||||||
mobyDick <span class="Keyword">=</span> <span class="String"><span class="String">"</span>Call me Ishmael. Some years ago --\</span>
|
mobyDick <span class="Keyword">=</span> <span class="String"><span class="String">"</span>Call me Ishmael. Some years ago -- never mind how long precisely -- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world...<span class="String">"</span></span>;
|
||||||
<span class="String"> never mind how long precisely -- having little\</span>
|
|
||||||
<span class="String"> or no money in my purse, and nothing particular\</span>
|
|
||||||
<span class="String"> to interest me on shore, I thought I would sail\</span>
|
|
||||||
<span class="String"> about a little and see the watery part of the\</span>
|
|
||||||
<span class="String"> world...<span class="String">"</span></span>;
|
|
||||||
</pre><button onclick='javascript: var mobyDick;
|
</pre><button onclick='javascript: var mobyDick;
|
||||||
mobyDick = "Call me Ishmael. Some years ago --\
|
mobyDick = "Call me Ishmael. Some years ago -- never mind how long precisely -- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world...";;alert(mobyDick);'>run: mobyDick</button><br class='clear' /></div>
|
||||||
never mind how long precisely -- having little\
|
|
||||||
or no money in my purse, and nothing particular\
|
|
||||||
to interest me on shore, I thought I would sail\
|
|
||||||
about a little and see the watery part of the\
|
|
||||||
world...";;alert(mobyDick);'>run: mobyDick</button><br class='clear' /></div>
|
|
||||||
<p>
|
<p>
|
||||||
Heredocs can be used to hold formatted or indentation-sensitive text
|
Heredocs can be used to hold formatted or indentation-sensitive text
|
||||||
(or, if you just don't feel like escaping quotes and apostrophes). The
|
(or, if you just don't feel like escaping quotes and apostrophes). The
|
||||||
|
@ -1716,7 +1690,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
||||||
</pre><br class='clear' /></div>
|
</pre><br class='clear' /></div>
|
||||||
<p>
|
<p>
|
||||||
If you need to invoke one task before another — for example, running
|
If you need to invoke one task before another — for example, running
|
||||||
<tt>build</tt> before <tt>test</tt>, you can use the <tt>invoke</tt> function:
|
<tt>build</tt> before <tt>test</tt>, you can use the <tt>invoke</tt> function:
|
||||||
<tt>invoke 'build'</tt>
|
<tt>invoke 'build'</tt>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -1830,12 +1804,12 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>chrislloyd</b>'s <a href="http://github.com/chrislloyd/roast">Roast</a>
|
<b>chrislloyd</b>'s <a href="http://github.com/chrislloyd/roast">Roast</a>
|
||||||
— a CoffeeScript compiler plug-in that allows you to include external
|
— a CoffeeScript compiler plug-in that allows you to include external
|
||||||
source files.
|
source files.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>mauricemach</b>'s <a href="http://github.com/mauricemach/coffeekup">CoffeeKup</a>
|
<b>mauricemach</b>'s <a href="http://github.com/mauricemach/coffeekup">CoffeeKup</a>
|
||||||
— Markup as CoffeeScript. After _why's
|
— Markup as CoffeeScript. After _why's
|
||||||
<a href="http://markaby.github.com/">Markaby</a>.
|
<a href="http://markaby.github.com/">Markaby</a>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -1864,7 +1838,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
||||||
<span id="change_log" class="bookmark"></span>
|
<span id="change_log" class="bookmark"></span>
|
||||||
Change Log
|
Change Log
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b class="header" style="margin-top: 20px;">0.9.4</b>
|
<b class="header" style="margin-top: 20px;">0.9.4</b>
|
||||||
CoffeeScript now uses appropriately-named temporary variables, and recycles
|
CoffeeScript now uses appropriately-named temporary variables, and recycles
|
||||||
|
@ -1873,11 +1847,11 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
||||||
single <tt>CoffeeScript</tt> object to global scope.
|
single <tt>CoffeeScript</tt> object to global scope.
|
||||||
Fixes for implicit object and block comment edge cases.
|
Fixes for implicit object and block comment edge cases.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b class="header" style="margin-top: 20px;">0.9.3</b>
|
<b class="header" style="margin-top: 20px;">0.9.3</b>
|
||||||
CoffeeScript <tt>switch</tt> statements now compile into JS <tt>switch</tt>
|
CoffeeScript <tt>switch</tt> statements now compile into JS <tt>switch</tt>
|
||||||
statements — they previously compiled into <tt>if/else</tt> chains
|
statements — they previously compiled into <tt>if/else</tt> chains
|
||||||
for JavaScript 1.3 compatibility.
|
for JavaScript 1.3 compatibility.
|
||||||
Soaking a function invocation is now supported. Users of the RubyMine
|
Soaking a function invocation is now supported. Users of the RubyMine
|
||||||
editor should now be able to use <tt>--watch</tt> mode.
|
editor should now be able to use <tt>--watch</tt> mode.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue