Trapped-Frontend.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371
  1. define("gh_herby_trapped/Trapped-Frontend", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Canvas", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Trapped-Frontend');
  3. smalltalk.packages["Trapped-Frontend"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"};
  4. smalltalk.addClass('TrappedDataCarrier', smalltalk.Object, ['target', 'model', 'chain'], 'Trapped-Frontend');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "chain:",
  8. category: 'accessing',
  9. fn: function (aDataChain){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) {
  12. self["@chain"]=aDataChain;
  13. return self}, function($ctx1) {$ctx1.fill(self,"chain:",{aDataChain:aDataChain},smalltalk.TrappedDataCarrier)})},
  14. args: ["aDataChain"],
  15. source: "chain: aDataChain\x0a\x09chain := aDataChain",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. smalltalk.TrappedDataCarrier);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "modifyTarget",
  23. category: 'action',
  24. fn: function (){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) {
  27. _st(self._target())._modify_((function(){
  28. return smalltalk.withContext(function($ctx2) {
  29. return self._value();
  30. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31. return self}, function($ctx1) {$ctx1.fill(self,"modifyTarget",{},smalltalk.TrappedDataCarrier)})},
  32. args: [],
  33. source: "modifyTarget\x0a\x09self target modify: [ self value ]",
  34. messageSends: ["modify:", "target", "value"],
  35. referencedClasses: []
  36. }),
  37. smalltalk.TrappedDataCarrier);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "target",
  41. category: 'accessing',
  42. fn: function (){
  43. var self=this;
  44. return smalltalk.withContext(function($ctx1) {
  45. var $1;
  46. $1=self["@target"];
  47. return $1;
  48. }, function($ctx1) {$ctx1.fill(self,"target",{},smalltalk.TrappedDataCarrier)})},
  49. args: [],
  50. source: "target\x0a\x09^target",
  51. messageSends: [],
  52. referencedClasses: []
  53. }),
  54. smalltalk.TrappedDataCarrier);
  55. smalltalk.addMethod(
  56. smalltalk.method({
  57. selector: "target:",
  58. category: 'accessing',
  59. fn: function (anObject){
  60. var self=this;
  61. return smalltalk.withContext(function($ctx1) {
  62. self["@target"]=anObject;
  63. return self}, function($ctx1) {$ctx1.fill(self,"target:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  64. args: ["anObject"],
  65. source: "target: anObject\x0a\x09target := anObject",
  66. messageSends: [],
  67. referencedClasses: []
  68. }),
  69. smalltalk.TrappedDataCarrier);
  70. smalltalk.addMethod(
  71. smalltalk.method({
  72. selector: "toTargetAttr:",
  73. category: 'action',
  74. fn: function (aString){
  75. var self=this;
  76. return smalltalk.withContext(function($ctx1) {
  77. var $1,$3,$2;
  78. $1=_st(self._target())._asJQuery();
  79. $3=self._value();
  80. $ctx1.sendIdx["value"]=1;
  81. if(($receiver = $3) == nil || $receiver == null){
  82. $2=(function(){
  83. return smalltalk.withContext(function($ctx2) {
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})});
  85. } else {
  86. var o;
  87. o=$receiver;
  88. $2=_st(o)._value();
  89. };
  90. _st($1)._attr_put_(aString,$2);
  91. return self}, function($ctx1) {$ctx1.fill(self,"toTargetAttr:",{aString:aString},smalltalk.TrappedDataCarrier)})},
  92. args: ["aString"],
  93. source: "toTargetAttr: aString\x0a\x09self target asJQuery attr: aString put: (self value ifNotNil: [ :o | o value ] ifNil: [[]])",
  94. messageSends: ["attr:put:", "asJQuery", "target", "ifNotNil:ifNil:", "value"],
  95. referencedClasses: []
  96. }),
  97. smalltalk.TrappedDataCarrier);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "toTargetContents",
  101. category: 'action',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. _st(self._target())._contents_(self._value());
  106. return self}, function($ctx1) {$ctx1.fill(self,"toTargetContents",{},smalltalk.TrappedDataCarrier)})},
  107. args: [],
  108. source: "toTargetContents\x0a\x09self target contents: self value",
  109. messageSends: ["contents:", "target", "value"],
  110. referencedClasses: []
  111. }),
  112. smalltalk.TrappedDataCarrier);
  113. smalltalk.addMethod(
  114. smalltalk.method({
  115. selector: "toTargetValue",
  116. category: 'action',
  117. fn: function (){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) {
  120. var $1,$3,$2;
  121. $1=_st(self._target())._asJQuery();
  122. $3=self._value();
  123. $ctx1.sendIdx["value"]=1;
  124. if(($receiver = $3) == nil || $receiver == null){
  125. $2=(function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})});
  128. } else {
  129. var o;
  130. o=$receiver;
  131. $2=_st(o)._value();
  132. };
  133. _st($1)._val_($2);
  134. return self}, function($ctx1) {$ctx1.fill(self,"toTargetValue",{},smalltalk.TrappedDataCarrier)})},
  135. args: [],
  136. source: "toTargetValue\x0a\x09self target asJQuery val: (self value ifNotNil: [ :o | o value ] ifNil: [[]])",
  137. messageSends: ["val:", "asJQuery", "target", "ifNotNil:ifNil:", "value"],
  138. referencedClasses: []
  139. }),
  140. smalltalk.TrappedDataCarrier);
  141. smalltalk.addMethod(
  142. smalltalk.method({
  143. selector: "value",
  144. category: 'accessing',
  145. fn: function (){
  146. var self=this;
  147. return smalltalk.withContext(function($ctx1) {
  148. var $1;
  149. $1=self["@model"];
  150. return $1;
  151. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.TrappedDataCarrier)})},
  152. args: [],
  153. source: "value\x0a\x09^model",
  154. messageSends: [],
  155. referencedClasses: []
  156. }),
  157. smalltalk.TrappedDataCarrier);
  158. smalltalk.addMethod(
  159. smalltalk.method({
  160. selector: "value:",
  161. category: 'accessing',
  162. fn: function (anObject){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) {
  165. self["@model"]=anObject;
  166. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  167. args: ["anObject"],
  168. source: "value: anObject\x0a\x09model := anObject",
  169. messageSends: [],
  170. referencedClasses: []
  171. }),
  172. smalltalk.TrappedDataCarrier);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "on:target:",
  176. category: 'not yet classified',
  177. fn: function (aDataChain,anObject){
  178. var self=this;
  179. return smalltalk.withContext(function($ctx1) {
  180. var $2,$3,$1;
  181. $2=self._new();
  182. _st($2)._chain_(aDataChain);
  183. _st($2)._target_(anObject);
  184. $3=_st($2)._yourself();
  185. $1=$3;
  186. return $1;
  187. }, function($ctx1) {$ctx1.fill(self,"on:target:",{aDataChain:aDataChain,anObject:anObject},smalltalk.TrappedDataCarrier.klass)})},
  188. args: ["aDataChain", "anObject"],
  189. source: "on: aDataChain target: anObject\x0a\x09^self new\x0a\x09\x09chain: aDataChain;\x0a\x09\x09target: anObject;\x0a\x09\x09yourself",
  190. messageSends: ["chain:", "new", "target:", "yourself"],
  191. referencedClasses: []
  192. }),
  193. smalltalk.TrappedDataCarrier.klass);
  194. smalltalk.addClass('TrappedDataCarrierToModel', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  195. smalltalk.addMethod(
  196. smalltalk.method({
  197. selector: "proceed",
  198. category: 'not yet classified',
  199. fn: function (){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) {
  202. var $1;
  203. $1=self["@index"];
  204. if(($receiver = $1) == nil || $receiver == null){
  205. self["@index"]=_st(self["@chain"])._lastProcessorNo();
  206. } else {
  207. self["@index"]=_st(self["@index"]).__minus((1));
  208. };
  209. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toModel_(self);
  210. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToModel)})},
  211. args: [],
  212. source: "proceed\x0a\x09index := index ifNil: [ chain lastProcessorNo ] ifNotNil: [ index - 1 ].\x0a\x09(chain processorNo: index) toModel: self",
  213. messageSends: ["ifNil:ifNotNil:", "lastProcessorNo", "-", "toModel:", "processorNo:"],
  214. referencedClasses: []
  215. }),
  216. smalltalk.TrappedDataCarrierToModel);
  217. smalltalk.addClass('TrappedDataCarrierToView', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  218. smalltalk.addMethod(
  219. smalltalk.method({
  220. selector: "proceed",
  221. category: 'not yet classified',
  222. fn: function (){
  223. var self=this;
  224. return smalltalk.withContext(function($ctx1) {
  225. var $1;
  226. $1=self["@index"];
  227. if(($receiver = $1) == nil || $receiver == null){
  228. self["@index"]=_st(self["@chain"])._firstProcessorNo();
  229. } else {
  230. self["@index"]=_st(self["@index"]).__plus((1));
  231. };
  232. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toView_(self);
  233. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToView)})},
  234. args: [],
  235. source: "proceed\x0a\x09index := index ifNil: [ chain firstProcessorNo ] ifNotNil: [ index + 1 ].\x0a\x09(chain processorNo: index) toView: self",
  236. messageSends: ["ifNil:ifNotNil:", "firstProcessorNo", "+", "toView:", "processorNo:"],
  237. referencedClasses: []
  238. }),
  239. smalltalk.TrappedDataCarrierToView);
  240. smalltalk.addClass('TrappedDataChain', smalltalk.Object, ['processors'], 'Trapped-Frontend');
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "firstProcessorNo",
  244. category: 'accessing',
  245. fn: function (){
  246. var self=this;
  247. return smalltalk.withContext(function($ctx1) {
  248. return (1);
  249. }, function($ctx1) {$ctx1.fill(self,"firstProcessorNo",{},smalltalk.TrappedDataChain)})},
  250. args: [],
  251. source: "firstProcessorNo\x0a\x09^1",
  252. messageSends: [],
  253. referencedClasses: []
  254. }),
  255. smalltalk.TrappedDataChain);
  256. smalltalk.addMethod(
  257. smalltalk.method({
  258. selector: "forSnapshot:andBrush:",
  259. category: 'action',
  260. fn: function (aSnapshot,aTagBrush){
  261. var self=this;
  262. var toViewCarrier,toModelCarrier;
  263. function $TrappedDataCarrierToView(){return smalltalk.TrappedDataCarrierToView||(typeof TrappedDataCarrierToView=="undefined"?nil:TrappedDataCarrierToView)}
  264. function $TrappedDataCarrierToModel(){return smalltalk.TrappedDataCarrierToModel||(typeof TrappedDataCarrierToModel=="undefined"?nil:TrappedDataCarrierToModel)}
  265. return smalltalk.withContext(function($ctx1) {
  266. toViewCarrier=_st($TrappedDataCarrierToView())._on_target_(self,aTagBrush);
  267. $ctx1.sendIdx["on:target:"]=1;
  268. toModelCarrier=_st($TrappedDataCarrierToModel())._on_target_(self,aSnapshot);
  269. _st(self["@processors"])._do_((function(each){
  270. return smalltalk.withContext(function($ctx2) {
  271. return _st(each)._installToView_toModel_(toViewCarrier,toModelCarrier);
  272. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  273. return self}, function($ctx1) {$ctx1.fill(self,"forSnapshot:andBrush:",{aSnapshot:aSnapshot,aTagBrush:aTagBrush,toViewCarrier:toViewCarrier,toModelCarrier:toModelCarrier},smalltalk.TrappedDataChain)})},
  274. args: ["aSnapshot", "aTagBrush"],
  275. source: "forSnapshot: aSnapshot andBrush: aTagBrush\x0a\x09| toViewCarrier toModelCarrier |\x0a\x09toViewCarrier := TrappedDataCarrierToView on: self target: aTagBrush.\x0a\x09toModelCarrier := TrappedDataCarrierToModel on: self target: aSnapshot.\x0a\x09processors do: [ :each | each installToView: toViewCarrier toModel: toModelCarrier ]",
  276. messageSends: ["on:target:", "do:", "installToView:toModel:"],
  277. referencedClasses: ["TrappedDataCarrierToView", "TrappedDataCarrierToModel"]
  278. }),
  279. smalltalk.TrappedDataChain);
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: "lastProcessorNo",
  283. category: 'accessing',
  284. fn: function (){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var $1;
  288. $1=_st(self["@processors"])._size();
  289. return $1;
  290. }, function($ctx1) {$ctx1.fill(self,"lastProcessorNo",{},smalltalk.TrappedDataChain)})},
  291. args: [],
  292. source: "lastProcessorNo\x0a\x09^processors size",
  293. messageSends: ["size"],
  294. referencedClasses: []
  295. }),
  296. smalltalk.TrappedDataChain);
  297. smalltalk.addMethod(
  298. smalltalk.method({
  299. selector: "processorNo:",
  300. category: 'accessing',
  301. fn: function (aNumber){
  302. var self=this;
  303. return smalltalk.withContext(function($ctx1) {
  304. var $1;
  305. $1=_st(self["@processors"])._at_(aNumber);
  306. return $1;
  307. }, function($ctx1) {$ctx1.fill(self,"processorNo:",{aNumber:aNumber},smalltalk.TrappedDataChain)})},
  308. args: ["aNumber"],
  309. source: "processorNo: aNumber\x0a\x09^processors at: aNumber",
  310. messageSends: ["at:"],
  311. referencedClasses: []
  312. }),
  313. smalltalk.TrappedDataChain);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "processors:",
  317. category: 'accessing',
  318. fn: function (anArray){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) {
  321. self["@processors"]=anArray;
  322. return self}, function($ctx1) {$ctx1.fill(self,"processors:",{anArray:anArray},smalltalk.TrappedDataChain)})},
  323. args: ["anArray"],
  324. source: "processors: anArray\x0a\x09processors := anArray",
  325. messageSends: [],
  326. referencedClasses: []
  327. }),
  328. smalltalk.TrappedDataChain);
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "blackboardReaderWriter",
  332. category: 'private',
  333. fn: function (){
  334. var self=this;
  335. function $TrappedProcessorBlackboard(){return smalltalk.TrappedProcessorBlackboard||(typeof TrappedProcessorBlackboard=="undefined"?nil:TrappedProcessorBlackboard)}
  336. return smalltalk.withContext(function($ctx1) {
  337. var $1;
  338. $1=_st($TrappedProcessorBlackboard())._new();
  339. return $1;
  340. }, function($ctx1) {$ctx1.fill(self,"blackboardReaderWriter",{},smalltalk.TrappedDataChain.klass)})},
  341. args: [],
  342. source: "blackboardReaderWriter\x0a\x09^TrappedProcessorBlackboard new",
  343. messageSends: ["new"],
  344. referencedClasses: ["TrappedProcessorBlackboard"]
  345. }),
  346. smalltalk.TrappedDataChain.klass);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "new:",
  350. category: 'instance creation',
  351. fn: function (anArray){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) {
  354. var $2,$3,$1;
  355. $2=self._new();
  356. _st($2)._processors_(_st([self._blackboardReaderWriter()]).__comma(anArray));
  357. $3=_st($2)._yourself();
  358. $1=$3;
  359. return $1;
  360. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedDataChain.klass)})},
  361. args: ["anArray"],
  362. source: "new: anArray\x0a\x09^self new\x0a\x09\x09processors: { self blackboardReaderWriter }, anArray;\x0a\x09\x09yourself",
  363. messageSends: ["processors:", "new", ",", "blackboardReaderWriter", "yourself"],
  364. referencedClasses: []
  365. }),
  366. smalltalk.TrappedDataChain.klass);
  367. smalltalk.addMethod(
  368. smalltalk.method({
  369. selector: "newFromProcessorNames:",
  370. category: 'instance creation',
  371. fn: function (anArray){
  372. var self=this;
  373. function $TrappedProcessor(){return smalltalk.TrappedProcessor||(typeof TrappedProcessor=="undefined"?nil:TrappedProcessor)}
  374. return smalltalk.withContext(function($ctx1) {
  375. var $1;
  376. $1=self._new_(_st(anArray)._collect_((function(each){
  377. return smalltalk.withContext(function($ctx2) {
  378. return _st($TrappedProcessor())._perform_(each);
  379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  380. return $1;
  381. }, function($ctx1) {$ctx1.fill(self,"newFromProcessorNames:",{anArray:anArray},smalltalk.TrappedDataChain.klass)})},
  382. args: ["anArray"],
  383. source: "newFromProcessorNames: anArray\x0a\x09^self new: (anArray collect: [ :each | TrappedProcessor perform: each ])",
  384. messageSends: ["new:", "collect:", "perform:"],
  385. referencedClasses: ["TrappedProcessor"]
  386. }),
  387. smalltalk.TrappedDataChain.klass);
  388. smalltalk.addClass('TrappedDumbView', smalltalk.Widget, [], 'Trapped-Frontend');
  389. smalltalk.TrappedDumbView.comment="I just read and show an actual path.";
  390. smalltalk.addMethod(
  391. smalltalk.method({
  392. selector: "renderOn:",
  393. category: 'rendering',
  394. fn: function (html){
  395. var self=this;
  396. return smalltalk.withContext(function($ctx1) {
  397. _st(_st(html)._root())._trap_([]);
  398. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.TrappedDumbView)})},
  399. args: ["html"],
  400. source: "renderOn: html\x0a\x09html root trap: #()",
  401. messageSends: ["trap:", "root"],
  402. referencedClasses: []
  403. }),
  404. smalltalk.TrappedDumbView);
  405. smalltalk.addClass('TrappedProcessor', smalltalk.Object, [], 'Trapped-Frontend');
  406. smalltalk.TrappedProcessor.comment="I process data in TrappedDataChain.\x0aI am stateless flyweight (aka servant)\x0aand will get all necessary data as arguments in API calls.\x0a\x0aMy public API is:\x0a - installToView:toModel:\x0a This gets two TrappedDataCarriers set up without actual data\x0a and at the beginning of their chains. It should do one-time\x0a installation task needed (install event handlers etc.).\x0a To start a chain, do: dataCarrier copy value: data; proceed.\x0a - toView:\x0a This performs transformation of TrappedDataCarrier on its way from model to view.\x0a Should call aDataCarrier proceed to proceed to subsequent step.\x0a - toModel:\x0a This performs transformation of TrappedDataToken on its way from view to model.\x0a Should call aDataCarrier proceed to proceed to subsequent step.\x0a";
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "installToView:toModel:",
  410. category: 'installation',
  411. fn: function (aDataCarrier,anotherDataCarrier){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessor)})},
  415. args: ["aDataCarrier", "anotherDataCarrier"],
  416. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09\x22by default, do nothing\x22",
  417. messageSends: [],
  418. referencedClasses: []
  419. }),
  420. smalltalk.TrappedProcessor);
  421. smalltalk.addMethod(
  422. smalltalk.method({
  423. selector: "toModel:",
  424. category: 'data transformation',
  425. fn: function (aDataCarrier){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) {
  428. _st(aDataCarrier)._proceed();
  429. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  430. args: ["aDataCarrier"],
  431. source: "toModel: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  432. messageSends: ["proceed"],
  433. referencedClasses: []
  434. }),
  435. smalltalk.TrappedProcessor);
  436. smalltalk.addMethod(
  437. smalltalk.method({
  438. selector: "toView:",
  439. category: 'data transformation',
  440. fn: function (aDataCarrier){
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) {
  443. _st(aDataCarrier)._proceed();
  444. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  445. args: ["aDataCarrier"],
  446. source: "toView: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  447. messageSends: ["proceed"],
  448. referencedClasses: []
  449. }),
  450. smalltalk.TrappedProcessor);
  451. smalltalk.addMethod(
  452. smalltalk.method({
  453. selector: "contents",
  454. category: 'factory',
  455. fn: function (){
  456. var self=this;
  457. function $TrappedProcessorContents(){return smalltalk.TrappedProcessorContents||(typeof TrappedProcessorContents=="undefined"?nil:TrappedProcessorContents)}
  458. return smalltalk.withContext(function($ctx1) {
  459. var $1;
  460. $1=_st($TrappedProcessorContents())._new();
  461. return $1;
  462. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrappedProcessor.klass)})},
  463. args: [],
  464. source: "contents\x0a\x09^TrappedProcessorContents new",
  465. messageSends: ["new"],
  466. referencedClasses: ["TrappedProcessorContents"]
  467. }),
  468. smalltalk.TrappedProcessor.klass);
  469. smalltalk.addMethod(
  470. smalltalk.method({
  471. selector: "inputChecked",
  472. category: 'factory',
  473. fn: function (){
  474. var self=this;
  475. function $TrappedProcessorInputChecked(){return smalltalk.TrappedProcessorInputChecked||(typeof TrappedProcessorInputChecked=="undefined"?nil:TrappedProcessorInputChecked)}
  476. return smalltalk.withContext(function($ctx1) {
  477. var $1;
  478. $1=_st($TrappedProcessorInputChecked())._new();
  479. return $1;
  480. }, function($ctx1) {$ctx1.fill(self,"inputChecked",{},smalltalk.TrappedProcessor.klass)})},
  481. args: [],
  482. source: "inputChecked\x0a\x09^TrappedProcessorInputChecked new",
  483. messageSends: ["new"],
  484. referencedClasses: ["TrappedProcessorInputChecked"]
  485. }),
  486. smalltalk.TrappedProcessor.klass);
  487. smalltalk.addMethod(
  488. smalltalk.method({
  489. selector: "inputValue",
  490. category: 'factory',
  491. fn: function (){
  492. var self=this;
  493. function $TrappedProcessorInputValue(){return smalltalk.TrappedProcessorInputValue||(typeof TrappedProcessorInputValue=="undefined"?nil:TrappedProcessorInputValue)}
  494. return smalltalk.withContext(function($ctx1) {
  495. var $1;
  496. $1=_st($TrappedProcessorInputValue())._new();
  497. return $1;
  498. }, function($ctx1) {$ctx1.fill(self,"inputValue",{},smalltalk.TrappedProcessor.klass)})},
  499. args: [],
  500. source: "inputValue\x0a\x09^TrappedProcessorInputValue new",
  501. messageSends: ["new"],
  502. referencedClasses: ["TrappedProcessorInputValue"]
  503. }),
  504. smalltalk.TrappedProcessor.klass);
  505. smalltalk.addClass('TrappedProcessorBlackboard', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  506. smalltalk.TrappedProcessorBlackboard.comment="I am used internally to fetch data from blackboard\x0aor write it back.";
  507. smalltalk.addMethod(
  508. smalltalk.method({
  509. selector: "installToView:toModel:",
  510. category: 'installation',
  511. fn: function (aDataCarrier,anotherDataCarrier){
  512. var self=this;
  513. var snap;
  514. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  515. return smalltalk.withContext(function($ctx1) {
  516. var $1,$2,$3;
  517. snap=_st(anotherDataCarrier)._target();
  518. $ctx1.sendIdx["target"]=1;
  519. _st(snap)._watch_((function(data){
  520. return smalltalk.withContext(function($ctx2) {
  521. $1=_st(_st(_st(_st(_st(aDataCarrier)._target())._asJQuery())._closest_("html"))._toArray())._isEmpty();
  522. if(smalltalk.assert($1)){
  523. _st($KeyedPubSubUnsubscribe())._signal();
  524. };
  525. return _st(snap)._do_((function(){
  526. return smalltalk.withContext(function($ctx3) {
  527. $2=_st(aDataCarrier)._copy();
  528. _st($2)._value_(data);
  529. $3=_st($2)._proceed();
  530. return $3;
  531. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  532. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,1)})}));
  533. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,snap:snap},smalltalk.TrappedProcessorBlackboard)})},
  534. args: ["aDataCarrier", "anotherDataCarrier"],
  535. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| snap |\x0a\x09snap := anotherDataCarrier target.\x0a\x09snap watch: [ :data |\x0a\x09\x09(aDataCarrier target asJQuery closest: 'html') toArray isEmpty ifTrue: [ KeyedPubSubUnsubscribe signal ].\x0a snap do: [ aDataCarrier copy value: data; proceed ] ]",
  536. messageSends: ["target", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "value:", "copy", "proceed"],
  537. referencedClasses: ["KeyedPubSubUnsubscribe"]
  538. }),
  539. smalltalk.TrappedProcessorBlackboard);
  540. smalltalk.addMethod(
  541. smalltalk.method({
  542. selector: "toModel:",
  543. category: 'data transformation',
  544. fn: function (aDataCarrier){
  545. var self=this;
  546. return smalltalk.withContext(function($ctx1) {
  547. _st(aDataCarrier)._modifyTarget();
  548. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorBlackboard)})},
  549. args: ["aDataCarrier"],
  550. source: "toModel: aDataCarrier\x0a\x09aDataCarrier modifyTarget",
  551. messageSends: ["modifyTarget"],
  552. referencedClasses: []
  553. }),
  554. smalltalk.TrappedProcessorBlackboard);
  555. smalltalk.addClass('TrappedProcessorContents', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  556. smalltalk.TrappedProcessorContents.comment="I put data into target via contents: in toView:";
  557. smalltalk.addMethod(
  558. smalltalk.method({
  559. selector: "toView:",
  560. category: 'data transformation',
  561. fn: function (aDataCarrier){
  562. var self=this;
  563. return smalltalk.withContext(function($ctx1) {
  564. _st(aDataCarrier)._toTargetContents();
  565. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorContents)})},
  566. args: ["aDataCarrier"],
  567. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetContents",
  568. messageSends: ["toTargetContents"],
  569. referencedClasses: []
  570. }),
  571. smalltalk.TrappedProcessorContents);
  572. smalltalk.addClass('TrappedProcessorInputChecked', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  573. smalltalk.TrappedProcessorInputChecked.comment="I bind to checkbox checked attribute.";
  574. smalltalk.addMethod(
  575. smalltalk.method({
  576. selector: "installToView:toModel:",
  577. category: 'installation',
  578. fn: function (aDataCarrier,anotherDataCarrier){
  579. var self=this;
  580. var brush;
  581. return smalltalk.withContext(function($ctx1) {
  582. var $1,$2;
  583. brush=_st(aDataCarrier)._target();
  584. _st(brush)._onChange_((function(){
  585. return smalltalk.withContext(function($ctx2) {
  586. $1=_st(anotherDataCarrier)._copy();
  587. _st($1)._value_(_st(_st(_st(brush)._asJQuery())._attr_("checked"))._notNil());
  588. $2=_st($1)._proceed();
  589. return $2;
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  591. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputChecked)})},
  592. args: ["aDataCarrier", "anotherDataCarrier"],
  593. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: (brush asJQuery attr: 'checked') notNil; proceed ]",
  594. messageSends: ["target", "onChange:", "value:", "copy", "notNil", "attr:", "asJQuery", "proceed"],
  595. referencedClasses: []
  596. }),
  597. smalltalk.TrappedProcessorInputChecked);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "toView:",
  601. category: 'data transformation',
  602. fn: function (aDataCarrier){
  603. var self=this;
  604. return smalltalk.withContext(function($ctx1) {
  605. _st(aDataCarrier)._toTargetAttr_("checked");
  606. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputChecked)})},
  607. args: ["aDataCarrier"],
  608. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetAttr: 'checked'",
  609. messageSends: ["toTargetAttr:"],
  610. referencedClasses: []
  611. }),
  612. smalltalk.TrappedProcessorInputChecked);
  613. smalltalk.addClass('TrappedProcessorInputValue', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  614. smalltalk.TrappedProcessorInputValue.comment="I bind to input value.";
  615. smalltalk.addMethod(
  616. smalltalk.method({
  617. selector: "installToView:toModel:",
  618. category: 'installation',
  619. fn: function (aDataCarrier,anotherDataCarrier){
  620. var self=this;
  621. var brush;
  622. return smalltalk.withContext(function($ctx1) {
  623. var $1,$2;
  624. brush=_st(aDataCarrier)._target();
  625. _st(brush)._onChange_((function(){
  626. return smalltalk.withContext(function($ctx2) {
  627. $1=_st(anotherDataCarrier)._copy();
  628. _st($1)._value_(_st(_st(brush)._asJQuery())._val());
  629. $2=_st($1)._proceed();
  630. return $2;
  631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  632. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},smalltalk.TrappedProcessorInputValue)})},
  633. args: ["aDataCarrier", "anotherDataCarrier"],
  634. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: brush asJQuery val; proceed ]",
  635. messageSends: ["target", "onChange:", "value:", "copy", "val", "asJQuery", "proceed"],
  636. referencedClasses: []
  637. }),
  638. smalltalk.TrappedProcessorInputValue);
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "toView:",
  642. category: 'data transformation',
  643. fn: function (aDataCarrier){
  644. var self=this;
  645. return smalltalk.withContext(function($ctx1) {
  646. _st(aDataCarrier)._toTargetValue();
  647. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorInputValue)})},
  648. args: ["aDataCarrier"],
  649. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetValue",
  650. messageSends: ["toTargetValue"],
  651. referencedClasses: []
  652. }),
  653. smalltalk.TrappedProcessorInputValue);
  654. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  655. smalltalk.addMethod(
  656. smalltalk.method({
  657. selector: "start:",
  658. category: 'action',
  659. fn: function (args){
  660. var self=this;
  661. return smalltalk.withContext(function($ctx1) {
  662. var $1;
  663. $1=self._subclassResponsibility();
  664. return $1;
  665. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  666. args: ["args"],
  667. source: "start: args\x0a\x09^ self subclassResponsibility",
  668. messageSends: ["subclassResponsibility"],
  669. referencedClasses: []
  670. }),
  671. smalltalk.TrappedSingleton);
  672. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  673. smalltalk.addMethod(
  674. smalltalk.method({
  675. selector: "current",
  676. category: 'accessing',
  677. fn: function (){
  678. var self=this;
  679. return smalltalk.withContext(function($ctx1) {
  680. var $2,$1;
  681. $2=self["@current"];
  682. if(($receiver = $2) == nil || $receiver == null){
  683. self["@current"]=self._new();
  684. $1=self["@current"];
  685. } else {
  686. $1=$2;
  687. };
  688. return $1;
  689. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  690. args: [],
  691. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  692. messageSends: ["ifNil:", "new"],
  693. referencedClasses: []
  694. }),
  695. smalltalk.TrappedSingleton.klass);
  696. smalltalk.addMethod(
  697. smalltalk.method({
  698. selector: "start:",
  699. category: 'action',
  700. fn: function (args){
  701. var self=this;
  702. return smalltalk.withContext(function($ctx1) {
  703. _st(self._current())._start_(args);
  704. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  705. args: ["args"],
  706. source: "start: args\x0a\x09self current start: args",
  707. messageSends: ["start:", "current"],
  708. referencedClasses: []
  709. }),
  710. smalltalk.TrappedSingleton.klass);
  711. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "byName:",
  715. category: 'accessing',
  716. fn: function (aString){
  717. var self=this;
  718. return smalltalk.withContext(function($ctx1) {
  719. var $1;
  720. $1=_st(self["@registry"])._at_(aString);
  721. return $1;
  722. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  723. args: ["aString"],
  724. source: "byName: aString\x0a\x09^ registry at: aString",
  725. messageSends: ["at:"],
  726. referencedClasses: []
  727. }),
  728. smalltalk.Trapped);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "descend:snapshotDo:",
  732. category: 'action',
  733. fn: function (anArray,aBlock){
  734. var self=this;
  735. var tpsc;
  736. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  737. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  738. return smalltalk.withContext(function($ctx1) {
  739. tpsc=_st($TrappedPathStack())._current();
  740. _st(tpsc)._append_do_(anArray,(function(){
  741. var path,model;
  742. return smalltalk.withContext(function($ctx2) {
  743. path=_st(_st(tpsc)._elements())._copy();
  744. path;
  745. model=self._byName_(_st(path)._first());
  746. model;
  747. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  748. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  749. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  750. args: ["anArray", "aBlock"],
  751. source: "descend: anArray snapshotDo: aBlock\x0a\x09| tpsc |\x0a tpsc := TrappedPathStack current.\x0a tpsc append: anArray do: [\x0a | path model |\x0a path := tpsc elements copy.\x0a \x09 model := self byName: path first.\x0a aBlock value: (TrappedSnapshot new path: path model: model)\x0a ]",
  752. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  753. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  754. }),
  755. smalltalk.Trapped);
  756. smalltalk.addMethod(
  757. smalltalk.method({
  758. selector: "initialize",
  759. category: 'initialization',
  760. fn: function (){
  761. var self=this;
  762. return smalltalk.withContext(function($ctx1) {
  763. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  764. self["@registry"]=smalltalk.HashedCollection._from_([]);
  765. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  766. args: [],
  767. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  768. messageSends: ["initialize"],
  769. referencedClasses: []
  770. }),
  771. smalltalk.Trapped);
  772. smalltalk.addMethod(
  773. smalltalk.method({
  774. selector: "register:",
  775. category: 'accessing',
  776. fn: function (aListKeyedEntity){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  780. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  781. args: ["aListKeyedEntity"],
  782. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  783. messageSends: ["register:name:", "name", "class"],
  784. referencedClasses: []
  785. }),
  786. smalltalk.Trapped);
  787. smalltalk.addMethod(
  788. smalltalk.method({
  789. selector: "register:name:",
  790. category: 'accessing',
  791. fn: function (aListKeyedEntity,aString){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) {
  794. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  795. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  796. args: ["aListKeyedEntity", "aString"],
  797. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  798. messageSends: ["at:put:"],
  799. referencedClasses: []
  800. }),
  801. smalltalk.Trapped);
  802. smalltalk.addMethod(
  803. smalltalk.method({
  804. selector: "start:",
  805. category: 'action',
  806. fn: function (args){
  807. var self=this;
  808. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  809. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  810. return smalltalk.withContext(function($ctx1) {
  811. var $1,$2;
  812. _st(args)._do_((function(each){
  813. return smalltalk.withContext(function($ctx2) {
  814. return self._register_(each);
  815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  816. $1="[data-trap]"._asJQuery();
  817. $ctx1.sendIdx["asJQuery"]=1;
  818. _st($1)._each_((function(index,elem){
  819. var trap,jq,viewName,modelName,tokens,path;
  820. return smalltalk.withContext(function($ctx2) {
  821. jq=_st(elem)._asJQuery();
  822. jq;
  823. trap=_st(jq)._attr_("data-trap");
  824. trap;
  825. tokens=_st(trap)._tokenize_(":");
  826. $ctx2.sendIdx["tokenize:"]=1;
  827. tokens;
  828. $2=_st(_st(tokens)._size()).__eq((1));
  829. if(smalltalk.assert($2)){
  830. tokens=_st(["TrappedDumbView"]).__comma(tokens);
  831. $ctx2.sendIdx[","]=1;
  832. tokens;
  833. };
  834. viewName=_st(tokens)._first();
  835. $ctx2.sendIdx["first"]=1;
  836. viewName;
  837. tokens=_st(_st(_st(tokens)._second())._tokenize_(" "))._select_((function(each){
  838. return smalltalk.withContext(function($ctx3) {
  839. return _st(each)._notEmpty();
  840. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
  841. tokens;
  842. modelName=_st(tokens)._first();
  843. modelName;
  844. path=_st($Trapped())._parse_(_st(tokens)._allButFirst());
  845. path;
  846. return _st(_st([modelName]).__comma(path))._trapDescend_((function(){
  847. return smalltalk.withContext(function($ctx3) {
  848. return _st(_st(_st(_st($Smalltalk())._current())._at_(viewName))._new())._appendToJQuery_(jq);
  849. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  850. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,trap:trap,jq:jq,viewName:viewName,modelName:modelName,tokens:tokens,path:path},$ctx1,2)})}));
  851. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  852. args: ["args"],
  853. source: "start: args\x0a args do: [ :each | self register: each ].\x0a\x09'[data-trap]' asJQuery each: [ :index :elem |\x0a \x09| trap jq viewName modelName tokens path |\x0a jq := elem asJQuery.\x0a trap := jq attr: 'data-trap'.\x0a tokens := trap tokenize: ':'.\x0a tokens size = 1 ifTrue: [ tokens := { 'TrappedDumbView' }, tokens ].\x0a viewName := tokens first.\x0a tokens := (tokens second tokenize: ' ') select: [ :each | each notEmpty ].\x0a modelName := tokens first.\x0a path := Trapped parse: tokens allButFirst.\x0a { modelName }, path trapDescend: [(Smalltalk current at: viewName) new appendToJQuery: jq].\x0a ]",
  854. messageSends: ["do:", "register:", "each:", "asJQuery", "attr:", "tokenize:", "ifTrue:", "=", "size", ",", "first", "select:", "second", "notEmpty", "parse:", "allButFirst", "trapDescend:", "appendToJQuery:", "new", "at:", "current"],
  855. referencedClasses: ["Trapped", "Smalltalk"]
  856. }),
  857. smalltalk.Trapped);
  858. smalltalk.addMethod(
  859. smalltalk.method({
  860. selector: "envelope:loop:before:tag:do:",
  861. category: 'private',
  862. fn: function (envelope,model,endjq,aSymbol,aBlock){
  863. var self=this;
  864. var envjq;
  865. return smalltalk.withContext(function($ctx1) {
  866. envjq=_st(envelope)._asJQuery();
  867. _st(model)._withIndexDo_((function(item,i){
  868. return smalltalk.withContext(function($ctx2) {
  869. _st(envelope)._with_((function(html){
  870. return smalltalk.withContext(function($ctx3) {
  871. return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  872. }, function($ctx3) {$ctx3.fillBlock({html:html},$ctx2,2)})}));
  873. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  874. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  875. _st(envjq)._remove();
  876. return self}, function($ctx1) {$ctx1.fill(self,"envelope:loop:before:tag:do:",{envelope:envelope,model:model,endjq:endjq,aSymbol:aSymbol,aBlock:aBlock,envjq:envjq},smalltalk.Trapped.klass)})},
  877. args: ["envelope", "model", "endjq", "aSymbol", "aBlock"],
  878. source: "envelope: envelope loop: model before: endjq tag: aSymbol do: aBlock\x0a \x09| envjq |\x0a envjq := envelope asJQuery.\x0a model withIndexDo: [ :item :i |\x0a envelope with: [ :html | (html perform: aSymbol) trap: {i} read: aBlock ].\x0a envjq children detach insertBefore: endjq.\x0a ].\x0a envjq remove",
  879. messageSends: ["asJQuery", "withIndexDo:", "with:", "trap:read:", "perform:", "insertBefore:", "detach", "children", "remove"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.Trapped.klass);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "loop:between:and:tag:do:",
  886. category: 'private',
  887. fn: function (model,start,end,aSymbol,aBlock){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $2,$1;
  891. $2=_st(start)._asJQuery();
  892. $ctx1.sendIdx["asJQuery"]=1;
  893. $1=_st($2)._nextUntil_(_st(end)._element());
  894. _st($1)._remove();
  895. _st(start)._with_((function(html){
  896. return smalltalk.withContext(function($ctx2) {
  897. if(($receiver = model) == nil || $receiver == null){
  898. return model;
  899. } else {
  900. return self._envelope_loop_before_tag_do_(_st(html)._div(),model,_st(end)._asJQuery(),aSymbol,aBlock);
  901. };
  902. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  903. return self}, function($ctx1) {$ctx1.fill(self,"loop:between:and:tag:do:",{model:model,start:start,end:end,aSymbol:aSymbol,aBlock:aBlock},smalltalk.Trapped.klass)})},
  904. args: ["model", "start", "end", "aSymbol", "aBlock"],
  905. source: "loop: model between: start and: end tag: aSymbol do: aBlock\x0a (start asJQuery nextUntil: end element) remove.\x0a start with: [ :html | model ifNotNil: [\x0a \x09self envelope: html div loop: model before: end asJQuery tag: aSymbol do: aBlock\x0a\x09]]",
  906. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:tag:do:", "div"],
  907. referencedClasses: []
  908. }),
  909. smalltalk.Trapped.klass);
  910. smalltalk.addMethod(
  911. smalltalk.method({
  912. selector: "parse:",
  913. category: 'accessing',
  914. fn: function (anArray){
  915. var self=this;
  916. return smalltalk.withContext(function($ctx1) {
  917. var $2,$3,$1;
  918. $1=_st(anArray)._collect_((function(each){
  919. var asNum;
  920. return smalltalk.withContext(function($ctx2) {
  921. asNum=_st(each)._asNumber();
  922. asNum;
  923. $2=_st(asNum).__eq(asNum);
  924. $ctx2.sendIdx["="]=1;
  925. if(smalltalk.assert($2)){
  926. return asNum;
  927. } else {
  928. $3=_st(_st(each)._first()).__eq("#");
  929. if(smalltalk.assert($3)){
  930. return [_st(each)._allButFirst()];
  931. } else {
  932. return each;
  933. };
  934. };
  935. }, function($ctx2) {$ctx2.fillBlock({each:each,asNum:asNum},$ctx1,1)})}));
  936. return $1;
  937. }, function($ctx1) {$ctx1.fill(self,"parse:",{anArray:anArray},smalltalk.Trapped.klass)})},
  938. args: ["anArray"],
  939. source: "parse: anArray\x0a\x09^anArray collect: [ :each |\x0a \x09| asNum |\x0a \x09asNum := each asNumber.\x0a asNum = asNum ifTrue: [ asNum ] ifFalse: [\x0a\x09\x09\x09each first = '#' ifTrue: [ { each allButFirst } ] ifFalse: [ each ]]]",
  940. messageSends: ["collect:", "asNumber", "ifTrue:ifFalse:", "=", "first", "allButFirst"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.Trapped.klass);
  944. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  945. smalltalk.addMethod(
  946. smalltalk.method({
  947. selector: "append:do:",
  948. category: 'descending',
  949. fn: function (anArray,aBlock){
  950. var self=this;
  951. return smalltalk.withContext(function($ctx1) {
  952. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  953. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  954. args: ["anArray", "aBlock"],
  955. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  956. messageSends: ["with:do:", ","],
  957. referencedClasses: []
  958. }),
  959. smalltalk.TrappedPathStack);
  960. smalltalk.addMethod(
  961. smalltalk.method({
  962. selector: "elements",
  963. category: 'accessing',
  964. fn: function (){
  965. var self=this;
  966. return smalltalk.withContext(function($ctx1) {
  967. var $1;
  968. $1=self["@elements"];
  969. return $1;
  970. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  971. args: [],
  972. source: "elements\x0a\x09^elements",
  973. messageSends: [],
  974. referencedClasses: []
  975. }),
  976. smalltalk.TrappedPathStack);
  977. smalltalk.addMethod(
  978. smalltalk.method({
  979. selector: "initialize",
  980. category: 'initialization',
  981. fn: function (){
  982. var self=this;
  983. return smalltalk.withContext(function($ctx1) {
  984. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  985. self["@elements"]=[];
  986. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  987. args: [],
  988. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  989. messageSends: ["initialize"],
  990. referencedClasses: []
  991. }),
  992. smalltalk.TrappedPathStack);
  993. smalltalk.addMethod(
  994. smalltalk.method({
  995. selector: "with:do:",
  996. category: 'descending',
  997. fn: function (anArray,aBlock){
  998. var self=this;
  999. var old;
  1000. return smalltalk.withContext(function($ctx1) {
  1001. old=self["@elements"];
  1002. _st((function(){
  1003. return smalltalk.withContext(function($ctx2) {
  1004. self["@elements"]=anArray;
  1005. self["@elements"];
  1006. return _st(aBlock)._value();
  1007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1008. return smalltalk.withContext(function($ctx2) {
  1009. self["@elements"]=old;
  1010. return self["@elements"];
  1011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1012. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1013. args: ["anArray", "aBlock"],
  1014. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1015. messageSends: ["ensure:", "value"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.TrappedPathStack);
  1019. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1020. smalltalk.addMethod(
  1021. smalltalk.method({
  1022. selector: "do:",
  1023. category: 'action',
  1024. fn: function (aBlock){
  1025. var self=this;
  1026. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1027. return smalltalk.withContext(function($ctx1) {
  1028. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1029. return smalltalk.withContext(function($ctx2) {
  1030. return _st(aBlock)._value_(self["@model"]);
  1031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1032. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1033. args: ["aBlock"],
  1034. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1035. messageSends: ["with:do:", "current", "value:"],
  1036. referencedClasses: ["TrappedPathStack"]
  1037. }),
  1038. smalltalk.TrappedSnapshot);
  1039. smalltalk.addMethod(
  1040. smalltalk.method({
  1041. selector: "model",
  1042. category: 'accessing',
  1043. fn: function (){
  1044. var self=this;
  1045. return smalltalk.withContext(function($ctx1) {
  1046. var $1;
  1047. $1=self["@model"];
  1048. return $1;
  1049. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1050. args: [],
  1051. source: "model\x0a\x09^model",
  1052. messageSends: [],
  1053. referencedClasses: []
  1054. }),
  1055. smalltalk.TrappedSnapshot);
  1056. smalltalk.addMethod(
  1057. smalltalk.method({
  1058. selector: "modify:",
  1059. category: 'action',
  1060. fn: function (aBlock){
  1061. var self=this;
  1062. return smalltalk.withContext(function($ctx1) {
  1063. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1064. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1065. args: ["aBlock"],
  1066. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1067. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1068. referencedClasses: []
  1069. }),
  1070. smalltalk.TrappedSnapshot);
  1071. smalltalk.addMethod(
  1072. smalltalk.method({
  1073. selector: "path",
  1074. category: 'accessing',
  1075. fn: function (){
  1076. var self=this;
  1077. return smalltalk.withContext(function($ctx1) {
  1078. var $1;
  1079. $1=self["@path"];
  1080. return $1;
  1081. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1082. args: [],
  1083. source: "path\x0a\x09^path",
  1084. messageSends: [],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.TrappedSnapshot);
  1088. smalltalk.addMethod(
  1089. smalltalk.method({
  1090. selector: "path:model:",
  1091. category: 'accessing',
  1092. fn: function (anArray,aTrappedMW){
  1093. var self=this;
  1094. return smalltalk.withContext(function($ctx1) {
  1095. self["@path"]=anArray;
  1096. self["@model"]=aTrappedMW;
  1097. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1098. args: ["anArray", "aTrappedMW"],
  1099. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1100. messageSends: [],
  1101. referencedClasses: []
  1102. }),
  1103. smalltalk.TrappedSnapshot);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "watch:",
  1107. category: 'action',
  1108. fn: function (aBlock){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1112. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1113. args: ["aBlock"],
  1114. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1115. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1116. referencedClasses: []
  1117. }),
  1118. smalltalk.TrappedSnapshot);
  1119. smalltalk.addMethod(
  1120. smalltalk.method({
  1121. selector: "trapDescend:",
  1122. category: '*Trapped-Frontend',
  1123. fn: function (aBlock){
  1124. var self=this;
  1125. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1126. return smalltalk.withContext(function($ctx1) {
  1127. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1128. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1129. args: ["aBlock"],
  1130. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1131. messageSends: ["descend:snapshotDo:", "current"],
  1132. referencedClasses: ["Trapped"]
  1133. }),
  1134. smalltalk.Array);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "trapIter:tag:do:",
  1138. category: '*Trapped-Frontend',
  1139. fn: function (path,aSymbol,aBlock){
  1140. var self=this;
  1141. var start,end;
  1142. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1143. return smalltalk.withContext(function($ctx1) {
  1144. self._with_((function(html){
  1145. return smalltalk.withContext(function($ctx2) {
  1146. start=_st(html)._script();
  1147. $ctx2.sendIdx["script"]=1;
  1148. start;
  1149. end=_st(html)._script();
  1150. return end;
  1151. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1152. _st(start)._trap_read_(path,(function(model){
  1153. return smalltalk.withContext(function($ctx2) {
  1154. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1155. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1156. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1157. args: ["path", "aSymbol", "aBlock"],
  1158. source: "trapIter: path tag: aSymbol do: aBlock\x0a\x09| start end |\x0a self with: [ :html | start := html script. end := html script ].\x0a start trap: path read: [ :model |\x0a \x09Trapped loop: model between: start and: end tag: aSymbol do: aBlock.\x0a ]",
  1159. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1160. referencedClasses: ["Trapped"]
  1161. }),
  1162. smalltalk.HTMLCanvas);
  1163. smalltalk.addMethod(
  1164. smalltalk.method({
  1165. selector: "trap:",
  1166. category: '*Trapped-Frontend',
  1167. fn: function (path){
  1168. var self=this;
  1169. return smalltalk.withContext(function($ctx1) {
  1170. self._trap_processors_(path,["contents"]);
  1171. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1172. args: ["path"],
  1173. source: "trap: path\x0a\x09self trap: path processors: #(contents)",
  1174. messageSends: ["trap:processors:"],
  1175. referencedClasses: []
  1176. }),
  1177. smalltalk.TagBrush);
  1178. smalltalk.addMethod(
  1179. smalltalk.method({
  1180. selector: "trap:processors:",
  1181. category: '*Trapped-Frontend',
  1182. fn: function (path,anArray){
  1183. var self=this;
  1184. function $TrappedDataChain(){return smalltalk.TrappedDataChain||(typeof TrappedDataChain=="undefined"?nil:TrappedDataChain)}
  1185. return smalltalk.withContext(function($ctx1) {
  1186. _st(path)._trapDescend_((function(snap){
  1187. return smalltalk.withContext(function($ctx2) {
  1188. return _st(_st($TrappedDataChain())._newFromProcessorNames_(anArray))._forSnapshot_andBrush_(snap,self);
  1189. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1190. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1191. args: ["path", "anArray"],
  1192. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedDataChain newFromProcessorNames: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1193. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorNames:"],
  1194. referencedClasses: ["TrappedDataChain"]
  1195. }),
  1196. smalltalk.TagBrush);
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "trap:read:",
  1200. category: '*Trapped-Frontend',
  1201. fn: function (path,aBlock){
  1202. var self=this;
  1203. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1204. return smalltalk.withContext(function($ctx1) {
  1205. var $1;
  1206. _st(path)._trapDescend_((function(snap){
  1207. return smalltalk.withContext(function($ctx2) {
  1208. return _st(snap)._watch_((function(data){
  1209. return smalltalk.withContext(function($ctx3) {
  1210. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1211. if(smalltalk.assert($1)){
  1212. _st($KeyedPubSubUnsubscribe())._signal();
  1213. };
  1214. return _st(snap)._do_((function(){
  1215. return smalltalk.withContext(function($ctx4) {
  1216. return self._with_((function(html){
  1217. return smalltalk.withContext(function($ctx5) {
  1218. return _st(aBlock)._value_value_(data,html);
  1219. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1220. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1221. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1222. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1223. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1224. args: ["path", "aBlock"],
  1225. source: "trap: path read: aBlock\x0a\x09path trapDescend: [ :snap |\x0a snap watch: [ :data |\x0a (self asJQuery closest: 'html') toArray isEmpty ifTrue: [ KeyedPubSubUnsubscribe signal ].\x0a \x09snap do: [ self with: [ :html | aBlock value: data value: html ] ]\x0a \x09]\x0a ]",
  1226. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1227. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1228. }),
  1229. smalltalk.TagBrush);
  1230. smalltalk.addMethod(
  1231. smalltalk.method({
  1232. selector: "trapGuard:contents:",
  1233. category: '*Trapped-Frontend',
  1234. fn: function (anArray,aBlock){
  1235. var self=this;
  1236. return smalltalk.withContext(function($ctx1) {
  1237. var $1,$2,$3,$4,$5;
  1238. []._trapDescend_((function(snap){
  1239. var shown;
  1240. return smalltalk.withContext(function($ctx2) {
  1241. shown=nil;
  1242. shown;
  1243. return self._trap_read_(anArray,(function(gdata){
  1244. var sanitized;
  1245. return smalltalk.withContext(function($ctx3) {
  1246. if(($receiver = gdata) == nil || $receiver == null){
  1247. sanitized=false;
  1248. } else {
  1249. sanitized=gdata;
  1250. };
  1251. sanitized;
  1252. $1=_st(shown).__eq(sanitized);
  1253. if(! smalltalk.assert($1)){
  1254. shown=sanitized;
  1255. shown;
  1256. $2=shown;
  1257. if(smalltalk.assert($2)){
  1258. _st(snap)._do_((function(){
  1259. return smalltalk.withContext(function($ctx4) {
  1260. return self._contents_(aBlock);
  1261. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1262. $3=self._asJQuery();
  1263. $ctx3.sendIdx["asJQuery"]=1;
  1264. return _st($3)._show();
  1265. } else {
  1266. $4=self._asJQuery();
  1267. _st($4)._hide();
  1268. $5=_st($4)._empty();
  1269. return $5;
  1270. };
  1271. };
  1272. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1273. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1274. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1275. args: ["anArray", "aBlock"],
  1276. source: "trapGuard: anArray contents: aBlock\x0a\x09#() trapDescend: [ :snap |\x0a\x09 | shown |\x0a \x09shown := nil.\x0a\x09 self trap: anArray read: [ :gdata |\x0a\x09\x09\x09| sanitized |\x0a\x09\x09\x09sanitized := gdata ifNil: [ false ].\x0a \x09 shown = sanitized ifFalse: [\x0a \x09 shown := sanitized.\x0a \x09shown\x0a\x09\x09\x09\x09\x09ifTrue: [ snap do: [ self contents: aBlock ]. self asJQuery show ]\x0a\x09\x09\x09\x09\x09ifFalse: [ self asJQuery hide; empty ] ] ] ]",
  1277. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1278. referencedClasses: []
  1279. }),
  1280. smalltalk.TagBrush);
  1281. });