Permalink
Browse files

Removed JSAN and Dojo module import options, since they aren't much u…

…sed and doesn't add anything much.
  • Loading branch information...
1 parent ebecbd7 commit f4782648ab98df241841a13cb43d621ff5a7ee15 @cederberg cederberg committed Apr 26, 2009
Showing with 56 additions and 102 deletions.
  1. +56 −102 PlotKit/PlotKit.js
View
@@ -38,113 +38,67 @@ PlotKit.PlotKit.SUBMODULES = [
"EasyPlot"
];
-if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
- if (typeof(dojo) != 'undefined') {
- dojo.provide('PlotKit.PlotKit');
- dojo.require("PlotKit.*");
- }
- if (typeof(JSAN) != 'undefined') {
- // hopefully this makes it easier for static analysis?
- JSAN.use("PlotKit.Base", []);
- JSAN.use("PlotKit.Layout", []);
- JSAN.use("PlotKit.Canvas", []);
- JSAN.use("PlotKit.SweetCanvas", []);
- JSAN.use("PlotKit.SVG", []);
- JSAN.use("PlotKit.SweetSVG", []);
+if (typeof(PlotKit.__compat__) == 'undefined') {
+ PlotKit.__compat__ = true;
+}
+(function () {
+ if (typeof(document) == "undefined") {
+ return;
}
- (function () {
- var extend = MochiKit.Base.extend;
- var self = PlotKit.PlotKit;
- var modules = self.SUBMODULES;
- var EXPORT = [];
- var EXPORT_OK = [];
- var EXPORT_TAGS = {};
- var i, k, m, all;
- for (i = 0; i < modules.length; i++) {
- m = PlotKit[modules[i]];
- extend(EXPORT, m.EXPORT);
- extend(EXPORT_OK, m.EXPORT_OK);
- for (k in m.EXPORT_TAGS) {
- EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]);
- }
- all = m.EXPORT_TAGS[":all"];
- if (!all) {
- all = extend(null, m.EXPORT, m.EXPORT_OK);
- }
- var j;
- for (j = 0; j < all.length; j++) {
- k = all[j];
- self[k] = m[k];
- }
+
+ var scripts = document.getElementsByTagName("script");
+ var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var base = null;
+ var baseElem = null;
+ var allScripts = {};
+ var i;
+ for (i = 0; i < scripts.length; i++) {
+ var src = scripts[i].getAttribute("src");
+ if (!src) {
+ continue;
}
- self.EXPORT = EXPORT;
- self.EXPORT_OK = EXPORT_OK;
- self.EXPORT_TAGS = EXPORT_TAGS;
- }());
-
-} else {
- if (typeof(PlotKit.__compat__) == 'undefined') {
- PlotKit.__compat__ = true;
- }
- (function () {
- if (typeof(document) == "undefined") {
- return;
+ allScripts[src] = true;
+ if (src.match(/PlotKit.js$/)) {
+ base = src.substring(0, src.lastIndexOf('PlotKit.js'));
+ baseElem = scripts[i];
}
+ }
- var scripts = document.getElementsByTagName("script");
- var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- var base = null;
- var baseElem = null;
- var allScripts = {};
- var i;
- for (i = 0; i < scripts.length; i++) {
- var src = scripts[i].getAttribute("src");
- if (!src) {
- continue;
- }
- allScripts[src] = true;
- if (src.match(/PlotKit.js$/)) {
- base = src.substring(0, src.lastIndexOf('PlotKit.js'));
- baseElem = scripts[i];
- }
+ if (base === null) {
+ return;
+ }
+ var modules = PlotKit.PlotKit.SUBMODULES;
+ for (var i = 0; i < modules.length; i++) {
+ if (PlotKit[modules[i]]) {
+ continue;
}
-
- if (base === null) {
- return;
+ var uri = base + modules[i] + '.js';
+ if (uri in allScripts) {
+ continue;
}
- var modules = PlotKit.PlotKit.SUBMODULES;
- for (var i = 0; i < modules.length; i++) {
- if (PlotKit[modules[i]]) {
- continue;
- }
- var uri = base + modules[i] + '.js';
- if (uri in allScripts) {
- continue;
- }
- if (document.documentElement &&
- document.documentElement.namespaceURI == kXULNSURI) {
- // XUL
- var s = document.createElementNS(kXULNSURI, 'script');
- s.setAttribute("id", "PlotKit_" + base + modules[i]);
- s.setAttribute("src", uri);
- s.setAttribute("type", "application/x-javascript");
- baseElem.parentNode.appendChild(s);
- } else {
- // HTML
- /*
- DOM can not be used here because Safari does
- deferred loading of scripts unless they are
- in the document or inserted with document.write
+ if (document.documentElement &&
+ document.documentElement.namespaceURI == kXULNSURI) {
+ // XUL
+ var s = document.createElementNS(kXULNSURI, 'script');
+ s.setAttribute("id", "PlotKit_" + base + modules[i]);
+ s.setAttribute("src", uri);
+ s.setAttribute("type", "application/x-javascript");
+ baseElem.parentNode.appendChild(s);
+ } else {
+ // HTML
+ /*
+ DOM can not be used here because Safari does
+ deferred loading of scripts unless they are
+ in the document or inserted with document.write
- This is not XHTML compliant. If you want XHTML
- compliance then you must use the packed version of PlotKit
- or include each script individually (basically unroll
- these document.write calls into your XHTML source)
+ This is not XHTML compliant. If you want XHTML
+ compliance then you must use the packed version of PlotKit
+ or include each script individually (basically unroll
+ these document.write calls into your XHTML source)
- */
- document.write('<script src="' + uri +
- '" type="text/javascript"></script>');
- }
- };
- })();
-}
+ */
+ document.write('<script src="' + uri +
+ '" type="text/javascript"></script>');
+ }
+ };
+})();

0 comments on commit f478264

Please sign in to comment.