Last active
September 4, 2015 13:28
-
-
Save avuori/d592ef0a6f83514fd29e 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
(function(jqueryUrl, callback) { | |
if (typeof jqueryUrl != 'string') { | |
jqueryUrl = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'; | |
} | |
if (typeof jQuery == 'undefined') { | |
var script = document.createElement('script'); | |
var head = document.getElementsByTagName('head')[0]; | |
var done = false; | |
script.onload = script.onreadystatechange = (function() { | |
if (!done && (!this.readyState || this.readyState == 'loaded' | |
|| this.readyState == 'complete')) { | |
done = true; | |
script.onload = script.onreadystatechange = null; | |
head.removeChild(script); | |
callback(); | |
} | |
}); | |
script.src = jqueryUrl; | |
head.appendChild(script); | |
} | |
else { | |
callback(); | |
} | |
})(false, callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment