Project

General

Profile

1811p_all_changes.txt

Sergey Ivanovskiy, 07/31/2015 08:29 AM

Download (15.5 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.clipboard_helpers.js'
2
--- src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.clipboard_helpers.js	2015-05-18 20:48:28 +0000
3
+++ src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.clipboard_helpers.js	2015-07-31 12:09:20 +0000
4
@@ -10,10 +10,12 @@
5
 **
6
 ** -#- -I- --Date-- ------------------------------Description----------------------------------
7
 ** 001 GES 20150324 First version, with refactored content moved from tty.clipboard.js.
8
+** 002 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
9
 */
10
 
11
 p2j.clipboard_helpers = (function() 
12
 {
13
+   "use strict";
14
    /** Clipboard helper object which will be returned from this initialization function. */
15
    var me = {};
16
    
17
@@ -71,8 +73,8 @@
18
     */
19
    me.mouseDown = function(e) 
20
    {
21
-      var x = (e.pageX - this.offsetLeft) | 0;
22
-      var y = (e.pageY - this.offsetTop) | 0;
23
+      var x = (e.pageX - canvas.offsetLeft) | 0;
24
+      var y = (e.pageY - canvas.offsetTop) | 0;
25
       cells.startX = (x / charWidth) | 0;
26
       cells.startY = (y / charHeight) | 0;         
27
       rect.startX = cells.startX * charWidth;
28
@@ -87,8 +89,8 @@
29
     */
30
    me.mouseMove = function(e) 
31
    {
32
-      var x = (e.pageX - this.offsetLeft | 0);
33
-      var y = (e.pageY - this.offsetTop | 0);
34
+      var x = (e.pageX - canvas.offsetLeft) | 0;
35
+      var y = (e.pageY - canvas.offsetTop) | 0;
36
       cells.startX1 = (x / charWidth) | 0;
37
       cells.startY1 = (y / charHeight) | 0;
38
 
39

    
40
=== modified file 'src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.screen.js'
41
--- src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.screen.js	2015-05-18 20:48:28 +0000
42
+++ src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.screen.js	2015-07-31 12:09:20 +0000
43
@@ -19,10 +19,13 @@
44
 ** 007 MAG 20140821 Extended color palette.
45
 ** 008 GES 20150325 Renamed objects to match the more generic web client approach (not just
46
 **                  ChUI). Moved some logic to common code locations.
47
+** 009 SBI 20150729 Applied "use strict" directive, fixed undeclared variables,
48
+**                  added end-lines on copy.
49
 */
50
 
51
 p2j.screen = (function()
52
 {
53
+   "use strict";
54
    /** Screen object which will be returned from this initialization function. */
55
    var me = {};
56
 
57
@@ -76,10 +79,10 @@
58
       {
59
          me.color = color;
60
          memo = new Array(rows);
61
-         for (i = 0; i < rows; i++)
62
+         for (var i = 0; i < rows; i++)
63
          {
64
             memo[i] = new Array(cols);
65
-            for (j = 0; j < cols; j++)
66
+            for (var j = 0; j < cols; j++)
67
             {
68
                var cell = {'c': ' ', 'f': 'white', 'b': 'black', 'a': 0, 'k': 0};
69
                cell.f = color.f;
70
@@ -97,9 +100,9 @@
71
        */
72
       me.clear = function(rows, cols)
73
       {
74
-         for (i = 0; i < rows; i++)
75
+         for (var i = 0; i < rows; i++)
76
          {
77
-            for (j = 0; j < cols; j++)
78
+            for (var j = 0; j < cols; j++)
79
             {
80
                var v = memo[i][j];
81
                v.c = ' ';
82
@@ -156,14 +159,17 @@
83
        */
84
       me.copy = function(begRow, endRow, begCol, endCol)
85
       {
86
-         var text = "";         
87
-         for (i = begRow; i <= endRow; i++)
88
+         var text = "";
89
+         for (var i = begRow; i <= endRow; i++)
90
          {
91
-            for (j = begCol; j <= endCol; j++)
92
+            for (var j = begCol; j <= endCol; j++)
93
             {
94
                text += memo[i][j].c;
95
             }
96
-         }         
97
+            if (i < endRow) {
98
+               text += "\n";//add end of line
99
+            }
100
+         }
101
          return text;
102
       };
103
 
104

    
105
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/index.html'
106
--- src/com/goldencode/p2j/ui/client/driver/web/index.html	2015-05-18 20:48:28 +0000
107
+++ src/com/goldencode/p2j/ui/client/driver/web/index.html	2015-07-31 12:09:20 +0000
108
@@ -4,7 +4,6 @@
109
       <title>P2J ${client_title} Web Client</title>
110
       
111
       <link rel="stylesheet" type="text/css" href="/dojo-toolkit/dijit/themes/claro/claro.css">
112
-      
113
       <!-- load dojo -->      
114
       <script src="/dojo-toolkit/dojo/dojo.js" data-dojo-config="async: true"></script>  
115
             
116
@@ -17,11 +16,12 @@
117
       <script type="text/javascript" src="/client/p2j.clipboard_helpers.js"></script>
118
       <script type="text/javascript" src="/common/p2j.clipboard.js"></script>
119
       
120
-      <script>    
121
+      <script>
122
       require(["dojo"], function(dojo)
123
       {
124
          dojo.ready(function()
125
-         {               
126
+         {   
127
+            "use strict";
128
             p2j.init({
129
                'isGui' : ${isGui},
130
                'canvas' : {'id' : 'def_win', 'size' : {'${height_name}' : ${height_val}, '${width_name}' : ${width_val}}, 'mouse' : false},
131

    
132
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js'
133
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js	2015-05-18 20:48:28 +0000
134
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js	2015-07-31 12:09:20 +0000
135
@@ -14,6 +14,8 @@
136
 **                  can be used for both ChUI and GUI web clients. Client-specific portions have
137
 **                  been moved to p2j.clipboard_helpers which will have different versions for
138
 **                  ChUI and GUI.
139
+** 003 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
140
+** 004 SBI 20150731 Fixed end of lines (EOLs) by simulating key "Enter" pressed
141
 */
142
 
143
 /**
144
@@ -26,6 +28,7 @@
145
  */
146
 p2j.clipboard = (function() 
147
 {
148
+   "use strict";
149
    /** Clipboard object which will be returned from this initialization function. */
150
    var me = {};
151
    
152
@@ -69,13 +72,13 @@
153
       require(["dijit/Menu", "dijit/MenuItem", "dijit/CheckedMenuItem", "dijit/MenuSeparator", "dijit/PopupMenuItem"], 
154
       function(Menu, MenuItem, CheckedMenuItem, MenuSeparator, PopupMenuItem)
155
       {   
156
-         pMenu = new dijit.Menu(
157
+         var pMenu = new dijit.Menu(
158
          {
159
             targetNodeIds:[cfg.clipboard.id]
160
          });
161
 
162
          // select 
163
-         pMenuSelect = new dijit.CheckedMenuItem(
164
+         var pMenuSelect = new dijit.CheckedMenuItem(
165
          {
166
             iconClass:"dijitEditorIcon dijitEditorIconSelectAll",
167
             label: "Enable Clipboard",
168
@@ -196,21 +199,26 @@
169
    {
170
       if (text.length > 0)
171
       {
172
-         var msg = new Uint8Array(text.length * 2 + 1);
173
+         /**
174
+          *  Replace eol lines in order to be handled properly on the thin client
175
+          *  as it would be "Enter" pressed.
176
+          */
177
+         var text2 = text.replace(/\n/g,"\r");
178
+         var msg = new Uint8Array(text2.length * 2 + 1);
179
          msg[0] = 0x03;
180
 
181
-         for (var i = 0, j = 1;i < text.length;i++, j += 2)
182
+         for (var i = 0, j = 1;i < text2.length;i++, j += 2)
183
          {
184
-            var c = text.charCodeAt(i);
185
+            var c = text2.charCodeAt(i);
186
             msg[j + 1] = c & 0xff;
187
             c = c >> 8;
188
             msg[j] = c & 0xff;
189
          }
190
          
191
-         p2j.socket.send(msg); 
192
+         p2j.socket.send(msg.buffer); 
193
       }                     
194
    }
195
-
196
+   
197
    /**
198
     * Clipboard copy handler.
199
     * 
200
@@ -222,8 +230,8 @@
201
       if (!me.enabled)
202
          return;
203
 
204
-      // value to copy
205
-      var text = inputText.value;
206
+      // restore value to copy
207
+      var text = decodeURIComponent(inputText.value);
208
       
209
       // copy to clipboard
210
       if (window.clipboardData) 
211
@@ -255,7 +263,7 @@
212
          var text = p2j.clipboard_helpers.getSelectedText();
213
          
214
          // copy selection to clipboard
215
-         inputText.value = text;
216
+         inputText.value = encodeURIComponent(text); // to escape "\n"
217
          inputText.focus();
218
          inputText.select();
219
       }
220

    
221
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js'
222
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js	2015-05-18 20:48:28 +0000
223
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js	2015-07-31 12:09:20 +0000
224
@@ -14,6 +14,7 @@
225
 ** 003 MAG 20140702 Add tty.clipboard module.
226
 ** 004 GES 20150324 Moved this class to a common resource base and made it generic (so that it
227
 **                  can be used for both ChUI and GUI web clients.
228
+** 005 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
229
 */
230
 
231
 /**
232
@@ -31,8 +32,9 @@
233
  *    <li> p2j.clipboard
234
  * </ol>
235
  */
236
-p2j = (function()
237
+var p2j = (function()
238
 {
239
+   "use strict";
240
    /** The top-level web client object which will be returned from this function. */
241
    var me = {};
242
 
243

    
244
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js'
245
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js	2015-05-18 20:48:28 +0000
246
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js	2015-07-31 12:09:20 +0000
247
@@ -16,10 +16,12 @@
248
 ** 005 MAG 20140701 Use CTRL-C and CTRL-V to copy/paste.
249
 ** 006 GES 20150324 Moved this class to a common resource base and made it generic (so that it
250
 **                  can be used for both ChUI and GUI web clients.
251
+** 007 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
252
 */
253
 
254
 p2j.keyboard = (function()
255
 {
256
+   "use strict";
257
    /** Keyboard object which will be returned from this initialization function. */
258
    var me = {};    
259
    
260

    
261
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js'
262
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-05-18 20:48:28 +0000
263
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-07-31 12:09:20 +0000
264
@@ -13,80 +13,89 @@
265
 ** 002 MAG 20140228 Add javadoc.
266
 ** 003 GES 20150324 Moved this class to a common resource base and made it generic (so that it
267
 **                  can be used for both ChUI and GUI web clients.
268
+** 004 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
269
 */
270
 
271
 /**
272
  * Global definitions for common key values.
273
  */
274
-keys = 
275
-{
276
-   BACKSPACE: 8,
277
-   TAB: 9,
278
-   CLEAR: 12,
279
-   ENTER: 13,
280
-   SHIFT: 16,
281
-   CTRL: 17,
282
-   ALT: 18,
283
-   PAUSE: 19,
284
-   CAPS_LOCK: 20,
285
-   ESCAPE: 27,
286
-   SPACE: 32,
287
-   PAGE_UP: 33,
288
-   PAGE_DOWN: 34,
289
-   END: 35,
290
-   HOME: 36,
291
-   LEFT_ARROW: 37,
292
-   UP_ARROW: 38,
293
-   RIGHT_ARROW: 39,
294
-   DOWN_ARROW: 40,
295
-   INSERT: 45,
296
-   DELETE: 46,
297
-   HELP: 47,
298
-   LEFT_WINDOW: 91,
299
-   RIGHT_WINDOW: 92,
300
-   SELECT: 93,
301
-   NUMPAD_0: 96,
302
-   NUMPAD_1: 97,
303
-   NUMPAD_2: 98,
304
-   NUMPAD_3: 99,
305
-   NUMPAD_4: 100,
306
-   NUMPAD_5: 101,
307
-   NUMPAD_6: 102,
308
-   NUMPAD_7: 103,
309
-   NUMPAD_8: 104,
310
-   NUMPAD_9: 105,
311
-   NUMPAD_MULTIPLY: 106,
312
-   NUMPAD_PLUS: 107,
313
-   NUMPAD_ENTER: 108,
314
-   NUMPAD_MINUS: 109,
315
-   NUMPAD_PERIOD: 110,
316
-   NUMPAD_DIVIDE: 111,
317
-   F1: 112,
318
-   F2: 113,
319
-   F3: 114,
320
-   F4: 115,
321
-   F5: 116,
322
-   F6: 117,
323
-   F7: 118,
324
-   F8: 119,
325
-   F9: 120,
326
-   F10: 121,
327
-   F11: 122,
328
-   F12: 123,
329
-   F13: 124,
330
-   F14: 125,
331
-   F15: 126,
332
-   NUM_LOCK: 144,
333
-   SCROLL_LOCK: 145,
334
-   UP_DPAD: 175,
335
-   DOWN_DPAD: 176,
336
-   LEFT_DPAD: 177,
337
-   RIGHT_DPAD: 178
338
-};
339
+var keys;
340
+
341
+(function() {
342
+   "use strict";
343
+   keys = {
344
+      BACKSPACE : 8,
345
+      TAB : 9,
346
+      CLEAR : 12,
347
+      ENTER : 13,
348
+      SHIFT : 16,
349
+      CTRL : 17,
350
+      ALT : 18,
351
+      PAUSE : 19,
352
+      CAPS_LOCK : 20,
353
+      ESCAPE : 27,
354
+      SPACE : 32,
355
+      PAGE_UP : 33,
356
+      PAGE_DOWN : 34,
357
+      END : 35,
358
+      HOME : 36,
359
+      LEFT_ARROW : 37,
360
+      UP_ARROW : 38,
361
+      RIGHT_ARROW : 39,
362
+      DOWN_ARROW : 40,
363
+      INSERT : 45,
364
+      DELETE : 46,
365
+      HELP : 47,
366
+      LEFT_WINDOW : 91,
367
+      RIGHT_WINDOW : 92,
368
+      SELECT : 93,
369
+      NUMPAD_0 : 96,
370
+      NUMPAD_1 : 97,
371
+      NUMPAD_2 : 98,
372
+      NUMPAD_3 : 99,
373
+      NUMPAD_4 : 100,
374
+      NUMPAD_5 : 101,
375
+      NUMPAD_6 : 102,
376
+      NUMPAD_7 : 103,
377
+      NUMPAD_8 : 104,
378
+      NUMPAD_9 : 105,
379
+      NUMPAD_MULTIPLY : 106,
380
+      NUMPAD_PLUS : 107,
381
+      NUMPAD_ENTER : 108,
382
+      NUMPAD_MINUS : 109,
383
+      NUMPAD_PERIOD : 110,
384
+      NUMPAD_DIVIDE : 111,
385
+      F1 : 112,
386
+      F2 : 113,
387
+      F3 : 114,
388
+      F4 : 115,
389
+      F5 : 116,
390
+      F6 : 117,
391
+      F7 : 118,
392
+      F8 : 119,
393
+      F9 : 120,
394
+      F10 : 121,
395
+      F11 : 122,
396
+      F12 : 123,
397
+      F13 : 124,
398
+      F14 : 125,
399
+      F15 : 126,
400
+      NUM_LOCK : 144,
401
+      SCROLL_LOCK : 145,
402
+      UP_DPAD : 175,
403
+      DOWN_DPAD : 176,
404
+      LEFT_DPAD : 177,
405
+      RIGHT_DPAD : 178
406
+   };
407
+}());
408
 
409
 p2j.keymap = (function()
410
 {
411
-   /** Key mapping object which will be returned from this initialization function. */
412
+   "use strict";
413
+   /**
414
+    * Key mapping object which will be returned from this initialization
415
+    * function.
416
+    */
417
    var me = {};
418
    
419
    /* normal key mapping */   
420
@@ -94,7 +103,7 @@
421
    
422
    /* ALT key mapping */
423
    me.xlateAlt = {};         
424
-       
425
+   
426
    /**
427
     * Init function.
428
     */
429

    
430
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js'
431
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-05-18 20:48:28 +0000
432
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-07-31 12:09:20 +0000
433
@@ -17,10 +17,12 @@
434
 ** 006 MAG 20140402 Implements interactive child process mode.
435
 ** 007 GES 20150324 Moved this class to a common resource base and made it generic (so that it
436
 **                  can be used for both ChUI and GUI web clients.
437
+** 008 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
438
 */
439
 
440
 p2j.socket = (function()
441
 {
442
+   "use strict";
443
    /** Socket object which will be returned from this initialization function. */
444
    var me = {}; 
445
 
446

    
447
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sound.js'
448
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sound.js	2015-05-18 20:48:28 +0000
449
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sound.js	2015-07-31 12:09:20 +0000
450
@@ -13,10 +13,12 @@
451
 ** 002 MAG 20140228 Add javadoc.
452
 ** 003 GES 20150324 Moved this class to a common resource base and made it generic (so that it
453
 **                  can be used for both ChUI and GUI web clients.
454
+** 004 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
455
 */
456
 
457
 p2j.sound = (function()
458
 {
459
+   "use strict";
460
    /** Sound object which will be returned from this initialization function. */
461
    var me = {};
462
    
463
@@ -48,5 +50,5 @@
464
       }
465
    };
466
    
467
-   return me;       
468
+   return me;
469
 }());
470

    
471
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.clipboard_helpers.js'
472
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.clipboard_helpers.js	2015-05-18 20:48:28 +0000
473
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.clipboard_helpers.js	2015-07-31 12:09:20 +0000
474
@@ -10,6 +10,7 @@
475
 **
476
 ** -#- -I- --Date-- ------------------------------Description----------------------------------
477
 ** 001 GES 20150324 First version, with refactored content moved from tty.clipboard.js.
478
+** 002 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
479
 */
480
 
481
 p2j.clipboard_helpers = (function() 
482

    
483
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
484
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-05-18 20:48:28 +0000
485
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-07-31 12:09:20 +0000
486
@@ -12,10 +12,12 @@
487
 ** 001 GES 20150325 Created GUI version from ChUI version. Right now it is not functional.
488
 **                  Renamed objects to match the more generic web client approach (not just
489
 **                  ChUI). Moved some logic to common code locations.
490
+** 002 SBI 20150729 Applied "use strict" directive, fixed undeclared variables.
491
 */
492
 
493
 p2j.screen = (function()
494
 {
495
+   "use strict";
496
    /** Screen object which will be returned from this initialization function. */
497
    var me = {};
498
 
499