orbit-theme-sdk/app/assets/javascripts/loadjquery.js

28 lines
921 B
JavaScript

if (typeof jQuery === "undefined") {
loadjQuery("//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js", verifyJQueryCdnLoaded);
} else
main();
var verifyJQueryCdnLoaded = function() {
if (typeof jQuery === "undefined")
loadjQuery("//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js", main);
else
main();
}
var loadjQuery = function(url, callback) {
var script_tag = document.createElement('script');
script_tag.setAttribute("src", url)
script_tag.onload = callback; // Run callback once jQuery has loaded
script_tag.onreadystatechange = function () { // Same thing but for IE
if (this.readyState == 'complete' || this.readyState == 'loaded') callback();
}
script_tag.onerror = function() {
loadjQuery("//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js", main);
}
document.getElementsByTagName("head")[0].appendChild(script_tag);
}
function main() {
}