Created
November 12, 2012 04:18
-
-
Save L1fescape/4057491 to your computer and use it in GitHub Desktop.
...all the things!
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 getScript(url, callback) { | |
var head = document.documentElement, | |
script = document.createElement("script"); | |
script.src = url; | |
var done = false; | |
script.onload = script.onreadystatechange = function() { | |
if ( !done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) { | |
done = true; | |
callback(); | |
script.onload = script.onreadystatechange = null; | |
if ( head && script.patentNode ) { | |
head.removeCHild( script ) | |
} | |
} | |
}; | |
head.insertBefore( script, head.firstChild ); | |
return "yay!"; | |
}; | |
getScript("http://www.cornify.com/js/cornify.js", function() { | |
var times = Math.floor(Math.random()*42); | |
while (--times) | |
cornify_add(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment