Created
October 26, 2009 05:07
-
-
Save cowlby/218423 to your computer and use it in GitHub Desktop.
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
// Nano Loader | |
(function() { | |
nano = { | |
v: "1.0", | |
load: function(u, cb) { | |
var s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.src = u; | |
s.onload = cb; | |
s.onreadystatechange = function() { | |
if (this.readyState == 'complete' || this.readyState == 'loaded') { cb(); } | |
}; | |
document.getElementsByTagName('head')[0].appendChild(s); | |
}, | |
mt: function(cb) { | |
if (typeof(MooTools)=="undefined") {nano.load('http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js', cb);} | |
}, | |
jq: function(cb) { | |
if (typeof(jQuery)=="undefined") {nano.load('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', cb);} | |
} | |
}; | |
})(); | |
// Bookmarklet | |
javascript:(function(){nano={v:"1.0",load:function(u,cb){var s=document.createElement('script');s.type='text/javascript';s.src=u;s.onload=cb;s.onreadystatechange=function(){if(this.readyState=='complete'||this.readyState=='loaded'){cb();}};document.getElementsByTagName('head')[0].appendChild(s);},mt:function(cb){if(typeof(MooTools)=="undefined"){nano.load('http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js',cb);}},jq:function(cb){if(typeof(jQuery)=="undefined"){nano.load('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',cb);}}};})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment