-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunWithJQuerySupport.js
More file actions
31 lines (29 loc) · 1.35 KB
/
Copy pathRunWithJQuerySupport.js
File metadata and controls
31 lines (29 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function RunWithJQuerySupport(success) {
if (typeof jQuery == 'undefined') {
function getScript(success1) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = "_layouts/1033/JS/ITWorx.UTCNow/jquery-1.8.1.min.js";
done = false;
script.onload = script.onreadystatechange = function () {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done = true;
if (typeof (success1) != 'undefined' && success1 != null) { success1(); }
script.onload = script.onreadystatechange = null;
};
};
head.appendChild(script);
};
getScript(function () {
if (typeof jQuery == 'undefined') {
// Super failsafe - still somehow failed...
} else {
//jQuery.noConflict();
if (typeof (success) != 'undefined' && success != null) { success(); }
}
});
} else {
if (typeof (success) != 'undefined' && success != null) { success(); }
};
}
Read more: http://developmentsimplyput.blogspot.com/2012/12/how-make-sure-jquery-is-loaded-and-only.html#ixzz4tvNu99XH