JavaScript
// Wegner's jQuery Script => Check, load and execute
function waitOnjQuery(index = 0) {
if (checkjQueryReady()) {
MainScript();
} else {
if (index <= 1) {
insertjQuery();
}
setTimeout(function () {
waitOnjQuery(++index);
}, 200);
}
}
function checkjQueryReady() {
if (typeof jQuery == 'function') {
return true;
}
return false;
}
function insertjQuery(version = "1.7.1") {
var jQueryScript = document.createElement("script");
jQueryScript.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + version + "/jquery.min.js";
document.getElementsByTagName("head")[0].appendChild(jQueryScript);
}
function MainScript() {
// Paste your code here
}
waitOnjQuery();
Alles anzeigen
JavaScript: minimized
function waitOnjQuery(e=0){checkjQueryReady()?MainScript():(e<=1&&insertjQuery(),setTimeout(function(){waitOnjQuery(++e)},200))}function checkjQueryReady(){return"function"==typeof jQuery}function insertjQuery(e="1.7.1"){var n=document.createElement("script");n.src="https://ajax.googleapis.com/ajax/libs/jquery/"+e+"/jquery.min.js",document.getElementsByTagName("head")[0].appendChild(n)}function MainScript(/* Paste your code here */){}waitOnjQuery();