Helios-KeyBindings.deploy.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. smalltalk.addPackage('Helios-KeyBindings', {});
  2. smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
  3. smalltalk.addMethod(
  4. "_applyOn_",
  5. smalltalk.method({
  6. selector: "applyOn:",
  7. fn: function (aKeyBinder) {
  8. var self = this;
  9. smalltalk.send(self, "_subclassResponsibility", []);
  10. return self;
  11. }
  12. }),
  13. smalltalk.HLBinding);
  14. smalltalk.addMethod(
  15. "_isBindingAction",
  16. smalltalk.method({
  17. selector: "isBindingAction",
  18. fn: function () {
  19. var self = this;
  20. return false;
  21. }
  22. }),
  23. smalltalk.HLBinding);
  24. smalltalk.addMethod(
  25. "_isBindingGroup",
  26. smalltalk.method({
  27. selector: "isBindingGroup",
  28. fn: function () {
  29. var self = this;
  30. return false;
  31. }
  32. }),
  33. smalltalk.HLBinding);
  34. smalltalk.addMethod(
  35. "_key",
  36. smalltalk.method({
  37. selector: "key",
  38. fn: function () {
  39. var self = this;
  40. return self['@key'];
  41. }
  42. }),
  43. smalltalk.HLBinding);
  44. smalltalk.addMethod(
  45. "_key_",
  46. smalltalk.method({
  47. selector: "key:",
  48. fn: function (anInteger) {
  49. var self = this;
  50. self['@key'] = anInteger;
  51. return self;
  52. }
  53. }),
  54. smalltalk.HLBinding);
  55. smalltalk.addMethod(
  56. "_label",
  57. smalltalk.method({
  58. selector: "label",
  59. fn: function () {
  60. var self = this;
  61. return self['@label'];
  62. }
  63. }),
  64. smalltalk.HLBinding);
  65. smalltalk.addMethod(
  66. "_label_",
  67. smalltalk.method({
  68. selector: "label:",
  69. fn: function (aString) {
  70. var self = this;
  71. self['@label'] = aString;
  72. return self;
  73. }
  74. }),
  75. smalltalk.HLBinding);
  76. smalltalk.addMethod(
  77. "_renderOn_html_",
  78. smalltalk.method({
  79. selector: "renderOn:html:",
  80. fn: function (aBindingHelper, html) {
  81. var self = this;
  82. return self;
  83. }
  84. }),
  85. smalltalk.HLBinding);
  86. smalltalk.addMethod(
  87. "_shortcut",
  88. smalltalk.method({
  89. selector: "shortcut",
  90. fn: function () {
  91. var self = this;
  92. var $1;
  93. $1 = smalltalk.send(smalltalk.String || String, "_fromCharCode_", [smalltalk.send(self, "_key", [])]);
  94. return $1;
  95. }
  96. }),
  97. smalltalk.HLBinding);
  98. smalltalk.addMethod(
  99. "_on_labelled_",
  100. smalltalk.method({
  101. selector: "on:labelled:",
  102. fn: function (anInteger, aString) {
  103. var self = this;
  104. var $2, $3, $1;
  105. $2 = smalltalk.send(self, "_new", []);
  106. smalltalk.send($2, "_key_", [anInteger]);
  107. smalltalk.send($2, "_label_", [aString]);
  108. $3 = smalltalk.send($2, "_yourself", []);
  109. $1 = $3;
  110. return $1;
  111. }
  112. }),
  113. smalltalk.HLBinding.klass);
  114. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['callback'], 'Helios-KeyBindings');
  115. smalltalk.addMethod(
  116. "_applyOn_",
  117. smalltalk.method({
  118. selector: "applyOn:",
  119. fn: function (aKeyBinder) {
  120. var self = this;
  121. smalltalk.send(aKeyBinder, "_applyBindingAction_", [self]);
  122. return self;
  123. }
  124. }),
  125. smalltalk.HLBindingAction);
  126. smalltalk.addMethod(
  127. "_callback",
  128. smalltalk.method({
  129. selector: "callback",
  130. fn: function () {
  131. var self = this;
  132. return self['@callback'];
  133. }
  134. }),
  135. smalltalk.HLBindingAction);
  136. smalltalk.addMethod(
  137. "_callback_",
  138. smalltalk.method({
  139. selector: "callback:",
  140. fn: function (aBlock) {
  141. var self = this;
  142. self['@callback'] = aBlock;
  143. return self;
  144. }
  145. }),
  146. smalltalk.HLBindingAction);
  147. smalltalk.addMethod(
  148. "_isBindingAction",
  149. smalltalk.method({
  150. selector: "isBindingAction",
  151. fn: function () {
  152. var self = this;
  153. return true;
  154. }
  155. }),
  156. smalltalk.HLBindingAction);
  157. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  158. smalltalk.addMethod(
  159. "_add_",
  160. smalltalk.method({
  161. selector: "add:",
  162. fn: function (aBinding) {
  163. var self = this;
  164. var $1;
  165. $1 = smalltalk.send(smalltalk.send(self, "_bindings", []), "_add_", [aBinding]);
  166. return $1;
  167. }
  168. }),
  169. smalltalk.HLBindingGroup);
  170. smalltalk.addMethod(
  171. "_addActionKey_labelled_callback_",
  172. smalltalk.method({
  173. selector: "addActionKey:labelled:callback:",
  174. fn: function (anInteger, aString, aBlock) {
  175. var self = this;
  176. var $1, $2;
  177. $1 = smalltalk.send(smalltalk.HLBindingAction || HLBindingAction, "_on_labelled_", [anInteger, aString]);
  178. smalltalk.send($1, "_callback_", [aBlock]);
  179. $2 = smalltalk.send($1, "_yourself", []);
  180. smalltalk.send(self, "_add_", [$2]);
  181. return self;
  182. }
  183. }),
  184. smalltalk.HLBindingGroup);
  185. smalltalk.addMethod(
  186. "_addActionKey_labelled_command_",
  187. smalltalk.method({
  188. selector: "addActionKey:labelled:command:",
  189. fn: function (anInteger, aString, aCommand) {
  190. var self = this;
  191. var $1, $2;
  192. $1 = smalltalk.send(smalltalk.HLBindingAction || HLBindingAction, "_on_labelled_", [anInteger, aString]);
  193. smalltalk.send($1, "_command_", [aCommand]);
  194. $2 = smalltalk.send($1, "_yourself", []);
  195. smalltalk.send(self, "_add_", [$2]);
  196. return self;
  197. }
  198. }),
  199. smalltalk.HLBindingGroup);
  200. smalltalk.addMethod(
  201. "_addGroupKey_labelled_",
  202. smalltalk.method({
  203. selector: "addGroupKey:labelled:",
  204. fn: function (anInteger, aString) {
  205. var self = this;
  206. smalltalk.send(self, "_add_", [smalltalk.send(smalltalk.HLBindingGroup || HLBindingGroup, "_on_labelled_", [anInteger, aString])]);
  207. return self;
  208. }
  209. }),
  210. smalltalk.HLBindingGroup);
  211. smalltalk.addMethod(
  212. "_applyOn_",
  213. smalltalk.method({
  214. selector: "applyOn:",
  215. fn: function (aKeyBinder) {
  216. var self = this;
  217. smalltalk.send(aKeyBinder, "_applyBindingGroup_", [self]);
  218. return self;
  219. }
  220. }),
  221. smalltalk.HLBindingGroup);
  222. smalltalk.addMethod(
  223. "_at_",
  224. smalltalk.method({
  225. selector: "at:",
  226. fn: function (aString) {
  227. var self = this;
  228. var $1;
  229. $1 = smalltalk.send(smalltalk.send(self, "_bindings", []), "_detect_ifNone_", [function (each) {return smalltalk.send(smalltalk.send(each, "_label", []), "__eq", [aString]);}, function () {return nil;}]);
  230. return $1;
  231. }
  232. }),
  233. smalltalk.HLBindingGroup);
  234. smalltalk.addMethod(
  235. "_atKey_",
  236. smalltalk.method({
  237. selector: "atKey:",
  238. fn: function (anInteger) {
  239. var self = this;
  240. var $1;
  241. $1 = smalltalk.send(smalltalk.send(self, "_bindings", []), "_detect_ifNone_", [function (each) {return smalltalk.send(smalltalk.send(each, "_key", []), "__eq", [anInteger]);}, function () {return nil;}]);
  242. return $1;
  243. }
  244. }),
  245. smalltalk.HLBindingGroup);
  246. smalltalk.addMethod(
  247. "_bindings",
  248. smalltalk.method({
  249. selector: "bindings",
  250. fn: function () {
  251. var self = this;
  252. var $1;
  253. if (($receiver = self['@bindings']) == nil || $receiver == undefined) {
  254. self['@bindings'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  255. $1 = self['@bindings'];
  256. } else {
  257. $1 = self['@bindings'];
  258. }
  259. return $1;
  260. }
  261. }),
  262. smalltalk.HLBindingGroup);
  263. smalltalk.addMethod(
  264. "_isBindingGroup",
  265. smalltalk.method({
  266. selector: "isBindingGroup",
  267. fn: function () {
  268. var self = this;
  269. return true;
  270. }
  271. }),
  272. smalltalk.HLBindingGroup);
  273. smalltalk.addMethod(
  274. "_renderOn_html_",
  275. smalltalk.method({
  276. selector: "renderOn:html:",
  277. fn: function (aBindingHelper, html) {
  278. var self = this;
  279. smalltalk.send(aBindingHelper, "_renderBindingGroup_on_", [self, html]);
  280. return self;
  281. }
  282. }),
  283. smalltalk.HLBindingGroup);
  284. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'active', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  285. smalltalk.addMethod(
  286. "_activate",
  287. smalltalk.method({
  288. selector: "activate",
  289. fn: function () {
  290. var self = this;
  291. self['@active'] = true;
  292. smalltalk.send(smalltalk.send(self, "_helper", []), "_show", []);
  293. return self;
  294. }
  295. }),
  296. smalltalk.HLKeyBinder);
  297. smalltalk.addMethod(
  298. "_activationKey",
  299. smalltalk.method({
  300. selector: "activationKey",
  301. fn: function () {
  302. var self = this;
  303. return 32;
  304. }
  305. }),
  306. smalltalk.HLKeyBinder);
  307. smalltalk.addMethod(
  308. "_applyBinding_",
  309. smalltalk.method({
  310. selector: "applyBinding:",
  311. fn: function (aBinding) {
  312. var self = this;
  313. smalltalk.send(aBinding, "_applyOn_", [self]);
  314. return self;
  315. }
  316. }),
  317. smalltalk.HLKeyBinder);
  318. smalltalk.addMethod(
  319. "_applyBindingAction_",
  320. smalltalk.method({
  321. selector: "applyBindingAction:",
  322. fn: function (aBinding) {
  323. var self = this;
  324. smalltalk.send(smalltalk.send(aBinding, "_callback", []), "_value", []);
  325. smalltalk.send(self, "_deactivate", []);
  326. return self;
  327. }
  328. }),
  329. smalltalk.HLKeyBinder);
  330. smalltalk.addMethod(
  331. "_applyBindingGroup_",
  332. smalltalk.method({
  333. selector: "applyBindingGroup:",
  334. fn: function (aBinding) {
  335. var self = this;
  336. self['@selectedBinding'] = aBinding;
  337. smalltalk.send(smalltalk.send(self, "_helper", []), "_refresh", []);
  338. return self;
  339. }
  340. }),
  341. smalltalk.HLKeyBinder);
  342. smalltalk.addMethod(
  343. "_bindings",
  344. smalltalk.method({
  345. selector: "bindings",
  346. fn: function () {
  347. var self = this;
  348. var $1;
  349. if (($receiver = self['@bindings']) == nil || $receiver == undefined) {
  350. self['@bindings'] = smalltalk.send(smalltalk.HLBindingGroup || HLBindingGroup, "_new", []);
  351. $1 = self['@bindings'];
  352. } else {
  353. $1 = self['@bindings'];
  354. }
  355. return $1;
  356. }
  357. }),
  358. smalltalk.HLKeyBinder);
  359. smalltalk.addMethod(
  360. "_deactivate",
  361. smalltalk.method({
  362. selector: "deactivate",
  363. fn: function () {
  364. var self = this;
  365. self['@active'] = false;
  366. self['@selectedBinding'] = nil;
  367. smalltalk.send(smalltalk.send(self, "_helper", []), "_hide", []);
  368. return self;
  369. }
  370. }),
  371. smalltalk.HLKeyBinder);
  372. smalltalk.addMethod(
  373. "_escapeKey",
  374. smalltalk.method({
  375. selector: "escapeKey",
  376. fn: function () {
  377. var self = this;
  378. return 27;
  379. }
  380. }),
  381. smalltalk.HLKeyBinder);
  382. smalltalk.addMethod(
  383. "_flushBindings",
  384. smalltalk.method({
  385. selector: "flushBindings",
  386. fn: function () {
  387. var self = this;
  388. self['@bindings'] = nil;
  389. self['@helper'] = nil;
  390. return self;
  391. }
  392. }),
  393. smalltalk.HLKeyBinder);
  394. smalltalk.addMethod(
  395. "_handleActiveKeyDown_",
  396. smalltalk.method({
  397. selector: "handleActiveKeyDown:",
  398. fn: function (event) {
  399. var self = this;
  400. var $1, $2;
  401. $1 = smalltalk.send(smalltalk.send(smalltalk.send(event, "_which", []), "__eq", [smalltalk.send(self, "_escapeKey", [])]), "_or_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(event, "_which", []), "__eq", [71]), "_and_", [function () {return smalltalk.send(event, "_ctrlKey", []);}]);}]);
  402. if (smalltalk.assert($1)) {
  403. smalltalk.send(self, "_deactivate", []);
  404. smalltalk.send(event, "_preventDefault", []);
  405. return false;
  406. }
  407. $2 = smalltalk.send(self, "_handleBindingFor_", [event]);
  408. return $2;
  409. }
  410. }),
  411. smalltalk.HLKeyBinder);
  412. smalltalk.addMethod(
  413. "_handleBindingFor_",
  414. smalltalk.method({
  415. selector: "handleBindingFor:",
  416. fn: function (anEvent) {
  417. var self = this;
  418. var binding;
  419. binding = smalltalk.send(smalltalk.send(self, "_selectedBinding", []), "_atKey_", [smalltalk.send(anEvent, "_which", [])]);
  420. if (($receiver = binding) == nil || $receiver == undefined) {
  421. } else {
  422. smalltalk.send(self, "_applyBinding_", [binding]);
  423. smalltalk.send(anEvent, "_preventDefault", []);
  424. return false;
  425. }
  426. return self;
  427. }
  428. }),
  429. smalltalk.HLKeyBinder);
  430. smalltalk.addMethod(
  431. "_handleInactiveKeyDown_",
  432. smalltalk.method({
  433. selector: "handleInactiveKeyDown:",
  434. fn: function (event) {
  435. var self = this;
  436. var $1, $2;
  437. $1 = smalltalk.send(smalltalk.send(event, "_which", []), "__eq", [smalltalk.send(self, "_activationKey", [])]);
  438. if (smalltalk.assert($1)) {
  439. $2 = smalltalk.send(event, "_ctrlKey", []);
  440. if (smalltalk.assert($2)) {
  441. smalltalk.send(self, "_activate", []);
  442. smalltalk.send(event, "_preventDefault", []);
  443. return false;
  444. }
  445. }
  446. return self;
  447. }
  448. }),
  449. smalltalk.HLKeyBinder);
  450. smalltalk.addMethod(
  451. "_handleKeyDown_",
  452. smalltalk.method({
  453. selector: "handleKeyDown:",
  454. fn: function (event) {
  455. var self = this;
  456. var $2, $1;
  457. $2 = smalltalk.send(self, "_isActive", []);
  458. if (smalltalk.assert($2)) {
  459. $1 = smalltalk.send(self, "_handleActiveKeyDown_", [event]);
  460. } else {
  461. $1 = smalltalk.send(self, "_handleInactiveKeyDown_", [event]);
  462. }
  463. return $1;
  464. }
  465. }),
  466. smalltalk.HLKeyBinder);
  467. smalltalk.addMethod(
  468. "_helper",
  469. smalltalk.method({
  470. selector: "helper",
  471. fn: function () {
  472. var self = this;
  473. var $1;
  474. if (($receiver = self['@helper']) == nil || $receiver == undefined) {
  475. self['@helper'] = smalltalk.send(smalltalk.HLKeyBinderHelper || HLKeyBinderHelper, "_on_", [self]);
  476. $1 = self['@helper'];
  477. } else {
  478. $1 = self['@helper'];
  479. }
  480. return $1;
  481. }
  482. }),
  483. smalltalk.HLKeyBinder);
  484. smalltalk.addMethod(
  485. "_initialize",
  486. smalltalk.method({
  487. selector: "initialize",
  488. fn: function () {
  489. var self = this;
  490. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  491. self['@active'] = false;
  492. return self;
  493. }
  494. }),
  495. smalltalk.HLKeyBinder);
  496. smalltalk.addMethod(
  497. "_isActive",
  498. smalltalk.method({
  499. selector: "isActive",
  500. fn: function () {
  501. var self = this;
  502. var $1;
  503. if (($receiver = self['@active']) == nil || $receiver == undefined) {
  504. $1 = false;
  505. } else {
  506. $1 = self['@active'];
  507. }
  508. return $1;
  509. }
  510. }),
  511. smalltalk.HLKeyBinder);
  512. smalltalk.addMethod(
  513. "_selectedBinding",
  514. smalltalk.method({
  515. selector: "selectedBinding",
  516. fn: function () {
  517. var self = this;
  518. var $1;
  519. if (($receiver = self['@selectedBinding']) == nil ||
  520. $receiver == undefined) {
  521. $1 = smalltalk.send(self, "_bindings", []);
  522. } else {
  523. $1 = self['@selectedBinding'];
  524. }
  525. return $1;
  526. }
  527. }),
  528. smalltalk.HLKeyBinder);
  529. smalltalk.addMethod(
  530. "_setupEvents",
  531. smalltalk.method({
  532. selector: "setupEvents",
  533. fn: function () {
  534. var self = this;
  535. smalltalk.send(smalltalk.send(window, "_jQuery_", ["body"]), "_keydown_", [function (event) {return smalltalk.send(self, "_handleKeyDown_", [event]);}]);
  536. return self;
  537. }
  538. }),
  539. smalltalk.HLKeyBinder);
  540. smalltalk.addMethod(
  541. "_systemIsMac",
  542. smalltalk.method({
  543. selector: "systemIsMac",
  544. fn: function () {
  545. var self = this;
  546. var $1;
  547. $1 = smalltalk.send(smalltalk.send(navigator, "_platform", []), "_match_", ["Mac"]);
  548. return $1;
  549. }
  550. }),
  551. smalltalk.HLKeyBinder);
  552. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  553. smalltalk.addMethod(
  554. "_hide",
  555. smalltalk.method({
  556. selector: "hide",
  557. fn: function () {
  558. var self = this;
  559. smalltalk.send(smalltalk.send(self['@rootDiv'], "_asJQuery", []), "_remove", []);
  560. return self;
  561. }
  562. }),
  563. smalltalk.HLKeyBinderHelper);
  564. smalltalk.addMethod(
  565. "_keyBinder",
  566. smalltalk.method({
  567. selector: "keyBinder",
  568. fn: function () {
  569. var self = this;
  570. return self['@keyBinder'];
  571. }
  572. }),
  573. smalltalk.HLKeyBinderHelper);
  574. smalltalk.addMethod(
  575. "_keyBinder_",
  576. smalltalk.method({
  577. selector: "keyBinder:",
  578. fn: function (aKeyBinder) {
  579. var self = this;
  580. self['@keyBinder'] = aKeyBinder;
  581. return self;
  582. }
  583. }),
  584. smalltalk.HLKeyBinderHelper);
  585. smalltalk.addMethod(
  586. "_registerBindings",
  587. smalltalk.method({
  588. selector: "registerBindings",
  589. fn: function () {
  590. var self = this;
  591. return self;
  592. }
  593. }),
  594. smalltalk.HLKeyBinderHelper);
  595. smalltalk.addMethod(
  596. "_renderBindingGroup_on_",
  597. smalltalk.method({
  598. selector: "renderBindingGroup:on:",
  599. fn: function (aBindingGroup, html) {
  600. var self = this;
  601. var $1, $3, $4, $5, $6, $2;
  602. smalltalk.send(smalltalk.send(smalltalk.send(aBindingGroup, "_bindings", []), "_sorted_", [function (a, b) {return smalltalk.send(smalltalk.send(a, "_key", []), "__lt", [smalltalk.send(b, "_key", [])]);}]), "_do_", [function (each) {$1 = smalltalk.send(html, "_span", []);smalltalk.send($1, "_class_", ["command"]);$2 = smalltalk.send($1, "_with_", [function () {$3 = smalltalk.send(html, "_span", []);smalltalk.send($3, "_class_", ["label"]);$4 = smalltalk.send($3, "_with_", [smalltalk.send(smalltalk.send(each, "_shortcut", []), "_asLowercase", [])]);$4;$5 = smalltalk.send(html, "_a", []);smalltalk.send($5, "_class_", ["action"]);smalltalk.send($5, "_with_", [smalltalk.send(each, "_label", [])]);$6 = smalltalk.send($5, "_onClick_", [function () {return smalltalk.send(smalltalk.send(self, "_keyBinder", []), "_applyBinding_", [each]);}]);return $6;}]);return $2;}]);
  603. return self;
  604. }
  605. }),
  606. smalltalk.HLKeyBinderHelper);
  607. smalltalk.addMethod(
  608. "_renderBindingOn_",
  609. smalltalk.method({
  610. selector: "renderBindingOn:",
  611. fn: function (html) {
  612. var self = this;
  613. smalltalk.send(smalltalk.send(self, "_selectedBinding", []), "_renderOn_html_", [self, html]);
  614. return self;
  615. }
  616. }),
  617. smalltalk.HLKeyBinderHelper);
  618. smalltalk.addMethod(
  619. "_renderContentOn_",
  620. smalltalk.method({
  621. selector: "renderContentOn:",
  622. fn: function (html) {
  623. var self = this;
  624. var $1, $3, $2;
  625. $1 = smalltalk.send(html, "_div", []);
  626. smalltalk.send($1, "_class_", ["key_helper"]);
  627. $2 = smalltalk.send($1, "_with_", [function () {smalltalk.send(self, "_renderSelectionOn_", [html]);$3 = smalltalk.send(self, "_renderBindingOn_", [html]);return $3;}]);
  628. return self;
  629. }
  630. }),
  631. smalltalk.HLKeyBinderHelper);
  632. smalltalk.addMethod(
  633. "_renderSelectionOn_",
  634. smalltalk.method({
  635. selector: "renderSelectionOn:",
  636. fn: function (html) {
  637. var self = this;
  638. var $1, $4, $3, $2;
  639. $1 = smalltalk.send(html, "_span", []);
  640. smalltalk.send($1, "_class_", ["selected"]);
  641. $4 = smalltalk.send(smalltalk.send(self, "_selectedBinding", []), "_label", []);
  642. if (($receiver = $4) == nil || $receiver == undefined) {
  643. $3 = "Action";
  644. } else {
  645. $3 = $4;
  646. }
  647. $2 = smalltalk.send($1, "_with_", [$3]);
  648. return self;
  649. }
  650. }),
  651. smalltalk.HLKeyBinderHelper);
  652. smalltalk.addMethod(
  653. "_selectedBinding",
  654. smalltalk.method({
  655. selector: "selectedBinding",
  656. fn: function () {
  657. var self = this;
  658. var $1;
  659. $1 = smalltalk.send(smalltalk.send(self, "_keyBinder", []), "_selectedBinding", []);
  660. return $1;
  661. }
  662. }),
  663. smalltalk.HLKeyBinderHelper);
  664. smalltalk.addMethod(
  665. "_show",
  666. smalltalk.method({
  667. selector: "show",
  668. fn: function () {
  669. var self = this;
  670. smalltalk.send(self, "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
  671. return self;
  672. }
  673. }),
  674. smalltalk.HLKeyBinderHelper);
  675. smalltalk.addMethod(
  676. "_on_",
  677. smalltalk.method({
  678. selector: "on:",
  679. fn: function (aKeyBinder) {
  680. var self = this;
  681. var $2, $3, $1;
  682. $2 = smalltalk.send(self, "_new", []);
  683. smalltalk.send($2, "_keyBinder_", [aKeyBinder]);
  684. $3 = smalltalk.send($2, "_yourself", []);
  685. $1 = $3;
  686. return $1;
  687. }
  688. }),
  689. smalltalk.HLKeyBinderHelper.klass);