Created
April 28, 2011 17:53
-
-
Save chrishamant/946868 to your computer and use it in GitHub Desktop.
comparison of generated coffeescript code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#analytics stuff | |
_gaq = [['_setAccount','UA-18606719-1'],['_trackPageview']] | |
d = window.document | |
l = d.location | |
scripts = [ | |
'google-analytics.com/ga.js', | |
'ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', | |
l.host + '/js/site.js' | |
] | |
getScript = (src)-> | |
s = d.createElement 'script' | |
s.async = true | |
s.src = if 'http:' == d.location.protocol then 'http://' + src else 'https://' + src | |
e = (d.getElementsByTagName('script')[0]) | |
e.parentNode.insertBefore(s,e) | |
getScript(script) for script in scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var d, getScript, l, script, scripts, _gaq, _i, _len; | |
_gaq = [['_setAccount', 'UA-18606719-1'], ['_trackPageview']]; | |
d = window.document; | |
l = d.location; | |
scripts = ['google-analytics.com/ga.js', 'ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', l.host + '/js/site.js']; | |
getScript = function(src) { | |
var e, s; | |
s = d.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = 'http:' === d.location.protocol ? 'http://' + src : 'https://' + src; | |
e = (d.getElementsByTagName('script')[0]); | |
return e.parentNode.insertBefore(s, e); | |
}; | |
for (_i = 0, _len = scripts.length; _i < _len; _i++) { | |
script = scripts[_i]; | |
getScript(script); | |
} | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment