Browse Source

Comment out googlecharts example on index.html; Add require system to load amber for processing, presentation and trysmalltalk (Prof Stef) examples.

Thomas Rake 10 years ago
parent
commit
56db0048e3

+ 2 - 0
index.html

@@ -4,7 +4,9 @@
 </head>
 </head>
 <body>
 <body>
 	<ul>
 	<ul>
+        <!--
 		<li><a href="./googlecharts/index.html">Google Charts Example</a></li>
 		<li><a href="./googlecharts/index.html">Google Charts Example</a></li>
+        -->
 		<li><a href="./presentation/index.html">Amber Presentations</a></li>
 		<li><a href="./presentation/index.html">Amber Presentations</a></li>
 		<li><a href="./processing/index.html">Amber Example using Processing.js</a></li>
 		<li><a href="./processing/index.html">Amber Example using Processing.js</a></li>
 		<li><a href="./trysmalltalk/index.html">Prof Stef Tutorial</a></li>
 		<li><a href="./trysmalltalk/index.html">Prof Stef Tutorial</a></li>

+ 2 - 1
presentation/Gruntfile.js

@@ -15,7 +15,8 @@ module.exports = function(grunt) {
         src: ['st/Presentation.st'],
         src: ['st/Presentation.st'],
         libraries: ['Canvas'],
         libraries: ['Canvas'],
         output_dir: 'js',
         output_dir: 'js',
-        deploy: true
+        deploy: true,
+        amd_namespace: 'amber_examples_presentation'
       }
       }
     }
     }
   });
   });

+ 12 - 5
presentation/index.html

@@ -1,16 +1,23 @@
 <html>
 <html>
 <head>
 <head>
 <title>JTalk - Presentation</title>
 <title>JTalk - Presentation</title>
+<script src="../vendor/amber/support/requirejs/require.min.js" type="text/javascript"></script>
 <script src="../vendor/amber/support/amber.js" type="text/javascript"></script>
 <script src="../vendor/amber/support/amber.js" type="text/javascript"></script>
 </head>
 </head>
 <body>
 <body>
 
 
 <script type="text/javascript"> 
 <script type="text/javascript"> 
-	loadAmber({
-		files: ['Presentation'],
-		packageHome: './'
-		//ready: function() {smalltalk.Browser._openOn_(smalltalk.FOSDEM2012Presentation)}
-	}); 
+	require.config({
+		paths: {
+			'amber_examples_presentation': 'js',
+			'amber_examples_presentation\_source': 'st'
+		}
+	});
+	require(['amber/devel','amber_examples_presentation/Presentation'],function(smalltalk) {
+		smalltalk.defaultAMDNamespace = 'amber_examples_presentation';
+		smalltalk.initialize();
+		smalltalk.Browser._openOn_(smalltalk.FOSDEM2012Presentation);
+	});
 </script>
 </script>
 
 
 </body>
 </body>

+ 4 - 3
presentation/js/Presentation.js

@@ -1,5 +1,7 @@
-(function(smalltalk,nil,_st){
+define("amber_examples_presentation/Presentation", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Canvas"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Presentation');
 smalltalk.addPackage('Presentation');
+smalltalk.packages["Presentation"].transport = {"type":"amd","amdNamespace":"amber_examples_presentation"};
+
 smalltalk.addClass('Presentation', smalltalk.Widget, ['currentSlide', 'slides'], 'Presentation');
 smalltalk.addClass('Presentation', smalltalk.Widget, ['currentSlide', 'slides'], 'Presentation');
 smalltalk.addMethod(
 smalltalk.addMethod(
 smalltalk.method({
 smalltalk.method({
@@ -4205,5 +4207,4 @@ referencedClasses: ["SourceArea"]
 smalltalk.WorkspaceSlide);
 smalltalk.WorkspaceSlide);
 
 
 
 
-
-})(global_smalltalk,global_nil,global__st);
+});

+ 2 - 1
processing/Gruntfile.js

@@ -14,7 +14,8 @@ module.exports = function(grunt) {
       processing: {
       processing: {
         src: ['st/Processing-Examples.st'],
         src: ['st/Processing-Examples.st'],
         output_dir: 'js',
         output_dir: 'js',
-        deploy: true
+        deploy: true,
+        amd_namespace: 'amber_examples_processing'
       }
       }
     }
     }
   });
   });

