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
@@ -7,35 +7,35 @@
|
|
7
7
|
******/
|
8
8
|
|
9
9
|
function EditAreaLoader(){
|
10
|
-
this
|
10
|
+
var t=this;
|
11
|
+
t.version= "0.8.1.1";
|
11
12
|
date= new Date();
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
//
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
t.start_time=date.getTime();
|
14
|
+
t.win= "loading"; // window loading state
|
15
|
+
t.error= false; // to know if load is interrrupt
|
16
|
+
t.baseURL="";
|
17
|
+
//t.suffix="";
|
18
|
+
t.template="";
|
19
|
+
t.lang= {}; // array of loaded speech language
|
20
|
+
t.load_syntax= {}; // array of loaded syntax language for highlight mode
|
21
|
+
t.syntax= {}; // array of initilized syntax language for highlight mode
|
22
|
+
t.loadedFiles= [];
|
23
|
+
t.waiting_loading= {}; // files that must be loaded in order to allow the script to really start
|
23
24
|
// scripts that must be loaded in the iframe
|
24
|
-
|
25
|
-
|
25
|
+
t.scripts_to_load= ["elements_functions", "resize_area", "reg_syntax"];
|
26
|
+
t.sub_scripts_to_load= ["edit_area", "manage_area" ,"edit_area_functions", "keyboard", "search_replace", "highlight", "regexp"];
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
t.resize= []; // contain resizing datas
|
29
|
+
t.hidden= {}; // store datas of the hidden textareas
|
29
30
|
|
30
|
-
|
31
|
+
t.default_settings= {
|
31
32
|
//id: "src" // id of the textarea to transform
|
32
33
|
debug: false
|
33
34
|
,smooth_selection: true
|
34
35
|
,font_size: "10" // not for IE
|
35
36
|
,font_family: "monospace" // can be "verdana,monospace". Allow non monospace font but Firefox get smaller tabulation with non monospace fonts. IE doesn't change the tabulation width and Opera doesn't take this option into account...
|
36
37
|
,start_highlight: false // if start with highlight
|
37
|
-
,
|
38
|
-
,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, |, help"
|
38
|
+
,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help"
|
39
39
|
,begin_toolbar: "" // "new_document, save, load, |"
|
40
40
|
,end_toolbar: "" // or end_toolbar
|
41
41
|
,is_multi_files: false // enable the multi file mode (the textarea content is ignored)
|
@@ -47,7 +47,7 @@ function EditAreaLoader(){
|
|
47
47
|
,allow_toggle: true // true or false
|
48
48
|
,language: "en"
|
49
49
|
,syntax: ""
|
50
|
-
,syntax_selection_allow: "basic,brainfuck,c,coldfusion,cpp,css,html,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml"
|
50
|
+
,syntax_selection_allow: "basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml"
|
51
51
|
,display: "onload" // onload or later
|
52
52
|
,max_undo: 30
|
53
53
|
,browsers: "known" // all or known
|
@@ -55,7 +55,9 @@ function EditAreaLoader(){
|
|
55
55
|
,gecko_spellcheck: false // enable/disable by default the gecko_spellcheck
|
56
56
|
,fullscreen: false
|
57
57
|
,is_editable: true
|
58
|
-
,
|
58
|
+
,cursor_position: "begin"
|
59
|
+
,word_wrap: false // define if the text is wrapped of not in the textarea
|
60
|
+
,autocompletion: false // NOT IMPLEMENTED
|
59
61
|
,load_callback: "" // click on load button (function name)
|
60
62
|
,save_callback: "" // click on save button (function name)
|
61
63
|
,change_callback: "" // textarea onchange trigger (function name)
|
@@ -71,83 +73,39 @@ function EditAreaLoader(){
|
|
71
73
|
,EA_file_close_callback: "" // close a tab
|
72
74
|
};
|
73
75
|
|
74
|
-
|
76
|
+
t.advanced_buttons = [
|
75
77
|
// id, button img, command (it will try to find the translation of "id"), is_file_specific
|
76
78
|
['new_document', 'newdocument.gif', 'new_document', false],
|
77
|
-
['search', 'search.
|
78
|
-
['go_to_line', '
|
79
|
-
['undo', 'undo.
|
80
|
-
['redo', 'redo.
|
79
|
+
['search', 'search.png', 'show_search', false],
|
80
|
+
['go_to_line', 'goto.png', 'go_to_line', false],
|
81
|
+
['undo', 'undo.png', 'undo', true],
|
82
|
+
['redo', 'redo.png', 'redo', true],
|
81
83
|
['change_smooth_selection', 'smooth_selection.gif', 'change_smooth_selection_mode', true],
|
82
84
|
['reset_highlight', 'reset_highlight.gif', 'resync_highlight', true],
|
83
85
|
['highlight', 'highlight.gif','change_highlight', true],
|
84
|
-
['help', 'help.
|
85
|
-
['save', 'save.
|
86
|
+
['help', 'help.png', 'show_help', false],
|
87
|
+
['save', 'save.png', 'save', false],
|
86
88
|
['load', 'load.gif', 'load', false],
|
87
89
|
['fullscreen', 'fullscreen.gif', 'toggle_full_screen', false],
|
90
|
+
['word_wrap', 'word_wrap.gif', 'toggle_word_wrap', true],
|
88
91
|
['autocompletion', 'autocompletion.gif', 'toggle_autocompletion', true]
|
89
92
|
];
|
90
93
|
|
91
94
|
// navigator identification
|
92
|
-
|
93
|
-
|
94
|
-
this.nav= new Object();
|
95
|
-
|
96
|
-
this.nav['isMacOS'] = (ua.indexOf('Mac OS') != -1);
|
97
|
-
|
98
|
-
this.nav['isIE'] = (navigator.appName == "Microsoft Internet Explorer");
|
99
|
-
if(this.nav['isIE']){
|
100
|
-
this.nav['isIE'] = ua.replace(/^.*?MSIE ([0-9\.]*).*$/, "$1");
|
101
|
-
if(this.nav['isIE']<6)
|
102
|
-
this.has_error();
|
103
|
-
}
|
104
|
-
if(this.nav['isNS'] = ua.indexOf('Netscape/') != -1){ // work only on netscape > 8 with render mode IE
|
105
|
-
this.nav['isNS']= ua.substr(ua.indexOf('Netscape/')+9);
|
106
|
-
if(this.nav['isNS']<8 || !this.nav['isIE'])
|
107
|
-
this.has_error();
|
108
|
-
}
|
109
|
-
|
110
|
-
if(this.nav['isOpera'] = (ua.indexOf('Opera') != -1)){
|
111
|
-
this.nav['isOpera']= ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i, "$1");
|
112
|
-
if(this.nav['isOpera']<9)
|
113
|
-
this.has_error();
|
114
|
-
this.nav['isIE']=false;
|
115
|
-
}
|
116
|
-
this.nav['isGecko'] = (ua.indexOf('Gecko') != -1);
|
117
|
-
|
118
|
-
if(this.nav['isFirefox'] =(ua.indexOf('Firefox') != -1))
|
119
|
-
this.nav['isFirefox'] = ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i, "$1");
|
120
|
-
// Iceweasel is a clone of Firefox
|
121
|
-
if(this.nav['isIceweasel'] =(ua.indexOf('Iceweasel') != -1))
|
122
|
-
this.nav['isFirefox']= this.nav['isIceweasel'] = ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i, "$1");
|
123
|
-
// grandparadisio is a clone of Firefox
|
124
|
-
if(this.nav['GranParadiso'] =(ua.indexOf('GranParadiso') != -1))
|
125
|
-
this.nav['isFirefox']= this.nav['isGranParadiso'] = ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i, "$1");
|
126
|
-
// BonEcho is a clone of Firefox
|
127
|
-
if(this.nav['BonEcho'] =(ua.indexOf('BonEcho') != -1))
|
128
|
-
this.nav['isFirefox']= this.nav['isBonEcho'] = ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i, "$1");
|
129
|
-
|
130
|
-
if(this.nav['isCamino'] =(ua.indexOf('Camino') != -1))
|
131
|
-
this.nav['isCamino'] = ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i, "$1");
|
95
|
+
t.set_browser_infos(t);
|
132
96
|
|
133
|
-
if(
|
134
|
-
|
135
|
-
|
136
|
-
if(this.nav['isSafari'] =(ua.indexOf('Safari') != -1))
|
137
|
-
this.nav['isSafari']= ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i, "$1");
|
138
|
-
|
139
|
-
if(this.nav['isIE']>=6 || this.nav['isOpera']>=9 || this.nav['isFirefox'] || this.nav['isChrome'] || this.nav['isCamino'] || this.nav['isSafari']>=3)
|
140
|
-
this.nav['isValidBrowser']=true;
|
97
|
+
if(t.isIE>=6 || t.isGecko || ( t.isWebKit && !t.isSafari<3 ) || t.isOpera>=9 || t.isCamino )
|
98
|
+
t.isValidBrowser=true;
|
141
99
|
else
|
142
|
-
|
100
|
+
t.isValidBrowser=false;
|
143
101
|
|
144
|
-
|
102
|
+
t.set_base_url();
|
145
103
|
|
146
|
-
for(var i=0; i<
|
147
|
-
setTimeout("editAreaLoader.load_script('"+
|
148
|
-
|
149
|
-
}
|
150
|
-
|
104
|
+
for(var i=0; i<t.scripts_to_load.length; i++){
|
105
|
+
setTimeout("editAreaLoader.load_script('"+t.baseURL + t.scripts_to_load[i]+ ".js');", 1); // let the time to Object editAreaLoader to be created before loading additionnal scripts
|
106
|
+
t.waiting_loading[t.scripts_to_load[i]+ ".js"]= false;
|
107
|
+
}
|
108
|
+
t.add_event(window, "load", EditAreaLoader.prototype.window_loaded);
|
151
109
|
};
|
152
110
|
|
153
111
|
EditAreaLoader.prototype ={
|
@@ -159,6 +117,54 @@ EditAreaLoader.prototype ={
|
|
159
117
|
}
|
160
118
|
},
|
161
119
|
|
120
|
+
// add browser informations to the object passed in parameter
|
121
|
+
set_browser_infos : function(o){
|
122
|
+
ua= navigator.userAgent;
|
123
|
+
|
124
|
+
// general detection
|
125
|
+
o.isWebKit = /WebKit/.test(ua);
|
126
|
+
o.isGecko = !o.isWebKit && /Gecko/.test(ua);
|
127
|
+
o.isMac = /Mac/.test(ua);
|
128
|
+
|
129
|
+
o.isIE = (navigator.appName == "Microsoft Internet Explorer");
|
130
|
+
if(o.isIE){
|
131
|
+
o.isIE = ua.replace(/^.*?MSIE\s+([0-9\.]+).*$/, "$1");
|
132
|
+
if(o.isIE<6)
|
133
|
+
o.has_error();
|
134
|
+
}
|
135
|
+
|
136
|
+
if(o.isOpera = (ua.indexOf('Opera') != -1)){
|
137
|
+
o.isOpera= ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i, "$1");
|
138
|
+
if(o.isOpera<9)
|
139
|
+
o.has_error();
|
140
|
+
o.isIE=false;
|
141
|
+
}
|
142
|
+
|
143
|
+
if(o.isFirefox =(ua.indexOf('Firefox') != -1))
|
144
|
+
o.isFirefox = ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i, "$1");
|
145
|
+
// Firefox clones
|
146
|
+
if( ua.indexOf('Iceweasel') != -1 )
|
147
|
+
o.isFirefox = ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i, "$1");
|
148
|
+
if( ua.indexOf('GranParadiso') != -1 )
|
149
|
+
o.isFirefox = ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i, "$1");
|
150
|
+
if( ua.indexOf('BonEcho') != -1 )
|
151
|
+
o.isFirefox = ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i, "$1");
|
152
|
+
if( ua.indexOf('SeaMonkey') != -1)
|
153
|
+
o.isFirefox = (ua.replace(/^.*?SeaMonkey.*?([0-9\.]+).*$/i, "$1") ) + 1;
|
154
|
+
|
155
|
+
if(o.isCamino =(ua.indexOf('Camino') != -1))
|
156
|
+
o.isCamino = ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i, "$1");
|
157
|
+
|
158
|
+
if(o.isSafari =(ua.indexOf('Safari') != -1))
|
159
|
+
o.isSafari= ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i, "$1");
|
160
|
+
|
161
|
+
if(o.isChrome =(ua.indexOf('Chrome') != -1)) {
|
162
|
+
o.isChrome = ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i, "$1");
|
163
|
+
o.isSafari = false;
|
164
|
+
}
|
165
|
+
|
166
|
+
},
|
167
|
+
|
162
168
|
window_loaded : function(){
|
163
169
|
editAreaLoader.win="loaded";
|
164
170
|
|
@@ -182,150 +188,145 @@ EditAreaLoader.prototype ={
|
|
182
188
|
|
183
189
|
// init the checkup of the selection of the IE textarea
|
184
190
|
init_ie_textarea : function(id){
|
185
|
-
var
|
191
|
+
var a=document.getElementById(id);
|
186
192
|
try{
|
187
|
-
if(
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
get_IE_selection(
|
192
|
-
editAreaLoader.add_event(
|
193
|
-
editAreaLoader.add_event(
|
193
|
+
if(a && typeof(a.focused)=="undefined"){
|
194
|
+
a.focus();
|
195
|
+
a.focused=true;
|
196
|
+
a.selectionStart= a.selectionEnd= 0;
|
197
|
+
get_IE_selection(a);
|
198
|
+
editAreaLoader.add_event(a, "focus", IE_textarea_focus);
|
199
|
+
editAreaLoader.add_event(a, "blur", IE_textarea_blur);
|
194
200
|
|
195
201
|
}
|
196
202
|
}catch(ex){}
|
197
203
|
},
|
198
204
|
|
199
205
|
init : function(settings){
|
200
|
-
|
201
|
-
if(!settings["id"])
|
202
|
-
this.has_error();
|
206
|
+
var t=this,s=settings,i;
|
203
207
|
|
204
|
-
if(
|
208
|
+
if(!s["id"])
|
209
|
+
t.has_error();
|
210
|
+
if(t.error)
|
205
211
|
return;
|
206
212
|
// if an instance of the editor already exists for this textarea => delete the previous one
|
207
|
-
if(editAreas[
|
208
|
-
|
213
|
+
if(editAreas[s["id"]])
|
214
|
+
t.delete_instance(s["id"]);
|
209
215
|
|
210
216
|
// init settings
|
211
|
-
for(
|
212
|
-
if(typeof(
|
213
|
-
|
217
|
+
for(i in t.default_settings){
|
218
|
+
if(typeof(s[i])=="undefined")
|
219
|
+
s[i]=t.default_settings[i];
|
214
220
|
}
|
215
221
|
|
216
|
-
if(
|
222
|
+
if(s["browsers"]=="known" && t.isValidBrowser==false){
|
217
223
|
return;
|
218
224
|
}
|
219
225
|
|
220
|
-
if(
|
221
|
-
|
222
|
-
if(
|
223
|
-
|
224
|
-
|
226
|
+
if(s["begin_toolbar"].length>0)
|
227
|
+
s["toolbar"]= s["begin_toolbar"] +","+ s["toolbar"];
|
228
|
+
if(s["end_toolbar"].length>0)
|
229
|
+
s["toolbar"]= s["toolbar"] +","+ s["end_toolbar"];
|
230
|
+
s["tab_toolbar"]= s["toolbar"].replace(/ /g,"").split(",");
|
225
231
|
|
226
|
-
|
227
|
-
for(
|
228
|
-
if(
|
229
|
-
|
232
|
+
s["plugins"]= s["plugins"].replace(/ /g,"").split(",");
|
233
|
+
for(i=0; i<s["plugins"].length; i++){
|
234
|
+
if(s["plugins"][i].length==0)
|
235
|
+
s["plugins"].splice(i,1);
|
230
236
|
}
|
231
237
|
// alert(settings["plugins"].length+": "+ settings["plugins"].join(","));
|
232
|
-
|
233
|
-
|
234
|
-
tmp+=i+" : "+settings[i]+";\n";
|
235
|
-
}
|
236
|
-
alert(tmp);*/
|
237
|
-
this.get_template();
|
238
|
-
this.load_script(this.baseURL + "langs/"+ settings["language"] + ".js");
|
238
|
+
t.get_template();
|
239
|
+
t.load_script(t.baseURL + "langs/"+ s["language"] + ".js");
|
239
240
|
|
240
|
-
if(
|
241
|
-
|
242
|
-
|
241
|
+
if(s["syntax"].length>0){
|
242
|
+
s["syntax"]=s["syntax"].toLowerCase();
|
243
|
+
t.load_script(t.baseURL + "reg_syntax/"+ s["syntax"] + ".js");
|
243
244
|
}
|
244
245
|
//alert(this.template);
|
245
246
|
|
246
|
-
editAreas[
|
247
|
-
editAreas[
|
248
|
-
editAreas[
|
247
|
+
editAreas[s["id"]]= {"settings": s};
|
248
|
+
editAreas[s["id"]]["displayed"]=false;
|
249
|
+
editAreas[s["id"]]["hidden"]=false;
|
249
250
|
|
250
251
|
//if(settings["display"]=="onload")
|
251
|
-
|
252
|
+
t.start(s["id"]);
|
252
253
|
},
|
253
254
|
|
254
255
|
// delete an instance of an EditArea
|
255
256
|
delete_instance : function(id){
|
256
|
-
|
257
|
+
var d=document,fs=window.frames,span,iframe;
|
257
258
|
editAreaLoader.execCommand(id, "EA_delete");
|
258
|
-
if(
|
259
|
+
if(fs["frame_"+id] && fs["frame_"+id].editArea)
|
259
260
|
{
|
260
261
|
if(editAreas[id]["displayed"])
|
261
262
|
editAreaLoader.toggle(id, "off");
|
262
|
-
|
263
|
+
fs["frame_"+id].editArea.execCommand("EA_unload");
|
263
264
|
}
|
264
265
|
|
265
266
|
// remove toggle infos and debug textarea
|
266
|
-
|
267
|
+
span= d.getElementById("EditAreaArroundInfos_"+id);
|
267
268
|
if(span)
|
268
269
|
span.parentNode.removeChild(span);
|
269
270
|
|
270
271
|
// remove the iframe
|
271
|
-
|
272
|
+
iframe= d.getElementById("frame_"+id);
|
272
273
|
if(iframe){
|
273
274
|
iframe.parentNode.removeChild(iframe);
|
274
275
|
//delete iframe;
|
275
276
|
try {
|
276
|
-
delete
|
277
|
+
delete fs["frame_"+id];
|
277
278
|
} catch (e) {// Do nothing
|
278
279
|
}
|
279
280
|
}
|
280
281
|
|
281
282
|
delete editAreas[id];
|
282
|
-
|
283
283
|
},
|
284
284
|
|
285
285
|
|
286
286
|
start : function(id){
|
287
|
+
var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;
|
288
|
+
|
287
289
|
// check that the window is loaded
|
288
|
-
if(
|
290
|
+
if(t.win!="loaded"){
|
289
291
|
setTimeout("editAreaLoader.start('"+id+"');", 50);
|
290
292
|
return;
|
291
293
|
}
|
292
294
|
|
293
295
|
// check that all needed scripts are loaded
|
294
|
-
for(
|
295
|
-
if(
|
296
|
+
for( i in t.waiting_loading){
|
297
|
+
if(t.waiting_loading[i]!="loaded" && typeof(t.waiting_loading[i])!="function"){
|
296
298
|
setTimeout("editAreaLoader.start('"+id+"');", 50);
|
297
299
|
return;
|
298
300
|
}
|
299
301
|
}
|
300
302
|
|
301
303
|
// wait until language and syntax files are loaded
|
302
|
-
if(!
|
304
|
+
if(!t.lang[editAreas[id]["settings"]["language"]] || (editAreas[id]["settings"]["syntax"].length>0 && !t.load_syntax[editAreas[id]["settings"]["syntax"]]) ){
|
303
305
|
setTimeout("editAreaLoader.start('"+id+"');", 50);
|
304
306
|
return;
|
305
307
|
}
|
306
308
|
// init the regexp for syntax highlight
|
307
309
|
if(editAreas[id]["settings"]["syntax"].length>0)
|
308
|
-
|
310
|
+
t.init_syntax_regexp();
|
309
311
|
|
310
312
|
|
311
313
|
// display toggle option and debug area
|
312
|
-
if(!
|
314
|
+
if(!d.getElementById("EditAreaArroundInfos_"+id) && (editAreas[id]["settings"]["debug"] || editAreas[id]["settings"]["allow_toggle"]))
|
313
315
|
{
|
314
|
-
|
316
|
+
span= d.createElement("span");
|
315
317
|
span.id= "EditAreaArroundInfos_"+id;
|
316
|
-
var html="";
|
317
318
|
if(editAreas[id]["settings"]["allow_toggle"]){
|
318
|
-
checked=(editAreas[id]["settings"]["display"]=="onload")?"checked":"";
|
319
|
+
checked=(editAreas[id]["settings"]["display"]=="onload")?"checked='checked'":"";
|
319
320
|
html+="<div id='edit_area_toggle_"+i+"'>";
|
320
321
|
html+="<input id='edit_area_toggle_checkbox_"+ id +"' class='toggle_"+ id +"' type='checkbox' onclick='editAreaLoader.toggle(\""+ id +"\");' accesskey='e' "+checked+" />";
|
321
322
|
html+="<label for='edit_area_toggle_checkbox_"+ id +"'>{$toggle}</label></div>";
|
322
323
|
}
|
323
324
|
if(editAreas[id]["settings"]["debug"])
|
324
|
-
html+="<textarea id='edit_area_debug_"+ id +"' style='z-index: 20; width: 100%; height: 120px;overflow: auto; border: solid black 1px;'></textarea><br />";
|
325
|
-
html=
|
325
|
+
html+="<textarea id='edit_area_debug_"+ id +"' spellcheck='off' style='z-index: 20; width: 100%; height: 120px;overflow: auto; border: solid black 1px;'></textarea><br />";
|
326
|
+
html= t.translate(html, editAreas[id]["settings"]["language"]);
|
326
327
|
span.innerHTML= html;
|
327
|
-
|
328
|
-
|
328
|
+
father= d.getElementById(id).parentNode;
|
329
|
+
next= d.getElementById(id).nextSibling;
|
329
330
|
if(next==null)
|
330
331
|
father.appendChild(span);
|
331
332
|
else
|
@@ -334,68 +335,70 @@ EditAreaLoader.prototype ={
|
|
334
335
|
|
335
336
|
if(!editAreas[id]["initialized"])
|
336
337
|
{
|
337
|
-
|
338
|
+
t.execCommand(id, "EA_init"); // ini callback
|
338
339
|
if(editAreas[id]["settings"]["display"]=="later"){
|
339
340
|
editAreas[id]["initialized"]= true;
|
340
341
|
return;
|
341
342
|
}
|
342
343
|
}
|
343
344
|
|
344
|
-
if(
|
345
|
-
|
345
|
+
if(t.isIE){ // launch IE selection checkup
|
346
|
+
t.init_ie_textarea(id);
|
346
347
|
}
|
347
348
|
|
348
349
|
// get toolbar content
|
349
|
-
var html_toolbar_content="";
|
350
350
|
area=editAreas[id];
|
351
351
|
|
352
|
-
for(
|
352
|
+
for(i=0; i<area["settings"]["tab_toolbar"].length; i++){
|
353
353
|
// alert(this.tab_toolbar[i]+"\n"+ this.get_control_html(this.tab_toolbar[i]));
|
354
|
-
html_toolbar_content+=
|
354
|
+
html_toolbar_content+= t.get_control_html(area["settings"]["tab_toolbar"][i], area["settings"]["language"]);
|
355
355
|
}
|
356
|
+
// translate toolbar text here for chrome 2
|
357
|
+
html_toolbar_content = t.translate(html_toolbar_content, area["settings"]["language"], "template");
|
358
|
+
|
356
359
|
|
357
360
|
// create javascript import rules for the iframe if the javascript has not been already loaded by the compressor
|
358
|
-
if(!
|
359
|
-
|
360
|
-
for(
|
361
|
-
|
361
|
+
if(!t.iframe_script){
|
362
|
+
t.iframe_script="";
|
363
|
+
for(i=0; i<t.sub_scripts_to_load.length; i++)
|
364
|
+
t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + t.sub_scripts_to_load[i] +'.js"></script>';
|
362
365
|
}
|
363
366
|
|
364
367
|
// add plugins scripts if not already loaded by the compressor (but need to load language in all the case)
|
365
|
-
for(
|
368
|
+
for(i=0; i<area["settings"]["plugins"].length; i++){
|
366
369
|
//if(typeof(area["settings"]["plugins"][i])=="function") continue;
|
367
|
-
if(!
|
368
|
-
|
369
|
-
|
370
|
+
if(!t.all_plugins_loaded)
|
371
|
+
t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + 'plugins/' + area["settings"]["plugins"][i] + '/' + area["settings"]["plugins"][i] +'.js"></script>';
|
372
|
+
t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + 'plugins/' + area["settings"]["plugins"][i] + '/langs/' + area["settings"]["language"] +'.js"></script>';
|
370
373
|
}
|
371
374
|
|
372
375
|
|
373
376
|
// create css link for the iframe if the whole css text has not been already loaded by the compressor
|
374
|
-
if(!
|
375
|
-
|
377
|
+
if(!t.iframe_css){
|
378
|
+
t.iframe_css="<link href='"+ t.baseURL +"edit_area.css' rel='stylesheet' type='text/css' />";
|
376
379
|
}
|
377
380
|
|
378
381
|
|
379
382
|
// create template
|
380
|
-
|
383
|
+
template= t.template.replace(/\[__BASEURL__\]/g, t.baseURL);
|
381
384
|
template= template.replace("[__TOOLBAR__]",html_toolbar_content);
|
382
385
|
|
383
386
|
|
384
387
|
// fill template with good language sentences
|
385
|
-
template=
|
388
|
+
template= t.translate(template, area["settings"]["language"], "template");
|
386
389
|
|
387
390
|
// add css_code
|
388
|
-
template= template.replace("[__CSSRULES__]",
|
391
|
+
template= template.replace("[__CSSRULES__]", t.iframe_css);
|
389
392
|
// add js_code
|
390
|
-
template= template.replace("[__JSCODE__]",
|
393
|
+
template= template.replace("[__JSCODE__]", t.iframe_script);
|
391
394
|
|
392
395
|
// add version_code
|
393
|
-
template= template.replace("[__EA_VERSION__]",
|
396
|
+
template= template.replace("[__EA_VERSION__]", t.version);
|
394
397
|
//template=template.replace(/\{\$([^\}]+)\}/gm, this.traduc_template);
|
395
398
|
|
396
399
|
//editAreas[area["settings"]["id"]]["template"]= template;
|
397
400
|
|
398
|
-
area.textarea=
|
401
|
+
area.textarea=d.getElementById(area["settings"]["id"]);
|
399
402
|
editAreas[area["settings"]["id"]]["textarea"]=area.textarea;
|
400
403
|
|
401
404
|
// if removing previous instances from DOM before (fix from Marcin)
|
@@ -403,38 +406,31 @@ EditAreaLoader.prototype ={
|
|
403
406
|
delete window.frames["frame_"+area["settings"]["id"]];
|
404
407
|
|
405
408
|
// insert template in the document after the textarea
|
406
|
-
|
409
|
+
father= area.textarea.parentNode;
|
407
410
|
/* var container= document.createElement("div");
|
408
411
|
container.id= "EditArea_frame_container_"+area["settings"]["id"];
|
409
412
|
*/
|
410
|
-
|
413
|
+
content= d.createElement("iframe");
|
411
414
|
content.name= "frame_"+area["settings"]["id"];
|
412
415
|
content.id= "frame_"+area["settings"]["id"];
|
413
416
|
content.style.borderWidth= "0px";
|
414
417
|
setAttribute(content, "frameBorder", "0"); // IE
|
415
418
|
content.style.overflow="hidden";
|
416
419
|
content.style.display="none";
|
420
|
+
|
417
421
|
|
418
|
-
|
419
|
-
var next= area.textarea.nextSibling;
|
420
|
-
if(next==null)
|
421
|
-
father.appendChild(container);
|
422
|
-
else
|
423
|
-
father.insertBefore(container, next) ;*/
|
424
|
-
|
425
|
-
var next= area.textarea.nextSibling;
|
422
|
+
next= area.textarea.nextSibling;
|
426
423
|
if(next==null)
|
427
424
|
father.appendChild(content);
|
428
425
|
else
|
429
426
|
father.insertBefore(content, next) ;
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
frame.document.close();
|
427
|
+
f=window.frames["frame_"+area["settings"]["id"]];
|
428
|
+
f.document.open();
|
429
|
+
f.editAreas=editAreas;
|
430
|
+
f.area_id= area["settings"]["id"];
|
431
|
+
f.document.area_id= area["settings"]["id"];
|
432
|
+
f.document.write(template);
|
433
|
+
f.document.close();
|
438
434
|
|
439
435
|
// frame.editAreaLoader=this;
|
440
436
|
//editAreas[area["settings"]["id"]]["displayed"]=true;
|
@@ -459,97 +455,97 @@ EditAreaLoader.prototype ={
|
|
459
455
|
return false;
|
460
456
|
},
|
461
457
|
|
458
|
+
// static function
|
462
459
|
toggle_off : function(id){
|
463
|
-
|
460
|
+
var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft;
|
461
|
+
if(fs["frame_"+id])
|
464
462
|
{
|
465
|
-
|
466
|
-
|
467
|
-
|
463
|
+
f = fs["frame_"+id];
|
464
|
+
t = editAreas[id]["textarea"];
|
465
|
+
if(f.editArea.fullscreen['isFull'])
|
466
|
+
f.editArea.toggle_full_screen(false);
|
468
467
|
editAreas[id]["displayed"]=false;
|
469
468
|
|
470
|
-
// set wrap to off to keep same display mode (some browser get problem with this, so it need more complex operation
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
parNod.
|
477
|
-
parNod.insertBefore(editAreas[id]["textarea"], nxtSib);
|
469
|
+
// set wrap to off to keep same display mode (some browser get problem with this, so it need more complex operation
|
470
|
+
t.wrap = "off"; // for IE
|
471
|
+
setAttribute(t, "wrap", "off"); // for Firefox
|
472
|
+
parNod = t.parentNode;
|
473
|
+
nxtSib = t.nextSibling;
|
474
|
+
parNod.removeChild(t);
|
475
|
+
parNod.insertBefore(t, nxtSib);
|
478
476
|
|
479
477
|
// restore values
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
478
|
+
t.value= f.editArea.textarea.value;
|
479
|
+
selStart = f.editArea.last_selection["selectionStart"];
|
480
|
+
selEnd = f.editArea.last_selection["selectionEnd"];
|
481
|
+
scrollTop = f.document.getElementById("result").scrollTop;
|
482
|
+
scrollLeft = f.document.getElementById("result").scrollLeft;
|
485
483
|
|
486
484
|
|
487
485
|
document.getElementById("frame_"+id).style.display='none';
|
488
486
|
|
489
|
-
|
490
|
-
|
487
|
+
t.style.display="inline";
|
491
488
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
489
|
+
try{ // IE will give an error when trying to focus an invisible or disabled textarea
|
490
|
+
t.focus();
|
491
|
+
} catch(e){};
|
492
|
+
if(this.isIE){
|
493
|
+
t.selectionStart= selStart;
|
494
|
+
t.selectionEnd = selEnd;
|
495
|
+
t.focused = true;
|
496
|
+
set_IE_selection(t);
|
498
497
|
}else{
|
499
|
-
if(this.
|
500
|
-
|
498
|
+
if(this.isOpera && this.isOpera < 9.6 ){ // Opera bug when moving selection start and selection end
|
499
|
+
t.setSelectionRange(0, 0);
|
501
500
|
}
|
502
501
|
try{
|
503
|
-
|
504
|
-
} catch(e) {
|
505
|
-
};
|
502
|
+
t.setSelectionRange(selStart, selEnd);
|
503
|
+
} catch(e) {};
|
506
504
|
}
|
507
|
-
|
508
|
-
|
509
|
-
|
505
|
+
t.scrollTop= scrollTop;
|
506
|
+
t.scrollLeft= scrollLeft;
|
507
|
+
f.editArea.execCommand("toggle_off");
|
510
508
|
|
511
509
|
}
|
512
510
|
},
|
513
511
|
|
512
|
+
// static function
|
514
513
|
toggle_on : function(id){
|
515
|
-
|
516
|
-
editAreaLoader.start(id);*/
|
514
|
+
var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem;
|
517
515
|
|
518
|
-
if(
|
516
|
+
if(fs["frame_"+id])
|
519
517
|
{
|
520
|
-
|
521
|
-
|
522
|
-
area
|
518
|
+
f = fs["frame_"+id];
|
519
|
+
t = editAreas[id]["textarea"];
|
520
|
+
area= f.editArea;
|
521
|
+
area.textarea.value= t.value;
|
523
522
|
|
524
523
|
// store display values;
|
525
|
-
|
526
|
-
var selEnd= 0;
|
527
|
-
var scrollTop= 0;
|
528
|
-
var scrollLeft= 0;
|
524
|
+
curPos = editAreas[id]["settings"]["cursor_position"];
|
529
525
|
|
530
|
-
if(
|
526
|
+
if(t.use_last==true)
|
531
527
|
{
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
528
|
+
selStart = t.last_selectionStart;
|
529
|
+
selEnd = t.last_selectionEnd;
|
530
|
+
scrollTop = t.last_scrollTop;
|
531
|
+
scrollLeft = t.last_scrollLeft;
|
532
|
+
t.use_last=false;
|
537
533
|
}
|
538
|
-
else
|
534
|
+
else if( curPos == "auto" )
|
539
535
|
{
|
540
536
|
try{
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
537
|
+
selStart = t.selectionStart;
|
538
|
+
selEnd = t.selectionEnd;
|
539
|
+
scrollTop = t.scrollTop;
|
540
|
+
scrollLeft = t.scrollLeft;
|
545
541
|
//alert(scrollTop);
|
546
542
|
}catch(ex){}
|
547
543
|
}
|
548
544
|
|
549
545
|
// set to good size
|
550
546
|
this.set_editarea_size_from_textarea(id, document.getElementById("frame_"+id));
|
551
|
-
|
552
|
-
document.getElementById("frame_"+id).style.display="inline";
|
547
|
+
t.style.display="none";
|
548
|
+
document.getElementById("frame_"+id).style.display="block"; //"inline";
|
553
549
|
area.execCommand("focus"); // without this focus opera doesn't manage well the iframe body height
|
554
550
|
|
555
551
|
|
@@ -557,21 +553,18 @@ EditAreaLoader.prototype ={
|
|
557
553
|
editAreas[id]["displayed"]=true;
|
558
554
|
area.execCommand("update_size");
|
559
555
|
|
560
|
-
|
561
|
-
|
556
|
+
f.document.getElementById("result").scrollTop= scrollTop;
|
557
|
+
f.document.getElementById("result").scrollLeft= scrollLeft;
|
562
558
|
area.area_select(selStart, selEnd-selStart);
|
563
559
|
area.execCommand("toggle_on");
|
564
560
|
|
565
|
-
/*date= new Date();
|
566
|
-
end_time=date.getTime();
|
567
|
-
alert("load time: "+ (end_time-this.start_time));*/
|
568
561
|
|
569
562
|
}
|
570
563
|
else
|
571
564
|
{
|
572
|
-
/* if(this.
|
565
|
+
/* if(this.isIE)
|
573
566
|
get_IE_selection(document.getElementById(id)); */
|
574
|
-
|
567
|
+
elem= document.getElementById(id);
|
575
568
|
elem.last_selectionStart= elem.selectionStart;
|
576
569
|
elem.last_selectionEnd= elem.selectionEnd;
|
577
570
|
elem.last_scrollTop= elem.scrollTop;
|
@@ -582,15 +575,15 @@ EditAreaLoader.prototype ={
|
|
582
575
|
},
|
583
576
|
|
584
577
|
set_editarea_size_from_textarea : function(id, frame){
|
585
|
-
var elem
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
578
|
+
var elem,width,height;
|
579
|
+
elem = document.getElementById(id);
|
580
|
+
|
581
|
+
width = Math.max(editAreas[id]["settings"]["min_width"], elem.offsetWidth)+"px";
|
582
|
+
height = Math.max(editAreas[id]["settings"]["min_height"], elem.offsetHeight)+"px";
|
590
583
|
if(elem.style.width.indexOf("%")!=-1)
|
591
|
-
width= elem.style.width;
|
584
|
+
width = elem.style.width;
|
592
585
|
if(elem.style.height.indexOf("%")!=-1)
|
593
|
-
height= elem.style.height;
|
586
|
+
height = elem.style.height;
|
594
587
|
//alert("h: "+height+" w: "+width);
|
595
588
|
|
596
589
|
frame.style.width= width;
|
@@ -598,52 +591,53 @@ EditAreaLoader.prototype ={
|
|
598
591
|
},
|
599
592
|
|
600
593
|
set_base_url : function(){
|
601
|
-
|
602
|
-
|
603
|
-
|
594
|
+
var t=this,elems,i,docBasePath;
|
595
|
+
|
596
|
+
if( !this.baseURL ){
|
597
|
+
elems = document.getElementsByTagName('script');
|
604
598
|
|
605
|
-
for
|
606
|
-
if (
|
607
|
-
var src =
|
599
|
+
for( i=0; i<elems.length; i++ ){
|
600
|
+
if (elems[i].src && elems[i].src.match(/edit_area_[^\\\/]*$/i) ) {
|
601
|
+
var src = elems[i].src;
|
608
602
|
src = src.substring(0, src.lastIndexOf('/'));
|
609
603
|
this.baseURL = src;
|
610
|
-
this.file_name=
|
604
|
+
this.file_name= elems[i].src.substr(elems[i].src.lastIndexOf("/")+1);
|
611
605
|
break;
|
612
606
|
}
|
613
607
|
}
|
614
608
|
}
|
615
609
|
|
616
|
-
|
617
|
-
if (
|
618
|
-
|
619
|
-
|
620
|
-
documentBasePath = documentBasePath.substring(0, documentBasePath.lastIndexOf('/'));
|
610
|
+
docBasePath = document.location.href;
|
611
|
+
if (docBasePath.indexOf('?') != -1)
|
612
|
+
docBasePath = docBasePath.substring(0, docBasePath.indexOf('?'));
|
613
|
+
docBasePath = docBasePath.substring(0, docBasePath.lastIndexOf('/'));
|
621
614
|
|
622
615
|
// If not HTTP absolute
|
623
|
-
if (
|
616
|
+
if (t.baseURL.indexOf('://') == -1 && t.baseURL.charAt(0) != '/') {
|
624
617
|
// If site absolute
|
625
|
-
|
618
|
+
t.baseURL = docBasePath + "/" + t.baseURL;
|
626
619
|
}
|
627
|
-
|
620
|
+
t.baseURL +="/";
|
628
621
|
},
|
629
622
|
|
630
623
|
get_button_html : function(id, img, exec, isFileSpecific, baseURL) {
|
624
|
+
var cmd,html;
|
631
625
|
if(!baseURL)
|
632
626
|
baseURL= this.baseURL;
|
633
|
-
|
634
|
-
html= '<a id="a_'+ id +'" href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self" fileSpecific="'+ (isFileSpecific?'yes':'no') +'">';
|
635
|
-
html+= '<img id="' + id + '" src="'+ baseURL +'images/' + img + '" title="{$' + id + '}"
|
627
|
+
cmd = 'editArea.execCommand(\'' + exec + '\')';
|
628
|
+
html = '<a id="a_'+ id +'" href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self" fileSpecific="'+ (isFileSpecific?'yes':'no') +'">';
|
629
|
+
html += '<img id="' + id + '" src="'+ baseURL +'images/' + img + '" title="{$' + id + '}" class="editAreaButtonNormal" onmouseover="editArea.switchClass(this,\'editAreaButtonOver\');" onmouseout="editArea.restoreClass(this);" onmousedown="editArea.restoreAndSwitchClass(this,\'editAreaButtonDown\');" /></a>';
|
636
630
|
return html;
|
637
631
|
},
|
638
632
|
|
639
633
|
get_control_html : function(button_name, lang) {
|
640
|
-
|
641
|
-
for (
|
634
|
+
var t=this,i,but,html,si;
|
635
|
+
for (i=0; i<t.advanced_buttons.length; i++)
|
642
636
|
{
|
643
|
-
|
637
|
+
but = t.advanced_buttons[i];
|
644
638
|
if (but[0] == button_name)
|
645
639
|
{
|
646
|
-
return
|
640
|
+
return t.get_button_html(but[0], but[1], but[2], but[3]);
|
647
641
|
}
|
648
642
|
}
|
649
643
|
|
@@ -653,20 +647,18 @@ EditAreaLoader.prototype ={
|
|
653
647
|
return "<br />";
|
654
648
|
case "|":
|
655
649
|
case "separator":
|
656
|
-
return '<img src="'+
|
650
|
+
return '<img src="'+ t.baseURL +'images/spacer.gif" width="1" height="15" class="editAreaSeparatorLine">';
|
657
651
|
case "select_font":
|
658
|
-
html= "<select id='area_font_size' onchange='javascript:editArea.execCommand(\"change_font_size\")' fileSpecific='yes'>"
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
+"<option value='14'>14 pt</option>"
|
666
|
-
+"</select>";
|
652
|
+
html= "<select id='area_font_size' onchange='javascript:editArea.execCommand(\"change_font_size\")' fileSpecific='yes'>";
|
653
|
+
html+="<option value='-1'>{$font_size}</option>";
|
654
|
+
si=[8,9,10,11,12,14];
|
655
|
+
for( i=0;i<si.length;i++){
|
656
|
+
html+="<option value='"+si[i]+"'>"+si[i]+" pt</option>";
|
657
|
+
}
|
658
|
+
html+="</select>";
|
667
659
|
return html;
|
668
660
|
case "syntax_selection":
|
669
|
-
|
661
|
+
html= "<select id='syntax_selection' onchange='javascript:editArea.execCommand(\"change_syntax\", this.value)' fileSpecific='yes'>";
|
670
662
|
html+="<option value='-1'>{$syntax_selection}</option>";
|
671
663
|
html+="</select>";
|
672
664
|
return html;
|
@@ -700,7 +692,6 @@ EditAreaLoader.prototype ={
|
|
700
692
|
|
701
693
|
// translate text
|
702
694
|
translate : function(text, lang, mode){
|
703
|
-
|
704
695
|
if(mode=="word")
|
705
696
|
text=editAreaLoader.get_word_translation(text, lang);
|
706
697
|
else if(mode="template"){
|
@@ -715,7 +706,9 @@ EditAreaLoader.prototype ={
|
|
715
706
|
},
|
716
707
|
|
717
708
|
get_word_translation : function(val, lang){
|
718
|
-
|
709
|
+
var i;
|
710
|
+
|
711
|
+
for( i in editAreaLoader.lang[lang]){
|
719
712
|
if(i == val)
|
720
713
|
return editAreaLoader.lang[lang][i];
|
721
714
|
}
|
@@ -723,48 +716,57 @@ EditAreaLoader.prototype ={
|
|
723
716
|
},
|
724
717
|
|
725
718
|
load_script : function(url){
|
726
|
-
|
719
|
+
try {
|
720
|
+
var t=this,d=document,script,head;
|
721
|
+
|
722
|
+
if( t.loadedFiles[url] )
|
727
723
|
return;
|
728
724
|
//alert("load: "+url);
|
729
725
|
try{
|
730
|
-
|
726
|
+
script= d.createElement("script");
|
731
727
|
script.type= "text/javascript";
|
732
728
|
script.src= url;
|
733
729
|
script.charset= "UTF-8";
|
734
|
-
|
735
|
-
head[0].appendChild(script);
|
730
|
+
d.getElementsByTagName("head")[0].appendChild(script);
|
736
731
|
}catch(e){
|
737
|
-
|
732
|
+
d.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '" charset="UTF-8"></sc'+'ript>');
|
738
733
|
}
|
739
|
-
|
740
|
-
|
734
|
+
|
735
|
+
t.loadedFiles[url] = true;
|
736
|
+
} catch (e) { debug(e); }
|
741
737
|
},
|
742
738
|
|
743
739
|
add_event : function(obj, name, handler) {
|
744
|
-
|
745
|
-
obj.attachEvent
|
746
|
-
|
747
|
-
|
748
|
-
|
740
|
+
try{
|
741
|
+
if (obj.attachEvent) {
|
742
|
+
obj.attachEvent("on" + name, handler);
|
743
|
+
} else{
|
744
|
+
obj.addEventListener(name, handler, false);
|
745
|
+
}
|
746
|
+
}catch(e){}
|
749
747
|
},
|
750
748
|
|
751
749
|
remove_event : function(obj, name, handler){
|
752
|
-
|
753
|
-
obj.detachEvent
|
754
|
-
|
755
|
-
|
750
|
+
try{
|
751
|
+
if (obj.detachEvent)
|
752
|
+
obj.detachEvent("on" + name, handler);
|
753
|
+
else
|
754
|
+
obj.removeEventListener(name, handler, false);
|
755
|
+
}catch(e){}
|
756
756
|
},
|
757
757
|
|
758
758
|
|
759
759
|
// reset all the editareas in the form that have been reseted
|
760
760
|
reset : function(e){
|
761
|
-
var formObj
|
761
|
+
var formObj,is_child,i,x;
|
762
|
+
|
763
|
+
formObj = editAreaLoader.isIE ? window.event.srcElement : e.target;
|
762
764
|
if(formObj.tagName!='FORM')
|
763
765
|
formObj= formObj.form;
|
764
766
|
|
765
|
-
for(
|
766
|
-
|
767
|
-
for
|
767
|
+
for( i in editAreas ){
|
768
|
+
is_child= false;
|
769
|
+
for( x=0;x<formObj.elements.length;x++ ) {
|
768
770
|
if(formObj.elements[x].id == i)
|
769
771
|
is_child=true;
|
770
772
|
}
|
@@ -784,34 +786,35 @@ EditAreaLoader.prototype ={
|
|
784
786
|
|
785
787
|
// prepare all the textarea replaced by an editarea to be submited
|
786
788
|
submit : function(e){
|
787
|
-
var formObj
|
789
|
+
var formObj,is_child,fs=window.frames,i,x;
|
790
|
+
formObj = editAreaLoader.isIE ? window.event.srcElement : e.target;
|
788
791
|
if(formObj.tagName!='FORM')
|
789
792
|
formObj= formObj.form;
|
790
793
|
|
791
|
-
for(
|
792
|
-
|
793
|
-
for
|
794
|
+
for( i in editAreas){
|
795
|
+
is_child= false;
|
796
|
+
for( x=0;x<formObj.elements.length;x++ ) {
|
794
797
|
if(formObj.elements[x].id == i)
|
795
798
|
is_child=true;
|
796
799
|
}
|
797
800
|
|
798
801
|
if(is_child)
|
799
802
|
{
|
800
|
-
if(
|
801
|
-
document.getElementById(i).value=
|
803
|
+
if(fs["frame_"+i] && editAreas[i]["displayed"]==true)
|
804
|
+
document.getElementById(i).value= fs["frame_"+ i].editArea.textarea.value;
|
802
805
|
editAreaLoader.execCommand(i,"EA_submit");
|
803
806
|
}
|
804
807
|
}
|
805
|
-
if(typeof(formObj.edit_area_replaced_submit) == "function"){
|
808
|
+
if( typeof(formObj.edit_area_replaced_submit) == "function" ){
|
806
809
|
res= formObj.edit_area_replaced_submit();
|
807
810
|
if(res==false){
|
808
|
-
if(editAreaLoader.
|
811
|
+
if(editAreaLoader.isIE)
|
809
812
|
return false;
|
810
813
|
else
|
811
814
|
e.preventDefault();
|
812
815
|
}
|
813
816
|
}
|
814
|
-
return
|
817
|
+
return;
|
815
818
|
},
|
816
819
|
|
817
820
|
// allow to get the value of the editarea
|
@@ -826,11 +829,13 @@ EditAreaLoader.prototype ={
|
|
826
829
|
|
827
830
|
// allow to set the value of the editarea
|
828
831
|
setValue : function(id, new_val){
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
832
|
+
var fs=window.frames;
|
833
|
+
|
834
|
+
if( ( f=fs["frame_"+id] ) && editAreas[id]["displayed"]==true){
|
835
|
+
f.editArea.textarea.value= new_val;
|
836
|
+
f.editArea.execCommand("focus");
|
837
|
+
f.editArea.check_line_selection(false);
|
838
|
+
f.editArea.execCommand("onchange");
|
834
839
|
}else if(elem=document.getElementById(id)){
|
835
840
|
elem.value= new_val;
|
836
841
|
}
|
@@ -838,21 +843,16 @@ EditAreaLoader.prototype ={
|
|
838
843
|
|
839
844
|
// allow to get infos on the selection: array(start, end)
|
840
845
|
getSelectionRange : function(id){
|
841
|
-
var sel=
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
sel["start"]=editArea.textarea.selectionStart;
|
850
|
-
sel["end"]=editArea.textarea.selectionEnd;
|
851
|
-
*/
|
852
|
-
sel["start"]=editArea.textarea.selectionStart;
|
853
|
-
sel["end"]=editArea.textarea.selectionEnd;
|
846
|
+
var sel,eA,fs=window.frames;
|
847
|
+
|
848
|
+
sel= {"start": 0, "end": 0};
|
849
|
+
if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
|
850
|
+
eA= fs["frame_"+ id].editArea;
|
851
|
+
|
852
|
+
sel["start"] = eA.textarea.selectionStart;
|
853
|
+
sel["end"] = eA.textarea.selectionEnd;
|
854
854
|
|
855
|
-
}else if(elem=document.getElementById(id)){
|
855
|
+
}else if( elem=document.getElementById(id) ){
|
856
856
|
sel= getSelectionRange(elem);
|
857
857
|
}
|
858
858
|
return sel;
|
@@ -860,12 +860,14 @@ EditAreaLoader.prototype ={
|
|
860
860
|
|
861
861
|
// allow to set the selection with the given start and end positions
|
862
862
|
setSelectionRange : function(id, new_start, new_end){
|
863
|
-
|
864
|
-
|
863
|
+
var fs=window.frames;
|
864
|
+
|
865
|
+
if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
|
866
|
+
fs["frame_"+ id].editArea.area_select(new_start, new_end-new_start);
|
865
867
|
// make an auto-scroll to the selection
|
866
|
-
if(!this.
|
867
|
-
|
868
|
-
|
868
|
+
if(!this.isIE){
|
869
|
+
fs["frame_"+ id].editArea.check_line_selection(false);
|
870
|
+
fs["frame_"+ id].editArea.scroll_to_view();
|
869
871
|
}
|
870
872
|
}else if(elem=document.getElementById(id)){
|
871
873
|
setSelectionRange(elem, new_start, new_end);
|
@@ -874,24 +876,27 @@ EditAreaLoader.prototype ={
|
|
874
876
|
|
875
877
|
getSelectedText : function(id){
|
876
878
|
var sel= this.getSelectionRange(id);
|
879
|
+
|
877
880
|
return this.getValue(id).substring(sel["start"], sel["end"]);
|
878
881
|
},
|
879
882
|
|
880
883
|
setSelectedText : function(id, new_val){
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
884
|
+
var fs=window.frames,d=document,sel,text,scrollTop,scrollLeft,new_sel_end;
|
885
|
+
|
886
|
+
new_val = new_val.replace(/\r/g, "");
|
887
|
+
sel = this.getSelectionRange(id);
|
888
|
+
text = this.getValue(id);
|
889
|
+
if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
|
890
|
+
scrollTop = fs["frame_"+ id].document.getElementById("result").scrollTop;
|
891
|
+
scrollLeft = fs["frame_"+ id].document.getElementById("result").scrollLeft;
|
887
892
|
}else{
|
888
|
-
|
889
|
-
|
893
|
+
scrollTop = d.getElementById(id).scrollTop;
|
894
|
+
scrollLeft = d.getElementById(id).scrollLeft;
|
890
895
|
}
|
891
896
|
|
892
|
-
text= text.substring(0, sel["start"])+ new_val +text.substring(sel["end"]);
|
897
|
+
text = text.substring(0, sel["start"])+ new_val +text.substring(sel["end"]);
|
893
898
|
this.setValue(id, text);
|
894
|
-
|
899
|
+
new_sel_end = sel["start"]+ new_val.length;
|
895
900
|
this.setSelectionRange(id, sel["start"], new_sel_end);
|
896
901
|
|
897
902
|
|
@@ -900,21 +905,25 @@ EditAreaLoader.prototype ={
|
|
900
905
|
this.setSelectionRange(id, sel["start"], new_sel_end+ new_val.split("\n").length -1);
|
901
906
|
}
|
902
907
|
// restore scrolling position
|
903
|
-
if(
|
904
|
-
|
905
|
-
|
906
|
-
|
908
|
+
if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
|
909
|
+
fs["frame_"+ id].document.getElementById("result").scrollTop= scrollTop;
|
910
|
+
fs["frame_"+ id].document.getElementById("result").scrollLeft= scrollLeft;
|
911
|
+
fs["frame_"+ id].editArea.execCommand("onchange");
|
907
912
|
}else{
|
908
|
-
|
909
|
-
|
913
|
+
d.getElementById(id).scrollTop= scrollTop;
|
914
|
+
d.getElementById(id).scrollLeft= scrollLeft;
|
910
915
|
}
|
911
916
|
},
|
912
917
|
|
913
918
|
insertTags : function(id, open_tag, close_tag){
|
914
|
-
var old_sel
|
915
|
-
|
919
|
+
var old_sel,new_sel;
|
920
|
+
|
921
|
+
old_sel = this.getSelectionRange(id);
|
922
|
+
text = open_tag + this.getSelectedText(id) + close_tag;
|
923
|
+
|
916
924
|
editAreaLoader.setSelectedText(id, text);
|
917
|
-
|
925
|
+
|
926
|
+
new_sel = this.getSelectionRange(id);
|
918
927
|
if(old_sel["end"] > old_sel["start"]) // if text was selected, cursor at the end
|
919
928
|
this.setSelectionRange(id, new_sel["end"], new_sel["end"]);
|
920
929
|
else // cursor in the middle
|
@@ -923,58 +932,60 @@ EditAreaLoader.prototype ={
|
|
923
932
|
|
924
933
|
// hide both EditArea and normal textarea
|
925
934
|
hide : function(id){
|
926
|
-
|
935
|
+
var fs= window.frames,d=document,t=this,scrollTop,scrollLeft,span;
|
936
|
+
if(d.getElementById(id) && !t.hidden[id])
|
927
937
|
{
|
928
|
-
|
929
|
-
|
930
|
-
if(
|
938
|
+
t.hidden[id]= {};
|
939
|
+
t.hidden[id]["selectionRange"]= t.getSelectionRange(id);
|
940
|
+
if(d.getElementById(id).style.display!="none")
|
931
941
|
{
|
932
|
-
|
933
|
-
|
942
|
+
t.hidden[id]["scrollTop"]= d.getElementById(id).scrollTop;
|
943
|
+
t.hidden[id]["scrollLeft"]= d.getElementById(id).scrollLeft;
|
934
944
|
}
|
935
945
|
|
936
|
-
if(
|
946
|
+
if(fs["frame_"+id])
|
937
947
|
{
|
938
|
-
|
948
|
+
t.hidden[id]["toggle"]= editAreas[id]["displayed"];
|
939
949
|
|
940
|
-
if(
|
941
|
-
|
942
|
-
|
950
|
+
if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
|
951
|
+
scrollTop = fs["frame_"+ id].document.getElementById("result").scrollTop;
|
952
|
+
scrollLeft = fs["frame_"+ id].document.getElementById("result").scrollLeft;
|
943
953
|
}else{
|
944
|
-
|
945
|
-
|
954
|
+
scrollTop = d.getElementById(id).scrollTop;
|
955
|
+
scrollLeft = d.getElementById(id).scrollLeft;
|
946
956
|
}
|
947
|
-
|
948
|
-
|
957
|
+
t.hidden[id]["scrollTop"]= scrollTop;
|
958
|
+
t.hidden[id]["scrollLeft"]= scrollLeft;
|
949
959
|
|
950
960
|
if(editAreas[id]["displayed"]==true)
|
951
961
|
editAreaLoader.toggle_off(id);
|
952
962
|
}
|
953
963
|
|
954
964
|
// hide toggle button and debug box
|
955
|
-
|
965
|
+
span= d.getElementById("EditAreaArroundInfos_"+id);
|
956
966
|
if(span){
|
957
967
|
span.style.display='none';
|
958
968
|
}
|
959
969
|
|
960
970
|
// hide textarea
|
961
|
-
|
971
|
+
d.getElementById(id).style.display= "none";
|
962
972
|
}
|
963
973
|
},
|
964
974
|
|
965
975
|
// restore hidden EditArea and normal textarea
|
966
976
|
show : function(id){
|
967
|
-
|
977
|
+
var fs= window.frames,d=document,t=this,span;
|
978
|
+
if((elem=d.getElementById(id)) && t.hidden[id])
|
968
979
|
{
|
969
980
|
elem.style.display= "inline";
|
970
|
-
elem.scrollTop=
|
971
|
-
elem.scrollLeft=
|
972
|
-
|
981
|
+
elem.scrollTop= t.hidden[id]["scrollTop"];
|
982
|
+
elem.scrollLeft= t.hidden[id]["scrollLeft"];
|
983
|
+
span= d.getElementById("EditAreaArroundInfos_"+id);
|
973
984
|
if(span){
|
974
985
|
span.style.display='inline';
|
975
986
|
}
|
976
987
|
|
977
|
-
if(
|
988
|
+
if(fs["frame_"+id])
|
978
989
|
{
|
979
990
|
|
980
991
|
// restore toggle button and debug box
|
@@ -984,25 +995,25 @@ EditAreaLoader.prototype ={
|
|
984
995
|
elem.style.display= "inline";
|
985
996
|
|
986
997
|
// restore EditArea
|
987
|
-
if(
|
998
|
+
if(t.hidden[id]["toggle"]==true)
|
988
999
|
editAreaLoader.toggle_on(id);
|
989
1000
|
|
990
|
-
scrollTop=
|
991
|
-
scrollLeft=
|
1001
|
+
scrollTop = t.hidden[id]["scrollTop"];
|
1002
|
+
scrollLeft = t.hidden[id]["scrollLeft"];
|
992
1003
|
|
993
|
-
if(
|
994
|
-
|
995
|
-
|
1004
|
+
if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
|
1005
|
+
fs["frame_"+ id].document.getElementById("result").scrollTop = scrollTop;
|
1006
|
+
fs["frame_"+ id].document.getElementById("result").scrollLeft = scrollLeft;
|
996
1007
|
}else{
|
997
|
-
elem.scrollTop= scrollTop;
|
998
|
-
elem.scrollLeft= scrollLeft;
|
1008
|
+
elem.scrollTop = scrollTop;
|
1009
|
+
elem.scrollLeft = scrollLeft;
|
999
1010
|
}
|
1000
1011
|
|
1001
1012
|
}
|
1002
1013
|
// restore selection
|
1003
|
-
sel=
|
1004
|
-
|
1005
|
-
delete
|
1014
|
+
sel = t.hidden[id]["selectionRange"];
|
1015
|
+
t.setSelectionRange(id, sel["start"], sel["end"]);
|
1016
|
+
delete t.hidden[id];
|
1006
1017
|
}
|
1007
1018
|
},
|
1008
1019
|
|
@@ -1033,8 +1044,9 @@ EditAreaLoader.prototype ={
|
|
1033
1044
|
|
1034
1045
|
// close the given file (for multi file editing mode)
|
1035
1046
|
setFileEditedMode : function(id, file_id, to){
|
1036
|
-
var reg1
|
1037
|
-
|
1047
|
+
var reg1,reg2;
|
1048
|
+
reg1 = new RegExp('\\\\', 'g');
|
1049
|
+
reg2 = new RegExp('"', 'g');
|
1038
1050
|
return this.execCommand(id, 'set_file_edited_mode("'+ file_id.replace(reg1, '\\\\').replace(reg2, '\\"') +'", '+ to +')');
|
1039
1051
|
},
|
1040
1052
|
|
@@ -1066,5 +1078,5 @@ EditAreaLoader.prototype ={
|
|
1066
1078
|
};
|
1067
1079
|
|
1068
1080
|
var editAreaLoader= new EditAreaLoader();
|
1069
|
-
var editAreas=
|
1081
|
+
var editAreas= {};
|
1070
1082
|
|