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.
- data/ChangeLog +24 -1
- data/README +0 -0
- data/base/shared_lib/moving_average.rb +34 -33
- data/base/shared_lib/system/cross.rb +76 -0
- data/base/shared_lib/system/position_manager.rb +160 -0
- data/base/shared_lib/system/signal.rb +347 -0
- data/html/css/datatable.css +4 -4
- data/html/css/default.css +57 -5
- data/html/css/treeview.css +205 -0
- data/html/img/bin_closed.png +0 -0
- data/html/img/bin_empty.png +0 -0
- data/html/img/button_add_small.gif +0 -0
- data/html/img/button_add_small_gray.gif +0 -0
- data/html/img/button_add_small_over.gif +0 -0
- data/html/img/button_mkcol.gif +0 -0
- data/html/img/button_mkcol_gray.gif +0 -0
- data/html/img/button_mkcol_over.gif +0 -0
- data/html/img/button_remove_small.gif +0 -0
- data/html/img/button_remove_small_gray.gif +0 -0
- data/html/img/button_remove_small_over.gif +0 -0
- data/html/img/button_rename.gif +0 -0
- data/html/img/button_rename_gray.gif +0 -0
- data/html/img/button_rename_over.gif +0 -0
- data/html/img/control_play.png +0 -0
- data/html/img/control_play_blue.png +0 -0
- data/html/img/folder.png +0 -0
- data/html/img/folder_brick.png +0 -0
- data/html/img/folder_user.png +0 -0
- data/html/{js/codepress/images → img}/line-numbers.png +0 -0
- data/html/img/page_white_ruby.png +0 -0
- data/html/img/sidebar_agent_edit.png +0 -0
- data/html/img/sidebar_agent_edit_over.png +0 -0
- data/html/img/sidebar_agent_edit_s.png +0 -0
- data/html/img/yui/treeview-sprite.gif +0 -0
- data/html/index.html +34 -18
- data/html/js/agent-editor/agent-editor-page.js +324 -0
- data/html/js/agent-editor/agent-editor.js +363 -0
- data/html/js/agent-editor/agent-list-tree.js +251 -0
- data/html/js/agent-selector.js +23 -28
- data/html/js/app.js +63 -91
- data/html/js/bt-create-page.js +25 -19
- data/html/js/container-min.js +1 -1
- data/html/js/container.js +944 -0
- data/html/js/edit_area/autocompletion.js +11 -13
- data/html/js/edit_area/edit_area.css +79 -40
- data/html/js/edit_area/edit_area.js +255 -226
- data/html/js/edit_area/edit_area_compressor.php +4 -4
- data/html/js/edit_area/edit_area_full.gz +0 -0
- data/html/js/edit_area/edit_area_full.js +31 -31
- data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
- data/html/js/edit_area/edit_area_full_with_plugins.js +31 -31
- data/html/js/edit_area/edit_area_functions.js +448 -341
- data/html/js/edit_area/edit_area_loader.js +409 -397
- data/html/js/edit_area/elements_functions.js +120 -123
- data/html/js/edit_area/highlight.js +305 -197
- data/html/js/edit_area/images/goto.png +0 -0
- data/html/js/edit_area/images/help.png +0 -0
- data/html/js/edit_area/images/redo.png +0 -0
- data/html/js/edit_area/images/save.png +0 -0
- data/html/js/edit_area/images/search.png +0 -0
- data/html/js/edit_area/images/undo.png +0 -0
- data/html/js/edit_area/images/word_wrap.gif +0 -0
- data/html/js/edit_area/keyboard.js +5 -5
- data/html/js/edit_area/langs/bg.js +73 -0
- data/html/js/edit_area/langs/cs.js +2 -0
- data/html/js/edit_area/langs/de.js +2 -0
- data/html/js/edit_area/langs/dk.js +2 -0
- data/html/js/edit_area/langs/en.js +2 -0
- data/html/js/edit_area/langs/eo.js +2 -0
- data/html/js/edit_area/langs/es.js +2 -0
- data/html/js/edit_area/langs/fi.js +67 -0
- data/html/js/edit_area/langs/fr.js +2 -0
- data/html/js/edit_area/langs/hr.js +2 -0
- data/html/js/edit_area/langs/it.js +2 -0
- data/html/js/edit_area/langs/ja.js +2 -0
- data/html/js/edit_area/langs/mk.js +2 -0
- data/html/js/edit_area/langs/nl.js +2 -0
- data/html/js/edit_area/langs/pl.js +2 -0
- data/html/js/edit_area/langs/pt.js +2 -0
- data/html/js/edit_area/langs/ru.js +2 -0
- data/html/js/edit_area/langs/sk.js +2 -0
- data/html/js/edit_area/langs/zh.js +67 -0
- data/html/js/edit_area/manage_area.js +362 -205
- data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
- data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
- data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
- data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
- data/html/js/edit_area/reg_syntax/java.js +56 -0
- data/html/js/edit_area/reg_syntax/ruby.js +9 -9
- data/html/js/edit_area/reg_syntax.js +15 -13
- data/html/js/edit_area/regexp.js +36 -32
- data/html/js/edit_area/resize_area.js +43 -47
- data/html/js/edit_area/search_replace.js +29 -29
- data/html/js/edit_area/template.html +6 -4
- data/html/js/json-broker-client.js +23 -17
- data/html/js/result-page.js +107 -57
- data/html/js/rt-setting-page.js +38 -15
- data/html/js/sidebar.js +41 -27
- data/html/js/templates.js +167 -32
- data/html/js/utils.js +143 -7
- data/html/js/yui/treeview.js +3671 -0
- data/html/swf/chart.swf +0 -0
- data/html/test/agent_editor_spec.js +815 -0
- data/html/test/index.html +40 -0
- data/html/test/jsspec/JSSpec.css +224 -0
- data/html/test/jsspec/JSSpec.js +1549 -0
- data/html/test/jsspec/diff_match_patch.js +1 -0
- data/html/test/utils_spec.js +111 -0
- data/lib/jiji/agent/agent.rb +69 -12
- data/lib/jiji/agent/agent_manager.rb +18 -12
- data/lib/jiji/agent/agent_registry.rb +35 -121
- data/lib/jiji/collector.rb +16 -6
- data/lib/jiji/command.rb +46 -5
- data/lib/jiji/dao/file_system_dao.rb +158 -0
- data/lib/jiji/dao/timed_data_dao.rb +2 -0
- data/lib/jiji/dao/trade_result_dao.rb +1 -1
- data/lib/jiji/error.rb +24 -8
- data/lib/jiji/migration/migrator1_2_0.rb +67 -0
- data/lib/jiji/models.rb +82 -24
- data/lib/jiji/operator.rb +55 -51
- data/lib/jiji/output.rb +85 -29
- data/lib/jiji/output_manager.rb +84 -0
- data/lib/jiji/plugin/embedded/single_click_client.rb +2 -2
- data/lib/jiji/plugin/securities_plugin.rb +0 -1
- data/lib/jiji/process.rb +229 -208
- data/lib/jiji/process_manager.rb +190 -96
- data/lib/jiji/registry.rb +87 -19
- data/lib/jiji/server.rb +1 -0
- data/lib/jiji/service/agent_service.rb +147 -48
- data/lib/jiji/service/output_service.rb +37 -17
- data/lib/jiji/service/process_service.rb +3 -5
- data/lib/jiji/service/trade_result_service.rb +4 -5
- data/lib/jiji/util/file_lock.rb +4 -4
- data/lib/jiji/util/include_proxy.rb +17 -0
- data/lib/jiji/util/json_broker.rb +6 -4
- data/lib/jiji/util/util.rb +1 -1
- data/swf/chart/fx/chart/Chart.as +7 -0
- data/swf/chart/fx/chart/ui/graph/GraphManager.as +15 -2
- data/test/ProcessTest/agents/foo.rb +10 -0
- data/test/ProcessTest/conf/configuration.yaml +3 -0
- data/test/agent/agent_tests.rb +10 -0
- data/test/agent/test_AgentManager.rb +28 -12
- data/test/agent/test_AgentRegistry.rb +194 -99
- data/test/agent/test_PeriodicallyAgent.rb +1 -2
- data/test/agent/test_Permitter.rb +1 -2
- data/test/all_tests.rb +7 -19
- data/test/dao/dao_tests.rb +9 -0
- data/test/dao/test_FileSystemDao.rb +431 -0
- data/test/dao/test_RateDao.rb +5 -7
- data/test/dao/test_TradeResultDao.rb +1 -2
- data/test/migration/migration_tests.rb +10 -0
- data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
- data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/test_Migrator.rb +1 -1
- data/test/migration/test_Migrator1_0_3.rb +1 -1
- data/test/migration/test_Migrator1_1_0.rb +1 -1
- data/test/migration/test_Migrator1_2_0.rb +94 -0
- data/test/plugin/embedded/test_SingleClickClient.rb +1 -2
- data/test/plugin/plugin_tests.rb +8 -0
- data/test/plugin/test_Loader.rb +1 -1
- data/test/shared/rate.csv +144 -0
- data/test/shared/shared_tests.rb +9 -0
- data/test/shared/test_Cross.rb +144 -0
- data/test/shared/test_PositionManager.rb +285 -0
- data/test/shared/test_Signal.rb +65 -0
- data/test/test_Output.rb +28 -21
- data/test/test_OutputManager.rb +162 -0
- data/test/test_Output_registry.rb +6 -17
- data/test/test_Process.rb +434 -222
- data/test/test_ProcessManager.rb +458 -101
- data/test/test_utils.rb +71 -8
- data/test/util/test_BlockToSession.rb +1 -2
- data/test/util/test_CSV.rb +1 -2
- data/test/util/test_SynchronizeInterceptor.rb +1 -2
- data/test/util/util_tests.rb +9 -0
- metadata +127 -47
- data/html/js/agent-editor-page.js +0 -440
- data/html/js/codepress/codepress.css +0 -21
- data/html/js/codepress/codepress.html +0 -35
- data/html/js/codepress/codepress.js +0 -138
- data/html/js/codepress/engines/gecko.js +0 -293
- data/html/js/codepress/engines/khtml.js +0 -0
- data/html/js/codepress/engines/msie.js +0 -304
- data/html/js/codepress/engines/older.js +0 -0
- data/html/js/codepress/engines/opera.js +0 -260
- data/html/js/codepress/images/line-numbers.gif +0 -0
- data/html/js/codepress/index.html +0 -443
- data/html/js/codepress/languages/asp.css +0 -71
- data/html/js/codepress/languages/asp.js +0 -117
- data/html/js/codepress/languages/autoit.css +0 -13
- data/html/js/codepress/languages/autoit.js +0 -32
- data/html/js/codepress/languages/csharp.css +0 -9
- data/html/js/codepress/languages/csharp.js +0 -25
- data/html/js/codepress/languages/css.css +0 -10
- data/html/js/codepress/languages/css.js +0 -23
- data/html/js/codepress/languages/generic.css +0 -9
- data/html/js/codepress/languages/generic.js +0 -25
- data/html/js/codepress/languages/html.css +0 -13
- data/html/js/codepress/languages/html.js +0 -59
- data/html/js/codepress/languages/java.css +0 -7
- data/html/js/codepress/languages/java.js +0 -24
- data/html/js/codepress/languages/javascript.css +0 -8
- data/html/js/codepress/languages/javascript.js +0 -30
- data/html/js/codepress/languages/perl.css +0 -11
- data/html/js/codepress/languages/perl.js +0 -27
- data/html/js/codepress/languages/php.css +0 -12
- data/html/js/codepress/languages/php.js +0 -61
- data/html/js/codepress/languages/ruby.css +0 -10
- data/html/js/codepress/languages/ruby.js +0 -26
- data/html/js/codepress/languages/sql.css +0 -10
- data/html/js/codepress/languages/sql.js +0 -30
- data/html/js/codepress/languages/text.css +0 -5
- data/html/js/codepress/languages/text.js +0 -9
- data/html/js/codepress/languages/vbscript.css +0 -71
- data/html/js/codepress/languages/vbscript.js +0 -117
- data/html/js/codepress/languages/xsl.css +0 -15
- data/html/js/codepress/languages/xsl.js +0 -103
- data/html/js/codepress/license.txt +0 -458
- data/html/js/edit_area/images/Thumbs.db +0 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +0 -6
@@ -5,22 +5,23 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
// need to redefine this functiondue to IE problem
|
8
|
-
function getAttribute( elm,
|
8
|
+
function getAttribute( elm, aName ) {
|
9
|
+
var aValue,taName,i;
|
9
10
|
try{
|
10
|
-
|
11
|
-
}catch(exept){
|
11
|
+
aValue = elm.getAttribute( aName );
|
12
|
+
}catch(exept){}
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
for
|
16
|
-
|
17
|
-
if
|
18
|
-
|
19
|
-
return
|
14
|
+
if( ! aValue ){
|
15
|
+
if ( !elm.attributes ) return null;
|
16
|
+
for( i = 0; i < elm.attributes.length; i ++ ) {
|
17
|
+
taName = elm.attributes[i] .name.toLowerCase();
|
18
|
+
if( taName == aName ) {
|
19
|
+
aValue = elm.attributes[i] .value;
|
20
|
+
return aValue;
|
20
21
|
}
|
21
22
|
}
|
22
23
|
}
|
23
|
-
return
|
24
|
+
return aValue;
|
24
25
|
};
|
25
26
|
|
26
27
|
// need to redefine this function due to IE problem
|
@@ -50,7 +51,7 @@
|
|
50
51
|
if(elem){
|
51
52
|
var children= elem.childNodes;
|
52
53
|
var result=null;
|
53
|
-
var results=
|
54
|
+
var results= [];
|
54
55
|
for (var x=0;x<children.length;x++) {
|
55
56
|
strTagName = new String(children[x].tagName);
|
56
57
|
children_class="?";
|
@@ -93,46 +94,37 @@
|
|
93
94
|
};
|
94
95
|
|
95
96
|
function getMouseX(e){
|
96
|
-
|
97
|
-
return event.x + document.body.scrollLeft;
|
98
|
-
else
|
99
|
-
return e.pageX;*/
|
97
|
+
|
100
98
|
if(e!=null && typeof(e.pageX)!="undefined"){
|
101
99
|
return e.pageX;
|
102
100
|
}else{
|
103
101
|
return (e!=null?e.x:event.x)+ document.documentElement.scrollLeft;
|
104
102
|
}
|
105
|
-
//return (e!=null) ? e.pageX : event.x + document.documentElement.scrollLeft;
|
106
103
|
};
|
107
104
|
|
108
105
|
function getMouseY(e){
|
109
|
-
/*if(document.all)
|
110
|
-
return event.y + document.body.scrollTop;
|
111
|
-
else
|
112
|
-
return e.pageY;*/
|
113
106
|
if(e!=null && typeof(e.pageY)!="undefined"){
|
114
107
|
return e.pageY;
|
115
108
|
}else{
|
116
109
|
return (e!=null?e.y:event.y)+ document.documentElement.scrollTop;
|
117
110
|
}
|
118
|
-
//return (e!=null) ? e.pageY : event.y + document.documentElement.scrollTop;
|
119
111
|
};
|
120
112
|
|
121
113
|
function calculeOffsetLeft(r){
|
122
|
-
|
114
|
+
return calculeOffset(r,"offsetLeft")
|
123
115
|
};
|
124
116
|
|
125
117
|
function calculeOffsetTop(r){
|
126
|
-
|
118
|
+
return calculeOffset(r,"offsetTop")
|
127
119
|
};
|
128
120
|
|
129
121
|
function calculeOffset(element,attr){
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
122
|
+
var offset=0;
|
123
|
+
while(element){
|
124
|
+
offset+=element[attr];
|
125
|
+
element=element.offsetParent
|
126
|
+
}
|
127
|
+
return offset;
|
136
128
|
};
|
137
129
|
|
138
130
|
/** return the computed style
|
@@ -160,7 +152,8 @@
|
|
160
152
|
* Moving an element
|
161
153
|
***/
|
162
154
|
|
163
|
-
var
|
155
|
+
var _mCE; // currently moving element
|
156
|
+
|
164
157
|
/* allow to move an element in a window
|
165
158
|
e: the event
|
166
159
|
id: the id of the element
|
@@ -179,46 +172,44 @@
|
|
179
172
|
if(frame.event)
|
180
173
|
e=frame.event;
|
181
174
|
|
182
|
-
|
183
|
-
|
175
|
+
_mCE= frame.document.getElementById(elem_id);
|
176
|
+
_mCE.frame=frame;
|
184
177
|
frame.document.onmousemove= move_element;
|
185
178
|
frame.document.onmouseup= end_move_element;
|
186
|
-
/*
|
187
|
-
|
179
|
+
/*_mCE.onmousemove= move_element;
|
180
|
+
_mCE.onmouseup= end_move_element;*/
|
188
181
|
|
189
|
-
//alert(
|
182
|
+
//alert(_mCE.frame.document.body.offsetHeight);
|
190
183
|
|
191
184
|
mouse_x= getMouseX(e);
|
192
185
|
mouse_y= getMouseY(e);
|
193
|
-
//window.status=frame+ " elem: "+elem_id+" elem: "+
|
194
|
-
|
195
|
-
|
186
|
+
//window.status=frame+ " elem: "+elem_id+" elem: "+ _mCE + " mouse_x: "+mouse_x;
|
187
|
+
_mCE.start_pos_x = mouse_x - (_mCE.style.left.replace("px","") || calculeOffsetLeft(_mCE));
|
188
|
+
_mCE.start_pos_y = mouse_y - (_mCE.style.top.replace("px","") || calculeOffsetTop(_mCE));
|
196
189
|
return false;
|
197
190
|
};
|
198
191
|
|
199
192
|
function end_move_element(e){
|
200
|
-
|
201
|
-
|
202
|
-
|
193
|
+
_mCE.frame.document.onmousemove= "";
|
194
|
+
_mCE.frame.document.onmouseup= "";
|
195
|
+
_mCE=null;
|
203
196
|
};
|
204
197
|
|
205
198
|
function move_element(e){
|
206
|
-
|
207
|
-
|
208
|
-
if(
|
209
|
-
e=
|
210
|
-
|
211
|
-
|
212
|
-
var new_top= mouse_y - move_current_element.start_pos_y;
|
213
|
-
var new_left= mouse_x - move_current_element.start_pos_x;
|
199
|
+
var newTop,newLeft,maxLeft;
|
200
|
+
|
201
|
+
if( _mCE.frame && _mCE.frame.event )
|
202
|
+
e=_mCE.frame.event;
|
203
|
+
newTop = getMouseY(e) - _mCE.start_pos_y;
|
204
|
+
newLeft = getMouseX(e) - _mCE.start_pos_x;
|
214
205
|
|
215
|
-
|
216
|
-
max_top=
|
217
|
-
|
218
|
-
|
206
|
+
maxLeft = _mCE.frame.document.body.offsetWidth- _mCE.offsetWidth;
|
207
|
+
max_top = _mCE.frame.document.body.offsetHeight- _mCE.offsetHeight;
|
208
|
+
newTop = Math.min(Math.max(0, newTop), max_top);
|
209
|
+
newLeft = Math.min(Math.max(0, newLeft), maxLeft);
|
219
210
|
|
220
|
-
|
221
|
-
|
211
|
+
_mCE.style.top = newTop+"px";
|
212
|
+
_mCE.style.left = newLeft+"px";
|
222
213
|
return false;
|
223
214
|
};
|
224
215
|
|
@@ -230,85 +221,86 @@
|
|
230
221
|
|
231
222
|
// allow to get infos on the selection: array(start, end)
|
232
223
|
function getSelectionRange(textarea){
|
233
|
-
//if(nav['isIE'])
|
234
|
-
// get_IE_selection(textarea);
|
235
224
|
return {"start": textarea.selectionStart, "end": textarea.selectionEnd};
|
236
225
|
};
|
237
226
|
|
238
227
|
// allow to set the selection
|
239
|
-
function setSelectionRange(
|
240
|
-
|
228
|
+
function setSelectionRange(t, start, end){
|
229
|
+
t.focus();
|
241
230
|
|
242
|
-
start= Math.max(0, Math.min(
|
243
|
-
end= Math.max(start, Math.min(
|
231
|
+
start = Math.max(0, Math.min(t.value.length, start));
|
232
|
+
end = Math.max(start, Math.min(t.value.length, end));
|
244
233
|
|
245
|
-
if(
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
234
|
+
if( this.isOpera && this.isOpera < 9.6 ){ // Opera bug when moving selection start and selection end
|
235
|
+
t.selectionEnd = 1;
|
236
|
+
t.selectionStart = 0;
|
237
|
+
t.selectionEnd = 1;
|
238
|
+
t.selectionStart = 0;
|
250
239
|
}
|
251
|
-
|
252
|
-
|
240
|
+
t.selectionStart = start;
|
241
|
+
t.selectionEnd = end;
|
253
242
|
//textarea.setSelectionRange(start, end);
|
254
243
|
|
255
|
-
if(
|
256
|
-
set_IE_selection(
|
244
|
+
if(isIE)
|
245
|
+
set_IE_selection(t);
|
257
246
|
};
|
258
247
|
|
259
248
|
|
260
249
|
// set IE position in Firefox mode (textarea.selectionStart and textarea.selectionEnd). should work as a repeated task
|
261
|
-
function get_IE_selection(
|
262
|
-
|
263
|
-
if(
|
250
|
+
function get_IE_selection(t){
|
251
|
+
var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab;
|
252
|
+
if(t && t.focused)
|
264
253
|
{
|
265
|
-
if(!
|
254
|
+
if(!t.ea_line_height)
|
266
255
|
{ // calculate the lineHeight
|
267
|
-
|
268
|
-
div.style.fontFamily= get_css_property(
|
269
|
-
div.style.fontSize= get_css_property(
|
256
|
+
div= d.createElement("div");
|
257
|
+
div.style.fontFamily= get_css_property(t, "font-family");
|
258
|
+
div.style.fontSize= get_css_property(t, "font-size");
|
270
259
|
div.style.visibility= "hidden";
|
271
260
|
div.innerHTML="0";
|
272
|
-
|
273
|
-
|
274
|
-
|
261
|
+
d.body.appendChild(div);
|
262
|
+
t.ea_line_height= div.offsetHeight;
|
263
|
+
d.body.removeChild(div);
|
275
264
|
}
|
276
|
-
//
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
scrollTop
|
287
|
-
elem
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
// var relative_top= range.offsetTop - calculeOffsetTop(textarea) + scrollTop;
|
293
|
-
var relative_top= range.offsetTop - calculeOffsetTop(textarea)+ scrollTop;
|
294
|
-
// alert("rangeoffset: "+ range.offsetTop +"\ncalcoffsetTop: "+ calculeOffsetTop(textarea) +"\nrelativeTop: "+ relative_top);
|
295
|
-
var line_start = Math.round((relative_top / textarea.ea_line_height) +1);
|
296
|
-
|
297
|
-
var line_nb= Math.round(range.boundingHeight / textarea.ea_line_height);
|
298
|
-
|
299
|
-
// alert("store_range: "+ stored_range.text.length+"\nrange: "+range.text.length+"\nrange_text: "+ range.text);
|
300
|
-
var range_start= stored_range.text.length - range.text.length;
|
301
|
-
var tab= textarea.value.substr(0, range_start).split("\n");
|
302
|
-
range_start+= (line_start - tab.length)*2; // add missing empty lines to the selection
|
303
|
-
textarea.selectionStart = range_start;
|
265
|
+
//t.focus();
|
266
|
+
range = d.selection.createRange();
|
267
|
+
try
|
268
|
+
{
|
269
|
+
stored_range = range.duplicate();
|
270
|
+
stored_range.moveToElementText( t );
|
271
|
+
stored_range.setEndPoint( 'EndToEnd', range );
|
272
|
+
if(stored_range.parentElement() == t){
|
273
|
+
// the range don't take care of empty lines in the end of the selection
|
274
|
+
elem = t;
|
275
|
+
scrollTop = 0;
|
276
|
+
while(elem.parentNode){
|
277
|
+
scrollTop+= elem.scrollTop;
|
278
|
+
elem = elem.parentNode;
|
279
|
+
}
|
304
280
|
|
305
|
-
var
|
306
|
-
|
307
|
-
|
308
|
-
|
281
|
+
// var scrollTop= t.scrollTop + document.body.scrollTop;
|
282
|
+
|
283
|
+
// var relative_top= range.offsetTop - calculeOffsetTop(t) + scrollTop;
|
284
|
+
relative_top= range.offsetTop - calculeOffsetTop(t)+ scrollTop;
|
285
|
+
// alert("rangeoffset: "+ range.offsetTop +"\ncalcoffsetTop: "+ calculeOffsetTop(t) +"\nrelativeTop: "+ relative_top);
|
286
|
+
line_start = Math.round((relative_top / t.ea_line_height) +1);
|
287
|
+
|
288
|
+
line_nb = Math.round(range.boundingHeight / t.ea_line_height);
|
289
|
+
|
290
|
+
range_start = stored_range.text.length - range.text.length;
|
291
|
+
tab = t.value.substr(0, range_start).split("\n");
|
292
|
+
range_start += (line_start - tab.length)*2; // add missing empty lines to the selection
|
293
|
+
t.selectionStart = range_start;
|
294
|
+
|
295
|
+
range_end = t.selectionStart + range.text.length;
|
296
|
+
tab = t.value.substr(0, range_start + range.text.length).split("\n");
|
297
|
+
range_end += (line_start + line_nb - 1 - tab.length)*2;
|
298
|
+
t.selectionEnd = range_end;
|
299
|
+
}
|
309
300
|
}
|
301
|
+
catch(e){}
|
310
302
|
}
|
311
|
-
setTimeout("get_IE_selection(document.getElementById('"+
|
303
|
+
setTimeout("get_IE_selection(document.getElementById('"+ t.id +"'));", 50);
|
312
304
|
};
|
313
305
|
|
314
306
|
function IE_textarea_focus(){
|
@@ -320,16 +312,21 @@
|
|
320
312
|
}
|
321
313
|
|
322
314
|
// select the text for IE (take into account the \r difference)
|
323
|
-
function set_IE_selection(
|
315
|
+
function set_IE_selection( t ){
|
316
|
+
var nbLineStart,nbLineStart,nbLineEnd,range;
|
324
317
|
if(!window.closed){
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
318
|
+
nbLineStart=t.value.substr(0, t.selectionStart).split("\n").length - 1;
|
319
|
+
nbLineEnd=t.value.substr(0, t.selectionEnd).split("\n").length - 1;
|
320
|
+
try
|
321
|
+
{
|
322
|
+
range = document.selection.createRange();
|
323
|
+
range.moveToElementText( t );
|
324
|
+
range.setEndPoint( 'EndToStart', range );
|
325
|
+
range.moveStart('character', t.selectionStart - nbLineStart);
|
326
|
+
range.moveEnd('character', t.selectionEnd - nbLineEnd - (t.selectionStart - nbLineStart) );
|
327
|
+
range.select();
|
328
|
+
}
|
329
|
+
catch(e){}
|
333
330
|
}
|
334
331
|
};
|
335
332
|
|