1 // A dygraph "auto-loader".
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', ...)
7 var src
=document
.getElementsByTagName('script');
8 var script
= src
[src
.length
-1].getAttribute("src");
9 var m
= /^(.*)\/[^/]*\.js$/.exec(script
);
11 console
.error("Can't grok dygraph-dev.js path: " + script
);
13 var path
= m
[1]; // captured group, not the full match.
15 // This list needs to be kept in sync w/ the one
in generate
-combined
.sh
16 // and the one in jsTestDriver.conf.
18 "strftime/strftime-min.js",
19 "rgbcolor/rgbcolor.js",
25 "dygraph-interaction-model.js",
26 "dygraph-options-reference.js" // Shouldn't be included in generate-combined.sh
29 for (var i
= 0; i
< source_files
.length
; i
++) {
30 document
.write('<script type="text/javascript" src="' + path + '/' + source_files
[i
] + '"></script>\n');