Commit | Line | Data |
---|---|---|
74a5af31 DV |
1 | // A dygraph "auto-loader". |
2 | ||
3 | // Check where this script was sourced from. If it was sourced from | |
4 | // '../dygraph-dev.js', then we should source all the other scripts with the | |
5 | // same relative path ('../dygraph.js', '../dygraph-canvas.js', ...) | |
6 | (function() { | |
7 | var src=document.getElementsByTagName('script'); | |
8 | var script = src[src.length-1].getAttribute("src"); | |
9 | var m = /^(.*)\/[^/]*\.js$/.exec(script); | |
10 | if (!m) { | |
11 | console.error("Can't grok dygraph-dev.js path: " + script); | |
12 | } else { | |
13 | var path = m[1]; // captured group, not the full match. | |
14 | ||
15 | // This list needs to be kept in sync w/ the one in generate-combined.sh | |
8d3d15af | 16 | // and the one in jsTestDriver.conf. |
74a5af31 DV |
17 | var source_files = [ |
18 | "strftime/strftime-min.js", | |
19 | "rgbcolor/rgbcolor.js", | |
20 | "dygraph-layout.js", | |
21 | "dygraph-canvas.js", | |
22 | "dygraph.js", | |
dedb4f5f | 23 | "dygraph-utils.js", |
74a5af31 | 24 | "dygraph-gviz.js", |
846f3d2d | 25 | "dygraph-interaction-model.js", |
730852d8 | 26 | "dygraph-options-reference.js" // Shouldn't be included in generate-combined.sh |
74a5af31 DV |
27 | ]; |
28 | ||
29 | for (var i = 0; i < source_files.length; i++) { | |
30 | document.write('<script type="text/javascript" src="' + path + '/' + source_files[i] + '"></script>\n'); | |
31 | } | |
32 | } | |
33 | })(); |