Преглед изворни кода

make it possible for the amber.js script to be located in alternate locations relative to the directory that the server is launched from

Dale Henrichs пре 13 година
родитељ
комит
9f6f9217fd
1 измењених фајлова са 16 додато и 13 уклоњено
  1. 16 13
      js/amber.js

+ 16 - 13
js/amber.js

@@ -12,6 +12,9 @@ amber = (function() {
 	var scripts = document.getElementsByTagName("script");
 	var scripts = document.getElementsByTagName("script");
 	var src     = scripts[ scripts.length - 1 ].src;
 	var src     = scripts[ scripts.length - 1 ].src;
 	var home    = src.split("/").slice(0, -2).join("/") + "/";
 	var home    = src.split("/").slice(0, -2).join("/") + "/";
+        var amberPrefix = "amber/";
+        var amberCssPrefix = "amber/css"; 
+        var amberJsPrefix = "amber/js"; 
 
 
 	var debug;
 	var debug;
 	var deploy;
 	var deploy;
@@ -56,8 +59,8 @@ amber = (function() {
 		}
 		}
 
 
 		loadDependencies();
 		loadDependencies();
-		addJSToLoad('compat.js');
-		addJSToLoad('boot.js');
+		addJSToLoad('compat.js', amberJsPrefix);
+		addJSToLoad('boot.js', amberJsPrefix);
 
 
 		if (deploy) {
 		if (deploy) {
 			loadPackages([
 			loadPackages([
@@ -69,10 +72,10 @@ amber = (function() {
 				'Kernel-Transcript.deploy',
 				'Kernel-Transcript.deploy',
 				'Kernel-Announcements.deploy',
 				'Kernel-Announcements.deploy',
 				'Canvas.deploy'
 				'Canvas.deploy'
-			]);
+			], amberJsPrefix);
 		} else {
 		} else {
 			loadIDEDependencies();
 			loadIDEDependencies();
-			loadCSS('amber.css');
+			loadCSS('amber.css', amberCssPrefix);
 
 
 			loadPackages([
 			loadPackages([
 				'Kernel-Objects',
 				'Kernel-Objects',
@@ -90,7 +93,7 @@ amber = (function() {
 				'Examples',
 				'Examples',
 				'Benchfib',
 				'Benchfib',
 				'Kernel-Tests'
 				'Kernel-Tests'
-			]);
+			], amberJsPrefix);
 		}
 		}
 
 
 		var additionalFiles = spec.packages || spec.files;
 		var additionalFiles = spec.packages || spec.files;
@@ -99,7 +102,7 @@ amber = (function() {
 		}
 		}
 
 
 		// Be sure to setup & initialize smalltalk classes
 		// Be sure to setup & initialize smalltalk classes
-		addJSToLoad('init.js');
+		addJSToLoad('init.js', amberJsPrefix);
 		initializeSmalltalk();
 		initializeSmalltalk();
 	};
 	};
 
 
@@ -146,20 +149,20 @@ amber = (function() {
 
 
 	function loadDependencies() {
 	function loadDependencies() {
 		if (typeof jQuery == 'undefined') {
 		if (typeof jQuery == 'undefined') {
-			writeScriptTag(buildJSURL('lib/jQuery/jquery-1.6.4.min.js'));
+			writeScriptTag(buildJSURL('lib/jQuery/jquery-1.6.4.min.js', amberJsPrefix));
 		}
 		}
 
 
 		if ((typeof jQuery == 'undefined') || (typeof jQuery.ui == 'undefined')) {      
 		if ((typeof jQuery == 'undefined') || (typeof jQuery.ui == 'undefined')) {      
-			writeScriptTag(buildJSURL('lib/jQuery/jquery-ui-1.8.16.custom.min.js'));
+			writeScriptTag(buildJSURL('lib/jQuery/jquery-ui-1.8.16.custom.min.js', amberJsPrefix));
 		}
 		}
 	};
 	};
 
 
 	function loadIDEDependencies() {
 	function loadIDEDependencies() {
-		addJSToLoad('lib/jQuery/jquery.textarea.js');
-		addJSToLoad('lib/CodeMirror/codemirror.js');
-		addJSToLoad('lib/CodeMirror/smalltalk.js');
-		loadCSS('lib/CodeMirror/codemirror.css', 'js');
-		loadCSS('lib/CodeMirror/amber.css', 'js');
+		addJSToLoad('lib/jQuery/jquery.textarea.js', amberJsPrefix);
+		addJSToLoad('lib/CodeMirror/codemirror.js', amberJsPrefix);
+		addJSToLoad('lib/CodeMirror/smalltalk.js', amberJsPrefix);
+		loadCSS('lib/CodeMirror/codemirror.css', amberJsPrefix);
+		loadCSS('lib/CodeMirror/amber.css', amberJsPrefix);
 	};
 	};
 
 
 	// This will be called after JS files have been loaded
 	// This will be called after JS files have been loaded