+ 20 - 13
processing/index.html

@@ -7,15 +7,17 @@
     <link rel="stylesheet" type="text/css" href='css/style.css' /> 
     <link rel="stylesheet" type="text/css" href='css/style.css' /> 
     <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/> 
     <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/> 
     <link href='http://fonts.googleapis.com/css?family=Istok+Web' rel='stylesheet' type='text/css'> 
     <link href='http://fonts.googleapis.com/css?family=Istok+Web' rel='stylesheet' type='text/css'> 
+	<script type="text/javascript" src="../vendor/amber/support/requirejs/require.min.js"></script>
     <script type='text/javascript' src='../vendor/amber/support/amber.js'></script>
     <script type='text/javascript' src='../vendor/amber/support/amber.js'></script>
     <script type='text/javascript' src='showdown/showdown.js'></script>
     <script type='text/javascript' src='showdown/showdown.js'></script>
 	<script type="text/javascript" src="processing-1.4.1.js"></script>
 	<script type="text/javascript" src="processing-1.4.1.js"></script>
   </head> 
   </head> 
   <body> 
   <body> 
-	A Clock made with <a href="http://processingjs.org">Processing.js</a> and <a href"http://amber-lang.net/">Amber</a>
-	<p>Examine the <button onClick="global_smalltalk.Browser._openOn_(global_smalltalk.ProcessingClock)"> ProcessingClock class</button></p> 
+	A Clock made with <a href="http://processingjs.org">Processing.js</a> and <a href="http://amber-lang.net/">Amber</a>
+	<p>Examine the <button onClick="buttonClick()"> ProcessingClock class</button></p> 
 	<p><canvas id="canvas1" width="200" height="200"></canvas></p>
 	<p><canvas id="canvas1" width="200" height="200"></canvas></p>
 	<script id="script1" type="text/javascript">
 	<script id="script1" type="text/javascript">
+		var buttonClick;
 		// Simple way to attach js code to the canvas is by using a function
 		// Simple way to attach js code to the canvas is by using a function
 		function sketchProc(processing) {
 		function sketchProc(processing) {
 			// Override draw function, by default it will be called 60 times per second
 			// Override draw function, by default it will be called 60 times per second
@@ -25,17 +27,22 @@
 		var canvas = document.getElementById("canvas1");
 		var canvas = document.getElementById("canvas1");
 		// attaching the sketchProc function to the canvas
 		// attaching the sketchProc function to the canvas
 		var p = new Processing(canvas, sketchProc);
 		var p = new Processing(canvas, sketchProc);
-	</script>
-	   
-	<script type='text/javascript'> loadAmber(
-		{
-			packages: [ 'Processing-Examples' ],
-            packageHome: './',
-			ready: function(smalltalk) {
-				smalltalk.ProcessingClock._init() 
+		require.config({
+			paths: {
+				'amber_examples_processing': 'js',
+				'amber_examples_processing\_source': 'st'
 			}
 			}
-		}) 
-	</script> 
-	
+		});
+		require(['amber/devel','amber_examples_processing/Processing-Examples'],function(smalltalk){
+
+			smalltalk.defaultAMDNamespace = 'amber_examples_processing';
+			smalltalk.initialize();
+			buttonClick = function() {
+				smalltalk.Browser._openOn_(smalltalk.ProcessingClock);
+			};
+			smalltalk.ProcessingClock._init();
+		});
+	</script>
+	   	
   </body> 
   </body> 
 </html> 
 </html> 

+ 3 - 2
processing/js/Processing-Examples.js

@@ -1,5 +1,6 @@
-(function(smalltalk,nil,_st){
+define("amber_examples_processing/Processing-Examples", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Processing-Examples');
 smalltalk.addPackage('Processing-Examples');
+smalltalk.packages["Processing-Examples"].transport = {"type":"amd","amdNamespace":"amber_examples_processing"};
 
 
 smalltalk.addClass('ProcessingClock', smalltalk.Object, ['processing', 'centerX', 'centerY', 'maxArmLength'], 'Processing-Examples');
 smalltalk.addClass('ProcessingClock', smalltalk.Object, ['processing', 'centerX', 'centerY', 'maxArmLength'], 'Processing-Examples');
 smalltalk.addMethod(
 smalltalk.addMethod(
@@ -135,4 +136,4 @@ referencedClasses: ["ProcessingClock"]
 }),
 }),
 smalltalk.ProcessingClock.klass);
 smalltalk.ProcessingClock.klass);
 
 
-})(global_smalltalk,global_nil,global__st);
+});

