3
PlotKit Autoload Javascript Module.
5
This file was adapted from MochiKit.
6
See <http://mochikit.com/> for documentation, downloads, license, etc.
7
(c) 2005 Bob Ippolito. All rights Reserved.
9
Modified by Alastair Tse, 2006, for PlotKit.
13
if (typeof(PlotKit) == 'undefined') {
17
if (typeof(PlotKit.PlotKit) == 'undefined') {
21
PlotKit.PlotKit.NAME = "PlotKit.PlotKit";
22
PlotKit.PlotKit.VERSION = "0.9.1";
23
PlotKit.PlotKit.__repr__ = function () {
24
return "[" + this.NAME + " " + this.VERSION + "]";
27
PlotKit.PlotKit.toString = function () {
28
return this.__repr__();
31
PlotKit.PlotKit.SUBMODULES = [
41
if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
42
if (typeof(dojo) != 'undefined') {
43
dojo.provide('PlotKit.PlotKit');
44
dojo.require("PlotKit.*");
46
if (typeof(JSAN) != 'undefined') {
47
// hopefully this makes it easier for static analysis?
48
JSAN.use("PlotKit.Base", []);
49
JSAN.use("PlotKit.Layout", []);
50
JSAN.use("PlotKit.Canvas", []);
51
JSAN.use("PlotKit.SweetCanvas", []);
52
JSAN.use("PlotKit.SVG", []);
53
JSAN.use("PlotKit.SweetSVG", []);
56
var extend = MochiKit.Base.extend;
57
var self = PlotKit.PlotKit;
58
var modules = self.SUBMODULES;
63
for (i = 0; i < modules.length; i++) {
64
m = PlotKit[modules[i]];
65
extend(EXPORT, m.EXPORT);
66
extend(EXPORT_OK, m.EXPORT_OK);
67
for (k in m.EXPORT_TAGS) {
68
EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]);
70
all = m.EXPORT_TAGS[":all"];
72
all = extend(null, m.EXPORT, m.EXPORT_OK);
75
for (j = 0; j < all.length; j++) {
81
self.EXPORT_OK = EXPORT_OK;
82
self.EXPORT_TAGS = EXPORT_TAGS;
86
if (typeof(PlotKit.__compat__) == 'undefined') {
87
PlotKit.__compat__ = true;
90
if (typeof(document) == "undefined") {
94
var scripts = document.getElementsByTagName("script");
95
var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
100
for (i = 0; i < scripts.length; i++) {
101
var src = scripts[i].getAttribute("src");
105
allScripts[src] = true;
106
if (src.match(/PlotKit.js$/)) {
107
base = src.substring(0, src.lastIndexOf('PlotKit.js'));
108
baseElem = scripts[i];
116
var modules = PlotKit.PlotKit.SUBMODULES;
117
for (var i = 0; i < modules.length; i++) {
118
if (PlotKit[modules[i]]) {
121
var uri = base + modules[i] + '.js';
122
if (uri in allScripts) {
125
if (document.documentElement &&
126
document.documentElement.namespaceURI == kXULNSURI) {
128
var s = document.createElementNS(kXULNSURI, 'script');
129
s.setAttribute("id", "PlotKit_" + base + modules[i]);
130
s.setAttribute("src", uri);
131
s.setAttribute("type", "application/x-javascript");
132
baseElem.parentNode.appendChild(s);
136
DOM can not be used here because Safari does
137
deferred loading of scripts unless they are
138
in the document or inserted with document.write
140
This is not XHTML compliant. If you want XHTML
141
compliance then you must use the packed version of MochiKit
142
or include each script individually (basically unroll
143
these document.write calls into your XHTML source)
146
document.write('<script src="' + uri +
147
'" type="text/javascript"></script>');