Explorar o código

Handle 'text/smalltalk' scripts

Nicolas Petton %!s(int64=12) %!d(string=hai) anos
pai
achega
c3c98606f5
Modificáronse 1 ficheiros con 14 adicións e 2 borrados
  1. 14 2
      js/amber.js

+ 14 - 2
js/amber.js

@@ -177,8 +177,9 @@ amber = (function() {
 		window.smalltalkReady = function() {
 			if (spec.ready) {
 				spec.ready();
-			}
-		}
+			};
+            evaluateSmalltalkScripts();
+		};
 
 		loadAllJS(); 
 	};
@@ -224,6 +225,17 @@ amber = (function() {
 		document.write(scriptString);
 	};
 
+    function evaluateSmalltalkScripts() {
+        jQuery(document).ready(function() {
+            jQuery('script[type="text/smalltalk"]').each(function(i, elt) {
+                smalltalk.send(
+                    smalltalk.send(smalltalk.Compiler, '_new'),
+                    '_evaluateExpression_',
+                    [jQuery(elt).html()])
+            });
+        })
+    };
+
 	function populateLocalPackages(){
 		var localStorageRE = /^smalltalk\.packages\.(.*)$/;
 		localPackages = {};