unageanu-jiji 1.1.4 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/ChangeLog +24 -1
  2. data/README +0 -0
  3. data/base/shared_lib/moving_average.rb +34 -33
  4. data/base/shared_lib/system/cross.rb +76 -0
  5. data/base/shared_lib/system/position_manager.rb +160 -0
  6. data/base/shared_lib/system/signal.rb +347 -0
  7. data/html/css/datatable.css +4 -4
  8. data/html/css/default.css +57 -5
  9. data/html/css/treeview.css +205 -0
  10. data/html/img/bin_closed.png +0 -0
  11. data/html/img/bin_empty.png +0 -0
  12. data/html/img/button_add_small.gif +0 -0
  13. data/html/img/button_add_small_gray.gif +0 -0
  14. data/html/img/button_add_small_over.gif +0 -0
  15. data/html/img/button_mkcol.gif +0 -0
  16. data/html/img/button_mkcol_gray.gif +0 -0
  17. data/html/img/button_mkcol_over.gif +0 -0
  18. data/html/img/button_remove_small.gif +0 -0
  19. data/html/img/button_remove_small_gray.gif +0 -0
  20. data/html/img/button_remove_small_over.gif +0 -0
  21. data/html/img/button_rename.gif +0 -0
  22. data/html/img/button_rename_gray.gif +0 -0
  23. data/html/img/button_rename_over.gif +0 -0
  24. data/html/img/control_play.png +0 -0
  25. data/html/img/control_play_blue.png +0 -0
  26. data/html/img/folder.png +0 -0
  27. data/html/img/folder_brick.png +0 -0
  28. data/html/img/folder_user.png +0 -0
  29. data/html/{js/codepress/images → img}/line-numbers.png +0 -0
  30. data/html/img/page_white_ruby.png +0 -0
  31. data/html/img/sidebar_agent_edit.png +0 -0
  32. data/html/img/sidebar_agent_edit_over.png +0 -0
  33. data/html/img/sidebar_agent_edit_s.png +0 -0
  34. data/html/img/yui/treeview-sprite.gif +0 -0
  35. data/html/index.html +34 -18
  36. data/html/js/agent-editor/agent-editor-page.js +324 -0
  37. data/html/js/agent-editor/agent-editor.js +363 -0
  38. data/html/js/agent-editor/agent-list-tree.js +251 -0
  39. data/html/js/agent-selector.js +23 -28
  40. data/html/js/app.js +63 -91
  41. data/html/js/bt-create-page.js +25 -19
  42. data/html/js/container-min.js +1 -1
  43. data/html/js/container.js +944 -0
  44. data/html/js/edit_area/autocompletion.js +11 -13
  45. data/html/js/edit_area/edit_area.css +79 -40
  46. data/html/js/edit_area/edit_area.js +255 -226
  47. data/html/js/edit_area/edit_area_compressor.php +4 -4
  48. data/html/js/edit_area/edit_area_full.gz +0 -0
  49. data/html/js/edit_area/edit_area_full.js +31 -31
  50. data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
  51. data/html/js/edit_area/edit_area_full_with_plugins.js +31 -31
  52. data/html/js/edit_area/edit_area_functions.js +448 -341
  53. data/html/js/edit_area/edit_area_loader.js +409 -397
  54. data/html/js/edit_area/elements_functions.js +120 -123
  55. data/html/js/edit_area/highlight.js +305 -197
  56. data/html/js/edit_area/images/goto.png +0 -0
  57. data/html/js/edit_area/images/help.png +0 -0
  58. data/html/js/edit_area/images/redo.png +0 -0
  59. data/html/js/edit_area/images/save.png +0 -0
  60. data/html/js/edit_area/images/search.png +0 -0
  61. data/html/js/edit_area/images/undo.png +0 -0
  62. data/html/js/edit_area/images/word_wrap.gif +0 -0
  63. data/html/js/edit_area/keyboard.js +5 -5
  64. data/html/js/edit_area/langs/bg.js +73 -0
  65. data/html/js/edit_area/langs/cs.js +2 -0
  66. data/html/js/edit_area/langs/de.js +2 -0
  67. data/html/js/edit_area/langs/dk.js +2 -0
  68. data/html/js/edit_area/langs/en.js +2 -0
  69. data/html/js/edit_area/langs/eo.js +2 -0
  70. data/html/js/edit_area/langs/es.js +2 -0
  71. data/html/js/edit_area/langs/fi.js +67 -0
  72. data/html/js/edit_area/langs/fr.js +2 -0
  73. data/html/js/edit_area/langs/hr.js +2 -0
  74. data/html/js/edit_area/langs/it.js +2 -0
  75. data/html/js/edit_area/langs/ja.js +2 -0
  76. data/html/js/edit_area/langs/mk.js +2 -0
  77. data/html/js/edit_area/langs/nl.js +2 -0
  78. data/html/js/edit_area/langs/pl.js +2 -0
  79. data/html/js/edit_area/langs/pt.js +2 -0
  80. data/html/js/edit_area/langs/ru.js +2 -0
  81. data/html/js/edit_area/langs/sk.js +2 -0
  82. data/html/js/edit_area/langs/zh.js +67 -0
  83. data/html/js/edit_area/manage_area.js +362 -205
  84. data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
  85. data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
  86. data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
  87. data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
  88. data/html/js/edit_area/reg_syntax/java.js +56 -0
  89. data/html/js/edit_area/reg_syntax/ruby.js +9 -9
  90. data/html/js/edit_area/reg_syntax.js +15 -13
  91. data/html/js/edit_area/regexp.js +36 -32
  92. data/html/js/edit_area/resize_area.js +43 -47
  93. data/html/js/edit_area/search_replace.js +29 -29
  94. data/html/js/edit_area/template.html +6 -4
  95. data/html/js/json-broker-client.js +23 -17
  96. data/html/js/result-page.js +107 -57
  97. data/html/js/rt-setting-page.js +38 -15
  98. data/html/js/sidebar.js +41 -27
  99. data/html/js/templates.js +167 -32
  100. data/html/js/utils.js +143 -7
  101. data/html/js/yui/treeview.js +3671 -0
  102. data/html/swf/chart.swf +0 -0
  103. data/html/test/agent_editor_spec.js +815 -0
  104. data/html/test/index.html +40 -0
  105. data/html/test/jsspec/JSSpec.css +224 -0
  106. data/html/test/jsspec/JSSpec.js +1549 -0
  107. data/html/test/jsspec/diff_match_patch.js +1 -0
  108. data/html/test/utils_spec.js +111 -0
  109. data/lib/jiji/agent/agent.rb +69 -12
  110. data/lib/jiji/agent/agent_manager.rb +18 -12
  111. data/lib/jiji/agent/agent_registry.rb +35 -121
  112. data/lib/jiji/collector.rb +16 -6
  113. data/lib/jiji/command.rb +46 -5
  114. data/lib/jiji/dao/file_system_dao.rb +158 -0
  115. data/lib/jiji/dao/timed_data_dao.rb +2 -0
  116. data/lib/jiji/dao/trade_result_dao.rb +1 -1
  117. data/lib/jiji/error.rb +24 -8
  118. data/lib/jiji/migration/migrator1_2_0.rb +67 -0
  119. data/lib/jiji/models.rb +82 -24
  120. data/lib/jiji/operator.rb +55 -51
  121. data/lib/jiji/output.rb +85 -29
  122. data/lib/jiji/output_manager.rb +84 -0
  123. data/lib/jiji/plugin/embedded/single_click_client.rb +2 -2
  124. data/lib/jiji/plugin/securities_plugin.rb +0 -1
  125. data/lib/jiji/process.rb +229 -208
  126. data/lib/jiji/process_manager.rb +190 -96
  127. data/lib/jiji/registry.rb +87 -19
  128. data/lib/jiji/server.rb +1 -0
  129. data/lib/jiji/service/agent_service.rb +147 -48
  130. data/lib/jiji/service/output_service.rb +37 -17
  131. data/lib/jiji/service/process_service.rb +3 -5
  132. data/lib/jiji/service/trade_result_service.rb +4 -5
  133. data/lib/jiji/util/file_lock.rb +4 -4
  134. data/lib/jiji/util/include_proxy.rb +17 -0
  135. data/lib/jiji/util/json_broker.rb +6 -4
  136. data/lib/jiji/util/util.rb +1 -1
  137. data/swf/chart/fx/chart/Chart.as +7 -0
  138. data/swf/chart/fx/chart/ui/graph/GraphManager.as +15 -2
  139. data/test/ProcessTest/agents/foo.rb +10 -0
  140. data/test/ProcessTest/conf/configuration.yaml +3 -0
  141. data/test/agent/agent_tests.rb +10 -0
  142. data/test/agent/test_AgentManager.rb +28 -12
  143. data/test/agent/test_AgentRegistry.rb +194 -99
  144. data/test/agent/test_PeriodicallyAgent.rb +1 -2
  145. data/test/agent/test_Permitter.rb +1 -2
  146. data/test/all_tests.rb +7 -19
  147. data/test/dao/dao_tests.rb +9 -0
  148. data/test/dao/test_FileSystemDao.rb +431 -0
  149. data/test/dao/test_RateDao.rb +5 -7
  150. data/test/dao/test_TradeResultDao.rb +1 -2
  151. data/test/migration/migration_tests.rb +10 -0
  152. data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  153. data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  154. data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  155. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  156. data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
  157. data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  158. data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  159. data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  160. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  161. data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
  162. data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
  163. data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  164. data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  165. data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  166. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  167. data/test/migration/test_Migrator.rb +1 -1
  168. data/test/migration/test_Migrator1_0_3.rb +1 -1
  169. data/test/migration/test_Migrator1_1_0.rb +1 -1
  170. data/test/migration/test_Migrator1_2_0.rb +94 -0
  171. data/test/plugin/embedded/test_SingleClickClient.rb +1 -2
  172. data/test/plugin/plugin_tests.rb +8 -0
  173. data/test/plugin/test_Loader.rb +1 -1
  174. data/test/shared/rate.csv +144 -0
  175. data/test/shared/shared_tests.rb +9 -0
  176. data/test/shared/test_Cross.rb +144 -0
  177. data/test/shared/test_PositionManager.rb +285 -0
  178. data/test/shared/test_Signal.rb +65 -0
  179. data/test/test_Output.rb +28 -21
  180. data/test/test_OutputManager.rb +162 -0
  181. data/test/test_Output_registry.rb +6 -17
  182. data/test/test_Process.rb +434 -222
  183. data/test/test_ProcessManager.rb +458 -101
  184. data/test/test_utils.rb +71 -8
  185. data/test/util/test_BlockToSession.rb +1 -2
  186. data/test/util/test_CSV.rb +1 -2
  187. data/test/util/test_SynchronizeInterceptor.rb +1 -2
  188. data/test/util/util_tests.rb +9 -0
  189. metadata +127 -47
  190. data/html/js/agent-editor-page.js +0 -440
  191. data/html/js/codepress/codepress.css +0 -21
  192. data/html/js/codepress/codepress.html +0 -35
  193. data/html/js/codepress/codepress.js +0 -138
  194. data/html/js/codepress/engines/gecko.js +0 -293
  195. data/html/js/codepress/engines/khtml.js +0 -0
  196. data/html/js/codepress/engines/msie.js +0 -304
  197. data/html/js/codepress/engines/older.js +0 -0
  198. data/html/js/codepress/engines/opera.js +0 -260
  199. data/html/js/codepress/images/line-numbers.gif +0 -0
  200. data/html/js/codepress/index.html +0 -443
  201. data/html/js/codepress/languages/asp.css +0 -71
  202. data/html/js/codepress/languages/asp.js +0 -117
  203. data/html/js/codepress/languages/autoit.css +0 -13
  204. data/html/js/codepress/languages/autoit.js +0 -32
  205. data/html/js/codepress/languages/csharp.css +0 -9
  206. data/html/js/codepress/languages/csharp.js +0 -25
  207. data/html/js/codepress/languages/css.css +0 -10
  208. data/html/js/codepress/languages/css.js +0 -23
  209. data/html/js/codepress/languages/generic.css +0 -9
  210. data/html/js/codepress/languages/generic.js +0 -25
  211. data/html/js/codepress/languages/html.css +0 -13
  212. data/html/js/codepress/languages/html.js +0 -59
  213. data/html/js/codepress/languages/java.css +0 -7
  214. data/html/js/codepress/languages/java.js +0 -24
  215. data/html/js/codepress/languages/javascript.css +0 -8
  216. data/html/js/codepress/languages/javascript.js +0 -30
  217. data/html/js/codepress/languages/perl.css +0 -11
  218. data/html/js/codepress/languages/perl.js +0 -27
  219. data/html/js/codepress/languages/php.css +0 -12
  220. data/html/js/codepress/languages/php.js +0 -61
  221. data/html/js/codepress/languages/ruby.css +0 -10
  222. data/html/js/codepress/languages/ruby.js +0 -26
  223. data/html/js/codepress/languages/sql.css +0 -10
  224. data/html/js/codepress/languages/sql.js +0 -30
  225. data/html/js/codepress/languages/text.css +0 -5
  226. data/html/js/codepress/languages/text.js +0 -9
  227. data/html/js/codepress/languages/vbscript.css +0 -71
  228. data/html/js/codepress/languages/vbscript.js +0 -117
  229. data/html/js/codepress/languages/xsl.css +0 -15
  230. data/html/js/codepress/languages/xsl.js +0 -103
  231. data/html/js/codepress/license.txt +0 -458
  232. data/html/js/edit_area/images/Thumbs.db +0 -0
  233. data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +0 -6
