Advertisement
patrickc

Untitled

Aug 9th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function PopupAssistant() {
  2.     /* this is the creator function for your scene assistant object. It will be passed all the
  3.        additional parameters (after the scene name) that were passed to pushScene. The reference
  4.        to the scene controller (this.controller) has not be established yet, so any initialization
  5.        that needs the scene controller should be done in the setup function below. */
  6. }
  7.  
  8. PopupAssistant.prototype.setup = function() {
  9. this.keyTap = this.keyTap.bind(this);
  10.     this.controller.listen(this.controller.get('E'), Mojo.Event.tap, this.keyTap);
  11.     this.controller.listen(this.controller.get('X'), Mojo.Event.tap, this.keyTap);
  12.     this.controller.listen(this.controller.get('D'), Mojo.Event.tap, this.keyTap);
  13.     this.controller.listen(this.controller.get('S'), Mojo.Event.tap, this.keyTap);
  14.     this.controller.listen(this.controller.get('C'), Mojo.Event.tap, this.keyTap);
  15.     this.controller.listen(this.controller.get('T'), Mojo.Event.tap, this.keyTap);
  16.     this.controller.listen(this.controller.get('SHIFT'), Mojo.Event.tap, this.keyTap);
  17.     this.controller.listen(this.controller.get('J'), Mojo.Event.tap, this.keyTap);
  18.     this.controller.listen(this.controller.get('K'), Mojo.Event.tap, this.keyTap);
  19.     this.controller.listen(this.controller.get('R'), Mojo.Event.tap, this.keyTap);
  20.     this.controller.listen(this.controller.get('H'), Mojo.Event.tap, this.keyTap);
  21.     this.controller.listen(this.controller.get('F'), Mojo.Event.tap, this.keyTap);
  22.     this.controller.listen(this.controller.get('BACK'), Mojo.Event.tap, this.keyTap);
  23.     this.controller.listen(this.controller.get('L'), Mojo.Event.tap, this.keyTap);
  24.     this.controller.listen(this.controller.get('B'), Mojo.Event.tap, this.keyTap);
  25.     this.controller.listen(this.controller.get('N'), Mojo.Event.tap, this.keyTap);
  26.     this.controller.listen(this.controller.get('U'), Mojo.Event.tap, this.keyTap);
  27.     this.controller.listen(this.controller.get('V'), Mojo.Event.tap, this.keyTap);
  28.     this.controller.listen(this.controller.get('Y'), Mojo.Event.tap, this.keyTap);
  29.     this.controller.listen(this.controller.get('Z'), Mojo.Event.tap, this.keyTap);
  30.     this.controller.listen(this.controller.get('G'), Mojo.Event.tap, this.keyTap);
  31.     this.controller.listen(this.controller.get('I'), Mojo.Event.tap, this.keyTap);
  32.     this.controller.listen(this.controller.get('O'), Mojo.Event.tap, this.keyTap);
  33.     this.controller.listen(this.controller.get('P'), Mojo.Event.tap, this.keyTap);
  34.     this.controller.listen(this.controller.get('M'), Mojo.Event.tap, this.keyTap);
  35.     this.controller.listen(this.controller.get('ENTER'), Mojo.Event.tap, this.keyTap);
  36.     this.controller.listen(this.controller.get('Q'), Mojo.Event.tap, this.keyTap);
  37.     this.controller.listen(this.controller.get('W'), Mojo.Event.tap, this.keyTap);
  38.     this.controller.listen(this.controller.get('A'), Mojo.Event.tap, this.keyTap);
  39.     this.controller.listen(this.controller.get('OPTION'), Mojo.Event.tap, this.keyTap);
  40.     this.controller.listen(this.controller.get('SPACE'), Mojo.Event.tap, this.keyTap); 
  41.     this.controller.listen(this.controller.get('exc'), Mojo.Event.tap, this.keyTap);   
  42.     this.controller.listen(this.controller.get('qut'), Mojo.Event.tap, this.keyTap);   
  43.     this.controller.listen(this.controller.get('at'), Mojo.Event.tap, this.keyTap);
  44.     this.controller.listen(this.controller.get('per'), Mojo.Event.tap, this.keyTap);   
  45.     this.controller.listen(this.controller.get('com'), Mojo.Event.tap, this.keyTap);   
  46.     this.controller.listen(this.controller.get('inv'), Mojo.Event.tap, this.keyTap);   
  47.  
  48. };
  49.  
  50. PopupAssistant.prototype.activate = function(event) {
  51.     this.keyTap();
  52.     if (keyTapped === 'ENTER')
  53.         this.keysSetup();
  54.     /*else
  55.         this.keySetupLc();*/
  56.  
  57. };
  58.  
  59. //set up the kets
  60. PopupAssistant.prototype.keyTap = function(event) {
  61. keyTapped = event.srcElement.id
  62.    
  63.     if (keyTapped === 'E') {letter = E}
  64.     else if (keyTapped === 'X') {letter = X}
  65.     else if (keyTapped === 'D') {letter = D}
  66.     else if (keyTapped === 'S') {letter = S}
  67.     else if (keyTapped === 'C') {letter = C}
  68.     else if (keyTapped === 'T') {letter = T}
  69.     else if (keyTapped === 'SHIFT') {letter = SHIFT}
  70.     else if (keyTapped === 'J') {letter = J}
  71.     else if (keyTapped === 'K') {letter = K}
  72.     else if (keyTapped === 'R') {letter = R}
  73.     else if (keyTapped === 'H') {letter = H}
  74.     else if (keyTapped === 'F') {letter = F}
  75.     else if (keyTapped === 'BACK') {letter = BACK}
  76.     else if (keyTapped === 'L') {letter = L}
  77.     else if (keyTapped === 'B') {letter = B}
  78.     else if (keyTapped === 'N') {letter = N}
  79.     else if (keyTapped === 'U') {letter = U}
  80.     else if (keyTapped === 'V') {letter = V}
  81.     else if (keyTapped === 'Y') {letter = Y}
  82.     else if (keyTapped === 'Z') {letter = Z}
  83.     else if (keyTapped === 'G') {letter = G}
  84.     else if (keyTapped === 'I') {letter = I}
  85.     else if (keyTapped === 'O') {letter = O}
  86.     else if (keyTapped === 'P') {letter = P}
  87.     else if (keyTapped === 'M') {letter = M}
  88.     else if (keyTapped === 'ENTER') {/*send message*/}
  89.     else if (keyTapped === 'Q') {letter = Q}
  90.     else if (keyTapped === 'W') {letter = W}
  91.     else if (keyTapped === 'A') {letter = A}
  92.     else if (keyTapped === 'OPTION') {letter = OPTION}
  93.     else if (keyTapped === 'SPACE') {letter = ' ' }
  94.     else if (keyTapped === 'exc') {letter = '!'}
  95.     else if (keyTapped === 'qut') {letter = '?'}
  96.     else if (keyTapped === 'at') {letter = '@'}
  97.     else if (keyTapped === 'per') {letter = '.'}
  98.     else if (keyTapped === 'com') {letter = '‚'}
  99.     else if (keyTapped === 'inv') {letter = '"'}
  100.  
  101. var printtext = letter ;
  102. this.controller.get("text").innerHTML = printtext;
  103. viewtext = this.controller.get("text").innerHTML   
  104. this.controller.stageController.setClipboard(viewtext);
  105. if (PalmSystem && PalmSystem.paste) {
  106. PalmSystem.paste()
  107. }
  108. //this.window.PalmSystem.deactivate();
  109. };
  110.  
  111. PopupAssistant.prototype.keysSetupLc = function(event) {
  112.     E       = 'e';
  113.     X       = 'X';
  114.     D       = 'D';
  115.     S       = 'S';
  116.     C       = 'C';
  117.     T       = 'T';
  118.     //shift
  119.     SHIFT   = '↑';
  120.     J       = 'J';
  121.     K       = 'K';
  122.     R       = 'R';
  123.     H       = 'H';
  124.     F       = 'F';
  125.     //backspace
  126.     BACK    = '←';
  127.     L       = 'L';
  128.     B       = 'B';
  129.     N       = 'N';
  130.     U       = 'U';
  131.     V       = 'V';
  132.     Y       = 'Y';
  133.     Z       = 'Z';
  134.     G       = 'G';
  135.     I       = 'I';
  136.     O       = 'O';
  137.     //enter key - - - not functioning yet
  138.     //ENTER = 'enter';
  139.     P       = 'P';
  140.     M       = 'M';
  141.     Q       = 'Q';
  142.     W       = 'W';
  143.     A       = 'A';
  144.     //option key
  145.     OPTION      = 'Ξ';
  146.    
  147.     this.controller.get('Q').update(Q)
  148.     this.controller.get('W').update(W)
  149.     this.controller.get('E').update(E)
  150.     this.controller.get('R').update(R)
  151.     this.controller.get('T').update(T)
  152.     this.controller.get('Y').update(Y)
  153.     this.controller.get('U').update(U)
  154.     this.controller.get('I').update(I)
  155.     this.controller.get('O').update(O)
  156.     this.controller.get('A').update(A)
  157.     this.controller.get('S').update(S)
  158.     this.controller.get('D').update(D)
  159.     this.controller.get('F').update(F)
  160.     this.controller.get('G').update(G)
  161.     this.controller.get('H').update(H)
  162.     this.controller.get('J').update(J)
  163.     this.controller.get('K').update(K)
  164.     this.controller.get('L').update(L)
  165.     this.controller.get('BACK').update(BACK)
  166.     this.controller.get('P').update(P)
  167.     this.controller.get('SHIFT').update(SHIFT)
  168.     this.controller.get('Z').update(Z)
  169.     this.controller.get('X').update(X)
  170.     this.controller.get('C').update(C)
  171.     this.controller.get('V').update(V)
  172.     this.controller.get('B').update(B)
  173.     this.controller.get('N').update(N)
  174.     this.controller.get('M').update(M)
  175.     this.controller.get('OPTION').update(OPTION)
  176.     this.controller.get('ENTER').update(ENTER)
  177.    
  178.    
  179. }
  180.  
  181. //Set up the key characters
  182. PopupAssistant.prototype.keysSetup = function(event) {
  183.     E       = 'E';
  184.     X       = 'X';
  185.     D       = 'D';
  186.     S       = 'S';
  187.     C       = 'C';
  188.     T       = 'T';
  189.     //shift
  190.     SHIFT       = '↑';
  191.     J       = 'J';
  192.     K       = 'K';
  193.     R       = 'R';
  194.     H       = 'H';
  195.     F       = 'F';
  196.     //backspace
  197.     BACK    = '←';
  198.     L       = 'L';
  199.     B       = 'B';
  200.     N       = 'N';
  201.     U       = 'U';
  202.     V       = 'V';
  203.     Y       = 'Y';
  204.     Z       = 'Z';
  205.     G       = 'G';
  206.     I       = 'I';
  207.     O       = 'O';
  208.     //enter key - - - not functioning yet
  209.     //ENTER = 'enter';
  210.     P       = 'P';
  211.     M       = 'M';
  212.     Q       = 'Q';
  213.     W       = 'W';
  214.     A       = 'A';
  215.     //option key
  216.     OPTION      = 'Ξ';
  217.    
  218.     this.controller.get('Q').update(Q)
  219.     this.controller.get('W').update(W)
  220.     this.controller.get('E').update(E)
  221.     this.controller.get('R').update(R)
  222.     this.controller.get('T').update(T)
  223.     this.controller.get('Y').update(Y)
  224.     this.controller.get('U').update(U)
  225.     this.controller.get('I').update(I)
  226.     this.controller.get('O').update(O)
  227.     this.controller.get('A').update(A)
  228.     this.controller.get('S').update(S)
  229.     this.controller.get('D').update(D)
  230.     this.controller.get('F').update(F)
  231.     this.controller.get('G').update(G)
  232.     this.controller.get('H').update(H)
  233.     this.controller.get('J').update(J)
  234.     this.controller.get('K').update(K)
  235.     this.controller.get('L').update(L)
  236.     this.controller.get('BACK').update(BACK)
  237.     this.controller.get('P').update(P)
  238.     this.controller.get('SHIFT').update(SHIFT)
  239.     this.controller.get('Z').update(Z)
  240.     this.controller.get('X').update(X)
  241.     this.controller.get('C').update(C)
  242.     this.controller.get('V').update(V)
  243.     this.controller.get('B').update(B)
  244.     this.controller.get('N').update(N)
  245.     this.controller.get('M').update(M)
  246.     this.controller.get('OPTION').update(OPTION)
  247.     this.controller.get('ENTER').update(ENTER)
  248.    
  249.    
  250. }
  251. /*PopupAssistant.prototype.onTap = function(event) {
  252. temptext = 'helpme';
  253.  this.controller.stageController.setClipboard(temptext);
  254.  
  255. if (PalmSystem && PalmSystem.paste) {
  256.    
  257.  
  258.     PalmSystem.paste()
  259. }
  260. };*/
  261.  
  262. PopupAssistant.prototype.deactivate = function(event) {
  263.     /* remove any event handlers you added in activate and do any other cleanup that should happen before
  264.        this scene is popped or another scene is pushed on top */
  265. };
  266.  
  267. PopupAssistant.prototype.cleanup = function(event) {
  268.     /* this function should do any cleanup needed before the scene is destroyed as
  269.        a result of being popped off the scene stack */
  270. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement