32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
1 |
<script> |
35
by Rob
REF/ENH: Changes for notebook loading |
2 |
|
32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
3 |
var bearcart_event = new CustomEvent( |
4 |
"bearcart_libs_loaded", |
|
5 |
{bubbles: true, cancelable: true} |
|
6 |
);
|
|
7 |
||
35
by Rob
REF/ENH: Changes for notebook loading |
8 |
var load_cart_charts = function(){ |
9 |
window.dispatchEvent(bearcart_event); |
|
10 |
};
|
|
11 |
||
12 |
function load_bearcart_libs(){ |
|
13 |
console.log('Loading all Bearcart libraries...') |
|
14 |
$.getScript('http://code.jquery.com/ui/1.10.4/jquery-ui.js', function(){ |
|
15 |
$.getScript('http://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js', load_cart_charts) |
|
32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
16 |
})
|
35
by Rob
REF/ENH: Changes for notebook loading |
17 |
};
|
32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
18 |
|
19 |
if(typeof define === "function" && define.amd){ |
|
20 |
if (window['d3'] === undefined){ |
|
21 |
require.config( |
|
22 |
{paths: {d3: 'http://d3js.org/d3.v3.min'} |
|
23 |
}
|
|
24 |
);
|
|
25 |
require(["d3"], function(d3){ |
|
26 |
console.log('Loading from require.js...') |
|
27 |
window.d3 = d3; |
|
35
by Rob
REF/ENH: Changes for notebook loading |
28 |
load_bearcart_libs(); |
32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
29 |
});
|
35
by Rob
REF/ENH: Changes for notebook loading |
30 |
} else { |
31 |
load_bearcart_libs(); |
|
32 |
}
|
|
32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
33 |
}else{ |
35
by Rob
REF/ENH: Changes for notebook loading |
34 |
console.log('Require.js not found!'); |
35 |
throw "Require.js not found!" |
|
32
by Rob
ENH/REF: Methods and templates for IPython Notebook rendering |
36 |
};
|
37 |
||
38 |
</script> |