@@ -1,8 +1,8 @@
1
1
  // change_to: "on" or "off"
2
2
  EditArea.prototype.change_highlight= function(change_to){
3
3
  if(this.settings["syntax"].length==0 && change_to==false){
4
- this.switchClassSticky($("highlight"), 'editAreaButtonDisabled', true);
5
- this.switchClassSticky($("reset_highlight"), 'editAreaButtonDisabled', true);
4
+ this.switchClassSticky(_$("highlight"), 'editAreaButtonDisabled', true);
5
+ this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonDisabled', true);
6
6
  return false;
7
7
  }
8
8
 
@@ -10,8 +10,7 @@
10
10
  return false;
11
11
 
12
12
 
13
- if(this.nav['isIE'])
14
- this.getIESelection();
13
+ this.getIESelection();
15
14
  var pos_start= this.textarea.selectionStart;
16
15
  var pos_end= this.textarea.selectionEnd;
17
16
 
@@ -22,261 +21,370 @@
22
21
  this.textarea.focus();
23
22
  this.textarea.selectionStart = pos_start;
24
23
  this.textarea.selectionEnd = pos_end;
25
- if(this.nav['isIE'])
26
- this.setIESelection();
24
+ this.setIESelection();
27
25
 
28
26
  };
29
27
 