+ 2 - 1
trysmalltalk/Gruntfile.js

@@ -15,7 +15,8 @@ module.exports = function(grunt) {
         src: ['st/TrySmalltalk.st'],
         src: ['st/TrySmalltalk.st'],
         libraries: ['Canvas'],
         libraries: ['Canvas'],
         output_dir: 'js',
         output_dir: 'js',
-        deploy: true
+        deploy: true,
+        amd_namespace: 'amber_examples_profstef'
       }
       }
     }
     }
   });
   });

+ 14 - 7
trysmalltalk/index.html

@@ -1,17 +1,24 @@
 <html>
 <html>
 <head>
 <head>
 <title>TrySmalltalk</title>
 <title>TrySmalltalk</title>
+<script src="../vendor/amber/support/requirejs/require.min.js" type="text/javascript"></script>
 <script src="../vendor/amber/support/amber.js" type="text/javascript"></script>
 <script src="../vendor/amber/support/amber.js" type="text/javascript"></script>
 </head>
 </head>
 <body>
 <body>
 <script type="text/javascript"> 
 <script type="text/javascript"> 
-	loadAmber({
-		files: ['TrySmalltalk'],
-		packageHome: './',
-		ready: function(smalltalk) {
-			smalltalk.Browser._openOn_(smalltalk.ProfStef)
-			smalltalk.TrySmalltalkWidget._open();
-		}}); 
+	require.config({
+		paths: {
+			'amber_examples_profstef': 'js',
+			'amber_examples_profstef\_source': 'st'
+		}
+	});
+	require(['amber/devel','amber_examples_profstef/TrySmalltalk'],function(smalltalk) {
+		smalltalk.defaultAMDNamespace = 'amber_examples_profstef';
+		smalltalk.initialize();
+		smalltalk.Browser._openOn_(smalltalk.ProfStef);
+		smalltalk.TrySmalltalkWidget._open();
+
+	});
 </script>
 </script>
 
 
 </body>
 </body>

+ 4 - 3
trysmalltalk/js/TrySmalltalk.js

@@ -1,5 +1,7 @@
-(function(smalltalk,nil,_st){
+define("amber_examples_profstef/TrySmalltalk", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Canvas"], function(smalltalk,nil,_st){
 smalltalk.addPackage('TrySmalltalk');
 smalltalk.addPackage('TrySmalltalk');
+smalltalk.packages["TrySmalltalk"].transport = {"type":"amd","amdNamespace":"amber_examples_profstef"};
+
 smalltalk.addClass('AbstractTutorial', smalltalk.Object, [], 'TrySmalltalk');
 smalltalk.addClass('AbstractTutorial', smalltalk.Object, [], 'TrySmalltalk');
 smalltalk.AbstractTutorial.comment="Parent class of all ProfStef tutorials.\x0a\x0aTo create your own tutorial:\x0a- subclass AbstractTutorial\x0a- implement a few methods which returns a Lesson instance\x0a- implement tutorial which returns a Collection of selectors to the methods you've created.";
 smalltalk.AbstractTutorial.comment="Parent class of all ProfStef tutorials.\x0a\x0aTo create your own tutorial:\x0a- subclass AbstractTutorial\x0a- implement a few methods which returns a Lesson instance\x0a- implement tutorial which returns a Collection of selectors to the methods you've created.";
 smalltalk.addMethod(
 smalltalk.addMethod(
@@ -1452,5 +1454,4 @@ referencedClasses: []
 smalltalk.TutorialPlayer);
 smalltalk.TutorialPlayer);
 
 
 
 
-
-})(global_smalltalk,global_nil,global__st);
+});

+ 1 - 1
vendor/amber

@@ -1 +1 @@
-Subproject commit df326c1aaa4723dcf01a63dc8232cd6b535b4ad6
+Subproject commit 97f1d2534ad80f40602a2ec1f9cf9de029259c29