1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

removing CoffeeScript.activate() simply including the tag will do for text/coffeescript

This commit is contained in:
Jeremy Ashkenas 2010-02-24 23:57:39 -05:00
parent 23c5ebb00f
commit 22674bc536
6 changed files with 20 additions and 35 deletions

View file

@ -923,9 +923,6 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
</div> </div>
<script src="extras/coffee-script.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/coffeescript"> <script type="text/coffeescript">
window.repl_compile: -> window.repl_compile: ->
@ -959,9 +956,8 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
$(document.body).click -> close_menus() $(document.body).click -> close_menus()
</script> </script>
<script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
CoffeeScript.activate(); <script src="extras/coffee-script.js"></script>
</script>
</body> </body>
</html> </html>

View file

@ -1,10 +1,9 @@
EXTRAS:
"extras/coffee-script.js" is a concatenated and compressed version of the "extras/coffee-script.js" is a concatenated and compressed version of the
CoffeeScript compiler. To use it in the browser, include the script, and call: CoffeeScript compiler. To use it in the browser, include the script after any
inline script tags of type "text/coffeescript" on the page. It will compile
CoffeeScript.activate(); and evaluate all of the scripts in order.
After any inline script tags of type "text/coffeescript" on the page.
This folder also includes rough cuts of CoffeeScript syntax highlighters for This folder also includes rough cuts of CoffeeScript syntax highlighters for

File diff suppressed because one or more lines are too long

View file

@ -1803,9 +1803,6 @@ task(<span class="String"><span class="String">'</span>test<span class="String">
</div> </div>
<script src="extras/coffee-script.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/coffeescript"> <script type="text/coffeescript">
window.repl_compile: -> window.repl_compile: ->
@ -1839,9 +1836,8 @@ task(<span class="String"><span class="String">'</span>test<span class="String">
$(document.body).click -> close_menus() $(document.body).click -> close_menus()
</script> </script>
<script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
CoffeeScript.activate(); <script src="extras/coffee-script.js"></script>
</script>
</body> </body>
</html> </html>

View file

@ -1,5 +1,5 @@
(function(){ (function(){
var lexer, parser, path; var _a, _b, lexer, parser, path, tag;
// Set up for both the browser and the server. // Set up for both the browser and the server.
if ((typeof process !== "undefined" && process !== null)) { if ((typeof process !== "undefined" && process !== null)) {
process.mixin(require('nodes')); process.mixin(require('nodes'));
@ -47,16 +47,11 @@
}; };
// Activate CoffeeScript in the browser by having it compile and eval // Activate CoffeeScript in the browser by having it compile and eval
// all script tags with a content-type of text/coffeescript. // all script tags with a content-type of text/coffeescript.
exports.activate = function activate() { if ((typeof document !== "undefined" && document !== null) && document.getElementsByTagName) {
var _a, _b, _c, script, scripts; _a = document.getElementsByTagName('script');
scripts = document.getElementsByTagName('script'); for (_b = 0; _b < _a.length; _b++) {
_a = []; _b = scripts; tag = _a[_b];
for (_c = 0; _c < _b.length; _c++) { tag.type === 'text/coffeescript' ? eval(exports.compile(tag.innerHTML)) : null;
script = _b[_c];
if (script.type === 'text/coffeescript') {
_a.push(eval(exports.compile(script.innerHTML)));
}
} }
return _a; }
};
})(); })();

View file

@ -40,7 +40,6 @@ exports.tree: (code) ->
# Activate CoffeeScript in the browser by having it compile and eval # Activate CoffeeScript in the browser by having it compile and eval
# all script tags with a content-type of text/coffeescript. # all script tags with a content-type of text/coffeescript.
exports.activate: -> if document? and document.getElementsByTagName
scripts: document.getElementsByTagName 'script' for tag in document.getElementsByTagName('script') when tag.type is 'text/coffeescript'
for script in scripts when script.type is 'text/coffeescript' eval exports.compile tag.innerHTML
eval exports.compile script.innerHTML