30
- EditArea.prototype.disable_highlight= function(displayOnly){
31
- this.selection_field.innerHTML="";
32
- this.content_highlight.style.visibility="hidden";
28
+ EditArea.prototype.disable_highlight= function(displayOnly){
29
+ var t= this, a=t.textarea, new_Obj, old_class, new_class;
30
+
31
+ t.selection_field.innerHTML="";
32
+ t.selection_field_text.innerHTML="";
33
+ t.content_highlight.style.visibility="hidden";
33
34
  // replacing the node is far more faster than deleting it's content in firefox
34
- var new_Obj= this.content_highlight.cloneNode(false);
35
+ new_Obj= t.content_highlight.cloneNode(false);
35
36
  new_Obj.innerHTML= "";
36
- this.content_highlight.parentNode.insertBefore(new_Obj, this.content_highlight);
37
- this.content_highlight.parentNode.removeChild(this.content_highlight);
38
- this.content_highlight= new_Obj;
39
- var old_class= parent.getAttribute(this.textarea,"class");
37
+ t.content_highlight.parentNode.insertBefore(new_Obj, t.content_highlight);
38
+ t.content_highlight.parentNode.removeChild(t.content_highlight);
39
+ t.content_highlight= new_Obj;
40
+ old_class= parent.getAttribute( a,"class" );
40
41
  if(old_class){
41
- var new_class= old_class.replace("hidden","");
42
- parent.setAttribute(this.textarea, "class", new_class);
42
+ new_class= old_class.replace( "hidden","" );
43
+ parent.setAttribute( a, "class", new_class );
43
44
  }
44
45
 
45
- this.textarea.style.backgroundColor="transparent"; // needed in order to see the bracket finders
46
+ a.style.backgroundColor="transparent"; // needed in order to see the bracket finders
46
47
 
47
48
  //var icon= document.getElementById("highlight");
48
49
  //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") );
49
- //this.restoreClass(icon);
50
- //this.switchClass(icon,'editAreaButtonNormal');
51
- this.switchClassSticky($("highlight"), 'editAreaButtonNormal', true);
52
- this.switchClassSticky($("reset_highlight"), 'editAreaButtonDisabled', true);
50
+ //t.restoreClass(icon);
51
+ //t.switchClass(icon,'editAreaButtonNormal');
52
+ t.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', true);
53
+ t.switchClassSticky(_$("reset_highlight"), 'editAreaButtonDisabled', true);
53
54
 
54
- this.do_highlight=false;
55
+ t.do_highlight=false;
55
56
 
56
- this.switchClassSticky($("change_smooth_selection"), 'editAreaButtonSelected', true);
57
- if(typeof(this.smooth_selection_before_highlight)!="undefined" && this.smooth_selection_before_highlight===false){
58
- this.change_smooth_selection_mode(false);
57
+ t.switchClassSticky(_$("change_smooth_selection"), 'editAreaButtonSelected', true);
58
+ if(typeof(t.smooth_selection_before_highlight)!="undefined" && t.smooth_selection_before_highlight===false){
59
+ t.change_smooth_selection_mode(false);
59
60
  }
60
61
 
61
62
  // this.textarea.style.backgroundColor="#FFFFFF";
62
63
  };
63
64
 
64
65
  EditArea.prototype.enable_highlight= function(){
65
- this.show_waiting_screen();
66
+ var t=this, a=t.textarea, new_class;
67
+ t.show_waiting_screen();
66
68
 
67
- this.content_highlight.style.visibility="visible";
68
- var new_class=parent.getAttribute(this.textarea,"class")+" hidden";
69
- parent.setAttribute(this.textarea, "class", new_class);
69
+ t.content_highlight.style.visibility="visible";
70
+ new_class =parent.getAttribute(a,"class")+" hidden";
71
+ parent.setAttribute( a, "class", new_class );
70
72
 
71
- if(this.nav['isIE'])
72
- this.textarea.style.backgroundColor="#FFFFFF"; // IE can't manage mouse click outside text range without this
73
+ // IE can't manage mouse click outside text range without this
74
+ if( t.isIE )
75
+ a.style.backgroundColor="#FFFFFF";
73
76
 
74
- //var icon= document.getElementById("highlight");
75
- //setAttribute(icon, "class", getAttribute(icon, "class") + " selected");
76
- //this.switchClass(icon,'editAreaButtonSelected');
77
- //this.switchClassSticky($("highlight"), 'editAreaButtonNormal', false);
78
- this.switchClassSticky($("highlight"), 'editAreaButtonSelected', false);
79
- this.switchClassSticky($("reset_highlight"), 'editAreaButtonNormal', false);
77
+ t.switchClassSticky(_$("highlight"), 'editAreaButtonSelected', false);
78
+ t.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false);
80
79
 
81
- this.smooth_selection_before_highlight=this.smooth_selection;
82
- if(!this.smooth_selection)
83
- this.change_smooth_selection_mode(true);
84
- this.switchClassSticky($("change_smooth_selection"), 'editAreaButtonDisabled', true);
80
+ t.smooth_selection_before_highlight=t.smooth_selection;
81
+ if(!t.smooth_selection)
82
+ t.change_smooth_selection_mode(true);
83
+ t.switchClassSticky(_$("change_smooth_selection"), 'editAreaButtonDisabled', true);
85
84
 
86
85
 
87
- this.do_highlight=true;
88
- this.resync_highlight();
86
+ t.do_highlight=true;
87
+ t.resync_highlight();
89
88
 
90
- this.hide_waiting_screen();
91
- //area.onkeyup="";
92
- /*if(!displayOnly){
93
- this.do_highlight=true;
94
- this.reSync();
95
- if(this.state=="loaded")
96
- this.textarea.focus();
97
- }*/
98
-
89
+ t.hide_waiting_screen();
99
90
  };
100
91
 
101
-
92
+ /**
93
+ * Ask to update highlighted text
94
+ * @param Array infos - Array of datas returned by EditArea.get_selection_infos()
95
+ */
102
96
  EditArea.prototype.maj_highlight= function(infos){
103
- if(this.last_highlight_base_text==infos["full_text"] && this.resync_highlight!==true)
104
- return;
105
-
106
- //var infos= this.getSelectionInfos();
107
- if(infos["full_text"].indexOf("\r")!=-1)
108
- text_to_highlight= infos["full_text"].replace(/\r/g, "");
109
- else
110
- text_to_highlight= infos["full_text"];
111
-
112
- // for optimisation process
113
- var start_line_pb=-1;
114
- var end_line_pb=-1;
115
-
116
- var stay_begin="";
117
- var stay_end="";
118
-
119
-
120
- var debug_opti="";
121
-
122
97
  // for speed mesure
123
- var date= new Date();
124
- var tps_start=date.getTime();
125
- var tps_middle_opti=date.getTime();
98
+ var debug_opti="",tps_start= new Date().getTime(), tps_middle_opti=new Date().getTime();
99
+ var t=this, hightlighted_text, updated_highlight;
100
+ var textToHighlight=infos["full_text"], doSyntaxOpti = false, doHtmlOpti = false, stay_begin="", stay_end="", trace_new , trace_last;
126
101
 
102
+ if(t.last_text_to_highlight==infos["full_text"] && t.resync_highlight!==true)
103
+ return;
127
104
 
128
105
  // OPTIMISATION: will search to update only changed lines
129
- if(this.reload_highlight===true){
130
- this.reload_highlight=false;
131
- }else if(text_to_highlight.length==0){
132
- text_to_highlight="\n ";
133
- }else{
134
- var base_step=200;
106
+ if(t.reload_highlight===true){
107
+ t.reload_highlight=false;
108
+ }else if(textToHighlight.length==0){
109
+ textToHighlight="\n ";
110
+ }else{
111
+ // get text change datas
112
+ changes = t.checkTextEvolution(t.last_text_to_highlight,textToHighlight);
135
113
 
136
- var cpt= 0;
137
- var end= Math.min(text_to_highlight.length, this.last_text_to_highlight.length);
138
- var step= base_step;
139
- // find how many chars are similar at the begin of the text
140
- while(cpt<end && step>=1){
141
- if(this.last_text_to_highlight.substr(cpt, step) == text_to_highlight.substr(cpt, step)){
142
- cpt+= step;
143
- }else{
144
- step= Math.floor(step/2);
145
- }
146
- }
147
- var pos_start_change=cpt;
148
- var line_start_change= text_to_highlight.substr(0, pos_start_change).split("\n").length -1;
114
+ // check if it can only reparse the changed text
115
+ trace_new = t.get_syntax_trace(changes.newTextLine).replace(/\r/g, '');
116
+ trace_last = t.get_syntax_trace(changes.lastTextLine).replace(/\r/g, '');
117
+ doSyntaxOpti = ( trace_new == trace_last );
149
118
 
150
- cpt_last= this.last_text_to_highlight.length;
151
- cpt= text_to_highlight.length;
152
- step= base_step;
153
- // find how many chars are similar at the end of the text
154
- while(cpt>=0 && cpt_last>=0 && step>=1){
155
- if(this.last_text_to_highlight.substr(cpt_last-step, step) == text_to_highlight.substr(cpt-step, step)){
156
- cpt-= step;
157
- cpt_last-= step;
158
- }else{
159
- step= Math.floor(step/2);
160
- }
119
+ // check if the difference comes only from a new line created
120
+ // => we have to remember that the editor can automaticaly add tabulation or space after the new line)
121
+ if( !doSyntaxOpti && trace_new == "\n"+trace_last && /^[ \t\s]*\n[ \t\s]*$/.test( changes.newText.replace(/\r/g, '') ) && changes.lastText =="" )
122
+ {
123
+ doSyntaxOpti = true;
161
124
  }
162
- //cpt_last=Math.max(0, cpt_last);
163
- var pos_new_end_change= cpt;
164
- var pos_last_end_change= cpt_last;
165
- if(pos_new_end_change<=pos_start_change){
166
- if(this.last_text_to_highlight.length < text_to_highlight.length){
167
- pos_new_end_change= pos_start_change + text_to_highlight.length - this.last_text_to_highlight.length;
168
- pos_last_end_change= pos_start_change;
169
- }else{
170
- pos_last_end_change= pos_start_change + this.last_text_to_highlight.length - text_to_highlight.length;
171
- pos_new_end_change= pos_start_change;
172
- }
173
- }
174
- var change_new_text= text_to_highlight.substring(pos_start_change, pos_new_end_change);
175
- var change_last_text= this.last_text_to_highlight.substring(pos_start_change, pos_last_end_change);
176
-
177
- var line_new_end_change= text_to_highlight.substr(0, pos_new_end_change).split("\n").length -1;
178
- var line_last_end_change= this.last_text_to_highlight.substr(0, pos_last_end_change).split("\n").length -1;
179
125
 
180
- var change_new_text_line= text_to_highlight.split("\n").slice(line_start_change, line_new_end_change+1).join("\n");
181
- var change_last_text_line= this.last_text_to_highlight.split("\n").slice(line_start_change, line_last_end_change+1).join("\n");
182
-
183
- // check if it can only reparse the changed text
184
- var trace_new= this.get_syntax_trace(change_new_text_line);
185
- var trace_last= this.get_syntax_trace(change_last_text_line);
186
- if(trace_new == trace_last){
126
+ // we do the syntax optimisation
127
+ if( doSyntaxOpti ){
187
128
 
129
+ tps_middle_opti=new Date().getTime();
188
130
 
189
-
190
- date= new Date();
191
- tps_middle_opti=date.getTime();
192
-
193
- stay_begin= this.last_hightlighted_text.split("\n").slice(0, line_start_change).join("\n");
194
- if(line_start_change>0)
131
+ stay_begin= t.last_hightlighted_text.split("\n").slice(0, changes.lineStart).join("\n");
132
+ if(changes.lineStart>0)
195
133
  stay_begin+= "\n";
196
- stay_end= this.last_hightlighted_text.split("\n").slice(line_last_end_change+1).join("\n");
134
+ stay_end= t.last_hightlighted_text.split("\n").slice(changes.lineLastEnd+1).join("\n");
197
135
  if(stay_end.length>0)
198
136
  stay_end= "\n"+stay_end;
199
-
200
-
201
- if(stay_begin.length==0 && pos_last_end_change==-1)
202
- change_new_text_line+="\n";
203
- text_to_highlight=change_new_text_line;
204
-
137
+
138
+ // Final check to see that we're not in the middle of span tags
139
+ if( stay_begin.split('<span').length != stay_begin.split('</span').length
140
+ || stay_end.split('<span').length != stay_end.split('</span').length )
141
+ {
142
+ doSyntaxOpti = false;
143
+ stay_end = '';
144
+ stay_begin = '';
145
+ }
146
+ else
147
+ {
148
+ if(stay_begin.length==0 && changes.posLastEnd==-1)
149
+ changes.newTextLine+="\n";
150
+ textToHighlight=changes.newTextLine;
151
+ }
205
152
  }
206
- if(this.settings["debug"]){
207
- debug_opti= (trace_new == trace_last)?"Optimisation": "No optimisation";
208
- debug_opti+= " start: "+pos_start_change +"("+line_start_change+")";
209
- debug_opti+=" end_new: "+ pos_new_end_change+"("+line_new_end_change+")";
210
- debug_opti+=" end_last: "+ pos_last_end_change+"("+line_last_end_change+")";
211
- debug_opti+="\nchanged_text: "+change_new_text+" => trace: "+trace_new;
212
- debug_opti+="\nchanged_last_text: "+change_last_text+" => trace: "+trace_last;
213
- //debug_opti+= "\nchanged: "+ infos["full_text"].substring(pos_start_change, pos_new_end_change);
214
- debug_opti+= "\nchanged_line: "+change_new_text_line;
215
- debug_opti+= "\nlast_changed_line: "+change_last_text_line;
216
- debug_opti+="\nstay_begin: "+ stay_begin.slice(-200);
217
- debug_opti+="\nstay_end: "+ stay_end;
218
- //debug_opti="start: "+stay_begin_len+ "("+nb_line_start_unchanged+") end: "+ (stay_end_len)+ "("+(splited.length-nb_line_end_unchanged)+") ";
219
- //debug_opti+="changed: "+ text_to_highlight.substring(stay_begin_len, text_to_highlight.length-stay_end_len)+" \n";
220
-
221
- //debug_opti+="changed: "+ stay_begin.substr(stay_begin.length-200)+ "----------"+ text_to_highlight+"------------------"+ stay_end.substr(0,200) +"\n";
222
- debug_opti+="\n";
153
+ if(t.settings["debug"]){
154
+ var ch =changes;
155
+ debug_opti= ( doSyntaxOpti?"Optimisation": "No optimisation" )
156
+ +" start: "+ch.posStart +"("+ch.lineStart+")"
157
+ +" end_new: "+ ch.posNewEnd+"("+ch.lineNewEnd+")"
158
+ +" end_last: "+ ch.posLastEnd+"("+ch.lineLastEnd+")"
159
+ +"\nchanged_text: "+ch.newText+" => trace: "+trace_new
160
+ +"\nchanged_last_text: "+ch.lastText+" => trace: "+trace_last
161
+ //debug_opti+= "\nchanged: "+ infos["full_text"].substring(ch.posStart, ch.posNewEnd);
162
+ + "\nchanged_line: "+ch.newTextLine
163
+ + "\nlast_changed_line: "+ch.lastTextLine
164
+ +"\nstay_begin: "+ stay_begin.slice(-100)
165
+ +"\nstay_end: "+ stay_end.substr( 0, 100 );
166
+ //debug_opti="start: "+stay_begin_len+ "("+nb_line_start_unchanged+") end: "+ (stay_end_len)+ "("+(splited.length-nb_line_end_unchanged)+") ";
167
+ //debug_opti+="changed: "+ textToHighlight.substring(stay_begin_len, textToHighlight.length-stay_end_len)+" \n";
168
+
169
+ //debug_opti+="changed: "+ stay_begin.substr(stay_begin.length-200)+ "----------"+ textToHighlight+"------------------"+ stay_end.substr(0,200) +"\n";
170
+ +"\n";
223
171
  }
224
172
 
225
173
 
226
174
  // END OPTIMISATION
227
175
  }
228
- date= new Date();
229
- tps_end_opti=date.getTime();
176
+
177
+ tps_end_opti = new Date().getTime();
230
178
 
231
179
  // apply highlight
232
- var updated_highlight= this.colorize_text(text_to_highlight);
180
+ updated_highlight = t.colorize_text(textToHighlight);
181
+ tpsAfterReg = new Date().getTime();
233
182
 
234
- // get the new highlight content
183
+ /***
184
+ * see if we can optimize for updating only the required part of the HTML code
185
+ *
186
+ * The goal here will be to find the text node concerned by the modification and to update it
187
+ */
188
+ //-------------------------------------------
189
+ //
190
+ if( doSyntaxOpti )
191
+ {
192
+ try
193
+ {
194
+ var replacedBloc, i, nbStart = '', nbEnd = '', newHtml, lengthOld, lengthNew;
195
+ replacedBloc = t.last_hightlighted_text.substring( stay_begin.length, t.last_hightlighted_text.length - stay_end.length );
196
+
197
+ lengthOld = replacedBloc.length;
198
+ lengthNew = updated_highlight.length;
199
+
200
+ // find the identical caracters at the beginning
201
+ for( i=0; i < lengthOld && i < lengthNew && replacedBloc.charAt(i) == updated_highlight.charAt(i) ; i++ )
202
+ {
203
+ }
204
+ nbStart = i;
205
+ // find the identical caracters at the end
206
+ for( i=0; i + nbStart < lengthOld && i + nbStart < lengthNew && replacedBloc.charAt(lengthOld-i-1) == updated_highlight.charAt(lengthNew-i-1) ; i++ )
207
+ {
208
+ }
209
+ nbEnd = i;
210
+
211
+ // get the changes
212
+ lastHtml = replacedBloc.substring( nbStart, lengthOld - nbEnd );
213
+ newHtml = updated_highlight.substring( nbStart, lengthNew - nbEnd );
214
+
215
+
216
+ // We can do the optimisation only if we havn't touch to span elements
217
+ if( newHtml.indexOf('<span') == -1 && newHtml.indexOf('</span') == -1
218
+ && lastHtml.indexOf('<span') == -1 && lastHtml.indexOf('</span') == -1 )
219
+ {
220
+ var beginStr, nbOpendedSpan, nbClosedSpan, nbUnchangedChars, span, textNode;
221
+ doHtmlOpti = true;
222
+ beginStr = t.last_hightlighted_text.substr( 0, stay_begin.length + nbStart );
235
223
 
236
- date= new Date();
237
- tps2=date.getTime();
238
- //updated_highlight= "<div class='keywords'>"+updated_highlight+"</div>";
239
- var hightlighted_text= stay_begin + updated_highlight + stay_end;
240
- //this.previous_hightlight_content= tab_text.join("<br>");
224
+ nbOpendedSpan = beginStr.split('<span').length - 1;
225
+ nbClosedSpan = beginStr.split('</span').length - 1;
226
+ // retrieve the previously opened span (Add 1 for the first level span?)
227
+ span = t.content_highlight.getElementsByTagName('span')[ nbOpendedSpan ];
228
+
229
+ //--------[
230
+ // get the textNode to update
231
+
232
+ // if we're inside a span, we'll take the one that is opened (can be a parent of the current span)
233
+ parentSpan = span;
234
+ maxStartOffset = maxEndOffset = 0;
235
+
236
+ // it will be in the child of the root node
237
+ if( nbOpendedSpan == nbClosedSpan )
238
+ {
239
+ while( parentSpan.parentNode != t.content_highlight && parentSpan.parentNode.tagName != 'PRE' )
240
+ {
241
+ parentSpan = parentSpan.parentNode;
242
+ }
243
+ }
244
+ // get the last opened span
245
+ else
246
+ {
247
+ maxStartOffset = maxEndOffset = beginStr.length + 1;
248
+ // move to parent node for each closed span found after the lastest open span
249
+ nbClosed = beginStr.substr( Math.max( 0, beginStr.lastIndexOf( '<span', maxStartOffset - 1 ) ) ).split('</span').length - 1;
250
+ while( nbClosed > 0 )
251
+ {
252
+ nbClosed--;
253
+ parentSpan = parentSpan.parentNode;
254
+ }
255
+
256
+ // find the position of the last opended tag
257
+ while( parentSpan.parentNode != t.content_highlight && parentSpan.parentNode.tagName != 'PRE' && ( tmpMaxStartOffset = Math.max( 0, beginStr.lastIndexOf( '<span', maxStartOffset - 1 ) ) ) < ( tmpMaxEndOffset = Math.max( 0, beginStr.lastIndexOf( '</span', maxEndOffset - 1 ) ) ) )
258
+ {
259
+ maxStartOffset = tmpMaxStartOffset;
260
+ maxEndOffset = tmpMaxEndOffset;
261
+ }
262
+ }
263
+ // Note: maxEndOffset is no more used but maxStartOffset will be used
264
+
265
+ if( parentSpan.parentNode == t.content_highlight || parentSpan.parentNode.tagName == 'PRE' )
266
+ {
267
+ maxStartOffset = Math.max( 0, beginStr.indexOf( '<span' ) );
268
+ }
269
+
270
+ // find the matching text node (this will be one that will be at the end of the beginStr
271
+ if( maxStartOffset == beginStr.length )
272
+ {
273
+ nbSubSpanBefore = 0;
274
+ }
275
+ else
276
+ {
277
+ lastEndPos = Math.max( 0, beginStr.lastIndexOf( '>', maxStartOffset ) );
241
278
 
242
- date= new Date();
243
- inner1=date.getTime();
279
+ // count the number of sub spans
280
+ nbSubSpanBefore = beginStr.substr( lastEndPos ).split('<span').length-1;
281
+ }
244
282
 
245
- // update the content of the highlight div by first updating a clone node (as there is no display in the same time for this node it's quite faster (5*))
246
- var new_Obj= this.content_highlight.cloneNode(false);
247
- if(this.nav['isIE'] || this.nav['isOpera'] || this.nav['isFirefox'] >= 3 )
248
- new_Obj.innerHTML= "<pre><span class='"+ this.settings["syntax"] +"'>" + hightlighted_text.replace("\n", "<br/>") + "</span></pre>";
249
- else
250
- new_Obj.innerHTML= "<span class='"+ this.settings["syntax"] +"'>"+ hightlighted_text +"</span>";
251
- this.content_highlight.parentNode.replaceChild(new_Obj, this.content_highlight);
252
- this.content_highlight= new_Obj;
253
- if(infos["full_text"].indexOf("\r")!=-1)
254
- this.last_text_to_highlight= infos["full_text"].replace(/\r/g, "");
255
- else
256
- this.last_text_to_highlight= infos["full_text"];
257
- this.last_hightlighted_text= hightlighted_text;
258
- date= new Date();
259
- tps3=date.getTime();
283
+ // there is no sub-span before
284
+ if( nbSubSpanBefore == 0 )
285
+ {
286
+ textNode = parentSpan.firstChild;
287
+ }
288
+ // we need to find where is the text node modified
289
+ else
290
+ {
291
+ // take the last direct child (no sub-child)
292
+ lastSubSpan = parentSpan.getElementsByTagName('span')[ nbSubSpanBefore - 1 ];
293
+ while( lastSubSpan.parentNode != parentSpan )
294
+ {
295
+ lastSubSpan = lastSubSpan.parentNode;
296
+ }
297
+
298
+ // associate to next text node following the last sub span
299
+ if( lastSubSpan.nextSibling == null || lastSubSpan.nextSibling.nodeType != 3 )
300
+ {
301
+ textNode = document.createTextNode('');
302
+ lastSubSpan.parentNode.insertBefore( textNode, lastSubSpan.nextSibling );
303
+ }
304
+ else
305
+ {
306
+ textNode = lastSubSpan.nextSibling;
307
+ }
308
+ }
309
+ //--------]
310
+
311
+
312
+ //--------[
313
+ // update the textNode content
314
+
315
+ // number of caracters after the last opened of closed span
316
+ nbUnchangedChars = beginStr.length - Math.max( 0, beginStr.lastIndexOf( '>' ) + 1 );
317
+
318
+ // console.log( span, textNode, nbOpendedSpan,nbClosedSpan, span.nextSibling, textNode.length, nbUnchangedChars, lastHtml, lastHtml.length, newHtml, newHtml.length );
319
+ // alert( textNode.parentNode.className +'-'+ textNode.parentNode.tagName+"\n"+ textNode.data +"\n"+ nbUnchangedChars +"\n"+ lastHtml.length +"\n"+ newHtml +"\n"+ newHtml.length );
320
+
321
+ // IE only manage \r for cariage return in textNode and not \n or \r\n
322
+ if( t.isIE )
323
+ {
324
+ nbUnchangedChars -= ( beginStr.substr( beginStr.length - nbUnchangedChars ).split("\n").length - 1 );
325
+ //alert( textNode.data.replace(/\r/g, '_r').replace(/\n/g, '_n'));
326
+ textNode.replaceData( nbUnchangedChars, lastHtml.replace(/\n/g, '').length, newHtml.replace(/\n/g, '') );
327
+ }
328
+ else
329
+ {
330
+ textNode.replaceData( nbUnchangedChars, lastHtml.length, newHtml );
331
+ }
332
+ //--------]
333
+ }
334
+ }
335
+ // an exception shouldn't occured but if replaceData failed at least it won't break everything
336
+ catch( e )
337
+ {
338
+ // throw e;
339
+ // console.log( e );
340
+ doHtmlOpti = false;
341
+ }
342
+
343
+ }
344
+ /*** END HTML update's optimisation ***/
345
+ // end test
346
+
347
+ // console.log( (TPS6-TPS5), (TPS5-TPS4), (TPS4-TPS3), (TPS3-TPS2), (TPS2-TPS1), _CPT );
348
+ // get the new highlight content
349
+ tpsAfterOpti2 = new Date().getTime();
350
+ hightlighted_text = stay_begin + updated_highlight + stay_end;
351
+ if( !doHtmlOpti )
352
+ {
353
+ // update the content of the highlight div by first updating a clone node (as there is no display in the same time for t node it's quite faster (5*))
354
+ var new_Obj= t.content_highlight.cloneNode(false);
355
+ if( ( t.isIE && t.isIE < 8 ) || ( t.isOpera && t.isOpera < 9.6 ) )
356
+ new_Obj.innerHTML= "<pre><span class='"+ t.settings["syntax"] +"'>" + hightlighted_text + "</span></pre>";
357
+ else
358
+ new_Obj.innerHTML= "<span class='"+ t.settings["syntax"] +"'>"+ hightlighted_text +"</span>";
359
+
360
+ t.content_highlight.parentNode.replaceChild(new_Obj, t.content_highlight);
361
+
362
+ t.content_highlight= new_Obj;
363
+ }
364
+
365
+ t.last_text_to_highlight= infos["full_text"];
366
+ t.last_hightlighted_text= hightlighted_text;
367
+
368
+ tps3=new Date().getTime();
260
369
 
261
- if(this.settings["debug"]){
262
- tot1=tps_end_opti-tps_start;
263
- tot_middle=tps_end_opti- tps_middle_opti;
264
- tot2=tps2-tps_end_opti;
265
- tps_join=inner1-tps2;
266
- tps_td2=tps3-inner1;
370
+ if(t.settings["debug"]){
267
371
  //lineNumber=tab_text.length;
268
- //this.debug.value+=" \nNB char: "+$("src").value.length+" Nb line: "+ lineNumber;
269
- this.debug.value= "Tps optimisation "+tot1+" (second part: "+tot_middle+") | tps reg exp: "+tot2+" | tps join: "+tps_join;
270
- this.debug.value+= " | tps update highlight content: "+tps_td2+"("+tps3+")\n";
271
- this.debug.value+=debug_opti;
272
- // this.debug.value+= "highlight\n"+hightlighted_text;
372
+ //t.debug.value+=" \nNB char: "+_$("src").value.length+" Nb line: "+ lineNumber;
373
+
374
+ t.debug.value= "Tps optimisation "+(tps_end_opti-tps_start)
375
+ +" | tps reg exp: "+ (tpsAfterReg-tps_end_opti)
376
+ +" | tps opti HTML : "+ (tpsAfterOpti2-tpsAfterReg) + ' '+ ( doHtmlOpti ? 'yes' : 'no' )
377
+ +" | tps update highlight content: "+ (tps3-tpsAfterOpti2)
378
+ +" | tpsTotal: "+ (tps3-tps_start)
379
+ + "("+tps3+")\n"+ debug_opti;
380
+ // t.debug.value+= "highlight\n"+hightlighted_text;*/
273
381
  }
274
382
 
275
383
  };
276
384
 
277
385
  EditArea.prototype.resync_highlight= function(reload_now){
278
386
  this.reload_highlight=true;
279
- this.last_highlight_base_text="";
387
+ this.last_text_to_highlight="";
280
388
  this.focus();
281
389
  if(reload_now)
282
390
  this.check_line_selection(false);
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -11,7 +11,7 @@ function keyDown(e){
11
11
  for(var i in editArea.plugins){
12
12
  if(typeof(editArea.plugins[i].onkeydown)=="function"){
13
13
  if(editArea.plugins[i].onkeydown(e)===false){ // stop propaging
14
- if(editArea.nav['isIE'])
14
+ if(editArea.isIE)
15
15
  e.keyCode=0;
16
16
  return false;
17
17
  }
@@ -27,10 +27,10 @@ function keyDown(e){
27
27
 
28
28
  var low_letter= letter.toLowerCase();
29
29
 
30
- if(letter=="Page up" && !editArea.nav['isOpera']){
30
+ if(letter=="Page up" && !editArea.isOpera){
31
31
  editArea.execCommand("scroll_page", {"dir": "up", "shift": ShiftPressed(e)});
32
32
  use=true;
33
- }else if(letter=="Page down" && !editArea.nav['isOpera']){
33
+ }else if(letter=="Page down" && !editArea.isOpera){
34
34
  editArea.execCommand("scroll_page", {"dir": "down", "shift": ShiftPressed(e)});
35
35
  use=true;
36
36
  }else if(editArea.is_editable==false){
@@ -43,7 +43,7 @@ function keyDown(e){
43
43
  editArea.execCommand("tab_selection");
44
44
 
45
45
  use=true;
46
- if(editArea.nav['isOpera'] || (editArea.nav['isFirefox'] && editArea.nav['isMacOS']) ) // opera && firefox mac can't cancel tabulation events...
46
+ if(editArea.isOpera || (editArea.isFirefox && editArea.isMac) ) // opera && firefox mac can't cancel tabulation events...
47
47
  setTimeout("editArea.execCommand('focus');", 1);
48
48
  }else if(letter=="Entrer" && target_id=="textarea"){
49
49
  if(editArea.press_enter())
@@ -103,7 +103,7 @@ function keyDown(e){
103
103
 
104
104
  if(use){
105
105
  // in case of a control that sould'nt be used by IE but that is used => THROW a javascript error that will stop key action
106
- if(editArea.nav['isIE'])
106
+ if(editArea.isIE)
107
107
  e.keyCode=0;
108
108
  return false;
109
109
  }