TrySmalltalk.deploy.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. smalltalk.addPackage('TrySmalltalk', {});
  2. smalltalk.addClass('AbstractTutorial', smalltalk.Object, [], 'TrySmalltalk');
  3. smalltalk.addMethod(
  4. "_indexOfLesson_",
  5. smalltalk.method({
  6. selector: "indexOfLesson:",
  7. fn: function (aSelector) {
  8. var self=this;
  9. return smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_indexOf_", [aSelector]);
  10. return self;}
  11. }),
  12. smalltalk.AbstractTutorial);
  13. smalltalk.addMethod(
  14. "_lessonAt_",
  15. smalltalk.method({
  16. selector: "lessonAt:",
  17. fn: function (anInteger) {
  18. var self=this;
  19. var lessonSelector=nil;
  20. lessonSelector=smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_at_", [anInteger]);
  21. return smalltalk.send(self, "_perform_", [lessonSelector]);
  22. return self;}
  23. }),
  24. smalltalk.AbstractTutorial);
  25. smalltalk.addMethod(
  26. "_size",
  27. smalltalk.method({
  28. selector: "size",
  29. fn: function () {
  30. var self=this;
  31. return smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_size", []);
  32. return self;}
  33. }),
  34. smalltalk.AbstractTutorial);
  35. smalltalk.addMethod(
  36. "_tableOfContents",
  37. smalltalk.method({
  38. selector: "tableOfContents",
  39. fn: function () {
  40. var self=this;
  41. return ["welcome", "testLesson", "theEnd"];
  42. return self;}
  43. }),
  44. smalltalk.AbstractTutorial);
  45. smalltalk.addMethod(
  46. "_testLesson",
  47. smalltalk.method({
  48. selector: "testLesson",
  49. fn: function () {
  50. var self=this;
  51. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Test Lesson", unescape("%22This%20lesson%20is%20a%20test%22")]);
  52. return self;}
  53. }),
  54. smalltalk.AbstractTutorial);
  55. smalltalk.addMethod(
  56. "_theEnd",
  57. smalltalk.method({
  58. selector: "theEnd",
  59. fn: function () {
  60. var self=this;
  61. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["The End", unescape("%22And%20that%27d%20be%20pretty%20much%20it%20%3A%29%22")]);
  62. return self;}
  63. }),
  64. smalltalk.AbstractTutorial);
  65. smalltalk.addMethod(
  66. "_welcome",
  67. smalltalk.method({
  68. selector: "welcome",
  69. fn: function () {
  70. var self=this;
  71. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Welcome", unescape("%22Hi%2C%20this%20is%20a%20test%20tutorial.%22")]);
  72. return self;}
  73. }),
  74. smalltalk.AbstractTutorial);
  75. smalltalk.addClass('SmalltalkSyntaxTutorial', smalltalk.AbstractTutorial, [], 'TrySmalltalk');
  76. smalltalk.addMethod(
  77. "_basicTypesArray",
  78. smalltalk.method({
  79. selector: "basicTypesArray",
  80. fn: function () {
  81. var self=this;
  82. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Basic types: Array", unescape("%22Literal%20arrays%20are%20created%20at%20parse%20time%3A%22%0A%0A%23%281%202%203%29.%0A%0A%23%28%201%202%203%20%23%284%205%206%29%29%20size.%0A%0A%23%281%202%204%29%20isEmpty.%0A%0A%23%281%202%203%29%20first.%0A%0A%23%28%27hello%27%20%27Javascript%27%29%20at%3A%202%20put%3A%20%27Smalltalk%27%3B%20yourself.%0A%0AProfStef%20next.")]);
  83. return self;}
  84. }),
  85. smalltalk.SmalltalkSyntaxTutorial);
  86. smalltalk.addMethod(
  87. "_basicTypesCharacters",
  88. smalltalk.method({
  89. selector: "basicTypesCharacters",
  90. fn: function () {
  91. var self=this;
  92. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Basic types: Characters", unescape("%22A%20Character%20can%20be%20instantiated%20using%20%24%20operator%3A%22%0A%0A%24A.%0A%0A%24A%20class.%0A%0A%24B%20charCode.%0A%0ACharacter%20cr.%0A%0ACharacter%20space.%0A%0A%22You%20can%20print%20all%20256%20characters%20of%20the%20ASCII%20extended%20set%3A%22%0A%0ACharacter%20allByteCharacters.%0A%0AProfStef%20next.")]);
  93. return self;}
  94. }),
  95. smalltalk.SmalltalkSyntaxTutorial);
  96. smalltalk.addMethod(
  97. "_basicTypesDynamicArray",
  98. smalltalk.method({
  99. selector: "basicTypesDynamicArray",
  100. fn: function () {
  101. var self=this;
  102. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Basic types: Dynamic Array", unescape("%22Dynamic%20Arrays%20are%20created%20at%20execution%20time%3A%22%0A%0A%7B%20%282+3%29%20.%20%286*6%29%20%7D.%0A%0A%7B%20%282+3%29%20.%20%286*6%29%20.%20%27hello%27%2C%20%27%20Stef%27%7D%20size.%0A%0A%0A%7B%20ProfStef%20%7D%20first%20next.")]);
  103. return self;}
  104. }),
  105. smalltalk.SmalltalkSyntaxTutorial);
  106. smalltalk.addMethod(
  107. "_basicTypesNumbers",
  108. smalltalk.method({
  109. selector: "basicTypesNumbers",
  110. fn: function () {
  111. var self=this;
  112. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Basic types: Numbers", unescape("%22You%20now%20know%20how%20to%20execute%20Smalltalk%20code.%20%0A%0ANow%20let%27s%20talk%20about%20basic%20objects.%0A%0A1%2C%202%2C%20100%2C%202/3%20...%20are%20Numbers%2C%20and%20respond%20to%20many%20messages%20evaluating%20mathematical%20expressions.%0AEvaluate%20these%20ones%3A%22%0A%0A2.%0A%0A%281/3%29.%0A%0A%281/3%29%20+%20%284/5%29.%0A%0A%2818/5%29%20rounded.%0A%0A1%20class.%0A%0A1%20negated.%0A%0A1%20negated%20negated.%0A%0A%281%20+%203%29%20odd.%0A%0AProfStef%20next.")]);
  113. return self;}
  114. }),
  115. smalltalk.SmalltalkSyntaxTutorial);
  116. smalltalk.addMethod(
  117. "_basicTypesString",
  118. smalltalk.method({
  119. selector: "basicTypesString",
  120. fn: function () {
  121. var self=this;
  122. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Basic types: Strings", unescape("%22A%20String%20is%20a%20collection%20of%20characters.%20Use%20single%20quotes%20to%20create%20a%20String%20object.%20Print%20these%20expressions%3A%22%0A%0A%27ProfStef%27.%0A%0A%27ProfStef%27%20size.%0A%0A%27abc%27%20asUppercase.%0A%0A%27Hello%20World%27%20reversed.%20%0A%0A%22You%20can%20access%20each%20character%20using%20at%3A%20message%22%0A%0A%27ProfStef%27%20at%3A%201.%0A%0A%22String%20concatenation%20uses%20the%20comma%20operator%3A%22%0A%0A%27ProfStef%27%2C%20%27%20is%20cool%27.%0A%0AProfStef%20next.")]);
  123. return self;}
  124. }),
  125. smalltalk.SmalltalkSyntaxTutorial);
  126. smalltalk.addMethod(
  127. "_basicTypesSymbol",
  128. smalltalk.method({
  129. selector: "basicTypesSymbol",
  130. fn: function () {
  131. var self=this;
  132. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Basic types: Symbols", unescape("%22A%20Symbol%20is%20a%20String%20which%20is%20guaranteed%20to%20be%20globally%20unique.%20%0A%0AThere%20is%20one%20and%20only%20one%20Symbol%20%23ProfStef.%20There%20may%20be%20several%20%27ProfStef%27%20String%20objects.%0A%0A%28Message%20%3D%3D%20returns%20true%20if%20the%20two%20objects%20are%20the%20SAME%29%22%0A%0A%27ProfStef%27%20asSymbol.%0A%0A%23ProfStef%20asString.%0A%0A%282%20asString%29%20%3D%3D%20%282%20asString%29.%0A%0A%282%20asString%29%20asSymbol%20%3D%3D%20%282%20asString%29%20asSymbol.%0A%0A%0A%28Smalltalk%20at%3A%20%23ProfStef%29%20next.")]);
  133. return self;}
  134. }),
  135. smalltalk.SmalltalkSyntaxTutorial);
  136. smalltalk.addMethod(
  137. "_blocks",
  138. smalltalk.method({
  139. selector: "blocks",
  140. fn: function () {
  141. var self=this;
  142. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Blocks", unescape("%22Cascade%20is%20cool%20%21%20Let%27s%20talk%20about%20blocks.%0A%0ABlocks%20are%20anonymous%20methods%20that%20can%20be%20stored%20into%20variables%20and%20executed%20on%20demand.%0A%0ABlocks%20are%20delimited%20by%20square%20brackets%3A%20%5B%5D%22%0A%0A%5BTranscript%20open%5D.%0A%0A%22does%20not%20open%20a%20Transcript%20because%20the%20block%20is%20not%20executed.%0A%0AHere%20is%20a%20block%20that%20adds%202%20to%20its%20argument%20%28its%20argument%20is%20named%20x%29%3A%22%0A%0A%5B%3Ax%20%7C%20x+2%5D.%0A%0A%22We%20can%20execute%20a%20block%20by%20sending%20it%20value%20messages.%22%0A%0A%5B%3Ax%20%7C%20x+2%5D%20value%3A%205.%0A%0A%5BTranscript%20open%5D%20value.%0A%0A%5B%3Ax%20%7C%20x+2%5D%20value%3A%2010.%0A%0A%5B%3Ax%20%3Ay%7C%20x%20+%20y%5D%20value%3A3%20value%3A5.%0A%0A%5BProfStef%20next%5D%20value.")]);
  143. return self;}
  144. }),
  145. smalltalk.SmalltalkSyntaxTutorial);
  146. smalltalk.addMethod(
  147. "_blocksAssignation",
  148. smalltalk.method({
  149. selector: "blocksAssignation",
  150. fn: function () {
  151. var self=this;
  152. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Block assignation", unescape("%22Blocks%20can%20be%20assigned%20to%20a%20variable%20then%20executed%20later.%0A%0ANote%20that%20%7Cb%7C%20is%20the%20declaration%20of%20a%20variable%20named%20%27b%27%20and%20that%20%27%3A%3D%27%20assigns%20a%20value%20to%20a%20variable.%0A%0ASelect%20the%20three%20lines%20then%20Print%20It%3A%22%0A%0A%7Cb%7C%0Ab%20%3A%3D%20%5B%3Ax%20%7C%20x+2%5D.%0Ab%20value%3A%2012.%0A%0A%0AProfStef%20next.")]);
  153. return self;}
  154. }),
  155. smalltalk.SmalltalkSyntaxTutorial);
  156. smalltalk.addMethod(
  157. "_conditionals",
  158. smalltalk.method({
  159. selector: "conditionals",
  160. fn: function () {
  161. var self=this;
  162. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Conditionals", unescape("%22Conditionals%20are%20just%20messages%20sent%20to%20Boolean%20objects%22%0A%0A1%20%3C%202%0A%20%20ifTrue%3A%20%5B100%5D%0A%20%20ifFalse%3A%20%5B42%5D.%0A%0A%22Here%20the%20message%20is%20ifTrue%3AifFalse%0A%0ATry%20this%3A%22%0A%0ATranscript%20open.%0A%0A3%20%3E%2010%20%0A%09ifTrue%3A%20%5BTranscript%20show%3A%20%27maybe%20there%27%27s%20a%20bug%20....%27%5D%0A%09ifFalse%3A%20%5BTranscript%20show%3A%20%27No%20%3A%203%20is%20less%20than%2010%27%5D.%0A%0A3%20%3D%203%20ifTrue%3A%20%5BProfStef%20next%5D.")]);
  163. return self;}
  164. }),
  165. smalltalk.SmalltalkSyntaxTutorial);
  166. smalltalk.addMethod(
  167. "_debugger",
  168. smalltalk.method({
  169. selector: "debugger",
  170. fn: function () {
  171. var self=this;
  172. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Debugger", unescape("%22The%20Debugger%20may%20be%20the%20most%20famous%20tool%20of%20Smalltalk%20environments.%20It%20will%20open%20as%20soon%20as%20an%20unmanaged%20Exception%20occurs.%20%0A%0AThe%20following%20code%20will%20open%20the%20debugger.%0A%0A***This%20should%20be%20rethought%20completely***%22%0A%0A%0A%20")]);
  173. return self;}
  174. }),
  175. smalltalk.SmalltalkSyntaxTutorial);
  176. smalltalk.addMethod(
  177. "_doingVSPrinting",
  178. smalltalk.method({
  179. selector: "doingVSPrinting",
  180. fn: function () {
  181. var self=this;
  182. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Doing VS Printing: Doing", unescape("%22Cool%20%21%20%28I%20like%20to%20say%20Cooool%20%3A%29%20%29.%20You%27ve%20just%20executed%20a%20Smalltalk%20expression.%20More%20precisely%2C%20you%20sent%20the%20message%20%27next%27%20to%0AProfStef%20class%20%28it%27s%20me%20%21%29.%0A%0ANote%20you%20can%20run%20this%20tutorial%20again%20by%20evaluating%3A%20%27ProfStef%20go%27.%20%0A%27ProfStef%20previous%27%20returns%20to%20the%20previous%20lesson.%0A%0AYou%20can%20also%20Do%20It%20using%20the%20keyboard%20shortcut%20%27CTRL%20d%27%0A%0ATry%20to%20evaluate%20this%20expression%3A%22%0A%0Awindow%20alert%3A%20%27hello%20world%21%27.%0A%0A%22Then%20go%20to%20the%20next%20lesson%3A%22%0A%0AProfStef%20next.")]);
  183. return self;}
  184. }),
  185. smalltalk.SmalltalkSyntaxTutorial);
  186. smalltalk.addMethod(
  187. "_instanciation",
  188. smalltalk.method({
  189. selector: "instanciation",
  190. fn: function () {
  191. var self=this;
  192. return smalltalk.send((smalltalk.Lesson || 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"]);
  193. return self;}
  194. }),
  195. smalltalk.SmalltalkSyntaxTutorial);
  196. smalltalk.addMethod(
  197. "_iterators",
  198. smalltalk.method({
  199. selector: "iterators",
  200. fn: function () {
  201. var self=this;
  202. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Iterators", unescape("%22The%20message%20do%3A%20is%20sent%20to%20a%20collection%20of%20objects%20%28Array%2C%20Dictionary%2C%20String%2C%20etc%29%2C%20evaluating%20the%20block%20for%20each%20element.%0A%0AHere%20we%20want%20to%20print%20all%20the%20numbers%20on%20the%20Transcript%20%28a%20console%29%22%0A%0A%23%2811%2038%203%20-2%2010%29%20do%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%20Transcript%20show%3A%20each%20printString%3B%20cr%5D.%0A%0A%22Some%20other%20really%20nice%20iterators%22%0A%0A%23%2811%2038%203%20-2%2010%29%20collect%3A%20%5B%3Aeach%20%7C%20each%20negated%5D.%0A%0A%23%2811%2038%203%20-2%2010%29%20collect%3A%20%5B%3Aeach%20%7C%20each%20odd%5D.%0A%0A%23%2811%2038%203%20-2%2010%29%20select%3A%20%5B%3Aeach%20%7C%20each%20odd%5D.%0A%0A%23%2811%2038%203%20-2%2010%29%20select%3A%20%5B%3Aeach%20%7C%20each%20%3E%2010%5D.%0A%0A%23%2811%2038%203%20-2%2010%29%20reject%3A%20%5B%3Aeach%20%7C%20each%20%3E%2010%5D.%0A%0A%23%2811%2038%203%20-2%2010%29%20%0A%20%20%20%20%20do%3A%20%5B%3Aeach%20%7C%20Transcript%20show%3A%20each%20printString%5D%0A%20%20%20%20%20separatedBy%3A%20%5BTranscript%20show%3A%20%27.%27%5D.%0A%0A%0A%28Smalltalk%20current%20classes%20select%3A%20%5B%3AeachClass%20%7C%20eachClass%20name%20%3D%20%27ProfStef%27%5D%29%20do%3A%20%5B%3AeachProfstef%20%7C%20eachProfstef%20next%5D.")]);
  203. return self;}
  204. }),
  205. smalltalk.SmalltalkSyntaxTutorial);
  206. smalltalk.addMethod(
  207. "_loops",
  208. smalltalk.method({
  209. selector: "loops",
  210. fn: function () {
  211. var self=this;
  212. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Loops", unescape("%22Loops%20are%20high-level%20collection%20iterators%2C%20implemented%20as%20regular%20methods.%22%0A%0A%22Basic%20loops%3A%0A%20%20to%3Ado%3A%0A%20%20to%3Aby%3Ado%22%0A%0A1%20to%3A%20100%20do%3A%0A%20%20%5B%3Ai%20%7C%20Transcript%20show%3A%20i%20asString%3B%20cr%20%5D.%0A%0A1%20to%3A%20100%20by%3A%203%20do%3A%20%5B%3Ai%20%7C%20Transcript%20show%3A%20i%20asString%3B%20cr%5D.%0A%0A100%20to%3A%200%20by%3A%20-2%20do%3A%20%0A%20%20%20%20%5B%3Ai%20%7C%20Transcript%20show%3A%20i%20asString%3B%20cr%5D.%0A%0A1%20to%3A%201%20do%3A%20%5B%3Ai%20%7C%20ProfStef%20next%5D.")]);
  213. return self;}
  214. }),
  215. smalltalk.SmalltalkSyntaxTutorial);
  216. smalltalk.addMethod(
  217. "_mathematicalPrecedence",
  218. smalltalk.method({
  219. selector: "mathematicalPrecedence",
  220. fn: function () {
  221. var self=this;
  222. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Mathematical precedence", unescape("%22Traditional%20precedence%20rules%20from%20mathematics%20do%20not%20follow%20in%20Smalltalk.%22%0A%0A2%20*%2010%20+%202.%0A%0A%22Here%20the%20message%20*%20is%20sent%20to%202%2C%20which%20answers%2020%2C%20then%2020%20receive%20the%20message%20+%0A%0ARemember%20that%20all%20messages%20always%20follow%20a%20simple%20left-to-right%20precedence%20rule%2C%20*%20without%20exceptions%20*.%22%0A%0A2%20+%202%20*%2010.%0A%0A2%20+%20%282%20*%2010%29.%0A%0A8%20-%205%20/%202.%0A%0A%288%20-%205%29%20/%202.%0A%0A8%20-%20%285%20/%202%29.%0A%0AProfStef%20next.")]);
  223. return self;}
  224. }),
  225. smalltalk.SmalltalkSyntaxTutorial);
  226. smalltalk.addMethod(
  227. "_messageSyntaxBinary",
  228. smalltalk.method({
  229. selector: "messageSyntaxBinary",
  230. fn: function () {
  231. var self=this;
  232. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Message syntax: Binary messages", unescape("%22Binary%20messages%20have%20the%20following%20form%3A%0A%20%20%20%20anObject%20+%20anotherObject%22%0A%0A3%20*%202.%0A%0ADate%20today%20year%20%3D%202011.%0A%0Afalse%20%7C%20false.%0A%0Atrue%20%26%20true.%0A%0Atrue%20%26%20false.%0A%0A10%20@%20100.%0A%0A10%20%3C%3D%2012.%0A%0A%27ab%27%2C%20%27cd%27.%0A%0AProfStef%20next.")]);
  233. return self;}
  234. }),
  235. smalltalk.SmalltalkSyntaxTutorial);
  236. smalltalk.addMethod(
  237. "_messageSyntaxCascade",
  238. smalltalk.method({
  239. selector: "messageSyntaxCascade",
  240. fn: function () {
  241. var self=this;
  242. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Message syntax: Cascade", unescape("%22%3B%20is%20the%20cascade%20operator.%20It%27s%20useful%20to%20send%20message%20to%20the%20SAME%20receiver%0AOpen%20a%20Transcript%20%28console%29%3A%22%0A%0ATranscript%20open.%0A%0A%22Then%3A%22%0A%0ATranscript%20show%3A%20%27hello%27.%0ATranscript%20show%3A%20%27Smalltalk%27.%0ATranscript%20cr.%0A%0A%22is%20equivalent%20to%3A%22%0A%0ATranscript%20%0A%09%20%20%20show%3A%20%27hello%27%3B%0A%09%20%20%20show%3A%20%27Smalltalk%27%20%3B%0A%09%20%20%20cr.%0A%0A%22You%20can%20close%20the%20development%20tools%20by%20clicking%20on%20the%20red%20circle%20with%20a%20cross%20at%20the%20bottom%20left%20of%20the%20website.%0ATry%20to%20go%20to%20the%20next%20lesson%20with%20a%20cascade%20of%20two%20%27next%27%20messages%3A%22%0A%0AProfStef")]);
  243. return self;}
  244. }),
  245. smalltalk.SmalltalkSyntaxTutorial);
  246. smalltalk.addMethod(
  247. "_messageSyntaxCascadeShouldNotBeHere",
  248. smalltalk.method({
  249. selector: "messageSyntaxCascadeShouldNotBeHere",
  250. fn: function () {
  251. var self=this;
  252. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", [unescape("Lost%20%3F"), unescape("%22Hey%2C%20you%20should%20not%20be%20here%20%21%21%20%0A%0AGo%20back%20and%20use%20a%20cascade%20%21%22%0A%0AProfStef%20previous.")]);
  253. return self;}
  254. }),
  255. smalltalk.SmalltalkSyntaxTutorial);
  256. smalltalk.addMethod(
  257. "_messageSyntaxExecutionOrder",
  258. smalltalk.method({
  259. selector: "messageSyntaxExecutionOrder",
  260. fn: function () {
  261. var self=this;
  262. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Message syntax: Execution order", unescape("%22Unary%20messages%20are%20executed%20first%2C%20then%20binary%20messages%20and%20finally%20keyword%20messages%3A%0A%20%20%20%20Unary%20%3E%20Binary%20%3E%20Keywords%22%0A%0A2.5%20+%203.8%20rounded.%0A%0A3%20max%3A%202%20+%202.%0A%20%20%0A%280@0%29%20class.%0A%0A0@0%20x%3A%20100.%0A%0A%280@0%20x%3A%20100%29%20class.%0A%0A%22Between%20messages%20of%20similar%20precedence%2C%20expressions%20are%20executed%20from%20left%20to%20right%22%0A%0A-12345%20negated%20asString%20reversed.%0A%0AProfStef%20next.")]);
  263. return self;}
  264. }),
  265. smalltalk.SmalltalkSyntaxTutorial);
  266. smalltalk.addMethod(
  267. "_messageSyntaxExecutionOrderParentheses",
  268. smalltalk.method({
  269. selector: "messageSyntaxExecutionOrderParentheses",
  270. fn: function () {
  271. var self=this;
  272. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Message syntax: Parentheses", unescape("%22Use%20parentheses%20to%20change%20order%20of%20evaluation%22%0A%0A%282.5%20+%203.8%29%20rounded.%0A%0A%283%20max%3A%202%29%20+%202.%0A%0AProfStef%20next.")]);
  273. return self;}
  274. }),
  275. smalltalk.SmalltalkSyntaxTutorial);
  276. smalltalk.addMethod(
  277. "_messageSyntaxKeyword",
  278. smalltalk.method({
  279. selector: "messageSyntaxKeyword",
  280. fn: function () {
  281. var self=this;
  282. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Message syntax: Keyword messages", unescape("%22Keyword%20Messages%20are%20messages%20with%20arguments.%20They%20have%20the%20following%20form%3A%0A%20%20%20%20anObject%20akey%3A%20anotherObject%20akey2%3A%20anotherObject2%22%0A%0A%27Web%20development%20is%20a%20good%20deal%20of%20pain%27%20copyFrom%3A%201%20to%3A%2030%0A%0A%22The%20message%20is%20copyFrom%3Ato%3A%20sent%20to%20the%20String%20%27Web%20development%20is%20a%20good%20deal%20of%20pain%27%22%0A%0A1%20max%3A%203.%0A%0AArray%20with%3A%20%27hello%27%20with%3A%202%20with%3A%20Smalltalk.%0A%0A%22The%20message%20is%20with%3Awith%3Awith%3A%20implemented%20on%20class%20Array.%20Note%20you%20can%20also%20write%22%0A%0AArray%0A%09with%3A%20%27Hi%20there%21%27%0A%09with%3A%202%0A%09with%3A%20Smalltalk.%0A%09%0AProfStef%20perform%3A%20%27next%27.")]);
  283. return self;}
  284. }),
  285. smalltalk.SmalltalkSyntaxTutorial);
  286. smalltalk.addMethod(
  287. "_messageSyntaxUnary",
  288. smalltalk.method({
  289. selector: "messageSyntaxUnary",
  290. fn: function () {
  291. var self=this;
  292. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Message syntax: Unary messages", unescape("%22Messages%20are%20sent%20to%20objects.%20There%20are%20three%20types%20of%20message%3A%20Unary%2C%20Binary%20and%20Keyword.%0A%0AUnary%20messages%20have%20the%20following%20form%3A%0A%20%20%20%20anObject%20aMessage%20%0A%0AYou%27ve%20already%20sent%20unary%20messages.%20For%20example%3A%22%0A%0A1%20class.%0A%0Afalse%20not.%0A%0ADate%20today.%0A%0ANumber%20pi.%0A%0A%22And%20of%20course%3A%20%22%0A%0AProfStef%20next.")]);
  293. return self;}
  294. }),
  295. smalltalk.SmalltalkSyntaxTutorial);
  296. smalltalk.addMethod(
  297. "_pharoEnvironment",
  298. smalltalk.method({
  299. selector: "pharoEnvironment",
  300. fn: function () {
  301. var self=this;
  302. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Pharo environment", unescape("%22Every%20Smalltalk%20system%20is%20full%20of%20objects.%20There%20are%20windows%2C%20text%2C%20numbers%2C%20dates%2C%20colors%2C%20points%20and%20much%20more.%20You%20can%20interact%20with%20objects%20in%20a%20much%20more%20direct%20way%20than%20is%20possible%20with%20other%20programming%20languages.%0A%0AEvery%20object%20understands%20the%20message%20%27explore%27.%20As%20a%20result%2C%20you%20get%20an%20Explorer%20window%20that%20shows%20details%20about%20the%20object.%22%0A%0ADate%20today%20explore.%0A%0A%22This%20shows%20that%20the%20date%20object%20consists%20of%20a%20point%20in%20time%20%28start%29%20and%20a%20duration%20%28one%20day%20long%29.%22%0A%0AProfStef%20explore.%0A%0A%22You%20see%2C%20ProfStef%20class%20has%20a%20lot%20of%20objects.%20Let%27s%20take%20a%20look%20at%20my%20code%3A%22%0A%0AProfStef%20browse.%0A%0AProfStef%20next.")]);
  303. return self;}
  304. }),
  305. smalltalk.SmalltalkSyntaxTutorial);
  306. smalltalk.addMethod(
  307. "_printing",
  308. smalltalk.method({
  309. selector: "printing",
  310. fn: function () {
  311. var self=this;
  312. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Doing VS Printing: Printing", unescape("%22Now%20you%27re%20a%20Do%20It%20master%20%21%20Let%27s%20talk%20about%20printing.%20It%27s%20a%20Do%20It%20which%20prints%20the%20result%20next%20to%20the%20expression%20you%27ve%20selected.%0AFor%20example%2C%20select%20the%20text%20below%2C%20and%20click%20on%20%27PrintIt%27%3A%22%0A%0A1%20+%202.%0A%0A%22As%20with%20%27DoIt%27%2C%20there%20is%20also%20a%20shortcut%20to%20execute%20this%20command.%0A%0ATry%20CTRL-p%20on%20the%20following%20expressions%3A%22%0A%0ADate%20today.%0A%0A%22The%20result%20is%20selected%2C%20so%20you%20can%20erase%20it%20using%20the%20backspace%20key.%20Try%20it%20%21%22%0A%0ADate%20today%20asDateString.%0A%0ADate%20today%20asTimeString.%0A%0AProfStef%20next.")]);
  313. return self;}
  314. }),
  315. smalltalk.SmalltalkSyntaxTutorial);
  316. smalltalk.addMethod(
  317. "_reflection",
  318. smalltalk.method({
  319. selector: "reflection",
  320. fn: function () {
  321. var self=this;
  322. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Reflection", unescape("%22You%20can%20inspect%20and%20change%20the%20system%20at%20runtime.%0A%0ATake%20a%20look%20at%20the%20source%20code%20of%20the%20method%20%23and%3A%20of%20the%20class%20Boolean%3A%22%0A%0A%28Boolean%20methodDictionary%20at%3A%20%27and%3A%27%29%20source.%0A%0A%22Or%20all%20the%20methods%20it%20sends%3A%22%0A%0A%28Boolean%20methodDictionary%20at%3A%20%27and%3A%27%29%20messageSends.%0A%0A%22Here%27s%20all%20the%20methods%20I%20implement%3A%22%0A%0AProfStef%20methodDictionary.%0A%0A%22Let%27s%20create%20a%20new%20method%20to%20go%20to%20the%20next%20lesson%3A%22%0A%0A%7CnewMethod%7C%0AnewMethod%20%3A%3D%20Compiler%20new%20load%3A%20%27goToNextLesson%20ProfStef%20next.%27%20forClass%3A%20ProfStef.%0AProfStef%20class%20addCompiledMethod%3A%20newMethod%0A%0A%22Wow%21%20I%20can%27t%20wait%20to%20use%20my%20new%20method%21%22%0A%0AProfStef%20goToNextLesson.")]);
  323. return self;}
  324. }),
  325. smalltalk.SmalltalkSyntaxTutorial);
  326. smalltalk.addMethod(
  327. "_reflectionContinued",
  328. smalltalk.method({
  329. selector: "reflectionContinued",
  330. fn: function () {
  331. var self=this;
  332. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Reflection continued", unescape("%22So%20cool%2C%20isn%27t%20it%20%3F%20%20Before%20going%20further%2C%20let%27s%20remove%20this%20method%3A%22%0A%0AProfStef%20class%20methodAt%3A%20%23goToNextLesson.%0A%0AProfStef%20class%20removeCompiledMethod%3A%20%28ProfStef%20class%20methodAt%3A%20%23goToNextLesson%29.%0A%0AProfStef%20class%20methodAt%3A%20%23goToNextLesson.%0A%0A%0A%22Then%20move%20forward%3A%22%0A%0AProfStef%20perform%3A%23next")]);
  333. return self;}
  334. }),
  335. smalltalk.SmalltalkSyntaxTutorial);
  336. smalltalk.addMethod(
  337. "_tableOfContents",
  338. smalltalk.method({
  339. selector: "tableOfContents",
  340. fn: function () {
  341. var self=this;
  342. return ["welcome", "doingVSPrinting", "printing", "basicTypesNumbers", "basicTypesString", "basicTypesArray", "basicTypesDynamicArray", "messageSyntaxUnary", "messageSyntaxBinary", "messageSyntaxKeyword", "messageSyntaxExecutionOrder", "messageSyntaxExecutionOrderParentheses", "mathematicalPrecedence", "messageSyntaxCascade", "messageSyntaxCascadeShouldNotBeHere", "blocks", "blocksAssignation", "conditionals", "loops", "iterators", "instanciation", "reflection", "reflectionContinued", "theEnd"];
  343. return self;}
  344. }),
  345. smalltalk.SmalltalkSyntaxTutorial);
  346. smalltalk.addMethod(
  347. "_theEnd",
  348. smalltalk.method({
  349. selector: "theEnd",
  350. fn: function () {
  351. var self=this;
  352. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", [unescape("Tutorial%20done%20%21"), unescape("%22This%20tutorial%20is%20done.%20Enjoy%20programming%20Smalltalk%20with%20JTalk.%20%0A%0AYou%20can%20run%20this%20tutorial%20again%20by%20evaluating%3A%20ProfStef%20go.%0A%0ASee%20you%20soon%20%21%22%0A")]);
  353. return self;}
  354. }),
  355. smalltalk.SmalltalkSyntaxTutorial);
  356. smalltalk.addMethod(
  357. "_welcome",
  358. smalltalk.method({
  359. selector: "welcome",
  360. fn: function () {
  361. var self=this;
  362. return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Welcome", unescape("%20%22Hello%21%20I%27m%20Professor%20Stef.%20%0A%0AYou%20must%20want%20me%20to%20help%20you%20learn%20Smalltalk.%0A%0ASo%20let%27s%20go%20to%20the%20first%20lesson.%20%20Select%20the%20text%20below%20and%20click%20on%20the%20%27DoIt%27%20button%22%0A%0AProfStef%20next.")]);
  363. return self;}
  364. }),
  365. smalltalk.SmalltalkSyntaxTutorial);
  366. smalltalk.addClass('Lesson', smalltalk.Object, ['title', 'contents'], 'TrySmalltalk');
  367. smalltalk.addMethod(
  368. "_contents",
  369. smalltalk.method({
  370. selector: "contents",
  371. fn: function () {
  372. var self=this;
  373. return (($receiver = self['@contents']) == nil || $receiver == undefined) ? (function(){return self['@contents']="";})() : $receiver;
  374. return self;}
  375. }),
  376. smalltalk.Lesson);
  377. smalltalk.addMethod(
  378. "_contents_",
  379. smalltalk.method({
  380. selector: "contents:",
  381. fn: function (aString) {
  382. var self=this;
  383. self['@contents']=aString;
  384. return self;}
  385. }),
  386. smalltalk.Lesson);
  387. smalltalk.addMethod(
  388. "_title",
  389. smalltalk.method({
  390. selector: "title",
  391. fn: function () {
  392. var self=this;
  393. return (($receiver = self['@title']) == nil || $receiver == undefined) ? (function(){return self['@title']="";})() : $receiver;
  394. return self;}
  395. }),
  396. smalltalk.Lesson);
  397. smalltalk.addMethod(
  398. "_title_",
  399. smalltalk.method({
  400. selector: "title:",
  401. fn: function (aString) {
  402. var self=this;
  403. self['@title']=aString;
  404. return self;}
  405. }),
  406. smalltalk.Lesson);
  407. smalltalk.addMethod(
  408. "_title_contents_",
  409. smalltalk.method({
  410. selector: "title:contents:",
  411. fn: function (aTitle, someContents) {
  412. var self=this;
  413. return (function($rec){smalltalk.send($rec, "_title_", [aTitle]);return smalltalk.send($rec, "_contents_", [someContents]);})(smalltalk.send(self, "_new", []));
  414. return self;}
  415. }),
  416. smalltalk.Lesson.klass);
  417. smalltalk.addClass('ProfStef', smalltalk.Object, ['tutorialPlayer', 'widget'], 'TrySmalltalk');
  418. smalltalk.addMethod(
  419. "_first",
  420. smalltalk.method({
  421. selector: "first",
  422. fn: function () {
  423. var self=this;
  424. smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_first", []);
  425. return smalltalk.send(self, "_showCurrentLesson", []);
  426. return self;}
  427. }),
  428. smalltalk.ProfStef);
  429. smalltalk.addMethod(
  430. "_next",
  431. smalltalk.method({
  432. selector: "next",
  433. fn: function () {
  434. var self=this;
  435. smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_next", []);
  436. return smalltalk.send(self, "_showCurrentLesson", []);
  437. return self;}
  438. }),
  439. smalltalk.ProfStef);
  440. smalltalk.addMethod(
  441. "_previous",
  442. smalltalk.method({
  443. selector: "previous",
  444. fn: function () {
  445. var self=this;
  446. smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_previous", []);
  447. return smalltalk.send(self, "_showCurrentLesson", []);
  448. return self;}
  449. }),
  450. smalltalk.ProfStef);
  451. smalltalk.addMethod(
  452. "_progress",
  453. smalltalk.method({
  454. selector: "progress",
  455. fn: function () {
  456. var self=this;
  457. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%28"), "__comma", [smalltalk.send(self, "_tutorialPositionString", [])]), "__comma", [unescape("/")]), "__comma", [smalltalk.send(self, "_tutorialSizeString", [])]), "__comma", [unescape("%29")]);
  458. return self;}
  459. }),
  460. smalltalk.ProfStef);
  461. smalltalk.addMethod(
  462. "_showCurrentLesson",
  463. smalltalk.method({
  464. selector: "showCurrentLesson",
  465. fn: function () {
  466. var self=this;
  467. var lesson=nil;
  468. lesson=smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_currentLesson", []);
  469. smalltalk.send(self['@widget'], "_contents_", [smalltalk.send(lesson, "_contents", [])]);
  470. smalltalk.send(self['@widget'], "_setTitle_", [smalltalk.send(smalltalk.send(smalltalk.send(lesson, "_title", []), "__comma", [" "]), "__comma", [smalltalk.send(self, "_progress", [])])]);
  471. return self;}
  472. }),
  473. smalltalk.ProfStef);
  474. smalltalk.addMethod(
  475. "_tutorialPlayer",
  476. smalltalk.method({
  477. selector: "tutorialPlayer",
  478. fn: function () {
  479. var self=this;
  480. return (($receiver = self['@tutorialPlayer']) == nil || $receiver == undefined) ? (function(){return self['@tutorialPlayer']=smalltalk.send((smalltalk.TutorialPlayer || TutorialPlayer), "_new", []);})() : $receiver;
  481. return self;}
  482. }),
  483. smalltalk.ProfStef);
  484. smalltalk.addMethod(
  485. "_tutorialPositionString",
  486. smalltalk.method({
  487. selector: "tutorialPositionString",
  488. fn: function () {
  489. var self=this;
  490. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_tutorialPosition", []), "_asString", []);
  491. return self;}
  492. }),
  493. smalltalk.ProfStef);
  494. smalltalk.addMethod(
  495. "_tutorialSizeString",
  496. smalltalk.method({
  497. selector: "tutorialSizeString",
  498. fn: function () {
  499. var self=this;
  500. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_size", []), "_asString", []);
  501. return self;}
  502. }),
  503. smalltalk.ProfStef);
  504. smalltalk.addMethod(
  505. "_widget_",
  506. smalltalk.method({
  507. selector: "widget:",
  508. fn: function (aWidget) {
  509. var self=this;
  510. self['@widget']=aWidget;
  511. return self;}
  512. }),
  513. smalltalk.ProfStef);
  514. smalltalk.ProfStef.klass.iVarNames = ['instance'];
  515. smalltalk.addMethod(
  516. "_default",
  517. smalltalk.method({
  518. selector: "default",
  519. fn: function () {
  520. var self=this;
  521. return (($receiver = self['@instance']) == nil || $receiver == undefined) ? (function(){return self['@instance']=smalltalk.send(self, "_new", []);})() : $receiver;
  522. return self;}
  523. }),
  524. smalltalk.ProfStef.klass);
  525. smalltalk.addMethod(
  526. "_first",
  527. smalltalk.method({
  528. selector: "first",
  529. fn: function () {
  530. var self=this;
  531. return smalltalk.send(smalltalk.send(self, "_default", []), "_first", []);
  532. return self;}
  533. }),
  534. smalltalk.ProfStef.klass);
  535. smalltalk.addMethod(
  536. "_go",
  537. smalltalk.method({
  538. selector: "go",
  539. fn: function () {
  540. var self=this;
  541. smalltalk.send(self, "_first", []);
  542. return self;}
  543. }),
  544. smalltalk.ProfStef.klass);
  545. smalltalk.addMethod(
  546. "_next",
  547. smalltalk.method({
  548. selector: "next",
  549. fn: function () {
  550. var self=this;
  551. return smalltalk.send(smalltalk.send(self, "_default", []), "_next", []);
  552. return self;}
  553. }),
  554. smalltalk.ProfStef.klass);
  555. smalltalk.addMethod(
  556. "_previous",
  557. smalltalk.method({
  558. selector: "previous",
  559. fn: function () {
  560. var self=this;
  561. return smalltalk.send(smalltalk.send(self, "_default", []), "_previous", []);
  562. return self;}
  563. }),
  564. smalltalk.ProfStef.klass);
  565. smalltalk.addClass('TrySmalltalkWidget', smalltalk.Widget, ['workspace', 'contents', 'header'], 'TrySmalltalk');
  566. smalltalk.addMethod(
  567. "_contents",
  568. smalltalk.method({
  569. selector: "contents",
  570. fn: function () {
  571. var self=this;
  572. return smalltalk.send(smalltalk.send(self, "_workspace", []), "_val", []);
  573. return self;}
  574. }),
  575. smalltalk.TrySmalltalkWidget);
  576. smalltalk.addMethod(
  577. "_contents_",
  578. smalltalk.method({
  579. selector: "contents:",
  580. fn: function (aString) {
  581. var self=this;
  582. smalltalk.send(smalltalk.send(self, "_workspace", []), "_val_", [aString]);
  583. return self;}
  584. }),
  585. smalltalk.TrySmalltalkWidget);
  586. smalltalk.addMethod(
  587. "_renderButtonsOn_",
  588. smalltalk.method({
  589. selector: "renderButtonsOn:",
  590. fn: function (html) {
  591. var self=this;
  592. (function($rec){smalltalk.send($rec, "_with_", ["DoIt"]);smalltalk.send($rec, "_title_", [unescape("ctrl+d")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_doIt", []);})]);})(smalltalk.send(html, "_button", []));
  593. (function($rec){smalltalk.send($rec, "_with_", ["PrintIt"]);smalltalk.send($rec, "_title_", [unescape("ctrl+p")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_printIt", []);})]);})(smalltalk.send(html, "_button", []));
  594. (function($rec){smalltalk.send($rec, "_with_", ["InspectIt"]);smalltalk.send($rec, "_title_", [unescape("ctrl+i")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_inspectIt", []);})]);})(smalltalk.send(html, "_button", []));
  595. return self;}
  596. }),
  597. smalltalk.TrySmalltalkWidget);
  598. smalltalk.addMethod(
  599. "_renderOn_",
  600. smalltalk.method({
  601. selector: "renderOn:",
  602. fn: function (html) {
  603. var self=this;
  604. (function($rec){smalltalk.send($rec, "_class_", ["profStef"]);smalltalk.send($rec, "_with_", [(function(){return self['@header']=smalltalk.send(html, "_h2", []);})]);smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_renderOn_", [html]);})]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(self, "_renderButtonsOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
  605. (function($rec){smalltalk.send($rec, "_widget_", [self]);return smalltalk.send($rec, "_showCurrentLesson", []);})(smalltalk.send((smalltalk.ProfStef || ProfStef), "_default", []));
  606. return self;}
  607. }),
  608. smalltalk.TrySmalltalkWidget);
  609. smalltalk.addMethod(
  610. "_setTitle_",
  611. smalltalk.method({
  612. selector: "setTitle:",
  613. fn: function (aString) {
  614. var self=this;
  615. smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [aString]);})]);
  616. return self;}
  617. }),
  618. smalltalk.TrySmalltalkWidget);
  619. smalltalk.addMethod(
  620. "_workspace",
  621. smalltalk.method({
  622. selector: "workspace",
  623. fn: function () {
  624. var self=this;
  625. return (($receiver = self['@workspace']) == nil || $receiver == undefined) ? (function(){return self['@workspace']=smalltalk.send((smalltalk.SourceArea || SourceArea), "_new", []);})() : $receiver;
  626. return self;}
  627. }),
  628. smalltalk.TrySmalltalkWidget);
  629. smalltalk.addMethod(
  630. "_open",
  631. smalltalk.method({
  632. selector: "open",
  633. fn: function () {
  634. var self=this;
  635. smalltalk.send(smalltalk.send(self, "_new", []), "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
  636. return self;}
  637. }),
  638. smalltalk.TrySmalltalkWidget.klass);
  639. smalltalk.addClass('TutorialPlayer', smalltalk.Object, ['tutorialPosition', 'tutorial'], 'TrySmalltalk');
  640. smalltalk.addMethod(
  641. "_currentLesson",
  642. smalltalk.method({
  643. selector: "currentLesson",
  644. fn: function () {
  645. var self=this;
  646. return smalltalk.send(smalltalk.send(self, "_tutorial", []), "_lessonAt_", [smalltalk.send(self, "_tutorialPosition", [])]);
  647. return self;}
  648. }),
  649. smalltalk.TutorialPlayer);
  650. smalltalk.addMethod(
  651. "_first",
  652. smalltalk.method({
  653. selector: "first",
  654. fn: function () {
  655. var self=this;
  656. smalltalk.send(self, "_rewind", []);
  657. return smalltalk.send(self, "_currentLesson", []);
  658. return self;}
  659. }),
  660. smalltalk.TutorialPlayer);
  661. smalltalk.addMethod(
  662. "_last",
  663. smalltalk.method({
  664. selector: "last",
  665. fn: function () {
  666. var self=this;
  667. self['@tutorialPosition']=smalltalk.send(self, "_size", []);
  668. return smalltalk.send(self, "_currentLesson", []);
  669. return self;}
  670. }),
  671. smalltalk.TutorialPlayer);
  672. smalltalk.addMethod(
  673. "_next",
  674. smalltalk.method({
  675. selector: "next",
  676. fn: function () {
  677. var self=this;
  678. (($receiver = (($receiver = smalltalk.send(self, "_tutorialPosition", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(self, "_size", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(self, "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})]);
  679. return smalltalk.send(self, "_currentLesson", []);
  680. return self;}
  681. }),
  682. smalltalk.TutorialPlayer);
  683. smalltalk.addMethod(
  684. "_previous",
  685. smalltalk.method({
  686. selector: "previous",
  687. fn: function () {
  688. var self=this;
  689. (($receiver = (($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver >(1) : smalltalk.send($receiver, "__gt", [(1)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})]);
  690. return smalltalk.send(self, "_currentLesson", []);
  691. return self;}
  692. }),
  693. smalltalk.TutorialPlayer);
  694. smalltalk.addMethod(
  695. "_rewind",
  696. smalltalk.method({
  697. selector: "rewind",
  698. fn: function () {
  699. var self=this;
  700. self['@tutorialPosition']=(1);
  701. return self;}
  702. }),
  703. smalltalk.TutorialPlayer);
  704. smalltalk.addMethod(
  705. "_size",
  706. smalltalk.method({
  707. selector: "size",
  708. fn: function () {
  709. var self=this;
  710. return smalltalk.send(smalltalk.send(self, "_tutorial", []), "_size", []);
  711. return self;}
  712. }),
  713. smalltalk.TutorialPlayer);
  714. smalltalk.addMethod(
  715. "_tutorial",
  716. smalltalk.method({
  717. selector: "tutorial",
  718. fn: function () {
  719. var self=this;
  720. return (($receiver = self['@tutorial']) == nil || $receiver == undefined) ? (function(){return self['@tutorial']=smalltalk.send((smalltalk.SmalltalkSyntaxTutorial || SmalltalkSyntaxTutorial), "_new", []);})() : $receiver;
  721. return self;}
  722. }),
  723. smalltalk.TutorialPlayer);
  724. smalltalk.addMethod(
  725. "_tutorial_",
  726. smalltalk.method({
  727. selector: "tutorial:",
  728. fn: function (aTutorial) {
  729. var self=this;
  730. self['@tutorial']=aTutorial;
  731. return self;}
  732. }),
  733. smalltalk.TutorialPlayer);
  734. smalltalk.addMethod(
  735. "_tutorialPosition",
  736. smalltalk.method({
  737. selector: "tutorialPosition",
  738. fn: function () {
  739. var self=this;
  740. return (($receiver = self['@tutorialPosition']) == nil || $receiver == undefined) ? (function(){smalltalk.send(self, "_rewind", []);return self['@tutorialPosition'];})() : $receiver;
  741. return self;}
  742. }),
  743. smalltalk.TutorialPlayer);
  744. smalltalk.addMethod(
  745. "_tutorialPosition_",
  746. smalltalk.method({
  747. selector: "tutorialPosition:",
  748. fn: function (aTutorialPosition) {
  749. var self=this;
  750. self['@tutorialPosition']=aTutorialPosition;
  751. return self;}
  752. }),
  753. smalltalk.TutorialPlayer);