-
Notifications
You must be signed in to change notification settings - Fork 181
/
selectorgadget_edge.js
48 lines (45 loc) · 1.57 KB
/
selectorgadget_edge.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function importJS(src, look_for, onload) {
var s = document.createElement('script');
s.setAttribute('type', 'text/javascript');
s.setAttribute('src', src);
if (onload) wait_for_script_load(look_for, onload);
var head = document.getElementsByTagName('head')[0];
if (head) {
head.appendChild(s);
} else {
document.body.appendChild(s);
}
}
function importCSS(href, look_for, onload) {
var s = document.createElement('link');
s.setAttribute('rel', 'stylesheet');
s.setAttribute('type', 'text/css');
s.setAttribute('media', 'screen');
s.setAttribute('href', href);
if (onload) wait_for_script_load(look_for, onload);
var head = document.getElementsByTagName('head')[0];
if (head) {
head.appendChild(s);
} else {
document.body.appendChild(s);
}
}
function wait_for_script_load(look_for, callback) {
var interval = setInterval(function() {
if (eval("typeof " + look_for) != 'undefined') {
clearInterval(interval);
callback();
}
}, 50);
}
(function(){
importCSS('http://www.selectorgadget.com/unstable/lib/selectorgadget.css.scss');
importJS('http://www.selectorgadget.com/unstable/vendor/jquery.js', 'jQuery', function() { // Load everything else when it is done.
window.jQuerySG = jQuery.noConflict(true);
importJS('http://www.selectorgadget.com/unstable/vendor/diff/diff_match_patch.js', 'diff_match_patch', function() {
importJS('http://www.selectorgadget.com/unstable/lib/dom.js', 'DomPredictionHelper', function() {
importJS('http://www.selectorgadget.com/unstable/lib/core.js');
});
});
});
})();