2
0

TrySmalltalk.deploy.js 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. smalltalk.addPackage('TrySmalltalk');
  2. smalltalk.addClass('AbstractTutorial', smalltalk.Object, [], 'TrySmalltalk');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "indexOfLesson:",
  6. fn: function (aSelector){
  7. var self=this;
  8. return smalltalk.withContext(function($ctx1) {
  9. var $1;
  10. $1=_st(self._tableOfContents())._indexOf_(aSelector);
  11. return $1;
  12. }, function($ctx1) {$ctx1.fill(self,"indexOfLesson:",{aSelector:aSelector},smalltalk.AbstractTutorial)})},
  13. messageSends: ["indexOf:", "tableOfContents"]}),
  14. smalltalk.AbstractTutorial);
  15. smalltalk.addMethod(
  16. smalltalk.method({
  17. selector: "lessonAt:",
  18. fn: function (anInteger){
  19. var self=this;
  20. var lessonSelector;
  21. return smalltalk.withContext(function($ctx1) {
  22. var $1;
  23. lessonSelector=_st(self._tableOfContents())._at_(anInteger);
  24. $1=self._perform_(lessonSelector);
  25. return $1;
  26. }, function($ctx1) {$ctx1.fill(self,"lessonAt:",{anInteger:anInteger,lessonSelector:lessonSelector},smalltalk.AbstractTutorial)})},
  27. messageSends: ["at:", "tableOfContents", "perform:"]}),
  28. smalltalk.AbstractTutorial);
  29. smalltalk.addMethod(
  30. smalltalk.method({
  31. selector: "size",
  32. fn: function (){
  33. var self=this;
  34. return smalltalk.withContext(function($ctx1) {
  35. var $1;
  36. $1=_st(self._tableOfContents())._size();
  37. return $1;
  38. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.AbstractTutorial)})},
  39. messageSends: ["size", "tableOfContents"]}),
  40. smalltalk.AbstractTutorial);
  41. smalltalk.addMethod(
  42. smalltalk.method({
  43. selector: "tableOfContents",
  44. fn: function (){
  45. var self=this;
  46. return smalltalk.withContext(function($ctx1) {
  47. var $1;
  48. $1=["welcome", "testLesson", "theEnd"];
  49. return $1;
  50. }, function($ctx1) {$ctx1.fill(self,"tableOfContents",{},smalltalk.AbstractTutorial)})},
  51. messageSends: []}),
  52. smalltalk.AbstractTutorial);
  53. smalltalk.addMethod(
  54. smalltalk.method({
  55. selector: "testLesson",
  56. fn: function (){
  57. var self=this;
  58. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  59. return smalltalk.withContext(function($ctx1) {
  60. var $1;
  61. $1=_st($Lesson())._title_contents_("Test Lesson","\x22This lesson is a test\x22");
  62. return $1;
  63. }, function($ctx1) {$ctx1.fill(self,"testLesson",{},smalltalk.AbstractTutorial)})},
  64. messageSends: ["title:contents:"]}),
  65. smalltalk.AbstractTutorial);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "theEnd",
  69. fn: function (){
  70. var self=this;
  71. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  72. return smalltalk.withContext(function($ctx1) {
  73. var $1;
  74. $1=_st($Lesson())._title_contents_("The End","\x22And that'd be pretty much it :)\x22");
  75. return $1;
  76. }, function($ctx1) {$ctx1.fill(self,"theEnd",{},smalltalk.AbstractTutorial)})},
  77. messageSends: ["title:contents:"]}),
  78. smalltalk.AbstractTutorial);
  79. smalltalk.addMethod(
  80. smalltalk.method({
  81. selector: "welcome",
  82. fn: function (){
  83. var self=this;
  84. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  85. return smalltalk.withContext(function($ctx1) {
  86. var $1;
  87. $1=_st($Lesson())._title_contents_("Welcome","\x22Hi, this is a test tutorial.\x22");
  88. return $1;
  89. }, function($ctx1) {$ctx1.fill(self,"welcome",{},smalltalk.AbstractTutorial)})},
  90. messageSends: ["title:contents:"]}),
  91. smalltalk.AbstractTutorial);
  92. smalltalk.addClass('SmalltalkSyntaxTutorial', smalltalk.AbstractTutorial, [], 'TrySmalltalk');
  93. smalltalk.addMethod(
  94. smalltalk.method({
  95. selector: "basicTypesArray",
  96. fn: function (){
  97. var self=this;
  98. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  99. return smalltalk.withContext(function($ctx1) {
  100. var $1;
  101. $1=_st($Lesson())._title_contents_("Basic types: Array","\x22Literal arrays are created at parse time:\x22\x0a\x0a#(1 2 3).\x0a\x0a#( 1 2 3 #(4 5 6)) size.\x0a\x0a#(1 2 4) isEmpty.\x0a\x0a#(1 2 3) first.\x0a\x0a#('hello' 'Javascript') at: 2 put: 'Smalltalk'; yourself.\x0a\x0aProfStef next.");
  102. return $1;
  103. }, function($ctx1) {$ctx1.fill(self,"basicTypesArray",{},smalltalk.SmalltalkSyntaxTutorial)})},
  104. messageSends: ["title:contents:"]}),
  105. smalltalk.SmalltalkSyntaxTutorial);
  106. smalltalk.addMethod(
  107. smalltalk.method({
  108. selector: "basicTypesCharacters",
  109. fn: function (){
  110. var self=this;
  111. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  112. return smalltalk.withContext(function($ctx1) {
  113. var $1;
  114. $1=_st($Lesson())._title_contents_("Basic types: Characters","\x22A Character can be instantiated using $ operator:\x22\x0a\x0a$A.\x0a\x0a$A class.\x0a\x0a$B charCode.\x0a\x0aCharacter cr.\x0a\x0aCharacter space.\x0a\x0a\x22You can print all 256 characters of the ASCII extended set:\x22\x0a\x0aCharacter allByteCharacters.\x0a\x0aProfStef next.");
  115. return $1;
  116. }, function($ctx1) {$ctx1.fill(self,"basicTypesCharacters",{},smalltalk.SmalltalkSyntaxTutorial)})},
  117. messageSends: ["title:contents:"]}),
  118. smalltalk.SmalltalkSyntaxTutorial);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "basicTypesDynamicArray",
  122. fn: function (){
  123. var self=this;
  124. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  125. return smalltalk.withContext(function($ctx1) {
  126. var $1;
  127. $1=_st($Lesson())._title_contents_("Basic types: Dynamic Array","\x22Dynamic Arrays are created at execution time:\x22\x0a\x0a{ (2+3) . (6*6) }.\x0a\x0a{ (2+3) . (6*6) . 'hello', ' Stef'} size.\x0a\x0a\x0a{ ProfStef } first next.");
  128. return $1;
  129. }, function($ctx1) {$ctx1.fill(self,"basicTypesDynamicArray",{},smalltalk.SmalltalkSyntaxTutorial)})},
  130. messageSends: ["title:contents:"]}),
  131. smalltalk.SmalltalkSyntaxTutorial);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "basicTypesNumbers",
  135. fn: function (){
  136. var self=this;
  137. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  138. return smalltalk.withContext(function($ctx1) {
  139. var $1;
  140. $1=_st($Lesson())._title_contents_("Basic types: Numbers","\x22You now know how to execute Smalltalk code. \x0a\x0aNow let's talk about basic objects.\x0a\x0a1, 2, 100, 2/3 ... are Numbers, and respond to many messages evaluating mathematical expressions.\x0aEvaluate these ones:\x22\x0a\x0a2.\x0a\x0a(1/3).\x0a\x0a(1/3) + (4/5).\x0a\x0a(18/5) rounded.\x0a\x0a1 class.\x0a\x0a1 negated.\x0a\x0a1 negated negated.\x0a\x0a(1 + 3) odd.\x0a\x0aProfStef next.");
  141. return $1;
  142. }, function($ctx1) {$ctx1.fill(self,"basicTypesNumbers",{},smalltalk.SmalltalkSyntaxTutorial)})},
  143. messageSends: ["title:contents:"]}),
  144. smalltalk.SmalltalkSyntaxTutorial);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "basicTypesString",
  148. fn: function (){
  149. var self=this;
  150. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  151. return smalltalk.withContext(function($ctx1) {
  152. var $1;
  153. $1=_st($Lesson())._title_contents_("Basic types: Strings","\x22A String is a collection of characters. Use single quotes to create a String object. Print these expressions:\x22\x0a\x0a'ProfStef'.\x0a\x0a'ProfStef' size.\x0a\x0a'abc' asUppercase.\x0a\x0a'Hello World' reversed. \x0a\x0a\x22You can access each character using at: message\x22\x0a\x0a'ProfStef' at: 1.\x0a\x0a\x22String concatenation uses the comma operator:\x22\x0a\x0a'ProfStef', ' is cool'.\x0a\x0aProfStef next.");
  154. return $1;
  155. }, function($ctx1) {$ctx1.fill(self,"basicTypesString",{},smalltalk.SmalltalkSyntaxTutorial)})},
  156. messageSends: ["title:contents:"]}),
  157. smalltalk.SmalltalkSyntaxTutorial);
  158. smalltalk.addMethod(
  159. smalltalk.method({
  160. selector: "basicTypesSymbol",
  161. fn: function (){
  162. var self=this;
  163. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  164. return smalltalk.withContext(function($ctx1) {
  165. var $1;
  166. $1=_st($Lesson())._title_contents_("Basic types: Symbols","\x22A Symbol is a String which is guaranteed to be globally unique. \x0a\x0aThere is one and only one Symbol #ProfStef. There may be several 'ProfStef' String objects.\x0a\x0a(Message == returns true if the two objects are the SAME)\x22\x0a\x0a'ProfStef' asSymbol.\x0a\x0a#ProfStef asString.\x0a\x0a(2 asString) == (2 asString).\x0a\x0a(2 asString) asSymbol == (2 asString) asSymbol.\x0a\x0a\x0a(Smalltalk at: #ProfStef) next.");
  167. return $1;
  168. }, function($ctx1) {$ctx1.fill(self,"basicTypesSymbol",{},smalltalk.SmalltalkSyntaxTutorial)})},
  169. messageSends: ["title:contents:"]}),
  170. smalltalk.SmalltalkSyntaxTutorial);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "blocks",
  174. fn: function (){
  175. var self=this;
  176. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  177. return smalltalk.withContext(function($ctx1) {
  178. var $1;
  179. $1=_st($Lesson())._title_contents_("Blocks","\x22Cascade is cool ! Let's talk about blocks.\x0a\x0aBlocks are anonymous methods that can be stored into variables and executed on demand.\x0a\x0aBlocks are delimited by square brackets: []\x22\x0a\x0a[Transcript open].\x0a\x0a\x22does not open a Transcript because the block is not executed.\x0a\x0aHere is a block that adds 2 to its argument (its argument is named x):\x22\x0a\x0a[:x | x+2].\x0a\x0a\x22We can execute a block by sending it value messages.\x22\x0a\x0a[:x | x+2] value: 5.\x0a\x0a[Transcript open] value.\x0a\x0a[:x | x+2] value: 10.\x0a\x0a[:x :y| x + y] value:3 value:5.\x0a\x0a[ProfStef next] value.");
  180. return $1;
  181. }, function($ctx1) {$ctx1.fill(self,"blocks",{},smalltalk.SmalltalkSyntaxTutorial)})},
  182. messageSends: ["title:contents:"]}),
  183. smalltalk.SmalltalkSyntaxTutorial);
  184. smalltalk.addMethod(
  185. smalltalk.method({
  186. selector: "blocksAssignation",
  187. fn: function (){
  188. var self=this;
  189. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  190. return smalltalk.withContext(function($ctx1) {
  191. var $1;
  192. $1=_st($Lesson())._title_contents_("Block assignation","\x22Blocks can be assigned to a variable then executed later.\x0a\x0aNote that |b| is the declaration of a variable named 'b' and that ':=' assigns a value to a variable.\x0a\x0aSelect the three lines then Print It:\x22\x0a\x0a|b|\x0ab := [:x | x+2].\x0ab value: 12.\x0a\x0a\x0aProfStef next.");
  193. return $1;
  194. }, function($ctx1) {$ctx1.fill(self,"blocksAssignation",{},smalltalk.SmalltalkSyntaxTutorial)})},
  195. messageSends: ["title:contents:"]}),
  196. smalltalk.SmalltalkSyntaxTutorial);
  197. smalltalk.addMethod(
  198. smalltalk.method({
  199. selector: "conditionals",
  200. fn: function (){
  201. var self=this;
  202. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  203. return smalltalk.withContext(function($ctx1) {
  204. var $1;
  205. $1=_st($Lesson())._title_contents_("Conditionals","\x22Conditionals are just messages sent to Boolean objects\x22\x0a\x0a1 < 2\x0a ifTrue: [100]\x0a ifFalse: [42].\x0a\x0a\x22Here the message is ifTrue:ifFalse\x0a\x0aTry this:\x22\x0a\x0aTranscript open.\x0a\x0a3 > 10 \x0a\x09ifTrue: [Transcript show: 'maybe there''s a bug ....']\x0a\x09ifFalse: [Transcript show: 'No : 3 is less than 10'].\x0a\x0a3 = 3 ifTrue: [ProfStef next].");
  206. return $1;
  207. }, function($ctx1) {$ctx1.fill(self,"conditionals",{},smalltalk.SmalltalkSyntaxTutorial)})},
  208. messageSends: ["title:contents:"]}),
  209. smalltalk.SmalltalkSyntaxTutorial);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "debugger",
  213. fn: function (){
  214. var self=this;
  215. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  216. return smalltalk.withContext(function($ctx1) {
  217. var $1;
  218. $1=_st($Lesson())._title_contents_("Debugger","\x22The Debugger may be the most famous tool of Smalltalk environments. It will open as soon as an unmanaged Exception occurs. \x0a\x0aThe following code will open the debugger.\x0a\x0a***This should be rethought completely***\x22\x0a\x0a\x0a ");
  219. return $1;
  220. }, function($ctx1) {$ctx1.fill(self,"debugger",{},smalltalk.SmalltalkSyntaxTutorial)})},
  221. messageSends: ["title:contents:"]}),
  222. smalltalk.SmalltalkSyntaxTutorial);
  223. smalltalk.addMethod(
  224. smalltalk.method({
  225. selector: "doingVSPrinting",
  226. fn: function (){
  227. var self=this;
  228. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  229. return smalltalk.withContext(function($ctx1) {
  230. var $1;
  231. $1=_st($Lesson())._title_contents_("Doing VS Printing: Doing","\x22Cool ! (I like to say Cooool :) ).\x0aYou've just executed a Smalltalk expression.\x0aMore precisely, you sent the message 'next' to ProfStef class (it's me !).\x0a\x0aNote you can run this tutorial again by evaluating: 'ProfStef go'. \x0a'ProfStef previous' returns to the previous lesson.\x0a\x0aYou can also Do It using the keyboard shortcut 'CTRL d'\x0a\x0aTry to evaluate this expression:\x22\x0a\x0awindow alert: 'hello world!'.\x0a\x0a\x22Then go to the next lesson:\x22\x0a\x0aProfStef next.");
  232. return $1;
  233. }, function($ctx1) {$ctx1.fill(self,"doingVSPrinting",{},smalltalk.SmalltalkSyntaxTutorial)})},
  234. messageSends: ["title:contents:"]}),
  235. smalltalk.SmalltalkSyntaxTutorial);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "instanciation",
  239. fn: function (){
  240. var self=this;
  241. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  242. return smalltalk.withContext(function($ctx1) {
  243. var $1;
  244. $1=_st($Lesson())._title_contents_("Instanciation","\x22Objects are instances of their class. Usually, we send the message #new to a class for creating an instance of this class.\x0a\x0aFor example, let's create an instance of the class Array:\x22\x0a\x0aArray new\x0a\x09add: 'Some text';\x0a\x09add: 3.;\x0a\x09yourself.\x0a\x0a\x22See the array we've created? Actually, #('Some text' 3) is just a shorthand for instantiating arrays.\x22\x0a\x0a\x22If we use a variable to keep track of this object, we'll be able to do stuff with it.\x22\x0a\x0a\x22The following code must be ran all at one, as the 'anArray' variable will cease to exist once the execution finishes:\x22\x0a\x0a|anArray|\x0a\x0aanArray := Array new\x0a\x09add: 'Some text';\x0a\x09add: 3;\x0a\x09yourself.\x0a\x0aTranscript show: anArray; cr.\x0a\x0aanArray remove: 3.\x0a\x0aTranscript show: anArray; cr.\x0a\x0aanArray add: 'Some more text!'.\x0a\x0aTranscript show: anArray; cr.\x0a\x09\x0a\x22I'll put myself in an instance of a class named Dictionary and go to the next lesson:\x22\x0a\x0a((Dictionary new add: ('move on!' -> ProfStef)) at: 'move on!') next");
  245. return $1;
  246. }, function($ctx1) {$ctx1.fill(self,"instanciation",{},smalltalk.SmalltalkSyntaxTutorial)})},
  247. messageSends: ["title:contents:"]}),
  248. smalltalk.SmalltalkSyntaxTutorial);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "iterators",
  252. fn: function (){
  253. var self=this;
  254. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  255. return smalltalk.withContext(function($ctx1) {
  256. var $1;
  257. $1=_st($Lesson())._title_contents_("Iterators","\x22The message do: is sent to a collection of objects (Array, Dictionary, String, etc), evaluating the block for each element.\x0a\x0aHere we want to print all the numbers on the Transcript (a console)\x22\x0a\x0a#(11 38 3 -2 10) do: [:each |\x0a Transcript show: each printString; cr].\x0a\x0a\x22Some other really nice iterators\x22\x0a\x0a#(11 38 3 -2 10) collect: [:each | each negated].\x0a\x0a#(11 38 3 -2 10) collect: [:each | each odd].\x0a\x0a#(11 38 3 -2 10) select: [:each | each odd].\x0a\x0a#(11 38 3 -2 10) select: [:each | each > 10].\x0a\x0a#(11 38 3 -2 10) reject: [:each | each > 10].\x0a\x0a#(11 38 3 -2 10) \x0a do: [:each | Transcript show: each printString]\x0a separatedBy: [Transcript show: '.'].\x0a\x0a\x0a(Smalltalk current classes select: [:eachClass | eachClass name = 'ProfStef']) do: [:eachProfstef | eachProfstef next].");
  258. return $1;
  259. }, function($ctx1) {$ctx1.fill(self,"iterators",{},smalltalk.SmalltalkSyntaxTutorial)})},
  260. messageSends: ["title:contents:"]}),
  261. smalltalk.SmalltalkSyntaxTutorial);
  262. smalltalk.addMethod(
  263. smalltalk.method({
  264. selector: "loops",
  265. fn: function (){
  266. var self=this;
  267. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  268. return smalltalk.withContext(function($ctx1) {
  269. var $1;
  270. $1=_st($Lesson())._title_contents_("Loops","\x22Loops are high-level collection iterators, implemented as regular methods.\x22\x0a\x0a\x22Basic loops:\x0a to:do:\x0a to:by:do\x22\x0a\x0a1 to: 100 do:\x0a [:i | Transcript show: i asString; cr ].\x0a\x0a1 to: 100 by: 3 do: [:i | Transcript show: i asString; cr].\x0a\x0a100 to: 0 by: -2 do: \x0a [:i | Transcript show: i asString; cr].\x0a\x0a1 to: 1 do: [:i | ProfStef next].");
  271. return $1;
  272. }, function($ctx1) {$ctx1.fill(self,"loops",{},smalltalk.SmalltalkSyntaxTutorial)})},
  273. messageSends: ["title:contents:"]}),
  274. smalltalk.SmalltalkSyntaxTutorial);
  275. smalltalk.addMethod(
  276. smalltalk.method({
  277. selector: "mathematicalPrecedence",
  278. fn: function (){
  279. var self=this;
  280. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  281. return smalltalk.withContext(function($ctx1) {
  282. var $1;
  283. $1=_st($Lesson())._title_contents_("Mathematical precedence","\x22Traditional precedence rules from mathematics do not follow in Smalltalk.\x22\x0a\x0a2 * 10 + 2.\x0a\x0a\x22Here the message * is sent to 2, which answers 20, then 20 receive the message +\x0a\x0aRemember that all messages always follow a simple left-to-right precedence rule, * without exceptions *.\x22\x0a\x0a2 + 2 * 10.\x0a\x0a2 + (2 * 10).\x0a\x0a8 - 5 / 2.\x0a\x0a(8 - 5) / 2.\x0a\x0a8 - (5 / 2).\x0a\x0aProfStef next.");
  284. return $1;
  285. }, function($ctx1) {$ctx1.fill(self,"mathematicalPrecedence",{},smalltalk.SmalltalkSyntaxTutorial)})},
  286. messageSends: ["title:contents:"]}),
  287. smalltalk.SmalltalkSyntaxTutorial);
  288. smalltalk.addMethod(
  289. smalltalk.method({
  290. selector: "messageSyntaxBinary",
  291. fn: function (){
  292. var self=this;
  293. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  294. return smalltalk.withContext(function($ctx1) {
  295. var $1;
  296. $1=_st($Lesson())._title_contents_("Message syntax: Binary messages","\x22Binary messages have the following form:\x0a anObject + anotherObject\x22\x0a\x0a3 * 2.\x0a\x0aDate today year = 2011.\x0a\x0afalse | false.\x0a\x0atrue & true.\x0a\x0atrue & false.\x0a\x0a10 @ 100.\x0a\x0a10 <= 12.\x0a\x0a'ab', 'cd'.\x0a\x0aProfStef next.");
  297. return $1;
  298. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxBinary",{},smalltalk.SmalltalkSyntaxTutorial)})},
  299. messageSends: ["title:contents:"]}),
  300. smalltalk.SmalltalkSyntaxTutorial);
  301. smalltalk.addMethod(
  302. smalltalk.method({
  303. selector: "messageSyntaxCascade",
  304. fn: function (){
  305. var self=this;
  306. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  307. return smalltalk.withContext(function($ctx1) {
  308. var $1;
  309. $1=_st($Lesson())._title_contents_("Message syntax: Cascade","\x22; is the cascade operator. It's useful to send message to the SAME receiver\x0aOpen a Transcript (console):\x22\x0a\x0aTranscript open.\x0a\x0a\x22Then:\x22\x0a\x0aTranscript show: 'hello'.\x0aTranscript show: 'Smalltalk'.\x0aTranscript cr.\x0a\x0a\x22is equivalent to:\x22\x0a\x0aTranscript \x0a\x09 show: 'hello';\x0a\x09 show: 'Smalltalk' ;\x0a\x09 cr.\x0a\x0a\x22You can close the development tools by clicking on the red circle with a cross at the bottom left of the website.\x0aTry to go to the next lesson with a cascade of two 'next' messages:\x22\x0a\x0aProfStef");
  310. return $1;
  311. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxCascade",{},smalltalk.SmalltalkSyntaxTutorial)})},
  312. messageSends: ["title:contents:"]}),
  313. smalltalk.SmalltalkSyntaxTutorial);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "messageSyntaxCascadeShouldNotBeHere",
  317. fn: function (){
  318. var self=this;
  319. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  320. return smalltalk.withContext(function($ctx1) {
  321. var $1;
  322. $1=_st($Lesson())._title_contents_("Lost ?","\x22Hey, you should not be here !! \x0a\x0aGo back and use a cascade !\x22\x0a\x0aProfStef previous.");
  323. return $1;
  324. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxCascadeShouldNotBeHere",{},smalltalk.SmalltalkSyntaxTutorial)})},
  325. messageSends: ["title:contents:"]}),
  326. smalltalk.SmalltalkSyntaxTutorial);
  327. smalltalk.addMethod(
  328. smalltalk.method({
  329. selector: "messageSyntaxExecutionOrder",
  330. fn: function (){
  331. var self=this;
  332. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  333. return smalltalk.withContext(function($ctx1) {
  334. var $1;
  335. $1=_st($Lesson())._title_contents_("Message syntax: Execution order","\x22Unary messages are executed first, then binary messages and finally keyword messages:\x0a Unary > Binary > Keywords\x22\x0a\x0a2.5 + 3.8 rounded.\x0a\x0a3 max: 2 + 2.\x0a \x0a(0@0) class.\x0a\x0a0@0 x: 100.\x0a\x0a(0@0 x: 100) class.\x0a\x0a\x22Between messages of similar precedence, expressions are executed from left to right\x22\x0a\x0a-12345 negated asString reversed.\x0a\x0aProfStef next.");
  336. return $1;
  337. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxExecutionOrder",{},smalltalk.SmalltalkSyntaxTutorial)})},
  338. messageSends: ["title:contents:"]}),
  339. smalltalk.SmalltalkSyntaxTutorial);
  340. smalltalk.addMethod(
  341. smalltalk.method({
  342. selector: "messageSyntaxExecutionOrderParentheses",
  343. fn: function (){
  344. var self=this;
  345. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  346. return smalltalk.withContext(function($ctx1) {
  347. var $1;
  348. $1=_st($Lesson())._title_contents_("Message syntax: Parentheses","\x22Use parentheses to change order of evaluation\x22\x0a\x0a(2.5 + 3.8) rounded.\x0a\x0a(3 max: 2) + 2.\x0a\x0aProfStef next.");
  349. return $1;
  350. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxExecutionOrderParentheses",{},smalltalk.SmalltalkSyntaxTutorial)})},
  351. messageSends: ["title:contents:"]}),
  352. smalltalk.SmalltalkSyntaxTutorial);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "messageSyntaxKeyword",
  356. fn: function (){
  357. var self=this;
  358. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  359. return smalltalk.withContext(function($ctx1) {
  360. var $1;
  361. $1=_st($Lesson())._title_contents_("Message syntax: Keyword messages","\x22Keyword Messages are messages with arguments. They have the following form:\x0a anObject akey: anotherObject akey2: anotherObject2\x22\x0a\x0a'Web development is a good deal of pain' copyFrom: 1 to: 30\x0a\x0a\x22The message is copyFrom:to: sent to the String 'Web development is a good deal of pain'\x22\x0a\x0a1 max: 3.\x0a\x0aArray with: 'hello' with: 2 with: Smalltalk.\x0a\x0a\x22The message is with:with:with: implemented on class Array. Note you can also write\x22\x0a\x0aArray\x0a\x09with: 'Hi there!'\x0a\x09with: 2\x0a\x09with: Smalltalk.\x0a\x09\x0aProfStef perform: 'next'.");
  362. return $1;
  363. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxKeyword",{},smalltalk.SmalltalkSyntaxTutorial)})},
  364. messageSends: ["title:contents:"]}),
  365. smalltalk.SmalltalkSyntaxTutorial);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "messageSyntaxUnary",
  369. fn: function (){
  370. var self=this;
  371. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  372. return smalltalk.withContext(function($ctx1) {
  373. var $1;
  374. $1=_st($Lesson())._title_contents_("Message syntax: Unary messages","\x22Messages are sent to objects. There are three types of message: Unary, Binary and Keyword.\x0a\x0aUnary messages have the following form:\x0a anObject aMessage \x0a\x0aYou've already sent unary messages. For example:\x22\x0a\x0a1 class.\x0a\x0afalse not.\x0a\x0aDate today.\x0a\x0aNumber pi.\x0a\x0a\x22And of course: \x22\x0a\x0aProfStef next.");
  375. return $1;
  376. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxUnary",{},smalltalk.SmalltalkSyntaxTutorial)})},
  377. messageSends: ["title:contents:"]}),
  378. smalltalk.SmalltalkSyntaxTutorial);
  379. smalltalk.addMethod(
  380. smalltalk.method({
  381. selector: "pharoEnvironment",
  382. fn: function (){
  383. var self=this;
  384. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  385. return smalltalk.withContext(function($ctx1) {
  386. var $1;
  387. $1=_st($Lesson())._title_contents_("Pharo environment","\x22Every Smalltalk system is full of objects.\x0aThere are windows, text, numbers, dates, colors, points and much more.\x0aYou can interact with objects in a much more direct way than is possible with other programming languages.\x0a\x0aEvery object understands the message 'explore'. As a result, you get an Explorer window that shows details about the object.\x22\x0a\x0aDate today explore.\x0a\x0a\x22This shows that the date object consists of a point in time (start) and a duration (one day long).\x22\x0a\x0aProfStef explore.\x0a\x0a\x22You see, ProfStef class has a lot of objects. Let's take a look at my code:\x22\x0a\x0aProfStef browse.\x0a\x0aProfStef next.");
  388. return $1;
  389. }, function($ctx1) {$ctx1.fill(self,"pharoEnvironment",{},smalltalk.SmalltalkSyntaxTutorial)})},
  390. messageSends: ["title:contents:"]}),
  391. smalltalk.SmalltalkSyntaxTutorial);
  392. smalltalk.addMethod(
  393. smalltalk.method({
  394. selector: "printing",
  395. fn: function (){
  396. var self=this;
  397. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  398. return smalltalk.withContext(function($ctx1) {
  399. var $1;
  400. $1=_st($Lesson())._title_contents_("Doing VS Printing: Printing","\x22Now you're a Do It master ! Let's talk about printing.\x0aIt's a Do It which prints the result next to the expression you've selected.\x0aFor example, select the text below, and click on 'PrintIt':\x22\x0a\x0a1 + 2.\x0a\x0a\x22As with 'DoIt', there is also a shortcut to execute this command.\x0a\x0aTry CTRL-p on the following expressions:\x22\x0a\x0aDate today.\x0a\x0a\x22The result is selected, so you can erase it using the backspace key. Try it !\x22\x0a\x0aDate today asDateString.\x0a\x0aDate today asTimeString.\x0a\x0aProfStef next.");
  401. return $1;
  402. }, function($ctx1) {$ctx1.fill(self,"printing",{},smalltalk.SmalltalkSyntaxTutorial)})},
  403. messageSends: ["title:contents:"]}),
  404. smalltalk.SmalltalkSyntaxTutorial);
  405. smalltalk.addMethod(
  406. smalltalk.method({
  407. selector: "reflection",
  408. fn: function (){
  409. var self=this;
  410. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  411. return smalltalk.withContext(function($ctx1) {
  412. var $1;
  413. $1=_st($Lesson())._title_contents_("Reflection","\x22You can inspect and change the system at runtime.\x0a\x0aTake a look at the source code of the method #and: of the class Boolean:\x22\x0a\x0a(Boolean methodDictionary at: 'and:') source.\x0a\x0a\x22Or all the methods it sends:\x22\x0a\x0a(Boolean methodDictionary at: 'and:') messageSends.\x0a\x0a\x22Here's all the methods I implement:\x22\x0a\x0aProfStef methodDictionary.\x0a\x0a\x22Let's create a new method to go to the next lesson:\x22\x0a\x0a|newMethod|\x0anewMethod := Compiler new load: 'goToNextLesson ProfStef next.' forClass: ProfStef.\x0aProfStef class addCompiledMethod: newMethod\x0a\x0a\x22Wow! I can't wait to use my new method!\x22\x0a\x0aProfStef goToNextLesson.");
  414. return $1;
  415. }, function($ctx1) {$ctx1.fill(self,"reflection",{},smalltalk.SmalltalkSyntaxTutorial)})},
  416. messageSends: ["title:contents:"]}),
  417. smalltalk.SmalltalkSyntaxTutorial);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "reflectionContinued",
  421. fn: function (){
  422. var self=this;
  423. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  424. return smalltalk.withContext(function($ctx1) {
  425. var $1;
  426. $1=_st($Lesson())._title_contents_("Reflection continued","\x22So cool, isn't it ? Before going further, let's remove this method:\x22\x0a\x0aProfStef class methodAt: #goToNextLesson.\x0a\x0aProfStef class removeCompiledMethod: (ProfStef class methodAt: #goToNextLesson).\x0a\x0aProfStef class methodAt: #goToNextLesson.\x0a\x0a\x0a\x22Then move forward:\x22\x0a\x0aProfStef perform:#next");
  427. return $1;
  428. }, function($ctx1) {$ctx1.fill(self,"reflectionContinued",{},smalltalk.SmalltalkSyntaxTutorial)})},
  429. messageSends: ["title:contents:"]}),
  430. smalltalk.SmalltalkSyntaxTutorial);
  431. smalltalk.addMethod(
  432. smalltalk.method({
  433. selector: "tableOfContents",
  434. fn: function (){
  435. var self=this;
  436. return smalltalk.withContext(function($ctx1) {
  437. var $1;
  438. $1=["welcome", "doingVSPrinting", "printing", "basicTypesNumbers", "basicTypesString", "basicTypesArray", "basicTypesDynamicArray", "messageSyntaxUnary", "messageSyntaxBinary", "messageSyntaxKeyword", "messageSyntaxExecutionOrder", "messageSyntaxExecutionOrderParentheses", "mathematicalPrecedence", "messageSyntaxCascade", "messageSyntaxCascadeShouldNotBeHere", "blocks", "blocksAssignation", "conditionals", "loops", "iterators", "instanciation", "reflection", "reflectionContinued", "theEnd"];
  439. return $1;
  440. }, function($ctx1) {$ctx1.fill(self,"tableOfContents",{},smalltalk.SmalltalkSyntaxTutorial)})},
  441. messageSends: []}),
  442. smalltalk.SmalltalkSyntaxTutorial);
  443. smalltalk.addMethod(
  444. smalltalk.method({
  445. selector: "theEnd",
  446. fn: function (){
  447. var self=this;
  448. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  449. return smalltalk.withContext(function($ctx1) {
  450. var $1;
  451. $1=_st($Lesson())._title_contents_("Tutorial done !","\x22This tutorial is done. Enjoy programming Smalltalk with Amber. \x0a\x0aYou can run this tutorial again by evaluating: ProfStef go.\x0a\x0aSee you soon !\x22\x0a");
  452. return $1;
  453. }, function($ctx1) {$ctx1.fill(self,"theEnd",{},smalltalk.SmalltalkSyntaxTutorial)})},
  454. messageSends: ["title:contents:"]}),
  455. smalltalk.SmalltalkSyntaxTutorial);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "welcome",
  459. fn: function (){
  460. var self=this;
  461. function $Lesson(){return smalltalk.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  462. return smalltalk.withContext(function($ctx1) {
  463. var $1;
  464. $1=_st($Lesson())._title_contents_("Welcome"," \x22Hello! I'm Professor Stef. \x0a\x0aYou must want me to help you learn Smalltalk.\x0a\x0aSo let's go to the first lesson. Select the text below and click on the 'DoIt' button\x22\x0a\x0aProfStef next.");
  465. return $1;
  466. }, function($ctx1) {$ctx1.fill(self,"welcome",{},smalltalk.SmalltalkSyntaxTutorial)})},
  467. messageSends: ["title:contents:"]}),
  468. smalltalk.SmalltalkSyntaxTutorial);
  469. smalltalk.addClass('Lesson', smalltalk.Object, ['title', 'contents'], 'TrySmalltalk');
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "contents",
  473. fn: function (){
  474. var self=this;
  475. return smalltalk.withContext(function($ctx1) {
  476. var $2,$1;
  477. $2=self["@contents"];
  478. if(($receiver = $2) == nil || $receiver == undefined){
  479. self["@contents"]="";
  480. $1=self["@contents"];
  481. } else {
  482. $1=$2;
  483. };
  484. return $1;
  485. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Lesson)})},
  486. messageSends: ["ifNil:"]}),
  487. smalltalk.Lesson);
  488. smalltalk.addMethod(
  489. smalltalk.method({
  490. selector: "contents:",
  491. fn: function (aString){
  492. var self=this;
  493. return smalltalk.withContext(function($ctx1) {
  494. self["@contents"]=aString;
  495. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},smalltalk.Lesson)})},
  496. messageSends: []}),
  497. smalltalk.Lesson);
  498. smalltalk.addMethod(
  499. smalltalk.method({
  500. selector: "title",
  501. fn: function (){
  502. var self=this;
  503. return smalltalk.withContext(function($ctx1) {
  504. var $2,$1;
  505. $2=self["@title"];
  506. if(($receiver = $2) == nil || $receiver == undefined){
  507. self["@title"]="";
  508. $1=self["@title"];
  509. } else {
  510. $1=$2;
  511. };
  512. return $1;
  513. }, function($ctx1) {$ctx1.fill(self,"title",{},smalltalk.Lesson)})},
  514. messageSends: ["ifNil:"]}),
  515. smalltalk.Lesson);
  516. smalltalk.addMethod(
  517. smalltalk.method({
  518. selector: "title:",
  519. fn: function (aString){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) {
  522. self["@title"]=aString;
  523. return self}, function($ctx1) {$ctx1.fill(self,"title:",{aString:aString},smalltalk.Lesson)})},
  524. messageSends: []}),
  525. smalltalk.Lesson);
  526. smalltalk.addMethod(
  527. smalltalk.method({
  528. selector: "title:contents:",
  529. fn: function (aTitle,someContents){
  530. var self=this;
  531. return smalltalk.withContext(function($ctx1) {
  532. var $2,$3,$1;
  533. $2=self._new();
  534. _st($2)._title_(aTitle);
  535. $3=_st($2)._contents_(someContents);
  536. $1=$3;
  537. return $1;
  538. }, function($ctx1) {$ctx1.fill(self,"title:contents:",{aTitle:aTitle,someContents:someContents},smalltalk.Lesson.klass)})},
  539. messageSends: ["title:", "new", "contents:"]}),
  540. smalltalk.Lesson.klass);
  541. smalltalk.addClass('ProfStef', smalltalk.Object, ['tutorialPlayer', 'widget'], 'TrySmalltalk');
  542. smalltalk.addMethod(
  543. smalltalk.method({
  544. selector: "first",
  545. fn: function (){
  546. var self=this;
  547. return smalltalk.withContext(function($ctx1) {
  548. var $1;
  549. _st(self._tutorialPlayer())._first();
  550. $1=self._showCurrentLesson();
  551. return $1;
  552. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.ProfStef)})},
  553. messageSends: ["first", "tutorialPlayer", "showCurrentLesson"]}),
  554. smalltalk.ProfStef);
  555. smalltalk.addMethod(
  556. smalltalk.method({
  557. selector: "next",
  558. fn: function (){
  559. var self=this;
  560. return smalltalk.withContext(function($ctx1) {
  561. var $1;
  562. _st(self._tutorialPlayer())._next();
  563. $1=self._showCurrentLesson();
  564. return $1;
  565. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.ProfStef)})},
  566. messageSends: ["next", "tutorialPlayer", "showCurrentLesson"]}),
  567. smalltalk.ProfStef);
  568. smalltalk.addMethod(
  569. smalltalk.method({
  570. selector: "previous",
  571. fn: function (){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) {
  574. var $1;
  575. _st(self._tutorialPlayer())._previous();
  576. $1=self._showCurrentLesson();
  577. return $1;
  578. }, function($ctx1) {$ctx1.fill(self,"previous",{},smalltalk.ProfStef)})},
  579. messageSends: ["previous", "tutorialPlayer", "showCurrentLesson"]}),
  580. smalltalk.ProfStef);
  581. smalltalk.addMethod(
  582. smalltalk.method({
  583. selector: "progress",
  584. fn: function (){
  585. var self=this;
  586. return smalltalk.withContext(function($ctx1) {
  587. var $1;
  588. $1=_st(_st(_st("(".__comma(self._tutorialPositionString())).__comma("/")).__comma(self._tutorialSizeString())).__comma(")");
  589. return $1;
  590. }, function($ctx1) {$ctx1.fill(self,"progress",{},smalltalk.ProfStef)})},
  591. messageSends: [",", "tutorialSizeString", "tutorialPositionString"]}),
  592. smalltalk.ProfStef);
  593. smalltalk.addMethod(
  594. smalltalk.method({
  595. selector: "showCurrentLesson",
  596. fn: function (){
  597. var self=this;
  598. var lesson;
  599. return smalltalk.withContext(function($ctx1) {
  600. lesson=_st(self._tutorialPlayer())._currentLesson();
  601. _st(self["@widget"])._contents_(_st(lesson)._contents());
  602. _st(self["@widget"])._setTitle_(_st(_st(_st(lesson)._title()).__comma(" ")).__comma(self._progress()));
  603. return self}, function($ctx1) {$ctx1.fill(self,"showCurrentLesson",{lesson:lesson},smalltalk.ProfStef)})},
  604. messageSends: ["currentLesson", "tutorialPlayer", "contents:", "contents", "setTitle:", ",", "progress", "title"]}),
  605. smalltalk.ProfStef);
  606. smalltalk.addMethod(
  607. smalltalk.method({
  608. selector: "tutorialPlayer",
  609. fn: function (){
  610. var self=this;
  611. function $TutorialPlayer(){return smalltalk.TutorialPlayer||(typeof TutorialPlayer=="undefined"?nil:TutorialPlayer)}
  612. return smalltalk.withContext(function($ctx1) {
  613. var $2,$1;
  614. $2=self["@tutorialPlayer"];
  615. if(($receiver = $2) == nil || $receiver == undefined){
  616. self["@tutorialPlayer"]=_st($TutorialPlayer())._new();
  617. $1=self["@tutorialPlayer"];
  618. } else {
  619. $1=$2;
  620. };
  621. return $1;
  622. }, function($ctx1) {$ctx1.fill(self,"tutorialPlayer",{},smalltalk.ProfStef)})},
  623. messageSends: ["ifNil:", "new"]}),
  624. smalltalk.ProfStef);
  625. smalltalk.addMethod(
  626. smalltalk.method({
  627. selector: "tutorialPositionString",
  628. fn: function (){
  629. var self=this;
  630. return smalltalk.withContext(function($ctx1) {
  631. var $1;
  632. $1=_st(_st(self._tutorialPlayer())._tutorialPosition())._asString();
  633. return $1;
  634. }, function($ctx1) {$ctx1.fill(self,"tutorialPositionString",{},smalltalk.ProfStef)})},
  635. messageSends: ["asString", "tutorialPosition", "tutorialPlayer"]}),
  636. smalltalk.ProfStef);
  637. smalltalk.addMethod(
  638. smalltalk.method({
  639. selector: "tutorialSizeString",
  640. fn: function (){
  641. var self=this;
  642. return smalltalk.withContext(function($ctx1) {
  643. var $1;
  644. $1=_st(_st(self._tutorialPlayer())._size())._asString();
  645. return $1;
  646. }, function($ctx1) {$ctx1.fill(self,"tutorialSizeString",{},smalltalk.ProfStef)})},
  647. messageSends: ["asString", "size", "tutorialPlayer"]}),
  648. smalltalk.ProfStef);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "widget:",
  652. fn: function (aWidget){
  653. var self=this;
  654. return smalltalk.withContext(function($ctx1) {
  655. self["@widget"]=aWidget;
  656. return self}, function($ctx1) {$ctx1.fill(self,"widget:",{aWidget:aWidget},smalltalk.ProfStef)})},
  657. messageSends: []}),
  658. smalltalk.ProfStef);
  659. smalltalk.ProfStef.klass.iVarNames = ['instance'];
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "default",
  663. fn: function (){
  664. var self=this;
  665. return smalltalk.withContext(function($ctx1) {
  666. var $2,$1;
  667. $2=self["@instance"];
  668. if(($receiver = $2) == nil || $receiver == undefined){
  669. self["@instance"]=self._new();
  670. $1=self["@instance"];
  671. } else {
  672. $1=$2;
  673. };
  674. return $1;
  675. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ProfStef.klass)})},
  676. messageSends: ["ifNil:", "new"]}),
  677. smalltalk.ProfStef.klass);
  678. smalltalk.addMethod(
  679. smalltalk.method({
  680. selector: "first",
  681. fn: function (){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. var $1;
  685. $1=_st(self._default())._first();
  686. return $1;
  687. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.ProfStef.klass)})},
  688. messageSends: ["first", "default"]}),
  689. smalltalk.ProfStef.klass);
  690. smalltalk.addMethod(
  691. smalltalk.method({
  692. selector: "go",
  693. fn: function (){
  694. var self=this;
  695. return smalltalk.withContext(function($ctx1) {
  696. self._first();
  697. return self}, function($ctx1) {$ctx1.fill(self,"go",{},smalltalk.ProfStef.klass)})},
  698. messageSends: ["first"]}),
  699. smalltalk.ProfStef.klass);
  700. smalltalk.addMethod(
  701. smalltalk.method({
  702. selector: "next",
  703. fn: function (){
  704. var self=this;
  705. return smalltalk.withContext(function($ctx1) {
  706. var $1;
  707. $1=_st(self._default())._next();
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.ProfStef.klass)})},
  710. messageSends: ["next", "default"]}),
  711. smalltalk.ProfStef.klass);
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "previous",
  715. fn: function (){
  716. var self=this;
  717. return smalltalk.withContext(function($ctx1) {
  718. var $1;
  719. $1=_st(self._default())._previous();
  720. return $1;
  721. }, function($ctx1) {$ctx1.fill(self,"previous",{},smalltalk.ProfStef.klass)})},
  722. messageSends: ["previous", "default"]}),
  723. smalltalk.ProfStef.klass);
  724. smalltalk.addClass('TrySmalltalkWidget', smalltalk.Widget, ['workspace', 'contents', 'header'], 'TrySmalltalk');
  725. smalltalk.addMethod(
  726. smalltalk.method({
  727. selector: "contents",
  728. fn: function (){
  729. var self=this;
  730. return smalltalk.withContext(function($ctx1) {
  731. var $1;
  732. $1=_st(self._workspace())._val();
  733. return $1;
  734. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrySmalltalkWidget)})},
  735. messageSends: ["val", "workspace"]}),
  736. smalltalk.TrySmalltalkWidget);
  737. smalltalk.addMethod(
  738. smalltalk.method({
  739. selector: "contents:",
  740. fn: function (aString){
  741. var self=this;
  742. return smalltalk.withContext(function($ctx1) {
  743. _st(self._workspace())._val_(aString);
  744. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},smalltalk.TrySmalltalkWidget)})},
  745. messageSends: ["val:", "workspace"]}),
  746. smalltalk.TrySmalltalkWidget);
  747. smalltalk.addMethod(
  748. smalltalk.method({
  749. selector: "renderButtonsOn:",
  750. fn: function (html){
  751. var self=this;
  752. return smalltalk.withContext(function($ctx1) {
  753. var $1,$2,$3,$4,$5,$6;
  754. $1=_st(html)._button();
  755. _st($1)._with_("DoIt");
  756. _st($1)._title_("ctrl+d");
  757. $2=_st($1)._onClick_((function(){
  758. return smalltalk.withContext(function($ctx2) {
  759. return _st(self._workspace())._doIt();
  760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  761. $3=_st(html)._button();
  762. _st($3)._with_("PrintIt");
  763. _st($3)._title_("ctrl+p");
  764. $4=_st($3)._onClick_((function(){
  765. return smalltalk.withContext(function($ctx2) {
  766. return _st(self._workspace())._printIt();
  767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  768. $5=_st(html)._button();
  769. _st($5)._with_("InspectIt");
  770. _st($5)._title_("ctrl+i");
  771. $6=_st($5)._onClick_((function(){
  772. return smalltalk.withContext(function($ctx2) {
  773. return _st(self._workspace())._inspectIt();
  774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  775. return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},smalltalk.TrySmalltalkWidget)})},
  776. messageSends: ["with:", "button", "title:", "onClick:", "doIt", "workspace", "printIt", "inspectIt"]}),
  777. smalltalk.TrySmalltalkWidget);
  778. smalltalk.addMethod(
  779. smalltalk.method({
  780. selector: "renderOn:",
  781. fn: function (html){
  782. var self=this;
  783. function $ProfStef(){return smalltalk.ProfStef||(typeof ProfStef=="undefined"?nil:ProfStef)}
  784. return smalltalk.withContext(function($ctx1) {
  785. var $1,$2,$3,$4;
  786. $1=_st(html)._div();
  787. _st($1)._class_("profStef");
  788. _st($1)._with_((function(){
  789. return smalltalk.withContext(function($ctx2) {
  790. self["@header"]=_st(html)._h2();
  791. return self["@header"];
  792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  793. _st($1)._with_((function(){
  794. return smalltalk.withContext(function($ctx2) {
  795. return _st(self._workspace())._renderOn_(html);
  796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  797. $2=_st($1)._with_((function(){
  798. return smalltalk.withContext(function($ctx2) {
  799. return self._renderButtonsOn_(html);
  800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  801. $3=_st($ProfStef())._default();
  802. _st($3)._widget_(self);
  803. $4=_st($3)._showCurrentLesson();
  804. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.TrySmalltalkWidget)})},
  805. messageSends: ["class:", "div", "with:", "h2", "renderOn:", "workspace", "renderButtonsOn:", "widget:", "default", "showCurrentLesson"]}),
  806. smalltalk.TrySmalltalkWidget);
  807. smalltalk.addMethod(
  808. smalltalk.method({
  809. selector: "setTitle:",
  810. fn: function (aString){
  811. var self=this;
  812. return smalltalk.withContext(function($ctx1) {
  813. _st(self["@header"])._contents_((function(html){
  814. return smalltalk.withContext(function($ctx2) {
  815. return _st(html)._with_(aString);
  816. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}));
  817. return self}, function($ctx1) {$ctx1.fill(self,"setTitle:",{aString:aString},smalltalk.TrySmalltalkWidget)})},
  818. messageSends: ["contents:", "with:"]}),
  819. smalltalk.TrySmalltalkWidget);
  820. smalltalk.addMethod(
  821. smalltalk.method({
  822. selector: "workspace",
  823. fn: function (){
  824. var self=this;
  825. function $SourceArea(){return smalltalk.SourceArea||(typeof SourceArea=="undefined"?nil:SourceArea)}
  826. return smalltalk.withContext(function($ctx1) {
  827. var $2,$1;
  828. $2=self["@workspace"];
  829. if(($receiver = $2) == nil || $receiver == undefined){
  830. self["@workspace"]=_st($SourceArea())._new();
  831. $1=self["@workspace"];
  832. } else {
  833. $1=$2;
  834. };
  835. return $1;
  836. }, function($ctx1) {$ctx1.fill(self,"workspace",{},smalltalk.TrySmalltalkWidget)})},
  837. messageSends: ["ifNil:", "new"]}),
  838. smalltalk.TrySmalltalkWidget);
  839. smalltalk.addMethod(
  840. smalltalk.method({
  841. selector: "open",
  842. fn: function (){
  843. var self=this;
  844. return smalltalk.withContext(function($ctx1) {
  845. _st(self._new())._appendToJQuery_("body"._asJQuery());
  846. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.TrySmalltalkWidget.klass)})},
  847. messageSends: ["appendToJQuery:", "asJQuery", "new"]}),
  848. smalltalk.TrySmalltalkWidget.klass);
  849. smalltalk.addClass('TutorialPlayer', smalltalk.Object, ['tutorialPosition', 'tutorial'], 'TrySmalltalk');
  850. smalltalk.addMethod(
  851. smalltalk.method({
  852. selector: "currentLesson",
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. $1=_st(self._tutorial())._lessonAt_(self._tutorialPosition());
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"currentLesson",{},smalltalk.TutorialPlayer)})},
  860. messageSends: ["lessonAt:", "tutorialPosition", "tutorial"]}),
  861. smalltalk.TutorialPlayer);
  862. smalltalk.addMethod(
  863. smalltalk.method({
  864. selector: "first",
  865. fn: function (){
  866. var self=this;
  867. return smalltalk.withContext(function($ctx1) {
  868. var $1;
  869. self._rewind();
  870. $1=self._currentLesson();
  871. return $1;
  872. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.TutorialPlayer)})},
  873. messageSends: ["rewind", "currentLesson"]}),
  874. smalltalk.TutorialPlayer);
  875. smalltalk.addMethod(
  876. smalltalk.method({
  877. selector: "last",
  878. fn: function (){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) {
  881. var $1;
  882. self["@tutorialPosition"]=self._size();
  883. $1=self._currentLesson();
  884. return $1;
  885. }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.TutorialPlayer)})},
  886. messageSends: ["size", "currentLesson"]}),
  887. smalltalk.TutorialPlayer);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "next",
  891. fn: function (){
  892. var self=this;
  893. return smalltalk.withContext(function($ctx1) {
  894. var $1,$2;
  895. $1=_st(self._tutorialPosition()).__lt(self._size());
  896. if(smalltalk.assert($1)){
  897. self["@tutorialPosition"]=_st(self["@tutorialPosition"]).__plus((1));
  898. self["@tutorialPosition"];
  899. };
  900. $2=self._currentLesson();
  901. return $2;
  902. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.TutorialPlayer)})},
  903. messageSends: ["ifTrue:", "+", "<", "size", "tutorialPosition", "currentLesson"]}),
  904. smalltalk.TutorialPlayer);
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "previous",
  908. fn: function (){
  909. var self=this;
  910. return smalltalk.withContext(function($ctx1) {
  911. var $1,$2;
  912. $1=_st(self["@tutorialPosition"]).__gt((1));
  913. if(smalltalk.assert($1)){
  914. self["@tutorialPosition"]=_st(self["@tutorialPosition"]).__minus((1));
  915. self["@tutorialPosition"];
  916. };
  917. $2=self._currentLesson();
  918. return $2;
  919. }, function($ctx1) {$ctx1.fill(self,"previous",{},smalltalk.TutorialPlayer)})},
  920. messageSends: ["ifTrue:", "-", ">", "currentLesson"]}),
  921. smalltalk.TutorialPlayer);
  922. smalltalk.addMethod(
  923. smalltalk.method({
  924. selector: "rewind",
  925. fn: function (){
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) {
  928. self["@tutorialPosition"]=(1);
  929. return self}, function($ctx1) {$ctx1.fill(self,"rewind",{},smalltalk.TutorialPlayer)})},
  930. messageSends: []}),
  931. smalltalk.TutorialPlayer);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "size",
  935. fn: function (){
  936. var self=this;
  937. return smalltalk.withContext(function($ctx1) {
  938. var $1;
  939. $1=_st(self._tutorial())._size();
  940. return $1;
  941. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.TutorialPlayer)})},
  942. messageSends: ["size", "tutorial"]}),
  943. smalltalk.TutorialPlayer);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "tutorial",
  947. fn: function (){
  948. var self=this;
  949. function $SmalltalkSyntaxTutorial(){return smalltalk.SmalltalkSyntaxTutorial||(typeof SmalltalkSyntaxTutorial=="undefined"?nil:SmalltalkSyntaxTutorial)}
  950. return smalltalk.withContext(function($ctx1) {
  951. var $2,$1;
  952. $2=self["@tutorial"];
  953. if(($receiver = $2) == nil || $receiver == undefined){
  954. self["@tutorial"]=_st($SmalltalkSyntaxTutorial())._new();
  955. $1=self["@tutorial"];
  956. } else {
  957. $1=$2;
  958. };
  959. return $1;
  960. }, function($ctx1) {$ctx1.fill(self,"tutorial",{},smalltalk.TutorialPlayer)})},
  961. messageSends: ["ifNil:", "new"]}),
  962. smalltalk.TutorialPlayer);
  963. smalltalk.addMethod(
  964. smalltalk.method({
  965. selector: "tutorial:",
  966. fn: function (aTutorial){
  967. var self=this;
  968. return smalltalk.withContext(function($ctx1) {
  969. self["@tutorial"]=aTutorial;
  970. return self}, function($ctx1) {$ctx1.fill(self,"tutorial:",{aTutorial:aTutorial},smalltalk.TutorialPlayer)})},
  971. messageSends: []}),
  972. smalltalk.TutorialPlayer);
  973. smalltalk.addMethod(
  974. smalltalk.method({
  975. selector: "tutorialPosition",
  976. fn: function (){
  977. var self=this;
  978. return smalltalk.withContext(function($ctx1) {
  979. var $2,$1;
  980. $2=self["@tutorialPosition"];
  981. if(($receiver = $2) == nil || $receiver == undefined){
  982. self._rewind();
  983. $1=self["@tutorialPosition"];
  984. } else {
  985. $1=$2;
  986. };
  987. return $1;
  988. }, function($ctx1) {$ctx1.fill(self,"tutorialPosition",{},smalltalk.TutorialPlayer)})},
  989. messageSends: ["ifNil:", "rewind"]}),
  990. smalltalk.TutorialPlayer);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "tutorialPosition:",
  994. fn: function (aTutorialPosition){
  995. var self=this;
  996. return smalltalk.withContext(function($ctx1) {
  997. self["@tutorialPosition"]=aTutorialPosition;
  998. return self}, function($ctx1) {$ctx1.fill(self,"tutorialPosition:",{aTutorialPosition:aTutorialPosition},smalltalk.TutorialPlayer)})},
  999. messageSends: []}),
  1000. smalltalk.TutorialPlayer);