Code Snippets - Version 1.4

Version Description

  • Added interface to Network Dashboard
  • Updated uninstall to support multisite
  • Replaced EditArea with CodeMirror
  • Small improvements
Download this release

Release Info

Developer bungeshea
Plugin Icon Code Snippets
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

Files changed (146) hide show
  1. code-snippets.php +224 -88
  2. css/codemirror.css +169 -0
  3. css/dialog.css +27 -0
  4. css/style.css +54 -38
  5. includes/admin-manage.php +0 -83
  6. includes/{admin-import.php → admin/admin-import.php} +0 -0
  7. includes/admin/admin-manage.php +91 -0
  8. includes/{admin-edit.php → admin/admin-single.php} +13 -8
  9. includes/edit_area/autocompletion.js +0 -491
  10. includes/edit_area/edit_area.css +0 -530
  11. includes/edit_area/edit_area.js +0 -527
  12. includes/edit_area/edit_area_compressor.php +0 -428
  13. includes/edit_area/edit_area_full.gz +0 -0
  14. includes/edit_area/edit_area_full.js +0 -38
  15. includes/edit_area/edit_area_functions.js +0 -1202
  16. includes/edit_area/edit_area_loader.js +0 -1081
  17. includes/edit_area/elements_functions.js +0 -336
  18. includes/edit_area/highlight.js +0 -407
  19. includes/edit_area/images/autocompletion.gif +0 -0
  20. includes/edit_area/images/close.gif +0 -0
  21. includes/edit_area/images/fullscreen.gif +0 -0
  22. includes/edit_area/images/go_to_line.gif +0 -0
  23. includes/edit_area/images/help.gif +0 -0
  24. includes/edit_area/images/highlight.gif +0 -0
  25. includes/edit_area/images/load.gif +0 -0
  26. includes/edit_area/images/move.gif +0 -0
  27. includes/edit_area/images/newdocument.gif +0 -0
  28. includes/edit_area/images/opacity.png +0 -0
  29. includes/edit_area/images/processing.gif +0 -0
  30. includes/edit_area/images/redo.gif +0 -0
  31. includes/edit_area/images/reset_highlight.gif +0 -0
  32. includes/edit_area/images/save.gif +0 -0
  33. includes/edit_area/images/search.gif +0 -0
  34. includes/edit_area/images/smooth_selection.gif +0 -0
  35. includes/edit_area/images/spacer.gif +0 -0
  36. includes/edit_area/images/statusbar_resize.gif +0 -0
  37. includes/edit_area/images/undo.gif +0 -0
  38. includes/edit_area/images/word_wrap.gif +0 -0
  39. includes/edit_area/keyboard.js +0 -145
  40. includes/edit_area/langs/bg.js +0 -54
  41. includes/edit_area/langs/cs.js +0 -48
  42. includes/edit_area/langs/de.js +0 -48
  43. includes/edit_area/langs/dk.js +0 -48
  44. includes/edit_area/langs/en.js +0 -48
  45. includes/edit_area/langs/eo.js +0 -48
  46. includes/edit_area/langs/es.js +0 -48
  47. includes/edit_area/langs/fi.js +0 -48
  48. includes/edit_area/langs/fr.js +0 -48
  49. includes/edit_area/langs/hr.js +0 -48
  50. includes/edit_area/langs/it.js +0 -48
  51. includes/edit_area/langs/ja.js +0 -48
  52. includes/edit_area/langs/mk.js +0 -48
  53. includes/edit_area/langs/nl.js +0 -48
  54. includes/edit_area/langs/pl.js +0 -48
  55. includes/edit_area/langs/pt.js +0 -48
  56. includes/edit_area/langs/ru.js +0 -48
  57. includes/edit_area/langs/sk.js +0 -48
  58. includes/edit_area/langs/zh.js +0 -48
  59. includes/edit_area/license_apache.txt +0 -7
  60. includes/edit_area/license_bsd.txt +0 -10
  61. includes/edit_area/license_lgpl.txt +0 -458
  62. includes/edit_area/manage_area.js +0 -623
  63. includes/edit_area/plugins/charmap/charmap.js +0 -90
  64. includes/edit_area/plugins/charmap/css/charmap.css +0 -64
  65. includes/edit_area/plugins/charmap/images/charmap.gif +0 -0
  66. includes/edit_area/plugins/charmap/jscripts/map.js +0 -373
  67. includes/edit_area/plugins/charmap/langs/bg.js +0 -12
  68. includes/edit_area/plugins/charmap/langs/cs.js +0 -6
  69. includes/edit_area/plugins/charmap/langs/de.js +0 -6
  70. includes/edit_area/plugins/charmap/langs/dk.js +0 -6
  71. includes/edit_area/plugins/charmap/langs/en.js +0 -6
  72. includes/edit_area/plugins/charmap/langs/eo.js +0 -6
  73. includes/edit_area/plugins/charmap/langs/es.js +0 -6
  74. includes/edit_area/plugins/charmap/langs/fr.js +0 -6
  75. includes/edit_area/plugins/charmap/langs/hr.js +0 -6
  76. includes/edit_area/plugins/charmap/langs/it.js +0 -6
  77. includes/edit_area/plugins/charmap/langs/ja.js +0 -6
  78. includes/edit_area/plugins/charmap/langs/mk.js +0 -6
  79. includes/edit_area/plugins/charmap/langs/nl.js +0 -6
  80. includes/edit_area/plugins/charmap/langs/pl.js +0 -6
  81. includes/edit_area/plugins/charmap/langs/pt.js +0 -6
  82. includes/edit_area/plugins/charmap/langs/ru.js +0 -6
  83. includes/edit_area/plugins/charmap/langs/sk.js +0 -6
  84. includes/edit_area/plugins/charmap/langs/zh.js +0 -6
  85. includes/edit_area/plugins/charmap/popup.html +0 -24
  86. includes/edit_area/plugins/test/css/test.css +0 -3
  87. includes/edit_area/plugins/test/images/Thumbs.db +0 -0
  88. includes/edit_area/plugins/test/images/test.gif +0 -0
  89. includes/edit_area/plugins/test/langs/bg.js +0 -10
  90. includes/edit_area/plugins/test/langs/cs.js +0 -4
  91. includes/edit_area/plugins/test/langs/de.js +0 -4
  92. includes/edit_area/plugins/test/langs/dk.js +0 -4
  93. includes/edit_area/plugins/test/langs/en.js +0 -4
  94. includes/edit_area/plugins/test/langs/eo.js +0 -4
  95. includes/edit_area/plugins/test/langs/es.js +0 -4
  96. includes/edit_area/plugins/test/langs/fr.js +0 -4
  97. includes/edit_area/plugins/test/langs/hr.js +0 -4
  98. includes/edit_area/plugins/test/langs/it.js +0 -4
  99. includes/edit_area/plugins/test/langs/ja.js +0 -4
  100. includes/edit_area/plugins/test/langs/mk.js +0 -4
  101. includes/edit_area/plugins/test/langs/nl.js +0 -4
  102. includes/edit_area/plugins/test/langs/pl.js +0 -4
  103. includes/edit_area/plugins/test/langs/pt.js +0 -4
  104. includes/edit_area/plugins/test/langs/ru.js +0 -4
  105. includes/edit_area/plugins/test/langs/sk.js +0 -4
  106. includes/edit_area/plugins/test/langs/zh.js +0 -4
  107. includes/edit_area/plugins/test/test.js +0 -110
  108. includes/edit_area/plugins/test/test2.js +0 -1
  109. includes/edit_area/reg_syntax.js +0 -166
  110. includes/edit_area/reg_syntax/basic.js +0 -70
  111. includes/edit_area/reg_syntax/brainfuck.js +0 -45
  112. includes/edit_area/reg_syntax/c.js +0 -63
  113. includes/edit_area/reg_syntax/coldfusion.js +0 -120
  114. includes/edit_area/reg_syntax/cpp.js +0 -66
  115. includes/edit_area/reg_syntax/css.js +0 -85
  116. includes/edit_area/reg_syntax/html.js +0 -51
  117. includes/edit_area/reg_syntax/java.js +0 -57
  118. includes/edit_area/reg_syntax/js.js +0 -94
  119. includes/edit_area/reg_syntax/pas.js +0 -83
  120. includes/edit_area/reg_syntax/perl.js +0 -88
  121. includes/edit_area/reg_syntax/php.js +0 -157
  122. includes/edit_area/reg_syntax/python.js +0 -145
  123. includes/edit_area/reg_syntax/robotstxt.js +0 -25
  124. includes/edit_area/reg_syntax/ruby.js +0 -68
  125. includes/edit_area/reg_syntax/sql.js +0 -56
  126. includes/edit_area/reg_syntax/tsql.js +0 -88
  127. includes/edit_area/reg_syntax/vb.js +0 -53
  128. includes/edit_area/reg_syntax/xml.js +0 -57
  129. includes/edit_area/regexp.js +0 -139
  130. includes/edit_area/resize_area.js +0 -73
  131. includes/edit_area/search_replace.js +0 -174
  132. includes/edit_area/template.html +0 -100
  133. includes/export.php +0 -1
  134. includes/help/admin-import-help.php +4 -2
  135. includes/help/admin-manage-help.php +11 -8
  136. includes/help/{admin-edit-help.php → admin-single-help.php} +6 -4
  137. js/clike.js +280 -0
  138. js/codemirror.js +3231 -0
  139. js/css.js +124 -0
  140. js/dialog.js +67 -0
  141. js/javascript.js +361 -0
  142. js/php.js +150 -0
  143. js/search.js +118 -0
  144. js/searchcursor.js +117 -0
  145. js/xml.js +326 -0
  146. readme.txt +50 -20
code-snippets.php CHANGED
@@ -1,75 +1,81 @@
1
  <?php
2
  /*
3
- Plugin Name: Code Snippets
4
- Plugin URI: http://bungeshea.wordpress.com/plugins/code-snippets/
5
- Description: Provides an easy-to-manage GUI interface for adding code snippets to your blog.
6
- Author: Shea Bunge
7
- Version: 1.3
8
- Author URI: http://bungeshea.wordpress.com/
9
- License: GPLv3 or later
 
10
 
11
  Code Snippets - WordPress Plugin
12
- Copyright (C) 2012 Shea Bunge
13
 
14
- This program is free software: you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License as published by
16
- the Free Software Foundation, either version 3 of the License, or
17
- (at your option) any later version.
18
 
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
 
24
- You should have received a copy of the GNU General Public License
25
- along with this program. If not, see <http://www.gnu.org/licenses/>.
26
  */
27
 
28
  // Exit if accessed directly
29
- if ( !defined( 'ABSPATH' ) ) exit;
30
 
31
- if( !class_exists('Code_Snippets') ) :
32
 
33
- class Code_Snippets {
34
 
35
  public $table = 'snippets';
36
- public $version = '1.3';
37
-
38
- public $file;
39
- public $plugin_dir;
40
- public $plugin_url;
41
- public $basename;
42
-
43
- var $admin_manage_url = 'snippets';
44
- var $admin_edit_url = 'snippet';
45
- var $admin_import_url = 'import-snippets';
46
 
47
  public function Code_Snippets() {
48
- $this->setup(); // initialise the varables and run the hooks
49
  $this->create_table(); // create the snippet tables if they do not exist
50
  $this->upgrade(); // check if we need to change some stuff
 
 
 
 
51
  $this->run_snippets(); // execute the snippets
52
  }
53
 
54
  function setup() {
55
  global $wpdb;
56
- $this->file = __FILE__;
57
- $this->table = apply_filters( 'cs_table', $wpdb->prefix . $this->table );
58
- $this->current_version = get_option( 'cs_db_version' );
 
59
 
60
- $this->basename = plugin_basename( $this->file );
61
- $this->plugin_dir = plugin_dir_path( $this->file );
62
- $this->plugin_url = plugin_dir_url ( $this->file );
 
 
 
 
63
 
64
  add_action( 'admin_menu', array( $this, 'add_admin_menus' ) );
 
65
  add_filter( 'plugin_action_links_' . $this->basename, array( $this, 'settings_link' ) );
66
  add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 );
67
  }
68
 
69
- function create_table() {
 
70
  global $wpdb;
71
- if( $wpdb->get_var( "SHOW TABLES LIKE '$this->table'" ) != $this->table ) {
72
- $sql = 'CREATE TABLE ' . $this->table . ' (
73
  id mediumint(9) NOT NULL AUTO_INCREMENT,
74
  name varchar(36) NOT NULL,
75
  description text NOT NULL,
@@ -94,67 +100,151 @@ class Code_Snippets {
94
 
95
  function add_admin_menus() {
96
  $this->admin_manage_page = add_menu_page( __('Snippets'), __('Snippets'), 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage' ), $this->plugin_url . 'images/icon16.png', 67 );
97
- add_submenu_page('snippets', __('Snippets'), __('Manage Snippets') , 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage_loader') );
98
- $this->admin_edit_page = add_submenu_page( 'snippets', __('Add New Snippet'), __('Add New'), 'install_plugins', $this->admin_edit_url, array( $this, 'admin_edit' ) );
99
  $this->admin_import_page = add_submenu_page( 'snippets', __('Import Snippets'), __('Import'), 'install_plugins', $this->admin_import_url, array( $this, 'admin_import' ) );
100
-
101
  $this->admin_manage_url = admin_url( 'admin.php?page=' . $this->admin_manage_url );
102
- $this->admin_edit_url = admin_url( 'admin.php?page=' . $this->admin_edit_url );
103
  $this->admin_import_url = admin_url( 'admin.php?page=' . $this->admin_import_url );
104
 
105
- add_action( "admin_print_styles-$this->admin_manage_page", array( $this, 'load_stylesheet' ), 5 );
106
- add_action( "admin_print_styles-$this->admin_edit_page", array( $this, 'load_stylesheet' ), 5 );
107
- add_action( "admin_print_styles-$this->admin_import_page", array( $this, 'load_stylesheet' ), 5 );
108
- add_action( "admin_print_scripts-$this->admin_edit_page", array( $this, 'load_editarea' ), 5 );
109
- add_action( "load-$this->admin_manage_page", array( $this, 'admin_manage_loader' ), 5 );
110
- add_action( "load-$this->admin_edit_page", array( $this, 'admin_edit_loader' ), 5 );
111
- add_action( "load-$this->admin_import_page", array( $this, 'admin_import_loader' ), 5 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
 
114
  function load_stylesheet() {
115
  wp_enqueue_style( 'code-snippets', plugins_url( 'css/style.css', $this->file ), false, $this->version );
116
  }
117
-
118
- function load_editarea() {
119
- wp_register_script( 'editarea', plugins_url( 'includes/edit_area/edit_area_full.js', $this->file ), false, '0.8.2' );
120
- wp_enqueue_script( 'editarea' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
 
123
  function admin_manage_loader() {
124
 
125
  require_once $this->plugin_dir . 'includes/export.php';
126
 
127
- if( isset( $_POST['action'] ) && isset( $_POST['ids'] ) )
128
  if( $_POST['action'] == 'export' && is_array( $_POST['ids'] ) )
129
  cs_export( $_POST['ids'], $this->table );
130
 
131
- if( isset( $_POST['action2'] ) && isset( $_POST['ids'] ) )
132
  if( $_POST['action2'] == 'export' && is_array( $_POST['ids'] ) )
133
  cs_export( $_POST['ids'], $this->table );
134
 
135
- if( isset( $_GET['action'] ) && isset( $_GET['id'] ) )
136
  if( $_GET['action'] == 'export' )
137
  cs_export( $_GET['id'], $this->table );
138
 
139
- require_once $this->plugin_dir . 'includes/help/admin-manage-help.php';
140
  }
141
 
142
- function admin_edit_title( $title ) {
 
 
 
 
 
143
  return str_ireplace( 'Add New Snippet', 'Edit Snippet', $title );
144
  }
145
 
146
- function admin_edit_loader() {
 
 
 
 
 
 
 
147
 
148
  if( isset( $_GET['action'] ) && @$_GET['action'] == 'edit' )
149
- add_filter( 'admin_title', array( $this, 'admin_edit_title' ) );
150
 
151
- require_once $this->plugin_dir . 'includes/help/admin-edit-help.php';
152
  }
153
 
 
 
 
 
 
154
  function admin_import_loader() {
155
- require_once $this->plugin_dir . 'includes/help/admin-import-help.php';
156
  }
157
 
 
 
 
 
 
 
 
 
158
  function bulk_action( $action, $ids ) {
159
  if( ! isset( $action ) && ! isset( $ids ) && ! is_array( $ids ) )
160
  return false;
@@ -188,6 +278,13 @@ class Code_Snippets {
188
  }
189
  }
190
 
 
 
 
 
 
 
 
191
  function admin_manage() {
192
  global $wpdb;
193
 
@@ -209,22 +306,26 @@ class Code_Snippets {
209
  }
210
  }
211
 
212
- require_once $this->plugin_dir . 'includes/admin-manage.php';
213
- }
214
 
215
- function admin_edit() {
 
 
 
 
 
 
 
216
  global $wpdb;
217
- if( isset( $_POST['save_snippet'] ) ) {
218
  $name = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_name' ] ) );
219
  $description = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_description'] ) );
220
  $code = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_code'] ) );
221
 
222
  if( strlen( $name ) && strlen( $code ) ) {
223
  if( isset( $_POST['edit_id'] ) ) {
224
- $wpdb->query( "update $this->table set name='".$name."',
225
- description='".$description."',
226
- code='".$code."'
227
- where id=" . intval($_POST["edit_id"]." limit 1"));
228
  $msg = 'Snippet updated.';
229
  }
230
  else {
@@ -235,10 +336,17 @@ class Code_Snippets {
235
  else {
236
  $msg = 'Please provide a name for the snippet and the code.';
237
  }
238
- }
239
- require_once $this->plugin_dir . 'includes/admin-edit.php';
240
  }
241
-
 
 
 
 
 
 
 
242
  function admin_import() {
243
  if( file_exists( $_FILES['cs_import_file']['tmp_name'] ) ) {
244
  global $wpdb;
@@ -249,8 +357,8 @@ class Code_Snippets {
249
 
250
  $msg = 'Imported ' . $xml->count() . ' snippets';
251
  }
252
- require_once( $this->plugin_dir . 'includes/admin-import.php');
253
- }
254
 
255
  function settings_link( $links ) {
256
  array_unshift( $links, '<a href="' . $this->admin_manage_url . '" title="Manage your existing snippets">' . __('Manage') . '</a>' );
@@ -260,22 +368,34 @@ class Code_Snippets {
260
  function plugin_meta( $links, $file ) {
261
  if ( $file == $this->basename ) {
262
  return array_merge( $links, array(
263
- '<a href="http://wordpress.org/support/plugin/code-snippets/" title="Visit the WordPress.org plugin page">' . __( 'About' ) . '</a>',
264
- '<a href="http://wordpress.org/support/plugin/code-snippets/" title="Visit the support forums">' . __( 'Support' ) . '</a>'
 
265
  ) );
266
  }
267
  return $links;
268
  }
269
-
270
- function run_snippets() {
 
 
 
 
 
 
 
271
  if( defined( 'CS_SAFE_MODE' ) ) if( CS_SAFE_MODE ) return;
 
272
  global $wpdb;
273
  // grab the active snippets from the database
274
- $active_snippets = $wpdb->get_results( 'select * FROM `' . $this->table . '` WHERE `active` = 1;' );
275
  if( count( $active_snippets ) ) {
276
  foreach( $active_snippets as $snippet ) {
277
  // execute the php code
278
- $result = @eval( htmlspecialchars_decode( stripslashes( $snippet->code ) ) );
 
 
 
279
  }
280
  }
281
  }
@@ -286,10 +406,26 @@ endif; // class exists check
286
  global $cs;
287
  $cs = new Code_Snippets;
288
 
289
- register_uninstall_hook( __FILE__, 'cs_uninstall' );
290
 
291
  function cs_uninstall() {
292
  global $wpdb, $cs;
293
- $wpdb->query( "DROP TABLE IF EXISTS `$cs->table`" );
294
- delete_option( 'cs_db_version' );
295
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /*
3
+ Plugin Name: Code Snippets
4
+ Plugin URI: http://cs.bungeshea.com
5
+ Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
6
+ Author: Shea Bunge
7
+ Author URI: http://bungeshea.com
8
+ Version: 1.4
9
+ License: GPLv3 or later
10
+ Network: true
11
 
12
  Code Snippets - WordPress Plugin
13
+ Copyright (C) 2012 Shea Bunge
14
 
15
+ This program is free software: you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation, either version 3 of the License, or
18
+ (at your option) any later version.
19
 
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
 
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
27
  */
28
 
29
  // Exit if accessed directly
30
+ if ( ! defined( 'ABSPATH' ) ) exit;
31
 
32
+ if( ! class_exists( 'Code_Snippets' ) ) :
33
 
34
+ final class Code_Snippets {
35
 
36
  public $table = 'snippets';
37
+ public $ms_table = 'ms_snippets';
38
+ public $version = '1.4';
39
+ public $admin_manage_url, $admin_single_url, $admin_import_url;
40
+ public $admin_manage_page, $admin_single_page, $admin_import_page;
 
 
 
 
 
 
41
 
42
  public function Code_Snippets() {
43
+ $this->setup(); // initialise the variables and run the hooks
44
  $this->create_table(); // create the snippet tables if they do not exist
45
  $this->upgrade(); // check if we need to change some stuff
46
+ if( is_multisite() ) { // perform multisite-specific actions
47
+ $this->create_table( $this->ms_table );
48
+ $this->run_snippets( $this->ms_table );
49
+ }
50
  $this->run_snippets(); // execute the snippets
51
  }
52
 
53
  function setup() {
54
  global $wpdb;
55
+ $this->file = __FILE__;
56
+ $this->table = apply_filters( 'cs_table', $wpdb->prefix . $this->table );
57
+ $this->ms_table = apply_filters( 'cs_ms_table', $wpdb->base_prefix . $this->ms_table );
58
+ $this->current_version = get_option( 'cs_db_version' );
59
 
60
+ $this->basename = plugin_basename( $this->file );
61
+ $this->plugin_dir = plugin_dir_path( $this->file );
62
+ $this->plugin_url = plugin_dir_url ( $this->file );
63
+
64
+ $this->admin_manage_url = apply_filters( 'cs_manage_url', 'snippets' );
65
+ $this->admin_single_url = apply_filters( 'cs_single_url', 'snippet' );
66
+ $this->admin_import_url = apply_filters( 'cs_import_url', 'import-snippets' );
67
 
68
  add_action( 'admin_menu', array( $this, 'add_admin_menus' ) );
69
+ add_action( 'network_admin_menu', array( $this, 'add_network_admin_menus' ) );
70
  add_filter( 'plugin_action_links_' . $this->basename, array( $this, 'settings_link' ) );
71
  add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 );
72
  }
73
 
74
+ function create_table( $table = NULL ) {
75
+ if( ! isset( $table ) ) $table = $this->table;
76
  global $wpdb;
77
+ if( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) != $table ) {
78
+ $sql = 'CREATE TABLE ' . $table . ' (
79
  id mediumint(9) NOT NULL AUTO_INCREMENT,
80
  name varchar(36) NOT NULL,
81
  description text NOT NULL,
100
 
101
  function add_admin_menus() {
102
  $this->admin_manage_page = add_menu_page( __('Snippets'), __('Snippets'), 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage' ), $this->plugin_url . 'images/icon16.png', 67 );
103
+ add_submenu_page('snippets', __('Snippets'), __('Manage Snippets') , 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage') );
104
+ $this->admin_single_page = add_submenu_page( 'snippets', __('Add New Snippet'), __('Add New'), 'install_plugins', $this->admin_single_url, array( $this, 'admin_single' ) );
105
  $this->admin_import_page = add_submenu_page( 'snippets', __('Import Snippets'), __('Import'), 'install_plugins', $this->admin_import_url, array( $this, 'admin_import' ) );
106
+
107
  $this->admin_manage_url = admin_url( 'admin.php?page=' . $this->admin_manage_url );
108
+ $this->admin_single_url = admin_url( 'admin.php?page=' . $this->admin_single_url );
109
  $this->admin_import_url = admin_url( 'admin.php?page=' . $this->admin_import_url );
110
 
111
+ add_action( "admin_print_styles-$this->admin_single_page", array( $this, 'load_editor_styles' ) );
112
+ add_action( "admin_print_scripts-$this->admin_single_page", array( $this, 'load_editor_scripts' ) );
113
+
114
+ add_action( "admin_print_styles-$this->admin_manage_page", array( $this, 'load_stylesheet' ) );
115
+ add_action( "admin_print_styles-$this->admin_single_page", array( $this, 'load_stylesheet' ) );
116
+ add_action( "admin_print_styles-$this->admin_import_page", array( $this, 'load_stylesheet' ) );
117
+
118
+ add_action( "load-$this->admin_manage_page", array( $this, 'admin_manage_loader' ) );
119
+ add_action( "load-$this->admin_single_page", array( $this, 'admin_single_loader' ) );
120
+ add_action( "load-$this->admin_import_page", array( $this, 'admin_import_loader' ) );
121
+ }
122
+
123
+ function add_network_admin_menus() {
124
+ $this->table = $this->ms_table;
125
+
126
+ $this->admin_manage_page = add_menu_page( __('Snippets'), __('Snippets'), 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage' ), $this->plugin_url . 'images/icon16.png', 21 );
127
+ add_submenu_page('snippets', __('Snippets'), __('Manage Snippets') , 'install_plugins', $this->admin_manage_url, array( $this, 'admin_manage') );
128
+ $this->admin_single_page = add_submenu_page( 'snippets', __('Add New Snippet'), __('Add New'), 'install_plugins', $this->admin_single_url, array( $this, 'admin_single' ) );
129
+ $this->admin_import_page = add_submenu_page( 'snippets', __('Import Snippets'), __('Import'), 'install_plugins', $this->admin_import_url, array( $this, 'admin_import' ) );
130
+
131
+ $this->admin_manage_url = network_admin_url( 'admin.php?page=' . $this->admin_manage_url );
132
+ $this->admin_single_url = network_admin_url( 'admin.php?page=' . $this->admin_single_url );
133
+ $this->admin_import_url = network_admin_url( 'admin.php?page=' . $this->admin_import_url );
134
+
135
+ add_action( "admin_print_styles-$this->admin_single_page", array( $this, 'load_editor_styles' ) );
136
+ add_action( "admin_print_scripts-$this->admin_single_page", array( $this, 'load_editor_scripts' ) );
137
+
138
+ add_action( "admin_print_styles-$this->admin_manage_page", array( $this, 'load_stylesheet' ) );
139
+ add_action( "admin_print_styles-$this->admin_single_page", array( $this, 'load_stylesheet' ) );
140
+ add_action( "admin_print_styles-$this->admin_import_page", array( $this, 'load_stylesheet' ) );
141
+
142
+ add_action( "load-$this->admin_manage_page", array( $this, 'admin_manage_loader' ) );
143
+ add_action( "load-$this->admin_single_page", array( $this, 'admin_single_loader' ) );
144
+ add_action( "load-$this->admin_import_page", array( $this, 'admin_import_loader' ) );
145
  }
146
 
147
  function load_stylesheet() {
148
  wp_enqueue_style( 'code-snippets', plugins_url( 'css/style.css', $this->file ), false, $this->version );
149
  }
150
+
151
+ /**
152
+ * Registers and loads the code editor's scripts
153
+ *
154
+ * @since Code Snippets 1.4
155
+ *
156
+ * @uses wp_register_script()
157
+ */
158
+ function load_editor_scripts() {
159
+ $version = 2.32;
160
+ wp_register_script( 'codemirror', plugins_url( 'js/codemirror.js', $this->file ), false, $version );
161
+ wp_register_script( 'codemirror-php', plugins_url( 'js/php.js', $this->file ), array( 'codemirror' ), $version );
162
+ wp_register_script( 'codemirror-xml', plugins_url( 'js/xml.js', $this->file ), array( 'codemirror' ), $version );
163
+ wp_register_script( 'codemirror-js', plugins_url( 'js/javascript.js', $this->file ), array( 'codemirror' ), $version );
164
+ wp_register_script( 'codemirror-css', plugins_url( 'js/css.js', $this->file ), array( 'codemirror' ), $version );
165
+ wp_register_script( 'codemirror-clike', plugins_url( 'js/clike.js', $this->file ), array( 'codemirror' ), $version );
166
+
167
+ wp_register_script( 'codemirror-dialog.js', plugins_url( 'js/dialog.js', $this->file ), array( 'codemirror' ), $version );
168
+ wp_register_script( 'codemirror-searchcursor.js', plugins_url( 'js/searchcursor.js', $this->file ), array( 'codemirror-dialog.js' ), $version );
169
+ wp_register_script( 'codemirror-search.js', plugins_url( 'js/search.js', $this->file ), array( 'codemirror-searchcursor.js' ), $version );
170
+
171
+ wp_enqueue_script( array( 'codemirror-xml', 'codemirror-js', 'codemirror-css', 'codemirror-clike', 'codemirror-php', 'codemirror-search.js' ) );
172
+ }
173
+
174
+ /**
175
+ * Registers and loads the code editor's styles
176
+ *
177
+ * @since Code Snippets 1.4
178
+ *
179
+ * @uses wp_register_style()
180
+ */
181
+ function load_editor_styles() {
182
+ $version = 2.32;
183
+ wp_register_style( 'codemirror', plugins_url( 'css/codemirror.css', $this->file ), false, $version );
184
+ wp_enqueue_style( 'codemirror-dialog', plugins_url( 'css/dialog.css', $this->file ), array( 'codemirror' ), $version );
185
+ wp_enqueue_style( 'codemirror', 'codemirror-dialog' );
186
  }
187
 
188
  function admin_manage_loader() {
189
 
190
  require_once $this->plugin_dir . 'includes/export.php';
191
 
192
+ if( isset( $_POST['action'], $_POST['ids'] ) )
193
  if( $_POST['action'] == 'export' && is_array( $_POST['ids'] ) )
194
  cs_export( $_POST['ids'], $this->table );
195
 
196
+ if( isset( $_POST['action2'], $_POST['ids'] ) )
197
  if( $_POST['action2'] == 'export' && is_array( $_POST['ids'] ) )
198
  cs_export( $_POST['ids'], $this->table );
199
 
200
+ if( isset( $_GET['action'], $_GET['id'] ) )
201
  if( $_GET['action'] == 'export' )
202
  cs_export( $_GET['id'], $this->table );
203
 
204
+ include $this->plugin_dir . 'includes/help/admin-manage-help.php';
205
  }
206
 
207
+ /**
208
+ * Replaces the text 'Add New Snippet' with 'Edit Snippet'
209
+ *
210
+ * @since Code Snippets 1.1
211
+ */
212
+ function admin_single_title( $title ) {
213
  return str_ireplace( 'Add New Snippet', 'Edit Snippet', $title );
214
  }
215
 
216
+ /**
217
+ * Loads the help tabs for the Edit Snippets page
218
+ *
219
+ * @since Code Snippets 1.0
220
+ *
221
+ * @uses admin_single_title() To change the page title when editing a snippet
222
+ */
223
+ function admin_single_loader() {
224
 
225
  if( isset( $_GET['action'] ) && @$_GET['action'] == 'edit' )
226
+ add_filter( 'admin_title', array( $this, 'admin_single_title' ) );
227
 
228
+ include $this->plugin_dir . 'includes/help/admin-single-help.php';
229
  }
230
 
231
+ /**
232
+ * Loads the help tabs for the Import Snippets page
233
+ *
234
+ * @since Code Snippets 1.3
235
+ */
236
  function admin_import_loader() {
237
+ include $this->plugin_dir . 'includes/help/admin-import-help.php';
238
  }
239
 
240
+ /**
241
+ * Processes a bulk action
242
+ *
243
+ * @since Code Snippets 1.0
244
+ *
245
+ * @uses $wpdb To preform activate, deactivate and delete snippets
246
+ * @uses $wpdb To preform activate, deactivate and delete snippets
247
+ */
248
  function bulk_action( $action, $ids ) {
249
  if( ! isset( $action ) && ! isset( $ids ) && ! is_array( $ids ) )
250
  return false;
278
  }
279
  }
280
 
281
+ /**
282
+ * Processes any action command and displays the Manage Snippets page
283
+ *
284
+ * @since Code Snippets 1.0
285
+ *
286
+ * @uses $wpdb To activate, deactivate and delete snippets
287
+ */
288
  function admin_manage() {
289
  global $wpdb;
290
 
306
  }
307
  }
308
 
309
+ require $this->plugin_dir . 'includes/admin/admin-manage.php';
310
+ }
311
 
312
+ /**
313
+ * Saves a posted snippet to the database and displays the Edit Snippets page
314
+ *
315
+ * @since Code Snippets 1.0
316
+ *
317
+ * @uses $wpdb To save te posted snippet to the database
318
+ */
319
+ function admin_single() {
320
  global $wpdb;
321
+ if( isset( $_POST['save_snippet'] ) ) :
322
  $name = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_name' ] ) );
323
  $description = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_description'] ) );
324
  $code = mysql_real_escape_string( htmlspecialchars( $_POST['snippet_code'] ) );
325
 
326
  if( strlen( $name ) && strlen( $code ) ) {
327
  if( isset( $_POST['edit_id'] ) ) {
328
+ $wpdb->query( "update $this->table set name='$name', description='$description', code='$code' where id=" . intval( $_POST['edit_id'] ) . " limit 1" );
 
 
 
329
  $msg = 'Snippet updated.';
330
  }
331
  else {
336
  else {
337
  $msg = 'Please provide a name for the snippet and the code.';
338
  }
339
+ endif;
340
+ require $this->plugin_dir . 'includes/admin/admin-single.php';
341
  }
342
+
343
+ /**
344
+ * Processes import files and displays the Import Snippets page
345
+ *
346
+ * @since Code Snippets 1.0
347
+ *
348
+ * @uses $wpdb To add the imported snippets to the database
349
+ */
350
  function admin_import() {
351
  if( file_exists( $_FILES['cs_import_file']['tmp_name'] ) ) {
352
  global $wpdb;
357
 
358
  $msg = 'Imported ' . $xml->count() . ' snippets';
359
  }
360
+ require $this->plugin_dir . 'includes/admin/admin-import.php';
361
+ }
362
 
363
  function settings_link( $links ) {
364
  array_unshift( $links, '<a href="' . $this->admin_manage_url . '" title="Manage your existing snippets">' . __('Manage') . '</a>' );
368
  function plugin_meta( $links, $file ) {
369
  if ( $file == $this->basename ) {
370
  return array_merge( $links, array(
371
+ '<a href="http://wordpress.org/extend/plugins/code-snippets/" title="Visit the WordPress.org plugin page">' . __( 'About' ) . '</a>',
372
+ '<a href="http://wordpress.org/support/plugin/code-snippets/" title="Visit the support forums">' . __( 'Support' ) . '</a>',
373
+ '<a href="http://cs.bungeshea.com/donate/" title="Support this plugin\'s development">' . __( 'Donate' ) . '</a>'
374
  ) );
375
  }
376
  return $links;
377
  }
378
+
379
+ /**
380
+ * Run the active snippets
381
+ *
382
+ * @since Code Snippets 1.0
383
+ *
384
+ * @uses $wpdb To grab the active snippets from the database
385
+ */
386
+ function run_snippets( $table = NULL ) {
387
  if( defined( 'CS_SAFE_MODE' ) ) if( CS_SAFE_MODE ) return;
388
+ if( ! isset( $table ) ) $table = $this->table;
389
  global $wpdb;
390
  // grab the active snippets from the database
391
+ $active_snippets = $wpdb->get_results( 'select * FROM `' . $table . '` WHERE `active` = 1;' );
392
  if( count( $active_snippets ) ) {
393
  foreach( $active_snippets as $snippet ) {
394
  // execute the php code
395
+ if( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'CS_DEBUG' ) && CS_DEBUG ) )
396
+ $result = eval( htmlspecialchars_decode( stripslashes( $snippet->code ) ) );
397
+ else
398
+ $result = @eval( htmlspecialchars_decode( stripslashes( $snippet->code ) ) );
399
  }
400
  }
401
  }
406
  global $cs;
407
  $cs = new Code_Snippets;
408
 
409
+ register_uninstall_hook( $cs->file, 'cs_uninstall' );
410
 
411
  function cs_uninstall() {
412
  global $wpdb, $cs;
413
+ if( is_multisite() ) {
414
+ $blogs = $wpdb->get_results( "SELECT blog_id FROM `$wpdb->blogs`", ARRAY_A );
415
+ if( $blogs ) {
416
+ foreach( $blogs as $blog ) {
417
+ switch_to_blog( $blog['blog_id'] );
418
+ $table = apply_filters( 'cs_table', $wpdb->prefix . 'snippets' );
419
+ $wpdb->query( "DROP TABLE IF EXISTS `$table`" );
420
+ delete_option( 'cs_db_version' );
421
+ }
422
+ restore_current_blog();
423
+ }
424
+ $wpdb->query( "DROP TABLE IF EXISTS `$cs->ms_table`" );
425
+ } else {
426
+ $wpdb->query( "DROP TABLE IF EXISTS `$cs->table`" );
427
+ delete_option( 'cs_db_version' );
428
+ }
429
+ }
430
+
431
+ ?>
css/codemirror.css ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .CodeMirror {
2
+ line-height: 1em;
3
+ font-family: monospace;
4
+
5
+ /* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
6
+ position: relative;
7
+ /* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
8
+ overflow: hidden;
9
+ }
10
+
11
+ .CodeMirror-scroll {
12
+ overflow-x: auto;
13
+ overflow-y: hidden;
14
+ height: 300px;
15
+ /* This is needed to prevent an IE[67] bug where the scrolled content
16
+ is visible outside of the scrolling box. */
17
+ position: relative;
18
+ outline: none;
19
+ }
20
+
21
+ /* Vertical scrollbar */
22
+ .CodeMirror-scrollbar {
23
+ float: right;
24
+ overflow-x: hidden;
25
+ overflow-y: scroll;
26
+
27
+ /* This corrects for the 1px gap introduced to the left of the scrollbar
28
+ by the rule for .CodeMirror-scrollbar-inner. */
29
+ margin-left: -1px;
30
+ }
31
+ .CodeMirror-scrollbar-inner {
32
+ /* This needs to have a nonzero width in order for the scrollbar to appear
33
+ in Firefox and IE9. */
34
+ width: 1px;
35
+ }
36
+ .CodeMirror-scrollbar.cm-sb-overlap {
37
+ /* Ensure that the scrollbar appears in Lion, and that it overlaps the content
38
+ rather than sitting to the right of it. */
39
+ position: absolute;
40
+ z-index: 1;
41
+ float: none;
42
+ right: 0;
43
+ min-width: 12px;
44
+ }
45
+ .CodeMirror-scrollbar.cm-sb-nonoverlap {
46
+ min-width: 12px;
47
+ }
48
+ .CodeMirror-scrollbar.cm-sb-ie7 {
49
+ min-width: 18px;
50
+ }
51
+
52
+ .CodeMirror-gutter {
53
+ position: absolute; left: 0; top: 0;
54
+ z-index: 10;
55
+ background-color: #f7f7f7;
56
+ border-right: 1px solid #eee;
57
+ min-width: 2em;
58
+ height: 100%;
59
+ }
60
+ .CodeMirror-gutter-text {
61
+ color: #aaa;
62
+ text-align: right;
63
+ padding: .4em .2em .4em .4em;
64
+ white-space: pre !important;
65
+ cursor: default;
66
+ }
67
+ .CodeMirror-lines {
68
+ padding: .4em;
69
+ white-space: pre;
70
+ cursor: text;
71
+ }
72
+ .CodeMirror-lines * {
73
+ /* Necessary for throw-scrolling to decelerate properly on Safari. */
74
+ pointer-events: none;
75
+ }
76
+
77
+ .CodeMirror pre {
78
+ -moz-border-radius: 0;
79
+ -webkit-border-radius: 0;
80
+ -o-border-radius: 0;
81
+ border-radius: 0;
82
+ border-width: 0; margin: 0; padding: 0; background: transparent;
83
+ font-family: inherit;
84
+ font-size: inherit;
85
+ padding: 0; margin: 0;
86
+ white-space: pre;
87
+ word-wrap: normal;
88
+ line-height: inherit;
89
+ color: inherit;
90
+ }
91
+
92
+ .CodeMirror-wrap pre {
93
+ word-wrap: break-word;
94
+ white-space: pre-wrap;
95
+ word-break: normal;
96
+ }
97
+ .CodeMirror-wrap .CodeMirror-scroll {
98
+ overflow-x: hidden;
99
+ }
100
+
101
+ .CodeMirror textarea {
102
+ outline: none !important;
103
+ }
104
+
105
+ .CodeMirror pre.CodeMirror-cursor {
106
+ z-index: 10;
107
+ position: absolute;
108
+ visibility: hidden;
109
+ border-left: 1px solid black;
110
+ border-right: none;
111
+ width: 0;
112
+ }
113
+ .cm-keymap-fat-cursor pre.CodeMirror-cursor {
114
+ width: auto;
115
+ border: 0;
116
+ background: transparent;
117
+ background: rgba(0, 200, 0, .4);
118
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
119
+ }
120
+ /* Kludge to turn off filter in ie9+, which also accepts rgba */
121
+ .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
122
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
123
+ }
124
+ .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
125
+ .CodeMirror-focused pre.CodeMirror-cursor {
126
+ visibility: visible;
127
+ }
128
+
129
+ div.CodeMirror-selected { background: #d9d9d9; }
130
+ .CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
131
+
132
+ .CodeMirror-searching {
133
+ background: #ffa;
134
+ background: rgba(255, 255, 0, .4);
135
+ }
136
+
137
+ /* Default theme */
138
+
139
+ .cm-s-default span.cm-keyword {color: #708;}
140
+ .cm-s-default span.cm-atom {color: #219;}
141
+ .cm-s-default span.cm-number {color: #164;}
142
+ .cm-s-default span.cm-def {color: #00f;}
143
+ .cm-s-default span.cm-variable {color: black;}
144
+ .cm-s-default span.cm-variable-2 {color: #05a;}
145
+ .cm-s-default span.cm-variable-3 {color: #085;}
146
+ .cm-s-default span.cm-property {color: black;}
147
+ .cm-s-default span.cm-operator {color: black;}
148
+ .cm-s-default span.cm-comment {color: #a50;}
149
+ .cm-s-default span.cm-string {color: #a11;}
150
+ .cm-s-default span.cm-string-2 {color: #f50;}
151
+ .cm-s-default span.cm-meta {color: #555;}
152
+ .cm-s-default span.cm-error {color: #f00;}
153
+ .cm-s-default span.cm-qualifier {color: #555;}
154
+ .cm-s-default span.cm-builtin {color: #30a;}
155
+ .cm-s-default span.cm-bracket {color: #cc7;}
156
+ .cm-s-default span.cm-tag {color: #170;}
157
+ .cm-s-default span.cm-attribute {color: #00c;}
158
+ .cm-s-default span.cm-header {color: blue;}
159
+ .cm-s-default span.cm-quote {color: #090;}
160
+ .cm-s-default span.cm-hr {color: #999;}
161
+ .cm-s-default span.cm-link {color: #00c;}
162
+
163
+ span.cm-header, span.cm-strong {font-weight: bold;}
164
+ span.cm-em {font-style: italic;}
165
+ span.cm-emstrong {font-style: italic; font-weight: bold;}
166
+ span.cm-link {text-decoration: underline;}
167
+
168
+ div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
169
+ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
css/dialog.css ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .CodeMirror-dialog {
2
+ position: relative;
3
+ }
4
+
5
+ .CodeMirror-dialog > div {
6
+ position: absolute;
7
+ top: 0; left: 0; right: 0;
8
+ background: white;
9
+ border-bottom: 1px solid #eee;
10
+ z-index: 15;
11
+ padding: .1em .8em;
12
+ overflow: hidden;
13
+ color: #333;
14
+ }
15
+
16
+ .CodeMirror-dialog input {
17
+ border: none;
18
+ outline: none;
19
+ background: transparent;
20
+ width: 20em;
21
+ color: inherit;
22
+ font-family: monospace;
23
+ }
24
+
25
+ .CodeMirror-dialog button {
26
+ font-size: 70%;
27
+ }
css/style.css CHANGED
@@ -1,39 +1,55 @@
1
- #icon-snippets.icon32 {
2
- background: url('../images/icon32.png') no-repeat scroll transparent;
3
- }
4
-
5
- /* Snippets > Manage Snippets */
6
-
7
- .inactive a:hover {
8
- color: #d54e21;
9
- }
10
-
11
- a.delete:hover {
12
- color: #f00;
13
- border-bottom-color: #f00;
14
- }
15
-
16
- a.delete {
17
- color: #21759b;
18
- }
19
-
20
- tr {
21
- background-color: #fcfcfc;
22
- }
23
-
24
- .inactive,
25
- .inactive th,
26
- .inactive td {
27
- background-color: #f4f4f4;
28
- }
29
-
30
- .active,
31
- .active th,
32
- .active td {
33
- color: #000;
34
- }
35
-
36
- .inactive a {
37
- color: #557799;
38
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
1
+ #icon-snippets.icon32 {
2
+ background: url('../images/icon32.png') no-repeat scroll transparent;
3
+ }
4
+
5
+ /* Snippets > Manage Snippets */
6
+
7
+ .inactive a:hover {
8
+ color: #d54e21;
9
+ }
10
+
11
+ a.delete:hover {
12
+ color: #f00;
13
+ border-bottom-color: #f00;
14
+ }
15
+
16
+ a.delete {
17
+ color: #21759b;
18
+ }
19
+
20
+ tr {
21
+ background-color: #fcfcfc;
22
+ }
23
+
24
+ .inactive,
25
+ .inactive th,
26
+ .inactive td {
27
+ background-color: #f4f4f4;
28
+ }
29
+
30
+ .active,
31
+ .active th,
32
+ .active td {
33
+ color: #000;
34
+ }
35
+
36
+ .inactive a {
37
+ color: #557799;
38
+ }
39
+
40
+ /* Snippets > Add New */
41
+
42
+ .CodeMirror {
43
+ border: 1px solid #ccc;
44
+ -o-border-radius: 3px;
45
+ -moz-border-radius: 3px;
46
+ -webkit-border-radius: 3px;
47
+ border-radius: 3px;
48
+ }
49
+
50
+ .CodeMirror-scroll {
51
+ height: auto;
52
+ overflow-y: hidden;
53
+ overflow-x: auto;
54
+ min-height: 242px;
55
  }
includes/admin-manage.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
- if( !class_exists( 'Code_Snippets' ) ) exit;
3
- global $wpdb;
4
- ?>
5
- <div class="wrap">
6
- <div id="icon-snippets" class="icon32"><br /></div><h2>Snippets <a href="<?php echo $this->admin_edit_url; ?>" class="add-new-h2">Add New</a></h2>
7
- <?php if ( isset( $msg ) ) : ?>
8
- <div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
9
- <?php endif; ?>
10
- <?php $snippets = $wpdb->get_results( 'select * from ' . $this->table ); ?>
11
- <form action="" method="post">
12
- <div class="tablenav top">
13
- <div class="alignleft actions">
14
- <select name='action' class="bulk-actions">
15
- <option value='-1' selected='selected'>Bulk Actions</option>
16
- <option value='activate'>Activate</option>
17
- <option value='deactivate'>Deactivate</option>
18
- <option value='export'>Export</option>
19
- <option value='delete'>Delete</option>
20
- </select>
21
- <input type="submit" id="doaction" class="button-secondary" value="Apply" />
22
- </div>
23
- </div>
24
- <table class="widefat manage-snippets" style="margin-top: .5em">
25
- <thead>
26
- <tr>
27
- <th scope="col" class="check-column"><input type="checkbox" name="toggle" id="toggle" /></th>
28
- <th scope="col" id="name" style="min-width:180px">Name</th>
29
- <th scope="col" id="description">Description</th>
30
- </tr>
31
- </thead>
32
- <?php if( count( $snippets ) ): ?>
33
- <?php foreach( $snippets as $snippet ) : ?>
34
- <tr class='<?php
35
- if($snippet->active == false)
36
- echo 'inactive';
37
- else
38
- echo 'active';
39
- ?>'>
40
- <th scope="row" class="check-column"><input class="snippets" type="checkbox" name="ids[]" value="<?php echo $snippet->id; ?>" /></th>
41
- <td class="snippet-title"><strong><?php echo stripslashes( $snippet->name );?></strong>
42
- <div class="row-actions-visible">
43
- <?php if( $snippet->active == 0 ) : ?>
44
- <span class='activate'><a href="<?php echo $this->admin_manage_url . '&action=activate&id=' . $snippet->id; ?>" title="Activate this snippet" class="edit">Activate</a> | </span>
45
- <?php else : ?>
46
- <span class='deactivate'><a href="<?php echo $this->admin_manage_url . '&action=deactivate&id=' . $snippet->id; ?>" title="Deactivate this snippet" class="edit">Deactivate</a> | </span>
47
- <?php endif; ?>
48
- <span class='edit'><a href="<?php echo $this->admin_edit_url . '&action=edit&id=' . $snippet->id; ?>" title="Edit this snippet" class="edit">Edit</a> | </span>
49
- <span class='edit'><a href="<?php echo $this->admin_manage_url . '&action=export&id=' . $snippet->id; ?>" title="Export this snippet" class="edit">Export</a> | </span>
50
- <span class='delete'><a href="<?php echo $this->admin_manage_url . '&action=delete&id=' . $snippet->id; ?>" title="Delete this snippet" class="delete" onclick="return confirm('Are you sure? This action is non-reversable');">Delete</a></span>
51
- </div>
52
- </td>
53
- <td><?php echo stripslashes( html_entity_decode( $snippet->description ) ); ?></td>
54
- </tr>
55
- <?php endforeach; ?>
56
- <?php else: ?>
57
- <tr id='no-groups'>
58
- <th scope="row" class="check-column">&nbsp;</th>
59
- <td colspan="4">You do not appear to have any snippets available at this time. <a href="<?php echo $this->admin_edit_url; ?>">Add New&rarr;</a></td>
60
- </tr>
61
- <?php endif;?>
62
- <tfoot>
63
- <tr>
64
- <th scope="col" class="check-column"><input type="checkbox" name="toggle" id="toggle" /></th>
65
- <th scope="col" id="name" style="min-width:160px">Name</th>
66
- <th scope="col" id="description">Description</th>
67
- </tr>
68
- </tfoot>
69
- </table>
70
- <div class="tablenav bottom">
71
- <div class="alignleft actions">
72
- <select name='action2' class="bulk-actions">
73
- <option value='-1' selected='selected'>Bulk Actions</option>
74
- <option value='activate'>Activate</option>
75
- <option value='deactivate'>Dectivate</option>
76
- <option value='export'>Export</option>
77
- <option value='delete'>Delete</option>
78
- </select>
79
- <input type="submit" id="doaction2" class="button-secondary action" value="Apply" />
80
- </div>
81
- </div>
82
- </form>
83
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{admin-import.php → admin/admin-import.php} RENAMED
File without changes
includes/admin/admin-manage.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( ! class_exists( 'Code_Snippets' ) ) exit;
3
+ global $wpdb;
4
+ $screen = get_current_screen();
5
+ if( $screen->is_network ) {
6
+ $activate_label = __( 'Network Activate' );
7
+ $deactivate_label = __( 'Network Deactivate' );
8
+ $activate_title = __( 'Activate this snippet for all sites on the network' );
9
+ } else {
10
+ $activate_label = __( 'Activate' );
11
+ $deactivate_label = __( 'Deactivate' );
12
+ $activate_title = __( 'Activate this snippet' );
13
+ }
14
+ ?>
15
+ <div class="wrap">
16
+ <div id="icon-snippets" class="icon32"><br /></div><h2>Snippets <a href="<?php echo $this->admin_single_url; ?>&action=new" class="add-new-h2">Add New</a></h2>
17
+ <?php if ( defined( 'CS_SAFE_MODE' ) ) if( CS_SAFE_MODE ) : ?>
18
+ <div class="error"><p><strong>Warning:</strong> Safe mode is active and snippets will not execute! Remove the <code>CS_SAFE_MODE</code> constant from wp-config.php to turn off safe mode. <a href="http://cs.bungeshea.com/docs/safe-mode" target="_blank">More info&rarr;</a></p></div>
19
+ <?php endif; ?>
20
+ <?php if ( isset( $msg ) ) : ?>
21
+ <div id="message" class="updated fade"><p><?php echo $msg; ?></p></div>
22
+ <?php endif; ?>
23
+ <?php $snippets = $wpdb->get_results( 'select * from ' . $this->table ); ?>
24
+ <form action="" method="post">
25
+ <div class="tablenav top">
26
+ <div class="alignleft actions">
27
+ <select name="action" class="bulk-actions">
28
+ <option value="-1" selected="selected">Bulk Actions</option>
29
+ <option value="activate"><?php echo $activate_label; ?></option>
30
+ <option value="deactivate"><?php echo $deactivate_label; ?></option>
31
+ <option value="export">Export</option>
32
+ <option value="delete">Delete</option>
33
+ </select>
34
+ <input type="submit" id="doaction" class="button-secondary" value="Apply" />
35
+ </div>
36
+ </div>
37
+ <table class="widefat snippets" style="margin-top: .5em">
38
+ <thead>
39
+ <tr>
40
+ <th scope="col" class="check-column"><input type="checkbox" name="toggle" id="toggle" /></th>
41
+ <th scope="col" id="name" style="width:36ex">Name</th>
42
+ <th scope="col" id="description">Description</th>
43
+ </tr>
44
+ </thead>
45
+ <?php if( count( $snippets ) ) : ?>
46
+ <?php foreach( $snippets as $snippet ) : ?>
47
+ <tr class="<?php echo ( $snippet->active ? 'active' : 'inactive' ); ?>">
48
+ <th scope="row" class="check-column"><input class="snippets" type="checkbox" name="ids[]" value="<?php echo $snippet->id; ?>" /></th>
49
+ <td class="snippet-title"><strong><?php echo stripslashes( $snippet->name );?></strong>
50
+ <div class="row-actions-visible">
51
+ <?php if( $snippet->active == 0 ) : ?>
52
+ <span class="activate"><a href="<?php echo $this->admin_manage_url . '&action=activate&id=' . $snippet->id; ?>" title="<?php echo $activate_title; ?>" class="edit"><?php echo $activate_label; ?></a> | </span>
53
+ <?php else : ?>
54
+ <span class="deactivate"><a href="<?php echo $this->admin_manage_url . '&action=deactivate&id=' . $snippet->id; ?>" title="Deactivate this snippet" class="edit"><?php echo $deactivate_label; ?></a> | </span>
55
+ <?php endif; ?>
56
+ <span class="edit"><a href="<?php echo $this->admin_single_url . '&action=edit&id=' . $snippet->id; ?>" title="Edit this snippet" class="edit">Edit</a> | </span>
57
+ <span class="edit"><a href="<?php echo $this->admin_manage_url . '&action=export&id=' . $snippet->id; ?>" title="Export this snippet" class="edit">Export</a> | </span>
58
+ <span class="delete"><a href="<?php echo $this->admin_manage_url . '&action=delete&id=' . $snippet->id; ?>" title="Delete this snippet" class="delete" onclick="return confirm('Are you sure? This action is non-reversable');">Delete</a></span>
59
+ </div>
60
+ </td>
61
+ <td><?php echo stripslashes( html_entity_decode( $snippet->description ) ); ?></td>
62
+ </tr>
63
+ <?php endforeach; ?>
64
+ <?php else: ?>
65
+ <tr id="no-groups">
66
+ <th scope="row" class="check-column">&nbsp;</th>
67
+ <td colspan="4">You do not appear to have any snippets available at this time. <a href="<?php echo $this->admin_single_url; ?>&action=new">Add New&rarr;</a></td>
68
+ </tr>
69
+ <?php endif;?>
70
+ <tfoot>
71
+ <tr>
72
+ <th scope="col" class="check-column"><input type="checkbox" name="toggle" id="toggle" /></th>
73
+ <th scope="col" id="name" style="min-width:160px">Name</th>
74
+ <th scope="col" id="description">Description</th>
75
+ </tr>
76
+ </tfoot>
77
+ </table>
78
+ <div class="tablenav bottom">
79
+ <div class="alignleft actions">
80
+ <select name="action2" class="bulk-actions">
81
+ <option value="-1" selected="selected">Bulk Actions</option>
82
+ <option value="activate"><?php echo $activate_label; ?></option>
83
+ <option value="deactivate"><?php echo $deactivate_label; ?></option>
84
+ <option value="export">Export</option>
85
+ <option value="delete">Delete</option>
86
+ </select>
87
+ <input type="submit" id="doaction2" class="button-secondary action" value="Apply" />
88
+ </div>
89
+ </div>
90
+ </form>
91
+ </div>
includes/{admin-edit.php → admin/admin-single.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- if( !class_exists( 'Code_Snippets' ) ) exit;
3
  $edit = isset( $_GET['id'] ) && intval( @$_GET['id'] );
4
 
5
  if( $edit )
@@ -8,7 +8,7 @@ if( $edit )
8
  <div class="wrap">
9
  <div id="icon-snippets" class="icon32"><br /></div><h2><?php
10
  if( $edit ) :
11
- ?>Edit Snippet<a href="<?php echo $this->admin_edit_url; ?>" class="add-new-h2">Add New</a></h2><?php
12
  else:
13
  ?>Add New Snippet</h2>
14
  <?php endif; ?>
@@ -40,7 +40,7 @@ if( $edit )
40
 
41
  <label for="snippet_code"><h3 style="display:inline">Code</h3>
42
  <span style="float:right">Enter or paste the snippet code without the <code>&lt;?php</code> and <code>?&gt;</code> tags.</span></label><br />
43
- <textarea id="snippet_code" name="snippet_code" rows="20" spellcheck="false" style="font-family:monospace;width:100%"><?php echo stripslashes( $snippet->code ); ?></textarea>
44
  <br style="margin: 20px;" />
45
  <div id="desclabel">
46
  <label for="description" style="text-align:center; margin: 10px auto"><h3 style="display:inline">Description</h3> (Optional)</label><br />
@@ -53,9 +53,14 @@ if( $edit )
53
  </form>
54
  </div>
55
  <script type="text/javascript">
56
- editAreaLoader.init({
57
- id : "snippet_code"
58
- ,syntax: "php"
59
- ,start_highlight: true
60
- });
 
 
 
 
 
61
  </script>
1
  <?php
2
+ if( ! class_exists( 'Code_Snippets' ) ) exit;
3
  $edit = isset( $_GET['id'] ) && intval( @$_GET['id'] );
4
 
5
  if( $edit )
8
  <div class="wrap">
9
  <div id="icon-snippets" class="icon32"><br /></div><h2><?php
10
  if( $edit ) :
11
+ ?>Edit Snippet<a href="<?php echo $this->admin_single_url; ?>&action=new" class="add-new-h2">Add New</a></h2><?php
12
  else:
13
  ?>Add New Snippet</h2>
14
  <?php endif; ?>
40
 
41
  <label for="snippet_code"><h3 style="display:inline">Code</h3>
42
  <span style="float:right">Enter or paste the snippet code without the <code>&lt;?php</code> and <code>?&gt;</code> tags.</span></label><br />
43
+ <textarea id="snippet_code" name="snippet_code" spellcheck="false" style="font-family:monospace;width:100%"><?php echo stripslashes( $snippet->code ); ?></textarea>
44
  <br style="margin: 20px;" />
45
  <div id="desclabel">
46
  <label for="description" style="text-align:center; margin: 10px auto"><h3 style="display:inline">Description</h3> (Optional)</label><br />
53
  </form>
54
  </div>
55
  <script type="text/javascript">
56
+ var editor = CodeMirror.fromTextArea(document.getElementById("snippet_code"), {
57
+ mode: "application/x-httpd-php-open",
58
+ lineNumbers: true,
59
+ lineWrapping: true,
60
+ matchBrackets: true,
61
+ indentUnit: 4,
62
+ indentWithTabs: true,
63
+ enterMode: "keep",
64
+ tabMode: "shift"
65
+ });
66
  </script>
includes/edit_area/autocompletion.js DELETED
@@ -1,491 +0,0 @@
1
- /**
2
- * Autocompletion class
3
- *
4
- * An auto completion box appear while you're writing. It's possible to force it to appear with Ctrl+Space short cut
5
- *
6
- * Loaded as a plugin inside editArea (everything made here could have been made in the plugin directory)
7
- * But is definitly linked to syntax selection (no need to do 2 different files for color and auto complete for each syntax language)
8
- * and add a too important feature that many people would miss if included as a plugin
9
- *
10
- * - init param: autocompletion_start
11
- * - Button name: "autocompletion"
12
- */
13
-
14
- var EditArea_autocompletion= {
15
-
16
- /**
17
- * Get called once this file is loaded (editArea still not initialized)
18
- *
19
- * @return nothing
20
- */
21
- init: function(){
22
- // alert("test init: "+ this._someInternalFunction(2, 3));
23
-
24
- if(editArea.settings["autocompletion"])
25
- this.enabled= true;
26
- else
27
- this.enabled= false;
28
- this.current_word = false;
29
- this.shown = false;
30
- this.selectIndex = -1;
31
- this.forceDisplay = false;
32
- this.isInMiddleWord = false;
33
- this.autoSelectIfOneResult = false;
34
- this.delayBeforeDisplay = 100;
35
- this.checkDelayTimer = false;
36
- this.curr_syntax_str = '';
37
-
38
- this.file_syntax_datas = {};
39
- }
40
- /**
41
- * Returns the HTML code for a specific control string or false if this plugin doesn't have that control.
42
- * A control can be a button, select list or any other HTML item to present in the EditArea user interface.
43
- * Language variables such as {$lang_somekey} will also be replaced with contents from
44
- * the language packs.
45
- *
46
- * @param {string} ctrl_name: the name of the control to add
47
- * @return HTML code for a specific control or false.
48
- * @type string or boolean
49
- */
50
- /*,get_control_html: function(ctrl_name){
51
- switch( ctrl_name ){
52
- case 'autocompletion':
53
- // Control id, button img, command
54
- return parent.editAreaLoader.get_button_html('autocompletion_but', 'autocompletion.gif', 'toggle_autocompletion', false, this.baseURL);
55
- break;
56
- }
57
- return false;
58
- }*/
59
- /**
60
- * Get called once EditArea is fully loaded and initialised
61
- *
62
- * @return nothing
63
- */
64
- ,onload: function(){
65
- if(this.enabled)
66
- {
67
- var icon= document.getElementById("autocompletion");
68
- if(icon)
69
- editArea.switchClassSticky(icon, 'editAreaButtonSelected', true);
70
- }
71
-
72
- this.container = document.createElement('div');
73
- this.container.id = "auto_completion_area";
74
- editArea.container.insertBefore( this.container, editArea.container.firstChild );
75
-
76
- // add event detection for hiding suggestion box
77
- parent.editAreaLoader.add_event( document, "click", function(){ editArea.plugins['autocompletion']._hide();} );
78
- parent.editAreaLoader.add_event( editArea.textarea, "blur", function(){ editArea.plugins['autocompletion']._hide();} );
79
-
80
- }
81
-
82
- /**
83
- * Is called each time the user touch a keyboard key.
84
- *
85
- * @param (event) e: the keydown event
86
- * @return true - pass to next handler in chain, false - stop chain execution
87
- * @type boolean
88
- */
89
- ,onkeydown: function(e){
90
- if(!this.enabled)
91
- return true;
92
-
93
- if (EA_keys[e.keyCode])
94
- letter=EA_keys[e.keyCode];
95
- else
96
- letter=String.fromCharCode(e.keyCode);
97
- // shown
98
- if( this._isShown() )
99
- {
100
- // if escape, hide the box
101
- if(letter=="Esc")
102
- {
103
- this._hide();
104
- return false;
105
- }
106
- // Enter
107
- else if( letter=="Entrer")
108
- {
109
- var as = this.container.getElementsByTagName('A');
110
- // select a suggested entry
111
- if( this.selectIndex >= 0 && this.selectIndex < as.length )
112
- {
113
- as[ this.selectIndex ].onmousedown();
114
- return false
115
- }
116
- // simply add an enter in the code
117
- else
118
- {
119
- this._hide();
120
- return true;
121
- }
122
- }
123
- else if( letter=="Tab" || letter=="Down")
124
- {
125
- this._selectNext();
126
- return false;
127
- }
128
- else if( letter=="Up")
129
- {
130
- this._selectBefore();
131
- return false;
132
- }
133
- }
134
- // hidden
135
- else
136
- {
137
-
138
- }
139
-
140
- // show current suggestion list and do autoSelect if possible (no matter it's shown or hidden)
141
- if( letter=="Space" && CtrlPressed(e) )
142
- {
143
- //parent.console.log('SHOW SUGGEST');
144
- this.forceDisplay = true;
145
- this.autoSelectIfOneResult = true;
146
- this._checkLetter();
147
- return false;
148
- }
149
-
150
- // wait a short period for check that the cursor isn't moving
151
- setTimeout("editArea.plugins['autocompletion']._checkDelayAndCursorBeforeDisplay();", editArea.check_line_selection_timer +5 );
152
- this.checkDelayTimer = false;
153
- return true;
154
- }
155
- /**
156
- * Executes a specific command, this function handles plugin commands.
157
- *
158
- * @param {string} cmd: the name of the command being executed
159
- * @param {unknown} param: the parameter of the command
160
- * @return true - pass to next handler in chain, false - stop chain execution
161
- * @type boolean
162
- */
163
- ,execCommand: function(cmd, param){
164
- switch( cmd ){
165
- case 'toggle_autocompletion':
166
- var icon= document.getElementById("autocompletion");
167
- if(!this.enabled)
168
- {
169
- if(icon != null){
170
- editArea.restoreClass(icon);
171
- editArea.switchClassSticky(icon, 'editAreaButtonSelected', true);
172
- }
173
- this.enabled= true;
174
- }
175
- else
176
- {
177
- this.enabled= false;
178
- if(icon != null)
179
- editArea.switchClassSticky(icon, 'editAreaButtonNormal', false);
180
- }
181
- return true;
182
- }
183
- return true;
184
- }
185
- ,_checkDelayAndCursorBeforeDisplay: function()
186
- {
187
- this.checkDelayTimer = setTimeout("if(editArea.textarea.selectionStart == "+ editArea.textarea.selectionStart +") EditArea_autocompletion._checkLetter();", this.delayBeforeDisplay - editArea.check_line_selection_timer - 5 );
188
- }
189
- // hide the suggested box
190
- ,_hide: function(){
191
- this.container.style.display="none";
192
- this.selectIndex = -1;
193
- this.shown = false;
194
- this.forceDisplay = false;
195
- this.autoSelectIfOneResult = false;
196
- }
197
- // display the suggested box
198
- ,_show: function(){
199
- if( !this._isShown() )
200
- {
201
- this.container.style.display="block";
202
- this.selectIndex = -1;
203
- this.shown = true;
204
- }
205
- }
206
- // is the suggested box displayed?
207
- ,_isShown: function(){
208
- return this.shown;
209
- }
210
- // setter and getter
211
- ,_isInMiddleWord: function( new_value ){
212
- if( typeof( new_value ) == "undefined" )
213
- return this.isInMiddleWord;
214
- else
215
- this.isInMiddleWord = new_value;
216
- }
217
- // select the next element in the suggested box
218
- ,_selectNext: function()
219
- {
220
- var as = this.container.getElementsByTagName('A');
221
-
222
- // clean existing elements
223
- for( var i=0; i<as.length; i++ )
224
- {
225
- if( as[i].className )
226
- as[i].className = as[i].className.replace(/ focus/g, '');
227
- }
228
-
229
- this.selectIndex++;
230
- this.selectIndex = ( this.selectIndex >= as.length || this.selectIndex < 0 ) ? 0 : this.selectIndex;
231
- as[ this.selectIndex ].className += " focus";
232
- }
233
- // select the previous element in the suggested box
234
- ,_selectBefore: function()
235
- {
236
- var as = this.container.getElementsByTagName('A');
237
-
238
- // clean existing elements
239
- for( var i=0; i<as.length; i++ )
240
- {
241
- if( as[i].className )
242
- as[i].className = as[ i ].className.replace(/ focus/g, '');
243
- }
244
-
245
- this.selectIndex--;
246
-
247
- this.selectIndex = ( this.selectIndex >= as.length || this.selectIndex < 0 ) ? as.length-1 : this.selectIndex;
248
- as[ this.selectIndex ].className += " focus";
249
- }
250
- ,_select: function( content )
251
- {
252
- cursor_forced_position = content.indexOf( '{@}' );
253
- content = content.replace(/{@}/g, '' );
254
- editArea.getIESelection();
255
-
256
- // retrive the number of matching characters
257
- var start_index = Math.max( 0, editArea.textarea.selectionEnd - content.length );
258
-
259
- line_string = editArea.textarea.value.substring( start_index, editArea.textarea.selectionEnd + 1);
260
- limit = line_string.length -1;
261
- nbMatch = 0;
262
- for( i =0; i<limit ; i++ )
263
- {
264
- if( line_string.substring( limit - i - 1, limit ) == content.substring( 0, i + 1 ) )
265
- nbMatch = i + 1;
266
- }
267
- // if characters match, we should include them in the selection that will be replaced
268
- if( nbMatch > 0 )
269
- parent.editAreaLoader.setSelectionRange(editArea.id, editArea.textarea.selectionStart - nbMatch , editArea.textarea.selectionEnd);
270
-
271
- parent.editAreaLoader.setSelectedText(editArea.id, content );
272
- range= parent.editAreaLoader.getSelectionRange(editArea.id);
273
-
274
- if( cursor_forced_position != -1 )
275
- new_pos = range["end"] - ( content.length-cursor_forced_position );
276
- else
277
- new_pos = range["end"];
278
- parent.editAreaLoader.setSelectionRange(editArea.id, new_pos, new_pos);
279
- this._hide();
280
- }
281
-
282
-
283
- /**
284
- * Parse the AUTO_COMPLETION part of syntax definition files
285
- */
286
- ,_parseSyntaxAutoCompletionDatas: function(){
287
- //foreach syntax loaded
288
- for(var lang in parent.editAreaLoader.load_syntax)
289
- {
290
- if(!parent.editAreaLoader.syntax[lang]['autocompletion']) // init the regexp if not already initialized
291
- {
292
- parent.editAreaLoader.syntax[lang]['autocompletion']= {};
293
- // the file has auto completion datas
294
- if(parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'])
295
- {
296
- // parse them
297
- for(var i in parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'])
298
- {
299
- datas = parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'][i];
300
- tmp = {};
301
- if(datas["CASE_SENSITIVE"]!="undefined" && datas["CASE_SENSITIVE"]==false)
302
- tmp["modifiers"]="i";
303
- else
304
- tmp["modifiers"]="";
305
- tmp["prefix_separator"]= datas["REGEXP"]["prefix_separator"];
306
- tmp["match_prefix_separator"]= new RegExp( datas["REGEXP"]["prefix_separator"] +"$", tmp["modifiers"]);
307
- tmp["match_word"]= new RegExp("(?:"+ datas["REGEXP"]["before_word"] +")("+ datas["REGEXP"]["possible_words_letters"] +")$", tmp["modifiers"]);
308
- tmp["match_next_letter"]= new RegExp("^("+ datas["REGEXP"]["letter_after_word_must_match"] +")$", tmp["modifiers"]);
309
- tmp["keywords"]= {};
310
- //console.log( datas["KEYWORDS"] );
311
- for( var prefix in datas["KEYWORDS"] )
312
- {
313
- tmp["keywords"][prefix]= {
314
- prefix: prefix,
315
- prefix_name: prefix,
316
- prefix_reg: new RegExp("(?:"+ parent.editAreaLoader.get_escaped_regexp( prefix ) +")(?:"+ tmp["prefix_separator"] +")$", tmp["modifiers"] ),
317
- datas: []
318
- };
319
- for( var j=0; j<datas["KEYWORDS"][prefix].length; j++ )
320
- {
321
- tmp["keywords"][prefix]['datas'][j]= {
322
- is_typing: datas["KEYWORDS"][prefix][j][0],
323
- // if replace with is empty, replace with the is_typing value
324
- replace_with: datas["KEYWORDS"][prefix][j][1] ? datas["KEYWORDS"][prefix][j][1].replace('�', datas["KEYWORDS"][prefix][j][0] ) : '',
325
- comment: datas["KEYWORDS"][prefix][j][2] ? datas["KEYWORDS"][prefix][j][2] : ''
326
- };
327
-
328
- // the replace with shouldn't be empty
329
- if( tmp["keywords"][prefix]['datas'][j]['replace_with'].length == 0 )
330
- tmp["keywords"][prefix]['datas'][j]['replace_with'] = tmp["keywords"][prefix]['datas'][j]['is_typing'];
331
-
332
- // if the comment is empty, display the replace_with value
333
- if( tmp["keywords"][prefix]['datas'][j]['comment'].length == 0 )
334
- tmp["keywords"][prefix]['datas'][j]['comment'] = tmp["keywords"][prefix]['datas'][j]['replace_with'].replace(/{@}/g, '' );
335
- }
336
-
337
- }
338
- tmp["max_text_length"]= datas["MAX_TEXT_LENGTH"];
339
- parent.editAreaLoader.syntax[lang]['autocompletion'][i] = tmp;
340
- }
341
- }
342
- }
343
- }
344
- }
345
-
346
- ,_checkLetter: function(){
347
- // check that syntax hasn't changed
348
- if( this.curr_syntax_str != editArea.settings['syntax'] )
349
- {
350
- if( !parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion'] )
351
- this._parseSyntaxAutoCompletionDatas();
352
- this.curr_syntax= parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion'];
353
- this.curr_syntax_str = editArea.settings['syntax'];
354
- //console.log( this.curr_syntax );
355
- }
356
-
357
- if( editArea.is_editable )
358
- {
359
- time=new Date;
360
- t1= time.getTime();
361
- editArea.getIESelection();
362
- this.selectIndex = -1;
363
- start=editArea.textarea.selectionStart;
364
- var str = editArea.textarea.value;
365
- var results= [];
366
-
367
-
368
- for(var i in this.curr_syntax)
369
- {
370
- var last_chars = str.substring(Math.max(0, start-this.curr_syntax[i]["max_text_length"]), start);
371
- var matchNextletter = str.substring(start, start+1).match( this.curr_syntax[i]["match_next_letter"]);
372
- // if not writting in the middle of a word or if forcing display
373
- if( matchNextletter || this.forceDisplay )
374
- {
375
- // check if the last chars match a separator
376
- var match_prefix_separator = last_chars.match(this.curr_syntax[i]["match_prefix_separator"]);
377
-
378
- // check if it match a possible word
379
- var match_word= last_chars.match(this.curr_syntax[i]["match_word"]);
380
-
381
- //console.log( match_word );
382
- if( match_word )
383
- {
384
- var begin_word= match_word[1];
385
- var match_curr_word= new RegExp("^"+ parent.editAreaLoader.get_escaped_regexp( begin_word ), this.curr_syntax[i]["modifiers"]);
386
- //console.log( match_curr_word );
387
- for(var prefix in this.curr_syntax[i]["keywords"])
388
- {
389
- // parent.console.log( this.curr_syntax[i]["keywords"][prefix] );
390
- for(var j=0; j<this.curr_syntax[i]["keywords"][prefix]['datas'].length; j++)
391
- {
392
- // parent.console.log( this.curr_syntax[i]["keywords"][prefix]['datas'][j]['is_typing'] );
393
- // the key word match or force display
394
- if( this.curr_syntax[i]["keywords"][prefix]['datas'][j]['is_typing'].match(match_curr_word) )
395
- {
396
- // parent.console.log('match');
397
- hasMatch = false;
398
- var before = last_chars.substr( 0, last_chars.length - begin_word.length );
399
-
400
- // no prefix to match => it's valid
401
- if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 )
402
- {
403
- if( ! before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) )
404
- hasMatch = true;
405
- }
406
- // we still need to check the prefix if there is one
407
- else if( this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 )
408
- {
409
- if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) )
410
- hasMatch = true;
411
- }
412
-
413
- if( hasMatch )
414
- results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ];
415
- }
416
- }
417
- }
418
- }
419
- // it doesn't match any possible word but we want to display something
420
- // we'll display to list of all available words
421
- else if( this.forceDisplay || match_prefix_separator )
422
- {
423
- for(var prefix in this.curr_syntax[i]["keywords"])
424
- {
425
- for(var j=0; j<this.curr_syntax[i]["keywords"][prefix]['datas'].length; j++)
426
- {
427
- hasMatch = false;
428
- // no prefix to match => it's valid
429
- if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 )
430
- {
431
- hasMatch = true;
432
- }
433
- // we still need to check the prefix if there is one
434
- else if( match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 )
435
- {
436
- var before = last_chars; //.substr( 0, last_chars.length );
437
- if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) )
438
- hasMatch = true;
439
- }
440
-
441
- if( hasMatch )
442
- results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ];
443
- }
444
- }
445
- }
446
- }
447
- }
448
-
449
- // there is only one result, and we can select it automatically
450
- if( results.length == 1 && this.autoSelectIfOneResult )
451
- {
452
- // console.log( results );
453
- this._select( results[0][1]['replace_with'] );
454
- }
455
- else if( results.length == 0 )
456
- {
457
- this._hide();
458
- }
459
- else
460
- {
461
- // build the suggestion box content
462
- var lines=[];
463
- for(var i=0; i<results.length; i++)
464
- {
465
- var line= "<li><a href=\"#\" class=\"entry\" onmousedown=\"EditArea_autocompletion._select('"+ results[i][1]['replace_with'].replace(new RegExp('"', "g"), "&quot;") +"');return false;\">"+ results[i][1]['comment'];
466
- if(results[i][0]['prefix_name'].length>0)
467
- line+='<span class="prefix">'+ results[i][0]['prefix_name'] +'</span>';
468
- line+='</a></li>';
469
- lines[lines.length]=line;
470
- }
471
- // sort results
472
- this.container.innerHTML = '<ul>'+ lines.sort().join('') +'</ul>';
473
-
474
- var cursor = _$("cursor_pos");
475
- this.container.style.top = ( cursor.cursor_top + editArea.lineHeight ) +"px";
476
- this.container.style.left = ( cursor.cursor_left + 8 ) +"px";
477
- this._show();
478
- }
479
-
480
- this.autoSelectIfOneResult = false;
481
- time=new Date;
482
- t2= time.getTime();
483
-
484
- //parent.console.log( begin_word +"\n"+ (t2-t1) +"\n"+ html );
485
- }
486
- }
487
- };
488
-
489
- // Load as a plugin
490
- editArea.settings['plugins'][ editArea.settings['plugins'].length ] = 'autocompletion';
491
- editArea.add_plugin('autocompletion', EditArea_autocompletion);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/edit_area.css DELETED
@@ -1,530 +0,0 @@
1
- body, html{
2
- margin: 0;
3
- padding: 0;
4
- height: 100%;
5
- border: none;
6
- overflow: hidden;
7
- background-color: #FFF;
8
- }
9
-
10
- body, html, table, form, textarea{
11
- font: 12px monospace, sans-serif;
12
- }
13
-
14
- #editor{
15
- border: solid #888 1px;
16
- overflow: hidden;
17
- }
18
-
19
- #result{
20
- z-index: 4;
21
- overflow-x: auto;
22
- overflow-y: scroll;
23
- border-top: solid #888 1px;
24
- border-bottom: solid #888 1px;
25
- position: relative;
26
- clear: both;
27
- }
28
-
29
- #result.empty{
30
- overflow: hidden;
31
- }
32
-
33
- #container{
34
- overflow: hidden;
35
- border: solid blue 0;
36
- position: relative;
37
- z-index: 10;
38
- padding: 0 5px 0 45px;
39
- /*padding-right: 5px;*/
40
- }
41
-
42
- #textarea{
43
- position: relative;
44
- top: 0;
45
- left: 0;
46
- margin: 0;
47
- padding: 0;
48
- width: 100%;
49
- height: 100%;
50
- overflow: hidden;
51
- z-index: 7;
52
- border-width: 0;
53
- background-color: transparent;
54
- resize: none;
55
- }
56
-
57
- #textarea, #textarea:hover{
58
- outline: none; /* safari outline fix */
59
- }
60
-
61
- #content_highlight{
62
- white-space: pre;
63
- margin: 0;
64
- padding: 0;
65
- position : absolute;
66
- z-index: 4;
67
- overflow: visible;
68
- }
69
-
70
-
71
- #selection_field, #selection_field_text{
72
- margin: 0;
73
- background-color: #E1F2F9;
74
- /* height: 1px; */
75
- position: absolute;
76
- z-index: 5;
77
- top: -100px;
78
- padding: 0;
79
- white-space: pre;
80
- overflow: hidden;
81
- }
82
-
83
- #selection_field.show_colors {
84
- z-index: 3;
85
- background-color:#EDF9FC;
86
-
87
- }
88
-
89
- #selection_field strong{
90
- font-weight:normal;
91
- }
92
-
93
- #selection_field.show_colors *, #selection_field_text * {
94
- visibility: hidden;
95
- }
96
-
97
- #selection_field_text{
98
- background-color:transparent;
99
- }
100
-
101
- #selection_field_text strong{
102
- font-weight:normal;
103
- background-color:#3399FE;
104
- color: #FFF;
105
- visibility:visible;
106
- }
107
-
108
- #container.word_wrap #content_highlight,
109
- #container.word_wrap #selection_field,
110
- #container.word_wrap #selection_field_text,
111
- #container.word_wrap #test_font_size{
112
- white-space: pre-wrap; /* css-3 */
113
- white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
114
- white-space: -pre-wrap; /* Opera 4-6 */
115
- white-space: -o-pre-wrap; /* Opera 7 */
116
- word-wrap: break-word; /* Internet Explorer 5.5+ */
117
- width: 99%;
118
- }
119
-
120
- #line_number{
121
- position: absolute;
122
- overflow: hidden;
123
- border-right: solid black 1px;
124
- z-index:8;
125
- width: 38px;
126
- padding: 0 5px 0 0;
127
- margin: 0 0 0 -45px;
128
- text-align: right;
129
- color: #AAAAAA;
130
- }
131
-
132
- #test_font_size{
133
- padding: 0;
134
- margin: 0;
135
- visibility: hidden;
136
- position: absolute;
137
- white-space: pre;
138
- }
139
-
140
- pre{
141
- margin: 0;
142
- padding: 0;
143
- }
144
-
145
- .hidden{
146
- opacity: 0.2;
147
- filter:alpha(opacity=20);
148
- }
149
-
150
- #result .edit_area_cursor{
151
- position: absolute;
152
- z-index:6;
153
- background-color: #FF6633;
154
- top: -100px;
155
- margin: 0;
156
- }
157
-
158
- #result .edit_area_selection_field .overline{
159
- background-color: #996600;
160
- }
161
-
162
-
163
- /* area popup */
164
- .editarea_popup{
165
- border: solid 1px #888888;
166
- background-color: #ECE9D8;
167
- width: 250px;
168
- padding: 4px;
169
- position: absolute;
170
- visibility: hidden;
171
- z-index: 15;
172
- top: -500px;
173
- }
174
-
175
- .editarea_popup, .editarea_popup table{
176
- font-family: sans-serif;
177
- font-size: 10pt;
178
- }
179
-
180
- .editarea_popup img{
181
- border: 0;
182
- }
183
-
184
- .editarea_popup .close_popup{
185
- float: right;
186
- line-height: 16px;
187
- border: 0;
188
- padding: 0;
189
- }
190
-
191
- .editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{
192
- margin: 0;
193
- padding: 0;
194
- }
195
-
196
- .editarea_popup .copyright{
197
- text-align: right;
198
- }
199
-
200
- /* Area_search */
201
- div#area_search_replace{
202
- /*width: 250px;*/
203
- }
204
-
205
- div#area_search_replace img{
206
- border: 0;
207
- }
208
-
209
- div#area_search_replace div.button{
210
- text-align: center;
211
- line-height: 1.7em;
212
- }
213
-
214
- div#area_search_replace .button a{
215
- cursor: pointer;
216
- border: solid 1px #888888;
217
- background-color: #DEDEDE;
218
- text-decoration: none;
219
- padding: 0 2px;
220
- color: #000000;
221
- white-space: nowrap;
222
- }
223
-
224
- div#area_search_replace a:hover{
225
- /*border: solid 1px #888888;*/
226
- background-color: #EDEDED;
227
- }
228
-
229
- div#area_search_replace #move_area_search_replace{
230
- cursor: move;
231
- border: solid 1px #888;
232
- }
233
-
234
- div#area_search_replace #close_area_search_replace{
235
- text-align: right;
236
- vertical-align: top;
237
- white-space: nowrap;
238
- }
239
-
240
- div#area_search_replace #area_search_msg{
241
- height: 18px;
242
- overflow: hidden;
243
- border-top: solid 1px #888;
244
- margin-top: 3px;
245
- }
246
-
247
- /* area help */
248
- #edit_area_help{
249
- width: 350px;
250
- }
251
-
252
- #edit_area_help div.close_popup{
253
- float: right;
254
- }
255
-
256
- /* area_toolbar */
257
- .area_toolbar{
258
- /*font: 11px sans-serif;*/
259
- width: 100%;
260
- /*height: 21px; */
261
- margin: 0;
262
- padding: 0;
263
- background-color: #ECE9D8;
264
- text-align: center;
265
- }
266
-
267
- .area_toolbar, .area_toolbar table{
268
- font: 11px sans-serif;
269
- }
270
-
271
- .area_toolbar img{
272
- border: 0;
273
- vertical-align: middle;
274
- }
275
-
276
- .area_toolbar input{
277
- margin: 0;
278
- padding: 0;
279
- }
280
-
281
- .area_toolbar select{
282
- font-family: 'MS Sans Serif',sans-serif,Verdana,Arial;
283
- font-size: 7pt;
284
- font-weight: normal;
285
- margin: 2px 0 0 0 ;
286
- padding: 0;
287
- vertical-align: top;
288
- background-color: #F0F0EE;
289
- }
290
-
291
- table.statusbar{
292
- width: 100%;
293
- }
294
-
295
- .area_toolbar td.infos{
296
- text-align: center;
297
- width: 130px;
298
- border-right: solid 1px #888;
299
- border-width: 0 1px 0 0;
300
- padding: 0;
301
- }
302
-
303
- .area_toolbar td.total{
304
- text-align: right;
305
- width: 50px;
306
- padding: 0;
307
- }
308
-
309
- .area_toolbar td.resize{
310
- text-align: right;
311
- }
312
- /*
313
- .area_toolbar span{
314
- line-height: 1px;
315
- padding: 0;
316
- margin: 0;
317
- }*/
318
-
319
- .area_toolbar span#resize_area{
320
- cursor: nw-resize;
321
- visibility: hidden;
322
- }
323
-
324
- /* toolbar buttons */
325
- .editAreaButtonNormal, .editAreaButtonOver, .editAreaButtonDown, .editAreaSeparator, .editAreaSeparatorLine, .editAreaButtonDisabled, .editAreaButtonSelected {
326
- border: 0; margin: 0; padding: 0; background: transparent;
327
- margin-top: 0;
328
- margin-left: 1px;
329
- padding: 0;
330
- }
331
-
332
- .editAreaButtonNormal {
333
- border: 1px solid #ECE9D8 !important;
334
- cursor: pointer;
335
- }
336
-
337
- .editAreaButtonOver {
338
- border: 1px solid #0A246A !important;
339
- cursor: pointer;
340
- background-color: #B6BDD2;
341
- }
342
-
343
- .editAreaButtonDown {
344
- cursor: pointer;
345
- border: 1px solid #0A246A !important;
346
- background-color: #8592B5;
347
- }
348
-
349
- .editAreaButtonSelected {
350
- border: 1px solid #C0C0BB !important;
351
- cursor: pointer;
352
- background-color: #F4F2E8;
353
- }
354
-
355
- .editAreaButtonDisabled {
356
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
357
- -moz-opacity:0.3;
358
- opacity: 0.3;
359
- border: 1px solid #F0F0EE !important;
360
- cursor: pointer;
361
- }
362
-
363
- .editAreaSeparatorLine {
364
- margin: 1px 2px;
365
- background-color: #C0C0BB;
366
- width: 2px;
367
- height: 18px;
368
- }
369
-
370
- /* waiting screen */
371
- #processing{
372
- display: none;
373
- background-color:#ECE9D8;
374
- border: solid #888 1px;
375
- position: absolute;
376
- top: 0;
377
- left: 0;
378
- width: 100%;
379
- height: 100%;
380
- z-index: 100;
381
- text-align: center;
382
- }
383
-
384
- #processing_text{
385
- position:absolute;
386
- left: 50%;
387
- top: 50%;
388
- width: 200px;
389
- height: 20px;
390
- margin-left: -100px;
391
- margin-top: -10px;
392
- text-align: center;
393
- }
394
- /* end */
395
-
396
-
397
- /**** tab browsing area ****/
398
- #tab_browsing_area{
399
- display: none;
400
- background-color: #CCC9A8;
401
- border-top: 1px solid #888;
402
- text-align: left;
403
- margin: 0;
404
- }
405
-
406
- #tab_browsing_list {
407
- padding: 0;
408
- margin: 0;
409
- list-style-type: none;
410
- white-space: nowrap;
411
- }
412
- #tab_browsing_list li {
413
- float: left;
414
- margin: -1px;
415
- }
416
- #tab_browsing_list a {
417
- position: relative;
418
- display: block;
419
- text-decoration: none;
420
- float: left;
421
- cursor: pointer;
422
- line-height:14px;
423
- }
424
-
425
- #tab_browsing_list a span {
426
- display: block;
427
- color: #000;
428
- background: #ECE9D8;
429
- border: 1px solid #888;
430
- border-width: 1px 1px 0;
431
- text-align: center;
432
- padding: 2px 2px 1px 4px;
433
- position: relative; /*IE 6 hack */
434
- }
435
-
436
- #tab_browsing_list a b {
437
- display: block;
438
- border-bottom: 2px solid #617994;
439
- }
440
-
441
- #tab_browsing_list a .edited {
442
- display: none;
443
- }
444
-
445
- #tab_browsing_list a.edited .edited {
446
- display: inline;
447
- }
448
-
449
- #tab_browsing_list a img{
450
- margin-left: 7px;
451
- }
452
-
453
- #tab_browsing_list a.edited img{
454
- margin-left: 3px;
455
- }
456
-
457
- #tab_browsing_list a:hover span {
458
- background: #F4F2E8;
459
- border-color: #0A246A;
460
- }
461
-
462
- #tab_browsing_list .selected a span{
463
- background: #046380;
464
- color: #FFF;
465
- }
466
-
467
-
468
- #no_file_selected{
469
- height: 100%;
470
- width: 150%; /* Opera need more than 100% */
471
- background: #CCC;
472
- display: none;
473
- z-index: 20;
474
- position: absolute;
475
- }
476
-
477
-
478
- /*** Non-editable mode ***/
479
- .non_editable #editor
480
- {
481
- border-width: 0 1px;
482
- }
483
-
484
- .non_editable .area_toolbar
485
- {
486
- display: none;
487
- }
488
-
489
- /*** Auto completion ***/
490
- #auto_completion_area
491
- {
492
- background: #FFF;
493
- border: solid 1px #888;
494
- position: absolute;
495
- z-index: 15;
496
- width: 280px;
497
- height: 180px;
498
- overflow: auto;
499
- display:none;
500
- }
501
-
502
- #auto_completion_area a, #auto_completion_area a:visited
503
- {
504
- display: block;
505
- padding: 0 2px 1px;
506
- color: #000;
507
- text-decoration:none;
508
- }
509
-
510
- #auto_completion_area a:hover, #auto_completion_area a:focus, #auto_completion_area a.focus
511
- {
512
- background: #D6E1FE;
513
- text-decoration:none;
514
- }
515
-
516
- #auto_completion_area ul
517
- {
518
- margin: 0;
519
- padding: 0;
520
- list-style: none inside;
521
- }
522
- #auto_completion_area li
523
- {
524
- padding: 0;
525
- }
526
- #auto_completion_area .prefix
527
- {
528
- font-style: italic;
529
- padding: 0 3px;
530
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/edit_area.js DELETED
@@ -1,527 +0,0 @@
1
- /******
2
- *
3
- * EditArea
4
- * Developped by Christophe Dolivet
5
- * Released under LGPL, Apache and BSD licenses (use the one you want)
6
- *
7
- ******/
8
-
9
- function EditArea(){
10
- var t=this;
11
- t.error= false; // to know if load is interrrupt
12
-
13
- t.inlinePopup= [{popup_id: "area_search_replace", icon_id: "search"},
14
- {popup_id: "edit_area_help", icon_id: "help"}];
15
- t.plugins= {};
16
-
17
- t.line_number=0;
18
-
19
- parent.editAreaLoader.set_browser_infos(t); // navigator identification
20
- // fix IE8 detection as we run in IE7 emulate mode through X-UA <meta> tag
21
- if( t.isIE >= 8 )
22
- t.isIE = 7;
23
-
24
- t.last_selection={};
25
- t.last_text_to_highlight="";
26
- t.last_hightlighted_text= "";
27
- t.syntax_list= [];
28
- t.allready_used_syntax= {};
29
- t.check_line_selection_timer= 50; // the timer delay for modification and/or selection change detection
30
-
31
- t.textareaFocused= false;
32
- t.highlight_selection_line= null;
33
- t.previous= [];
34
- t.next= [];
35
- t.last_undo="";
36
- t.files= {};
37
- t.filesIdAssoc= {};
38
- t.curr_file= '';
39
- //t.loaded= false;
40
- t.assocBracket={};
41
- t.revertAssocBracket= {};
42
- // bracket selection init
43
- t.assocBracket["("]=")";
44
- t.assocBracket["{"]="}";
45
- t.assocBracket["["]="]";
46
- for(var index in t.assocBracket){
47
- t.revertAssocBracket[t.assocBracket[index]]=index;
48
- }
49
- t.is_editable= true;
50
-
51
-
52
- /*t.textarea="";
53
-
54
- t.state="declare";
55
- t.code = []; // store highlight syntax for languagues*/
56
- // font datas
57
- t.lineHeight= 16;
58
- /*t.default_font_family= "monospace";
59
- t.default_font_size= 10;*/
60
- t.tab_nb_char= 8; //nb of white spaces corresponding to a tabulation
61
- if(t.isOpera)
62
- t.tab_nb_char= 6;
63
-
64
- t.is_tabbing= false;
65
-
66
- t.fullscreen= {'isFull': false};
67
-
68
- t.isResizing=false; // resize var
69
-
70
- // init with settings and ID (area_id is a global var defined by editAreaLoader on iframe creation
71
- t.id= area_id;
72
- t.settings= editAreas[t.id]["settings"];
73
-
74
- if((""+t.settings['replace_tab_by_spaces']).match(/^[0-9]+$/))
75
- {
76
- t.tab_nb_char= t.settings['replace_tab_by_spaces'];
77
- t.tabulation="";
78
- for(var i=0; i<t.tab_nb_char; i++)
79
- t.tabulation+=" ";
80
- }else{
81
- t.tabulation="\t";
82
- }
83
-
84
- // retrieve the init parameter for syntax
85
- if(t.settings["syntax_selection_allow"] && t.settings["syntax_selection_allow"].length>0)
86
- t.syntax_list= t.settings["syntax_selection_allow"].replace(/ /g,"").split(",");
87
-
88
- if(t.settings['syntax'])
89
- t.allready_used_syntax[t.settings['syntax']]=true;
90
-
91
-
92
- };
93
- EditArea.prototype.init= function(){
94
- var t=this, a, s=t.settings;
95
- t.textarea = _$("textarea");
96
- t.container = _$("container");
97
- t.result = _$("result");
98
- t.content_highlight = _$("content_highlight");
99
- t.selection_field = _$("selection_field");
100
- t.selection_field_text= _$("selection_field_text");
101
- t.processing_screen = _$("processing");
102
- t.editor_area = _$("editor");
103
- t.tab_browsing_area = _$("tab_browsing_area");
104
- t.test_font_size = _$("test_font_size");
105
- a = t.textarea;
106
-
107
- if(!s['is_editable'])
108
- t.set_editable(false);
109
-
110
- t.set_show_line_colors( s['show_line_colors'] );
111
-
112
- if(syntax_selec= _$("syntax_selection"))
113
- {
114
- // set up syntax selection lsit in the toolbar
115
- for(var i=0; i<t.syntax_list.length; i++) {
116
- var syntax= t.syntax_list[i];
117
- var option= document.createElement("option");
118
- option.value= syntax;
119
- if(syntax==s['syntax'])
120
- option.selected= "selected";
121
- dispSyntax = parent.editAreaLoader.syntax_display_name[ syntax ];
122
- option.innerHTML= typeof( dispSyntax ) == 'undefined' ? syntax.substring( 0, 1 ).toUpperCase() + syntax.substring( 1 ) : dispSyntax;//t.get_translation("syntax_" + syntax, "word");
123
- syntax_selec.appendChild(option);
124
- }
125
- }
126
-
127
- // add plugins buttons in the toolbar
128
- spans= parent.getChildren(_$("toolbar_1"), "span", "", "", "all", -1);
129
-
130
- for(var i=0; i<spans.length; i++){
131
-
132
- id=spans[i].id.replace(/tmp_tool_(.*)/, "$1");
133
- if(id!= spans[i].id){
134
- for(var j in t.plugins){
135
- if(typeof(t.plugins[j].get_control_html)=="function" ){
136
- html=t.plugins[j].get_control_html(id);
137
- if(html!=false){
138
- html= t.get_translation(html, "template");
139
- var new_span= document.createElement("span");
140
- new_span.innerHTML= html;
141
- var father= spans[i].parentNode;
142
- spans[i].parentNode.replaceChild(new_span, spans[i]);
143
- break; // exit the for loop
144
- }
145
- }
146
- }
147
- }
148
- }
149
-
150
- // init datas
151
- //a.value = 'a';//editAreas[t.id]["textarea"].value;
152
-
153
- if(s["debug"])
154
- {
155
- t.debug=parent.document.getElementById("edit_area_debug_"+t.id);
156
- }
157
- // init size
158
- //this.update_size();
159
-
160
- if(_$("redo") != null)
161
- t.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);
162
-
163
- // insert css rules for highlight mode
164
- if(typeof(parent.editAreaLoader.syntax[s["syntax"]])!="undefined"){
165
- for(var i in parent.editAreaLoader.syntax){
166
- if (typeof(parent.editAreaLoader.syntax[i]["styles"]) != "undefined"){
167
- t.add_style(parent.editAreaLoader.syntax[i]["styles"]);
168
- }
169
- }
170
- }
171
-
172
- // init key events
173
- if(t.isOpera)
174
- _$("editor").onkeypress = keyDown;
175
- else
176
- _$("editor").onkeydown = keyDown;
177
-
178
- for(var i=0; i<t.inlinePopup.length; i++){
179
- if(t.isOpera)
180
- _$(t.inlinePopup[i]["popup_id"]).onkeypress = keyDown;
181
- else
182
- _$(t.inlinePopup[i]["popup_id"]).onkeydown = keyDown;
183
- }
184
-
185
- if(s["allow_resize"]=="both" || s["allow_resize"]=="x" || s["allow_resize"]=="y")
186
- t.allow_resize(true);
187
-
188
- parent.editAreaLoader.toggle(t.id, "on");
189
- //a.focus();
190
- // line selection init
191
- t.change_smooth_selection_mode(editArea.smooth_selection);
192
- // highlight
193
- t.execCommand("change_highlight", s["start_highlight"]);
194
-
195
- // get font size datas
196
- t.set_font(editArea.settings["font_family"], editArea.settings["font_size"]);
197
-
198
- // set unselectable text
199
- children= parent.getChildren(document.body, "", "selec", "none", "all", -1);
200
- for(var i=0; i<children.length; i++){
201
- if(t.isIE)
202
- children[i].unselectable = true; // IE
203
- else
204
- children[i].onmousedown= function(){return false};
205
- /* children[i].style.MozUserSelect = "none"; // Moz
206
- children[i].style.KhtmlUserSelect = "none"; // Konqueror/Safari*/
207
- }
208
-
209
- a.spellcheck= s["gecko_spellcheck"];
210
-
211
- /** Browser specific style fixes **/
212
-
213
- // fix rendering bug for highlighted lines beginning with no tabs
214
- if( t.isFirefox >= '3' ) {
215
- t.content_highlight.style.paddingLeft= "1px";
216
- t.selection_field.style.paddingLeft= "1px";
217
- t.selection_field_text.style.paddingLeft= "1px";
218
- }
219
-
220
- if(t.isIE && t.isIE < 8 ){
221
- a.style.marginTop= "-1px";
222
- }
223
- /*
224
- if(t.isOpera){
225
- t.editor_area.style.position= "absolute";
226
- }*/
227
-
228
- if( t.isSafari ){
229
- t.editor_area.style.position = "absolute";
230
- a.style.marginLeft ="-3px";
231
- if( t.isSafari < 3.2 ) // Safari 3.0 (3.1?)
232
- a.style.marginTop ="1px";
233
- }
234
-
235
- // si le textarea n'est pas grand, un click sous le textarea doit provoquer un focus sur le textarea
236
- parent.editAreaLoader.add_event(t.result, "click", function(e){ if((e.target || e.srcElement)==editArea.result) { editArea.area_select(editArea.textarea.value.length, 0);} });
237
-
238
- if(s['is_multi_files']!=false)
239
- t.open_file({'id': t.curr_file, 'text': ''});
240
-
241
- t.set_word_wrap( s['word_wrap'] );
242
-
243
- setTimeout("editArea.focus();editArea.manage_size();editArea.execCommand('EA_load');", 10);
244
- //start checkup routine
245
- t.check_undo();
246
- t.check_line_selection(true);
247
- t.scroll_to_view();
248
-
249
- for(var i in t.plugins){
250
- if(typeof(t.plugins[i].onload)=="function")
251
- t.plugins[i].onload();
252
- }
253
- if(s['fullscreen']==true)
254
- t.toggle_full_screen(true);
255
-
256
- parent.editAreaLoader.add_event(window, "resize", editArea.update_size);
257
- parent.editAreaLoader.add_event(parent.window, "resize", editArea.update_size);
258
- parent.editAreaLoader.add_event(top.window, "resize", editArea.update_size);
259
- parent.editAreaLoader.add_event(window, "unload", function(){
260
- // in case where editAreaLoader have been already cleaned
261
- if( parent.editAreaLoader )
262
- {
263
- parent.editAreaLoader.remove_event(parent.window, "resize", editArea.update_size);
264
- parent.editAreaLoader.remove_event(top.window, "resize", editArea.update_size);
265
- }
266
- if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]){
267
- editArea.execCommand("EA_unload");
268
- }
269
- });
270
-
271
-
272
- /*date= new Date();
273
- alert(date.getTime()- parent.editAreaLoader.start_time);*/
274
- };
275
-
276
-
277
-
278
- //called by the toggle_on
279
- EditArea.prototype.update_size= function(){
280
- var d=document,pd=parent.document,height,width,popup,maxLeft,maxTop;
281
-
282
- if( typeof editAreas != 'undefined' && editAreas[editArea.id] && editAreas[editArea.id]["displayed"]==true){
283
- if(editArea.fullscreen['isFull']){
284
- pd.getElementById("frame_"+editArea.id).style.width = pd.getElementsByTagName("html")[0].clientWidth + "px";
285
- pd.getElementById("frame_"+editArea.id).style.height = pd.getElementsByTagName("html")[0].clientHeight + "px";
286
- }
287
-
288
- if(editArea.tab_browsing_area.style.display=='block' && ( !editArea.isIE || editArea.isIE >= 8 ) )
289
- {
290
- editArea.tab_browsing_area.style.height = "0px";
291
- editArea.tab_browsing_area.style.height = (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px";
292
- }
293
-
294
- height = d.body.offsetHeight - editArea.get_all_toolbar_height() - 4;
295
- editArea.result.style.height = height +"px";
296
-
297
- width = d.body.offsetWidth -2;
298
- editArea.result.style.width = width+"px";
299
- //alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight);
300
-
301
- // check that the popups don't get out of the screen
302
- for( i=0; i < editArea.inlinePopup.length; i++ )
303
- {
304
- popup = _$(editArea.inlinePopup[i]["popup_id"]);
305
- maxLeft = d.body.offsetWidth - popup.offsetWidth;
306
- maxTop = d.body.offsetHeight - popup.offsetHeight;
307
- if( popup.offsetTop > maxTop )
308
- popup.style.top = maxTop+"px";
309
- if( popup.offsetLeft > maxLeft )
310
- popup.style.left = maxLeft+"px";
311
- }
312
-
313
- editArea.manage_size( true );
314
- editArea.fixLinesHeight( editArea.textarea.value, 0,-1);
315
- }
316
- };
317
-
318
-
319
- EditArea.prototype.manage_size= function(onlyOneTime){
320
- if(!editAreas[this.id])
321
- return false;
322
-
323
- if(editAreas[this.id]["displayed"]==true && this.textareaFocused)
324
- {
325
- var area_height,resized= false;
326
-
327
- //1) Manage display width
328
- //1.1) Calc the new width to use for display
329
- if( !this.settings['word_wrap'] )
330
- {
331
- var area_width= this.textarea.scrollWidth;
332
- area_height= this.textarea.scrollHeight;
333
- // bug on old opera versions
334
- if(this.isOpera && this.isOpera < 9.6 ){
335
- area_width=10000;
336
- }
337
- //1.2) the width is not the same, we must resize elements
338
- if(this.textarea.previous_scrollWidth!=area_width)
339
- {
340
- this.container.style.width= area_width+"px";
341
- this.textarea.style.width= area_width+"px";
342
- this.content_highlight.style.width= area_width+"px";
343
- this.textarea.previous_scrollWidth=area_width;
344
- resized=true;
345
- }
346
- }
347
- // manage wrap width
348
- if( this.settings['word_wrap'] )
349
- {
350
- newW=this.textarea.offsetWidth;
351
- if( this.isFirefox || this.isIE )
352
- newW-=2;
353
- if( this.isSafari )
354
- newW-=6;
355
- this.content_highlight.style.width=this.selection_field_text.style.width=this.selection_field.style.width=this.test_font_size.style.width=newW+"px";
356
- }
357
-
358
- //2) Manage display height
359
- //2.1) Calc the new height to use for display
360
- if( this.isOpera || this.isFirefox || this.isSafari ) {
361
- area_height= this.getLinePosTop( this.last_selection["nb_line"] + 1 );
362
- } else {
363
- area_height = this.textarea.scrollHeight;
364
- }
365
- //2.2) the width is not the same, we must resize elements
366
- if(this.textarea.previous_scrollHeight!=area_height)
367
- {
368
- this.container.style.height= (area_height+2)+"px";
369
- this.textarea.style.height= area_height+"px";
370
- this.content_highlight.style.height= area_height+"px";
371
- this.textarea.previous_scrollHeight= area_height;
372
- resized=true;
373
- }
374
-
375
- //3) if there is new lines, we add new line numbers in the line numeration area
376
- if(this.last_selection["nb_line"] >= this.line_number)
377
- {
378
- var newLines= '', destDiv=_$("line_number"), start=this.line_number, end=this.last_selection["nb_line"]+100;
379
- for( i = start+1; i < end; i++ )
380
- {
381
- newLines+='<div id="line_'+ i +'">'+i+"</div>";
382
- this.line_number++;
383
- }
384
- destDiv.innerHTML= destDiv.innerHTML + newLines;
385
- if(this.settings['word_wrap']){
386
- this.fixLinesHeight( this.textarea.value, start, -1 );
387
- }
388
- }
389
-
390
- //4) be sure the text is well displayed
391
- this.textarea.scrollTop="0px";
392
- this.textarea.scrollLeft="0px";
393
- if(resized==true){
394
- this.scroll_to_view();
395
- }
396
- }
397
-
398
- if(!onlyOneTime)
399
- setTimeout("editArea.manage_size();", 100);
400
- };
401
-
402
- EditArea.prototype.execCommand= function(cmd, param){
403
-
404
- for(var i in this.plugins){
405
- if(typeof(this.plugins[i].execCommand)=="function"){
406
- if(!this.plugins[i].execCommand(cmd, param))
407
- return;
408
- }
409
- }
410
- switch(cmd){
411
- case "save":
412
- if(this.settings["save_callback"].length>0)
413
- eval("parent."+this.settings["save_callback"]+"('"+ this.id +"', editArea.textarea.value);");
414
- break;
415
- case "load":
416
- if(this.settings["load_callback"].length>0)
417
- eval("parent."+this.settings["load_callback"]+"('"+ this.id +"');");
418
- break;
419
- case "onchange":
420
- if(this.settings["change_callback"].length>0)
421
- eval("parent."+this.settings["change_callback"]+"('"+ this.id +"');");
422
- break;
423
- case "EA_load":
424
- if(this.settings["EA_load_callback"].length>0)
425
- eval("parent."+this.settings["EA_load_callback"]+"('"+ this.id +"');");
426
- break;
427
- case "EA_unload":
428
- if(this.settings["EA_unload_callback"].length>0)
429
- eval("parent."+this.settings["EA_unload_callback"]+"('"+ this.id +"');");
430
- break;
431
- case "toggle_on":
432
- if(this.settings["EA_toggle_on_callback"].length>0)
433
- eval("parent."+this.settings["EA_toggle_on_callback"]+"('"+ this.id +"');");
434
- break;
435
- case "toggle_off":
436
- if(this.settings["EA_toggle_off_callback"].length>0)
437
- eval("parent."+this.settings["EA_toggle_off_callback"]+"('"+ this.id +"');");
438
- break;
439
- case "re_sync":
440
- if(!this.do_highlight)
441
- break;
442
- case "file_switch_on":
443
- if(this.settings["EA_file_switch_on_callback"].length>0)
444
- eval("parent."+this.settings["EA_file_switch_on_callback"]+"(param);");
445
- break;
446
- case "file_switch_off":
447
- if(this.settings["EA_file_switch_off_callback"].length>0)
448
- eval("parent."+this.settings["EA_file_switch_off_callback"]+"(param);");
449
- break;
450
- case "file_close":
451
- if(this.settings["EA_file_close_callback"].length>0)
452
- return eval("parent."+this.settings["EA_file_close_callback"]+"(param);");
453
- break;
454
-
455
- default:
456
- if(typeof(eval("editArea."+cmd))=="function")
457
- {
458
- if(this.settings["debug"])
459
- eval("editArea."+ cmd +"(param);");
460
- else
461
- try{eval("editArea."+ cmd +"(param);");}catch(e){};
462
- }
463
- }
464
- };
465
-
466
- EditArea.prototype.get_translation= function(word, mode){
467
- if(mode=="template")
468
- return parent.editAreaLoader.translate(word, this.settings["language"], mode);
469
- else
470
- return parent.editAreaLoader.get_word_translation(word, this.settings["language"]);
471
- };
472
-
473
- EditArea.prototype.add_plugin= function(plug_name, plug_obj){
474
- for(var i=0; i<this.settings["plugins"].length; i++){
475
- if(this.settings["plugins"][i]==plug_name){
476
- this.plugins[plug_name]=plug_obj;
477
- plug_obj.baseURL=parent.editAreaLoader.baseURL + "plugins/" + plug_name + "/";
478
- if( typeof(plug_obj.init)=="function" )
479
- plug_obj.init();
480
- }
481
- }
482
- };
483
-
484
- EditArea.prototype.load_css= function(url){
485
- try{
486
- link = document.createElement("link");
487
- link.type = "text/css";
488
- link.rel= "stylesheet";
489
- link.media="all";
490
- link.href = url;
491
- head = document.getElementsByTagName("head");
492
- head[0].appendChild(link);
493
- }catch(e){
494
- document.write("<link href='"+ url +"' rel='stylesheet' type='text/css' />");
495
- }
496
- };
497
-
498
- EditArea.prototype.load_script= function(url){
499
- try{
500
- script = document.createElement("script");
501
- script.type = "text/javascript";
502
- script.src = url;
503
- script.charset= "UTF-8";
504
- head = document.getElementsByTagName("head");
505
- head[0].appendChild(script);
506
- }catch(e){
507
- document.write("<script type='text/javascript' src='" + url + "' charset=\"UTF-8\"><"+"/script>");
508
- }
509
- };
510
-
511
- // add plugin translation to language translation array
512
- EditArea.prototype.add_lang= function(language, values){
513
- if(!parent.editAreaLoader.lang[language])
514
- parent.editAreaLoader.lang[language]={};
515
- for(var i in values)
516
- parent.editAreaLoader.lang[language][i]= values[i];
517
- };
518
-
519
- // short cut for document.getElementById()
520
- function _$(id){return document.getElementById( id );};
521
-
522
- var editArea = new EditArea();
523
- parent.editAreaLoader.add_event(window, "load", init);
524
-
525
- function init(){
526
- setTimeout("editArea.init(); ", 10);
527
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/edit_area_compressor.php DELETED
@@ -1,428 +0,0 @@
1
- <?php
2
- /******
3
- *
4
- * EditArea PHP compressor
5
- * Developped by Christophe Dolivet
6
- * Released under LGPL, Apache and BSD licenses
7
- * v1.1.3 (2007/01/18)
8
- *
9
- ******/
10
-
11
- // CONFIG
12
- $param['cache_duration']= 3600 * 24 * 10; // 10 days util client cache expires
13
- $param['compress'] = true; // enable the code compression, should be activated but it can be usefull to desactivate it for easier error retrieving (true or false)
14
- $param['debug'] = false; // Enable this option if you need debuging info
15
- $param['use_disk_cache']= true; // If you enable this option gzip files will be cached on disk.
16
- $param['use_gzip']= true; // Enable gzip compression
17
- // END CONFIG
18
-
19
- $compressor= new Compressor($param);
20
-
21
- class Compressor{
22
-
23
-
24
- function compressor($param)
25
- {
26
- $this->__construct($param);
27
- }
28
-
29
- function __construct($param)
30
- {
31
- $this->start_time= $this->get_microtime();
32
- $this->file_loaded_size=0;
33
- $this->param= $param;
34
- $this->script_list="";
35
- $this->path= dirname(__FILE__)."/";
36
- if(isset($_GET['plugins'])){
37
- $this->load_all_plugins= true;
38
- $this->full_cache_file= $this->path."edit_area_full_with_plugins.js";
39
- $this->gzip_cache_file= $this->path."edit_area_full_with_plugins.gz";
40
- }else{
41
- $this->load_all_plugins= false;
42
- $this->full_cache_file= $this->path."edit_area_full.js";
43
- $this->gzip_cache_file= $this->path."edit_area_full.gz";
44
- }
45
-
46
- $this->check_gzip_use();
47
- $this->send_headers();
48
- $this->check_cache();
49
- $this->load_files();
50
- $this->send_datas();
51
- }
52
-
53
- function send_headers()
54
- {
55
- header("Content-type: text/javascript; charset: UTF-8");
56
- header("Vary: Accept-Encoding"); // Handle proxies
57
- header(sprintf("Expires: %s GMT", gmdate("D, d M Y H:i:s", time() + $this->param['cache_duration'])) );
58
- if($this->use_gzip)
59
- header("Content-Encoding: ".$this->gzip_enc_header);
60
- }
61
-
62
- function check_gzip_use()
63
- {
64
- $encodings = array();
65
- $desactivate_gzip=false;
66
-
67
- if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
68
- $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
69
-
70
- // desactivate gzip for IE version < 7
71
- if(preg_match("/(?:msie )([0-9.]+)/i", $_SERVER['HTTP_USER_AGENT'], $ie))
72
- {
73
- if($ie[1]<7)
74
- $desactivate_gzip=true;
75
- }
76
-
77
- // Check for gzip header or northon internet securities
78
- if (!$desactivate_gzip && $this->param['use_gzip'] && (in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
79
- $this->gzip_enc_header= in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
80
- $this->use_gzip=true;
81
- $this->cache_file=$this->gzip_cache_file;
82
- }else{
83
- $this->use_gzip=false;
84
- $this->cache_file=$this->full_cache_file;
85
- }
86
- }
87
-
88
- function check_cache()
89
- {
90
- // Only gzip the contents if clients and server support it
91
- if (file_exists($this->cache_file)) {
92
- // check if cache file must be updated
93
- $cache_date=0;
94
- if ($dir = opendir($this->path)) {
95
- while (($file = readdir($dir)) !== false) {
96
- if(is_file($this->path.$file) && $file!="." && $file!="..")
97
- $cache_date= max($cache_date, filemtime($this->path.$file));
98
- }
99
- closedir($dir);
100
- }
101
- if($this->load_all_plugins){
102
- $plug_path= $this->path."plugins/";
103
- if (($dir = @opendir($plug_path)) !== false)
104
- {
105
- while (($file = readdir($dir)) !== false)
106
- {
107
- if ($file !== "." && $file !== "..")
108
- {
109
- if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js"))
110
- $cache_date= max($cache_date, filemtime("plugins/".$file."/".$file.".js"));
111
- }
112
- }
113
- closedir($dir);
114
- }
115
- }
116
-
117
- if(filemtime($this->cache_file) >= $cache_date){
118
- // if cache file is up to date
119
- $last_modified = gmdate("D, d M Y H:i:s",filemtime($this->cache_file))." GMT";
120
- if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && strcasecmp($_SERVER["HTTP_IF_MODIFIED_SINCE"], $last_modified) === 0)
121
- {
122
- header("HTTP/1.1 304 Not Modified");
123
- header("Last-modified: ".$last_modified);
124
- header("Cache-Control: Public"); // Tells HTTP 1.1 clients to cache
125
- header("Pragma:"); // Tells HTTP 1.0 clients to cache
126
- }
127
- else
128
- {
129
- header("Last-modified: ".$last_modified);
130
- header("Cache-Control: Public"); // Tells HTTP 1.1 clients to cache
131
- header("Pragma:"); // Tells HTTP 1.0 clients to cache
132
- header('Content-Length: '.filesize($this->cache_file));
133
- echo file_get_contents($this->cache_file);
134
- }
135
- die;
136
- }
137
- }
138
- return false;
139
- }
140
-
141
- function load_files()
142
- {
143
- $loader= $this->get_content("edit_area_loader.js")."\n";
144
-
145
- // get the list of other files to load
146
- $loader= preg_replace("/(t\.scripts_to_load=\s*)\[([^\]]*)\];/e"
147
- , "\$this->replace_scripts('script_list', '\\1', '\\2')"
148
- , $loader);
149
-
150
- $loader= preg_replace("/(t\.sub_scripts_to_load=\s*)\[([^\]]*)\];/e"
151
- , "\$this->replace_scripts('sub_script_list', '\\1', '\\2')"
152
- , $loader);
153
-
154
- // replace languages names
155
- $reg_path= $this->path."reg_syntax/";
156
- $a_displayName = array();
157
- if (($dir = @opendir($reg_path)) !== false)
158
- {
159
- while (($file = readdir($dir)) !== false)
160
- {
161
- if( $file !== "." && $file !== ".." && ( $pos = strpos( $file, '.js' ) ) !== false )
162
- {
163
- $jsContent = $this->file_get_contents( $reg_path.$file );
164
- if( preg_match( '@(\'|")DISPLAY_NAME\1\s*:\s*(\'|")(.*)\2@', $jsContent, $match ) )
165
- {
166
- $a_displayName[] = "'". substr( $file, 0, $pos ) ."':'". htmlspecialchars( $match[3], ENT_QUOTES ) ."'";
167
- }
168
- }
169
- }
170
- closedir($dir);
171
- }
172
- $loader = str_replace( '/*syntax_display_name_AUTO-FILL-BY-COMPRESSOR*/', implode( ",", $a_displayName ), $loader );
173
-
174
- $this->datas= $loader;
175
- $this->compress_javascript($this->datas);
176
-
177
- // load other scripts needed for the loader
178
- preg_match_all('/"([^"]*)"/', $this->script_list, $match);
179
- foreach($match[1] as $key => $value)
180
- {
181
- $content= $this->get_content(preg_replace("/\\|\//i", "", $value).".js");
182
- $this->compress_javascript($content);
183
- $this->datas.= $content."\n";
184
- }
185
- //$this->datas);
186
- //$this->datas= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', "", $this->datas);
187
-
188
- // improved compression step 1/2
189
- $this->datas= preg_replace(array("/(\b)EditAreaLoader(\b)/", "/(\b)editAreaLoader(\b)/", "/(\b)editAreas(\b)/"), array("EAL", "eAL", "eAs"), $this->datas);
190
- //$this->datas= str_replace(array("EditAreaLoader", "editAreaLoader", "editAreas"), array("EAL", "eAL", "eAs"), $this->datas);
191
- $this->datas.= "var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;";
192
-
193
- // load sub scripts
194
- $sub_scripts="";
195
- $sub_scripts_list= array();
196
- preg_match_all('/"([^"]*)"/', $this->sub_script_list, $match);
197
- foreach($match[1] as $value){
198
- $sub_scripts_list[]= preg_replace("/\\|\//i", "", $value).".js";
199
- }
200
-
201
- if($this->load_all_plugins){
202
- // load plugins scripts
203
- $plug_path= $this->path."plugins/";
204
- if (($dir = @opendir($plug_path)) !== false)
205
- {
206
- while (($file = readdir($dir)) !== false)
207
- {
208
- if ($file !== "." && $file !== "..")
209
- {
210
- if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js"))
211
- $sub_scripts_list[]= "plugins/".$file."/".$file.".js";
212
- }
213
- }
214
- closedir($dir);
215
- }
216
- }
217
-
218
- foreach($sub_scripts_list as $value){
219
- $sub_scripts.= $this->get_javascript_content($value);
220
- }
221
- // improved compression step 2/2
222
- $sub_scripts= preg_replace(array("/(\b)editAreaLoader(\b)/", "/(\b)editAreas(\b)/", "/(\b)editArea(\b)/", "/(\b)EditArea(\b)/"), array("eAL", "eAs", "eA", "EA"), $sub_scripts);
223
- // $sub_scripts= str_replace(array("editAreaLoader", "editAreas", "editArea", "EditArea"), array("eAL", "eAs", "eA", "EA"), $sub_scripts);
224
- $sub_scripts.= "var editArea= eA;EditArea=EA;";
225
-
226
-
227
- // add the scripts
228
- // $this->datas.= sprintf("editAreaLoader.iframe_script= \"<script type='text/javascript'>%s</script>\";\n", $sub_scripts);
229
-
230
-
231
- // add the script and use a last compression
232
- if( $this->param['compress'] )
233
- {
234
- $last_comp = array( 'Á' => 'this',
235
- 'Â' => 'textarea',
236
- 'Ã' => 'function',
237
- 'Ä' => 'prototype',
238
- 'Å' => 'settings',
239
- 'Æ' => 'length',
240
- 'Ç' => 'style',
241
- 'È' => 'parent',
242
- 'É' => 'last_selection',
243
- 'Ê' => 'value',
244
- 'Ë' => 'true',
245
- 'Ì' => 'false'
246
- /*,
247
- 'Î' => '"',
248
- 'Ï' => "\n",
249
- 'À' => "\r"*/);
250
- }
251
- else
252
- {
253
- $last_comp = array();
254
- }
255
-
256
- $js_replace= '';
257
- foreach( $last_comp as $key => $val )
258
- $js_replace .= ".replace(/". $key ."/g,'". str_replace( array("\n", "\r"), array('\n','\r'), $val ) ."')";
259
-
260
- $this->datas.= sprintf("editAreaLoader.iframe_script= \"<script type='text/javascript'>%s</script>\"%s;\n",
261
- str_replace( array_values($last_comp), array_keys($last_comp), $sub_scripts ),
262
- $js_replace);
263
-
264
- if($this->load_all_plugins)
265
- $this->datas.="editAreaLoader.all_plugins_loaded=true;\n";
266
-
267
-
268
- // load the template
269
- $this->datas.= sprintf("editAreaLoader.template= \"%s\";\n", $this->get_html_content("template.html"));
270
- // load the css
271
- $this->datas.= sprintf("editAreaLoader.iframe_css= \"<style>%s</style>\";\n", $this->get_css_content("edit_area.css"));
272
-
273
- // $this->datas= "function editArea(){};editArea.prototype.loader= function(){alert('bouhbouh');} var a= new editArea();a.loader();";
274
-
275
- }
276
-
277
- function send_datas()
278
- {
279
- if($this->param['debug']){
280
- $header=sprintf("/* USE PHP COMPRESSION\n");
281
- $header.=sprintf("javascript size: based files: %s => PHP COMPRESSION => %s ", $this->file_loaded_size, strlen($this->datas));
282
- if($this->use_gzip){
283
- $gzip_datas= gzencode($this->datas, 9, FORCE_GZIP);
284
- $header.=sprintf("=> GZIP COMPRESSION => %s", strlen($gzip_datas));
285
- $ratio = round(100 - strlen($gzip_datas) / $this->file_loaded_size * 100.0);
286
- }else{
287
- $ratio = round(100 - strlen($this->datas) / $this->file_loaded_size * 100.0);
288
- }
289
- $header.=sprintf(", reduced by %s%%\n", $ratio);
290
- $header.=sprintf("compression time: %s\n", $this->get_microtime()-$this->start_time);
291
- $header.=sprintf("%s\n", implode("\n", $this->infos));
292
- $header.=sprintf("*/\n");
293
- $this->datas= $header.$this->datas;
294
- }
295
- $mtime= time(); // ensure that the 2 disk files will have the same update time
296
- // generate gzip file and cahce it if using disk cache
297
- if($this->use_gzip){
298
- $this->gzip_datas= gzencode($this->datas, 9, FORCE_GZIP);
299
- if($this->param['use_disk_cache'])
300
- $this->file_put_contents($this->gzip_cache_file, $this->gzip_datas, $mtime);
301
- }
302
-
303
- // generate full js file and cache it if using disk cache
304
- if($this->param['use_disk_cache'])
305
- $this->file_put_contents($this->full_cache_file, $this->datas, $mtime);
306
-
307
- // generate output
308
- if($this->use_gzip)
309
- echo $this->gzip_datas;
310
- else
311
- echo $this->datas;
312
-
313
- // die;
314
- }
315
-
316
-
317
- function get_content($end_uri)
318
- {
319
- $end_uri=preg_replace("/\.\./", "", $end_uri); // Remove any .. (security)
320
- $file= $this->path.$end_uri;
321
- if(file_exists($file)){
322
- $this->infos[]=sprintf("'%s' loaded", $end_uri);
323
- /*$fd = fopen($file, 'rb');
324
- $content = fread($fd, filesize($file));
325
- fclose($fd);
326
- return $content;*/
327
- return $this->file_get_contents($file);
328
- }else{
329
- $this->infos[]=sprintf("'%s' not loaded", $end_uri);
330
- return "";
331
- }
332
- }
333
-
334
- function get_javascript_content($end_uri)
335
- {
336
- $val=$this->get_content($end_uri);
337
-
338
- $this->compress_javascript($val);
339
- $this->prepare_string_for_quotes($val);
340
- return $val;
341
- }
342
-
343
- function compress_javascript(&$code)
344
- {
345
- if($this->param['compress'])
346
- {
347
- // remove all comments
348
- // (\"(?:[^\"\\]*(?:\\\\)*(?:\\\"?)?)*(?:\"|$))|(\'(?:[^\'\\]*(?:\\\\)*(?:\\'?)?)*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))
349
- $code= preg_replace("/(\"(?:[^\"\\\\]*(?:\\\\\\\\)*(?:\\\\\"?)?)*(?:\"|$))|(\'(?:[^\'\\\\]*(?:\\\\\\\\)*(?:\\\\\'?)?)*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "$1$2$3", $code);
350
- // remove line return, empty line and tabulation
351
- $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', " ", $code);
352
- // add line break before "else" otherwise navigators can't manage to parse the file
353
- $code= preg_replace('/(\b(else)\b)/', "\n$1", $code);
354
- // remove unnecessary spaces
355
- $code= preg_replace('/( |\t|\r)*(;|\{|\}|=|==|\-|\+|,|\(|\)|\|\||&\&|\:)( |\t|\r)*/', "$2", $code);
356
- }
357
- }
358
-
359
- function get_css_content($end_uri){
360
- $code=$this->get_content($end_uri);
361
- // remove comments
362
- $code= preg_replace("/(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "", $code);
363
- // remove spaces
364
- $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', "", $code);
365
- // remove spaces
366
- $code= preg_replace('/( |\t|\r)?(\:|,|\{|\})( |\t|\r)+/', "$2", $code);
367
-
368
- $this->prepare_string_for_quotes($code);
369
- return $code;
370
- }
371
-
372
- function get_html_content($end_uri){
373
- $code=$this->get_content($end_uri);
374
- //$code= preg_replace('/(\"(?:\\\"|[^\"])*(?:\"|$))|' . "(\'(?:\\\'|[^\'])*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "$1$2$3", $code);
375
- $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', " ", $code);
376
- $this->prepare_string_for_quotes($code);
377
- return $code;
378
- }
379
-
380
- function prepare_string_for_quotes(&$str){
381
- // prepare the code to be putted into quotes
382
- /*$pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/");
383
- $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\\\n"$1+"');*/
384
- $pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/");
385
- if($this->param['compress'])
386
- $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\n');
387
- else
388
- $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , "\\n\"\n+\"");
389
- $str= preg_replace($pattern, $replace, $str);
390
- }
391
-
392
- function replace_scripts($var, $param1, $param2)
393
- {
394
- $this->$var=stripslashes($param2);
395
- return $param1."[];";
396
- }
397
-
398
- /* for php version that have not thoses functions */
399
- function file_get_contents($file)
400
- {
401
- $fd = fopen($file, 'rb');
402
- $content = fread($fd, filesize($file));
403
- fclose($fd);
404
- $this->file_loaded_size+= strlen($content);
405
- return $content;
406
- }
407
-
408
- function file_put_contents($file, &$content, $mtime=-1)
409
- {
410
- if($mtime==-1)
411
- $mtime=time();
412
- $fp = @fopen($file, "wb");
413
- if ($fp) {
414
- fwrite($fp, $content);
415
- fclose($fp);
416
- touch($file, $mtime);
417
- return true;
418
- }
419
- return false;
420
- }
421
-
422
- function get_microtime()
423
- {
424
- list($usec, $sec) = explode(" ", microtime());
425
- return ((float)$usec + (float)$sec);
426
- }
427
- }
428
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/edit_area_full.gz DELETED
Binary file
includes/edit_area/edit_area_full.js DELETED
@@ -1,38 +0,0 @@
1
- function EAL(){var t=this;t.version="0.8.2";date=new Date();t.start_time=date.getTime();t.win="loading";t.error=false;t.baseURL="";t.template="";t.lang={};t.load_syntax={};t.syntax={};t.loadedFiles=[];t.waiting_loading={};t.scripts_to_load=[];t.sub_scripts_to_load=[];t.syntax_display_name={'basic':'Basic','brainfuck':'Brainfuck','c':'C','coldfusion':'Coldfusion','cpp':'CPP','css':'CSS','html':'HTML','java':'Java','js':'Javascript','pas':'Pascal','perl':'Perl','php':'Php','python':'Python','robotstxt':'Robots txt','ruby':'Ruby','sql':'SQL','tsql':'T-SQL','vb':'Visual Basic','xml':'XML'};t.resize=[];t.hidden={};t.default_settings={debug:false,smooth_selection:true,font_size:"10",font_family:"monospace",start_highlight:false,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,word_wrap,|,help",begin_toolbar:"",end_toolbar:"",is_multi_files:false,allow_resize:"both",show_line_colors:false,min_width:400,min_height:125,replace_tab_by_spaces:false,allow_toggle:true,language:"en",syntax:"",syntax_selection_allow:"basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml",display:"onload",max_undo:30,browsers:"known",plugins:"",gecko_spellcheck:false,fullscreen:false,is_editable:true,cursor_position:"begin",word_wrap:false,autocompletion:false,load_callback:"",save_callback:"",change_callback:"",submit_callback:"",EA_init_callback:"",EA_delete_callback:"",EA_load_callback:"",EA_unload_callback:"",EA_toggle_on_callback:"",EA_toggle_off_callback:"",EA_file_switch_on_callback:"",EA_file_switch_off_callback:"",EA_file_close_callback:""};t.advanced_buttons=[ ['new_document','newdocument.gif','new_document',false],['search','search.gif','show_search',false],['go_to_line','go_to_line.gif','go_to_line',false],['undo','undo.gif','undo',true],['redo','redo.gif','redo',true],['change_smooth_selection','smooth_selection.gif','change_smooth_selection_mode',true],['reset_highlight','reset_highlight.gif','resync_highlight',true],['highlight','highlight.gif','change_highlight',true],['help','help.gif','show_help',false],['save','save.gif','save',false],['load','load.gif','load',false],['fullscreen','fullscreen.gif','toggle_full_screen',false],['word_wrap','word_wrap.gif','toggle_word_wrap',true],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];t.set_browser_infos(t);if(t.isIE>=6||t.isGecko||(t.isWebKit&&!t.isSafari<3)||t.isOpera>=9||t.isCamino)t.isValidBrowser=true;
2
- else t.isValidBrowser=false;t.set_base_url();for(var i=0;i<t.scripts_to_load.length;i++){setTimeout("eAL.load_script('"+t.baseURL+t.scripts_to_load[i]+".js');",1);t.waiting_loading[t.scripts_to_load[i]+".js"]=false;}t.add_event(window,"load",EAL.prototype.window_loaded);};EAL.prototype={has_error:function(){this.error=true;for(var i in EAL.prototype){EAL.prototype[i]=function(){};}},set_browser_infos:function(o){ua=navigator.userAgent;o.isWebKit=/WebKit/.test(ua);o.isGecko=!o.isWebKit&&/Gecko/.test(ua);o.isMac=/Mac/.test(ua);o.isIE=(navigator.appName=="Microsoft Internet Explorer");if(o.isIE){o.isIE=ua.replace(/^.*?MSIE\s+([0-9\.]+).*$/,"$1");if(o.isIE<6)o.has_error();}if(o.isOpera=(ua.indexOf('Opera')!=-1)){o.isOpera=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(o.isOpera<9)o.has_error();o.isIE=false;}if(o.isFirefox=(ua.indexOf('Firefox')!=-1))o.isFirefox=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('Iceweasel')!=-1)o.isFirefox=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('GranParadiso')!=-1)o.isFirefox=ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('BonEcho')!=-1)o.isFirefox=ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('SeaMonkey')!=-1)o.isFirefox=(ua.replace(/^.*?SeaMonkey.*?([0-9\.]+).*$/i,"$1"))+1;if(o.isCamino=(ua.indexOf('Camino')!=-1))o.isCamino=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(o.isSafari=(ua.indexOf('Safari')!=-1))o.isSafari=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(o.isChrome=(ua.indexOf('Chrome')!=-1)){o.isChrome=ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i,"$1");o.isSafari=false;}},window_loaded:function(){eAL.win="loaded";if(document.forms){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];form.edit_area_replaced_submit=null;try{form.edit_area_replaced_submit=form.onsubmit;form.onsubmit="";}catch(e){}eAL.add_event(form,"submit",EAL.prototype.submit);eAL.add_event(form,"reset",EAL.prototype.reset);}}eAL.add_event(window,"unload",function(){for(var i in eAs){eAL.delete_instance(i);}});},init_ie_textarea:function(id){var a=document.getElementById(id);try{if(a&&typeof(a.focused)=="undefined"){a.focus();a.focused=true;a.selectionStart=a.selectionEnd=0;get_IE_selection(a);eAL.add_event(a,"focus",IE_textarea_focus);eAL.add_event(a,"blur",IE_textarea_blur);}}catch(ex){}},init:function(settings){var t=this,s=settings,i;if(!s["id"])t.has_error();if(t.error)return;if(eAs[s["id"]])t.delete_instance(s["id"]);for(i in t.default_settings){if(typeof(s[i])=="undefined")s[i]=t.default_settings[i];}if(s["browsers"]=="known"&&t.isValidBrowser==false){return;}if(s["begin_toolbar"].length>0)s["toolbar"]=s["begin_toolbar"]+","+s["toolbar"];if(s["end_toolbar"].length>0)s["toolbar"]=s["toolbar"]+","+s["end_toolbar"];s["tab_toolbar"]=s["toolbar"].replace(/ /g,"").split(",");s["plugins"]=s["plugins"].replace(/ /g,"").split(",");for(i=0;i<s["plugins"].length;i++){if(s["plugins"][i].length==0)s["plugins"].splice(i,1);}t.get_template();t.load_script(t.baseURL+"langs/"+s["language"]+".js");if(s["syntax"].length>0){s["syntax"]=s["syntax"].toLowerCase();t.load_script(t.baseURL+"reg_syntax/"+s["syntax"]+".js");}eAs[s["id"]]={"settings":s};eAs[s["id"]]["displayed"]=false;eAs[s["id"]]["hidden"]=false;t.start(s["id"]);},delete_instance:function(id){var d=document,fs=window.frames,span,iframe;eAL.execCommand(id,"EA_delete");if(fs["frame_"+id]&&fs["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");fs["frame_"+id].editArea.execCommand("EA_unload");}span=d.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);iframe=d.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete fs["frame_"+id];}catch(e){}}delete eAs[id];},start:function(id){var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;if(t.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(i in t.waiting_loading){if(t.waiting_loading[i]!="loaded"&&typeof(t.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!t.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!t.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)t.init_syntax_regexp();if(!d.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){span=d.createElement("span");span.id="EditAreaArroundInfos_"+id;if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked='checked'":"";html+="<div id='edit_area_toggle_"+i+"'>";html+="<input id='edit_area_toggle_checkbox_"+id+"' class='toggle_"+id+"' type='checkbox' onclick='eAL.toggle(\""+id+"\");' accesskey='e' "+checked+" />";html+="<label for='edit_area_toggle_checkbox_"+id+"'>{$toggle}</label></div>";}if(eAs[id]["settings"]["debug"])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 />";html=t.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;father=d.getElementById(id).parentNode;next=d.getElementById(id).nextSibling;if(next==null)father.appendChild(span);
3
- else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){t.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(t.isIE){t.init_ie_textarea(id);}var area=eAs[id];for(i=0;i<area["settings"]["tab_toolbar"].length;i++){html_toolbar_content+=t.get_control_html(area["settings"]["tab_toolbar"][i],area["settings"]["language"]);}html_toolbar_content=t.translate(html_toolbar_content,area["settings"]["language"],"template");if(!t.iframe_script){t.iframe_script="";for(i=0;i<t.sub_scripts_to_load.length;i++)t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+t.sub_scripts_to_load[i]+'.js"></script>';}for(i=0;i<area["settings"]["plugins"].length;i++){if(!t.all_plugins_loaded)t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/'+area["settings"]["plugins"][i]+'.js"></script>';t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/langs/'+area["settings"]["language"]+'.js"></script>';}if(!t.iframe_css){t.iframe_css="<link href='"+t.baseURL+"edit_area.css' rel='stylesheet' type='text/css' />";}template=t.template.replace(/\[__BASEURL__\]/g,t.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=t.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",t.iframe_css);template=template.replace("[__JSCODE__]",t.iframe_script);template=template.replace("[__EA_VERSION__]",t.version);area.textarea=d.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];father=area.textarea.parentNode;content=d.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";next=area.textarea.nextSibling;if(next==null)father.appendChild(content);
4
- else father.insertBefore(content,next);f=window.frames["frame_"+area["settings"]["id"]];f.document.open();f.eAs=eAs;f.area_id=area["settings"]["id"];f.document.area_id=area["settings"]["id"];f.document.write(template);f.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true&&toggle_to=="off"){this.toggle_off(id);}
5
- else if(eAs[id]["displayed"]==false&&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];if(f.editArea.fullscreen['isFull'])f.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;t.wrap="off";setAttribute(t,"wrap","off");parNod=t.parentNode;nxtSib=t.nextSibling;parNod.removeChild(t);parNod.insertBefore(t,nxtSib);t.value=f.editArea.textarea.value;selStart=f.editArea.last_selection["selectionStart"];selEnd=f.editArea.last_selection["selectionEnd"];scrollTop=f.document.getElementById("result").scrollTop;scrollLeft=f.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';t.style.display="inline";try{t.focus();}catch(e){};if(this.isIE){t.selectionStart=selStart;t.selectionEnd=selEnd;t.focused=true;set_IE_selection(t);}
6
- else{if(this.isOpera&&this.isOpera < 9.6){t.setSelectionRange(0,0);}try{t.setSelectionRange(selStart,selEnd);}catch(e){};}t.scrollTop=scrollTop;t.scrollLeft=scrollLeft;f.editArea.execCommand("toggle_off");}},toggle_on:function(id){var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];area=f.editArea;area.textarea.value=t.value;curPos=eAs[id]["settings"]["cursor_position"];if(t.use_last==true){selStart=t.last_selectionStart;selEnd=t.last_selectionEnd;scrollTop=t.last_scrollTop;scrollLeft=t.last_scrollLeft;t.use_last=false;}
7
- else if(curPos=="auto"){try{selStart=t.selectionStart;selEnd=t.selectionEnd;scrollTop=t.scrollTop;scrollLeft=t.scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id,document.getElementById("frame_"+id));t.style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");f.document.getElementById("result").scrollTop=scrollTop;f.document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart,selEnd-selStart);area.execCommand("toggle_on");}
8
- else{elem=document.getElementById(id);elem.last_selectionStart=elem.selectionStart;elem.last_selectionEnd=elem.selectionEnd;elem.last_scrollTop=elem.scrollTop;elem.last_scrollLeft=elem.scrollLeft;elem.use_last=true;eAL.start(id);}},set_editarea_size_from_textarea:function(id,frame){var elem,width,height;elem=document.getElementById(id);width=Math.max(eAs[id]["settings"]["min_width"],elem.offsetWidth)+"px";height=Math.max(eAs[id]["settings"]["min_height"],elem.offsetHeight)+"px";if(elem.style.width.indexOf("%")!=-1)width=elem.style.width;if(elem.style.height.indexOf("%")!=-1)height=elem.style.height;frame.style.width=width;frame.style.height=height;},set_base_url:function(){var t=this,elems,i,docBasePath;if(!this.baseURL){elems=document.getElementsByTagName('script');for(i=0;i<elems.length;i++){if(elems[i].src&&elems[i].src.match(/edit_area_[^\\\/]*$/i)){var src=unescape(elems[i].src);src=src.substring(0,src.lastIndexOf('/'));this.baseURL=src;this.file_name=elems[i].src.substr(elems[i].src.lastIndexOf("/")+1);break;}}}docBasePath=document.location.href;if(docBasePath.indexOf('?')!=-1)docBasePath=docBasePath.substring(0,docBasePath.indexOf('?'));docBasePath=docBasePath.substring(0,docBasePath.lastIndexOf('/'));if(t.baseURL.indexOf('://')==-1&&t.baseURL.charAt(0)!='/'){t.baseURL=docBasePath+"/"+t.baseURL;}t.baseURL+="/";},get_button_html:function(id,img,exec,isFileSpecific,baseURL){var cmd,html;if(!baseURL)baseURL=this.baseURL;cmd='editArea.execCommand(\''+exec+'\')';html='<a id="a_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+';return false;" onmousedown="return false;" target="_self" fileSpecific="'+(isFileSpecific?'yes':'no')+'">';html+='<img id="'+id+'" src="'+baseURL+'images/'+img+'" title="{$'+id+'}" width="20" height="20" class="editAreaButtonNormal" onmouseover="editArea.switchClass(this,\'editAreaButtonOver\');" onmouseout="editArea.restoreClass(this);" onmousedown="editArea.restoreAndSwitchClass(this,\'editAreaButtonDown\');" /></a>';return html;},get_control_html:function(button_name,lang){var t=this,i,but,html,si;for(i=0;i<t.advanced_buttons.length;i++){but=t.advanced_buttons[i];if(but[0]==button_name){return t.get_button_html(but[0],but[1],but[2],but[3]);}}switch(button_name){case "*":case "return":return "<br />";case "|":case "separator":return '<img src="'+t.baseURL+'images/spacer.gif" width="1" height="15" class="editAreaSeparatorLine">';case "select_font":html="<select id='area_font_size' onchange='javascript:editArea.execCommand(\"change_font_size\")' fileSpecific='yes'>";html+="<option value='-1'>{$font_size}</option>";si=[8,9,10,11,12,14];for(i=0;i<si.length;i++){html+="<option value='"+si[i]+"'>"+si[i]+" pt</option>";}html+="</select>";return html;case "syntax_selection":html="<select id='syntax_selection' onchange='javascript:editArea.execCommand(\"change_syntax\",this.value)' fileSpecific='yes'>";html+="<option value='-1'>{$syntax_selection}</option>";html+="</select>";return html;}return "<span id='tmp_tool_"+button_name+"'>["+button_name+"]</span>";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest();
9
- else if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP");
10
- else{alert("XMLHTTPRequest not supported. EditArea not loaded");return;}xhr_object.open("GET",this.baseURL+"template.html",false);xhr_object.send(null);if(xhr_object.readyState==4)this.template=xhr_object.responseText;
11
- else this.has_error();}},translate:function(text,lang,mode){if(mode=="word")text=eAL.get_word_translation(text,lang);
12
- else if(mode="template"){eAL.current_language=lang;text=text.replace(/\{\$([^\}]+)\}/gm,eAL.translate_template);}return text;},translate_template:function(){return eAL.get_word_translation(EAL.prototype.translate_template.arguments[1],eAL.current_language);},get_word_translation:function(val,lang){var i;for(i in eAL.lang[lang]){if(i==val)return eAL.lang[lang][i];}return "_"+val;},load_script:function(url){var t=this,d=document,script,head;if(t.loadedFiles[url])return;try{script=d.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";d.getElementsByTagName("head")[0].appendChild(script);}catch(e){d.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'" charset="UTF-8"></sc'+'ript>');}t.loadedFiles[url]=true;},add_event:function(obj,name,handler){try{if(obj.attachEvent){obj.attachEvent("on"+name,handler);}
13
- else{obj.addEventListener(name,handler,false);}}catch(e){}},remove_event:function(obj,name,handler){try{if(obj.detachEvent)obj.detachEvent("on"+name,handler);
14
- else obj.removeEventListener(name,handler,false);}catch(e){}},reset:function(e){var formObj,is_child,i,x;formObj=eAL.isIE ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(i in eAs){is_child=false;for(x=0;x<formObj.elements.length;x++){if(formObj.elements[x].id==i)is_child=true;}if(window.frames["frame_"+i]&&is_child&&eAs[i]["displayed"]==true){var exec='window.frames["frame_'+i+'"].editArea.textarea.value=document.getElementById("'+i+'").value;';exec+='window.frames["frame_'+i+'"].editArea.execCommand("focus");';exec+='window.frames["frame_'+i+'"].editArea.check_line_selection();';exec+='window.frames["frame_'+i+'"].editArea.execCommand("reset");';window.setTimeout(exec,10);}}return;},submit:function(e){var formObj,is_child,fs=window.frames,i,x;formObj=eAL.isIE ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(i in eAs){is_child=false;for(x=0;x<formObj.elements.length;x++){if(formObj.elements[x].id==i)is_child=true;}if(is_child){if(fs["frame_"+i]&&eAs[i]["displayed"]==true)document.getElementById(i).value=fs["frame_"+i].editArea.textarea.value;eAL.execCommand(i,"EA_submit");}}if(typeof(formObj.edit_area_replaced_submit)=="function"){res=formObj.edit_area_replaced_submit();if(res==false){if(eAL.isIE)return false;
15
- else e.preventDefault();}}return;},getValue:function(id){if(window.frames["frame_"+id]&&eAs[id]["displayed"]==true){return window.frames["frame_"+id].editArea.textarea.value;}
16
- else if(elem=document.getElementById(id)){return elem.value;}return false;},setValue:function(id,new_val){var fs=window.frames;if((f=fs["frame_"+id])&&eAs[id]["displayed"]==true){f.editArea.textarea.value=new_val;f.editArea.execCommand("focus");f.editArea.check_line_selection(false);f.editArea.execCommand("onchange");}
17
- else if(elem=document.getElementById(id)){elem.value=new_val;}},getSelectionRange:function(id){var sel,eA,fs=window.frames;sel={"start":0,"end":0};if(fs["frame_"+id]&&eAs[id]["displayed"]==true){eA=fs["frame_"+id].editArea;sel["start"]=eA.textarea.selectionStart;sel["end"]=eA.textarea.selectionEnd;}
18
- else if(elem=document.getElementById(id)){sel=getSelectionRange(elem);}return sel;},setSelectionRange:function(id,new_start,new_end){var fs=window.frames;if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].editArea.area_select(new_start,new_end-new_start);if(!this.isIE){fs["frame_"+id].editArea.check_line_selection(false);fs["frame_"+id].editArea.scroll_to_view();}}
19
- else if(elem=document.getElementById(id)){setSelectionRange(elem,new_start,new_end);}},getSelectedText:function(id){var sel=this.getSelectionRange(id);return this.getValue(id).substring(sel["start"],sel["end"]);},setSelectedText:function(id,new_val){var fs=window.frames,d=document,sel,text,scrollTop,scrollLeft,new_sel_end;new_val=new_val.replace(/\r/g,"");sel=this.getSelectionRange(id);text=this.getValue(id);if(fs["frame_"+id]&&eAs[id]["displayed"]==true){scrollTop=fs["frame_"+id].document.getElementById("result").scrollTop;scrollLeft=fs["frame_"+id].document.getElementById("result").scrollLeft;}
20
- else{scrollTop=d.getElementById(id).scrollTop;scrollLeft=d.getElementById(id).scrollLeft;}text=text.substring(0,sel["start"])+new_val+text.substring(sel["end"]);this.setValue(id,text);new_sel_end=sel["start"]+new_val.length;this.setSelectionRange(id,sel["start"],new_sel_end);if(new_val !=this.getSelectedText(id).replace(/\r/g,"")){this.setSelectionRange(id,sel["start"],new_sel_end+new_val.split("\n").length-1);}if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].document.getElementById("result").scrollTop=scrollTop;fs["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;fs["frame_"+id].editArea.execCommand("onchange");}
21
- else{d.getElementById(id).scrollTop=scrollTop;d.getElementById(id).scrollLeft=scrollLeft;}},insertTags:function(id,open_tag,close_tag){var old_sel,new_sel;old_sel=this.getSelectionRange(id);text=open_tag+this.getSelectedText(id)+close_tag;eAL.setSelectedText(id,text);new_sel=this.getSelectionRange(id);if(old_sel["end"] > old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]);
22
- else this.setSelectionRange(id,old_sel["start"]+open_tag.length,old_sel["start"]+open_tag.length);},hide:function(id){var fs=window.frames,d=document,t=this,scrollTop,scrollLeft,span;if(d.getElementById(id)&&!t.hidden[id]){t.hidden[id]={};t.hidden[id]["selectionRange"]=t.getSelectionRange(id);if(d.getElementById(id).style.display!="none"){t.hidden[id]["scrollTop"]=d.getElementById(id).scrollTop;t.hidden[id]["scrollLeft"]=d.getElementById(id).scrollLeft;}if(fs["frame_"+id]){t.hidden[id]["toggle"]=eAs[id]["displayed"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){scrollTop=fs["frame_"+id].document.getElementById("result").scrollTop;scrollLeft=fs["frame_"+id].document.getElementById("result").scrollLeft;}
23
- else{scrollTop=d.getElementById(id).scrollTop;scrollLeft=d.getElementById(id).scrollLeft;}t.hidden[id]["scrollTop"]=scrollTop;t.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true)eAL.toggle_off(id);}span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}d.getElementById(id).style.display="none";}},show:function(id){var fs=window.frames,d=document,t=this,span;if((elem=d.getElementById(id))&&t.hidden[id]){elem.style.display="inline";elem.scrollTop=t.hidden[id]["scrollTop"];elem.scrollLeft=t.hidden[id]["scrollLeft"];span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(fs["frame_"+id]){elem.style.display="inline";if(t.hidden[id]["toggle"]==true)eAL.toggle_on(id);scrollTop=t.hidden[id]["scrollTop"];scrollLeft=t.hidden[id]["scrollLeft"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].document.getElementById("result").scrollTop=scrollTop;fs["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;}
24
- else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=t.hidden[id]["selectionRange"];t.setSelectionRange(id,sel["start"],sel["end"]);delete t.hidden[id];}},getCurrentFile:function(id){return this.execCommand(id,'get_file',this.execCommand(id,'curr_file'));},getFile:function(id,file_id){return this.execCommand(id,'get_file',file_id);},getAllFiles:function(id){return this.execCommand(id,'get_all_files()');},openFile:function(id,file_infos){return this.execCommand(id,'open_file',file_infos);},closeFile:function(id,file_id){return this.execCommand(id,'close_file',file_id);},setFileEditedMode:function(id,file_id,to){var reg1,reg2;reg1=new RegExp('\\\\','g');reg2=new RegExp('"','g');return this.execCommand(id,'set_file_edited_mode("'+file_id.replace(reg1,'\\\\').replace(reg2,'\\"')+'",'+to+')');},execCommand:function(id,cmd,fct_param){switch(cmd){case "EA_init":if(eAs[id]['settings']["EA_init_callback"].length>0)eval(eAs[id]['settings']["EA_init_callback"]+"('"+id+"');");break;case "EA_delete":if(eAs[id]['settings']["EA_delete_callback"].length>0)eval(eAs[id]['settings']["EA_delete_callback"]+"('"+id+"');");break;case "EA_submit":if(eAs[id]['settings']["submit_callback"].length>0)eval(eAs[id]['settings']["submit_callback"]+"('"+id+"');");break;}if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(fct_param!=undefined)return eval('window.frames["frame_'+id+'"].editArea.'+cmd+'(fct_param);');
25
- else return eval('window.frames["frame_'+id+'"].editArea.'+cmd+';');}return false;}};var eAL=new EAL();var eAs={}; function getAttribute(elm,aName){var aValue,taName,i;try{aValue=elm.getAttribute(aName);}catch(exept){}if(! aValue){for(i=0;i < elm.attributes.length;i++){taName=elm.attributes[i] .name.toLowerCase();if(taName==aName){aValue=elm.attributes[i] .value;return aValue;}}}return aValue;};function setAttribute(elm,attr,val){if(attr=="class"){elm.setAttribute("className",val);elm.setAttribute("class",val);}
26
- else{elm.setAttribute(attr,val);}};function getChildren(elem,elem_type,elem_attribute,elem_attribute_match,option,depth){if(!option)var option="single";if(!depth)var depth=-1;if(elem){var children=elem.childNodes;var result=null;var results=[];for(var x=0;x<children.length;x++){strTagName=new String(children[x].tagName);children_class="?";if(strTagName!="undefined"){child_attribute=getAttribute(children[x],elem_attribute);if((strTagName.toLowerCase()==elem_type.toLowerCase()||elem_type=="")&&(elem_attribute==""||child_attribute==elem_attribute_match)){if(option=="all"){results.push(children[x]);}
27
- else{return children[x];}}if(depth!=0){result=getChildren(children[x],elem_type,elem_attribute,elem_attribute_match,option,depth-1);if(option=="all"){if(result.length>0){results=results.concat(result);}}
28
- else if(result!=null){return result;}}}}if(option=="all")return results;}return null;};function isChildOf(elem,parent){if(elem){if(elem==parent)return true;while(elem.parentNode !='undefined'){return isChildOf(elem.parentNode,parent);}}return false;};function getMouseX(e){if(e!=null&&typeof(e.pageX)!="undefined"){return e.pageX;}
29
- else{return(e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;}
30
- else{return(e!=null?e.y:event.y)+document.documentElement.scrollTop;}};function calculeOffsetLeft(r){return calculeOffset(r,"offsetLeft")};function calculeOffsetTop(r){return calculeOffset(r,"offsetTop")};function calculeOffset(element,attr){var offset=0;while(element){offset+=element[attr];element=element.offsetParent}return offset;};function get_css_property(elem,prop){if(document.defaultView){return document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop);}
31
- else if(elem.currentStyle){var prop=prop.replace(/-\D/gi,function(sMatch){return sMatch.charAt(sMatch.length-1).toUpperCase();});return elem.currentStyle[prop];}
32
- else return null;}var _mCE;function start_move_element(e,id,frame){var elem_id=(e.target||e.srcElement).id;if(id)elem_id=id;if(!frame)frame=window;if(frame.event)e=frame.event;_mCE=frame.document.getElementById(elem_id);_mCE.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);_mCE.start_pos_x=mouse_x-(_mCE.style.left.replace("px","")||calculeOffsetLeft(_mCE));_mCE.start_pos_y=mouse_y-(_mCE.style.top.replace("px","")||calculeOffsetTop(_mCE));return false;};function end_move_element(e){_mCE.frame.document.onmousemove="";_mCE.frame.document.onmouseup="";_mCE=null;};function move_element(e){var newTop,newLeft,maxLeft;if(_mCE.frame&&_mCE.frame.event)e=_mCE.frame.event;newTop=getMouseY(e)-_mCE.start_pos_y;newLeft=getMouseX(e)-_mCE.start_pos_x;maxLeft=_mCE.frame.document.body.offsetWidth-_mCE.offsetWidth;max_top=_mCE.frame.document.body.offsetHeight-_mCE.offsetHeight;newTop=Math.min(Math.max(0,newTop),max_top);newLeft=Math.min(Math.max(0,newLeft),maxLeft);_mCE.style.top=newTop+"px";_mCE.style.left=newLeft+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return{"start":textarea.selectionStart,"end":textarea.selectionEnd};};function setSelectionRange(t,start,end){t.focus();start=Math.max(0,Math.min(t.value.length,start));end=Math.max(start,Math.min(t.value.length,end));if(nav.isOpera&&nav.isOpera < 9.6){t.selectionEnd=1;t.selectionStart=0;t.selectionEnd=1;t.selectionStart=0;}t.selectionStart=start;t.selectionEnd=end;if(nav.isIE)set_IE_selection(t);};function get_IE_selection(t){var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab;if(t&&t.focused){if(!t.ea_line_height){div=d.createElement("div");div.style.fontFamily=get_css_property(t,"font-family");div.style.fontSize=get_css_property(t,"font-size");div.style.visibility="hidden";div.innerHTML="0";d.body.appendChild(div);t.ea_line_height=div.offsetHeight;d.body.removeChild(div);}range=d.selection.createRange();try{stored_range=range.duplicate();stored_range.moveToElementText(t);stored_range.setEndPoint('EndToEnd',range);if(stored_range.parentElement()==t){elem=t;scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}relative_top=range.offsetTop-calculeOffsetTop(t)+scrollTop;line_start=Math.round((relative_top / t.ea_line_height)+1);line_nb=Math.round(range.boundingHeight / t.ea_line_height);range_start=stored_range.text.length-range.text.length;tab=t.value.substr(0,range_start).split("\n");range_start+=(line_start-tab.length)*2;t.selectionStart=range_start;range_end=t.selectionStart+range.text.length;tab=t.value.substr(0,range_start+range.text.length).split("\n");range_end+=(line_start+line_nb-1-tab.length)*2;t.selectionEnd=range_end;}}catch(e){}}if(t&&t.id){setTimeout("get_IE_selection(document.getElementById('"+t.id+"'));",50);}};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(t){var nbLineStart,nbLineStart,nbLineEnd,range;if(!window.closed){nbLineStart=t.value.substr(0,t.selectionStart).split("\n").length-1;nbLineEnd=t.value.substr(0,t.selectionEnd).split("\n").length-1;try{range=document.selection.createRange();range.moveToElementText(t);range.setEndPoint('EndToStart',range);range.moveStart('character',t.selectionStart-nbLineStart);range.moveEnd('character',t.selectionEnd-nbLineEnd-(t.selectionStart-nbLineStart));range.select();}catch(e){}}};eAL.waiting_loading["elements_functions.js"]="loaded";
33
- EAL.prototype.start_resize_area=function(){var d=document,a,div,width,height,father;d.onmouseup=eAL.end_resize_area;d.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);a=eAs[eAL.resize["id"]]["textarea"];div=d.getElementById("edit_area_resize");if(!div){div=d.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}width=a.offsetWidth-2;height=a.offsetHeight-2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";father=a.parentNode;father.insertBefore(div,a);a.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){var d=document,div,a,width,height;d.onmouseup="";d.onmousemove="";div=d.getElementById("edit_area_resize");a=eAs[eAL.resize["id"]]["textarea"];width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.isIE==6){width-=2;height-=2;}a.style.width=width+"px";a.style.height=height+"px";div.style.display="none";a.style.display="inline";a.selectionStart=eAL.resize["selectionStart"];a.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow,newHeight,newWidth;allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){newHeight=Math.max(20,getMouseY(e)-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=newHeight+"px";}if(allow=="both"||allow=="x"){newWidth=Math.max(20,getMouseX(e)-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=newWidth+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded";
34
- EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i<text_array.length;i++){if(i>0)res+="|";res+=this.get_escaped_regexp(text_array[i]);}res+=")(\\b)";reg=new RegExp(res);return res;};EAL.prototype.get_escaped_regexp=function(str){return str.toString().replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style={};for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]={};this.syntax[lang]["keywords_reg_exp"]={};this.keywords_reg_exp_nb=0;if(this.load_syntax[lang]['KEYWORDS']){param="g";if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false)param+="i";for(var i in this.load_syntax[lang]['KEYWORDS']){if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function")continue;this.syntax[lang]["keywords_reg_exp"][i]=new RegExp(this.get_regexp(this.load_syntax[lang]['KEYWORDS'][i]),param);this.keywords_reg_exp_nb++;}}if(this.load_syntax[lang]['OPERATORS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['OPERATORS']){if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);nb++;}if(str.length>0)this.syntax[lang]["operators_reg_exp"]=new RegExp("("+str+")","g");}if(this.load_syntax[lang]['DELIMITERS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['DELIMITERS']){if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);nb++;}if(str.length>0)this.syntax[lang]["delimiters_reg_exp"]=new RegExp("("+str+")","g");}var syntax_trace=[];this.syntax[lang]["quotes"]={};var quote_tab=[];if(this.load_syntax[lang]['QUOTEMARKS']){for(var i in this.load_syntax[lang]['QUOTEMARKS']){if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);this.syntax[lang]["quotes"][x]=x;quote_tab[quote_tab.length]="("+x+"(\\\\.|[^"+x+"])*(?:"+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]={};if(this.load_syntax[lang]['COMMENT_SINGLE']){for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";syntax_trace.push(x);this.syntax[lang]["comments"][x]="\n";}}if(this.load_syntax[lang]['COMMENT_MULTI']){for(var i in this.load_syntax[lang]['COMMENT_MULTI']){if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function")continue;var start=this.get_escaped_regexp(i);var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";syntax_trace.push(start);syntax_trace.push(end);this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];}}if(quote_tab.length>0)this.syntax[lang]["comment_or_quote_reg_exp"]=new RegExp("("+quote_tab.join("|")+")","gi");if(syntax_trace.length>0)this.syntax[lang]["syntax_trace_regexp"]=new RegExp("((.|\n)*?)(\\\\*("+syntax_trace.join("|")+"|$))","gmi");if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){this.syntax[lang]["script_delimiters"]={};for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function")continue;this.syntax[lang]["script_delimiters"][i]=this.load_syntax[lang]['SCRIPT_DELIMITERS'];}}this.syntax[lang]["custom_regexp"]={};if(this.load_syntax[lang]['REGEXPS']){for(var i in this.load_syntax[lang]['REGEXPS']){if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function")continue;var val=this.load_syntax[lang]['REGEXPS'][i];if(!this.syntax[lang]["custom_regexp"][val['execute']])this.syntax[lang]["custom_regexp"][val['execute']]={};this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp':new RegExp(val['search'],val['modifiers']),'class':val['class']};}}if(this.load_syntax[lang]['STYLES']){lang_style[lang]={};for(var i in this.load_syntax[lang]['STYLES']){if(typeof(this.load_syntax[lang]['STYLES'][i])=="function")continue;if(typeof(this.load_syntax[lang]['STYLES'][i])!="string"){for(var j in this.load_syntax[lang]['STYLES'][i]){lang_style[lang][j]=this.load_syntax[lang]['STYLES'][i][j];}}
35
- else{lang_style[lang][i]=this.load_syntax[lang]['STYLES'][i];}}}var style="";for(var i in lang_style[lang]){if(lang_style[lang][i].length>0){style+="."+lang+" ."+i.toLowerCase()+" span{"+lang_style[lang][i]+"}\n";style+="."+lang+" ."+i.toLowerCase()+"{"+lang_style[lang][i]+"}\n";}}this.syntax[lang]["styles"]=style;}}};eAL.waiting_loading["reg_syntax.js"]="loaded";
36
- var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= "<script type='text/javascript'> Ã EA(){var t=Á;t.error=Ì;t.inlinePopup=[{popup_id:\"area_search_replace\",icon_id:\"search\"},{popup_id:\"edit_area_help\",icon_id:\"help\"}];t.plugins={};t.line_number=0;È.eAL.set_browser_infos(t);if(t.isIE >=8)t.isIE=7;t.É={};t.last_text_to_highlight=\"\";t.last_hightlighted_text=\"\";t.syntax_list=[];t.allready_used_syntax={};t.check_line_selection_timer=50;t.ÂFocused=Ì;t.highlight_selection_line=null;t.previous=[];t.next=[];t.last_undo=\"\";t.files={};t.filesIdAssoc={};t.curr_file='';t.assocBracket={};t.revertAssocBracket={};t.assocBracket[\"(\"]=\")\";t.assocBracket[\"{\"]=\"}\";t.assocBracket[\"[\"]=\"]\";for(var index in t.assocBracket){t.revertAssocBracket[t.assocBracket[index]]=index;}t.is_editable=Ë;t.lineHeight=16;t.tab_nb_char=8;if(t.isOpera)t.tab_nb_char=6;t.is_tabbing=Ì;t.fullscreen={'isFull':Ì};t.isResizing=Ì;t.id=area_id;t.Å=eAs[t.id][\"Å\"];if((\"\"+t.Å['replace_tab_by_spaces']).match(/^[0-9]+$/)){t.tab_nb_char=t.Å['replace_tab_by_spaces'];t.tabulation=\"\";for(var i=0;i<t.tab_nb_char;i++)t.tabulation+=\" \";}\nelse{t.tabulation=\"\t\";}if(t.Å[\"syntax_selection_allow\"]&&t.Å[\"syntax_selection_allow\"].Æ>0)t.syntax_list=t.Å[\"syntax_selection_allow\"].replace(/ /g,\"\").split(\",\");if(t.Å['syntax'])t.allready_used_syntax[t.Å['syntax']]=Ë;};EA.Ä.init=Ã(){var t=Á,a,s=t.Å;t.Â=_$(\"Â\");t.container=_$(\"container\");t.result=_$(\"result\");t.content_highlight=_$(\"content_highlight\");t.selection_field=_$(\"selection_field\");t.selection_field_text=_$(\"selection_field_text\");t.processing_screen=_$(\"processing\");t.editor_area=_$(\"editor\");t.tab_browsing_area=_$(\"tab_browsing_area\");t.test_font_size=_$(\"test_font_size\");a=t.Â;if(!s['is_editable'])t.set_editable(Ì);t.set_show_line_colors(s['show_line_colors']);if(syntax_selec=_$(\"syntax_selection\")){for(var i=0;i<t.syntax_list.Æ;i++){var syntax=t.syntax_list[i];var option=document.createElement(\"option\");option.Ê=syntax;if(syntax==s['syntax'])option.selected=\"selected\";dispSyntax=È.eAL.syntax_display_name[ syntax ];option.innerHTML=typeof(dispSyntax)=='undefined' ? syntax.substring(0,1).toUpperCase()+syntax.substring(1):dispSyntax;syntax_selec.appendChild(option);}}spans=È.getChildren(_$(\"toolbar_1\"),\"span\",\"\",\"\",\"all\",-1);for(var i=0;i<spans.Æ;i++){id=spans[i].id.replace(/tmp_tool_(.*)/,\"$1\");if(id!=spans[i].id){for(var j in t.plugins){if(typeof(t.plugins[j].get_control_html)==\"Ã\"){html=t.plugins[j].get_control_html(id);if(html!=Ì){html=t.get_translation(html,\"template\");var new_span=document.createElement(\"span\");new_span.innerHTML=html;var father=spans[i].ÈNode;spans[i].ÈNode.replaceChild(new_span,spans[i]);break;}}}}}if(s[\"debug\"]){t.debug=È.document.getElementById(\"edit_area_debug_\"+t.id);}if(_$(\"redo\")!=null)t.switchClassSticky(_$(\"redo\"),'editAreaButtonDisabled',Ë);if(typeof(È.eAL.syntax[s[\"syntax\"]])!=\"undefined\"){for(var i in È.eAL.syntax){if(typeof(È.eAL.syntax[i][\"Çs\"])!=\"undefined\"){t.add_Ç(È.eAL.syntax[i][\"Çs\"]);}}}if(t.isOpera)_$(\"editor\").onkeypress=keyDown;\nelse _$(\"editor\").onkeydown=keyDown;for(var i=0;i<t.inlinePopup.Æ;i++){if(t.isOpera)_$(t.inlinePopup[i][\"popup_id\"]).onkeypress=keyDown;\nelse _$(t.inlinePopup[i][\"popup_id\"]).onkeydown=keyDown;}if(s[\"allow_resize\"]==\"both\"||s[\"allow_resize\"]==\"x\"||s[\"allow_resize\"]==\"y\")t.allow_resize(Ë);È.eAL.toggle(t.id,\"on\");t.change_smooth_selection_mode(eA.smooth_selection);t.execCommand(\"change_highlight\",s[\"start_highlight\"]);t.set_font(eA.Å[\"font_family\"],eA.Å[\"font_size\"]);children=È.getChildren(document.body,\"\",\"selec\",\"none\",\"all\",-1);for(var i=0;i<children.Æ;i++){if(t.isIE)children[i].unselectable=Ë;\nelse children[i].onmousedown=Ã(){return Ì};}a.spellcheck=s[\"gecko_spellcheck\"];if(t.isFirefox >='3'){t.content_highlight.Ç.paddingLeft=\"1px\";t.selection_field.Ç.paddingLeft=\"1px\";t.selection_field_text.Ç.paddingLeft=\"1px\";}if(t.isIE&&t.isIE < 8){a.Ç.marginTop=\"-1px\";}if(t.isSafari){t.editor_area.Ç.position=\"absolute\";a.Ç.marginLeft=\"-3px\";if(t.isSafari < 3.2)a.Ç.marginTop=\"1px\";}È.eAL.add_event(t.result,\"click\",Ã(e){if((e.target||e.srcElement)==eA.result){eA.area_select(eA.Â.Ê.Æ,0);}});if(s['is_multi_files']!=Ì)t.open_file({'id':t.curr_file,'text':''});t.set_word_wrap(s['word_wrap']);setTimeout(\"eA.focus();eA.manage_size();eA.execCommand('EA_load');\",10);t.check_undo();t.check_line_selection(Ë);t.scroll_to_view();for(var i in t.plugins){if(typeof(t.plugins[i].onload)==\"Ã\")t.plugins[i].onload();}if(s['fullscreen']==Ë)t.toggle_full_screen(Ë);È.eAL.add_event(window,\"resize\",eA.update_size);È.eAL.add_event(È.window,\"resize\",eA.update_size);È.eAL.add_event(top.window,\"resize\",eA.update_size);È.eAL.add_event(window,\"unload\",Ã(){if(È.eAL){È.eAL.remove_event(È.window,\"resize\",eA.update_size);È.eAL.remove_event(top.window,\"resize\",eA.update_size);}if(eAs[eA.id]&&eAs[eA.id][\"displayed\"]){eA.execCommand(\"EA_unload\");}});};EA.Ä.update_size=Ã(){var d=document,pd=È.document,height,width,popup,maxLeft,maxTop;if(typeof eAs !='undefined'&&eAs[eA.id]&&eAs[eA.id][\"displayed\"]==Ë){if(eA.fullscreen['isFull']){pd.getElementById(\"frame_\"+eA.id).Ç.width=pd.getElementsByTagName(\"html\")[0].clientWidth+\"px\";pd.getElementById(\"frame_\"+eA.id).Ç.height=pd.getElementsByTagName(\"html\")[0].clientHeight+\"px\";}if(eA.tab_browsing_area.Ç.display=='block'&&(!eA.isIE||eA.isIE >=8)){eA.tab_browsing_area.Ç.height=\"0px\";eA.tab_browsing_area.Ç.height=(eA.result.offsetTop-eA.tab_browsing_area.offsetTop-1)+\"px\";}height=d.body.offsetHeight-eA.get_all_toolbar_height()-4;eA.result.Ç.height=height+\"px\";width=d.body.offsetWidth-2;eA.result.Ç.width=width+\"px\";for(i=0;i < eA.inlinePopup.Æ;i++){popup=_$(eA.inlinePopup[i][\"popup_id\"]);maxLeft=d.body.offsetWidth-popup.offsetWidth;maxTop=d.body.offsetHeight-popup.offsetHeight;if(popup.offsetTop > maxTop)popup.Ç.top=maxTop+\"px\";if(popup.offsetLeft > maxLeft)popup.Ç.left=maxLeft+\"px\";}eA.manage_size(Ë);eA.fixLinesHeight(eA.Â.Ê,0,-1);}};EA.Ä.manage_size=Ã(onlyOneTime){if(!eAs[Á.id])return Ì;if(eAs[Á.id][\"displayed\"]==Ë&&Á.ÂFocused){var area_height,resized=Ì;if(!Á.Å['word_wrap']){var area_width=Á.Â.scrollWidth;area_height=Á.Â.scrollHeight;if(Á.isOpera&&Á.isOpera < 9.6){area_width=10000;}if(Á.Â.previous_scrollWidth!=area_width){Á.container.Ç.width=area_width+\"px\";Á.Â.Ç.width=area_width+\"px\";Á.content_highlight.Ç.width=area_width+\"px\";Á.Â.previous_scrollWidth=area_width;resized=Ë;}}if(Á.Å['word_wrap']){newW=Á.Â.offsetWidth;if(Á.isFirefox||Á.isIE)newW-=2;if(Á.isSafari)newW-=6;Á.content_highlight.Ç.width=Á.selection_field_text.Ç.width=Á.selection_field.Ç.width=Á.test_font_size.Ç.width=newW+\"px\";}if(Á.isOpera||Á.isFirefox||Á.isSafari){area_height=Á.getLinePosTop(Á.É[\"nb_line\"]+1);}\nelse{area_height=Á.Â.scrollHeight;}if(Á.Â.previous_scrollHeight!=area_height){Á.container.Ç.height=(area_height+2)+\"px\";Á.Â.Ç.height=area_height+\"px\";Á.content_highlight.Ç.height=area_height+\"px\";Á.Â.previous_scrollHeight=area_height;resized=Ë;}if(Á.É[\"nb_line\"] >=Á.line_number){var newLines='',destDiv=_$(\"line_number\"),start=Á.line_number,end=Á.É[\"nb_line\"]+100;for(i=start+1;i < end;i++){newLines+='<div id=\"line_'+i+'\">'+i+\"</div>\";Á.line_number++;}destDiv.innerHTML=destDiv.innerHTML+newLines;if(Á.Å['word_wrap']){Á.fixLinesHeight(Á.Â.Ê,start,-1);}}Á.Â.scrollTop=\"0px\";Á.Â.scrollLeft=\"0px\";if(resized==Ë){Á.scroll_to_view();}}if(!onlyOneTime)setTimeout(\"eA.manage_size();\",100);};EA.Ä.execCommand=Ã(cmd,param){for(var i in Á.plugins){if(typeof(Á.plugins[i].execCommand)==\"Ã\"){if(!Á.plugins[i].execCommand(cmd,param))return;}}switch(cmd){case \"save\":if(Á.Å[\"save_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"save_callback\"]+\"('\"+Á.id+\"',eA.Â.Ê);\");break;case \"load\":if(Á.Å[\"load_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"load_callback\"]+\"('\"+Á.id+\"');\");break;case \"onchange\":if(Á.Å[\"change_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"change_callback\"]+\"('\"+Á.id+\"');\");break;case \"EA_load\":if(Á.Å[\"EA_load_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_load_callback\"]+\"('\"+Á.id+\"');\");break;case \"EA_unload\":if(Á.Å[\"EA_unload_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_unload_callback\"]+\"('\"+Á.id+\"');\");break;case \"toggle_on\":if(Á.Å[\"EA_toggle_on_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_toggle_on_callback\"]+\"('\"+Á.id+\"');\");break;case \"toggle_off\":if(Á.Å[\"EA_toggle_off_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_toggle_off_callback\"]+\"('\"+Á.id+\"');\");break;case \"re_sync\":if(!Á.do_highlight)break;case \"file_switch_on\":if(Á.Å[\"EA_file_switch_on_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_file_switch_on_callback\"]+\"(param);\");break;case \"file_switch_off\":if(Á.Å[\"EA_file_switch_off_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_file_switch_off_callback\"]+\"(param);\");break;case \"file_close\":if(Á.Å[\"EA_file_close_callback\"].Æ>0)return eval(\"È.\"+Á.Å[\"EA_file_close_callback\"]+\"(param);\");break;default:if(typeof(eval(\"eA.\"+cmd))==\"Ã\"){if(Á.Å[\"debug\"])eval(\"eA.\"+cmd+\"(param);\");\nelse try{eval(\"eA.\"+cmd+\"(param);\");}catch(e){};}}};EA.Ä.get_translation=Ã(word,mode){if(mode==\"template\")return È.eAL.translate(word,Á.Å[\"language\"],mode);\nelse return È.eAL.get_word_translation(word,Á.Å[\"language\"]);};EA.Ä.add_plugin=Ã(plug_name,plug_obj){for(var i=0;i<Á.Å[\"plugins\"].Æ;i++){if(Á.Å[\"plugins\"][i]==plug_name){Á.plugins[plug_name]=plug_obj;plug_obj.baseURL=È.eAL.baseURL+\"plugins/\"+plug_name+\"/\";if(typeof(plug_obj.init)==\"Ã\")plug_obj.init();}}};EA.Ä.load_css=Ã(url){try{link=document.createElement(\"link\");link.type=\"text/css\";link.rel=\"Çsheet\";link.media=\"all\";link.href=url;head=document.getElementsByTagName(\"head\");head[0].appendChild(link);}catch(e){document.write(\"<link href='\"+url+\"' rel='Çsheet' type='text/css' />\");}};EA.Ä.load_script=Ã(url){try{script=document.createElement(\"script\");script.type=\"text/javascript\";script.src=url;script.charset=\"UTF-8\";head=document.getElementsByTagName(\"head\");head[0].appendChild(script);}catch(e){document.write(\"<script type='text/javascript' src='\"+url+\"' charset=\\\"UTF-8\\\"><\"+\"/script>\");}};EA.Ä.add_lang=Ã(language,Ês){if(!È.eAL.lang[language])È.eAL.lang[language]={};for(var i in Ês)È.eAL.lang[language][i]=Ês[i];};Ã _$(id){return document.getElementById(id);};var eA=new EA();È.eAL.add_event(window,\"load\",init);Ã init(){setTimeout(\"eA.init();\",10);}; EA.Ä.focus=Ã(){Á.Â.focus();Á.ÂFocused=Ë;};EA.Ä.check_line_selection=Ã(timer_checkup){var changes,infos,new_top,new_width,i;var t1=t2=t2_1=t3=tLines=tend=new Date().getTime();if(!eAs[Á.id])return Ì;if(!Á.smooth_selection&&!Á.do_highlight){}\nelse if(Á.ÂFocused&&eAs[Á.id][\"displayed\"]==Ë&&Á.isResizing==Ì){infos=Á.get_selection_infos();changes=Á.checkTextEvolution(typeof(Á.É['full_text'])=='undefined' ? '':Á.É['full_text'],infos['full_text']);t2=new Date().getTime();if(Á.É[\"line_start\"] !=infos[\"line_start\"]||Á.É[\"line_nb\"] !=infos[\"line_nb\"]||infos[\"full_text\"] !=Á.É[\"full_text\"]||Á.reload_highlight||Á.É[\"selectionStart\"] !=infos[\"selectionStart\"]||Á.É[\"selectionEnd\"] !=infos[\"selectionEnd\"]||!timer_checkup){new_top=Á.getLinePosTop(infos[\"line_start\"]);new_width=Math.max(Á.Â.scrollWidth,Á.container.clientWidth-50);Á.selection_field.Ç.top=Á.selection_field_text.Ç.top=new_top+\"px\";if(!Á.Å['word_wrap']){Á.selection_field.Ç.width=Á.selection_field_text.Ç.width=Á.test_font_size.Ç.width=new_width+\"px\";}if(Á.do_highlight==Ë){var curr_text=infos[\"full_text\"].split(\"\\n\");var content=\"\";var start=Math.max(0,infos[\"line_start\"]-1);var end=Math.min(curr_text.Æ,infos[\"line_start\"]+infos[\"line_nb\"]-1);for(i=start;i< end;i++){content+=curr_text[i]+\"\\n\";}selLength=infos['selectionEnd']-infos['selectionStart'];content=content.substr(0,infos[\"curr_pos\"]-1)+\"\\r\\r\"+content.substr(infos[\"curr_pos\"]-1,selLength)+\"\\r\\r\"+content.substr(infos[\"curr_pos\"]-1+selLength);content='<span>'+content.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(\"\\r\\r\",'</span><strong>').replace(\"\\r\\r\",'</strong><span>')+'</span>';if(Á.isIE||(Á.isOpera&&Á.isOpera < 9.6)){Á.selection_field.innerHTML=\"<pre>\"+content.replace(/^\\r?\\n/,\"<br>\")+\"</pre>\";}\nelse{Á.selection_field.innerHTML=content;}Á.selection_field_text.innerHTML=Á.selection_field.innerHTML;t2_1=new Date().getTime();if(Á.reload_highlight||(infos[\"full_text\"] !=Á.last_text_to_highlight&&(Á.É[\"line_start\"]!=infos[\"line_start\"]||Á.show_line_colors||Á.Å['word_wrap']||Á.É[\"line_nb\"]!=infos[\"line_nb\"]||Á.É[\"nb_line\"]!=infos[\"nb_line\"]))){Á.maj_highlight(infos);}}}t3=new Date().getTime();if(Á.Å['word_wrap']&&infos[\"full_text\"] !=Á.É[\"full_text\"]){if(changes.newText.split(\"\\n\").Æ==1&&Á.É['nb_line']&&infos['nb_line']==Á.É['nb_line']){Á.fixLinesHeight(infos['full_text'],changes.lineStart,changes.lineStart);}\nelse{Á.fixLinesHeight(infos['full_text'],changes.lineStart,-1);}}tLines=new Date().getTime();if(infos[\"line_start\"] !=Á.É[\"line_start\"]||infos[\"curr_pos\"] !=Á.É[\"curr_pos\"]||infos[\"full_text\"].Æ!=Á.É[\"full_text\"].Æ||Á.reload_highlight||!timer_checkup){var selec_char=infos[\"curr_line\"].charAt(infos[\"curr_pos\"]-1);var no_real_move=Ë;if(infos[\"line_nb\"]==1&&(Á.assocBracket[selec_char]||Á.revertAssocBracket[selec_char])){no_real_move=Ì;if(Á.findEndBracket(infos,selec_char)===Ë){_$(\"end_bracket\").Ç.visibility=\"visible\";_$(\"cursor_pos\").Ç.visibility=\"visible\";_$(\"cursor_pos\").innerHTML=selec_char;_$(\"end_bracket\").innerHTML=(Á.assocBracket[selec_char]||Á.revertAssocBracket[selec_char]);}\nelse{_$(\"end_bracket\").Ç.visibility=\"hidden\";_$(\"cursor_pos\").Ç.visibility=\"hidden\";}}\nelse{_$(\"cursor_pos\").Ç.visibility=\"hidden\";_$(\"end_bracket\").Ç.visibility=\"hidden\";}Á.displayToCursorPosition(\"cursor_pos\",infos[\"line_start\"],infos[\"curr_pos\"]-1,infos[\"curr_line\"],no_real_move);if(infos[\"line_nb\"]==1&&infos[\"line_start\"]!=Á.É[\"line_start\"])Á.scroll_to_view();}Á.É=infos;}tend=new Date().getTime();if(timer_checkup){setTimeout(\"eA.check_line_selection(Ë)\",Á.check_line_selection_timer);}};EA.Ä.get_selection_infos=Ã(){var sel={},start,end,len,str;Á.getIESelection();start=Á.Â.selectionStart;end=Á.Â.selectionEnd;if(Á.É[\"selectionStart\"]==start&&Á.É[\"selectionEnd\"]==end&&Á.É[\"full_text\"]==Á.Â.Ê){return Á.É;}if(Á.tabulation!=\"\t\"&&Á.Â.Ê.indexOf(\"\t\")!=-1){len=Á.Â.Ê.Æ;Á.Â.Ê=Á.replace_tab(Á.Â.Ê);start=end=start+(Á.Â.Ê.Æ-len);Á.area_select(start,0);}sel[\"selectionStart\"]=start;sel[\"selectionEnd\"]=end;sel[\"full_text\"]=Á.Â.Ê;sel[\"line_start\"]=1;sel[\"line_nb\"]=1;sel[\"curr_pos\"]=0;sel[\"curr_line\"]=\"\";sel[\"indexOfCursor\"]=0;sel[\"selec_direction\"]=Á.É[\"selec_direction\"];var splitTab=sel[\"full_text\"].split(\"\\n\");var nbLine=Math.max(0,splitTab.Æ);var nbChar=Math.max(0,sel[\"full_text\"].Æ-(nbLine-1));if(sel[\"full_text\"].indexOf(\"\\r\")!=-1)nbChar=nbChar-(nbLine-1);sel[\"nb_line\"]=nbLine;sel[\"nb_char\"]=nbChar;if(start>0){str=sel[\"full_text\"].substr(0,start);sel[\"curr_pos\"]=start-str.lastIndexOf(\"\\n\");sel[\"line_start\"]=Math.max(1,str.split(\"\\n\").Æ);}\nelse{sel[\"curr_pos\"]=1;}if(end>start){sel[\"line_nb\"]=sel[\"full_text\"].substring(start,end).split(\"\\n\").Æ;}sel[\"indexOfCursor\"]=start;sel[\"curr_line\"]=splitTab[Math.max(0,sel[\"line_start\"]-1)];if(sel[\"selectionStart\"]==Á.É[\"selectionStart\"]){if(sel[\"selectionEnd\"]>Á.É[\"selectionEnd\"])sel[\"selec_direction\"]=\"down\";\nelse if(sel[\"selectionEnd\"]==Á.É[\"selectionStart\"])sel[\"selec_direction\"]=Á.É[\"selec_direction\"];}\nelse if(sel[\"selectionStart\"]==Á.É[\"selectionEnd\"]&&sel[\"selectionEnd\"]>Á.É[\"selectionEnd\"]){sel[\"selec_direction\"]=\"down\";}\nelse{sel[\"selec_direction\"]=\"up\";}_$(\"nbLine\").innerHTML=nbLine;_$(\"nbChar\").innerHTML=nbChar;_$(\"linePos\").innerHTML=sel[\"line_start\"];_$(\"currPos\").innerHTML=sel[\"curr_pos\"];return sel;};EA.Ä.getIESelection=Ã(){var selectionStart,selectionEnd,range,stored_range;if(!Á.isIE)return Ì;if(Á.Å['word_wrap'])Á.Â.wrap='off';try{range=document.selection.createRange();stored_range=range.duplicate();stored_range.moveToElementText(Á.Â);stored_range.setEndPoint('EndToEnd',range);if(stored_range.ÈElement()!=Á.Â)throw \"invalid focus\";var scrollTop=Á.result.scrollTop+document.body.scrollTop;var relative_top=range.offsetTop-È.calculeOffsetTop(Á.Â)+scrollTop;var line_start=Math.round((relative_top / Á.lineHeight)+1);var line_nb=Math.round(range.boundingHeight / Á.lineHeight);selectionStart=stored_range.text.Æ-range.text.Æ;selectionStart+=(line_start-Á.Â.Ê.substr(0,selectionStart).split(\"\\n\").Æ)*2;selectionStart-=(line_start-Á.Â.Ê.substr(0,selectionStart).split(\"\\n\").Æ)* 2;selectionEnd=selectionStart+range.text.Æ;selectionEnd+=(line_start+line_nb-1-Á.Â.Ê.substr(0,selectionEnd).split(\"\\n\").Æ)*2;Á.Â.selectionStart=selectionStart;Á.Â.selectionEnd=selectionEnd;}catch(e){}if(Á.Å['word_wrap'])Á.Â.wrap='soft';};EA.Ä.setIESelection=Ã(){var a=Á.Â,nbLineStart,nbLineEnd,range;if(!Á.isIE)return Ì;nbLineStart=a.Ê.substr(0,a.selectionStart).split(\"\\n\").Æ-1;nbLineEnd=a.Ê.substr(0,a.selectionEnd).split(\"\\n\").Æ-1;range=document.selection.createRange();range.moveToElementText(a);range.setEndPoint('EndToStart',range);range.moveStart('character',a.selectionStart-nbLineStart);range.moveEnd('character',a.selectionEnd-nbLineEnd-(a.selectionStart-nbLineStart));range.select();};EA.Ä.checkTextEvolution=Ã(lastText,newText){var ch={},baseStep=200,cpt=0,end,step,tStart=new Date().getTime();end=Math.min(newText.Æ,lastText.Æ);step=baseStep;while(cpt<end&&step>=1){if(lastText.substr(cpt,step)==newText.substr(cpt,step)){cpt+=step;}\nelse{step=Math.floor(step/2);}}ch.posStart=cpt;ch.lineStart=newText.substr(0,ch.posStart).split(\"\\n\").Æ-1;cpt_last=lastText.Æ;cpt=newText.Æ;step=baseStep;while(cpt>=0&&cpt_last>=0&&step>=1){if(lastText.substr(cpt_last-step,step)==newText.substr(cpt-step,step)){cpt-=step;cpt_last-=step;}\nelse{step=Math.floor(step/2);}}ch.posNewEnd=cpt;ch.posLastEnd=cpt_last;if(ch.posNewEnd<=ch.posStart){if(lastText.Æ < newText.Æ){ch.posNewEnd=ch.posStart+newText.Æ-lastText.Æ;ch.posLastEnd=ch.posStart;}\nelse{ch.posLastEnd=ch.posStart+lastText.Æ-newText.Æ;ch.posNewEnd=ch.posStart;}}ch.newText=newText.substring(ch.posStart,ch.posNewEnd);ch.lastText=lastText.substring(ch.posStart,ch.posLastEnd);ch.lineNewEnd=newText.substr(0,ch.posNewEnd).split(\"\\n\").Æ-1;ch.lineLastEnd=lastText.substr(0,ch.posLastEnd).split(\"\\n\").Æ-1;ch.newTextLine=newText.split(\"\\n\").slice(ch.lineStart,ch.lineNewEnd+1).join(\"\\n\");ch.lastTextLine=lastText.split(\"\\n\").slice(ch.lineStart,ch.lineLastEnd+1).join(\"\\n\");return ch;};EA.Ä.tab_selection=Ã(){if(Á.is_tabbing)return;Á.is_tabbing=Ë;Á.getIESelection();var start=Á.Â.selectionStart;var end=Á.Â.selectionEnd;var insText=Á.Â.Ê.substring(start,end);var pos_start=start;var pos_end=end;if(insText.Æ==0){Á.Â.Ê=Á.Â.Ê.substr(0,start)+Á.tabulation+Á.Â.Ê.substr(end);pos_start=start+Á.tabulation.Æ;pos_end=pos_start;}\nelse{start=Math.max(0,Á.Â.Ê.substr(0,start).lastIndexOf(\"\\n\")+1);endText=Á.Â.Ê.substr(end);startText=Á.Â.Ê.substr(0,start);tmp=Á.Â.Ê.substring(start,end).split(\"\\n\");insText=Á.tabulation+tmp.join(\"\\n\"+Á.tabulation);Á.Â.Ê=startText+insText+endText;pos_start=start;pos_end=Á.Â.Ê.indexOf(\"\\n\",startText.Æ+insText.Æ);if(pos_end==-1)pos_end=Á.Â.Ê.Æ;}Á.Â.selectionStart=pos_start;Á.Â.selectionEnd=pos_end;if(Á.isIE){Á.setIESelection();setTimeout(\"eA.is_tabbing=Ì;\",100);}\nelse{Á.is_tabbing=Ì;}};EA.Ä.invert_tab_selection=Ã(){var t=Á,a=Á.Â;if(t.is_tabbing)return;t.is_tabbing=Ë;t.getIESelection();var start=a.selectionStart;var end=a.selectionEnd;var insText=a.Ê.substring(start,end);var pos_start=start;var pos_end=end;if(insText.Æ==0){if(a.Ê.substring(start-t.tabulation.Æ,start)==t.tabulation){a.Ê=a.Ê.substr(0,start-t.tabulation.Æ)+a.Ê.substr(end);pos_start=Math.max(0,start-t.tabulation.Æ);pos_end=pos_start;}}\nelse{start=a.Ê.substr(0,start).lastIndexOf(\"\\n\")+1;endText=a.Ê.substr(end);startText=a.Ê.substr(0,start);tmp=a.Ê.substring(start,end).split(\"\\n\");insText=\"\";for(i=0;i<tmp.Æ;i++){for(j=0;j<t.tab_nb_char;j++){if(tmp[i].charAt(0)==\"\t\"){tmp[i]=tmp[i].substr(1);j=t.tab_nb_char;}\nelse if(tmp[i].charAt(0)==\" \")tmp[i]=tmp[i].substr(1);}insText+=tmp[i];if(i<tmp.Æ-1)insText+=\"\\n\";}a.Ê=startText+insText+endText;pos_start=start;pos_end=a.Ê.indexOf(\"\\n\",startText.Æ+insText.Æ);if(pos_end==-1)pos_end=a.Ê.Æ;}a.selectionStart=pos_start;a.selectionEnd=pos_end;if(t.isIE){t.setIESelection();setTimeout(\"eA.is_tabbing=Ì;\",100);}\nelse t.is_tabbing=Ì;};EA.Ä.press_enter=Ã(){if(!Á.smooth_selection)return Ì;Á.getIESelection();var scrollTop=Á.result.scrollTop;var scrollLeft=Á.result.scrollLeft;var start=Á.Â.selectionStart;var end=Á.Â.selectionEnd;var start_last_line=Math.max(0,Á.Â.Ê.substring(0,start).lastIndexOf(\"\\n\")+1);var begin_line=Á.Â.Ê.substring(start_last_line,start).replace(/^([ \t]*).*/gm,\"$1\");var lineStart=Á.Â.Ê.substring(0,start).split(\"\\n\").Æ;if(begin_line==\"\\n\"||begin_line==\"\\r\"||begin_line.Æ==0){return Ì;}if(Á.isIE||(Á.isOpera&&Á.isOpera < 9.6)){begin_line=\"\\r\\n\"+begin_line;}\nelse{begin_line=\"\\n\"+begin_line;}Á.Â.Ê=Á.Â.Ê.substring(0,start)+begin_line+Á.Â.Ê.substring(end);Á.area_select(start+begin_line.Æ,0);if(Á.isIE){Á.result.scrollTop=scrollTop;Á.result.scrollLeft=scrollLeft;}return Ë;};EA.Ä.findEndBracket=Ã(infos,bracket){var start=infos[\"indexOfCursor\"];var normal_order=Ë;if(Á.assocBracket[bracket])endBracket=Á.assocBracket[bracket];\nelse if(Á.revertAssocBracket[bracket]){endBracket=Á.revertAssocBracket[bracket];normal_order=Ì;}var end=-1;var nbBracketOpen=0;for(var i=start;i<infos[\"full_text\"].Æ&&i>=0;){if(infos[\"full_text\"].charAt(i)==endBracket){nbBracketOpen--;if(nbBracketOpen<=0){end=i;break;}}\nelse if(infos[\"full_text\"].charAt(i)==bracket)nbBracketOpen++;if(normal_order)i++;\nelse i--;}if(end==-1)return Ì;var endLastLine=infos[\"full_text\"].substr(0,end).lastIndexOf(\"\\n\");if(endLastLine==-1)line=1;\nelse line=infos[\"full_text\"].substr(0,endLastLine).split(\"\\n\").Æ+1;var curPos=end-endLastLine-1;var endLineLength=infos[\"full_text\"].substring(end).split(\"\\n\")[0].Æ;Á.displayToCursorPosition(\"end_bracket\",line,curPos,infos[\"full_text\"].substring(endLastLine+1,end+endLineLength));return Ë;};EA.Ä.displayToCursorPosition=Ã(id,start_line,cur_pos,lineContent,no_real_move){var elem,dest,content,posLeft=0,posTop,fixPadding,topOffset,endElem;elem=Á.test_font_size;dest=_$(id);content=\"<span id='test_font_size_inner'>\"+lineContent.substr(0,cur_pos).replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\")+\"</span><span id='endTestFont'>\"+lineContent.substr(cur_pos).replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\")+\"</span>\";if(Á.isIE||(Á.isOpera&&Á.isOpera < 9.6)){elem.innerHTML=\"<pre>\"+content.replace(/^\\r?\\n/,\"<br>\")+\"</pre>\";}\nelse{elem.innerHTML=content;}endElem=_$('endTestFont');topOffset=endElem.offsetTop;fixPadding=parseInt(Á.content_highlight.Ç.paddingLeft.replace(\"px\",\"\"));posLeft=45+endElem.offsetLeft+(!isNaN(fixPadding)&&topOffset > 0 ? fixPadding:0);posTop=Á.getLinePosTop(start_line)+topOffset;if(Á.isIE&&cur_pos > 0&&endElem.offsetLeft==0){posTop+=Á.lineHeight;}if(no_real_move!=Ë){dest.Ç.top=posTop+\"px\";dest.Ç.left=posLeft+\"px\";}dest.cursor_top=posTop;dest.cursor_left=posLeft;};EA.Ä.getLinePosTop=Ã(start_line){var elem=_$('line_'+start_line),posTop=0;if(elem)posTop=elem.offsetTop;\nelse posTop=Á.lineHeight *(start_line-1);return posTop;};EA.Ä.getTextHeight=Ã(text){var t=Á,elem,height;elem=t.test_font_size;content=text.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\");if(t.isIE||(Á.isOpera&&Á.isOpera < 9.6)){elem.innerHTML=\"<pre>\"+content.replace(/^\\r?\\n/,\"<br>\")+\"</pre>\";}\nelse{elem.innerHTML=content;}height=elem.offsetHeight;height=Math.max(1,Math.floor(elem.offsetHeight / Á.lineHeight))* Á.lineHeight;return height;};EA.Ä.fixLinesHeight=Ã(textValue,lineStart,lineEnd){var aText=textValue.split(\"\\n\");if(lineEnd==-1)lineEnd=aText.Æ-1;for(var i=Math.max(0,lineStart);i <=lineEnd;i++){if(elem=_$('line_'+(i+1))){elem.Ç.height=typeof(aText[i])!=\"undefined\" ? Á.getTextHeight(aText[i])+\"px\":Á.lineHeight;}}};EA.Ä.area_select=Ã(start,Æ){Á.Â.focus();start=Math.max(0,Math.min(Á.Â.Ê.Æ,start));end=Math.max(start,Math.min(Á.Â.Ê.Æ,start+Æ));if(Á.isIE){Á.Â.selectionStart=start;Á.Â.selectionEnd=end;Á.setIESelection();}\nelse{if(Á.isOpera&&Á.isOpera < 9.6){Á.Â.setSelectionRange(0,0);}Á.Â.setSelectionRange(start,end);}Á.check_line_selection();};EA.Ä.area_get_selection=Ã(){var text=\"\";if(document.selection){var range=document.selection.createRange();text=range.text;}\nelse{text=Á.Â.Ê.substring(Á.Â.selectionStart,Á.Â.selectionEnd);}return text;}; EA.Ä.replace_tab=Ã(text){return text.replace(/((\\n?)([^\t\\n]*)\t)/gi,eA.smartTab);};EA.Ä.smartTab=Ã(){val=\" \";return EA.Ä.smartTab.arguments[2]+EA.Ä.smartTab.arguments[3]+val.substr(0,eA.tab_nb_char-(EA.Ä.smartTab.arguments[3].Æ)%eA.tab_nb_char);};EA.Ä.show_waiting_screen=Ã(){width=Á.editor_area.offsetWidth;height=Á.editor_area.offsetHeight;if(!(Á.isIE&&Á.isIE<6)){width-=2;height-=2;}Á.processing_screen.Ç.display=\"block\";Á.processing_screen.Ç.width=width+\"px\";Á.processing_screen.Ç.height=height+\"px\";Á.waiting_screen_displayed=Ë;};EA.Ä.hide_waiting_screen=Ã(){Á.processing_screen.Ç.display=\"none\";Á.waiting_screen_displayed=Ì;};EA.Ä.add_Ç=Ã(Çs){if(Çs.Æ>0){newcss=document.createElement(\"Ç\");newcss.type=\"text/css\";newcss.media=\"all\";if(newcss.ÇSheet){newcss.ÇSheet.cssText=Çs;}\nelse{newcss.appendChild(document.createTextNode(Çs));}document.getElementsByTagName(\"head\")[0].appendChild(newcss);}};EA.Ä.set_font=Ã(family,size){var t=Á,a=Á.Â,s=Á.Å,elem_font,i,elem;var elems=[\"Â\",\"content_highlight\",\"cursor_pos\",\"end_bracket\",\"selection_field\",\"selection_field_text\",\"line_number\"];if(family&&family!=\"\")s[\"font_family\"]=family;if(size&&size>0)s[\"font_size\"]=size;if(t.isOpera&&t.isOpera < 9.6)s['font_family']=\"monospace\";if(elem_font=_$(\"area_font_size\")){for(i=0;i < elem_font.Æ;i++){if(elem_font.options[i].Ê&&elem_font.options[i].Ê==s[\"font_size\"])elem_font.options[i].selected=Ë;}}if(t.isFirefox){var nbTry=3;do{var div1=document.createElement('div'),text1=document.createElement('Â');var Çs={width:'40px',overflow:'scroll',zIndex:50,visibility:'hidden',fontFamily:s[\"font_family\"],fontSize:s[\"font_size\"]+\"pt\",lineHeight:t.lineHeight+\"px\",padding:'0',margin:'0',border:'none',whiteSpace:'nowrap'};var diff,changed=Ì;for(i in Çs){div1.Ç[ i ]=Çs[i];text1.Ç[ i ]=Çs[i];}text1.wrap='off';text1.setAttribute('wrap','off');t.container.appendChild(div1);t.container.appendChild(text1);div1.innerHTML=text1.Ê='azertyuiopqsdfghjklm';div1.innerHTML=text1.Ê=text1.Ê+'wxcvbn^p*ù$!:;,,';diff=text1.scrollWidth-div1.scrollWidth;if(Math.abs(diff)>=2){s[\"font_size\"]++;changed=Ë;}t.container.removeChild(div1);t.container.removeChild(text1);nbTry--;}while(changed&&nbTry > 0);}elem=t.test_font_size;elem.Ç.fontFamily=\"\"+s[\"font_family\"];elem.Ç.fontSize=s[\"font_size\"]+\"pt\";elem.innerHTML=\"0\";t.lineHeight=elem.offsetHeight;for(i=0;i<elems.Æ;i++){elem=_$(elems[i]);elem.Ç.fontFamily=s[\"font_family\"];elem.Ç.fontSize=s[\"font_size\"]+\"pt\";elem.Ç.lineHeight=t.lineHeight+\"px\";}t.add_Ç(\"pre{font-family:\"+s[\"font_family\"]+\"}\");if((t.isOpera&&t.isOpera < 9.6)||t.isIE >=8){var parNod=a.ÈNode,nxtSib=a.nextSibling,start=a.selectionStart,end=a.selectionEnd;parNod.removeChild(a);parNod.insertBefore(a,nxtSib);t.area_select(start,end-start);}Á.focus();Á.update_size();Á.check_line_selection();};EA.Ä.change_font_size=Ã(){var size=_$(\"area_font_size\").Ê;if(size>0)Á.set_font(\"\",size);};EA.Ä.open_inline_popup=Ã(popup_id){Á.close_all_inline_popup();var popup=_$(popup_id);var editor=_$(\"editor\");for(var i=0;i<Á.inlinePopup.Æ;i++){if(Á.inlinePopup[i][\"popup_id\"]==popup_id){var icon=_$(Á.inlinePopup[i][\"icon_id\"]);if(icon){Á.switchClassSticky(icon,'editAreaButtonSelected',Ë);break;}}}popup.Ç.height=\"auto\";popup.Ç.overflow=\"visible\";if(document.body.offsetHeight< popup.offsetHeight){popup.Ç.height=(document.body.offsetHeight-10)+\"px\";popup.Ç.overflow=\"auto\";}if(!popup.positionned){var new_left=editor.offsetWidth /2-popup.offsetWidth /2;var new_top=editor.offsetHeight /2-popup.offsetHeight /2;popup.Ç.left=new_left+\"px\";popup.Ç.top=new_top+\"px\";popup.positionned=Ë;}popup.Ç.visibility=\"visible\";};EA.Ä.close_inline_popup=Ã(popup_id){var popup=_$(popup_id);for(var i=0;i<Á.inlinePopup.Æ;i++){if(Á.inlinePopup[i][\"popup_id\"]==popup_id){var icon=_$(Á.inlinePopup[i][\"icon_id\"]);if(icon){Á.switchClassSticky(icon,'editAreaButtonNormal',Ì);break;}}}popup.Ç.visibility=\"hidden\";};EA.Ä.close_all_inline_popup=Ã(e){for(var i=0;i<Á.inlinePopup.Æ;i++){Á.close_inline_popup(Á.inlinePopup[i][\"popup_id\"]);}Á.Â.focus();};EA.Ä.show_help=Ã(){Á.open_inline_popup(\"edit_area_help\");};EA.Ä.new_document=Ã(){Á.Â.Ê=\"\";Á.area_select(0,0);};EA.Ä.get_all_toolbar_height=Ã(){var area=_$(\"editor\");var results=È.getChildren(area,\"div\",\"class\",\"area_toolbar\",\"all\",\"0\");var height=0;for(var i=0;i<results.Æ;i++){height+=results[i].offsetHeight;}return height;};EA.Ä.go_to_line=Ã(line){if(!line){var icon=_$(\"go_to_line\");if(icon !=null){Á.restoreClass(icon);Á.switchClassSticky(icon,'editAreaButtonSelected',Ë);}line=prompt(Á.get_translation(\"go_to_line_prompt\"));if(icon !=null)Á.switchClassSticky(icon,'editAreaButtonNormal',Ì);}if(line&&line!=null&&line.search(/^[0-9]+$/)!=-1){var start=0;var lines=Á.Â.Ê.split(\"\\n\");if(line > lines.Æ)start=Á.Â.Ê.Æ;\nelse{for(var i=0;i<Math.min(line-1,lines.Æ);i++)start+=lines[i].Æ+1;}Á.area_select(start,0);}};EA.Ä.change_smooth_selection_mode=Ã(setTo){if(Á.do_highlight)return;if(setTo !=null){if(setTo===Ì)Á.smooth_selection=Ë;\nelse Á.smooth_selection=Ì;}var icon=_$(\"change_smooth_selection\");Á.Â.focus();if(Á.smooth_selection===Ë){Á.switchClassSticky(icon,'editAreaButtonNormal',Ì);Á.smooth_selection=Ì;Á.selection_field.Ç.display=\"none\";_$(\"cursor_pos\").Ç.display=\"none\";_$(\"end_bracket\").Ç.display=\"none\";}\nelse{Á.switchClassSticky(icon,'editAreaButtonSelected',Ì);Á.smooth_selection=Ë;Á.selection_field.Ç.display=\"block\";_$(\"cursor_pos\").Ç.display=\"block\";_$(\"end_bracket\").Ç.display=\"block\";}};EA.Ä.scroll_to_view=Ã(show){var zone,lineElem;if(!Á.smooth_selection)return;zone=_$(\"result\");var cursor_pos_top=_$(\"cursor_pos\").cursor_top;if(show==\"bottom\"){cursor_pos_top+=Á.getLinePosTop(Á.É['line_start']+Á.É['line_nb']-1);}var max_height_visible=zone.clientHeight+zone.scrollTop;var miss_top=cursor_pos_top+Á.lineHeight-max_height_visible;if(miss_top>0){zone.scrollTop=zone.scrollTop+miss_top;}\nelse if(zone.scrollTop > cursor_pos_top){zone.scrollTop=cursor_pos_top;}var cursor_pos_left=_$(\"cursor_pos\").cursor_left;var max_width_visible=zone.clientWidth+zone.scrollLeft;var miss_left=cursor_pos_left+10-max_width_visible;if(miss_left>0){zone.scrollLeft=zone.scrollLeft+miss_left+50;}\nelse if(zone.scrollLeft > cursor_pos_left){zone.scrollLeft=cursor_pos_left;}\nelse if(zone.scrollLeft==45){zone.scrollLeft=0;}};EA.Ä.check_undo=Ã(only_once){if(!eAs[Á.id])return Ì;if(Á.ÂFocused&&eAs[Á.id][\"displayed\"]==Ë){var text=Á.Â.Ê;if(Á.previous.Æ<=1)Á.switchClassSticky(_$(\"undo\"),'editAreaButtonDisabled',Ë);if(!Á.previous[Á.previous.Æ-1]||Á.previous[Á.previous.Æ-1][\"text\"] !=text){Á.previous.push({\"text\":text,\"selStart\":Á.Â.selectionStart,\"selEnd\":Á.Â.selectionEnd});if(Á.previous.Æ > Á.Å[\"max_undo\"]+1)Á.previous.shift();}if(Á.previous.Æ >=2)Á.switchClassSticky(_$(\"undo\"),'editAreaButtonNormal',Ì);}if(!only_once)setTimeout(\"eA.check_undo()\",3000);};EA.Ä.undo=Ã(){if(Á.previous.Æ > 0){Á.getIESelection();Á.next.push({\"text\":Á.Â.Ê,\"selStart\":Á.Â.selectionStart,\"selEnd\":Á.Â.selectionEnd});var prev=Á.previous.pop();if(prev[\"text\"]==Á.Â.Ê&&Á.previous.Æ > 0)prev=Á.previous.pop();Á.Â.Ê=prev[\"text\"];Á.last_undo=prev[\"text\"];Á.area_select(prev[\"selStart\"],prev[\"selEnd\"]-prev[\"selStart\"]);Á.switchClassSticky(_$(\"redo\"),'editAreaButtonNormal',Ì);Á.resync_highlight(Ë);Á.check_file_changes();}};EA.Ä.redo=Ã(){if(Á.next.Æ > 0){var next=Á.next.pop();Á.previous.push(next);Á.Â.Ê=next[\"text\"];Á.last_undo=next[\"text\"];Á.area_select(next[\"selStart\"],next[\"selEnd\"]-next[\"selStart\"]);Á.switchClassSticky(_$(\"undo\"),'editAreaButtonNormal',Ì);Á.resync_highlight(Ë);Á.check_file_changes();}if(Á.next.Æ==0)Á.switchClassSticky(_$(\"redo\"),'editAreaButtonDisabled',Ë);};EA.Ä.check_redo=Ã(){if(eA.next.Æ==0||eA.Â.Ê!=eA.last_undo){eA.next=[];eA.switchClassSticky(_$(\"redo\"),'editAreaButtonDisabled',Ë);}\nelse{Á.switchClassSticky(_$(\"redo\"),'editAreaButtonNormal',Ì);}};EA.Ä.switchClass=Ã(element,class_name,lock_state){var lockChanged=Ì;if(typeof(lock_state)!=\"undefined\"&&element !=null){element.classLock=lock_state;lockChanged=Ë;}if(element !=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};EA.Ä.restoreAndSwitchClass=Ã(element,class_name){if(element !=null&&!element.classLock){Á.restoreClass(element);Á.switchClass(element,class_name);}};EA.Ä.restoreClass=Ã(element){if(element !=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};EA.Ä.setClassLock=Ã(element,lock_state){if(element !=null)element.classLock=lock_state;};EA.Ä.switchClassSticky=Ã(element,class_name,lock_state){var lockChanged=Ì;if(typeof(lock_state)!=\"undefined\"&&element !=null){element.classLock=lock_state;lockChanged=Ë;}if(element !=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;}};EA.Ä.scroll_page=Ã(params){var dir=params[\"dir\"],shift_pressed=params[\"shift\"];var lines=Á.Â.Ê.split(\"\\n\");var new_pos=0,Æ=0,char_left=0,line_nb=0,curLine=0;var toScrollAmount=_$(\"result\").clientHeight-30;var nbLineToScroll=0,diff=0;if(dir==\"up\"){nbLineToScroll=Math.ceil(toScrollAmount / Á.lineHeight);for(i=Á.É[\"line_start\"];i-diff > Á.É[\"line_start\"]-nbLineToScroll;i--){if(elem=_$('line_'+i)){diff+=Math.floor((elem.offsetHeight-1)/ Á.lineHeight);}}nbLineToScroll-=diff;if(Á.É[\"selec_direction\"]==\"up\"){for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]-nbLineToScroll,lines.Æ);line_nb++){new_pos+=lines[line_nb].Æ+1;}char_left=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"]-1);if(shift_pressed)Æ=Á.É[\"selectionEnd\"]-new_pos-char_left;Á.area_select(new_pos+char_left,Æ);view=\"top\";}\nelse{view=\"bottom\";for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]+Á.É[\"line_nb\"]-1-nbLineToScroll,lines.Æ);line_nb++){new_pos+=lines[line_nb].Æ+1;}char_left=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"]-1);if(shift_pressed){start=Math.min(Á.É[\"selectionStart\"],new_pos+char_left);Æ=Math.max(new_pos+char_left,Á.É[\"selectionStart\"])-start;if(new_pos+char_left < Á.É[\"selectionStart\"])view=\"top\";}\nelse start=new_pos+char_left;Á.area_select(start,Æ);}}\nelse{var nbLineToScroll=Math.floor(toScrollAmount / Á.lineHeight);for(i=Á.É[\"line_start\"];i+diff < Á.É[\"line_start\"]+nbLineToScroll;i++){if(elem=_$('line_'+i)){diff+=Math.floor((elem.offsetHeight-1)/ Á.lineHeight);}}nbLineToScroll-=diff;if(Á.É[\"selec_direction\"]==\"down\"){view=\"bottom\";for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]+Á.É[\"line_nb\"]-2+nbLineToScroll,lines.Æ);line_nb++){if(line_nb==Á.É[\"line_start\"]-1)char_left=Á.É[\"selectionStart\"]-new_pos;new_pos+=lines[line_nb].Æ+1;}if(shift_pressed){Æ=Math.abs(Á.É[\"selectionStart\"]-new_pos);Æ+=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"]);Á.area_select(Math.min(Á.É[\"selectionStart\"],new_pos),Æ);}\nelse{Á.area_select(new_pos+char_left,0);}}\nelse{view=\"top\";for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]+nbLineToScroll-1,lines.Æ,lines.Æ);line_nb++){if(line_nb==Á.É[\"line_start\"]-1)char_left=Á.É[\"selectionStart\"]-new_pos;new_pos+=lines[line_nb].Æ+1;}if(shift_pressed){Æ=Math.abs(Á.É[\"selectionEnd\"]-new_pos-char_left);Æ+=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"])-char_left-1;Á.area_select(Math.min(Á.É[\"selectionEnd\"],new_pos+char_left),Æ);if(new_pos+char_left > Á.É[\"selectionEnd\"])view=\"bottom\";}\nelse{Á.area_select(new_pos+char_left,0);}}}Á.check_line_selection();Á.scroll_to_view(view);};EA.Ä.start_resize=Ã(e){È.eAL.resize[\"id\"]=eA.id;È.eAL.resize[\"start_x\"]=(e)? e.pageX:event.x+document.body.scrollLeft;È.eAL.resize[\"start_y\"]=(e)? e.pageY:event.y+document.body.scrollTop;if(eA.isIE){eA.Â.focus();eA.getIESelection();}È.eAL.resize[\"selectionStart\"]=eA.Â.selectionStart;È.eAL.resize[\"selectionEnd\"]=eA.Â.selectionEnd;È.eAL.start_resize_area();};EA.Ä.toggle_full_screen=Ã(to){var t=Á,p=È,a=t.Â,html,frame,selStart,selEnd,old,icon;if(typeof(to)==\"undefined\")to=!t.fullscreen['isFull'];old=t.fullscreen['isFull'];t.fullscreen['isFull']=to;icon=_$(\"fullscreen\");selStart=t.Â.selectionStart;selEnd=t.Â.selectionEnd;html=p.document.getElementsByTagName(\"html\")[0];frame=p.document.getElementById(\"frame_\"+t.id);if(to&&to!=old){t.fullscreen['old_overflow']=p.get_css_property(html,\"overflow\");t.fullscreen['old_height']=p.get_css_property(html,\"height\");t.fullscreen['old_width']=p.get_css_property(html,\"width\");t.fullscreen['old_scrollTop']=html.scrollTop;t.fullscreen['old_scrollLeft']=html.scrollLeft;t.fullscreen['old_zIndex']=p.get_css_property(frame,\"z-index\");if(t.isOpera){html.Ç.height=\"100%\";html.Ç.width=\"100%\";}html.Ç.overflow=\"hidden\";html.scrollTop=0;html.scrollLeft=0;frame.Ç.position=\"absolute\";frame.Ç.width=html.clientWidth+\"px\";frame.Ç.height=html.clientHeight+\"px\";frame.Ç.display=\"block\";frame.Ç.zIndex=\"999999\";frame.Ç.top=\"0px\";frame.Ç.left=\"0px\";frame.Ç.top=\"-\"+p.calculeOffsetTop(frame)+\"px\";frame.Ç.left=\"-\"+p.calculeOffsetLeft(frame)+\"px\";t.switchClassSticky(icon,'editAreaButtonSelected',Ì);t.fullscreen['allow_resize']=t.resize_allowed;t.allow_resize(Ì);if(t.isFirefox){p.eAL.execCommand(t.id,\"update_size();\");t.area_select(selStart,selEnd-selStart);t.scroll_to_view();t.focus();}\nelse{setTimeout(\"È.eAL.execCommand('\"+t.id+\"','update_size();');eA.focus();\",10);}}\nelse if(to!=old){frame.Ç.position=\"static\";frame.Ç.zIndex=t.fullscreen['old_zIndex'];if(t.isOpera){html.Ç.height=\"auto\";html.Ç.width=\"auto\";html.Ç.overflow=\"auto\";}\nelse if(t.isIE&&p!=top){html.Ç.overflow=\"auto\";}\nelse{html.Ç.overflow=t.fullscreen['old_overflow'];}html.scrollTop=t.fullscreen['old_scrollTop'];html.scrollLeft=t.fullscreen['old_scrollLeft'];p.eAL.hide(t.id);p.eAL.show(t.id);t.switchClassSticky(icon,'editAreaButtonNormal',Ì);if(t.fullscreen['allow_resize'])t.allow_resize(t.fullscreen['allow_resize']);if(t.isFirefox){t.area_select(selStart,selEnd-selStart);setTimeout(\"eA.scroll_to_view();\",10);}}};EA.Ä.allow_resize=Ã(allow){var resize=_$(\"resize_area\");if(allow){resize.Ç.visibility=\"visible\";È.eAL.add_event(resize,\"mouseup\",eA.start_resize);}\nelse{resize.Ç.visibility=\"hidden\";È.eAL.remove_event(resize,\"mouseup\",eA.start_resize);}Á.resize_allowed=allow;};EA.Ä.change_syntax=Ã(new_syntax,is_waiting){if(new_syntax==Á.Å['syntax'])return Ë;var founded=Ì;for(var i=0;i<Á.syntax_list.Æ;i++){if(Á.syntax_list[i]==new_syntax)founded=Ë;}if(founded==Ë){if(!È.eAL.load_syntax[new_syntax]){if(!is_waiting)È.eAL.load_script(È.eAL.baseURL+\"reg_syntax/\"+new_syntax+\".js\");setTimeout(\"eA.change_syntax('\"+new_syntax+\"',Ë);\",100);Á.show_waiting_screen();}\nelse{if(!Á.allready_used_syntax[new_syntax]){È.eAL.init_syntax_regexp();Á.add_Ç(È.eAL.syntax[new_syntax][\"Çs\"]);Á.allready_used_syntax[new_syntax]=Ë;}var sel=_$(\"syntax_selection\");if(sel&&sel.Ê!=new_syntax){for(var i=0;i<sel.Æ;i++){if(sel.options[i].Ê&&sel.options[i].Ê==new_syntax)sel.options[i].selected=Ë;}}Á.Å['syntax']=new_syntax;Á.resync_highlight(Ë);Á.hide_waiting_screen();return Ë;}}return Ì;};EA.Ä.set_editable=Ã(is_editable){if(is_editable){document.body.className=\"\";Á.Â.readOnly=Ì;Á.is_editable=Ë;}\nelse{document.body.className=\"non_editable\";Á.Â.readOnly=Ë;Á.is_editable=Ì;}if(eAs[Á.id][\"displayed\"]==Ë)Á.update_size();};EA.Ä.toggle_word_wrap=Ã(){Á.set_word_wrap(!Á.Å['word_wrap']);};EA.Ä.set_word_wrap=Ã(to){var t=Á,a=t.Â;if(t.isOpera&&t.isOpera < 9.8){Á.Å['word_wrap']=Ì;t.switchClassSticky(_$(\"word_wrap\"),'editAreaButtonDisabled',Ë);return Ì;}if(to){wrap_mode='soft';Á.container.className+=' word_wrap';Á.container.Ç.width=\"\";Á.content_highlight.Ç.width=\"\";a.Ç.width=\"100%\";if(t.isIE&&t.isIE < 7){a.Ç.width=(a.offsetWidth-5)+\"px\";}t.switchClassSticky(_$(\"word_wrap\"),'editAreaButtonSelected',Ì);}\nelse{wrap_mode='off';Á.container.className=Á.container.className.replace(/word_wrap/g,'');t.switchClassSticky(_$(\"word_wrap\"),'editAreaButtonNormal',Ë);}Á.Â.previous_scrollWidth='';Á.Â.previous_scrollHeight='';a.wrap=wrap_mode;a.setAttribute('wrap',wrap_mode);if(!Á.isIE){var start=a.selectionStart,end=a.selectionEnd;var parNod=a.ÈNode,nxtSib=a.nextSibling;parNod.removeChild(a);parNod.insertBefore(a,nxtSib);Á.area_select(start,end-start);}Á.Å['word_wrap']=to;Á.focus();Á.update_size();Á.check_line_selection();};EA.Ä.open_file=Ã(Å){if(Å['id']!=\"undefined\"){var id=Å['id'];var new_file={};new_file['id']=id;new_file['title']=id;new_file['text']=\"\";new_file['É']=\"\";new_file['last_text_to_highlight']=\"\";new_file['last_hightlighted_text']=\"\";new_file['previous']=[];new_file['next']=[];new_file['last_undo']=\"\";new_file['smooth_selection']=Á.Å['smooth_selection'];new_file['do_highlight']=Á.Å['start_highlight'];new_file['syntax']=Á.Å['syntax'];new_file['scroll_top']=0;new_file['scroll_left']=0;new_file['selection_start']=0;new_file['selection_end']=0;new_file['edited']=Ì;new_file['font_size']=Á.Å[\"font_size\"];new_file['font_family']=Á.Å[\"font_family\"];new_file['word_wrap']=Á.Å[\"word_wrap\"];new_file['toolbar']={'links':{},'selects':{}};new_file['compare_edited_text']=new_file['text'];Á.files[id]=new_file;Á.update_file(id,Å);Á.files[id]['compare_edited_text']=Á.files[id]['text'];var html_id='tab_file_'+encodeURIComponent(id);Á.filesIdAssoc[html_id]=id;Á.files[id]['html_id']=html_id;if(!_$(Á.files[id]['html_id'])&&id!=\"\"){Á.tab_browsing_area.Ç.display=\"block\";var elem=document.createElement('li');elem.id=Á.files[id]['html_id'];var close=\"<img src=\\\"\"+È.eAL.baseURL+\"images/close.gif\\\" title=\\\"\"+Á.get_translation('close_tab','word')+\"\\\" onclick=\\\"eA.execCommand('close_file',eA.filesIdAssoc['\"+html_id+\"']);return Ì;\\\" class=\\\"hidden\\\" onmouseover=\\\"Á.className=''\\\" onmouseout=\\\"Á.className='hidden'\\\" />\";elem.innerHTML=\"<a onclick=\\\"javascript:eA.execCommand('switch_to_file',eA.filesIdAssoc['\"+html_id+\"']);\\\" selec=\\\"none\\\"><b><span><strong class=\\\"edited\\\">*</strong>\"+Á.files[id]['title']+close+\"</span></b></a>\";_$('tab_browsing_list').appendChild(elem);var elem=document.createElement('text');Á.update_size();}if(id!=\"\")Á.execCommand('file_open',Á.files[id]);Á.switch_to_file(id,Ë);return Ë;}\nelse return Ì;};EA.Ä.close_file=Ã(id){if(Á.files[id]){Á.save_file(id);if(Á.execCommand('file_close',Á.files[id])!==Ì){var li=_$(Á.files[id]['html_id']);li.ÈNode.removeChild(li);if(id==Á.curr_file){var next_file=\"\";var is_next=Ì;for(var i in Á.files){if(is_next){next_file=i;break;}\nelse if(i==id)is_next=Ë;\nelse next_file=i;}Á.switch_to_file(next_file);}delete(Á.files[id]);Á.update_size();}}};EA.Ä.save_file=Ã(id){var t=Á,save,a_links,a_selects,save_butt,img,i;if(t.files[id]){var save=t.files[id];save['É']=t.É;save['last_text_to_highlight']=t.last_text_to_highlight;save['last_hightlighted_text']=t.last_hightlighted_text;save['previous']=t.previous;save['next']=t.next;save['last_undo']=t.last_undo;save['smooth_selection']=t.smooth_selection;save['do_highlight']=t.do_highlight;save['syntax']=t.Å['syntax'];save['text']=t.Â.Ê;save['scroll_top']=t.result.scrollTop;save['scroll_left']=t.result.scrollLeft;save['selection_start']=t.É[\"selectionStart\"];save['selection_end']=t.É[\"selectionEnd\"];save['font_size']=t.Å[\"font_size\"];save['font_family']=t.Å[\"font_family\"];save['word_wrap']=t.Å[\"word_wrap\"];save['toolbar']={'links':{},'selects':{}};a_links=_$(\"toolbar_1\").getElementsByTagName(\"a\");for(i=0;i<a_links.Æ;i++){if(a_links[i].getAttribute('fileSpecific')=='yes'){save_butt={};img=a_links[i].getElementsByTagName('img')[0];save_butt['classLock']=img.classLock;save_butt['className']=img.className;save_butt['oldClassName']=img.oldClassName;save['toolbar']['links'][a_links[i].id]=save_butt;}}a_selects=_$(\"toolbar_1\").getElementsByTagName(\"select\");for(i=0;i<a_selects.Æ;i++){if(a_selects[i].getAttribute('fileSpecific')=='yes'){save['toolbar']['selects'][a_selects[i].id]=a_selects[i].Ê;}}t.files[id]=save;return save;}return Ì;};EA.Ä.update_file=Ã(id,new_Ês){for(var i in new_Ês){Á.files[id][i]=new_Ês[i];}};EA.Ä.display_file=Ã(id){var t=Á,a=t.Â,new_file,a_lis,a_selects,a_links,a_options,i,j;if(id==''){a.readOnly=Ë;t.tab_browsing_area.Ç.display=\"none\";_$(\"no_file_selected\").Ç.display=\"block\";t.result.className=\"empty\";if(!t.files['']){t.open_file({id:''});}}\nelse if(typeof(t.files[id])=='undefined'){return Ì;}\nelse{t.result.className=\"\";a.readOnly=!t.is_editable;_$(\"no_file_selected\").Ç.display=\"none\";t.tab_browsing_area.Ç.display=\"block\";}t.check_redo(Ë);t.check_undo(Ë);t.curr_file=id;a_lis=t.tab_browsing_area.getElementsByTagName('li');for(i=0;i<a_lis.Æ;i++){if(a_lis[i].id==t.files[id]['html_id'])a_lis[i].className='selected';\nelse a_lis[i].className='';}new_file=t.files[id];a.Ê=new_file['text'];t.set_font(new_file['font_family'],new_file['font_size']);t.area_select(new_file['selection_start'],new_file['selection_end']-new_file['selection_start']);t.manage_size(Ë);t.result.scrollTop=new_file['scroll_top'];t.result.scrollLeft=new_file['scroll_left'];t.previous=new_file['previous'];t.next=new_file['next'];t.last_undo=new_file['last_undo'];t.check_redo(Ë);t.check_undo(Ë);t.execCommand(\"change_highlight\",new_file['do_highlight']);t.execCommand(\"change_syntax\",new_file['syntax']);t.execCommand(\"change_smooth_selection_mode\",new_file['smooth_selection']);t.execCommand(\"set_word_wrap\",new_file['word_wrap']);a_links=new_file['toolbar']['links'];for(i in a_links){if(img=_$(i).getElementsByTagName('img')[0]){img.classLock=a_links[i]['classLock'];img.className=a_links[i]['className'];img.oldClassName=a_links[i]['oldClassName'];}}a_selects=new_file['toolbar']['selects'];for(i in a_selects){a_options=_$(i).options;for(j=0;j<a_options.Æ;j++){if(a_options[j].Ê==a_selects[i])_$(i).options[j].selected=Ë;}}};EA.Ä.switch_to_file=Ã(file_to_show,force_refresh){if(file_to_show!=Á.curr_file||force_refresh){Á.save_file(Á.curr_file);if(Á.curr_file!='')Á.execCommand('file_switch_off',Á.files[Á.curr_file]);Á.display_file(file_to_show);if(file_to_show!='')Á.execCommand('file_switch_on',Á.files[file_to_show]);}};EA.Ä.get_file=Ã(id){if(id==Á.curr_file)Á.save_file(id);return Á.files[id];};EA.Ä.get_all_files=Ã(){tmp_files=Á.files;Á.save_file(Á.curr_file);if(tmp_files[''])delete(Á.files['']);return tmp_files;};EA.Ä.check_file_changes=Ã(){var id=Á.curr_file;if(Á.files[id]&&Á.files[id]['compare_edited_text']!=undefined){if(Á.files[id]['compare_edited_text'].Æ==Á.Â.Ê.Æ&&Á.files[id]['compare_edited_text']==Á.Â.Ê){if(Á.files[id]['edited']!=Ì)Á.set_file_edited_mode(id,Ì);}\nelse{if(Á.files[id]['edited']!=Ë)Á.set_file_edited_mode(id,Ë);}}};EA.Ä.set_file_edited_mode=Ã(id,to){if(Á.files[id]&&_$(Á.files[id]['html_id'])){var link=_$(Á.files[id]['html_id']).getElementsByTagName('a')[0];if(to==Ë){link.className='edited';}\nelse{link.className='';if(id==Á.curr_file)text=Á.Â.Ê;\nelse text=Á.files[id]['text'];Á.files[id]['compare_edited_text']=text;}Á.files[id]['edited']=to;}};EA.Ä.set_show_line_colors=Ã(new_Ê){Á.show_line_colors=new_Ê;if(new_Ê)Á.selection_field.className+=' show_colors';\nelse Á.selection_field.className=Á.selection_field.className.replace(/ show_colors/g,'');};var EA_keys={8:\"Retour arriere\",9:\"Tabulation\",12:\"Milieu(pave numerique)\",13:\"Entrer\",16:\"Shift\",17:\"Ctrl\",18:\"Alt\",19:\"Pause\",20:\"Verr Maj\",27:\"Esc\",32:\"Space\",33:\"Page up\",34:\"Page down\",35:\"End\",36:\"Begin\",37:\"Left\",38:\"Up\",39:\"Right\",40:\"Down\",44:\"Impr ecran\",45:\"Inser\",46:\"Suppr\",91:\"Menu Demarrer Windows / touche pomme Mac\",92:\"Menu Demarrer Windows\",93:\"Menu contextuel Windows\",112:\"F1\",113:\"F2\",114:\"F3\",115:\"F4\",116:\"F5\",117:\"F6\",118:\"F7\",119:\"F8\",120:\"F9\",121:\"F10\",122:\"F11\",123:\"F12\",144:\"Verr Num\",145:\"Arret defil\"};Ã keyDown(e){if(!e){e=event;}for(var i in eA.plugins){if(typeof(eA.plugins[i].onkeydown)==\"Ã\"){if(eA.plugins[i].onkeydown(e)===Ì){if(eA.isIE)e.keyCode=0;return Ì;}}}var target_id=(e.target||e.srcElement).id;var use=Ì;if(EA_keys[e.keyCode])letter=EA_keys[e.keyCode];\nelse letter=String.fromCharCode(e.keyCode);var low_letter=letter.toLowerCase();if(letter==\"Page up\"&&!AltPressed(e)&&!eA.isOpera){eA.execCommand(\"scroll_page\",{\"dir\":\"up\",\"shift\":ShiftPressed(e)});use=Ë;}\nelse if(letter==\"Page down\"&&!AltPressed(e)&&!eA.isOpera){eA.execCommand(\"scroll_page\",{\"dir\":\"down\",\"shift\":ShiftPressed(e)});use=Ë;}\nelse if(eA.is_editable==Ì){return Ë;}\nelse if(letter==\"Tabulation\"&&target_id==\"Â\"&&!CtrlPressed(e)&&!AltPressed(e)){if(ShiftPressed(e))eA.execCommand(\"invert_tab_selection\");\nelse eA.execCommand(\"tab_selection\");use=Ë;if(eA.isOpera||(eA.isFirefox&&eA.isMac))setTimeout(\"eA.execCommand('focus');\",1);}\nelse if(letter==\"Entrer\"&&target_id==\"Â\"){if(eA.press_enter())use=Ë;}\nelse if(letter==\"Entrer\"&&target_id==\"area_search\"){eA.execCommand(\"area_search\");use=Ë;}\nelse if(letter==\"Esc\"){eA.execCommand(\"close_all_inline_popup\",e);use=Ë;}\nelse if(CtrlPressed(e)&&!AltPressed(e)&&!ShiftPressed(e)){switch(low_letter){case \"f\":eA.execCommand(\"area_search\");use=Ë;break;case \"r\":eA.execCommand(\"area_replace\");use=Ë;break;case \"q\":eA.execCommand(\"close_all_inline_popup\",e);use=Ë;break;case \"h\":eA.execCommand(\"change_highlight\");use=Ë;break;case \"g\":setTimeout(\"eA.execCommand('go_to_line');\",5);use=Ë;break;case \"e\":eA.execCommand(\"show_help\");use=Ë;break;case \"z\":use=Ë;eA.execCommand(\"undo\");break;case \"y\":use=Ë;eA.execCommand(\"redo\");break;default:break;}}if(eA.next.Æ > 0){setTimeout(\"eA.check_redo();\",10);}setTimeout(\"eA.check_file_changes();\",10);if(use){if(eA.isIE)e.keyCode=0;return Ì;}return Ë;};Ã AltPressed(e){if(window.event){return(window.event.altKey);}\nelse{if(e.modifiers)return(e.altKey||(e.modifiers % 2));\nelse return e.altKey;}};Ã CtrlPressed(e){if(window.event){return(window.event.ctrlKey);}\nelse{return(e.ctrlKey||(e.modifiers==2)||(e.modifiers==3)||(e.modifiers>5));}};Ã ShiftPressed(e){if(window.event){return(window.event.shiftKey);}\nelse{return(e.shiftKey||(e.modifiers>3));}}; EA.Ä.show_search=Ã(){if(_$(\"area_search_replace\").Ç.visibility==\"visible\"){Á.hidden_search();}\nelse{Á.open_inline_popup(\"area_search_replace\");var text=Á.area_get_selection();var search=text.split(\"\\n\")[0];_$(\"area_search\").Ê=search;_$(\"area_search\").focus();}};EA.Ä.hidden_search=Ã(){Á.close_inline_popup(\"area_search_replace\");};EA.Ä.area_search=Ã(mode){if(!mode)mode=\"search\";_$(\"area_search_msg\").innerHTML=\"\";var search=_$(\"area_search\").Ê;Á.Â.focus();Á.Â.ÂFocused=Ë;var infos=Á.get_selection_infos();var start=infos[\"selectionStart\"];var pos=-1;var pos_begin=-1;var Æ=search.Æ;if(_$(\"area_search_replace\").Ç.visibility!=\"visible\"){Á.show_search();return;}if(search.Æ==0){_$(\"area_search_msg\").innerHTML=Á.get_translation(\"search_field_empty\");return;}if(mode!=\"replace\"){if(_$(\"area_search_reg_exp\").checked)start++;\nelse start+=search.Æ;}if(_$(\"area_search_reg_exp\").checked){var opt=\"m\";if(!_$(\"area_search_match_case\").checked)opt+=\"i\";var reg=new RegExp(search,opt);pos=infos[\"full_text\"].substr(start).search(reg);pos_begin=infos[\"full_text\"].search(reg);if(pos!=-1){pos+=start;Æ=infos[\"full_text\"].substr(start).match(reg)[0].Æ;}\nelse if(pos_begin!=-1){Æ=infos[\"full_text\"].match(reg)[0].Æ;}}\nelse{if(_$(\"area_search_match_case\").checked){pos=infos[\"full_text\"].indexOf(search,start);pos_begin=infos[\"full_text\"].indexOf(search);}\nelse{pos=infos[\"full_text\"].toLowerCase().indexOf(search.toLowerCase(),start);pos_begin=infos[\"full_text\"].toLowerCase().indexOf(search.toLowerCase());}}if(pos==-1&&pos_begin==-1){_$(\"area_search_msg\").innerHTML=\"<strong>\"+search+\"</strong> \"+Á.get_translation(\"not_found\");return;}\nelse if(pos==-1&&pos_begin !=-1){begin=pos_begin;_$(\"area_search_msg\").innerHTML=Á.get_translation(\"restart_search_at_begin\");}\nelse begin=pos;if(mode==\"replace\"&&pos==infos[\"indexOfCursor\"]){var replace=_$(\"area_replace\").Ê;var new_text=\"\";if(_$(\"area_search_reg_exp\").checked){var opt=\"m\";if(!_$(\"area_search_match_case\").checked)opt+=\"i\";var reg=new RegExp(search,opt);new_text=infos[\"full_text\"].substr(0,begin)+infos[\"full_text\"].substr(start).replace(reg,replace);}\nelse{new_text=infos[\"full_text\"].substr(0,begin)+replace+infos[\"full_text\"].substr(begin+Æ);}Á.Â.Ê=new_text;Á.area_select(begin,Æ);Á.area_search();}\nelse Á.area_select(begin,Æ);};EA.Ä.area_replace=Ã(){Á.area_search(\"replace\");};EA.Ä.area_replace_all=Ã(){var base_text=Á.Â.Ê;var search=_$(\"area_search\").Ê;var replace=_$(\"area_replace\").Ê;if(search.Æ==0){_$(\"area_search_msg\").innerHTML=Á.get_translation(\"search_field_empty\");return;}var new_text=\"\";var nb_change=0;if(_$(\"area_search_reg_exp\").checked){var opt=\"mg\";if(!_$(\"area_search_match_case\").checked)opt+=\"i\";var reg=new RegExp(search,opt);nb_change=infos[\"full_text\"].match(reg).Æ;new_text=infos[\"full_text\"].replace(reg,replace);}\nelse{if(_$(\"area_search_match_case\").checked){var tmp_tab=base_text.split(search);nb_change=tmp_tab.Æ-1;new_text=tmp_tab.join(replace);}\nelse{var lower_Ê=base_text.toLowerCase();var lower_search=search.toLowerCase();var start=0;var pos=lower_Ê.indexOf(lower_search);while(pos!=-1){nb_change++;new_text+=Á.Â.Ê.substring(start,pos)+replace;start=pos+search.Æ;pos=lower_Ê.indexOf(lower_search,pos+1);}new_text+=Á.Â.Ê.substring(start);}}if(new_text==base_text){_$(\"area_search_msg\").innerHTML=\"<strong>\"+search+\"</strong> \"+Á.get_translation(\"not_found\");}\nelse{Á.Â.Ê=new_text;_$(\"area_search_msg\").innerHTML=\"<strong>\"+nb_change+\"</strong> \"+Á.get_translation(\"occurrence_replaced\");setTimeout(\"eA.Â.focus();eA.Â.ÂFocused=Ë;\",100);}}; EA.Ä.change_highlight=Ã(change_to){if(Á.Å[\"syntax\"].Æ==0&&change_to==Ì){Á.switchClassSticky(_$(\"highlight\"),'editAreaButtonDisabled',Ë);Á.switchClassSticky(_$(\"reset_highlight\"),'editAreaButtonDisabled',Ë);return Ì;}if(Á.do_highlight==change_to)return Ì;Á.getIESelection();var pos_start=Á.Â.selectionStart;var pos_end=Á.Â.selectionEnd;if(Á.do_highlight===Ë||change_to==Ì)Á.disable_highlight();\nelse Á.enable_highlight();Á.Â.focus();Á.Â.selectionStart=pos_start;Á.Â.selectionEnd=pos_end;Á.setIESelection();};EA.Ä.disable_highlight=Ã(displayOnly){var t=Á,a=t.Â,new_Obj,old_class,new_class;t.selection_field.innerHTML=\"\";t.selection_field_text.innerHTML=\"\";t.content_highlight.Ç.visibility=\"hidden\";new_Obj=t.content_highlight.cloneNode(Ì);new_Obj.innerHTML=\"\";t.content_highlight.ÈNode.insertBefore(new_Obj,t.content_highlight);t.content_highlight.ÈNode.removeChild(t.content_highlight);t.content_highlight=new_Obj;old_class=È.getAttribute(a,\"class\");if(old_class){new_class=old_class.replace(\"hidden\",\"\");È.setAttribute(a,\"class\",new_class);}a.Ç.backgroundColor=\"transÈ\";t.switchClassSticky(_$(\"highlight\"),'editAreaButtonNormal',Ë);t.switchClassSticky(_$(\"reset_highlight\"),'editAreaButtonDisabled',Ë);t.do_highlight=Ì;t.switchClassSticky(_$(\"change_smooth_selection\"),'editAreaButtonSelected',Ë);if(typeof(t.smooth_selection_before_highlight)!=\"undefined\"&&t.smooth_selection_before_highlight===Ì){t.change_smooth_selection_mode(Ì);}};EA.Ä.enable_highlight=Ã(){var t=Á,a=t.Â,new_class;t.show_waiting_screen();t.content_highlight.Ç.visibility=\"visible\";new_class=È.getAttribute(a,\"class\")+\" hidden\";È.setAttribute(a,\"class\",new_class);if(t.isIE)a.Ç.backgroundColor=\"#FFFFFF\";t.switchClassSticky(_$(\"highlight\"),'editAreaButtonSelected',Ì);t.switchClassSticky(_$(\"reset_highlight\"),'editAreaButtonNormal',Ì);t.smooth_selection_before_highlight=t.smooth_selection;if(!t.smooth_selection)t.change_smooth_selection_mode(Ë);t.switchClassSticky(_$(\"change_smooth_selection\"),'editAreaButtonDisabled',Ë);t.do_highlight=Ë;t.resync_highlight();t.hide_waiting_screen();};EA.Ä.maj_highlight=Ã(infos){var debug_opti=\"\",tps_start=new Date().getTime(),tps_middle_opti=new Date().getTime();var t=Á,hightlighted_text,updated_highlight;var textToHighlight=infos[\"full_text\"],doSyntaxOpti=Ì,doHtmlOpti=Ì,stay_begin=\"\",stay_end=\"\",trace_new,trace_last;if(t.last_text_to_highlight==infos[\"full_text\"]&&t.resync_highlight!==Ë)return;if(t.reload_highlight===Ë){t.reload_highlight=Ì;}\nelse if(textToHighlight.Æ==0){textToHighlight=\"\\n \";}\nelse{changes=t.checkTextEvolution(t.last_text_to_highlight,textToHighlight);trace_new=t.get_syntax_trace(changes.newTextLine).replace(/\\r/g,'');trace_last=t.get_syntax_trace(changes.lastTextLine).replace(/\\r/g,'');doSyntaxOpti=(trace_new==trace_last);if(!doSyntaxOpti&&trace_new==\"\\n\"+trace_last&&/^[ \t\s]*\\n[ \t\s]*$/.test(changes.newText.replace(/\\r/g,''))&&changes.lastText==\"\"){doSyntaxOpti=Ë;}if(doSyntaxOpti){tps_middle_opti=new Date().getTime();stay_begin=t.last_hightlighted_text.split(\"\\n\").slice(0,changes.lineStart).join(\"\\n\");if(changes.lineStart>0)stay_begin+=\"\\n\";stay_end=t.last_hightlighted_text.split(\"\\n\").slice(changes.lineLastEnd+1).join(\"\\n\");if(stay_end.Æ>0)stay_end=\"\\n\"+stay_end;if(stay_begin.split('<span').Æ !=stay_begin.split('</span').Æ||stay_end.split('<span').Æ !=stay_end.split('</span').Æ){doSyntaxOpti=Ì;stay_end='';stay_begin='';}\nelse{if(stay_begin.Æ==0&&changes.posLastEnd==-1)changes.newTextLine+=\"\\n\";textToHighlight=changes.newTextLine;}}if(t.Å[\"debug\"]){var ch=changes;debug_opti=(doSyntaxOpti?\"Optimisation\":\"No optimisation\")+\" start:\"+ch.posStart+\"(\"+ch.lineStart+\")\"+\" end_new:\"+ch.posNewEnd+\"(\"+ch.lineNewEnd+\")\"+\" end_last:\"+ch.posLastEnd+\"(\"+ch.lineLastEnd+\")\"+\"\\nchanged_text:\"+ch.newText+\"=> trace:\"+trace_new+\"\\nchanged_last_text:\"+ch.lastText+\"=> trace:\"+trace_last+\"\\nchanged_line:\"+ch.newTextLine+\"\\nlast_changed_line:\"+ch.lastTextLine+\"\\nstay_begin:\"+stay_begin.slice(-100)+\"\\nstay_end:\"+stay_end.substr(0,100);+\"\\n\";}}tps_end_opti=new Date().getTime();updated_highlight=t.colorize_text(textToHighlight);tpsAfterReg=new Date().getTime();doSyntaxOpti=doHtmlOpti=Ì;if(doSyntaxOpti){try{var replacedBloc,i,nbStart='',nbEnd='',newHtml,ÆOld,ÆNew;replacedBloc=t.last_hightlighted_text.substring(stay_begin.Æ,t.last_hightlighted_text.Æ-stay_end.Æ);ÆOld=replacedBloc.Æ;ÆNew=updated_highlight.Æ;for(i=0;i < ÆOld&&i < ÆNew&&replacedBloc.charAt(i)==updated_highlight.charAt(i);i++){}nbStart=i;for(i=0;i+nbStart < ÆOld&&i+nbStart < ÆNew&&replacedBloc.charAt(ÆOld-i-1)==updated_highlight.charAt(ÆNew-i-1);i++){}nbEnd=i;lastHtml=replacedBloc.substring(nbStart,ÆOld-nbEnd);newHtml=updated_highlight.substring(nbStart,ÆNew-nbEnd);if(newHtml.indexOf('<span')==-1&&newHtml.indexOf('</span')==-1&&lastHtml.indexOf('<span')==-1&&lastHtml.indexOf('</span')==-1){var beginStr,nbOpendedSpan,nbClosedSpan,nbUnchangedChars,span,textNode;doHtmlOpti=Ë;beginStr=t.last_hightlighted_text.substr(0,stay_begin.Æ+nbStart);newHtml=newHtml.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');nbOpendedSpan=beginStr.split('<span').Æ-1;nbClosedSpan=beginStr.split('</span').Æ-1;span=t.content_highlight.getElementsByTagName('span')[ nbOpendedSpan ];ÈSpan=span;maxStartOffset=maxEndOffset=0;if(nbOpendedSpan==nbClosedSpan){while(ÈSpan.ÈNode !=t.content_highlight&&ÈSpan.ÈNode.tagName !='PRE'){ÈSpan=ÈSpan.ÈNode;}}\nelse{maxStartOffset=maxEndOffset=beginStr.Æ+1;nbClosed=beginStr.substr(Math.max(0,beginStr.lastIndexOf('<span',maxStartOffset-1))).split('</span').Æ-1;while(nbClosed > 0){nbClosed--;ÈSpan=ÈSpan.ÈNode;}while(ÈSpan.ÈNode !=t.content_highlight&&ÈSpan.ÈNode.tagName !='PRE'&&(tmpMaxStartOffset=Math.max(0,beginStr.lastIndexOf('<span',maxStartOffset-1)))<(tmpMaxEndOffset=Math.max(0,beginStr.lastIndexOf('</span',maxEndOffset-1)))){maxStartOffset=tmpMaxStartOffset;maxEndOffset=tmpMaxEndOffset;}}if(ÈSpan.ÈNode==t.content_highlight||ÈSpan.ÈNode.tagName=='PRE'){maxStartOffset=Math.max(0,beginStr.indexOf('<span'));}if(maxStartOffset==beginStr.Æ){nbSubSpanBefore=0;}\nelse{lastEndPos=Math.max(0,beginStr.lastIndexOf('>',maxStartOffset));nbSubSpanBefore=beginStr.substr(lastEndPos).split('<span').Æ-1;}if(nbSubSpanBefore==0){textNode=ÈSpan.firstChild;}\nelse{lastSubSpan=ÈSpan.getElementsByTagName('span')[ nbSubSpanBefore-1 ];while(lastSubSpan.ÈNode !=ÈSpan){lastSubSpan=lastSubSpan.ÈNode;}if(lastSubSpan.nextSibling==null||lastSubSpan.nextSibling.nodeType !=3){textNode=document.createTextNode('');lastSubSpan.ÈNode.insertBefore(textNode,lastSubSpan.nextSibling);}\nelse{textNode=lastSubSpan.nextSibling;}}if((lastIndex=beginStr.lastIndexOf('>'))==-1){nbUnchangedChars=beginStr.Æ;}\nelse{nbUnchangedChars=beginStr.substr(lastIndex+1).replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&').Æ;}if(t.isIE){nbUnchangedChars-=(beginStr.substr(beginStr.Æ-nbUnchangedChars).split(\"\\n\").Æ-1);textNode.replaceData(nbUnchangedChars,lastHtml.replace(/\\n/g,'').Æ,newHtml.replace(/\\n/g,''));}\nelse{textNode.replaceData(nbUnchangedChars,lastHtml.Æ,newHtml);}}}catch(e){doHtmlOpti=Ì;}}tpsAfterOpti2=new Date().getTime();hightlighted_text=stay_begin+updated_highlight+stay_end;if(!doHtmlOpti){var new_Obj=t.content_highlight.cloneNode(Ì);if((t.isIE&&t.isIE < 8)||(t.isOpera&&t.isOpera < 9.6))new_Obj.innerHTML=\"<pre><span class='\"+t.Å[\"syntax\"]+\"'>\"+hightlighted_text+\"</span></pre>\";\nelse new_Obj.innerHTML=\"<span class='\"+t.Å[\"syntax\"]+\"'>\"+hightlighted_text+\"</span>\";t.content_highlight.ÈNode.replaceChild(new_Obj,t.content_highlight);t.content_highlight=new_Obj;}t.last_text_to_highlight=infos[\"full_text\"];t.last_hightlighted_text=hightlighted_text;tps3=new Date().getTime();if(t.Å[\"debug\"]){t.debug.Ê=\"Tps optimisation \"+(tps_end_opti-tps_start)+\" | tps reg exp:\"+(tpsAfterReg-tps_end_opti)+\" | tps opti HTML:\"+(tpsAfterOpti2-tpsAfterReg)+' '+(doHtmlOpti ? 'yes':'no')+\" | tps update highlight content:\"+(tps3-tpsAfterOpti2)+\" | tpsTotal:\"+(tps3-tps_start)+\"(\"+tps3+\")\\n\"+debug_opti;}};EA.Ä.resync_highlight=Ã(reload_now){Á.reload_highlight=Ë;Á.last_text_to_highlight=\"\";Á.focus();if(reload_now)Á.check_line_selection(Ì);}; EA.Ä.comment_or_quote=Ã(){var new_class=\"\",close_tag=\"\",sy,arg,i;sy=È.eAL.syntax[eA.current_code_lang];arg=EA.Ä.comment_or_quote.arguments[0];for(i in sy[\"quotes\"]){if(arg.indexOf(i)==0){new_class=\"quotesmarks\";close_tag=sy[\"quotes\"][i];}}if(new_class.Æ==0){for(var i in sy[\"comments\"]){if(arg.indexOf(i)==0){new_class=\"comments\";close_tag=sy[\"comments\"][i];}}}if(close_tag==\"\\n\"){return \"µ__\"+new_class+\"__µ\"+arg.replace(/(\\r?\\n)?$/m,\"µ_END_µ$1\");}\nelse{reg=new RegExp(È.eAL.get_escaped_regexp(close_tag)+\"$\",\"m\");if(arg.search(reg)!=-1)return \"µ__\"+new_class+\"__µ\"+arg+\"µ_END_µ\";\nelse return \"µ__\"+new_class+\"__µ\"+arg;}};EA.Ä.get_syntax_trace=Ã(text){if(Á.Å[\"syntax\"].Æ>0&&È.eAL.syntax[Á.Å[\"syntax\"]][\"syntax_trace_regexp\"])return text.replace(È.eAL.syntax[Á.Å[\"syntax\"]][\"syntax_trace_regexp\"],\"$3\");};EA.Ä.colorize_text=Ã(text){text=\" \"+text;if(Á.Å[\"syntax\"].Æ>0)text=Á.apply_syntax(text,Á.Å[\"syntax\"]);return text.substr(1).replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/µ_END_µ/g,\"</span>\").replace(/µ__([a-zA-Z0-9]+)__µ/g,\"<span class='$1'>\");};EA.Ä.apply_syntax=Ã(text,lang){var sy;Á.current_code_lang=lang;if(!È.eAL.syntax[lang])return text;sy=È.eAL.syntax[lang];if(sy[\"custom_regexp\"]['before']){for(var i in sy[\"custom_regexp\"]['before']){var convert=\"$1µ__\"+sy[\"custom_regexp\"]['before'][i]['class']+\"__µ$2µ_END_µ$3\";text=text.replace(sy[\"custom_regexp\"]['before'][i]['regexp'],convert);}}if(sy[\"comment_or_quote_reg_exp\"]){text=text.replace(sy[\"comment_or_quote_reg_exp\"],Á.comment_or_quote);}if(sy[\"keywords_reg_exp\"]){for(var i in sy[\"keywords_reg_exp\"]){text=text.replace(sy[\"keywords_reg_exp\"][i],'µ__'+i+'__µ$2µ_END_µ');}}if(sy[\"delimiters_reg_exp\"]){text=text.replace(sy[\"delimiters_reg_exp\"],'µ__delimiters__µ$1µ_END_µ');}if(sy[\"operators_reg_exp\"]){text=text.replace(sy[\"operators_reg_exp\"],'µ__operators__µ$1µ_END_µ');}if(sy[\"custom_regexp\"]['after']){for(var i in sy[\"custom_regexp\"]['after']){var convert=\"$1µ__\"+sy[\"custom_regexp\"]['after'][i]['class']+\"__µ$2µ_END_µ$3\";text=text.replace(sy[\"custom_regexp\"]['after'][i]['regexp'],convert);}}return text;};var editArea= eA;EditArea=EA;</script>".replace(/Á/g,'this').replace(/Â/g,'textarea').replace(/Ã/g,'function').replace(/Ä/g,'prototype').replace(/Å/g,'settings').replace(/Æ/g,'length').replace(/Ç/g,'style').replace(/È/g,'parent').replace(/É/g,'last_selection').replace(/Ê/g,'value').replace(/Ë/g,'true').replace(/Ì/g,'false');
37
- editAreaLoader.template= "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" > <head> <title>EditArea</title> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/> [__CSSRULES__] [__JSCODE__] </head> <body> <div id='editor'> <div class='area_toolbar' id='toolbar_1'>[__TOOLBAR__]</div> <div class='area_toolbar' id='tab_browsing_area'><ul id='tab_browsing_list' class='menu'> <li> </li> </ul></div> <div id='result'> <div id='no_file_selected'></div> <div id='container'> <div id='cursor_pos' class='edit_area_cursor'>&nbsp;</div> <div id='end_bracket' class='edit_area_cursor'>&nbsp;</div> <div id='selection_field'></div> <div id='line_number' selec='none'></div> <div id='content_highlight'></div> <div id='test_font_size'></div> <div id='selection_field_text'></div> <textarea id='textarea' wrap='off' onchange='editArea.execCommand(\"onchange\");' onfocus='javascript:editArea.textareaFocused=true;' onblur='javascript:editArea.textareaFocused=false;'> </textarea> </div> </div> <div class='area_toolbar' id='toolbar_2'> <table class='statusbar' cellspacing='0' cellpadding='0'> <tr> <td class='total' selec='none'>{$position}:</td> <td class='infos' selec='none'> {$line_abbr} <span id='linePos'>0</span>, {$char_abbr} <span id='currPos'>0</span> </td> <td class='total' selec='none'>{$total}:</td> <td class='infos' selec='none'> {$line_abbr} <span id='nbLine'>0</span>, {$char_abbr} <span id='nbChar'>0</span> </td> <td class='resize'> <span id='resize_area'><img src='[__BASEURL__]images/statusbar_resize.gif' alt='resize' selec='none'></span> </td> </tr> </table> </div> </div> <div id='processing'> <div id='processing_text'> {$processing} </div> </div> <div id='area_search_replace' class='editarea_popup'> <table cellspacing='2' cellpadding='0' style='width: 100%'> <tr> <td selec='none'>{$search}</td> <td><input type='text' id='area_search' /></td> <td id='close_area_search_replace'> <a onclick='Javascript:editArea.execCommand(\"hidden_search\")'><img selec='none' src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a><br /> </tr><tr> <td selec='none'>{$replace}</td> <td><input type='text' id='area_replace' /></td> <td><img id='move_area_search_replace' onmousedown='return parent.start_move_element(event,\"area_search_replace\", parent.frames[\"frame_\"+editArea.id]);' src='[__BASEURL__]images/move.gif' alt='{$move_popup}' title='{$move_popup}' /></td> </tr> </table> <div class='button'> <input type='checkbox' id='area_search_match_case' /><label for='area_search_match_case' selec='none'>{$match_case}</label> <input type='checkbox' id='area_search_reg_exp' /><label for='area_search_reg_exp' selec='none'>{$reg_exp}</label> <br /> <a onclick='Javascript:editArea.execCommand(\"area_search\")' selec='none'>{$find_next}</a> <a onclick='Javascript:editArea.execCommand(\"area_replace\")' selec='none'>{$replace}</a> <a onclick='Javascript:editArea.execCommand(\"area_replace_all\")' selec='none'>{$replace_all}</a><br /> </div> <div id='area_search_msg' selec='none'></div> </div> <div id='edit_area_help' class='editarea_popup'> <div class='close_popup'> <a onclick='Javascript:editArea.execCommand(\"close_all_inline_popup\")'><img src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a> </div> <div><h2>Editarea [__EA_VERSION__]</h2><br /> <h3>{$shortcuts}:</h3> {$tab}: {$add_tab}<br /> {$shift}+{$tab}: {$remove_tab}<br /> {$ctrl}+f: {$search_command}<br /> {$ctrl}+r: {$replace_command}<br /> {$ctrl}+h: {$highlight}<br /> {$ctrl}+g: {$go_to_line}<br /> {$ctrl}+z: {$undo}<br /> {$ctrl}+y: {$redo}<br /> {$ctrl}+e: {$help}<br /> {$ctrl}+q, {$esc}: {$close_popup}<br /> {$accesskey} E: {$toggle}<br /> <br /> <em>{$about_notice}</em> <br /><div class='copyright'>&copy; Christophe Dolivet 2007-2010</div> </div> </div> </body> </html> ";
38
- editAreaLoader.iframe_css= "<style>body,html{margin:0;padding:0;height:100%;border:none;overflow:hidden;background-color:#FFF;}body,html,table,form,textarea{font:12px monospace,sans-serif;}#editor{border:solid #888 1px;overflow:hidden;}#result{z-index:4;overflow-x:auto;overflow-y:scroll;border-top:solid #888 1px;border-bottom:solid #888 1px;position:relative;clear:both;}#result.empty{overflow:hidden;}#container{overflow:hidden;border:solid blue 0;position:relative;z-index:10;padding:0 5px 0 45px;}#textarea{position:relative;top:0;left:0;margin:0;padding:0;width:100%;height:100%;overflow:hidden;z-index:7;border-width:0;background-color:transparent;resize:none;}#textarea,#textarea:hover{outline:none;}#content_highlight{white-space:pre;margin:0;padding:0;position:absolute;z-index:4;overflow:visible;}#selection_field,#selection_field_text{margin:0;background-color:#E1F2F9;position:absolute;z-index:5;top:-100px;padding:0;white-space:pre;overflow:hidden;}#selection_field.show_colors {z-index:3;background-color:#EDF9FC;}#selection_field strong{font-weight:normal;}#selection_field.show_colors *,#selection_field_text * {visibility:hidden;}#selection_field_text{background-color:transparent;}#selection_field_text strong{font-weight:normal;background-color:#3399FE;color:#FFF;visibility:visible;}#container.word_wrap #content_highlight,#container.word_wrap #selection_field,#container.word_wrap #selection_field_text,#container.word_wrap #test_font_size{white-space:pre-wrap;white-space:-moz-pre-wrap !important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;width:99%;}#line_number{position:absolute;overflow:hidden;border-right:solid black 1px;z-index:8;width:38px;padding:0 5px 0 0;margin:0 0 0 -45px;text-align:right;color:#AAAAAA;}#test_font_size{padding:0;margin:0;visibility:hidden;position:absolute;white-space:pre;}pre{margin:0;padding:0;}.hidden{opacity:0.2;filter:alpha(opacity=20);}#result .edit_area_cursor{position:absolute;z-index:6;background-color:#FF6633;top:-100px;margin:0;}#result .edit_area_selection_field .overline{background-color:#996600;}.editarea_popup{border:solid 1px #888888;background-color:#ECE9D8;width:250px;padding:4px;position:absolute;visibility:hidden;z-index:15;top:-500px;}.editarea_popup,.editarea_popup table{font-family:sans-serif;font-size:10pt;}.editarea_popup img{border:0;}.editarea_popup .close_popup{float:right;line-height:16px;border:0;padding:0;}.editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{margin:0;padding:0;}.editarea_popup .copyright{text-align:right;}div#area_search_replace{}div#area_search_replace img{border:0;}div#area_search_replace div.button{text-align:center;line-height:1.7em;}div#area_search_replace .button a{cursor:pointer;border:solid 1px #888888;background-color:#DEDEDE;text-decoration:none;padding:0 2px;color:#000000;white-space:nowrap;}div#area_search_replace a:hover{background-color:#EDEDED;}div#area_search_replace #move_area_search_replace{cursor:move;border:solid 1px #888;}div#area_search_replace #close_area_search_replace{text-align:right;vertical-align:top;white-space:nowrap;}div#area_search_replace #area_search_msg{height:18px;overflow:hidden;border-top:solid 1px #888;margin-top:3px;}#edit_area_help{width:350px;}#edit_area_help div.close_popup{float:right;}.area_toolbar{width:100%;margin:0;padding:0;background-color:#ECE9D8;text-align:center;}.area_toolbar,.area_toolbar table{font:11px sans-serif;}.area_toolbar img{border:0;vertical-align:middle;}.area_toolbar input{margin:0;padding:0;}.area_toolbar select{font-family:'MS Sans Serif',sans-serif,Verdana,Arial;font-size:7pt;font-weight:normal;margin:2px 0 0 0 ;padding:0;vertical-align:top;background-color:#F0F0EE;}table.statusbar{width:100%;}.area_toolbar td.infos{text-align:center;width:130px;border-right:solid 1px #888;border-width:0 1px 0 0;padding:0;}.area_toolbar td.total{text-align:right;width:50px;padding:0;}.area_toolbar td.resize{text-align:right;}.area_toolbar span#resize_area{cursor:nw-resize;visibility:hidden;}.editAreaButtonNormal,.editAreaButtonOver,.editAreaButtonDown,.editAreaSeparator,.editAreaSeparatorLine,.editAreaButtonDisabled,.editAreaButtonSelected {border:0; margin:0; padding:0; background:transparent;margin-top:0;margin-left:1px;padding:0;}.editAreaButtonNormal {border:1px solid #ECE9D8 !important;cursor:pointer;}.editAreaButtonOver {border:1px solid #0A246A !important;cursor:pointer;background-color:#B6BDD2;}.editAreaButtonDown {cursor:pointer;border:1px solid #0A246A !important;background-color:#8592B5;}.editAreaButtonSelected {border:1px solid #C0C0BB !important;cursor:pointer;background-color:#F4F2E8;}.editAreaButtonDisabled {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);-moz-opacity:0.3;opacity:0.3;border:1px solid #F0F0EE !important;cursor:pointer;}.editAreaSeparatorLine {margin:1px 2px;background-color:#C0C0BB;width:2px;height:18px;}#processing{display:none;background-color:#ECE9D8;border:solid #888 1px;position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;text-align:center;}#processing_text{position:absolute;left:50%;top:50%;width:200px;height:20px;margin-left:-100px;margin-top:-10px;text-align:center;}#tab_browsing_area{display:none;background-color:#CCC9A8;border-top:1px solid #888;text-align:left;margin:0;}#tab_browsing_list {padding:0;margin:0;list-style-type:none;white-space:nowrap;}#tab_browsing_list li {float:left;margin:-1px;}#tab_browsing_list a {position:relative;display:block;text-decoration:none;float:left;cursor:pointer;line-height:14px;}#tab_browsing_list a span {display:block;color:#000;background:#ECE9D8;border:1px solid #888;border-width:1px 1px 0;text-align:center;padding:2px 2px 1px 4px;position:relative;}#tab_browsing_list a b {display:block;border-bottom:2px solid #617994;}#tab_browsing_list a .edited {display:none;}#tab_browsing_list a.edited .edited {display:inline;}#tab_browsing_list a img{margin-left:7px;}#tab_browsing_list a.edited img{margin-left:3px;}#tab_browsing_list a:hover span {background:#F4F2E8;border-color:#0A246A;}#tab_browsing_list .selected a span{background:#046380;color:#FFF;}#no_file_selected{height:100%;width:150%;background:#CCC;display:none;z-index:20;position:absolute;}.non_editable #editor{border-width:0 1px;}.non_editable .area_toolbar{display:none;}#auto_completion_area{background:#FFF;border:solid 1px #888;position:absolute;z-index:15;width:280px;height:180px;overflow:auto;display:none;}#auto_completion_area a,#auto_completion_area a:visited{display:block;padding:0 2px 1px;color:#000;text-decoration:none;}#auto_completion_area a:hover,#auto_completion_area a:focus,#auto_completion_area a.focus{background:#D6E1FE;text-decoration:none;}#auto_completion_area ul{margin:0;padding:0;list-style:none inside;}#auto_completion_area li{padding:0;}#auto_completion_area .prefix{font-style:italic;padding:0 3px;}</style>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/edit_area_functions.js DELETED
@@ -1,1202 +0,0 @@
1
- //replace tabulation by the good number of white spaces
2
- EditArea.prototype.replace_tab= function(text){
3
- return text.replace(/((\n?)([^\t\n]*)\t)/gi, editArea.smartTab); // slower than simple replace...
4
- };
5
-
6
- // call by the replace_tab function
7
- EditArea.prototype.smartTab= function(){
8
- val=" ";
9
- return EditArea.prototype.smartTab.arguments[2] + EditArea.prototype.smartTab.arguments[3] + val.substr(0, editArea.tab_nb_char - (EditArea.prototype.smartTab.arguments[3].length)%editArea.tab_nb_char);
10
- };
11
-
12
- EditArea.prototype.show_waiting_screen= function(){
13
- width = this.editor_area.offsetWidth;
14
- height = this.editor_area.offsetHeight;
15
- if( !(this.isIE && this.isIE<6) )
16
- {
17
- width -= 2;
18
- height -= 2;
19
- }
20
- this.processing_screen.style.display= "block";
21
- this.processing_screen.style.width = width+"px";
22
- this.processing_screen.style.height = height+"px";
23
- this.waiting_screen_displayed = true;
24
- };
25
-
26
- EditArea.prototype.hide_waiting_screen= function(){
27
- this.processing_screen.style.display="none";
28
- this.waiting_screen_displayed= false;
29
- };
30
-
31
- EditArea.prototype.add_style= function(styles){
32
- if(styles.length>0){
33
- newcss = document.createElement("style");
34
- newcss.type="text/css";
35
- newcss.media="all";
36
- if(newcss.styleSheet){ // IE
37
- newcss.styleSheet.cssText = styles;
38
- } else { // W3C
39
- newcss.appendChild(document.createTextNode(styles));
40
- }
41
- document.getElementsByTagName("head")[0].appendChild(newcss);
42
- }
43
- };
44
-
45
- EditArea.prototype.set_font= function(family, size){
46
- var t=this, a=this.textarea, s=this.settings, elem_font, i, elem;
47
- // list all elements concerned by font changes
48
- var elems= ["textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "selection_field_text", "line_number"];
49
-
50
- if(family && family!="")
51
- s["font_family"]= family;
52
- if(size && size>0)
53
- s["font_size"] = size;
54
- if( t.isOpera && t.isOpera < 9.6 ) // opera<9.6 can't manage non monospace font
55
- s['font_family']="monospace";
56
-
57
- // update the select tag
58
- if( elem_font = _$("area_font_size") )
59
- {
60
- for( i = 0; i < elem_font.length; i++ )
61
- {
62
- if( elem_font.options[i].value && elem_font.options[i].value == s["font_size"] )
63
- elem_font.options[i].selected=true;
64
- }
65
- }
66
-
67
- /*
68
- * somethimes firefox has rendering mistake with non-monospace font for text width in textarea vs in div for changing font size (eg: verdana change between 11pt to 12pt)
69
- * => looks like a browser internal random bug as text width can change while content_highlight is updated
70
- * we'll check if the font-size produce the same text width inside textarea and div and if not, we'll increment the font-size
71
- *
72
- * This is an ugly fix
73
- */
74
- if( t.isFirefox )
75
- {
76
- var nbTry = 3;
77
- do {
78
- var div1 = document.createElement( 'div' ), text1 = document.createElement( 'textarea' );
79
- var styles = {
80
- width: '40px',
81
- overflow: 'scroll',
82
- zIndex: 50,
83
- visibility: 'hidden',
84
- fontFamily: s["font_family"],
85
- fontSize: s["font_size"]+"pt",
86
- lineHeight: t.lineHeight+"px",
87
- padding: '0',
88
- margin: '0',
89
- border: 'none',
90
- whiteSpace: 'nowrap'
91
- };
92
- var diff, changed = false;
93
- for( i in styles )
94
- {
95
- div1.style[ i ] = styles[i];
96
- text1.style[ i ] = styles[i];
97
- }
98
- // no wrap for this text
99
- text1.wrap = 'off';
100
- text1.setAttribute('wrap', 'off');
101
- t.container.appendChild( div1 );
102
- t.container.appendChild( text1 );
103
- // try to make FF to bug
104
- div1.innerHTML = text1.value = 'azertyuiopqsdfghjklm';
105
- div1.innerHTML = text1.value = text1.value+'wxcvbn^p*ù$!:;,,';
106
- diff = text1.scrollWidth - div1.scrollWidth;
107
-
108
- // firefox return here a diff of 1 px between equals scrollWidth (can't explain)
109
- if( Math.abs( diff ) >= 2 )
110
- {
111
- s["font_size"]++;
112
- changed = true;
113
- }
114
- t.container.removeChild( div1 );
115
- t.container.removeChild( text1 );
116
- nbTry--;
117
- }while( changed && nbTry > 0 );
118
- }
119
-
120
-
121
- // calc line height
122
- elem = t.test_font_size;
123
- elem.style.fontFamily = ""+s["font_family"];
124
- elem.style.fontSize = s["font_size"]+"pt";
125
- elem.innerHTML = "0";
126
- t.lineHeight = elem.offsetHeight;
127
-
128
- // update font for all concerned elements
129
- for( i=0; i<elems.length; i++)
130
- {
131
- elem = _$(elems[i]);
132
- elem.style.fontFamily = s["font_family"];
133
- elem.style.fontSize = s["font_size"]+"pt";
134
- elem.style.lineHeight = t.lineHeight+"px";
135
- }
136
- // define a css for <pre> tags
137
- t.add_style("pre{font-family:"+s["font_family"]+"}");
138
-
139
- // old opera and IE>=8 doesn't update font changes to the textarea
140
- if( ( t.isOpera && t.isOpera < 9.6 ) || t.isIE >= 8 )
141
- {
142
- var parNod = a.parentNode, nxtSib = a.nextSibling, start= a.selectionStart, end= a.selectionEnd;
143
- parNod.removeChild(a);
144
- parNod.insertBefore(a, nxtSib);
145
- t.area_select(start, end-start);
146
- }
147
-
148
- // force update of selection field
149
- this.focus();
150
- this.update_size();
151
- this.check_line_selection();
152
- };
153
-
154
- EditArea.prototype.change_font_size= function(){
155
- var size=_$("area_font_size").value;
156
- if(size>0)
157
- this.set_font("", size);
158
- };
159
-
160
-
161
- EditArea.prototype.open_inline_popup= function(popup_id){
162
- this.close_all_inline_popup();
163
- var popup= _$(popup_id);
164
- var editor= _$("editor");
165
-
166
- // search matching icon
167
- for(var i=0; i<this.inlinePopup.length; i++){
168
- if(this.inlinePopup[i]["popup_id"]==popup_id){
169
- var icon= _$(this.inlinePopup[i]["icon_id"]);
170
- if(icon){
171
- this.switchClassSticky(icon, 'editAreaButtonSelected', true);
172
- break;
173
- }
174
- }
175
- }
176
- // check size
177
- popup.style.height="auto";
178
- popup.style.overflow= "visible";
179
-
180
- if(document.body.offsetHeight< popup.offsetHeight){
181
- popup.style.height= (document.body.offsetHeight-10)+"px";
182
- popup.style.overflow= "auto";
183
- }
184
-
185
- if(!popup.positionned){
186
- var new_left= editor.offsetWidth /2 - popup.offsetWidth /2;
187
- var new_top= editor.offsetHeight /2 - popup.offsetHeight /2;
188
- //var new_top= area.offsetHeight /2 - popup.offsetHeight /2;
189
- //var new_left= area.offsetWidth /2 - popup.offsetWidth /2;
190
- //alert("new_top: ("+new_top+") = calculeOffsetTop(area) ("+calculeOffsetTop(area)+") + area.offsetHeight /2("+ area.offsetHeight /2+") - popup.offsetHeight /2("+popup.offsetHeight /2+") - scrollTop: "+document.body.scrollTop);
191
- popup.style.left= new_left+"px";
192
- popup.style.top= new_top+"px";
193
- popup.positionned=true;
194
- }
195
- popup.style.visibility="visible";
196
-
197
- //popup.style.display="block";
198
- };
199
-
200
- EditArea.prototype.close_inline_popup= function(popup_id){
201
- var popup= _$(popup_id);
202
- // search matching icon
203
- for(var i=0; i<this.inlinePopup.length; i++){
204
- if(this.inlinePopup[i]["popup_id"]==popup_id){
205
- var icon= _$(this.inlinePopup[i]["icon_id"]);
206
- if(icon){
207
- this.switchClassSticky(icon, 'editAreaButtonNormal', false);
208
- break;
209
- }
210
- }
211
- }
212
-
213
- popup.style.visibility="hidden";
214
- };
215
-
216
- EditArea.prototype.close_all_inline_popup= function(e){
217
- for(var i=0; i<this.inlinePopup.length; i++){
218
- this.close_inline_popup(this.inlinePopup[i]["popup_id"]);
219
- }
220
- this.textarea.focus();
221
- };
222
-
223
- EditArea.prototype.show_help= function(){
224
-
225
- this.open_inline_popup("edit_area_help");
226
-
227
- };
228
-
229
- EditArea.prototype.new_document= function(){
230
- this.textarea.value="";
231
- this.area_select(0,0);
232
- };
233
-
234
- EditArea.prototype.get_all_toolbar_height= function(){
235
- var area= _$("editor");
236
- var results= parent.getChildren(area, "div", "class", "area_toolbar", "all", "0"); // search only direct children
237
- //results= results.concat(getChildren(area, "table", "class", "area_toolbar", "all", "0"));
238
- var height=0;
239
- for(var i=0; i<results.length; i++){
240
- height+= results[i].offsetHeight;
241
- }
242
- //alert("toolbar height: "+height);
243
- return height;
244
- };
245
-
246
- EditArea.prototype.go_to_line= function(line){
247
- if(!line)
248
- {
249
- var icon= _$("go_to_line");
250
- if(icon != null){
251
- this.restoreClass(icon);
252
- this.switchClassSticky(icon, 'editAreaButtonSelected', true);
253
- }
254
-
255
- line= prompt(this.get_translation("go_to_line_prompt"));
256
- if(icon != null)
257
- this.switchClassSticky(icon, 'editAreaButtonNormal', false);
258
- }
259
- if(line && line!=null && line.search(/^[0-9]+$/)!=-1){
260
- var start=0;
261
- var lines= this.textarea.value.split("\n");
262
- if(line > lines.length)
263
- start= this.textarea.value.length;
264
- else{
265
- for(var i=0; i<Math.min(line-1, lines.length); i++)
266
- start+= lines[i].length + 1;
267
- }
268
- this.area_select(start, 0);
269
- }
270
-
271
-
272
- };
273
-
274
-
275
- EditArea.prototype.change_smooth_selection_mode= function(setTo){
276
- //alert("setTo: "+setTo);
277
- if(this.do_highlight)
278
- return;
279
-
280
- if(setTo != null){
281
- if(setTo === false)
282
- this.smooth_selection=true;
283
- else
284
- this.smooth_selection=false;
285
- }
286
- var icon= _$("change_smooth_selection");
287
- this.textarea.focus();
288
- if(this.smooth_selection===true){
289
- //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") );
290
- /*setAttribute(icon, "oldClassName", "editAreaButtonNormal" );
291
- setAttribute(icon, "className", "editAreaButtonNormal" );*/
292
- //this.restoreClass(icon);
293
- //this.restoreAndSwitchClass(icon,'editAreaButtonNormal');
294
- this.switchClassSticky(icon, 'editAreaButtonNormal', false);
295
-
296
- this.smooth_selection=false;
297
- this.selection_field.style.display= "none";
298
- _$("cursor_pos").style.display= "none";
299
- _$("end_bracket").style.display= "none";
300
- }else{
301
- //setAttribute(icon, "class", getAttribute(icon, "class") + " selected");
302
- //this.switchClass(icon,'editAreaButtonSelected');
303
- this.switchClassSticky(icon, 'editAreaButtonSelected', false);
304
- this.smooth_selection=true;
305
- this.selection_field.style.display= "block";
306
- _$("cursor_pos").style.display= "block";
307
- _$("end_bracket").style.display= "block";
308
- }
309
- };
310
-
311
- // the auto scroll of the textarea has some lacks when it have to show cursor in the visible area when the textarea size change
312
- // show specifiy whereas it is the "top" or "bottom" of the selection that is showned
313
- EditArea.prototype.scroll_to_view= function(show){
314
- var zone, lineElem;
315
- if(!this.smooth_selection)
316
- return;
317
- zone= _$("result");
318
-
319
- // manage height scroll
320
- var cursor_pos_top= _$("cursor_pos").cursor_top;
321
- if(show=="bottom")
322
- {
323
- //cursor_pos_top+= (this.last_selection["line_nb"]-1)* this.lineHeight;
324
- cursor_pos_top+= this.getLinePosTop( this.last_selection['line_start'] + this.last_selection['line_nb'] - 1 );
325
- }
326
-
327
- var max_height_visible= zone.clientHeight + zone.scrollTop;
328
- var miss_top = cursor_pos_top + this.lineHeight - max_height_visible;
329
- if(miss_top>0){
330
- //alert(miss_top);
331
- zone.scrollTop= zone.scrollTop + miss_top;
332
- }else if( zone.scrollTop > cursor_pos_top){
333
- // when erase all the content -> does'nt scroll back to the top
334
- //alert("else: "+cursor_pos_top);
335
- zone.scrollTop= cursor_pos_top;
336
- }
337
-
338
- // manage left scroll
339
- //var cursor_pos_left= parseInt(_$("cursor_pos").style.left.replace("px",""));
340
- var cursor_pos_left= _$("cursor_pos").cursor_left;
341
- var max_width_visible= zone.clientWidth + zone.scrollLeft;
342
- var miss_left= cursor_pos_left + 10 - max_width_visible;
343
- if(miss_left>0){
344
- zone.scrollLeft= zone.scrollLeft + miss_left + 50;
345
- }else if( zone.scrollLeft > cursor_pos_left){
346
- zone.scrollLeft= cursor_pos_left ;
347
- }else if( zone.scrollLeft == 45){
348
- // show the line numbers if textarea align to it's left
349
- zone.scrollLeft=0;
350
- }
351
- };
352
-
353
- EditArea.prototype.check_undo= function(only_once){
354
- if(!editAreas[this.id])
355
- return false;
356
- if(this.textareaFocused && editAreas[this.id]["displayed"]==true){
357
- var text=this.textarea.value;
358
- if(this.previous.length<=1)
359
- this.switchClassSticky(_$("undo"), 'editAreaButtonDisabled', true);
360
-
361
- if(!this.previous[this.previous.length-1] || this.previous[this.previous.length-1]["text"] != text){
362
- this.previous.push({"text": text, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd});
363
- if(this.previous.length > this.settings["max_undo"]+1)
364
- this.previous.shift();
365
-
366
- }
367
- if(this.previous.length >= 2)
368
- this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false);
369
- }
370
-
371
- if(!only_once)
372
- setTimeout("editArea.check_undo()", 3000);
373
- };
374
-
375
- EditArea.prototype.undo= function(){
376
- //alert("undo"+this.previous.length);
377
- if(this.previous.length > 0)
378
- {
379
- this.getIESelection();
380
- // var pos_cursor=this.textarea.selectionStart;
381
- this.next.push( { "text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd } );
382
- var prev= this.previous.pop();
383
- if( prev["text"] == this.textarea.value && this.previous.length > 0 )
384
- prev =this.previous.pop();
385
- this.textarea.value = prev["text"];
386
- this.last_undo = prev["text"];
387
- this.area_select(prev["selStart"], prev["selEnd"]-prev["selStart"]);
388
- this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false);
389
- this.resync_highlight(true);
390
- //alert("undo"+this.previous.length);
391
- this.check_file_changes();
392
- }
393
- };
394
-
395
- EditArea.prototype.redo= function(){
396
- if(this.next.length > 0)
397
- {
398
- /*this.getIESelection();*/
399
- //var pos_cursor=this.textarea.selectionStart;
400
- var next= this.next.pop();
401
- this.previous.push(next);
402
- this.textarea.value= next["text"];
403
- this.last_undo= next["text"];
404
- this.area_select(next["selStart"], next["selEnd"]-next["selStart"]);
405
- this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false);
406
- this.resync_highlight(true);
407
- this.check_file_changes();
408
- }
409
- if( this.next.length == 0)
410
- this.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);
411
- };
412
-
413
- EditArea.prototype.check_redo= function(){
414
- if(editArea.next.length == 0 || editArea.textarea.value!=editArea.last_undo){
415
- editArea.next= []; // undo the ability to use "redo" button
416
- editArea.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);
417
- }
418
- else
419
- {
420
- this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false);
421
- }
422
- };
423
-
424
-
425
- // functions that manage icons roll over, disabled, etc...
426
- EditArea.prototype.switchClass = function(element, class_name, lock_state) {
427
- var lockChanged = false;
428
-
429
- if (typeof(lock_state) != "undefined" && element != null) {
430
- element.classLock = lock_state;
431
- lockChanged = true;
432
- }
433
-
434
- if (element != null && (lockChanged || !element.classLock)) {
435
- element.oldClassName = element.className;
436
- element.className = class_name;
437
- }
438
- };
439
-
440
- EditArea.prototype.restoreAndSwitchClass = function(element, class_name) {
441
- if (element != null && !element.classLock) {
442
- this.restoreClass(element);
443
- this.switchClass(element, class_name);
444
- }
445
- };
446
-
447
- EditArea.prototype.restoreClass = function(element) {
448
- if (element != null && element.oldClassName && !element.classLock) {
449
- element.className = element.oldClassName;
450
- element.oldClassName = null;
451
- }
452
- };
453
-
454
- EditArea.prototype.setClassLock = function(element, lock_state) {
455
- if (element != null)
456
- element.classLock = lock_state;
457
- };
458
-
459
- EditArea.prototype.switchClassSticky = function(element, class_name, lock_state) {
460
- var lockChanged = false;
461
- if (typeof(lock_state) != "undefined" && element != null) {
462
- element.classLock = lock_state;
463
- lockChanged = true;
464
- }
465
-
466
- if (element != null && (lockChanged || !element.classLock)) {
467
- element.className = class_name;
468
- element.oldClassName = class_name;
469
- }
470
- };
471
-
472
- //make the "page up" and "page down" buttons works correctly
473
- EditArea.prototype.scroll_page= function(params){
474
- var dir= params["dir"], shift_pressed= params["shift"];
475
- var lines= this.textarea.value.split("\n");
476
- var new_pos=0, length=0, char_left=0, line_nb=0, curLine=0;
477
- var toScrollAmount = _$("result").clientHeight -30;
478
- var nbLineToScroll = 0, diff= 0;
479
-
480
- if(dir=="up"){
481
- nbLineToScroll = Math.ceil( toScrollAmount / this.lineHeight );
482
-
483
- // fix number of line to scroll
484
- for( i = this.last_selection["line_start"]; i - diff > this.last_selection["line_start"] - nbLineToScroll ; i-- )
485
- {
486
- if( elem = _$('line_'+ i) )
487
- {
488
- diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight );
489
- }
490
- }
491
- nbLineToScroll -= diff;
492
-
493
- if(this.last_selection["selec_direction"]=="up"){
494
- for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-nbLineToScroll, lines.length); line_nb++){
495
- new_pos+= lines[line_nb].length + 1;
496
- }
497
- char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1);
498
- if(shift_pressed)
499
- length=this.last_selection["selectionEnd"]-new_pos-char_left;
500
- this.area_select(new_pos+char_left, length);
501
- view="top";
502
- }else{
503
- view="bottom";
504
- for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-nbLineToScroll, lines.length); line_nb++){
505
- new_pos+= lines[line_nb].length + 1;
506
- }
507
- char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1);
508
- if(shift_pressed){
509
- //length=this.last_selection["selectionEnd"]-new_pos-char_left;
510
- start= Math.min(this.last_selection["selectionStart"], new_pos+char_left);
511
- length= Math.max(new_pos+char_left, this.last_selection["selectionStart"] )- start ;
512
- if(new_pos+char_left < this.last_selection["selectionStart"])
513
- view="top";
514
- }else
515
- start=new_pos+char_left;
516
- this.area_select(start, length);
517
-
518
- }
519
- }
520
- else
521
- {
522
- var nbLineToScroll= Math.floor( toScrollAmount / this.lineHeight );
523
- // fix number of line to scroll
524
- for( i = this.last_selection["line_start"]; i + diff < this.last_selection["line_start"] + nbLineToScroll ; i++ )
525
- {
526
- if( elem = _$('line_'+ i) )
527
- {
528
- diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight );
529
- }
530
- }
531
- nbLineToScroll -= diff;
532
-
533
- if(this.last_selection["selec_direction"]=="down"){
534
- view="bottom";
535
- for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+nbLineToScroll, lines.length); line_nb++){
536
- if(line_nb==this.last_selection["line_start"]-1)
537
- char_left= this.last_selection["selectionStart"] -new_pos;
538
- new_pos+= lines[line_nb].length + 1;
539
-
540
- }
541
- if(shift_pressed){
542
- length=Math.abs(this.last_selection["selectionStart"]-new_pos);
543
- length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]);
544
- //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left);
545
- this.area_select(Math.min(this.last_selection["selectionStart"], new_pos), length);
546
- }else{
547
- this.area_select(new_pos+char_left, 0);
548
- }
549
-
550
- }else{
551
- view="top";
552
- for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+nbLineToScroll-1, lines.length, lines.length); line_nb++){
553
- if(line_nb==this.last_selection["line_start"]-1)
554
- char_left= this.last_selection["selectionStart"] -new_pos;
555
- new_pos+= lines[line_nb].length + 1;
556
- }
557
- if(shift_pressed){
558
- length=Math.abs(this.last_selection["selectionEnd"]-new_pos-char_left);
559
- length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"])- char_left-1;
560
- //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left);
561
- this.area_select(Math.min(this.last_selection["selectionEnd"], new_pos+char_left), length);
562
- if(new_pos+char_left > this.last_selection["selectionEnd"])
563
- view="bottom";
564
- }else{
565
- this.area_select(new_pos+char_left, 0);
566
- }
567
-
568
- }
569
- }
570
- //console.log( new_pos, char_left, length, nbLineToScroll, toScrollAmount, _$("result").clientHeigh );
571
- this.check_line_selection();
572
- this.scroll_to_view(view);
573
- };
574
-
575
- EditArea.prototype.start_resize= function(e){
576
- parent.editAreaLoader.resize["id"] = editArea.id;
577
- parent.editAreaLoader.resize["start_x"] = (e)? e.pageX : event.x + document.body.scrollLeft;
578
- parent.editAreaLoader.resize["start_y"] = (e)? e.pageY : event.y + document.body.scrollTop;
579
- if(editArea.isIE)
580
- {
581
- editArea.textarea.focus();
582
- editArea.getIESelection();
583
- }
584
- parent.editAreaLoader.resize["selectionStart"] = editArea.textarea.selectionStart;
585
- parent.editAreaLoader.resize["selectionEnd"] = editArea.textarea.selectionEnd;
586
- parent.editAreaLoader.start_resize_area();
587
- };
588
-
589
- EditArea.prototype.toggle_full_screen= function(to){
590
- var t=this, p=parent, a=t.textarea, html, frame, selStart, selEnd, old, icon;
591
- if(typeof(to)=="undefined")
592
- to= !t.fullscreen['isFull'];
593
- old = t.fullscreen['isFull'];
594
- t.fullscreen['isFull']= to;
595
- icon = _$("fullscreen");
596
- selStart = t.textarea.selectionStart;
597
- selEnd = t.textarea.selectionEnd;
598
- html = p.document.getElementsByTagName("html")[0];
599
- frame = p.document.getElementById("frame_"+t.id);
600
-
601
- if(to && to!=old)
602
- { // toogle on fullscreen
603
-
604
- t.fullscreen['old_overflow'] = p.get_css_property(html, "overflow");
605
- t.fullscreen['old_height'] = p.get_css_property(html, "height");
606
- t.fullscreen['old_width'] = p.get_css_property(html, "width");
607
- t.fullscreen['old_scrollTop'] = html.scrollTop;
608
- t.fullscreen['old_scrollLeft'] = html.scrollLeft;
609
- t.fullscreen['old_zIndex'] = p.get_css_property(frame, "z-index");
610
- if(t.isOpera){
611
- html.style.height = "100%";
612
- html.style.width = "100%";
613
- }
614
- html.style.overflow = "hidden";
615
- html.scrollTop = 0;
616
- html.scrollLeft = 0;
617
-
618
- frame.style.position = "absolute";
619
- frame.style.width = html.clientWidth+"px";
620
- frame.style.height = html.clientHeight+"px";
621
- frame.style.display = "block";
622
- frame.style.zIndex = "999999";
623
- frame.style.top = "0px";
624
- frame.style.left = "0px";
625
-
626
- // if the iframe was in a div with position absolute, the top and left are the one of the div,
627
- // so I fix it by seeing at witch position the iframe start and correcting it
628
- frame.style.top = "-"+p.calculeOffsetTop(frame)+"px";
629
- frame.style.left = "-"+p.calculeOffsetLeft(frame)+"px";
630
-
631
- // parent.editAreaLoader.execCommand(t.id, "update_size();");
632
- // var body=parent.document.getElementsByTagName("body")[0];
633
- // body.appendChild(frame);
634
-
635
- t.switchClassSticky(icon, 'editAreaButtonSelected', false);
636
- t.fullscreen['allow_resize']= t.resize_allowed;
637
- t.allow_resize(false);
638
-
639
- //t.area_select(selStart, selEnd-selStart);
640
-
641
-
642
- // opera can't manage to do a direct size update
643
- if(t.isFirefox){
644
- p.editAreaLoader.execCommand(t.id, "update_size();");
645
- t.area_select(selStart, selEnd-selStart);
646
- t.scroll_to_view();
647
- t.focus();
648
- }else{
649
- setTimeout("parent.editAreaLoader.execCommand('"+ t.id +"', 'update_size();');editArea.focus();", 10);
650
- }
651
-
652
-
653
- }
654
- else if(to!=old)
655
- { // toogle off fullscreen
656
- frame.style.position="static";
657
- frame.style.zIndex= t.fullscreen['old_zIndex'];
658
-
659
- if(t.isOpera)
660
- {
661
- html.style.height = "auto";
662
- html.style.width = "auto";
663
- html.style.overflow = "auto";
664
- }
665
- else if(t.isIE && p!=top)
666
- { // IE doesn't manage html overflow in frames like in normal page...
667
- html.style.overflow = "auto";
668
- }
669
- else
670
- {
671
- html.style.overflow = t.fullscreen['old_overflow'];
672
- }
673
- html.scrollTop = t.fullscreen['old_scrollTop'];
674
- html.scrollLeft = t.fullscreen['old_scrollLeft'];
675
-
676
- p.editAreaLoader.hide(t.id);
677
- p.editAreaLoader.show(t.id);
678
-
679
- t.switchClassSticky(icon, 'editAreaButtonNormal', false);
680
- if(t.fullscreen['allow_resize'])
681
- t.allow_resize(t.fullscreen['allow_resize']);
682
- if(t.isFirefox){
683
- t.area_select(selStart, selEnd-selStart);
684
- setTimeout("editArea.scroll_to_view();", 10);
685
- }
686
-
687
- //p.editAreaLoader.remove_event(p.window, "resize", editArea.update_size);
688
- }
689
-
690
- };
691
-
692
- EditArea.prototype.allow_resize= function(allow){
693
- var resize= _$("resize_area");
694
- if(allow){
695
-
696
- resize.style.visibility="visible";
697
- parent.editAreaLoader.add_event(resize, "mouseup", editArea.start_resize);
698
- }else{
699
- resize.style.visibility="hidden";
700
- parent.editAreaLoader.remove_event(resize, "mouseup", editArea.start_resize);
701
- }
702
- this.resize_allowed= allow;
703
- };
704
-
705
-
706
- EditArea.prototype.change_syntax= function(new_syntax, is_waiting){
707
- // alert("cahnge to "+new_syntax);
708
- // the syntax is the same
709
- if(new_syntax==this.settings['syntax'])
710
- return true;
711
-
712
- // check that the syntax is one allowed
713
- var founded= false;
714
- for(var i=0; i<this.syntax_list.length; i++)
715
- {
716
- if(this.syntax_list[i]==new_syntax)
717
- founded= true;
718
- }
719
-
720
- if(founded==true)
721
- {
722
- // the reg syntax file is not loaded
723
- if(!parent.editAreaLoader.load_syntax[new_syntax])
724
- {
725
- // load the syntax file and wait for file loading
726
- if(!is_waiting)
727
- parent.editAreaLoader.load_script(parent.editAreaLoader.baseURL + "reg_syntax/" + new_syntax + ".js");
728
- setTimeout("editArea.change_syntax('"+ new_syntax +"', true);", 100);
729
- this.show_waiting_screen();
730
- }
731
- else
732
- {
733
- if(!this.allready_used_syntax[new_syntax])
734
- { // the syntax has still not been used
735
- // rebuild syntax definition for new languages
736
- parent.editAreaLoader.init_syntax_regexp();
737
- // add style to the new list
738
- this.add_style(parent.editAreaLoader.syntax[new_syntax]["styles"]);
739
- this.allready_used_syntax[new_syntax]=true;
740
- }
741
- // be sure that the select option is correctly updated
742
- var sel= _$("syntax_selection");
743
- if(sel && sel.value!=new_syntax)
744
- {
745
- for(var i=0; i<sel.length; i++){
746
- if(sel.options[i].value && sel.options[i].value == new_syntax)
747
- sel.options[i].selected=true;
748
- }
749
- }
750
-
751
- /* if(this.settings['syntax'].length==0)
752
- {
753
- this.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', false);
754
- this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false);
755
- this.change_highlight(true);
756
- }
757
- */
758
- this.settings['syntax']= new_syntax;
759
- this.resync_highlight(true);
760
- this.hide_waiting_screen();
761
- return true;
762
- }
763
- }
764
- return false;
765
- };
766
-
767
-
768
- // check if the file has changed
769
- EditArea.prototype.set_editable= function(is_editable){
770
- if(is_editable)
771
- {
772
- document.body.className= "";
773
- this.textarea.readOnly= false;
774
- this.is_editable= true;
775
- }
776
- else
777
- {
778
- document.body.className= "non_editable";
779
- this.textarea.readOnly= true;
780
- this.is_editable= false;
781
- }
782
-
783
- if(editAreas[this.id]["displayed"]==true)
784
- this.update_size();
785
- };
786
-
787
- /***** Wrap mode *****/
788
-
789
- // toggling function for set_wrap_mode
790
- EditArea.prototype.toggle_word_wrap= function(){
791
- this.set_word_wrap( !this.settings['word_wrap'] );
792
- };
793
-
794
-
795
- // open a new tab for the given file
796
- EditArea.prototype.set_word_wrap= function(to){
797
- var t=this, a= t.textarea;
798
- if( t.isOpera && t.isOpera < 9.8 )
799
- {
800
- this.settings['word_wrap']= false;
801
- t.switchClassSticky( _$("word_wrap"), 'editAreaButtonDisabled', true );
802
- return false;
803
- }
804
-
805
- if( to )
806
- {
807
- wrap_mode = 'soft';
808
- this.container.className+= ' word_wrap';
809
- this.container.style.width="";
810
- this.content_highlight.style.width="";
811
- a.style.width="100%";
812
- if( t.isIE && t.isIE < 7 ) // IE 6 count 50 px too much
813
- {
814
- a.style.width = ( a.offsetWidth-5 )+"px";
815
- }
816
-
817
- t.switchClassSticky( _$("word_wrap"), 'editAreaButtonSelected', false );
818
- }
819
- else
820
- {
821
- wrap_mode = 'off';
822
- this.container.className = this.container.className.replace(/word_wrap/g, '');
823
- t.switchClassSticky( _$("word_wrap"), 'editAreaButtonNormal', true );
824
- }
825
- this.textarea.previous_scrollWidth = '';
826
- this.textarea.previous_scrollHeight = '';
827
-
828
- a.wrap= wrap_mode;
829
- a.setAttribute('wrap', wrap_mode);
830
- // only IE can change wrap mode on the fly without element reloading
831
- if(!this.isIE)
832
- {
833
- var start=a.selectionStart, end= a.selectionEnd;
834
- var parNod = a.parentNode, nxtSib = a.nextSibling;
835
- parNod.removeChild(a);
836
- parNod.insertBefore(a, nxtSib);
837
- this.area_select(start, end-start);
838
- }
839
- // reset some optimisation
840
- this.settings['word_wrap'] = to;
841
- this.focus();
842
- this.update_size();
843
- this.check_line_selection();
844
- };
845
- /***** tabbed files managing functions *****/
846
-
847
- // open a new tab for the given file
848
- EditArea.prototype.open_file= function(settings){
849
-
850
- if(settings['id']!="undefined")
851
- {
852
- var id= settings['id'];
853
- // create a new file object with defautl values
854
- var new_file= {};
855
- new_file['id'] = id;
856
- new_file['title'] = id;
857
- new_file['text'] = "";
858
- new_file['last_selection'] = "";
859
- new_file['last_text_to_highlight'] = "";
860
- new_file['last_hightlighted_text'] = "";
861
- new_file['previous'] = [];
862
- new_file['next'] = [];
863
- new_file['last_undo'] = "";
864
- new_file['smooth_selection'] = this.settings['smooth_selection'];
865
- new_file['do_highlight']= this.settings['start_highlight'];
866
- new_file['syntax'] = this.settings['syntax'];
867
- new_file['scroll_top'] = 0;
868
- new_file['scroll_left'] = 0;
869
- new_file['selection_start']= 0;
870
- new_file['selection_end']= 0;
871
- new_file['edited'] = false;
872
- new_file['font_size'] = this.settings["font_size"];
873
- new_file['font_family'] = this.settings["font_family"];
874
- new_file['word_wrap'] = this.settings["word_wrap"];
875
- new_file['toolbar'] = {'links':{}, 'selects': {}};
876
- new_file['compare_edited_text']= new_file['text'];
877
-
878
-
879
- this.files[id]= new_file;
880
- this.update_file(id, settings);
881
- this.files[id]['compare_edited_text']= this.files[id]['text'];
882
-
883
-
884
- var html_id= 'tab_file_'+encodeURIComponent(id);
885
- this.filesIdAssoc[html_id]= id;
886
- this.files[id]['html_id']= html_id;
887
-
888
- if(!_$(this.files[id]['html_id']) && id!="")
889
- {
890
- // be sure the tab browsing area is displayed
891
- this.tab_browsing_area.style.display= "block";
892
- var elem= document.createElement('li');
893
- elem.id= this.files[id]['html_id'];
894
- var close= "<img src=\""+ parent.editAreaLoader.baseURL +"images/close.gif\" title=\""+ this.get_translation('close_tab', 'word') +"\" onclick=\"editArea.execCommand('close_file', editArea.filesIdAssoc['"+ html_id +"']);return false;\" class=\"hidden\" onmouseover=\"this.className=''\" onmouseout=\"this.className='hidden'\" />";
895
- elem.innerHTML= "<a onclick=\"javascript:editArea.execCommand('switch_to_file', editArea.filesIdAssoc['"+ html_id +"']);\" selec=\"none\"><b><span><strong class=\"edited\">*</strong>"+ this.files[id]['title'] + close +"</span></b></a>";
896
- _$('tab_browsing_list').appendChild(elem);
897
- var elem= document.createElement('text');
898
- this.update_size();
899
- }
900
-
901
- // open file callback (for plugin)
902
- if(id!="")
903
- this.execCommand('file_open', this.files[id]);
904
-
905
- this.switch_to_file(id, true);
906
- return true;
907
- }
908
- else
909
- return false;
910
- };
911
-
912
- // close the given file
913
- EditArea.prototype.close_file= function(id){
914
- if(this.files[id])
915
- {
916
- this.save_file(id);
917
-
918
- // close file callback
919
- if(this.execCommand('file_close', this.files[id])!==false)
920
- {
921
- // remove the tab in the toolbar
922
- var li= _$(this.files[id]['html_id']);
923
- li.parentNode.removeChild(li);
924
- // select a new file
925
- if(id== this.curr_file)
926
- {
927
- var next_file= "";
928
- var is_next= false;
929
- for(var i in this.files)
930
- {
931
- if( is_next )
932
- {
933
- next_file = i;
934
- break;
935
- }
936
- else if( i == id )
937
- is_next = true;
938
- else
939
- next_file = i;
940
- }
941
- // display the next file
942
- this.switch_to_file(next_file);
943
- }
944
- // clear datas
945
- delete (this.files[id]);
946
- this.update_size();
947
- }
948
- }
949
- };
950
-
951
- // backup current file datas
952
- EditArea.prototype.save_file= function(id){
953
- var t= this, save, a_links, a_selects, save_butt, img, i;
954
- if(t.files[id])
955
- {
956
- var save= t.files[id];
957
- save['last_selection'] = t.last_selection;
958
- save['last_text_to_highlight'] = t.last_text_to_highlight;
959
- save['last_hightlighted_text'] = t.last_hightlighted_text;
960
- save['previous'] = t.previous;
961
- save['next'] = t.next;
962
- save['last_undo'] = t.last_undo;
963
- save['smooth_selection'] = t.smooth_selection;
964
- save['do_highlight'] = t.do_highlight;
965
- save['syntax'] = t.settings['syntax'];
966
- save['text'] = t.textarea.value;
967
- save['scroll_top'] = t.result.scrollTop;
968
- save['scroll_left'] = t.result.scrollLeft;
969
- save['selection_start'] = t.last_selection["selectionStart"];
970
- save['selection_end'] = t.last_selection["selectionEnd"];
971
- save['font_size'] = t.settings["font_size"];
972
- save['font_family'] = t.settings["font_family"];
973
- save['word_wrap'] = t.settings["word_wrap"];
974
- save['toolbar'] = {'links':{}, 'selects': {}};
975
-
976
- // save toolbar buttons state for fileSpecific buttons
977
- a_links= _$("toolbar_1").getElementsByTagName("a");
978
- for( i=0; i<a_links.length; i++ )
979
- {
980
- if( a_links[i].getAttribute('fileSpecific') == 'yes' )
981
- {
982
- save_butt = {};
983
- img = a_links[i].getElementsByTagName('img')[0];
984
- save_butt['classLock'] = img.classLock;
985
- save_butt['className'] = img.className;
986
- save_butt['oldClassName'] = img.oldClassName;
987
-
988
- save['toolbar']['links'][a_links[i].id]= save_butt;
989
- }
990
- }
991
-
992
- // save toolbar select state for fileSpecific buttons
993
- a_selects= _$("toolbar_1").getElementsByTagName("select");
994
- for( i=0; i<a_selects.length; i++)
995
- {
996
- if(a_selects[i].getAttribute('fileSpecific')=='yes')
997
- {
998
- save['toolbar']['selects'][a_selects[i].id]= a_selects[i].value;
999
- }
1000
- }
1001
-
1002
- t.files[id]= save;
1003
-
1004
- return save;
1005
- }
1006
-
1007
- return false;
1008
- };
1009
-
1010
- // update file_datas
1011
- EditArea.prototype.update_file= function(id, new_values){
1012
- for(var i in new_values)
1013
- {
1014
- this.files[id][i]= new_values[i];
1015
- }
1016
- };
1017
-
1018
- // display file datas
1019
- EditArea.prototype.display_file= function(id){
1020
- var t = this, a= t.textarea, new_file, a_lis, a_selects, a_links, a_options, i, j;
1021
-
1022
- // we're showing the empty file
1023
- if(id=='')
1024
- {
1025
- a.readOnly= true;
1026
- t.tab_browsing_area.style.display= "none";
1027
- _$("no_file_selected").style.display= "block";
1028
- t.result.className= "empty";
1029
- // clear current datas
1030
- if(!t.files[''])
1031
- {
1032
- t.open_file({id: ''});
1033
- }
1034
- }
1035
- // we try to show a non existent file, so we left
1036
- else if( typeof( t.files[id] ) == 'undefined' )
1037
- {
1038
- return false;
1039
- }
1040
- // display a normal file
1041
- else
1042
- {
1043
- t.result.className= "";
1044
- a.readOnly= !t.is_editable;
1045
- _$("no_file_selected").style.display= "none";
1046
- t.tab_browsing_area.style.display= "block";
1047
- }
1048
-
1049
- // ensure to have last state for undo/redo actions
1050
- t.check_redo(true);
1051
- t.check_undo(true);
1052
- t.curr_file= id;
1053
-
1054
- // replace selected tab file
1055
- a_lis= t.tab_browsing_area.getElementsByTagName('li');
1056
- for( i=0; i<a_lis.length; i++)
1057
- {
1058
- if(a_lis[i].id == t.files[id]['html_id'])
1059
- a_lis[i].className='selected';
1060
- else
1061
- a_lis[i].className='';
1062
- }
1063
-
1064
- // replace next files datas
1065
- new_file= t.files[id];
1066
-
1067
- // restore text content
1068
- a.value= new_file['text'];
1069
-
1070
- // restore font-size
1071
- t.set_font(new_file['font_family'], new_file['font_size']);
1072
-
1073
- // restore selection and scroll
1074
- t.area_select(new_file['selection_start'], new_file['selection_end'] - new_file['selection_start']);
1075
- t.manage_size(true);
1076
- t.result.scrollTop= new_file['scroll_top'];
1077
- t.result.scrollLeft= new_file['scroll_left'];
1078
-
1079
- // restore undo, redo
1080
- t.previous= new_file['previous'];
1081
- t.next= new_file['next'];
1082
- t.last_undo= new_file['last_undo'];
1083
- t.check_redo(true);
1084
- t.check_undo(true);
1085
-
1086
- // restore highlight
1087
- t.execCommand("change_highlight", new_file['do_highlight']);
1088
- t.execCommand("change_syntax", new_file['syntax']);
1089
-
1090
- // smooth mode
1091
- t.execCommand("change_smooth_selection_mode", new_file['smooth_selection']);
1092
-
1093
- // word_wrap
1094
- t.execCommand("set_word_wrap", new_file['word_wrap']);
1095
-
1096
- // restore links state in toolbar
1097
- a_links= new_file['toolbar']['links'];
1098
- for( i in a_links)
1099
- {
1100
- if( img = _$(i).getElementsByTagName('img')[0] )
1101
- {
1102
- img.classLock = a_links[i]['classLock'];
1103
- img.className = a_links[i]['className'];
1104
- img.oldClassName= a_links[i]['oldClassName'];
1105
- }
1106
- }
1107
-
1108
- // restore select state in toolbar
1109
- a_selects = new_file['toolbar']['selects'];
1110
- for( i in a_selects)
1111
- {
1112
- a_options = _$(i).options;
1113
- for( j=0; j<a_options.length; j++)
1114
- {
1115
- if( a_options[j].value == a_selects[i] )
1116
- _$(i).options[j].selected=true;
1117
- }
1118
- }
1119
-
1120
- };
1121
-
1122
- // change tab for displaying a new one
1123
- EditArea.prototype.switch_to_file= function(file_to_show, force_refresh){
1124
- if(file_to_show!=this.curr_file || force_refresh)
1125
- {
1126
- this.save_file(this.curr_file);
1127
- if(this.curr_file!='')
1128
- this.execCommand('file_switch_off', this.files[this.curr_file]);
1129
- this.display_file(file_to_show);
1130
- if(file_to_show!='')
1131
- this.execCommand('file_switch_on', this.files[file_to_show]);
1132
- }
1133
- };
1134
-
1135
- // get all infos for the given file
1136
- EditArea.prototype.get_file= function(id){
1137
- if(id==this.curr_file)
1138
- this.save_file(id);
1139
- return this.files[id];
1140
- };
1141
-
1142
- // get all available files infos
1143
- EditArea.prototype.get_all_files= function(){
1144
- tmp_files= this.files;
1145
- this.save_file(this.curr_file);
1146
- if(tmp_files[''])
1147
- delete(this.files['']);
1148
- return tmp_files;
1149
- };
1150
-
1151
-
1152
- // check if the file has changed
1153
- EditArea.prototype.check_file_changes= function(){
1154
-
1155
- var id= this.curr_file;
1156
- if(this.files[id] && this.files[id]['compare_edited_text']!=undefined)
1157
- {
1158
- if(this.files[id]['compare_edited_text'].length==this.textarea.value.length && this.files[id]['compare_edited_text']==this.textarea.value)
1159
- {
1160
- if(this.files[id]['edited']!= false)
1161
- this.set_file_edited_mode(id, false);
1162
- }
1163
- else
1164
- {
1165
- if(this.files[id]['edited']!= true)
1166
- this.set_file_edited_mode(id, true);
1167
- }
1168
- }
1169
- };
1170
-
1171
- // set if the file is edited or not
1172
- EditArea.prototype.set_file_edited_mode= function(id, to){
1173
- // change CSS for edited tab
1174
- if(this.files[id] && _$(this.files[id]['html_id']))
1175
- {
1176
- var link= _$(this.files[id]['html_id']).getElementsByTagName('a')[0];
1177
- if(to==true)
1178
- {
1179
- link.className= 'edited';
1180
- }
1181
- else
1182
- {
1183
- link.className= '';
1184
- if(id==this.curr_file)
1185
- text= this.textarea.value;
1186
- else
1187
- text= this.files[id]['text'];
1188
- this.files[id]['compare_edited_text']= text;
1189
- }
1190
-
1191
- this.files[id]['edited']= to;
1192
- }
1193
- };
1194
-
1195
- EditArea.prototype.set_show_line_colors = function(new_value){
1196
- this.show_line_colors = new_value;
1197
-
1198
- if( new_value )
1199
- this.selection_field.className += ' show_colors';
1200
- else
1201
- this.selection_field.className = this.selection_field.className.replace( / show_colors/g, '' );
1202
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/edit_area_loader.js DELETED
@@ -1,1081 +0,0 @@
1
- /******
2
- *
3
- * EditArea
4
- * Developped by Christophe Dolivet
5
- * Released under LGPL, Apache and BSD licenses (use the one you want)
6
- *
7
- ******/
8
-
9
- function EditAreaLoader(){
10
- var t=this;
11
- t.version= "0.8.2";
12
- date= new Date();
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
24
- // scripts that must be loaded in the iframe
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"];
27
- t.syntax_display_name= { /*syntax_display_name_AUTO-FILL-BY-COMPRESSOR*/ };
28
-
29
- t.resize= []; // contain resizing datas
30
- t.hidden= {}; // store datas of the hidden textareas
31
-
32
- t.default_settings= {
33
- //id: "src" // id of the textarea to transform
34
- debug: false
35
- ,smooth_selection: true
36
- ,font_size: "10" // not for IE
37
- ,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...
38
- ,start_highlight: false // if start with highlight
39
- ,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help"
40
- ,begin_toolbar: "" // "new_document, save, load, |"
41
- ,end_toolbar: "" // or end_toolbar
42
- ,is_multi_files: false // enable the multi file mode (the textarea content is ignored)
43
- ,allow_resize: "both" // possible values: "no", "both", "x", "y"
44
- ,show_line_colors: false // if the highlight is disabled for the line currently beeing edited (if enabled => heavy CPU use)
45
- ,min_width: 400
46
- ,min_height: 125
47
- ,replace_tab_by_spaces: false
48
- ,allow_toggle: true // true or false
49
- ,language: "en"
50
- ,syntax: ""
51
- ,syntax_selection_allow: "basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml"
52
- ,display: "onload" // onload or later
53
- ,max_undo: 30
54
- ,browsers: "known" // all or known
55
- ,plugins: "" // comma separated plugin list
56
- ,gecko_spellcheck: false // enable/disable by default the gecko_spellcheck
57
- ,fullscreen: false
58
- ,is_editable: true
59
- ,cursor_position: "begin"
60
- ,word_wrap: false // define if the text is wrapped of not in the textarea
61
- ,autocompletion: false // NOT IMPLEMENTED
62
- ,load_callback: "" // click on load button (function name)
63
- ,save_callback: "" // click on save button (function name)
64
- ,change_callback: "" // textarea onchange trigger (function name)
65
- ,submit_callback: "" // form submited (function name)
66
- ,EA_init_callback: "" // EditArea initiliazed (function name)
67
- ,EA_delete_callback: "" // EditArea deleted (function name)
68
- ,EA_load_callback: "" // EditArea fully loaded and displayed (function name)
69
- ,EA_unload_callback: "" // EditArea delete while being displayed (function name)
70
- ,EA_toggle_on_callback: "" // EditArea toggled on (function name)
71
- ,EA_toggle_off_callback: "" // EditArea toggled off (function name)
72
- ,EA_file_switch_on_callback: "" // a new tab is selected (called for the newly selected file)
73
- ,EA_file_switch_off_callback: "" // a new tab is selected (called for the previously selected file)
74
- ,EA_file_close_callback: "" // close a tab
75
- };
76
-
77
- t.advanced_buttons = [
78
- // id, button img, command (it will try to find the translation of "id"), is_file_specific
79
- ['new_document', 'newdocument.gif', 'new_document', false],
80
- ['search', 'search.gif', 'show_search', false],
81
- ['go_to_line', 'go_to_line.gif', 'go_to_line', false],
82
- ['undo', 'undo.gif', 'undo', true],
83
- ['redo', 'redo.gif', 'redo', true],
84
- ['change_smooth_selection', 'smooth_selection.gif', 'change_smooth_selection_mode', true],
85
- ['reset_highlight', 'reset_highlight.gif', 'resync_highlight', true],
86
- ['highlight', 'highlight.gif','change_highlight', true],
87
- ['help', 'help.gif', 'show_help', false],
88
- ['save', 'save.gif', 'save', false],
89
- ['load', 'load.gif', 'load', false],
90
- ['fullscreen', 'fullscreen.gif', 'toggle_full_screen', false],
91
- ['word_wrap', 'word_wrap.gif', 'toggle_word_wrap', true],
92
- ['autocompletion', 'autocompletion.gif', 'toggle_autocompletion', true]
93
- ];
94
-
95
- // navigator identification
96
- t.set_browser_infos(t);
97
-
98
- if(t.isIE>=6 || t.isGecko || ( t.isWebKit && !t.isSafari<3 ) || t.isOpera>=9 || t.isCamino )
99
- t.isValidBrowser=true;
100
- else
101
- t.isValidBrowser=false;
102
-
103
- t.set_base_url();
104
-
105
- for(var i=0; i<t.scripts_to_load.length; i++){
106
- 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
107
- t.waiting_loading[t.scripts_to_load[i]+ ".js"]= false;
108
- }
109
- t.add_event(window, "load", EditAreaLoader.prototype.window_loaded);
110
- };
111
-
112
- EditAreaLoader.prototype ={
113
- has_error : function(){
114
- this.error= true;
115
- // set to empty all EditAreaLoader functions
116
- for(var i in EditAreaLoader.prototype){
117
- EditAreaLoader.prototype[i]=function(){};
118
- }
119
- },
120
-
121
- // add browser informations to the object passed in parameter
122
- set_browser_infos : function(o){
123
- ua= navigator.userAgent;
124
-
125
- // general detection
126
- o.isWebKit = /WebKit/.test(ua);
127
- o.isGecko = !o.isWebKit && /Gecko/.test(ua);
128
- o.isMac = /Mac/.test(ua);
129
-
130
- o.isIE = (navigator.appName == "Microsoft Internet Explorer");
131
- if(o.isIE){
132
- o.isIE = ua.replace(/^.*?MSIE\s+([0-9\.]+).*$/, "$1");
133
- if(o.isIE<6)
134
- o.has_error();
135
- }
136
-
137
- if(o.isOpera = (ua.indexOf('Opera') != -1)){
138
- o.isOpera= ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i, "$1");
139
- if(o.isOpera<9)
140
- o.has_error();
141
- o.isIE=false;
142
- }
143
-
144
- if(o.isFirefox =(ua.indexOf('Firefox') != -1))
145
- o.isFirefox = ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i, "$1");
146
- // Firefox clones
147
- if( ua.indexOf('Iceweasel') != -1 )
148
- o.isFirefox = ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i, "$1");
149
- if( ua.indexOf('GranParadiso') != -1 )
150
- o.isFirefox = ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i, "$1");
151
- if( ua.indexOf('BonEcho') != -1 )
152
- o.isFirefox = ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i, "$1");
153
- if( ua.indexOf('SeaMonkey') != -1)
154
- o.isFirefox = (ua.replace(/^.*?SeaMonkey.*?([0-9\.]+).*$/i, "$1") ) + 1;
155
-
156
- if(o.isCamino =(ua.indexOf('Camino') != -1))
157
- o.isCamino = ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i, "$1");
158
-
159
- if(o.isSafari =(ua.indexOf('Safari') != -1))
160
- o.isSafari= ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i, "$1");
161
-
162
- if(o.isChrome =(ua.indexOf('Chrome') != -1)) {
163
- o.isChrome = ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i, "$1");
164
- o.isSafari = false;
165
- }
166
-
167
- },
168
-
169
- window_loaded : function(){
170
- editAreaLoader.win="loaded";
171
-
172
- // add events on forms
173
- if (document.forms) {
174
- for (var i=0; i<document.forms.length; i++) {
175
- var form = document.forms[i];
176
- form.edit_area_replaced_submit=null;
177
- try {
178
-
179
- form.edit_area_replaced_submit = form.onsubmit;
180
- form.onsubmit="";
181
- } catch (e) {// Do nothing
182
- }
183
- editAreaLoader.add_event(form, "submit", EditAreaLoader.prototype.submit);
184
- editAreaLoader.add_event(form, "reset", EditAreaLoader.prototype.reset);
185
- }
186
- }
187
- editAreaLoader.add_event(window, "unload", function(){for(var i in editAreas){editAreaLoader.delete_instance(i);}}); // ini callback
188
- },
189
-
190
- // init the checkup of the selection of the IE textarea
191
- init_ie_textarea : function(id){
192
- var a=document.getElementById(id);
193
- try{
194
- if(a && typeof(a.focused)=="undefined"){
195
- a.focus();
196
- a.focused=true;
197
- a.selectionStart= a.selectionEnd= 0;
198
- get_IE_selection(a);
199
- editAreaLoader.add_event(a, "focus", IE_textarea_focus);
200
- editAreaLoader.add_event(a, "blur", IE_textarea_blur);
201
-
202
- }
203
- }catch(ex){}
204
- },
205
-
206
- init : function(settings){
207
- var t=this,s=settings,i;
208
-
209
- if(!s["id"])
210
- t.has_error();
211
- if(t.error)
212
- return;
213
- // if an instance of the editor already exists for this textarea => delete the previous one
214
- if(editAreas[s["id"]])
215
- t.delete_instance(s["id"]);
216
-
217
- // init settings
218
- for(i in t.default_settings){
219
- if(typeof(s[i])=="undefined")
220
- s[i]=t.default_settings[i];
221
- }
222
-
223
- if(s["browsers"]=="known" && t.isValidBrowser==false){
224
- return;
225
- }
226
-
227
- if(s["begin_toolbar"].length>0)
228
- s["toolbar"]= s["begin_toolbar"] +","+ s["toolbar"];
229
- if(s["end_toolbar"].length>0)
230
- s["toolbar"]= s["toolbar"] +","+ s["end_toolbar"];
231
- s["tab_toolbar"]= s["toolbar"].replace(/ /g,"").split(",");
232
-
233
- s["plugins"]= s["plugins"].replace(/ /g,"").split(",");
234
- for(i=0; i<s["plugins"].length; i++){
235
- if(s["plugins"][i].length==0)
236
- s["plugins"].splice(i,1);
237
- }
238
- // alert(settings["plugins"].length+": "+ settings["plugins"].join(","));
239
- t.get_template();
240
- t.load_script(t.baseURL + "langs/"+ s["language"] + ".js");
241
-
242
- if(s["syntax"].length>0){
243
- s["syntax"]=s["syntax"].toLowerCase();
244
- t.load_script(t.baseURL + "reg_syntax/"+ s["syntax"] + ".js");
245
- }
246
- //alert(this.template);
247
-
248
- editAreas[s["id"]]= {"settings": s};
249
- editAreas[s["id"]]["displayed"]=false;
250
- editAreas[s["id"]]["hidden"]=false;
251
-
252
- //if(settings["display"]=="onload")
253
- t.start(s["id"]);
254
- },
255
-
256
- // delete an instance of an EditArea
257
- delete_instance : function(id){
258
- var d=document,fs=window.frames,span,iframe;
259
- editAreaLoader.execCommand(id, "EA_delete");
260
- if(fs["frame_"+id] && fs["frame_"+id].editArea)
261
- {
262
- if(editAreas[id]["displayed"])
263
- editAreaLoader.toggle(id, "off");
264
- fs["frame_"+id].editArea.execCommand("EA_unload");
265
- }
266
-
267
- // remove toggle infos and debug textarea
268
- span= d.getElementById("EditAreaArroundInfos_"+id);
269
- if(span)
270
- span.parentNode.removeChild(span);
271
-
272
- // remove the iframe
273
- iframe= d.getElementById("frame_"+id);
274
- if(iframe){
275
- iframe.parentNode.removeChild(iframe);
276
- //delete iframe;
277
- try {
278
- delete fs["frame_"+id];
279
- } catch (e) {// Do nothing
280
- }
281
- }
282
-
283
- delete editAreas[id];
284
- },
285
-
286
-
287
- start : function(id){
288
- var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;
289
-
290
- // check that the window is loaded
291
- if(t.win!="loaded"){
292
- setTimeout("editAreaLoader.start('"+id+"');", 50);
293
- return;
294
- }
295
-
296
- // check that all needed scripts are loaded
297
- for( i in t.waiting_loading){
298
- if(t.waiting_loading[i]!="loaded" && typeof(t.waiting_loading[i])!="function"){
299
- setTimeout("editAreaLoader.start('"+id+"');", 50);
300
- return;
301
- }
302
- }
303
-
304
- // wait until language and syntax files are loaded
305
- if(!t.lang[editAreas[id]["settings"]["language"]] || (editAreas[id]["settings"]["syntax"].length>0 && !t.load_syntax[editAreas[id]["settings"]["syntax"]]) ){
306
- setTimeout("editAreaLoader.start('"+id+"');", 50);
307
- return;
308
- }
309
- // init the regexp for syntax highlight
310
- if(editAreas[id]["settings"]["syntax"].length>0)
311
- t.init_syntax_regexp();
312
-
313
-
314
- // display toggle option and debug area
315
- if(!d.getElementById("EditAreaArroundInfos_"+id) && (editAreas[id]["settings"]["debug"] || editAreas[id]["settings"]["allow_toggle"]))
316
- {
317
- span= d.createElement("span");
318
- span.id= "EditAreaArroundInfos_"+id;
319
- if(editAreas[id]["settings"]["allow_toggle"]){
320
- checked=(editAreas[id]["settings"]["display"]=="onload")?"checked='checked'":"";
321
- html+="<div id='edit_area_toggle_"+i+"'>";
322
- html+="<input id='edit_area_toggle_checkbox_"+ id +"' class='toggle_"+ id +"' type='checkbox' onclick='editAreaLoader.toggle(\""+ id +"\");' accesskey='e' "+checked+" />";
323
- html+="<label for='edit_area_toggle_checkbox_"+ id +"'>{$toggle}</label></div>";
324
- }
325
- if(editAreas[id]["settings"]["debug"])
326
- 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 />";
327
- html= t.translate(html, editAreas[id]["settings"]["language"]);
328
- span.innerHTML= html;
329
- father= d.getElementById(id).parentNode;
330
- next= d.getElementById(id).nextSibling;
331
- if(next==null)
332
- father.appendChild(span);
333
- else
334
- father.insertBefore(span, next);
335
- }
336
-
337
- if(!editAreas[id]["initialized"])
338
- {
339
- t.execCommand(id, "EA_init"); // ini callback
340
- if(editAreas[id]["settings"]["display"]=="later"){
341
- editAreas[id]["initialized"]= true;
342
- return;
343
- }
344
- }
345
-
346
- if(t.isIE){ // launch IE selection checkup
347
- t.init_ie_textarea(id);
348
- }
349
-
350
- // get toolbar content
351
- var area=editAreas[id];
352
-
353
- for(i=0; i<area["settings"]["tab_toolbar"].length; i++){
354
- // alert(this.tab_toolbar[i]+"\n"+ this.get_control_html(this.tab_toolbar[i]));
355
- html_toolbar_content+= t.get_control_html(area["settings"]["tab_toolbar"][i], area["settings"]["language"]);
356
- }
357
- // translate toolbar text here for chrome 2
358
- html_toolbar_content = t.translate(html_toolbar_content, area["settings"]["language"], "template");
359
-
360
-
361
- // create javascript import rules for the iframe if the javascript has not been already loaded by the compressor
362
- if(!t.iframe_script){
363
- t.iframe_script="";
364
- for(i=0; i<t.sub_scripts_to_load.length; i++)
365
- t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + t.sub_scripts_to_load[i] +'.js"></script>';
366
- }
367
-
368
- // add plugins scripts if not already loaded by the compressor (but need to load language in all the case)
369
- for(i=0; i<area["settings"]["plugins"].length; i++){
370
- //if(typeof(area["settings"]["plugins"][i])=="function") continue;
371
- if(!t.all_plugins_loaded)
372
- t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + 'plugins/' + area["settings"]["plugins"][i] + '/' + area["settings"]["plugins"][i] +'.js"></script>';
373
- t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + 'plugins/' + area["settings"]["plugins"][i] + '/langs/' + area["settings"]["language"] +'.js"></script>';
374
- }
375
-
376
-
377
- // create css link for the iframe if the whole css text has not been already loaded by the compressor
378
- if(!t.iframe_css){
379
- t.iframe_css="<link href='"+ t.baseURL +"edit_area.css' rel='stylesheet' type='text/css' />";
380
- }
381
-
382
-
383
- // create template
384
- template= t.template.replace(/\[__BASEURL__\]/g, t.baseURL);
385
- template= template.replace("[__TOOLBAR__]",html_toolbar_content);
386
-
387
-
388
- // fill template with good language sentences
389
- template= t.translate(template, area["settings"]["language"], "template");
390
-
391
- // add css_code
392
- template= template.replace("[__CSSRULES__]", t.iframe_css);
393
- // add js_code
394
- template= template.replace("[__JSCODE__]", t.iframe_script);
395
-
396
- // add version_code
397
- template= template.replace("[__EA_VERSION__]", t.version);
398
- //template=template.replace(/\{\$([^\}]+)\}/gm, this.traduc_template);
399
-
400
- //editAreas[area["settings"]["id"]]["template"]= template;
401
-
402
- area.textarea=d.getElementById(area["settings"]["id"]);
403
- editAreas[area["settings"]["id"]]["textarea"]=area.textarea;
404
-
405
- // if removing previous instances from DOM before (fix from Marcin)
406
- if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')
407
- delete window.frames["frame_"+area["settings"]["id"]];
408
-
409
- // insert template in the document after the textarea
410
- father= area.textarea.parentNode;
411
- /* var container= document.createElement("div");
412
- container.id= "EditArea_frame_container_"+area["settings"]["id"];
413
- */
414
- content= d.createElement("iframe");
415
- content.name= "frame_"+area["settings"]["id"];
416
- content.id= "frame_"+area["settings"]["id"];
417
- content.style.borderWidth= "0px";
418
- setAttribute(content, "frameBorder", "0"); // IE
419
- content.style.overflow="hidden";
420
- content.style.display="none";
421
-
422
-
423
- next= area.textarea.nextSibling;
424
- if(next==null)
425
- father.appendChild(content);
426
- else
427
- father.insertBefore(content, next) ;
428
- f=window.frames["frame_"+area["settings"]["id"]];
429
- f.document.open();
430
- f.editAreas=editAreas;
431
- f.area_id= area["settings"]["id"];
432
- f.document.area_id= area["settings"]["id"];
433
- f.document.write(template);
434
- f.document.close();
435
-
436
- // frame.editAreaLoader=this;
437
- //editAreas[area["settings"]["id"]]["displayed"]=true;
438
-
439
- },
440
-
441
- toggle : function(id, toggle_to){
442
-
443
- /* if((editAreas[id]["displayed"]==true && toggle_to!="on") || toggle_to=="off"){
444
- this.toggle_off(id);
445
- }else if((editAreas[id]["displayed"]==false && toggle_to!="off") || toggle_to=="on"){
446
- this.toggle_on(id);
447
- }*/
448
- if(!toggle_to)
449
- toggle_to= (editAreas[id]["displayed"]==true)?"off":"on";
450
- if(editAreas[id]["displayed"]==true && toggle_to=="off"){
451
- this.toggle_off(id);
452
- }else if(editAreas[id]["displayed"]==false && toggle_to=="on"){
453
- this.toggle_on(id);
454
- }
455
-
456
- return false;
457
- },
458
-
459
- // static function
460
- toggle_off : function(id){
461
- var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft;
462
- if(fs["frame_"+id])
463
- {
464
- f = fs["frame_"+id];
465
- t = editAreas[id]["textarea"];
466
- if(f.editArea.fullscreen['isFull'])
467
- f.editArea.toggle_full_screen(false);
468
- editAreas[id]["displayed"]=false;
469
-
470
- // set wrap to off to keep same display mode (some browser get problem with this, so it need more complex operation
471
- t.wrap = "off"; // for IE
472
- setAttribute(t, "wrap", "off"); // for Firefox
473
- parNod = t.parentNode;
474
- nxtSib = t.nextSibling;
475
- parNod.removeChild(t);
476
- parNod.insertBefore(t, nxtSib);
477
-
478
- // restore values
479
- t.value= f.editArea.textarea.value;
480
- selStart = f.editArea.last_selection["selectionStart"];
481
- selEnd = f.editArea.last_selection["selectionEnd"];
482
- scrollTop = f.document.getElementById("result").scrollTop;
483
- scrollLeft = f.document.getElementById("result").scrollLeft;
484
-
485
-
486
- document.getElementById("frame_"+id).style.display='none';
487
-
488
- t.style.display="inline";
489
-
490
- try{ // IE will give an error when trying to focus an invisible or disabled textarea
491
- t.focus();
492
- } catch(e){};
493
- if(this.isIE){
494
- t.selectionStart= selStart;
495
- t.selectionEnd = selEnd;
496
- t.focused = true;
497
- set_IE_selection(t);
498
- }else{
499
- if(this.isOpera && this.isOpera < 9.6 ){ // Opera bug when moving selection start and selection end
500
- t.setSelectionRange(0, 0);
501
- }
502
- try{
503
- t.setSelectionRange(selStart, selEnd);
504
- } catch(e) {};
505
- }
506
- t.scrollTop= scrollTop;
507
- t.scrollLeft= scrollLeft;
508
- f.editArea.execCommand("toggle_off");
509
-
510
- }
511
- },
512
-
513
- // static function
514
- toggle_on : function(id){
515
- var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem;
516
-
517
- if(fs["frame_"+id])
518
- {
519
- f = fs["frame_"+id];
520
- t = editAreas[id]["textarea"];
521
- area= f.editArea;
522
- area.textarea.value= t.value;
523
-
524
- // store display values;
525
- curPos = editAreas[id]["settings"]["cursor_position"];
526
-
527
- if(t.use_last==true)
528
- {
529
- selStart = t.last_selectionStart;
530
- selEnd = t.last_selectionEnd;
531
- scrollTop = t.last_scrollTop;
532
- scrollLeft = t.last_scrollLeft;
533
- t.use_last=false;
534
- }
535
- else if( curPos == "auto" )
536
- {
537
- try{
538
- selStart = t.selectionStart;
539
- selEnd = t.selectionEnd;
540
- scrollTop = t.scrollTop;
541
- scrollLeft = t.scrollLeft;
542
- //alert(scrollTop);
543
- }catch(ex){}
544
- }
545
-
546
- // set to good size
547
- this.set_editarea_size_from_textarea(id, document.getElementById("frame_"+id));
548
- t.style.display="none";
549
- document.getElementById("frame_"+id).style.display="inline";
550
- area.execCommand("focus"); // without this focus opera doesn't manage well the iframe body height
551
-
552
-
553
- // restore display values
554
- editAreas[id]["displayed"]=true;
555
- area.execCommand("update_size");
556
-
557
- f.document.getElementById("result").scrollTop= scrollTop;
558
- f.document.getElementById("result").scrollLeft= scrollLeft;
559
- area.area_select(selStart, selEnd-selStart);
560
- area.execCommand("toggle_on");
561
-
562
-
563
- }
564
- else
565
- {
566
- /* if(this.isIE)
567
- get_IE_selection(document.getElementById(id)); */
568
- elem= document.getElementById(id);
569
- elem.last_selectionStart= elem.selectionStart;
570
- elem.last_selectionEnd= elem.selectionEnd;
571
- elem.last_scrollTop= elem.scrollTop;
572
- elem.last_scrollLeft= elem.scrollLeft;
573
- elem.use_last=true;
574
- editAreaLoader.start(id);
575
- }
576
- },
577
-
578
- set_editarea_size_from_textarea : function(id, frame){
579
- var elem,width,height;
580
- elem = document.getElementById(id);
581
-
582
- width = Math.max(editAreas[id]["settings"]["min_width"], elem.offsetWidth)+"px";
583
- height = Math.max(editAreas[id]["settings"]["min_height"], elem.offsetHeight)+"px";
584
- if(elem.style.width.indexOf("%")!=-1)
585
- width = elem.style.width;
586
- if(elem.style.height.indexOf("%")!=-1)
587
- height = elem.style.height;
588
- //alert("h: "+height+" w: "+width);
589
-
590
- frame.style.width= width;
591
- frame.style.height= height;
592
- },
593
-
594
- set_base_url : function(){
595
- var t=this,elems,i,docBasePath;
596
-
597
- if( !this.baseURL ){
598
- elems = document.getElementsByTagName('script');
599
-
600
- for( i=0; i<elems.length; i++ ){
601
- if (elems[i].src && elems[i].src.match(/edit_area_[^\\\/]*$/i) ) {
602
- var src = unescape( elems[i].src ); // use unescape for utf-8 encoded urls
603
- src = src.substring(0, src.lastIndexOf('/'));
604
- this.baseURL = src;
605
- this.file_name= elems[i].src.substr(elems[i].src.lastIndexOf("/")+1);
606
- break;
607
- }
608
- }
609
- }
610
-
611
- docBasePath = document.location.href;
612
- if (docBasePath.indexOf('?') != -1)
613
- docBasePath = docBasePath.substring(0, docBasePath.indexOf('?'));
614
- docBasePath = docBasePath.substring(0, docBasePath.lastIndexOf('/'));
615
-
616
- // If not HTTP absolute
617
- if (t.baseURL.indexOf('://') == -1 && t.baseURL.charAt(0) != '/') {
618
- // If site absolute
619
- t.baseURL = docBasePath + "/" + t.baseURL;
620
- }
621
- t.baseURL +="/";
622
- },
623
-
624
- get_button_html : function(id, img, exec, isFileSpecific, baseURL) {
625
- var cmd,html;
626
- if(!baseURL)
627
- baseURL= this.baseURL;
628
- cmd = 'editArea.execCommand(\'' + exec + '\')';
629
- html = '<a id="a_'+ id +'" href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self" fileSpecific="'+ (isFileSpecific?'yes':'no') +'">';
630
- html += '<img id="' + id + '" src="'+ baseURL +'images/' + img + '" title="{$' + id + '}" width="20" height="20" class="editAreaButtonNormal" onmouseover="editArea.switchClass(this,\'editAreaButtonOver\');" onmouseout="editArea.restoreClass(this);" onmousedown="editArea.restoreAndSwitchClass(this,\'editAreaButtonDown\');" /></a>';
631
- return html;
632
- },
633
-
634
- get_control_html : function(button_name, lang) {
635
- var t=this,i,but,html,si;
636
- for (i=0; i<t.advanced_buttons.length; i++)
637
- {
638
- but = t.advanced_buttons[i];
639
- if (but[0] == button_name)
640
- {
641
- return t.get_button_html(but[0], but[1], but[2], but[3]);
642
- }
643
- }
644
-
645
- switch (button_name){
646
- case "*":
647
- case "return":
648
- return "<br />";
649
- case "|":
650
- case "separator":
651
- return '<img src="'+ t.baseURL +'images/spacer.gif" width="1" height="15" class="editAreaSeparatorLine">';
652
- case "select_font":
653
- html= "<select id='area_font_size' onchange='javascript:editArea.execCommand(\"change_font_size\")' fileSpecific='yes'>";
654
- html+="<option value='-1'>{$font_size}</option>";
655
- si=[8,9,10,11,12,14];
656
- for( i=0;i<si.length;i++){
657
- html+="<option value='"+si[i]+"'>"+si[i]+" pt</option>";
658
- }
659
- html+="</select>";
660
- return html;
661
- case "syntax_selection":
662
- html= "<select id='syntax_selection' onchange='javascript:editArea.execCommand(\"change_syntax\", this.value)' fileSpecific='yes'>";
663
- html+="<option value='-1'>{$syntax_selection}</option>";
664
- html+="</select>";
665
- return html;
666
- }
667
-
668
- return "<span id='tmp_tool_"+button_name+"'>["+button_name+"]</span>";
669
- },
670
-
671
-
672
- get_template : function(){
673
- if(this.template=="")
674
- {
675
- var xhr_object = null;
676
- if(window.XMLHttpRequest) // Firefox
677
- xhr_object = new XMLHttpRequest();
678
- else if(window.ActiveXObject) // Internet Explorer
679
- xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
680
- else { // XMLHttpRequest not supported
681
- alert("XMLHTTPRequest not supported. EditArea not loaded");
682
- return;
683
- }
684
-
685
- xhr_object.open("GET", this.baseURL+"template.html", false);
686
- xhr_object.send(null);
687
- if(xhr_object.readyState == 4)
688
- this.template=xhr_object.responseText;
689
- else
690
- this.has_error();
691
- }
692
- },
693
-
694
- // translate text
695
- translate : function(text, lang, mode){
696
- if(mode=="word")
697
- text=editAreaLoader.get_word_translation(text, lang);
698
- else if(mode="template"){
699
- editAreaLoader.current_language= lang;
700
- text=text.replace(/\{\$([^\}]+)\}/gm, editAreaLoader.translate_template);
701
- }
702
- return text;
703
- },
704
-
705
- translate_template : function(){
706
- return editAreaLoader.get_word_translation(EditAreaLoader.prototype.translate_template.arguments[1], editAreaLoader.current_language);
707
- },
708
-
709
- get_word_translation : function(val, lang){
710
- var i;
711
-
712
- for( i in editAreaLoader.lang[lang]){
713
- if(i == val)
714
- return editAreaLoader.lang[lang][i];
715
- }
716
- return "_"+val;
717
- },
718
-
719
- load_script : function(url){
720
- var t=this,d=document,script,head;
721
-
722
- if( t.loadedFiles[url] )
723
- return;
724
- //alert("load: "+url);
725
- try{
726
- script= d.createElement("script");
727
- script.type= "text/javascript";
728
- script.src= url;
729
- script.charset= "UTF-8";
730
- d.getElementsByTagName("head")[0].appendChild(script);
731
- }catch(e){
732
- d.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '" charset="UTF-8"></sc'+'ript>');
733
- }
734
-
735
- t.loadedFiles[url] = true;
736
- },
737
-
738
- add_event : function(obj, name, handler) {
739
- try{
740
- if (obj.attachEvent) {
741
- obj.attachEvent("on" + name, handler);
742
- } else{
743
- obj.addEventListener(name, handler, false);
744
- }
745
- }catch(e){}
746
- },
747
-
748
- remove_event : function(obj, name, handler){
749
- try{
750
- if (obj.detachEvent)
751
- obj.detachEvent("on" + name, handler);
752
- else
753
- obj.removeEventListener(name, handler, false);
754
- }catch(e){}
755
- },
756
-
757
-
758
- // reset all the editareas in the form that have been reseted
759
- reset : function(e){
760
- var formObj,is_child,i,x;
761
-
762
- formObj = editAreaLoader.isIE ? window.event.srcElement : e.target;
763
- if(formObj.tagName!='FORM')
764
- formObj= formObj.form;
765
-
766
- for( i in editAreas ){
767
- is_child= false;
768
- for( x=0;x<formObj.elements.length;x++ ) {
769
- if(formObj.elements[x].id == i)
770
- is_child=true;
771
- }
772
-
773
- if(window.frames["frame_"+i] && is_child && editAreas[i]["displayed"]==true){
774
-
775
- var exec= 'window.frames["frame_'+ i +'"].editArea.textarea.value= document.getElementById("'+ i +'").value;';
776
- exec+= 'window.frames["frame_'+ i +'"].editArea.execCommand("focus");';
777
- exec+= 'window.frames["frame_'+ i +'"].editArea.check_line_selection();';
778
- exec+= 'window.frames["frame_'+ i +'"].editArea.execCommand("reset");';
779
- window.setTimeout(exec, 10);
780
- }
781
- }
782
- return;
783
- },
784
-
785
-
786
- // prepare all the textarea replaced by an editarea to be submited
787
- submit : function(e){
788
- var formObj,is_child,fs=window.frames,i,x;
789
- formObj = editAreaLoader.isIE ? window.event.srcElement : e.target;
790
- if(formObj.tagName!='FORM')
791
- formObj= formObj.form;
792
-
793
- for( i in editAreas){
794
- is_child= false;
795
- for( x=0;x<formObj.elements.length;x++ ) {
796
- if(formObj.elements[x].id == i)
797
- is_child=true;
798
- }
799
-
800
- if(is_child)
801
- {
802
- if(fs["frame_"+i] && editAreas[i]["displayed"]==true)
803
- document.getElementById(i).value= fs["frame_"+ i].editArea.textarea.value;
804
- editAreaLoader.execCommand(i,"EA_submit");
805
- }
806
- }
807
- if( typeof(formObj.edit_area_replaced_submit) == "function" ){
808
- res= formObj.edit_area_replaced_submit();
809
- if(res==false){
810
- if(editAreaLoader.isIE)
811
- return false;
812
- else
813
- e.preventDefault();
814
- }
815
- }
816
- return;
817
- },
818
-
819
- // allow to get the value of the editarea
820
- getValue : function(id){
821
- if(window.frames["frame_"+id] && editAreas[id]["displayed"]==true){
822
- return window.frames["frame_"+ id].editArea.textarea.value;
823
- }else if(elem=document.getElementById(id)){
824
- return elem.value;
825
- }
826
- return false;
827
- },
828
-
829
- // allow to set the value of the editarea
830
- setValue : function(id, new_val){
831
- var fs=window.frames;
832
-
833
- if( ( f=fs["frame_"+id] ) && editAreas[id]["displayed"]==true){
834
- f.editArea.textarea.value= new_val;
835
- f.editArea.execCommand("focus");
836
- f.editArea.check_line_selection(false);
837
- f.editArea.execCommand("onchange");
838
- }else if(elem=document.getElementById(id)){
839
- elem.value= new_val;
840
- }
841
- },
842
-
843
- // allow to get infos on the selection: array(start, end)
844
- getSelectionRange : function(id){
845
- var sel,eA,fs=window.frames;
846
-
847
- sel= {"start": 0, "end": 0};
848
- if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
849
- eA= fs["frame_"+ id].editArea;
850
-
851
- sel["start"] = eA.textarea.selectionStart;
852
- sel["end"] = eA.textarea.selectionEnd;
853
-
854
- }else if( elem=document.getElementById(id) ){
855
- sel= getSelectionRange(elem);
856
- }
857
- return sel;
858
- },
859
-
860
- // allow to set the selection with the given start and end positions
861
- setSelectionRange : function(id, new_start, new_end){
862
- var fs=window.frames;
863
-
864
- if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
865
- fs["frame_"+ id].editArea.area_select(new_start, new_end-new_start);
866
- // make an auto-scroll to the selection
867
- if(!this.isIE){
868
- fs["frame_"+ id].editArea.check_line_selection(false);
869
- fs["frame_"+ id].editArea.scroll_to_view();
870
- }
871
- }else if(elem=document.getElementById(id)){
872
- setSelectionRange(elem, new_start, new_end);
873
- }
874
- },
875
-
876
- getSelectedText : function(id){
877
- var sel= this.getSelectionRange(id);
878
-
879
- return this.getValue(id).substring(sel["start"], sel["end"]);
880
- },
881
-
882
- setSelectedText : function(id, new_val){
883
- var fs=window.frames,d=document,sel,text,scrollTop,scrollLeft,new_sel_end;
884
-
885
- new_val = new_val.replace(/\r/g, "");
886
- sel = this.getSelectionRange(id);
887
- text = this.getValue(id);
888
- if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
889
- scrollTop = fs["frame_"+ id].document.getElementById("result").scrollTop;
890
- scrollLeft = fs["frame_"+ id].document.getElementById("result").scrollLeft;
891
- }else{
892
- scrollTop = d.getElementById(id).scrollTop;
893
- scrollLeft = d.getElementById(id).scrollLeft;
894
- }
895
-
896
- text = text.substring(0, sel["start"])+ new_val +text.substring(sel["end"]);
897
- this.setValue(id, text);
898
- new_sel_end = sel["start"]+ new_val.length;
899
- this.setSelectionRange(id, sel["start"], new_sel_end);
900
-
901
-
902
- // fix \r problem for selection length count on IE & Opera
903
- if(new_val != this.getSelectedText(id).replace(/\r/g, "")){
904
- this.setSelectionRange(id, sel["start"], new_sel_end+ new_val.split("\n").length -1);
905
- }
906
- // restore scrolling position
907
- if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
908
- fs["frame_"+ id].document.getElementById("result").scrollTop= scrollTop;
909
- fs["frame_"+ id].document.getElementById("result").scrollLeft= scrollLeft;
910
- fs["frame_"+ id].editArea.execCommand("onchange");
911
- }else{
912
- d.getElementById(id).scrollTop= scrollTop;
913
- d.getElementById(id).scrollLeft= scrollLeft;
914
- }
915
- },
916
-
917
- insertTags : function(id, open_tag, close_tag){
918
- var old_sel,new_sel;
919
-
920
- old_sel = this.getSelectionRange(id);
921
- text = open_tag + this.getSelectedText(id) + close_tag;
922
-
923
- editAreaLoader.setSelectedText(id, text);
924
-
925
- new_sel = this.getSelectionRange(id);
926
- if(old_sel["end"] > old_sel["start"]) // if text was selected, cursor at the end
927
- this.setSelectionRange(id, new_sel["end"], new_sel["end"]);
928
- else // cursor in the middle
929
- this.setSelectionRange(id, old_sel["start"]+open_tag.length, old_sel["start"]+open_tag.length);
930
- },
931
-
932
- // hide both EditArea and normal textarea
933
- hide : function(id){
934
- var fs= window.frames,d=document,t=this,scrollTop,scrollLeft,span;
935
- if(d.getElementById(id) && !t.hidden[id])
936
- {
937
- t.hidden[id]= {};
938
- t.hidden[id]["selectionRange"]= t.getSelectionRange(id);
939
- if(d.getElementById(id).style.display!="none")
940
- {
941
- t.hidden[id]["scrollTop"]= d.getElementById(id).scrollTop;
942
- t.hidden[id]["scrollLeft"]= d.getElementById(id).scrollLeft;
943
- }
944
-
945
- if(fs["frame_"+id])
946
- {
947
- t.hidden[id]["toggle"]= editAreas[id]["displayed"];
948
-
949
- if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
950
- scrollTop = fs["frame_"+ id].document.getElementById("result").scrollTop;
951
- scrollLeft = fs["frame_"+ id].document.getElementById("result").scrollLeft;
952
- }else{
953
- scrollTop = d.getElementById(id).scrollTop;
954
- scrollLeft = d.getElementById(id).scrollLeft;
955
- }
956
- t.hidden[id]["scrollTop"]= scrollTop;
957
- t.hidden[id]["scrollLeft"]= scrollLeft;
958
-
959
- if(editAreas[id]["displayed"]==true)
960
- editAreaLoader.toggle_off(id);
961
- }
962
-
963
- // hide toggle button and debug box
964
- span= d.getElementById("EditAreaArroundInfos_"+id);
965
- if(span){
966
- span.style.display='none';
967
- }
968
-
969
- // hide textarea
970
- d.getElementById(id).style.display= "none";
971
- }
972
- },
973
-
974
- // restore hidden EditArea and normal textarea
975
- show : function(id){
976
- var fs= window.frames,d=document,t=this,span;
977
- if((elem=d.getElementById(id)) && t.hidden[id])
978
- {
979
- elem.style.display= "inline";
980
- elem.scrollTop= t.hidden[id]["scrollTop"];
981
- elem.scrollLeft= t.hidden[id]["scrollLeft"];
982
- span= d.getElementById("EditAreaArroundInfos_"+id);
983
- if(span){
984
- span.style.display='inline';
985
- }
986
-
987
- if(fs["frame_"+id])
988
- {
989
-
990
- // restore toggle button and debug box
991
-
992
-
993
- // restore textarea
994
- elem.style.display= "inline";
995
-
996
- // restore EditArea
997
- if(t.hidden[id]["toggle"]==true)
998
- editAreaLoader.toggle_on(id);
999
-
1000
- scrollTop = t.hidden[id]["scrollTop"];
1001
- scrollLeft = t.hidden[id]["scrollLeft"];
1002
-
1003
- if(fs["frame_"+id] && editAreas[id]["displayed"]==true){
1004
- fs["frame_"+ id].document.getElementById("result").scrollTop = scrollTop;
1005
- fs["frame_"+ id].document.getElementById("result").scrollLeft = scrollLeft;
1006
- }else{
1007
- elem.scrollTop = scrollTop;
1008
- elem.scrollLeft = scrollLeft;
1009
- }
1010
-
1011
- }
1012
- // restore selection
1013
- sel = t.hidden[id]["selectionRange"];
1014
- t.setSelectionRange(id, sel["start"], sel["end"]);
1015
- delete t.hidden[id];
1016
- }
1017
- },
1018
-
1019
- // get the current file datas (for multi file editing mode)
1020
- getCurrentFile : function(id){
1021
- return this.execCommand(id, 'get_file', this.execCommand(id, 'curr_file'));
1022
- },
1023
-
1024
- // get the given file datas (for multi file editing mode)
1025
- getFile : function(id, file_id){
1026
- return this.execCommand(id, 'get_file', file_id);
1027
- },
1028
-
1029
- // get all the openned files datas (for multi file editing mode)
1030
- getAllFiles : function(id){
1031
- return this.execCommand(id, 'get_all_files()');
1032
- },
1033
-
1034
- // open a file (for multi file editing mode)
1035
- openFile : function(id, file_infos){
1036
- return this.execCommand(id, 'open_file', file_infos);
1037
- },
1038
-
1039
- // close the given file (for multi file editing mode)
1040
- closeFile : function(id, file_id){
1041
- return this.execCommand(id, 'close_file', file_id);
1042
- },
1043
-
1044
- // close the given file (for multi file editing mode)
1045
- setFileEditedMode : function(id, file_id, to){
1046
- var reg1,reg2;
1047
- reg1 = new RegExp('\\\\', 'g');
1048
- reg2 = new RegExp('"', 'g');
1049
- return this.execCommand(id, 'set_file_edited_mode("'+ file_id.replace(reg1, '\\\\').replace(reg2, '\\"') +'", '+ to +')');
1050
- },
1051
-
1052
-
1053
- // allow to access to editarea functions and datas (for advanced users only)
1054
- execCommand : function(id, cmd, fct_param){
1055
- switch(cmd){
1056
- case "EA_init":
1057
- if(editAreas[id]['settings']["EA_init_callback"].length>0)
1058
- eval(editAreas[id]['settings']["EA_init_callback"]+"('"+ id +"');");
1059
- break;
1060
- case "EA_delete":
1061
- if(editAreas[id]['settings']["EA_delete_callback"].length>0)
1062
- eval(editAreas[id]['settings']["EA_delete_callback"]+"('"+ id +"');");
1063
- break;
1064
- case "EA_submit":
1065
- if(editAreas[id]['settings']["submit_callback"].length>0)
1066
- eval(editAreas[id]['settings']["submit_callback"]+"('"+ id +"');");
1067
- break;
1068
- }
1069
- if(window.frames["frame_"+id] && window.frames["frame_"+ id].editArea){
1070
- if(fct_param!=undefined)
1071
- return eval('window.frames["frame_'+ id +'"].editArea.'+ cmd +'(fct_param);');
1072
- else
1073
- return eval('window.frames["frame_'+ id +'"].editArea.'+ cmd +';');
1074
- }
1075
- return false;
1076
- }
1077
- };
1078
-
1079
- var editAreaLoader= new EditAreaLoader();
1080
- var editAreas= {};
1081
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/elements_functions.js DELETED
@@ -1,336 +0,0 @@
1
- /****
2
- * This page contains some general usefull functions for javascript
3
- *
4
- ****/
5
-
6
-
7
- // need to redefine this functiondue to IE problem
8
- function getAttribute( elm, aName ) {
9
- var aValue,taName,i;
10
- try{
11
- aValue = elm.getAttribute( aName );
12
- }catch(exept){}
13
-
14
- if( ! aValue ){
15
- for( i = 0; i < elm.attributes.length; i ++ ) {
16
- taName = elm.attributes[i] .name.toLowerCase();
17
- if( taName == aName ) {
18
- aValue = elm.attributes[i] .value;
19
- return aValue;
20
- }
21
- }
22
- }
23
- return aValue;
24
- };
25
-
26
- // need to redefine this function due to IE problem
27
- function setAttribute( elm, attr, val ) {
28
- if(attr=="class"){
29
- elm.setAttribute("className", val);
30
- elm.setAttribute("class", val);
31
- }else{
32
- elm.setAttribute(attr, val);
33
- }
34
- };
35
-
36
- /* return a child element
37
- elem: element we are searching in
38
- elem_type: type of the eleemnt we are searching (DIV, A, etc...)
39
- elem_attribute: attribute of the searched element that must match
40
- elem_attribute_match: value that elem_attribute must match
41
- option: "all" if must return an array of all children, otherwise return the first match element
42
- depth: depth of search (-1 or no set => unlimited)
43
- */
44
- function getChildren(elem, elem_type, elem_attribute, elem_attribute_match, option, depth)
45
- {
46
- if(!option)
47
- var option="single";
48
- if(!depth)
49
- var depth=-1;
50
- if(elem){
51
- var children= elem.childNodes;
52
- var result=null;
53
- var results= [];
54
- for (var x=0;x<children.length;x++) {
55
- strTagName = new String(children[x].tagName);
56
- children_class="?";
57
- if(strTagName!= "undefined"){
58
- child_attribute= getAttribute(children[x],elem_attribute);
59
- if((strTagName.toLowerCase()==elem_type.toLowerCase() || elem_type=="") && (elem_attribute=="" || child_attribute==elem_attribute_match)){
60
- if(option=="all"){
61
- results.push(children[x]);
62
- }else{
63
- return children[x];
64
- }
65
- }
66
- if(depth!=0){
67
- result=getChildren(children[x], elem_type, elem_attribute, elem_attribute_match, option, depth-1);
68
- if(option=="all"){
69
- if(result.length>0){
70
- results= results.concat(result);
71
- }
72
- }else if(result!=null){
73
- return result;
74
- }
75
- }
76
- }
77
- }
78
- if(option=="all")
79
- return results;
80
- }
81
- return null;
82
- };
83
-
84
- function isChildOf(elem, parent){
85
- if(elem){
86
- if(elem==parent)
87
- return true;
88
- while(elem.parentNode != 'undefined'){
89
- return isChildOf(elem.parentNode, parent);
90
- }
91
- }
92
- return false;
93
- };
94
-
95
- function getMouseX(e){
96
-
97
- if(e!=null && typeof(e.pageX)!="undefined"){
98
- return e.pageX;
99
- }else{
100
- return (e!=null?e.x:event.x)+ document.documentElement.scrollLeft;
101
- }
102
- };
103
-
104
- function getMouseY(e){
105
- if(e!=null && typeof(e.pageY)!="undefined"){
106
- return e.pageY;
107
- }else{
108
- return (e!=null?e.y:event.y)+ document.documentElement.scrollTop;
109
- }
110
- };
111
-
112
- function calculeOffsetLeft(r){
113
- return calculeOffset(r,"offsetLeft")
114
- };
115
-
116
- function calculeOffsetTop(r){
117
- return calculeOffset(r,"offsetTop")
118
- };
119
-
120
- function calculeOffset(element,attr){
121
- var offset=0;
122
- while(element){
123
- offset+=element[attr];
124
- element=element.offsetParent
125
- }
126
- return offset;
127
- };
128
-
129
- /** return the computed style
130
- * @param: elem: the reference to the element
131
- * @param: prop: the name of the css property
132
- */
133
- function get_css_property(elem, prop)
134
- {
135
- if(document.defaultView)
136
- {
137
- return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop);
138
- }
139
- else if(elem.currentStyle)
140
- {
141
- var prop = prop.replace(/-\D/gi, function(sMatch)
142
- {
143
- return sMatch.charAt(sMatch.length - 1).toUpperCase();
144
- });
145
- return elem.currentStyle[prop];
146
- }
147
- else return null;
148
- }
149
-
150
- /****
151
- * Moving an element
152
- ***/
153
-
154
- var _mCE; // currently moving element
155
-
156
- /* allow to move an element in a window
157
- e: the event
158
- id: the id of the element
159
- frame: the frame of the element
160
- ex of use:
161
- in html: <img id='move_area_search_replace' onmousedown='return parent.start_move_element(event,"area_search_replace", parent.frames["this_frame_id"]);' .../>
162
- or
163
- in javascript: document.getElementById("my_div").onmousedown= start_move_element
164
- */
165
- function start_move_element(e, id, frame){
166
- var elem_id=(e.target || e.srcElement).id;
167
- if(id)
168
- elem_id=id;
169
- if(!frame)
170
- frame=window;
171
- if(frame.event)
172
- e=frame.event;
173
-
174
- _mCE= frame.document.getElementById(elem_id);
175
- _mCE.frame=frame;
176
- frame.document.onmousemove= move_element;
177
- frame.document.onmouseup= end_move_element;
178
- /*_mCE.onmousemove= move_element;
179
- _mCE.onmouseup= end_move_element;*/
180
-
181
- //alert(_mCE.frame.document.body.offsetHeight);
182
-
183
- mouse_x= getMouseX(e);
184
- mouse_y= getMouseY(e);
185
- //window.status=frame+ " elem: "+elem_id+" elem: "+ _mCE + " mouse_x: "+mouse_x;
186
- _mCE.start_pos_x = mouse_x - (_mCE.style.left.replace("px","") || calculeOffsetLeft(_mCE));
187
- _mCE.start_pos_y = mouse_y - (_mCE.style.top.replace("px","") || calculeOffsetTop(_mCE));
188
- return false;
189
- };
190
-
191
- function end_move_element(e){
192
- _mCE.frame.document.onmousemove= "";
193
- _mCE.frame.document.onmouseup= "";
194
- _mCE=null;
195
- };
196
-
197
- function move_element(e){
198
- var newTop,newLeft,maxLeft;
199
-
200
- if( _mCE.frame && _mCE.frame.event )
201
- e=_mCE.frame.event;
202
- newTop = getMouseY(e) - _mCE.start_pos_y;
203
- newLeft = getMouseX(e) - _mCE.start_pos_x;
204
-
205
- maxLeft = _mCE.frame.document.body.offsetWidth- _mCE.offsetWidth;
206
- max_top = _mCE.frame.document.body.offsetHeight- _mCE.offsetHeight;
207
- newTop = Math.min(Math.max(0, newTop), max_top);
208
- newLeft = Math.min(Math.max(0, newLeft), maxLeft);
209
-
210
- _mCE.style.top = newTop+"px";
211
- _mCE.style.left = newLeft+"px";
212
- return false;
213
- };
214
-
215
- /***
216
- * Managing a textarea (this part need the navigator infos from editAreaLoader
217
- ***/
218
-
219
- var nav= editAreaLoader.nav;
220
-
221
- // allow to get infos on the selection: array(start, end)
222
- function getSelectionRange(textarea){
223
- return {"start": textarea.selectionStart, "end": textarea.selectionEnd};
224
- };
225
-
226
- // allow to set the selection
227
- function setSelectionRange(t, start, end){
228
- t.focus();
229
-
230
- start = Math.max(0, Math.min(t.value.length, start));
231
- end = Math.max(start, Math.min(t.value.length, end));
232
-
233
- if( nav.isOpera && nav.isOpera < 9.6 ){ // Opera bug when moving selection start and selection end
234
- t.selectionEnd = 1;
235
- t.selectionStart = 0;
236
- t.selectionEnd = 1;
237
- t.selectionStart = 0;
238
- }
239
- t.selectionStart = start;
240
- t.selectionEnd = end;
241
- //textarea.setSelectionRange(start, end);
242
-
243
- if(nav.isIE)
244
- set_IE_selection(t);
245
- };
246
-
247
-
248
- // set IE position in Firefox mode (textarea.selectionStart and textarea.selectionEnd). should work as a repeated task
249
- function get_IE_selection(t){
250
- var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab;
251
- if(t && t.focused)
252
- {
253
- if(!t.ea_line_height)
254
- { // calculate the lineHeight
255
- div= d.createElement("div");
256
- div.style.fontFamily= get_css_property(t, "font-family");
257
- div.style.fontSize= get_css_property(t, "font-size");
258
- div.style.visibility= "hidden";
259
- div.innerHTML="0";
260
- d.body.appendChild(div);
261
- t.ea_line_height= div.offsetHeight;
262
- d.body.removeChild(div);
263
- }
264
- //t.focus();
265
- range = d.selection.createRange();
266
- try
267
- {
268
- stored_range = range.duplicate();
269
- stored_range.moveToElementText( t );
270
- stored_range.setEndPoint( 'EndToEnd', range );
271
- if(stored_range.parentElement() == t){
272
- // the range don't take care of empty lines in the end of the selection
273
- elem = t;
274
- scrollTop = 0;
275
- while(elem.parentNode){
276
- scrollTop+= elem.scrollTop;
277
- elem = elem.parentNode;
278
- }
279
-
280
- // var scrollTop= t.scrollTop + document.body.scrollTop;
281
-
282
- // var relative_top= range.offsetTop - calculeOffsetTop(t) + scrollTop;
283
- relative_top= range.offsetTop - calculeOffsetTop(t)+ scrollTop;
284
- // alert("rangeoffset: "+ range.offsetTop +"\ncalcoffsetTop: "+ calculeOffsetTop(t) +"\nrelativeTop: "+ relative_top);
285
- line_start = Math.round((relative_top / t.ea_line_height) +1);
286
-
287
- line_nb = Math.round(range.boundingHeight / t.ea_line_height);
288
-
289
- range_start = stored_range.text.length - range.text.length;
290
- tab = t.value.substr(0, range_start).split("\n");
291
- range_start += (line_start - tab.length)*2; // add missing empty lines to the selection
292
- t.selectionStart = range_start;
293
-
294
- range_end = t.selectionStart + range.text.length;
295
- tab = t.value.substr(0, range_start + range.text.length).split("\n");
296
- range_end += (line_start + line_nb - 1 - tab.length)*2;
297
- t.selectionEnd = range_end;
298
- }
299
- }
300
- catch(e){}
301
- }
302
- if( t && t.id )
303
- {
304
- setTimeout("get_IE_selection(document.getElementById('"+ t.id +"'));", 50);
305
- }
306
- };
307
-
308
- function IE_textarea_focus(){
309
- event.srcElement.focused= true;
310
- }
311
-
312
- function IE_textarea_blur(){
313
- event.srcElement.focused= false;
314
- }
315
-
316
- // select the text for IE (take into account the \r difference)
317
- function set_IE_selection( t ){
318
- var nbLineStart,nbLineStart,nbLineEnd,range;
319
- if(!window.closed){
320
- nbLineStart=t.value.substr(0, t.selectionStart).split("\n").length - 1;
321
- nbLineEnd=t.value.substr(0, t.selectionEnd).split("\n").length - 1;
322
- try
323
- {
324
- range = document.selection.createRange();
325
- range.moveToElementText( t );
326
- range.setEndPoint( 'EndToStart', range );
327
- range.moveStart('character', t.selectionStart - nbLineStart);
328
- range.moveEnd('character', t.selectionEnd - nbLineEnd - (t.selectionStart - nbLineStart) );
329
- range.select();
330
- }
331
- catch(e){}
332
- }
333
- };
334
-
335
-
336
- editAreaLoader.waiting_loading["elements_functions.js"]= "loaded";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/highlight.js DELETED
@@ -1,407 +0,0 @@
1
- // change_to: "on" or "off"
2
- EditArea.prototype.change_highlight= function(change_to){
3
- if(this.settings["syntax"].length==0 && change_to==false){
4
- this.switchClassSticky(_$("highlight"), 'editAreaButtonDisabled', true);
5
- this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonDisabled', true);
6
- return false;
7
- }
8
-
9
- if(this.do_highlight==change_to)
10
- return false;
11
-
12
-
13
- this.getIESelection();
14
- var pos_start= this.textarea.selectionStart;
15
- var pos_end= this.textarea.selectionEnd;
16
-
17
- if(this.do_highlight===true || change_to==false)
18
- this.disable_highlight();
19
- else
20
- this.enable_highlight();
21
- this.textarea.focus();
22
- this.textarea.selectionStart = pos_start;
23
- this.textarea.selectionEnd = pos_end;
24
- this.setIESelection();
25
-
26
- };
27
-
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";
34
- // replacing the node is far more faster than deleting it's content in firefox
35
- new_Obj= t.content_highlight.cloneNode(false);
36
- new_Obj.innerHTML= "";
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" );
41
- if(old_class){
42
- new_class= old_class.replace( "hidden","" );
43
- parent.setAttribute( a, "class", new_class );
44
- }
45
-
46
- a.style.backgroundColor="transparent"; // needed in order to see the bracket finders
47
-
48
- //var icon= document.getElementById("highlight");
49
- //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") );
50
- //t.restoreClass(icon);
51
- //t.switchClass(icon,'editAreaButtonNormal');
52
- t.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', true);
53
- t.switchClassSticky(_$("reset_highlight"), 'editAreaButtonDisabled', true);
54
-
55
- t.do_highlight=false;
56
-
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);
60
- }
61
-
62
- // this.textarea.style.backgroundColor="#FFFFFF";
63
- };
64
-
65
- EditArea.prototype.enable_highlight= function(){
66
- var t=this, a=t.textarea, new_class;
67
- t.show_waiting_screen();
68
-
69
- t.content_highlight.style.visibility="visible";
70
- new_class =parent.getAttribute(a,"class")+" hidden";
71
- parent.setAttribute( a, "class", new_class );
72
-
73
- // IE can't manage mouse click outside text range without this
74
- if( t.isIE )
75
- a.style.backgroundColor="#FFFFFF";
76
-
77
- t.switchClassSticky(_$("highlight"), 'editAreaButtonSelected', false);
78
- t.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false);
79
-
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);
84
-
85
-
86
- t.do_highlight=true;
87
- t.resync_highlight();
88
-
89
- t.hide_waiting_screen();
90
- };
91
-
92
- /**
93
- * Ask to update highlighted text
94
- * @param Array infos - Array of datas returned by EditArea.get_selection_infos()
95
- */
96
- EditArea.prototype.maj_highlight= function(infos){
97
- // for speed mesure
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;
101
-
102
- if(t.last_text_to_highlight==infos["full_text"] && t.resync_highlight!==true)
103
- return;
104
-
105
- // OPTIMISATION: will search to update only changed lines
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);
113
-
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 );
118
-
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;
124
- }
125
-
126
- // we do the syntax optimisation
127
- if( doSyntaxOpti ){
128
-
129
- tps_middle_opti=new Date().getTime();
130
-
131
- stay_begin= t.last_hightlighted_text.split("\n").slice(0, changes.lineStart).join("\n");
132
- if(changes.lineStart>0)
133
- stay_begin+= "\n";
134
- stay_end= t.last_hightlighted_text.split("\n").slice(changes.lineLastEnd+1).join("\n");
135
- if(stay_end.length>0)
136
- stay_end= "\n"+stay_end;
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
- }
152
- }
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";
171
- }
172
-
173
-
174
- // END OPTIMISATION
175
- }
176
-
177
- tps_end_opti = new Date().getTime();
178
-
179
- // apply highlight
180
- updated_highlight = t.colorize_text(textToHighlight);
181
- tpsAfterReg = new Date().getTime();
182
-
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
- // disable latest optimization tricks (introduced in 0.8.1 and removed in 0.8.2), TODO: check for another try later
191
- doSyntaxOpti = doHtmlOpti = false;
192
- if( doSyntaxOpti )
193
- {
194
- try
195
- {
196
- var replacedBloc, i, nbStart = '', nbEnd = '', newHtml, lengthOld, lengthNew;
197
- replacedBloc = t.last_hightlighted_text.substring( stay_begin.length, t.last_hightlighted_text.length - stay_end.length );
198
-
199
- lengthOld = replacedBloc.length;
200
- lengthNew = updated_highlight.length;
201
-
202
- // find the identical caracters at the beginning
203
- for( i=0; i < lengthOld && i < lengthNew && replacedBloc.charAt(i) == updated_highlight.charAt(i) ; i++ )
204
- {
205
- }
206
- nbStart = i;
207
- // find the identical caracters at the end
208
- for( i=0; i + nbStart < lengthOld && i + nbStart < lengthNew && replacedBloc.charAt(lengthOld-i-1) == updated_highlight.charAt(lengthNew-i-1) ; i++ )
209
- {
210
- }
211
- nbEnd = i;
212
- //console.log( nbStart, nbEnd, replacedBloc, updated_highlight );
213
- // get the changes
214
- lastHtml = replacedBloc.substring( nbStart, lengthOld - nbEnd );
215
- newHtml = updated_highlight.substring( nbStart, lengthNew - nbEnd );
216
-
217
- // We can do the optimisation only if we havn't touch to span elements
218
- if( newHtml.indexOf('<span') == -1 && newHtml.indexOf('</span') == -1
219
- && lastHtml.indexOf('<span') == -1 && lastHtml.indexOf('</span') == -1 )
220
- {
221
- var beginStr, nbOpendedSpan, nbClosedSpan, nbUnchangedChars, span, textNode;
222
- doHtmlOpti = true;
223
- beginStr = t.last_hightlighted_text.substr( 0, stay_begin.length + nbStart );
224
- // fix special chars
225
- newHtml = newHtml.replace( /&lt;/g, '<').replace( /&gt;/g, '>').replace( /&amp;/g, '&');
226
-
227
- nbOpendedSpan = beginStr.split('<span').length - 1;
228
- nbClosedSpan = beginStr.split('</span').length - 1;
229
- // retrieve the previously opened span (Add 1 for the first level span?)
230
- span = t.content_highlight.getElementsByTagName('span')[ nbOpendedSpan ];
231
-
232
- //--------[
233
- // get the textNode to update
234
-
235
- // if we're inside a span, we'll take the one that is opened (can be a parent of the current span)
236
- parentSpan = span;
237
- maxStartOffset = maxEndOffset = 0;
238
-
239
- // it will be in the child of the root node
240
- if( nbOpendedSpan == nbClosedSpan )
241
- {
242
- while( parentSpan.parentNode != t.content_highlight && parentSpan.parentNode.tagName != 'PRE' )
243
- {
244
- parentSpan = parentSpan.parentNode;
245
- }
246
- }
247
- // get the last opened span
248
- else
249
- {
250
- maxStartOffset = maxEndOffset = beginStr.length + 1;
251
- // move to parent node for each closed span found after the lastest open span
252
- nbClosed = beginStr.substr( Math.max( 0, beginStr.lastIndexOf( '<span', maxStartOffset - 1 ) ) ).split('</span').length - 1;
253
- while( nbClosed > 0 )
254
- {
255
- nbClosed--;
256
- parentSpan = parentSpan.parentNode;
257
- }
258
-
259
- // find the position of the last opended tag
260
- 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 ) ) ) )
261
- {
262
- maxStartOffset = tmpMaxStartOffset;
263
- maxEndOffset = tmpMaxEndOffset;
264
- }
265
- }
266
- // Note: maxEndOffset is no more used but maxStartOffset will be used
267
-
268
- if( parentSpan.parentNode == t.content_highlight || parentSpan.parentNode.tagName == 'PRE' )
269
- {
270
- maxStartOffset = Math.max( 0, beginStr.indexOf( '<span' ) );
271
- }
272
-
273
- // find the matching text node (this will be one that will be at the end of the beginStr
274
- if( maxStartOffset == beginStr.length )
275
- {
276
- nbSubSpanBefore = 0;
277
- }
278
- else
279
- {
280
- lastEndPos = Math.max( 0, beginStr.lastIndexOf( '>', maxStartOffset ) );
281
-
282
- // count the number of sub spans
283
- nbSubSpanBefore = beginStr.substr( lastEndPos ).split('<span').length-1;
284
- }
285
-
286
- // there is no sub-span before
287
- if( nbSubSpanBefore == 0 )
288
- {
289
- textNode = parentSpan.firstChild;
290
- }
291
- // we need to find where is the text node modified
292
- else
293
- {
294
- // take the last direct child (no sub-child)
295
- lastSubSpan = parentSpan.getElementsByTagName('span')[ nbSubSpanBefore - 1 ];
296
- while( lastSubSpan.parentNode != parentSpan )
297
- {
298
- lastSubSpan = lastSubSpan.parentNode;
299
- }
300
-
301
- // associate to next text node following the last sub span
302
- if( lastSubSpan.nextSibling == null || lastSubSpan.nextSibling.nodeType != 3 )
303
- {
304
- textNode = document.createTextNode('');
305
- lastSubSpan.parentNode.insertBefore( textNode, lastSubSpan.nextSibling );
306
- }
307
- else
308
- {
309
- textNode = lastSubSpan.nextSibling;
310
- }
311
- }
312
- //--------]
313
-
314
-
315
- //--------[
316
- // update the textNode content
317
-
318
- // number of caracters after the last opened of closed span
319
- //nbUnchangedChars = ( lastIndex = beginStr.lastIndexOf( '>' ) ) == -1 ? beginStr.length : beginStr.length - ( lastIndex + 1 );
320
- //nbUnchangedChars = ? beginStr.length : beginStr.substr( lastIndex + 1 ).replace( /&lt;/g, '<').replace( /&gt;/g, '>').replace( /&amp;/g, '&').length;
321
-
322
- if( ( lastIndex = beginStr.lastIndexOf( '>' ) ) == -1 )
323
- {
324
- nbUnchangedChars = beginStr.length;
325
- }
326
- else
327
- {
328
- nbUnchangedChars = beginStr.substr( lastIndex + 1 ).replace( /&lt;/g, '<').replace( /&gt;/g, '>').replace( /&amp;/g, '&').length;
329
- //nbUnchangedChars += beginStr.substr( ).replace( /&/g, '&amp;').replace( /</g, '&lt;').replace( />/g, '&gt;').length - beginStr.length;
330
- }
331
- //alert( nbUnchangedChars );
332
- // console.log( span, textNode, nbOpendedSpan,nbClosedSpan, span.nextSibling, textNode.length, nbUnchangedChars, lastHtml, lastHtml.length, newHtml, newHtml.length );
333
- // alert( textNode.parentNode.className +'-'+ textNode.parentNode.tagName+"\n"+ textNode.data +"\n"+ nbUnchangedChars +"\n"+ lastHtml.length +"\n"+ newHtml +"\n"+ newHtml.length );
334
- // console.log( nbUnchangedChars, lastIndex, beginStr.length, beginStr.replace(/&/g, '&amp;'), lastHtml.length, '|', newHtml.replace( /\t/g, 't').replace( /\n/g, 'n').replace( /\r/g, 'r'), lastHtml.replace( /\t/g, 't').replace( /\n/g, 'n').replace( /\r/, 'r') );
335
- // console.log( textNode.data.replace(/&/g, '&amp;') );
336
- // IE only manage \r for cariage return in textNode and not \n or \r\n
337
- if( t.isIE )
338
- {
339
- nbUnchangedChars -= ( beginStr.substr( beginStr.length - nbUnchangedChars ).split("\n").length - 1 );
340
- //alert( textNode.data.replace(/\r/g, '_r').replace(/\n/g, '_n'));
341
- textNode.replaceData( nbUnchangedChars, lastHtml.replace(/\n/g, '').length, newHtml.replace(/\n/g, '') );
342
- }
343
- else
344
- {
345
- textNode.replaceData( nbUnchangedChars, lastHtml.length, newHtml );
346
- }
347
- //--------]
348
- }
349
- }
350
- // an exception shouldn't occured but if replaceData failed at least it won't break everything
351
- catch( e )
352
- {
353
- // throw e;
354
- // console.log( e );
355
- doHtmlOpti = false;
356
- }
357
-
358
- }
359
-
360
- /*** END HTML update's optimisation ***/
361
- // end test
362
-
363
- // console.log( (TPS6-TPS5), (TPS5-TPS4), (TPS4-TPS3), (TPS3-TPS2), (TPS2-TPS1), _CPT );
364
- // get the new highlight content
365
- tpsAfterOpti2 = new Date().getTime();
366
- hightlighted_text = stay_begin + updated_highlight + stay_end;
367
- if( !doHtmlOpti )
368
- {
369
- // 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*))
370
- var new_Obj= t.content_highlight.cloneNode(false);
371
- if( ( t.isIE && t.isIE < 8 ) || ( t.isOpera && t.isOpera < 9.6 ) )
372
- new_Obj.innerHTML= "<pre><span class='"+ t.settings["syntax"] +"'>" + hightlighted_text + "</span></pre>";
373
- else
374
- new_Obj.innerHTML= "<span class='"+ t.settings["syntax"] +"'>"+ hightlighted_text +"</span>";
375
-
376
- t.content_highlight.parentNode.replaceChild(new_Obj, t.content_highlight);
377
-
378
- t.content_highlight= new_Obj;
379
- }
380
-
381
- t.last_text_to_highlight= infos["full_text"];
382
- t.last_hightlighted_text= hightlighted_text;
383
-
384
- tps3=new Date().getTime();
385
-
386
- if(t.settings["debug"]){
387
- //lineNumber=tab_text.length;
388
- //t.debug.value+=" \nNB char: "+_$("src").value.length+" Nb line: "+ lineNumber;
389
-
390
- t.debug.value= "Tps optimisation "+(tps_end_opti-tps_start)
391
- +" | tps reg exp: "+ (tpsAfterReg-tps_end_opti)
392
- +" | tps opti HTML : "+ (tpsAfterOpti2-tpsAfterReg) + ' '+ ( doHtmlOpti ? 'yes' : 'no' )
393
- +" | tps update highlight content: "+ (tps3-tpsAfterOpti2)
394
- +" | tpsTotal: "+ (tps3-tps_start)
395
- + "("+tps3+")\n"+ debug_opti;
396
- // t.debug.value+= "highlight\n"+hightlighted_text;*/
397
- }
398
-
399
- };
400
-
401
- EditArea.prototype.resync_highlight= function(reload_now){
402
- this.reload_highlight=true;
403
- this.last_text_to_highlight="";
404
- this.focus();
405
- if(reload_now)
406
- this.check_line_selection(false);
407
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/images/autocompletion.gif DELETED
Binary file
includes/edit_area/images/close.gif DELETED
Binary file
includes/edit_area/images/fullscreen.gif DELETED
Binary file
includes/edit_area/images/go_to_line.gif DELETED
Binary file
includes/edit_area/images/help.gif DELETED
Binary file
includes/edit_area/images/highlight.gif DELETED
Binary file
includes/edit_area/images/load.gif DELETED
Binary file
includes/edit_area/images/move.gif DELETED
Binary file
includes/edit_area/images/newdocument.gif DELETED
Binary file
includes/edit_area/images/opacity.png DELETED
Binary file
includes/edit_area/images/processing.gif DELETED
Binary file
includes/edit_area/images/redo.gif DELETED
Binary file
includes/edit_area/images/reset_highlight.gif DELETED
Binary file
includes/edit_area/images/save.gif DELETED
Binary file
includes/edit_area/images/search.gif DELETED
Binary file
includes/edit_area/images/smooth_selection.gif DELETED
Binary file
includes/edit_area/images/spacer.gif DELETED
Binary file
includes/edit_area/images/statusbar_resize.gif DELETED
Binary file
includes/edit_area/images/undo.gif DELETED
Binary file
includes/edit_area/images/word_wrap.gif DELETED
Binary file
includes/edit_area/keyboard.js DELETED
@@ -1,145 +0,0 @@
1
- var EA_keys = {8:"Retour arriere",9:"Tabulation",12:"Milieu (pave numerique)",13:"Entrer",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"Verr Maj",27:"Esc",32:"Space",33:"Page up",34:"Page down",35:"End",36:"Begin",37:"Left",38:"Up",39:"Right",40:"Down",44:"Impr ecran",45:"Inser",46:"Suppr",91:"Menu Demarrer Windows / touche pomme Mac",92:"Menu Demarrer Windows",93:"Menu contextuel Windows",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Verr Num",145:"Arret defil"};
2
-
3
-
4
-
5
- function keyDown(e){
6
- if(!e){ // if IE
7
- e=event;
8
- }
9
-
10
- // send the event to the plugins
11
- for(var i in editArea.plugins){
12
- if(typeof(editArea.plugins[i].onkeydown)=="function"){
13
- if(editArea.plugins[i].onkeydown(e)===false){ // stop propaging
14
- if(editArea.isIE)
15
- e.keyCode=0;
16
- return false;
17
- }
18
- }
19
- }
20
-
21
- var target_id=(e.target || e.srcElement).id;
22
- var use=false;
23
- if (EA_keys[e.keyCode])
24
- letter=EA_keys[e.keyCode];
25
- else
26
- letter=String.fromCharCode(e.keyCode);
27
-
28
- var low_letter= letter.toLowerCase();
29
-
30
- if(letter=="Page up" && !AltPressed(e) && !editArea.isOpera){
31
- editArea.execCommand("scroll_page", {"dir": "up", "shift": ShiftPressed(e)});
32
- use=true;
33
- }else if(letter=="Page down" && !AltPressed(e) && !editArea.isOpera){
34
- editArea.execCommand("scroll_page", {"dir": "down", "shift": ShiftPressed(e)});
35
- use=true;
36
- }else if(editArea.is_editable==false){
37
- // do nothing but also do nothing else (allow to navigate with page up and page down)
38
- return true;
39
- }else if(letter=="Tabulation" && target_id=="textarea" && !CtrlPressed(e) && !AltPressed(e)){
40
- if(ShiftPressed(e))
41
- editArea.execCommand("invert_tab_selection");
42
- else
43
- editArea.execCommand("tab_selection");
44
-
45
- use=true;
46
- if(editArea.isOpera || (editArea.isFirefox && editArea.isMac) ) // opera && firefox mac can't cancel tabulation events...
47
- setTimeout("editArea.execCommand('focus');", 1);
48
- }else if(letter=="Entrer" && target_id=="textarea"){
49
- if(editArea.press_enter())
50
- use=true;
51
- }else if(letter=="Entrer" && target_id=="area_search"){
52
- editArea.execCommand("area_search");
53
- use=true;
54
- }else if(letter=="Esc"){
55
- editArea.execCommand("close_all_inline_popup", e);
56
- use=true;
57
- }else if(CtrlPressed(e) && !AltPressed(e) && !ShiftPressed(e)){
58
- switch(low_letter){
59
- case "f":
60
- editArea.execCommand("area_search");
61
- use=true;
62
- break;
63
- case "r":
64
- editArea.execCommand("area_replace");
65
- use=true;
66
- break;
67
- case "q":
68
- editArea.execCommand("close_all_inline_popup", e);
69
- use=true;
70
- break;
71
- case "h":
72
- editArea.execCommand("change_highlight");
73
- use=true;
74
- break;
75
- case "g":
76
- setTimeout("editArea.execCommand('go_to_line');", 5); // the prompt stop the return false otherwise
77
- use=true;
78
- break;
79
- case "e":
80
- editArea.execCommand("show_help");
81
- use=true;
82
- break;
83
- case "z":
84
- use=true;
85
- editArea.execCommand("undo");
86
- break;
87
- case "y":
88
- use=true;
89
- editArea.execCommand("redo");
90
- break;
91
- default:
92
- break;
93
- }
94
- }
95
-
96
- // check to disable the redo possibility if the textarea content change
97
- if(editArea.next.length > 0){
98
- setTimeout("editArea.check_redo();", 10);
99
- }
100
-
101
- setTimeout("editArea.check_file_changes();", 10);
102
-
103
-
104
- if(use){
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.isIE)
107
- e.keyCode=0;
108
- return false;
109
- }
110
- //alert("Test: "+ letter + " ("+e.keyCode+") ALT: "+ AltPressed(e) + " CTRL "+ CtrlPressed(e) + " SHIFT "+ ShiftPressed(e));
111
-
112
- return true;
113
-
114
- };
115
-
116
-
117
- // return true if Alt key is pressed
118
- function AltPressed(e) {
119
- if (window.event) {
120
- return (window.event.altKey);
121
- } else {
122
- if(e.modifiers)
123
- return (e.altKey || (e.modifiers % 2));
124
- else
125
- return e.altKey;
126
- }
127
- };
128
-
129
- // return true if Ctrl key is pressed
130
- function CtrlPressed(e) {
131
- if (window.event) {
132
- return (window.event.ctrlKey);
133
- } else {
134
- return (e.ctrlKey || (e.modifiers==2) || (e.modifiers==3) || (e.modifiers>5));
135
- }
136
- };
137
-
138
- // return true if Shift key is pressed
139
- function ShiftPressed(e) {
140
- if (window.event) {
141
- return (window.event.shiftKey);
142
- } else {
143
- return (e.shiftKey || (e.modifiers>3));
144
- }
145
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/bg.js DELETED
@@ -1,54 +0,0 @@
1
- /*
2
- * Bulgarian translation
3
- * Author: Valentin Hristov
4
- * Company: SOFTKIT Bulgarian
5
- * Site: http://www.softkit-bg.com
6
- */
7
- editAreaLoader.lang["bg"]={
8
- new_document: "нов документ",
9
- search_button: "търсене и замяна",
10
- search_command: "търси следващия / отвори прозорец с търсачка",
11
- search: "търсене",
12
- replace: "замяна",
13
- replace_command: "замяна / отвори прозорец с търсачка",
14
- find_next: "намери следващия",
15
- replace_all: "замени всички",
16
- reg_exp: "реголярни изрази",
17
- match_case: "чуствителен към регистъра",
18
- not_found: "няма резултат.",
19
- occurrence_replaced: "замяната е осъществена.",
20
- search_field_empty: "Полето за търсене е празно",
21
- restart_search_at_begin: "До края на документа. Почни с началото.",
22
- move_popup: "премести прозореца с търсачката",
23
- font_size: "--Размер на шрифта--",
24
- go_to_line: "премени към реда",
25
- go_to_line_prompt: "премени към номера на реда:",
26
- undo: "отмени",
27
- redo: "върни",
28
- change_smooth_selection: "включи/изключи някой от функциите за преглед (по красиво, но повече натоварва)",
29
- highlight: "превключване на оцветяване на синтаксиса включена/изключена",
30
- reset_highlight: "въстанови оцветяване на синтаксиса (ако не е синхронизиран с текста)",
31
- word_wrap: "режим на пренасяне на дълги редове",
32
- help: "за програмата",
33
- save: "съхрани",
34
- load: "зареди",
35
- line_abbr: "Стр",
36
- char_abbr: "Стлб",
37
- position: "Позиция",
38
- total: "Всичко",
39
- close_popup: "затвори прозореца",
40
- shortcuts: "Бързи клавиши",
41
- add_tab: "добави табулация в текста",
42
- remove_tab: "премахни табулацията в текста",
43
- about_notice: "Внимание: използвайте функцията оцветяване на синтаксиса само за малки текстове",
44
- toggle: "Превключи редактор",
45
- accesskey: "Бърз клавиш",
46
- tab: "Tab",
47
- shift: "Shift",
48
- ctrl: "Ctrl",
49
- esc: "Esc",
50
- processing: "Зареждане...",
51
- fullscreen: "на цял екран",
52
- syntax_selection: "--Синтаксис--",
53
- close_tab: "Затвори файла"
54
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/cs.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["cs"]={
2
- new_document: "Nový dokument",
3
- search_button: "Najdi a nahraď",
4
- search_command: "Hledej další / otevři vyhledávací pole",
5
- search: "Hledej",
6
- replace: "Nahraď",
7
- replace_command: "Nahraď / otevři vyhledávací pole",
8
- find_next: "Najdi další",
9
- replace_all: "Nahraď vše",
10
- reg_exp: "platné výrazy",
11
- match_case: "vyhodnocené výrazy",
12
- not_found: "nenalezené.",
13
- occurrence_replaced: "výskyty nahrazené.",
14
- search_field_empty: "Pole vyhledávání je prázdné",
15
- restart_search_at_begin: "Dosažen konec souboru, začínám od začátku.",
16
- move_popup: "Přesuň vyhledávací okno",
17
- font_size: "--Velikost textu--",
18
- go_to_line: "Přejdi na řádek",
19
- go_to_line_prompt: "Přejdi na řádek:",
20
- undo: "krok zpět",
21
- redo: "znovu",
22
- change_smooth_selection: "Povolit nebo zakázat některé ze zobrazených funkcí (účelnější zobrazení požaduje větší zatížení procesoru)",
23
- highlight: "Zvýrazňování syntaxe zap./vyp.",
24
- reset_highlight: "Obnovit zvýraznění (v případě nesrovnalostí)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "O programu",
27
- save: "Uložit",
28
- load: "Otevřít",
29
- line_abbr: "Ř.",
30
- char_abbr: "S.",
31
- position: "Pozice",
32
- total: "Celkem",
33
- close_popup: "Zavřít okno",
34
- shortcuts: "Zkratky",
35
- add_tab: "Přidat tabulování textu",
36
- remove_tab: "Odtsranit tabulování textu",
37
- about_notice: "Upozornění! Funkce zvýrazňování textu je k dispozici pouze pro malý text",
38
- toggle: "Přepnout editor",
39
- accesskey: "Přístupová klávesa",
40
- tab: "Záložka",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Zpracovávám ...",
45
- fullscreen: "Celá obrazovka",
46
- syntax_selection: "--vyber zvýrazňovač--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/de.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["de"]={
2
- new_document: "Neues Dokument",
3
- search_button: "Suchen und Ersetzen",
4
- search_command: "Weitersuchen / &ouml;ffne Suchfeld",
5
- search: "Suchen",
6
- replace: "Ersetzen",
7
- replace_command: "Ersetzen / &ouml;ffne Suchfeld",
8
- find_next: "Weitersuchen",
9
- replace_all: "Ersetze alle Treffer",
10
- reg_exp: "regul&auml;re Ausdr&uuml;cke",
11
- match_case: "passt auf den Begriff<br />",
12
- not_found: "Nicht gefunden.",
13
- occurrence_replaced: "Die Vorkommen wurden ersetzt.",
14
- search_field_empty: "Leeres Suchfeld",
15
- restart_search_at_begin: "Ende des zu durchsuchenden Bereiches erreicht. Es wird die Suche von Anfang an fortgesetzt.", //find a shorter translation
16
- move_popup: "Suchfenster bewegen",
17
- font_size: "--Schriftgr&ouml;&szlig;e--",
18
- go_to_line: "Gehe zu Zeile",
19
- go_to_line_prompt: "Gehe zu Zeilennummmer:",
20
- undo: "R&uuml;ckg&auml;ngig",
21
- redo: "Wiederherstellen",
22
- change_smooth_selection: "Aktiviere/Deaktiviere einige Features (weniger Bildschirmnutzung aber mehr CPU-Belastung)",
23
- highlight: "Syntax Highlighting an- und ausschalten",
24
- reset_highlight: "Highlighting zur&uuml;cksetzen (falls mit Text nicht konform)",
25
- word_wrap: "Toggle word wrapping mode",
26
- help: "Info",
27
- save: "Speichern",
28
- load: "&Ouml;ffnen",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Position",
32
- total: "Gesamt",
33
- close_popup: "Popup schlie&szlig;en",
34
- shortcuts: "Shortcuts",
35
- add_tab: "Tab zum Text hinzuf&uuml;gen",
36
- remove_tab: "Tab aus Text entfernen",
37
- about_notice: "Bemerkung: Syntax Highlighting ist nur f&uuml;r kurze Texte",
38
- toggle: "Editor an- und ausschalten",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "In Bearbeitung...",
45
- fullscreen: "Full-Screen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/dk.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["dk"]={
2
- new_document: "nyt tomt dokument",
3
- search_button: "s&oslash;g og erstat",
4
- search_command: "find n&aelig;ste / &aring;ben s&oslash;gefelt",
5
- search: "s&oslash;g",
6
- replace: "erstat",
7
- replace_command: "erstat / &aring;ben s&oslash;gefelt",
8
- find_next: "find n&aelig;ste",
9
- replace_all: "erstat alle",
10
- reg_exp: "regular expressions",
11
- match_case: "forskel på store/sm&aring; bogstaver<br />",
12
- not_found: "not found.",
13
- occurrence_replaced: "occurences replaced.",
14
- search_field_empty: "Search field empty",
15
- restart_search_at_begin: "End of area reached. Restart at begin.",
16
- move_popup: "flyt søgepopup",
17
- font_size: "--Skriftstørrelse--",
18
- go_to_line: "g&aring; til linie",
19
- go_to_line_prompt: "gå til linienummer:",
20
- undo: "fortryd",
21
- redo: "gentag",
22
- change_smooth_selection: "sl&aring; display funktioner til/fra (smartere display men mere CPU kr&aelig;vende)",
23
- highlight: "sl&aring; syntax highlight til/fra",
24
- reset_highlight: "nulstil highlight (hvis den er desynkroniseret fra teksten)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "om",
27
- save: "gem",
28
- load: "hent",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Position",
32
- total: "Total",
33
- close_popup: "luk popup",
34
- shortcuts: "Genveje",
35
- add_tab: "tilf&oslash;j tabulation til tekst",
36
- remove_tab: "fjern tabulation fra tekst",
37
- about_notice: "Husk: syntax highlight funktionen b&oslash;r kun bruge til sm&aring; tekster",
38
- toggle: "Sl&aring; editor til / fra",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Skift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Processing...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/en.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["en"]={
2
- new_document: "new empty document",
3
- search_button: "search and replace",
4
- search_command: "search next / open search area",
5
- search: "search",
6
- replace: "replace",
7
- replace_command: "replace / open search area",
8
- find_next: "find next",
9
- replace_all: "replace all",
10
- reg_exp: "regular expressions",
11
- match_case: "match case",
12
- not_found: "not found.",
13
- occurrence_replaced: "occurences replaced.",
14
- search_field_empty: "Search field empty",
15
- restart_search_at_begin: "End of area reached. Restart at begin.",
16
- move_popup: "move search popup",
17
- font_size: "--Font size--",
18
- go_to_line: "go to line",
19
- go_to_line_prompt: "go to line number:",
20
- undo: "undo",
21
- redo: "redo",
22
- change_smooth_selection: "enable/disable some display features (smarter display but more CPU charge)",
23
- highlight: "toggle syntax highlight on/off",
24
- reset_highlight: "reset highlight (if desyncronized from text)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "about",
27
- save: "save",
28
- load: "load",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Position",
32
- total: "Total",
33
- close_popup: "close popup",
34
- shortcuts: "Shortcuts",
35
- add_tab: "add tabulation to text",
36
- remove_tab: "remove tabulation to text",
37
- about_notice: "Notice: syntax highlight function is only for small text",
38
- toggle: "Toggle editor",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Processing...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/eo.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["eo"]={
2
- new_document: "nova dokumento (vakigas la enhavon)",
3
- search_button: "ser&#265;i / anstata&#365;igi",
4
- search_command: "pluser&#265;i / malfermi la ser&#265;o-fenestron",
5
- search: "ser&#265;i",
6
- replace: "anstata&#365;igi",
7
- replace_command: "anstata&#365;igi / malfermi la ser&#265;o-fenestron",
8
- find_next: "ser&#265;i",
9
- replace_all: "anstata&#365;igi &#265;ion",
10
- reg_exp: "regula esprimo",
11
- match_case: "respekti la usklecon",
12
- not_found: "ne trovita.",
13
- occurrence_replaced: "anstata&#365;igoj plenumitaj.",
14
- search_field_empty: "La kampo estas malplena.",
15
- restart_search_at_begin: "Fino de teksto &#285;isrirata, &#265;u da&#365;rigi el la komenco?",
16
- move_popup: "movi la ser&#265;o-fenestron",
17
- font_size: "--Tipara grando--",
18
- go_to_line: "iri al la linio",
19
- go_to_line_prompt: "iri al la linio numero:",
20
- undo: "rezigni",
21
- redo: "refari",
22
- change_smooth_selection: "ebligi/malebligi la funkcioj de vidigo (pli bona vidigo, sed pli da &#349;ar&#285;o de la &#265;eforgano)",
23
- highlight: "ebligi/malebligi la sintaksan kolorigon",
24
- reset_highlight: "repravalorizi la sintaksan kolorigon (se malsinkronigon de la teksto)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "pri",
27
- save: "registri",
28
- load: "&#349;ar&#285;i",
29
- line_abbr: "Ln",
30
- char_abbr: "Sg",
31
- position: "Pozicio",
32
- total: "Sumo",
33
- close_popup: "fermi la &#349;prucfenestron",
34
- shortcuts: "Fulmoklavo",
35
- add_tab: "aldoni tabon en la tekston",
36
- remove_tab: "forigi tablon el la teksto",
37
- about_notice: "Noto: la sintaksa kolorigo estas nur prikalkulita por mallongaj tekstoj.",
38
- toggle: "baskuligi la redaktilon",
39
- accesskey: "Fulmoklavo",
40
- tab: "Tab",
41
- shift: "Maj",
42
- ctrl: "Ktrl",
43
- esc: "Esk",
44
- processing: "&#349;argante...",
45
- fullscreen: "plenekrane",
46
- syntax_selection: "--Sintakso--",
47
- close_tab: "Fermi la dosieron"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/es.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["es"]={
2
- new_document: "nuevo documento vacío",
3
- search_button: "buscar y reemplazar",
4
- search_command: "buscar siguiente / abrir área de búsqueda",
5
- search: "buscar",
6
- replace: "reemplazar",
7
- replace_command: "reemplazar / abrir área de búsqueda",
8
- find_next: "encontrar siguiente",
9
- replace_all: "reemplazar todos",
10
- reg_exp: "expresiones regulares",
11
- match_case: "coincidir capitalización",
12
- not_found: "no encontrado.",
13
- occurrence_replaced: "ocurrencias reemplazadas.",
14
- search_field_empty: "Campo de búsqueda vacío",
15
- restart_search_at_begin: "Se ha llegado al final del área. Se va a seguir desde el principio.",
16
- move_popup: "mover la ventana de búsqueda",
17
- font_size: "--Tamaño de la fuente--",
18
- go_to_line: "ir a la línea",
19
- go_to_line_prompt: "ir a la línea número:",
20
- undo: "deshacer",
21
- redo: "rehacer",
22
- change_smooth_selection: "activar/desactivar algunas características de visualización (visualización más inteligente pero más carga de CPU)",
23
- highlight: "intercambiar resaltado de sintaxis",
24
- reset_highlight: "reinicializar resaltado (si no esta sincronizado con el texto)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "acerca",
27
- save: "guardar",
28
- load: "cargar",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Posición",
32
- total: "Total",
33
- close_popup: "recuadro de cierre",
34
- shortcuts: "Atajos",
35
- add_tab: "añadir tabulado al texto",
36
- remove_tab: "borrar tabulado del texto",
37
- about_notice: "Aviso: el resaltado de sintaxis sólo funciona para texto pequeño",
38
- toggle: "Cambiar editor",
39
- accesskey: "Tecla de acceso",
40
- tab: "Tab",
41
- shift: "Mayúsc",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Procesando...",
45
- fullscreen: "pantalla completa",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/fi.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["fi"]={
2
- new_document: "uusi tyhjä dokumentti",
3
- search_button: "etsi ja korvaa",
4
- search_command: "etsi seuraava / avaa etsintävalikko",
5
- search: "etsi",
6
- replace: "korvaa",
7
- replace_command: "korvaa / avaa etsintävalikko",
8
- find_next: "etsi seuraava",
9
- replace_all: "korvaa kaikki",
10
- reg_exp: "säännölliset lausekkeet",
11
- match_case: "täsmää kirjainkokoon",
12
- not_found: "ei löytynyt.",
13
- occurrence_replaced: "esiintymää korvattu.",
14
- search_field_empty: "Haettava merkkijono on tyhjä",
15
- restart_search_at_begin: "Alueen loppu saavutettiin. Aloitetaan alusta.",
16
- move_popup: "siirrä etsintävalikkoa",
17
- font_size: "--Fontin koko--",
18
- go_to_line: "siirry riville",
19
- go_to_line_prompt: "mene riville:",
20
- undo: "peruuta",
21
- redo: "tee uudelleen",
22
- change_smooth_selection: "kytke/sammuta joitakin näyttötoimintoja (Älykkäämpi toiminta, mutta suurempi CPU kuormitus)",
23
- highlight: "kytke syntaksikorostus päälle/pois",
24
- reset_highlight: "resetoi syntaksikorostus (jos teksti ei ole synkassa korostuksen kanssa)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "tietoja",
27
- save: "tallenna",
28
- load: "lataa",
29
- line_abbr: "Rv",
30
- char_abbr: "Pos",
31
- position: "Paikka",
32
- total: "Yhteensä",
33
- close_popup: "sulje valikko",
34
- shortcuts: "Pikatoiminnot",
35
- add_tab: "lisää sisennys tekstiin",
36
- remove_tab: "poista sisennys tekstistä",
37
- about_notice: "Huomautus: syntaksinkorostus toimii vain pienelle tekstille",
38
- toggle: "Kytke editori",
39
- accesskey: "Pikanäppäin",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Odota...",
45
- fullscreen: "koko ruutu",
46
- syntax_selection: "--Syntaksi--",
47
- close_tab: "Sulje tiedosto"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/fr.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["fr"]={
2
- new_document: "nouveau document (efface le contenu)",
3
- search_button: "rechercher / remplacer",
4
- search_command: "rechercher suivant / ouvrir la fen&ecirc;tre de recherche",
5
- search: "rechercher",
6
- replace: "remplacer",
7
- replace_command: "remplacer / ouvrir la fen&ecirc;tre de recherche",
8
- find_next: "rechercher",
9
- replace_all: "tout remplacer",
10
- reg_exp: "expr. r&eacute;guli&egrave;re",
11
- match_case: "respecter la casse",
12
- not_found: "pas trouv&eacute;.",
13
- occurrence_replaced: "remplacements &eacute;ffectu&eacute;s.",
14
- search_field_empty: "Le champ de recherche est vide.",
15
- restart_search_at_begin: "Fin du texte atteint, poursuite au d&eacute;but.",
16
- move_popup: "d&eacute;placer la fen&ecirc;tre de recherche",
17
- font_size: "--Taille police--",
18
- go_to_line: "aller &agrave; la ligne",
19
- go_to_line_prompt: "aller a la ligne numero:",
20
- undo: "annuler",
21
- redo: "refaire",
22
- change_smooth_selection: "activer/d&eacute;sactiver des fonctions d'affichage (meilleur affichage mais plus de charge processeur)",
23
- highlight: "activer/d&eacute;sactiver la coloration syntaxique",
24
- reset_highlight: "r&eacute;initialiser la coloration syntaxique (si d&eacute;syncronis&eacute;e du texte)",
25
- word_wrap: "activer/d&eacute;sactiver les retours &agrave; la ligne automatiques",
26
- help: "&agrave; propos",
27
- save: "sauvegarder",
28
- load: "charger",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Position",
32
- total: "Total",
33
- close_popup: "fermer le popup",
34
- shortcuts: "Racourcis clavier",
35
- add_tab: "ajouter une tabulation dans le texte",
36
- remove_tab: "retirer une tabulation dans le texte",
37
- about_notice: "Note: la coloration syntaxique n'est pr&eacute;vue que pour de courts textes.",
38
- toggle: "basculer l'&eacute;diteur",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Maj",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "chargement...",
45
- fullscreen: "plein &eacute;cran",
46
- syntax_selection: "--Syntaxe--",
47
- close_tab: "Fermer le fichier"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/hr.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["hr"]={
2
- new_document: "Novi dokument",
3
- search_button: "Traži i izmijeni",
4
- search_command: "Traži dalje / Otvori prozor za traženje",
5
- search: "Traži",
6
- replace: "Izmijeni",
7
- replace_command: "Izmijeni / Otvori prozor za traženje",
8
- find_next: "Traži dalje",
9
- replace_all: "Izmjeni sve",
10
- reg_exp: "Regularni izrazi",
11
- match_case: "Bitna vel. slova",
12
- not_found: "nije naðeno.",
13
- occurrence_replaced: "izmjenjenih.",
14
- search_field_empty: "Prazno polje za traženje!",
15
- restart_search_at_begin: "Došao do kraja. Poèeo od poèetka.",
16
- move_popup: "Pomakni prozor",
17
- font_size: "--Velièina teksta--",
18
- go_to_line: "Odi na redak",
19
- go_to_line_prompt: "Odi na redak:",
20
- undo: "Vrati natrag",
21
- redo: "Napravi ponovo",
22
- change_smooth_selection: "Ukljuèi/iskljuèi neke moguænosti prikaza (pametniji prikaz, ali zagušeniji CPU)",
23
- highlight: "Ukljuèi/iskljuèi bojanje sintakse",
24
- reset_highlight: "Ponovi kolorizaciju (ako je nesinkronizirana s tekstom)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "O edit_area",
27
- save: "Spremi",
28
- load: "Uèitaj",
29
- line_abbr: "Ln",
30
- char_abbr: "Zn",
31
- position: "Pozicija",
32
- total: "Ukupno",
33
- close_popup: "Zatvori prozor",
34
- shortcuts: "Kratice",
35
- add_tab: "Dodaj tabulaciju",
36
- remove_tab: "Makni tabulaciju",
37
- about_notice: "Napomena: koloriziranje sintakse je samo za kratke kodove",
38
- toggle: "Prebaci naèin ureðivanja",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Procesiram...",
45
- fullscreen: "Cijeli prozor",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/it.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["it"]={
2
- new_document: "nuovo documento vuoto",
3
- search_button: "cerca e sostituisci",
4
- search_command: "trova successivo / apri finestra di ricerca",
5
- search: "cerca",
6
- replace: "sostituisci",
7
- replace_command: "sostituisci / apri finestra di ricerca",
8
- find_next: "trova successivo",
9
- replace_all: "sostituisci tutti",
10
- reg_exp: "espressioni regolari",
11
- match_case: "confronta maiuscole/minuscole<br />",
12
- not_found: "non trovato.",
13
- occurrence_replaced: "occorrenze sostituite.",
14
- search_field_empty: "Campo ricerca vuoto",
15
- restart_search_at_begin: "Fine del testo raggiunta. Ricomincio dall'inizio.",
16
- move_popup: "sposta popup di ricerca",
17
- font_size: "-- Dimensione --",
18
- go_to_line: "vai alla linea",
19
- go_to_line_prompt: "vai alla linea numero:",
20
- undo: "annulla",
21
- redo: "ripeti",
22
- change_smooth_selection: "abilita/disabilita alcune caratteristiche della visualizzazione",
23
- highlight: "abilita/disabilita colorazione della sintassi",
24
- reset_highlight: "aggiorna colorazione (se non sincronizzata)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "informazioni su...",
27
- save: "salva",
28
- load: "carica",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Posizione",
32
- total: "Totale",
33
- close_popup: "chiudi popup",
34
- shortcuts: "Scorciatoie",
35
- add_tab: "aggiungi tabulazione",
36
- remove_tab: "rimuovi tabulazione",
37
- about_notice: "Avviso: la colorazione della sintassi vale solo con testo piccolo",
38
- toggle: "Abilita/disabilita editor",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "In corso...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/ja.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["ja"]={
2
- new_document: "新規作成",
3
- search_button: "検索・置換",
4
- search_command: "次を検索 / 検索窓を表示",
5
- search: "検索",
6
- replace: "置換",
7
- replace_command: "置換 / 置換窓を表示",
8
- find_next: "次を検索",
9
- replace_all: "全置換",
10
- reg_exp: "正規表現",
11
- match_case: "大文字小文字の区別",
12
- not_found: "見つかりません。",
13
- occurrence_replaced: "置換しました。",
14
- search_field_empty: "検索対象文字列が空です。",
15
- restart_search_at_begin: "終端に達しました、始めに戻ります",
16
- move_popup: "検索窓を移動",
17
- font_size: "--フォントサイズ--",
18
- go_to_line: "指定行へ移動",
19
- go_to_line_prompt: "指定行へ移動します:",
20
- undo: "元に戻す",
21
- redo: "やり直し",
22
- change_smooth_selection: "スムース表示の切り替え(CPUを使います)",
23
- highlight: "構文強調表示の切り替え",
24
- reset_highlight: "構文強調表示のリセット",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "ヘルプを表示",
27
- save: "保存",
28
- load: "読み込み",
29
- line_abbr: "行",
30
- char_abbr: "文字",
31
- position: "位置",
32
- total: "合計",
33
- close_popup: "ポップアップを閉じる",
34
- shortcuts: "ショートカット",
35
- add_tab: "タブを挿入する",
36
- remove_tab: "タブを削除する",
37
- about_notice: "注意:構文強調表示は短いテキストでしか有効に機能しません。",
38
- toggle: "テキストエリアとeditAreaの切り替え",
39
- accesskey: "アクセスキー",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "処理中です...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/mk.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["mk"]={
2
- new_document: "Нов документ",
3
- search_button: "Најди и замени",
4
- search_command: "Барај следно / Отвори нов прозорец за пребарување",
5
- search: "Барај",
6
- replace: "Замени",
7
- replace_command: "Замени / Отвори прозорец за пребарување",
8
- find_next: "најди следно",
9
- replace_all: "Замени ги сите",
10
- reg_exp: "Регуларни изрази",
11
- match_case: "Битна е големината на буквите",
12
- not_found: "не е пронајдено.",
13
- occurrence_replaced: "замени.",
14
- search_field_empty: "Полето за пребарување е празно",
15
- restart_search_at_begin: "Крај на областа. Стартувај од почеток.",
16
- move_popup: "Помести го прозорецот",
17
- font_size: "--Големина на текстот--",
18
- go_to_line: "Оди на линија",
19
- go_to_line_prompt: "Оди на линија со број:",
20
- undo: "Врати",
21
- redo: "Повтори",
22
- change_smooth_selection: "Вклучи/исклучи некои карактеристики за приказ (попаметен приказ, но поголемо оптеретување за процесорот)",
23
- highlight: "Вклучи/исклучи осветлување на синтакса",
24
- reset_highlight: "Ресетирај го осветлувањето на синтакса (доколку е десинхронизиранo со текстот)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "За",
27
- save: "Зачувај",
28
- load: "Вчитај",
29
- line_abbr: "Лн",
30
- char_abbr: "Зн",
31
- position: "Позиција",
32
- total: "Вкупно",
33
- close_popup: "Затвори го прозорецот",
34
- shortcuts: "Кратенки",
35
- add_tab: "Додај табулација на текстот",
36
- remove_tab: "Отстрани ја табулацијата",
37
- about_notice: "Напомена: Осветлувањето на синтанса е само за краток текст",
38
- toggle: "Смени начин на уредување",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Обработувам...",
45
- fullscreen: "Цел прозорец",
46
- syntax_selection: "--Синтакса--",
47
- close_tab: "Избери датотека"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/nl.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["nl"]={
2
- new_document: "nieuw leeg document",
3
- search_button: "zoek en vervang",
4
- search_command: "zoek volgende / zoekscherm openen",
5
- search: "zoek",
6
- replace: "vervang",
7
- replace_command: "vervang / zoekscherm openen",
8
- find_next: "volgende vinden",
9
- replace_all: "alles vervangen",
10
- reg_exp: "reguliere expressies",
11
- match_case: "hoofdletter gevoelig",
12
- not_found: "niet gevonden.",
13
- occurrence_replaced: "object vervangen.",
14
- search_field_empty: "Zoek veld leeg",
15
- restart_search_at_begin: "Niet meer instanties gevonden, begin opnieuw",
16
- move_popup: "versleep zoek scherm",
17
- font_size: "--Letter grootte--",
18
- go_to_line: "Ga naar regel",
19
- go_to_line_prompt: "Ga naar regel nummer:",
20
- undo: "Ongedaan maken",
21
- redo: "Opnieuw doen",
22
- change_smooth_selection: "zet wat schermopties aan/uit (kan langzamer zijn)",
23
- highlight: "zet syntax highlight aan/uit",
24
- reset_highlight: "reset highlight (indien gedesynchronizeerd)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "informatie",
27
- save: "opslaan",
28
- load: "laden",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Positie",
32
- total: "Totaal",
33
- close_popup: "Popup sluiten",
34
- shortcuts: "Snelkoppelingen",
35
- add_tab: "voeg tabs toe in tekst",
36
- remove_tab: "verwijder tabs uit tekst",
37
- about_notice: "Notitie: syntax highlight functie is alleen voor kleine tekst",
38
- toggle: "geavanceerde bewerkingsopties",
39
- accesskey: "Accessknop",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Verwerken...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/pl.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["pl"]={
2
- new_document: "nowy dokument",
3
- search_button: "znajdź i zamień",
4
- search_command: "znajdź następny",
5
- search: "znajdź",
6
- replace: "zamień",
7
- replace_command: "zamień",
8
- find_next: "następny",
9
- replace_all: "zamień wszystko",
10
- reg_exp: "wyrażenie regularne",
11
- match_case: "uwzględnij wielkość liter<br />",
12
- not_found: "nie znaleziono.",
13
- occurrence_replaced: "wystąpień zamieniono.",
14
- search_field_empty: "Nie wprowadzono tekstu",
15
- restart_search_at_begin: "Koniec dokumentu. Wyszukiwanie od początku.",
16
- move_popup: "przesuń okienko wyszukiwania",
17
- font_size: "Rozmiar",
18
- go_to_line: "idź do linii",
19
- go_to_line_prompt: "numer linii:",
20
- undo: "cofnij",
21
- redo: "przywróć",
22
- change_smooth_selection: "włącz/wyłącz niektóre opcje wyglądu (zaawansowane opcje wyglądu obciążają procesor)",
23
- highlight: "włącz/wyłącz podświetlanie składni",
24
- reset_highlight: "odśwież podświetlanie składni (jeśli rozsynchronizowało się z tekstem)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "o programie",
27
- save: "zapisz",
28
- load: "otwórz",
29
- line_abbr: "Ln",
30
- char_abbr: "Zn",
31
- position: "Pozycja",
32
- total: "W sumie",
33
- close_popup: "zamknij okienko",
34
- shortcuts: "Skróty klawiaturowe",
35
- add_tab: "dodaj wcięcie do zaznaczonego tekstu",
36
- remove_tab: "usuń wcięcie",
37
- about_notice: "Uwaga: podświetlanie składni nie jest zalecane dla długich tekstów",
38
- toggle: "Włącz/wyłącz edytor",
39
- accesskey: "Alt+",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Przetwarzanie...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/pt.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["pt"]={
2
- new_document: "Novo documento",
3
- search_button: "Localizar e substituir",
4
- search_command: "Localizar próximo",
5
- search: "Localizar",
6
- replace: "Substituir",
7
- replace_command: "Substituir",
8
- find_next: "Localizar",
9
- replace_all: "Subst. tudo",
10
- reg_exp: "Expressões regulares",
11
- match_case: "Diferenciar maiúsculas e minúsculas",
12
- not_found: "Não encontrado.",
13
- occurrence_replaced: "Ocorrências substituidas",
14
- search_field_empty: "Campo localizar vazio.",
15
- restart_search_at_begin: "Fim das ocorrências. Recomeçar do inicio.",
16
- move_popup: "Mover janela",
17
- font_size: "--Tamanho da fonte--",
18
- go_to_line: "Ir para linha",
19
- go_to_line_prompt: "Ir para a linha:",
20
- undo: "Desfazer",
21
- redo: "Refazer",
22
- change_smooth_selection: "Opções visuais",
23
- highlight: "Cores de sintaxe",
24
- reset_highlight: "Resetar cores (se não sincronizado)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "Sobre",
27
- save: "Salvar",
28
- load: "Carregar",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Posição",
32
- total: "Total",
33
- close_popup: "Fechar",
34
- shortcuts: "Shortcuts",
35
- add_tab: "Adicionar tabulação",
36
- remove_tab: "Remover tabulação",
37
- about_notice: "Atenção: Cores de sintaxe são indicados somente para textos pequenos",
38
- toggle: "Exibir editor",
39
- accesskey: "Accesskey",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Processando...",
45
- fullscreen: "fullscreen",
46
- syntax_selection: "--Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/ru.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["ru"]={
2
- new_document: "новый пустой документ",
3
- search_button: "поиск и замена",
4
- search_command: "искать следующий / открыть панель поиска",
5
- search: "поиск",
6
- replace: "замена",
7
- replace_command: "заменить / открыть панель поиска",
8
- find_next: "найти следующее",
9
- replace_all: "заменить все",
10
- reg_exp: "регулярное выражение",
11
- match_case: "учитывать регистр",
12
- not_found: "не найдено.",
13
- occurrence_replaced: "вхождение заменено.",
14
- search_field_empty: "Поле поиска пустое",
15
- restart_search_at_begin: "Достигнут конец документа. Начинаю с начала.",
16
- move_popup: "переместить окно поиска",
17
- font_size: "--Размер шрифта--",
18
- go_to_line: "перейти к строке",
19
- go_to_line_prompt: "перейти к строке номер:",
20
- undo: "отменить",
21
- redo: "вернуть",
22
- change_smooth_selection: "включить/отключить некоторые функции просмотра (более красиво, но больше использует процессор)",
23
- highlight: "переключить подсветку синтаксиса включена/выключена",
24
- reset_highlight: "восстановить подсветку (если разсинхронизирована от текста)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "о программе",
27
- save: "сохранить",
28
- load: "загрузить",
29
- line_abbr: "Стр",
30
- char_abbr: "Стлб",
31
- position: "Позиция",
32
- total: "Всего",
33
- close_popup: "закрыть всплывающее окно",
34
- shortcuts: "Горячие клавиши",
35
- add_tab: "добавить табуляцию в текст",
36
- remove_tab: "убрать табуляцию из текста",
37
- about_notice: "Внимание: функция подсветки синтаксиса только для небольших текстов",
38
- toggle: "Переключить редактор",
39
- accesskey: "Горячая клавиша",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Обработка...",
45
- fullscreen: "полный экран",
46
- syntax_selection: "--Синтакс--",
47
- close_tab: "Закрыть файл"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/sk.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["sk"]={
2
- new_document: "nový prázdy dokument",
3
- search_button: "vyhľadaj a nahraď",
4
- search_command: "hľadaj ďalsšie / otvor vyhľadávacie pole",
5
- search: "hľadaj",
6
- replace: "nahraď",
7
- replace_command: "nahraď / otvor vyhľadávacie pole",
8
- find_next: "nájdi ďalšie",
9
- replace_all: "nahraď všetko",
10
- reg_exp: "platné výrazy",
11
- match_case: "zhodujúce sa výrazy",
12
- not_found: "nenájdené.",
13
- occurrence_replaced: "výskyty nahradené.",
14
- search_field_empty: "Pole vyhľadávanie je prádzne",
15
- restart_search_at_begin: "End of area reached. Restart at begin.",
16
- move_popup: "presuň vyhľadávacie okno",
17
- font_size: "--Veľkosť textu--",
18
- go_to_line: "prejdi na riadok",
19
- go_to_line_prompt: "prejdi na riadok:",
20
- undo: "krok späť",
21
- redo: "prepracovať",
22
- change_smooth_selection: "povoliť/zamietnúť niektoré zo zobrazených funkcií (účelnejšie zobrazenie vyžaduje väčšie zaťaženie procesora CPU)",
23
- highlight: "prepnúť zvýrazňovanie syntaxe zap/vyp",
24
- reset_highlight: "zrušiť zvýrazňovanie (ak je nesynchronizované s textom)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "o programe",
27
- save: "uložiť",
28
- load: "načítať",
29
- line_abbr: "Ln",
30
- char_abbr: "Ch",
31
- position: "Pozícia",
32
- total: "Spolu",
33
- close_popup: "zavrieť okno",
34
- shortcuts: "Skratky",
35
- add_tab: "pridať tabulovanie textu",
36
- remove_tab: "odstrániť tabulovanie textu",
37
- about_notice: "Upozornenie: funkcia zvýrazňovania syntaxe je dostupná iba pre malý text",
38
- toggle: "Prepnúť editor",
39
- accesskey: "Accesskey",
40
- tab: "Záložka",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "Spracúvam...",
45
- fullscreen: "cel=a obrazovka",
46
- syntax_selection: "--Vyber Syntax--",
47
- close_tab: "Close file"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/langs/zh.js DELETED
@@ -1,48 +0,0 @@
1
- editAreaLoader.lang["zh"]={
2
- new_document: "新建空白文档",
3
- search_button: "查找与替换",
4
- search_command: "查找下一个 / 打开查找框",
5
- search: "查找",
6
- replace: "替换",
7
- replace_command: "替换 / 打开查找框",
8
- find_next: "查找下一个",
9
- replace_all: "全部替换",
10
- reg_exp: "正则表达式",
11
- match_case: "匹配大小写",
12
- not_found: "未找到.",
13
- occurrence_replaced: "处被替换.",
14
- search_field_empty: "查找框没有内容",
15
- restart_search_at_begin: "已到到文档末尾. 从头重新查找.",
16
- move_popup: "移动查找对话框",
17
- font_size: "--字体大小--",
18
- go_to_line: "转到行",
19
- go_to_line_prompt: "转到行:",
20
- undo: "恢复",
21
- redo: "重做",
22
- change_smooth_selection: "启用/禁止一些显示特性(更好看但更耗费资源)",
23
- highlight: "启用/禁止语法高亮",
24
- reset_highlight: "重置语法高亮(当文本显示不同步时)",
25
- word_wrap: "toggle word wrapping mode",
26
- help: "关于",
27
- save: "保存",
28
- load: "加载",
29
- line_abbr: "行",
30
- char_abbr: "字符",
31
- position: "位置",
32
- total: "总计",
33
- close_popup: "关闭对话框",
34
- shortcuts: "快捷键",
35
- add_tab: "添加制表符(Tab)",
36
- remove_tab: "移除制表符(Tab)",
37
- about_notice: "注意:语法高亮功能仅用于较少内容的文本(文件内容太大会导致浏览器反应慢)",
38
- toggle: "切换编辑器",
39
- accesskey: "快捷键",
40
- tab: "Tab",
41
- shift: "Shift",
42
- ctrl: "Ctrl",
43
- esc: "Esc",
44
- processing: "正在处理中...",
45
- fullscreen: "全屏编辑",
46
- syntax_selection: "--语法--",
47
- close_tab: "关闭文件"
48
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/license_apache.txt DELETED
@@ -1,7 +0,0 @@
1
- Copyright 2008 Christophe Dolivet
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
4
-
5
- http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 
 
 
 
 
includes/edit_area/license_bsd.txt DELETED
@@ -1,10 +0,0 @@
1
- Copyright (c) 2008, Christophe Dolivet
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
- * Neither the name of EditArea nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9
-
10
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 
 
 
 
 
 
 
 
includes/edit_area/license_lgpl.txt DELETED
@@ -1,458 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 2.1, February 1999
3
-
4
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- [This is the first released version of the Lesser GPL. It also counts
10
- as the successor of the GNU Library Public License, version 2, hence
11
- the version number 2.1.]
12
-
13
- Preamble
14
-
15
- The licenses for most software are designed to take away your
16
- freedom to share and change it. By contrast, the GNU General Public
17
- Licenses are intended to guarantee your freedom to share and change
18
- free software--to make sure the software is free for all its users.
19
-
20
- This license, the Lesser General Public License, applies to some
21
- specially designated software packages--typically libraries--of the
22
- Free Software Foundation and other authors who decide to use it. You
23
- can use it too, but we suggest you first think carefully about whether
24
- this license or the ordinary General Public License is the better
25
- strategy to use in any particular case, based on the explanations below.
26
-
27
- When we speak of free software, we are referring to freedom of use,
28
- not price. Our General Public Licenses are designed to make sure that
29
- you have the freedom to distribute copies of free software (and charge
30
- for this service if you wish); that you receive source code or can get
31
- it if you want it; that you can change the software and use pieces of
32
- it in new free programs; and that you are informed that you can do
33
- these things.
34
-
35
- To protect your rights, we need to make restrictions that forbid
36
- distributors to deny you these rights or to ask you to surrender these
37
- rights. These restrictions translate to certain responsibilities for
38
- you if you distribute copies of the library or if you modify it.
39
-
40
- For example, if you distribute copies of the library, whether gratis
41
- or for a fee, you must give the recipients all the rights that we gave
42
- you. You must make sure that they, too, receive or can get the source
43
- code. If you link other code with the library, you must provide
44
- complete object files to the recipients, so that they can relink them
45
- with the library after making changes to the library and recompiling
46
- it. And you must show them these terms so they know their rights.
47
-
48
- We protect your rights with a two-step method: (1) we copyright the
49
- library, and (2) we offer you this license, which gives you legal
50
- permission to copy, distribute and/or modify the library.
51
-
52
- To protect each distributor, we want to make it very clear that
53
- there is no warranty for the free library. Also, if the library is
54
- modified by someone else and passed on, the recipients should know
55
- that what they have is not the original version, so that the original
56
- author's reputation will not be affected by problems that might be
57
- introduced by others.
58
-
59
- Finally, software patents pose a constant threat to the existence of
60
- any free program. We wish to make sure that a company cannot
61
- effectively restrict the users of a free program by obtaining a
62
- restrictive license from a patent holder. Therefore, we insist that
63
- any patent license obtained for a version of the library must be
64
- consistent with the full freedom of use specified in this license.
65
-
66
- Most GNU software, including some libraries, is covered by the
67
- ordinary GNU General Public License. This license, the GNU Lesser
68
- General Public License, applies to certain designated libraries, and
69
- is quite different from the ordinary General Public License. We use
70
- this license for certain libraries in order to permit linking those
71
- libraries into non-free programs.
72
-
73
- When a program is linked with a library, whether statically or using
74
- a shared library, the combination of the two is legally speaking a
75
- combined work, a derivative of the original library. The ordinary
76
- General Public License therefore permits such linking only if the
77
- entire combination fits its criteria of freedom. The Lesser General
78
- Public License permits more lax criteria for linking other code with
79
- the library.
80
-
81
- We call this license the "Lesser" General Public License because it
82
- does Less to protect the user's freedom than the ordinary General
83
- Public License. It also provides other free software developers Less
84
- of an advantage over competing non-free programs. These disadvantages
85
- are the reason we use the ordinary General Public License for many
86
- libraries. However, the Lesser license provides advantages in certain
87
- special circumstances.
88
-
89
- For example, on rare occasions, there may be a special need to
90
- encourage the widest possible use of a certain library, so that it becomes
91
- a de-facto standard. To achieve this, non-free programs must be
92
- allowed to use the library. A more frequent case is that a free
93
- library does the same job as widely used non-free libraries. In this
94
- case, there is little to gain by limiting the free library to free
95
- software only, so we use the Lesser General Public License.
96
-
97
- In other cases, permission to use a particular library in non-free
98
- programs enables a greater number of people to use a large body of
99
- free software. For example, permission to use the GNU C Library in
100
- non-free programs enables many more people to use the whole GNU
101
- operating system, as well as its variant, the GNU/Linux operating
102
- system.
103
-
104
- Although the Lesser General Public License is Less protective of the
105
- users' freedom, it does ensure that the user of a program that is
106
- linked with the Library has the freedom and the wherewithal to run
107
- that program using a modified version of the Library.
108
-
109
- The precise terms and conditions for copying, distribution and
110
- modification follow. Pay close attention to the difference between a
111
- "work based on the library" and a "work that uses the library". The
112
- former contains code derived from the library, whereas the latter must
113
- be combined with the library in order to run.
114
-
115
- GNU LESSER GENERAL PUBLIC LICENSE
116
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
-
118
- 0. This License Agreement applies to any software library or other
119
- program which contains a notice placed by the copyright holder or
120
- other authorized party saying it may be distributed under the terms of
121
- this Lesser General Public License (also called "this License").
122
- Each licensee is addressed as "you".
123
-
124
- A "library" means a collection of software functions and/or data
125
- prepared so as to be conveniently linked with application programs
126
- (which use some of those functions and data) to form executables.
127
-
128
- The "Library", below, refers to any such software library or work
129
- which has been distributed under these terms. A "work based on the
130
- Library" means either the Library or any derivative work under
131
- copyright law: that is to say, a work containing the Library or a
132
- portion of it, either verbatim or with modifications and/or translated
133
- straightforwardly into another language. (Hereinafter, translation is
134
- included without limitation in the term "modification".)
135
-
136
- "Source code" for a work means the preferred form of the work for
137
- making modifications to it. For a library, complete source code means
138
- all the source code for all modules it contains, plus any associated
139
- interface definition files, plus the scripts used to control compilation
140
- and installation of the library.
141
-
142
- Activities other than copying, distribution and modification are not
143
- covered by this License; they are outside its scope. The act of
144
- running a program using the Library is not restricted, and output from
145
- such a program is covered only if its contents constitute a work based
146
- on the Library (independent of the use of the Library in a tool for
147
- writing it). Whether that is true depends on what the Library does
148
- and what the program that uses the Library does.
149
-
150
- 1. You may copy and distribute verbatim copies of the Library's
151
- complete source code as you receive it, in any medium, provided that
152
- you conspicuously and appropriately publish on each copy an
153
- appropriate copyright notice and disclaimer of warranty; keep intact
154
- all the notices that refer to this License and to the absence of any
155
- warranty; and distribute a copy of this License along with the
156
- Library.
157
-
158
- You may charge a fee for the physical act of transferring a copy,
159
- and you may at your option offer warranty protection in exchange for a
160
- fee.
161
-
162
- 2. You may modify your copy or copies of the Library or any portion
163
- of it, thus forming a work based on the Library, and copy and
164
- distribute such modifications or work under the terms of Section 1
165
- above, provided that you also meet all of these conditions:
166
-
167
- a) The modified work must itself be a software library.
168
-
169
- b) You must cause the files modified to carry prominent notices
170
- stating that you changed the files and the date of any change.
171
-
172
- c) You must cause the whole of the work to be licensed at no
173
- charge to all third parties under the terms of this License.
174
-
175
- d) If a facility in the modified Library refers to a function or a
176
- table of data to be supplied by an application program that uses
177
- the facility, other than as an argument passed when the facility
178
- is invoked, then you must make a good faith effort to ensure that,
179
- in the event an application does not supply such function or
180
- table, the facility still operates, and performs whatever part of
181
- its purpose remains meaningful.
182
-
183
- (For example, a function in a library to compute square roots has
184
- a purpose that is entirely well-defined independent of the
185
- application. Therefore, Subsection 2d requires that any
186
- application-supplied function or table used by this function must
187
- be optional: if the application does not supply it, the square
188
- root function must still compute square roots.)
189
-
190
- These requirements apply to the modified work as a whole. If
191
- identifiable sections of that work are not derived from the Library,
192
- and can be reasonably considered independent and separate works in
193
- themselves, then this License, and its terms, do not apply to those
194
- sections when you distribute them as separate works. But when you
195
- distribute the same sections as part of a whole which is a work based
196
- on the Library, the distribution of the whole must be on the terms of
197
- this License, whose permissions for other licensees extend to the
198
- entire whole, and thus to each and every part regardless of who wrote
199
- it.
200
-
201
- Thus, it is not the intent of this section to claim rights or contest
202
- your rights to work written entirely by you; rather, the intent is to
203
- exercise the right to control the distribution of derivative or
204
- collective works based on the Library.
205
-
206
- In addition, mere aggregation of another work not based on the Library
207
- with the Library (or with a work based on the Library) on a volume of
208
- a storage or distribution medium does not bring the other work under
209
- the scope of this License.
210
-
211
- 3. You may opt to apply the terms of the ordinary GNU General Public
212
- License instead of this License to a given copy of the Library. To do
213
- this, you must alter all the notices that refer to this License, so
214
- that they refer to the ordinary GNU General Public License, version 2,
215
- instead of to this License. (If a newer version than version 2 of the
216
- ordinary GNU General Public License has appeared, then you can specify
217
- that version instead if you wish.) Do not make any other change in
218
- these notices.
219
-
220
- Once this change is made in a given copy, it is irreversible for
221
- that copy, so the ordinary GNU General Public License applies to all
222
- subsequent copies and derivative works made from that copy.
223
-
224
- This option is useful when you wish to copy part of the code of
225
- the Library into a program that is not a library.
226
-
227
- 4. You may copy and distribute the Library (or a portion or
228
- derivative of it, under Section 2) in object code or executable form
229
- under the terms of Sections 1 and 2 above provided that you accompany
230
- it with the complete corresponding machine-readable source code, which
231
- must be distributed under the terms of Sections 1 and 2 above on a
232
- medium customarily used for software interchange.
233
-
234
- If distribution of object code is made by offering access to copy
235
- from a designated place, then offering equivalent access to copy the
236
- source code from the same place satisfies the requirement to
237
- distribute the source code, even though third parties are not
238
- compelled to copy the source along with the object code.
239
-
240
- 5. A program that contains no derivative of any portion of the
241
- Library, but is designed to work with the Library by being compiled or
242
- linked with it, is called a "work that uses the Library". Such a
243
- work, in isolation, is not a derivative work of the Library, and
244
- therefore falls outside the scope of this License.
245
-
246
- However, linking a "work that uses the Library" with the Library
247
- creates an executable that is a derivative of the Library (because it
248
- contains portions of the Library), rather than a "work that uses the
249
- library". The executable is therefore covered by this License.
250
- Section 6 states terms for distribution of such executables.
251
-
252
- When a "work that uses the Library" uses material from a header file
253
- that is part of the Library, the object code for the work may be a
254
- derivative work of the Library even though the source code is not.
255
- Whether this is true is especially significant if the work can be
256
- linked without the Library, or if the work is itself a library. The
257
- threshold for this to be true is not precisely defined by law.
258
-
259
- If such an object file uses only numerical parameters, data
260
- structure layouts and accessors, and small macros and small inline
261
- functions (ten lines or less in length), then the use of the object
262
- file is unrestricted, regardless of whether it is legally a derivative
263
- work. (Executables containing this object code plus portions of the
264
- Library will still fall under Section 6.)
265
-
266
- Otherwise, if the work is a derivative of the Library, you may
267
- distribute the object code for the work under the terms of Section 6.
268
- Any executables containing that work also fall under Section 6,
269
- whether or not they are linked directly with the Library itself.
270
-
271
- 6. As an exception to the Sections above, you may also combine or
272
- link a "work that uses the Library" with the Library to produce a
273
- work containing portions of the Library, and distribute that work
274
- under terms of your choice, provided that the terms permit
275
- modification of the work for the customer's own use and reverse
276
- engineering for debugging such modifications.
277
-
278
- You must give prominent notice with each copy of the work that the
279
- Library is used in it and that the Library and its use are covered by
280
- this License. You must supply a copy of this License. If the work
281
- during execution displays copyright notices, you must include the
282
- copyright notice for the Library among them, as well as a reference
283
- directing the user to the copy of this License. Also, you must do one
284
- of these things:
285
-
286
- a) Accompany the work with the complete corresponding
287
- machine-readable source code for the Library including whatever
288
- changes were used in the work (which must be distributed under
289
- Sections 1 and 2 above); and, if the work is an executable linked
290
- with the Library, with the complete machine-readable "work that
291
- uses the Library", as object code and/or source code, so that the
292
- user can modify the Library and then relink to produce a modified
293
- executable containing the modified Library. (It is understood
294
- that the user who changes the contents of definitions files in the
295
- Library will not necessarily be able to recompile the application
296
- to use the modified definitions.)
297
-
298
- b) Use a suitable shared library mechanism for linking with the
299
- Library. A suitable mechanism is one that (1) uses at run time a
300
- copy of the library already present on the user's computer system,
301
- rather than copying library functions into the executable, and (2)
302
- will operate properly with a modified version of the library, if
303
- the user installs one, as long as the modified version is
304
- interface-compatible with the version that the work was made with.
305
-
306
- c) Accompany the work with a written offer, valid for at
307
- least three years, to give the same user the materials
308
- specified in Subsection 6a, above, for a charge no more
309
- than the cost of performing this distribution.
310
-
311
- d) If distribution of the work is made by offering access to copy
312
- from a designated place, offer equivalent access to copy the above
313
- specified materials from the same place.
314
-
315
- e) Verify that the user has already received a copy of these
316
- materials or that you have already sent this user a copy.
317
-
318
- For an executable, the required form of the "work that uses the
319
- Library" must include any data and utility programs needed for
320
- reproducing the executable from it. However, as a special exception,
321
- the materials to be distributed need not include anything that is
322
- normally distributed (in either source or binary form) with the major
323
- components (compiler, kernel, and so on) of the operating system on
324
- which the executable runs, unless that component itself accompanies
325
- the executable.
326
-
327
- It may happen that this requirement contradicts the license
328
- restrictions of other proprietary libraries that do not normally
329
- accompany the operating system. Such a contradiction means you cannot
330
- use both them and the Library together in an executable that you
331
- distribute.
332
-
333
- 7. You may place library facilities that are a work based on the
334
- Library side-by-side in a single library together with other library
335
- facilities not covered by this License, and distribute such a combined
336
- library, provided that the separate distribution of the work based on
337
- the Library and of the other library facilities is otherwise
338
- permitted, and provided that you do these two things:
339
-
340
- a) Accompany the combined library with a copy of the same work
341
- based on the Library, uncombined with any other library
342
- facilities. This must be distributed under the terms of the
343
- Sections above.
344
-
345
- b) Give prominent notice with the combined library of the fact
346
- that part of it is a work based on the Library, and explaining
347
- where to find the accompanying uncombined form of the same work.
348
-
349
- 8. You may not copy, modify, sublicense, link with, or distribute
350
- the Library except as expressly provided under this License. Any
351
- attempt otherwise to copy, modify, sublicense, link with, or
352
- distribute the Library is void, and will automatically terminate your
353
- rights under this License. However, parties who have received copies,
354
- or rights, from you under this License will not have their licenses
355
- terminated so long as such parties remain in full compliance.
356
-
357
- 9. You are not required to accept this License, since you have not
358
- signed it. However, nothing else grants you permission to modify or
359
- distribute the Library or its derivative works. These actions are
360
- prohibited by law if you do not accept this License. Therefore, by
361
- modifying or distributing the Library (or any work based on the
362
- Library), you indicate your acceptance of this License to do so, and
363
- all its terms and conditions for copying, distributing or modifying
364
- the Library or works based on it.
365
-
366
- 10. Each time you redistribute the Library (or any work based on the
367
- Library), the recipient automatically receives a license from the
368
- original licensor to copy, distribute, link with or modify the Library
369
- subject to these terms and conditions. You may not impose any further
370
- restrictions on the recipients' exercise of the rights granted herein.
371
- You are not responsible for enforcing compliance by third parties with
372
- this License.
373
-
374
- 11. If, as a consequence of a court judgment or allegation of patent
375
- infringement or for any other reason (not limited to patent issues),
376
- conditions are imposed on you (whether by court order, agreement or
377
- otherwise) that contradict the conditions of this License, they do not
378
- excuse you from the conditions of this License. If you cannot
379
- distribute so as to satisfy simultaneously your obligations under this
380
- License and any other pertinent obligations, then as a consequence you
381
- may not distribute the Library at all. For example, if a patent
382
- license would not permit royalty-free redistribution of the Library by
383
- all those who receive copies directly or indirectly through you, then
384
- the only way you could satisfy both it and this License would be to
385
- refrain entirely from distribution of the Library.
386
-
387
- If any portion of this section is held invalid or unenforceable under any
388
- particular circumstance, the balance of the section is intended to apply,
389
- and the section as a whole is intended to apply in other circumstances.
390
-
391
- It is not the purpose of this section to induce you to infringe any
392
- patents or other property right claims or to contest validity of any
393
- such claims; this section has the sole purpose of protecting the
394
- integrity of the free software distribution system which is
395
- implemented by public license practices. Many people have made
396
- generous contributions to the wide range of software distributed
397
- through that system in reliance on consistent application of that
398
- system; it is up to the author/donor to decide if he or she is willing
399
- to distribute software through any other system and a licensee cannot
400
- impose that choice.
401
-
402
- This section is intended to make thoroughly clear what is believed to
403
- be a consequence of the rest of this License.
404
-
405
- 12. If the distribution and/or use of the Library is restricted in
406
- certain countries either by patents or by copyrighted interfaces, the
407
- original copyright holder who places the Library under this License may add
408
- an explicit geographical distribution limitation excluding those countries,
409
- so that distribution is permitted only in or among countries not thus
410
- excluded. In such case, this License incorporates the limitation as if
411
- written in the body of this License.
412
-
413
- 13. The Free Software Foundation may publish revised and/or new
414
- versions of the Lesser General Public License from time to time.
415
- Such new versions will be similar in spirit to the present version,
416
- but may differ in detail to address new problems or concerns.
417
-
418
- Each version is given a distinguishing version number. If the Library
419
- specifies a version number of this License which applies to it and
420
- "any later version", you have the option of following the terms and
421
- conditions either of that version or of any later version published by
422
- the Free Software Foundation. If the Library does not specify a
423
- license version number, you may choose any version ever published by
424
- the Free Software Foundation.
425
-
426
- 14. If you wish to incorporate parts of the Library into other free
427
- programs whose distribution conditions are incompatible with these,
428
- write to the author to ask for permission. For software which is
429
- copyrighted by the Free Software Foundation, write to the Free
430
- Software Foundation; we sometimes make exceptions for this. Our
431
- decision will be guided by the two goals of preserving the free status
432
- of all derivatives of our free software and of promoting the sharing
433
- and reuse of software generally.
434
-
435
- NO WARRANTY
436
-
437
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438
- WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439
- EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440
- OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444
- LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445
- THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
-
447
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448
- WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449
- AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450
- FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451
- CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452
- LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453
- RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454
- FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455
- SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456
- DAMAGES.
457
-
458
- END OF TERMS AND CONDITIONS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/manage_area.js DELETED
@@ -1,623 +0,0 @@
1
- EditArea.prototype.focus = function() {
2
- this.textarea.focus();
3
- this.textareaFocused=true;
4
- };
5
-
6
-
7
- EditArea.prototype.check_line_selection= function(timer_checkup){
8
- var changes, infos, new_top, new_width,i;
9
-
10
- var t1=t2=t2_1=t3=tLines=tend= new Date().getTime();
11
- // l'editeur n'existe plus => on quitte
12
- if(!editAreas[this.id])
13
- return false;
14
-
15
- if(!this.smooth_selection && !this.do_highlight)
16
- {
17
- //do nothing
18
- }
19
- else if(this.textareaFocused && editAreas[this.id]["displayed"]==true && this.isResizing==false)
20
- {
21
- infos = this.get_selection_infos();
22
- changes = this.checkTextEvolution( typeof( this.last_selection['full_text'] ) == 'undefined' ? '' : this.last_selection['full_text'], infos['full_text'] );
23
-
24
- t2= new Date().getTime();
25
-
26
- // if selection change
27
- if(this.last_selection["line_start"] != infos["line_start"] || this.last_selection["line_nb"] != infos["line_nb"] || infos["full_text"] != this.last_selection["full_text"] || this.reload_highlight || this.last_selection["selectionStart"] != infos["selectionStart"] || this.last_selection["selectionEnd"] != infos["selectionEnd"] || !timer_checkup )
28
- {
29
- // move and adjust text selection elements
30
- new_top = this.getLinePosTop( infos["line_start"] );
31
- new_width = Math.max(this.textarea.scrollWidth, this.container.clientWidth -50);
32
- this.selection_field.style.top=this.selection_field_text.style.top=new_top+"px";
33
- if(!this.settings['word_wrap']){
34
- this.selection_field.style.width=this.selection_field_text.style.width=this.test_font_size.style.width=new_width+"px";
35
- }
36
-
37
- // usefull? => _$("cursor_pos").style.top=new_top+"px";
38
-
39
- if(this.do_highlight==true)
40
- {
41
- // fill selection elements
42
- var curr_text = infos["full_text"].split("\n");
43
- var content = "";
44
- //alert("length: "+curr_text.length+ " i: "+ Math.max(0,infos["line_start"]-1)+ " end: "+Math.min(curr_text.length, infos["line_start"]+infos["line_nb"]-1)+ " line: "+infos["line_start"]+" [0]: "+curr_text[0]+" [1]: "+curr_text[1]);
45
- var start = Math.max(0,infos["line_start"]-1);
46
- var end = Math.min(curr_text.length, infos["line_start"]+infos["line_nb"]-1);
47
-
48
- //curr_text[start]= curr_text[start].substr(0,infos["curr_pos"]-1) +"¤_overline_¤"+ curr_text[start].substr(infos["curr_pos"]-1);
49
- for(i=start; i< end; i++){
50
- content+= curr_text[i]+"\n";
51
- }
52
-
53
- // add special chars arround selected characters
54
- selLength = infos['selectionEnd'] - infos['selectionStart'];
55
- content = content.substr( 0, infos["curr_pos"] - 1 ) + "\r\r" + content.substr( infos["curr_pos"] - 1, selLength ) + "\r\r" + content.substr( infos["curr_pos"] - 1 + selLength );
56
- content = '<span>'+ content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace("\r\r", '</span><strong>').replace("\r\r", '</strong><span>') +'</span>';
57
-
58
- if( this.isIE || ( this.isOpera && this.isOpera < 9.6 ) ) {
59
- this.selection_field.innerHTML= "<pre>" + content.replace(/^\r?\n/, "<br>") + "</pre>";
60
- } else {
61
- this.selection_field.innerHTML= content;
62
- }
63
- this.selection_field_text.innerHTML = this.selection_field.innerHTML;
64
- t2_1 = new Date().getTime();
65
- // check if we need to update the highlighted background
66
- if(this.reload_highlight || (infos["full_text"] != this.last_text_to_highlight && (this.last_selection["line_start"]!=infos["line_start"] || this.show_line_colors || this.settings['word_wrap'] || this.last_selection["line_nb"]!=infos["line_nb"] || this.last_selection["nb_line"]!=infos["nb_line"]) ) )
67
- {
68
- this.maj_highlight(infos);
69
- }
70
- }
71
- }
72
- t3= new Date().getTime();
73
-
74
- // manage line heights
75
- if( this.settings['word_wrap'] && infos["full_text"] != this.last_selection["full_text"])
76
- {
77
- // refresh only 1 line if text change concern only one line and that the total line number has not changed
78
- if( changes.newText.split("\n").length == 1 && this.last_selection['nb_line'] && infos['nb_line'] == this.last_selection['nb_line'] )
79
- {
80
- this.fixLinesHeight( infos['full_text'], changes.lineStart, changes.lineStart );
81
- }
82
- else
83
- {
84
- this.fixLinesHeight( infos['full_text'], changes.lineStart, -1 );
85
- }
86
- }
87
-
88
- tLines= new Date().getTime();
89
- // manage bracket finding
90
- if( infos["line_start"] != this.last_selection["line_start"] || infos["curr_pos"] != this.last_selection["curr_pos"] || infos["full_text"].length!=this.last_selection["full_text"].length || this.reload_highlight || !timer_checkup )
91
- {
92
- // move _cursor_pos
93
- var selec_char= infos["curr_line"].charAt(infos["curr_pos"]-1);
94
- var no_real_move=true;
95
- if(infos["line_nb"]==1 && (this.assocBracket[selec_char] || this.revertAssocBracket[selec_char]) ){
96
-
97
- no_real_move=false;
98
- //findEndBracket(infos["line_start"], infos["curr_pos"], selec_char);
99
- if(this.findEndBracket(infos, selec_char) === true){
100
- _$("end_bracket").style.visibility ="visible";
101
- _$("cursor_pos").style.visibility ="visible";
102
- _$("cursor_pos").innerHTML = selec_char;
103
- _$("end_bracket").innerHTML = (this.assocBracket[selec_char] || this.revertAssocBracket[selec_char]);
104
- }else{
105
- _$("end_bracket").style.visibility ="hidden";
106
- _$("cursor_pos").style.visibility ="hidden";
107
- }
108
- }else{
109
- _$("cursor_pos").style.visibility ="hidden";
110
- _$("end_bracket").style.visibility ="hidden";
111
- }
112
- //alert("move cursor");
113
- this.displayToCursorPosition("cursor_pos", infos["line_start"], infos["curr_pos"]-1, infos["curr_line"], no_real_move);
114
- if(infos["line_nb"]==1 && infos["line_start"]!=this.last_selection["line_start"])
115
- this.scroll_to_view();
116
- }
117
- this.last_selection=infos;
118
- }
119
-
120
- tend= new Date().getTime();
121
- //if( (tend-t1) > 7 )
122
- // console.log( "tps total: "+ (tend-t1) + " tps get_infos: "+ (t2-t1)+ " tps selec: "+ (t2_1-t2)+ " tps highlight: "+ (t3-t2_1) +" tps lines: "+ (tLines-t3) +" tps cursor+lines: "+ (tend-tLines)+" \n" );
123
-
124
-
125
- if(timer_checkup){
126
- setTimeout("editArea.check_line_selection(true)", this.check_line_selection_timer);
127
- }
128
- };
129
-
130
-
131
- EditArea.prototype.get_selection_infos= function(){
132
- var sel={}, start, end, len, str;
133
-
134
- this.getIESelection();
135
- start = this.textarea.selectionStart;
136
- end = this.textarea.selectionEnd;
137
-
138
- if( this.last_selection["selectionStart"] == start && this.last_selection["selectionEnd"] == end && this.last_selection["full_text"] == this.textarea.value )
139
- {
140
- return this.last_selection;
141
- }
142
-
143
- if(this.tabulation!="\t" && this.textarea.value.indexOf("\t")!=-1)
144
- { // can append only after copy/paste
145
- len = this.textarea.value.length;
146
- this.textarea.value = this.replace_tab(this.textarea.value);
147
- start = end = start+(this.textarea.value.length-len);
148
- this.area_select( start, 0 );
149
- }
150
-
151
- sel["selectionStart"] = start;
152
- sel["selectionEnd"] = end;
153
- sel["full_text"] = this.textarea.value;
154
- sel["line_start"] = 1;
155
- sel["line_nb"] = 1;
156
- sel["curr_pos"] = 0;
157
- sel["curr_line"] = "";
158
- sel["indexOfCursor"] = 0;
159
- sel["selec_direction"] = this.last_selection["selec_direction"];
160
-
161
- //return sel;
162
- var splitTab= sel["full_text"].split("\n");
163
- var nbLine = Math.max(0, splitTab.length);
164
- var nbChar = Math.max(0, sel["full_text"].length - (nbLine - 1)); // (remove \n caracters from the count)
165
- if( sel["full_text"].indexOf("\r") != -1 )
166
- nbChar = nbChar - ( nbLine - 1 ); // (remove \r caracters from the count)
167
- sel["nb_line"] = nbLine;
168
- sel["nb_char"] = nbChar;
169
-
170
- if(start>0){
171
- str = sel["full_text"].substr(0,start);
172
- sel["curr_pos"] = start - str.lastIndexOf("\n");
173
- sel["line_start"] = Math.max(1, str.split("\n").length);
174
- }else{
175
- sel["curr_pos"]=1;
176
- }
177
- if(end>start){
178
- sel["line_nb"]=sel["full_text"].substring(start,end).split("\n").length;
179
- }
180
- sel["indexOfCursor"]=start;
181
- sel["curr_line"]=splitTab[Math.max(0,sel["line_start"]-1)];
182
-
183
- // determine in which direction the selection grow
184
- if(sel["selectionStart"] == this.last_selection["selectionStart"]){
185
- if(sel["selectionEnd"]>this.last_selection["selectionEnd"])
186
- sel["selec_direction"]= "down";
187
- else if(sel["selectionEnd"] == this.last_selection["selectionStart"])
188
- sel["selec_direction"]= this.last_selection["selec_direction"];
189
- }else if(sel["selectionStart"] == this.last_selection["selectionEnd"] && sel["selectionEnd"]>this.last_selection["selectionEnd"]){
190
- sel["selec_direction"]= "down";
191
- }else{
192
- sel["selec_direction"]= "up";
193
- }
194
-
195
- _$("nbLine").innerHTML = nbLine;
196
- _$("nbChar").innerHTML = nbChar;
197
- _$("linePos").innerHTML = sel["line_start"];
198
- _$("currPos").innerHTML = sel["curr_pos"];
199
-
200
- return sel;
201
- };
202
-
203
- // set IE position in Firefox mode (textarea.selectionStart and textarea.selectionEnd)
204
- EditArea.prototype.getIESelection= function(){
205
- var selectionStart, selectionEnd, range, stored_range;
206
-
207
- if( !this.isIE )
208
- return false;
209
-
210
- // make it work as nowrap mode (easier for range manipulation with lineHeight)
211
- if( this.settings['word_wrap'] )
212
- this.textarea.wrap='off';
213
-
214
- try{
215
- range = document.selection.createRange();
216
- stored_range = range.duplicate();
217
- stored_range.moveToElementText( this.textarea );
218
- stored_range.setEndPoint( 'EndToEnd', range );
219
- if( stored_range.parentElement() != this.textarea )
220
- throw "invalid focus";
221
-
222
- // the range don't take care of empty lines in the end of the selection
223
- var scrollTop = this.result.scrollTop + document.body.scrollTop;
224
- var relative_top= range.offsetTop - parent.calculeOffsetTop(this.textarea) + scrollTop;
225
- var line_start = Math.round((relative_top / this.lineHeight) +1);
226
- var line_nb = Math.round( range.boundingHeight / this.lineHeight );
227
-
228
- selectionStart = stored_range.text.length - range.text.length;
229
- selectionStart += ( line_start - this.textarea.value.substr(0, selectionStart).split("\n").length)*2; // count missing empty \r to the selection
230
- selectionStart -= ( line_start - this.textarea.value.substr(0, selectionStart).split("\n").length ) * 2;
231
-
232
- selectionEnd = selectionStart + range.text.length;
233
- selectionEnd += (line_start + line_nb - 1 - this.textarea.value.substr(0, selectionEnd ).split("\n").length)*2;
234
-
235
- this.textarea.selectionStart = selectionStart;
236
- this.textarea.selectionEnd = selectionEnd;
237
- }
238
- catch(e){}
239
-
240
- // restore wrap mode
241
- if( this.settings['word_wrap'] )
242
- this.textarea.wrap='soft';
243
- };
244
-
245
- // select the text for IE (and take care of \r caracters)
246
- EditArea.prototype.setIESelection= function(){
247
- var a = this.textarea, nbLineStart, nbLineEnd, range;
248
-
249
- if( !this.isIE )
250
- return false;
251
-
252
- nbLineStart = a.value.substr(0, a.selectionStart).split("\n").length - 1;
253
- nbLineEnd = a.value.substr(0, a.selectionEnd).split("\n").length - 1;
254
- range = document.selection.createRange();
255
- range.moveToElementText( a );
256
- range.setEndPoint( 'EndToStart', range );
257
-
258
- range.moveStart('character', a.selectionStart - nbLineStart);
259
- range.moveEnd('character', a.selectionEnd - nbLineEnd - (a.selectionStart - nbLineStart) );
260
- range.select();
261
- };
262
-
263
-
264
-
265
- EditArea.prototype.checkTextEvolution=function(lastText,newText){
266
- // ch will contain changes datas
267
- var ch={},baseStep=200, cpt=0, end, step,tStart=new Date().getTime();
268
-
269
- end = Math.min(newText.length, lastText.length);
270
- step = baseStep;
271
- // find how many chars are similar at the begin of the text
272
- while( cpt<end && step>=1 ){
273
- if(lastText.substr(cpt, step) == newText.substr(cpt, step)){
274
- cpt+= step;
275
- }else{
276
- step= Math.floor(step/2);
277
- }
278
- }
279
-
280
- ch.posStart = cpt;
281
- ch.lineStart= newText.substr(0, ch.posStart).split("\n").length -1;
282
-
283
- cpt_last = lastText.length;
284
- cpt = newText.length;
285
- step = baseStep;
286
- // find how many chars are similar at the end of the text
287
- while( cpt>=0 && cpt_last>=0 && step>=1 ){
288
- if(lastText.substr(cpt_last-step, step) == newText.substr(cpt-step, step)){
289
- cpt-= step;
290
- cpt_last-= step;
291
- }else{
292
- step= Math.floor(step/2);
293
- }
294
- }
295
-
296
- ch.posNewEnd = cpt;
297
- ch.posLastEnd = cpt_last;
298
- if(ch.posNewEnd<=ch.posStart){
299
- if(lastText.length < newText.length){
300
- ch.posNewEnd= ch.posStart + newText.length - lastText.length;
301
- ch.posLastEnd= ch.posStart;
302
- }else{
303
- ch.posLastEnd= ch.posStart + lastText.length - newText.length;
304
- ch.posNewEnd= ch.posStart;
305
- }
306
- }
307
- ch.newText = newText.substring(ch.posStart, ch.posNewEnd);
308
- ch.lastText = lastText.substring(ch.posStart, ch.posLastEnd);
309
-
310
- ch.lineNewEnd = newText.substr(0, ch.posNewEnd).split("\n").length -1;
311
- ch.lineLastEnd = lastText.substr(0, ch.posLastEnd).split("\n").length -1;
312
-
313
- ch.newTextLine = newText.split("\n").slice(ch.lineStart, ch.lineNewEnd+1).join("\n");
314
- ch.lastTextLine = lastText.split("\n").slice(ch.lineStart, ch.lineLastEnd+1).join("\n");
315
- //console.log( ch );
316
- return ch;
317
- };
318
-
319
- EditArea.prototype.tab_selection= function(){
320
- if(this.is_tabbing)
321
- return;
322
- this.is_tabbing=true;
323
- //infos=getSelectionInfos();
324
- //if( document.selection ){
325
- this.getIESelection();
326
- /* Insertion du code de formatage */
327
- var start = this.textarea.selectionStart;
328
- var end = this.textarea.selectionEnd;
329
- var insText = this.textarea.value.substring(start, end);
330
-
331
- /* Insert tabulation and ajust cursor position */
332
- var pos_start=start;
333
- var pos_end=end;
334
- if (insText.length == 0) {
335
- // if only one line selected
336
- this.textarea.value = this.textarea.value.substr(0, start) + this.tabulation + this.textarea.value.substr(end);
337
- pos_start = start + this.tabulation.length;
338
- pos_end=pos_start;
339
- } else {
340
- start= Math.max(0, this.textarea.value.substr(0, start).lastIndexOf("\n")+1);
341
- endText=this.textarea.value.substr(end);
342
- startText=this.textarea.value.substr(0, start);
343
- tmp= this.textarea.value.substring(start, end).split("\n");
344
- insText= this.tabulation+tmp.join("\n"+this.tabulation);
345
- this.textarea.value = startText + insText + endText;
346
- pos_start = start;
347
- pos_end= this.textarea.value.indexOf("\n", startText.length + insText.length);
348
- if(pos_end==-1)
349
- pos_end=this.textarea.value.length;
350
- //pos = start + repdeb.length + insText.length + ;
351
- }
352
- this.textarea.selectionStart = pos_start;
353
- this.textarea.selectionEnd = pos_end;
354
-
355
- //if( document.selection ){
356
- if(this.isIE)
357
- {
358
- this.setIESelection();
359
- setTimeout("editArea.is_tabbing=false;", 100); // IE can't accept to make 2 tabulation without a little break between both
360
- }
361
- else
362
- {
363
- this.is_tabbing=false;
364
- }
365
-
366
- };
367
-
368
- EditArea.prototype.invert_tab_selection= function(){
369
- var t=this, a=this.textarea;
370
- if(t.is_tabbing)
371
- return;
372
- t.is_tabbing=true;
373
- //infos=getSelectionInfos();
374
- //if( document.selection ){
375
- t.getIESelection();
376
-
377
- var start = a.selectionStart;
378
- var end = a.selectionEnd;
379
- var insText = a.value.substring(start, end);
380
-
381
- /* Tab remove and cursor seleciton adjust */
382
- var pos_start=start;
383
- var pos_end=end;
384
- if (insText.length == 0) {
385
- if(a.value.substring(start-t.tabulation.length, start)==t.tabulation)
386
- {
387
- a.value = a.value.substr(0, start-t.tabulation.length) + a.value.substr(end);
388
- pos_start = Math.max(0, start-t.tabulation.length);
389
- pos_end = pos_start;
390
- }
391
- /*
392
- a.value = a.value.substr(0, start) + t.tabulation + insText + a.value.substr(end);
393
- pos_start = start + t.tabulation.length;
394
- pos_end=pos_start;*/
395
- } else {
396
- start = a.value.substr(0, start).lastIndexOf("\n")+1;
397
- endText = a.value.substr(end);
398
- startText = a.value.substr(0, start);
399
- tmp = a.value.substring(start, end).split("\n");
400
- insText = "";
401
- for(i=0; i<tmp.length; i++){
402
- for(j=0; j<t.tab_nb_char; j++){
403
- if(tmp[i].charAt(0)=="\t"){
404
- tmp[i]=tmp[i].substr(1);
405
- j=t.tab_nb_char;
406
- }else if(tmp[i].charAt(0)==" ")
407
- tmp[i]=tmp[i].substr(1);
408
- }
409
- insText+=tmp[i];
410
- if(i<tmp.length-1)
411
- insText+="\n";
412
- }
413
- //insText+="_";
414
- a.value = startText + insText + endText;
415
- pos_start = start;
416
- pos_end = a.value.indexOf("\n", startText.length + insText.length);
417
- if(pos_end==-1)
418
- pos_end=a.value.length;
419
- //pos = start + repdeb.length + insText.length + ;
420
- }
421
- a.selectionStart = pos_start;
422
- a.selectionEnd = pos_end;
423
-
424
- //if( document.selection ){
425
- if(t.isIE){
426
- // select the text for IE
427
- t.setIESelection();
428
- setTimeout("editArea.is_tabbing=false;", 100); // IE can accept to make 2 tabulation without a little break between both
429
- }else
430
- t.is_tabbing=false;
431
- };
432
-
433
- EditArea.prototype.press_enter= function(){
434
- if(!this.smooth_selection)
435
- return false;
436
- this.getIESelection();
437
- var scrollTop= this.result.scrollTop;
438
- var scrollLeft= this.result.scrollLeft;
439
- var start=this.textarea.selectionStart;
440
- var end= this.textarea.selectionEnd;
441
- var start_last_line= Math.max(0 , this.textarea.value.substring(0, start).lastIndexOf("\n") + 1 );
442
- var begin_line= this.textarea.value.substring(start_last_line, start).replace(/^([ \t]*).*/gm, "$1");
443
- var lineStart = this.textarea.value.substring(0, start).split("\n").length;
444
- if(begin_line=="\n" || begin_line=="\r" || begin_line.length==0)
445
- {
446
- return false;
447
- }
448
-
449
- if(this.isIE || ( this.isOpera && this.isOpera < 9.6 ) ){
450
- begin_line="\r\n"+ begin_line;
451
- }else{
452
- begin_line="\n"+ begin_line;
453
- }
454
- //alert(start_last_line+" strat: "+start +"\n"+this.textarea.value.substring(start_last_line, start)+"\n_"+begin_line+"_")
455
- this.textarea.value= this.textarea.value.substring(0, start) + begin_line + this.textarea.value.substring(end);
456
-
457
- this.area_select(start+ begin_line.length ,0);
458
- // during this process IE scroll back to the top of the textarea
459
- if(this.isIE){
460
- this.result.scrollTop = scrollTop;
461
- this.result.scrollLeft = scrollLeft;
462
- }
463
- return true;
464
-
465
- };
466
-
467
- EditArea.prototype.findEndBracket= function(infos, bracket){
468
-
469
- var start=infos["indexOfCursor"];
470
- var normal_order=true;
471
- //curr_text=infos["full_text"].split("\n");
472
- if(this.assocBracket[bracket])
473
- endBracket=this.assocBracket[bracket];
474
- else if(this.revertAssocBracket[bracket]){
475
- endBracket=this.revertAssocBracket[bracket];
476
- normal_order=false;
477
- }
478
- var end=-1;
479
- var nbBracketOpen=0;
480
-
481
- for(var i=start; i<infos["full_text"].length && i>=0; ){
482
- if(infos["full_text"].charAt(i)==endBracket){
483
- nbBracketOpen--;
484
- if(nbBracketOpen<=0){
485
- //i=infos["full_text"].length;
486
- end=i;
487
- break;
488
- }
489
- }else if(infos["full_text"].charAt(i)==bracket)
490
- nbBracketOpen++;
491
- if(normal_order)
492
- i++;
493
- else
494
- i--;
495
- }
496
-
497
- //end=infos["full_text"].indexOf("}", start);
498
- if(end==-1)
499
- return false;
500
- var endLastLine=infos["full_text"].substr(0, end).lastIndexOf("\n");
501
- if(endLastLine==-1)
502
- line=1;
503
- else
504
- line= infos["full_text"].substr(0, endLastLine).split("\n").length + 1;
505
-
506
- var curPos= end - endLastLine - 1;
507
- var endLineLength = infos["full_text"].substring(end).split("\n")[0].length;
508
- this.displayToCursorPosition("end_bracket", line, curPos, infos["full_text"].substring(endLastLine +1, end + endLineLength));
509
- return true;
510
- };
511
-
512
- EditArea.prototype.displayToCursorPosition= function(id, start_line, cur_pos, lineContent, no_real_move){
513
- var elem,dest,content,posLeft=0,posTop,fixPadding,topOffset,endElem;
514
-
515
- elem = this.test_font_size;
516
- dest = _$(id);
517
- content = "<span id='test_font_size_inner'>"+lineContent.substr(0, cur_pos).replace(/&/g,"&amp;").replace(/</g,"&lt;")+"</span><span id='endTestFont'>"+lineContent.substr(cur_pos).replace(/&/g,"&amp;").replace(/</g,"&lt;")+"</span>";
518
- if( this.isIE || ( this.isOpera && this.isOpera < 9.6 ) ) {
519
- elem.innerHTML= "<pre>" + content.replace(/^\r?\n/, "<br>") + "</pre>";
520
- } else {
521
- elem.innerHTML= content;
522
- }
523
-
524
-
525
- endElem = _$('endTestFont');
526
- topOffset = endElem.offsetTop;
527
- fixPadding = parseInt( this.content_highlight.style.paddingLeft.replace("px", "") );
528
- posLeft = 45 + endElem.offsetLeft + ( !isNaN( fixPadding ) && topOffset > 0 ? fixPadding : 0 );
529
- posTop = this.getLinePosTop( start_line ) + topOffset;// + Math.floor( ( endElem.offsetHeight - 1 ) / this.lineHeight ) * this.lineHeight;
530
-
531
- // detect the case where the span start on a line but has no display on it
532
- if( this.isIE && cur_pos > 0 && endElem.offsetLeft == 0 )
533
- {
534
- posTop += this.lineHeight;
535
- }
536
- if(no_real_move!=true){ // when the cursor is hidden no need to move him
537
- dest.style.top=posTop+"px";
538
- dest.style.left=posLeft+"px";
539
- }
540
- // usefull for smarter scroll
541
- dest.cursor_top=posTop;
542
- dest.cursor_left=posLeft;
543
- // _$(id).style.marginLeft=posLeft+"px";
544
- };
545
-
546
- EditArea.prototype.getLinePosTop= function(start_line){
547
- var elem= _$('line_'+ start_line), posTop=0;
548
- if( elem )
549
- posTop = elem.offsetTop;
550
- else
551
- posTop = this.lineHeight * (start_line-1);
552
- return posTop;
553
- };
554
-
555
-
556
- // return the dislpayed height of a text (take word-wrap into account)
557
- EditArea.prototype.getTextHeight= function(text){
558
- var t=this,elem,height;
559
- elem = t.test_font_size;
560
- content = text.replace(/&/g,"&amp;").replace(/</g,"&lt;");
561
- if( t.isIE || ( this.isOpera && this.isOpera < 9.6 ) ) {
562
- elem.innerHTML= "<pre>" + content.replace(/^\r?\n/, "<br>") + "</pre>";
563
- } else {
564
- elem.innerHTML= content;
565
- }
566
- height = elem.offsetHeight;
567
- height = Math.max( 1, Math.floor( elem.offsetHeight / this.lineHeight ) ) * this.lineHeight;
568
- return height;
569
- };
570
-
571
- /**
572
- * Fix line height for the given lines
573
- * @param Integer linestart
574
- * @param Integer lineEnd End line or -1 to cover all lines
575
- */
576
- EditArea.prototype.fixLinesHeight= function( textValue, lineStart,lineEnd ){
577
- var aText = textValue.split("\n");
578
- if( lineEnd == -1 )
579
- lineEnd = aText.length-1;
580
- for( var i = Math.max(0, lineStart); i <= lineEnd; i++ )
581
- {
582
- if( elem = _$('line_'+ ( i+1 ) ) )
583
- {
584
- elem.style.height= typeof( aText[i] ) != "undefined" ? this.getTextHeight( aText[i] )+"px" : this.lineHeight;
585
- }
586
- }
587
- };
588
-
589
- EditArea.prototype.area_select= function(start, length){
590
- this.textarea.focus();
591
-
592
- start = Math.max(0, Math.min(this.textarea.value.length, start));
593
- end = Math.max(start, Math.min(this.textarea.value.length, start+length));
594
-
595
- if(this.isIE)
596
- {
597
- this.textarea.selectionStart = start;
598
- this.textarea.selectionEnd = end;
599
- this.setIESelection();
600
- }
601
- else
602
- {
603
- // Opera bug when moving selection start and selection end
604
- if(this.isOpera && this.isOpera < 9.6 )
605
- {
606
- this.textarea.setSelectionRange(0, 0);
607
- }
608
- this.textarea.setSelectionRange(start, end);
609
- }
610
- this.check_line_selection();
611
- };
612
-
613
-
614
- EditArea.prototype.area_get_selection= function(){
615
- var text="";
616
- if( document.selection ){
617
- var range = document.selection.createRange();
618
- text=range.text;
619
- }else{
620
- text= this.textarea.value.substring(this.textarea.selectionStart, this.textarea.selectionEnd);
621
- }
622
- return text;
623
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/charmap/charmap.js DELETED
@@ -1,90 +0,0 @@
1
- /**
2
- * Charmap plugin
3
- * by Christophe Dolivet
4
- * v0.1 (2006/09/22)
5
- *
6
- *
7
- * This plugin allow to use a visual keyboard allowing to insert any UTF-8 characters in the text.
8
- *
9
- * - plugin name to add to the plugin list: "charmap"
10
- * - plugin name to add to the toolbar list: "charmap"
11
- * - possible parameters to add to EditAreaLoader.init():
12
- * "charmap_default": (String) define the name of the default character range displayed on popup display
13
- * (default: "arrows")
14
- *
15
- *
16
- */
17
-
18
- var EditArea_charmap= {
19
- /**
20
- * Get called once this file is loaded (editArea still not initialized)
21
- *
22
- * @return nothing
23
- */
24
- init: function(){
25
- this.default_language="Arrows";
26
- }
27
-
28
- /**
29
- * Returns the HTML code for a specific control string or false if this plugin doesn't have that control.
30
- * A control can be a button, select list or any other HTML item to present in the EditArea user interface.
31
- * Language variables such as {$lang_somekey} will also be replaced with contents from
32
- * the language packs.
33
- *
34
- * @param {string} ctrl_name: the name of the control to add
35
- * @return HTML code for a specific control or false.
36
- * @type string or boolean
37
- */
38
- ,get_control_html: function(ctrl_name){
39
- switch(ctrl_name){
40
- case "charmap":
41
- // Control id, button img, command
42
- return parent.editAreaLoader.get_button_html('charmap_but', 'charmap.gif', 'charmap_press', false, this.baseURL);
43
- }
44
- return false;
45
- }
46
- /**
47
- * Get called once EditArea is fully loaded and initialised
48
- *
49
- * @return nothing
50
- */
51
- ,onload: function(){
52
- if(editArea.settings["charmap_default"] && editArea.settings["charmap_default"].length>0)
53
- this.default_language= editArea.settings["charmap_default"];
54
- }
55
-
56
- /**
57
- * Is called each time the user touch a keyboard key.
58
- *
59
- * @param (event) e: the keydown event
60
- * @return true - pass to next handler in chain, false - stop chain execution
61
- * @type boolean
62
- */
63
- ,onkeydown: function(e){
64
-
65
- }
66
-
67
- /**
68
- * Executes a specific command, this function handles plugin commands.
69
- *
70
- * @param {string} cmd: the name of the command being executed
71
- * @param {unknown} param: the parameter of the command
72
- * @return true - pass to next handler in chain, false - stop chain execution
73
- * @type boolean
74
- */
75
- ,execCommand: function(cmd, param){
76
- // Handle commands
77
- switch(cmd){
78
- case "charmap_press":
79
- win= window.open(this.baseURL+"popup.html", "charmap", "width=500,height=270,scrollbars=yes,resizable=yes");
80
- win.focus();
81
- return false;
82
- }
83
- // Pass to next handler in chain
84
- return true;
85
- }
86
-
87
- };
88
-
89
- // Adds the plugin class to the list of available EditArea plugins
90
- editArea.add_plugin("charmap", EditArea_charmap);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/charmap/css/charmap.css DELETED
@@ -1,64 +0,0 @@
1
- body{
2
- background-color: #F0F0EE;
3
- font: 12px monospace, sans-serif;
4
- }
5
-
6
- select{
7
- background-color: #F9F9F9;
8
- border: solid 1px #888888;
9
- }
10
-
11
- h1, h2, h3, h4, h5, h6{
12
- margin: 0;
13
- padding: 0;
14
- color: #2B6FB6;
15
- }
16
-
17
- h1{
18
- font-size: 1.5em;
19
- }
20
-
21
- div#char_list{
22
- height: 200px;
23
- overflow: auto;
24
- padding: 1px;
25
- border: 1px solid #0A246A;
26
- background-color: #F9F9F9;
27
- clear: both;
28
- margin-top: 5px;
29
- }
30
-
31
- a.char{
32
- display: block;
33
- float: left;
34
- width: 20px;
35
- height: 20px;
36
- line-height: 20px;
37
- margin: 1px;
38
- border: solid 1px #888888;
39
- text-align: center;
40
- cursor: pointer;
41
- }
42
-
43
- a.char:hover{
44
- background-color: #CCCCCC;
45
- }
46
-
47
- .preview{
48
- border: solid 1px #888888;
49
- width: 50px;
50
- padding: 2px 5px;
51
- height: 35px;
52
- line-height: 35px;
53
- text-align:center;
54
- background-color: #CCCCCC;
55
- font-size: 2em;
56
- float: right;
57
- font-weight: bold;
58
- margin: 0 0 5px 5px;
59
- }
60
-
61
- #preview_code{
62
- font-size: 1.1em;
63
- width: 70px;
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/charmap/images/charmap.gif DELETED
Binary file
includes/edit_area/plugins/charmap/jscripts/map.js DELETED
@@ -1,373 +0,0 @@
1
- var editArea;
2
-
3
-
4
- /**
5
- * UTF-8 list taken from http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=dec
6
- */
7
-
8
-
9
- /*
10
- var char_range_list={
11
- "Basic Latin":"0021,007F",
12
- "Latin-1 Supplement":"0080,00FF",
13
- "Latin Extended-A":"0100,017F",
14
- "Latin Extended-B":"0180,024F",
15
- "IPA Extensions":"0250,02AF",
16
- "Spacing Modifier Letters":"02B0,02FF",
17
-
18
- "Combining Diacritical Marks":"0300,036F",
19
- "Greek and Coptic":"0370,03FF",
20
- "Cyrillic":"0400,04FF",
21
- "Cyrillic Supplement":"0500,052F",
22
- "Armenian":"0530,058F",
23
- "Hebrew":"0590,05FF",
24
- "Arabic":"0600,06FF",
25
- "Syriac":"0700,074F",
26
- "Arabic Supplement":"0750,077F",
27
-
28
- "Thaana":"0780,07BF",
29
- "Devanagari":"0900,097F",
30
- "Bengali":"0980,09FF",
31
- "Gurmukhi":"0A00,0A7F",
32
- "Gujarati":"0A80,0AFF",
33
- "Oriya":"0B00,0B7F",
34
- "Tamil":"0B80,0BFF",
35
- "Telugu":"0C00,0C7F",
36
- "Kannada":"0C80,0CFF",
37
-
38
- "Malayalam":"0D00,0D7F",
39
- "Sinhala":"0D80,0DFF",
40
- "Thai":"0E00,0E7F",
41
- "Lao":"0E80,0EFF",
42
- "Tibetan":"0F00,0FFF",
43
- "Myanmar":"1000,109F",
44
- "Georgian":"10A0,10FF",
45
- "Hangul Jamo":"1100,11FF",
46
- "Ethiopic":"1200,137F",
47
-
48
- "Ethiopic Supplement":"1380,139F",
49
- "Cherokee":"13A0,13FF",
50
- "Unified Canadian Aboriginal Syllabics":"1400,167F",
51
- "Ogham":"1680,169F",
52
- "Runic":"16A0,16FF",
53
- "Tagalog":"1700,171F",
54
- "Hanunoo":"1720,173F",
55
- "Buhid":"1740,175F",
56
- "Tagbanwa":"1760,177F",
57
-
58
- "Khmer":"1780,17FF",
59
- "Mongolian":"1800,18AF",
60
- "Limbu":"1900,194F",
61
- "Tai Le":"1950,197F",
62
- "New Tai Lue":"1980,19DF",
63
- "Khmer Symbols":"19E0,19FF",
64
- "Buginese":"1A00,1A1F",
65
- "Phonetic Extensions":"1D00,1D7F",
66
- "Phonetic Extensions Supplement":"1D80,1DBF",
67
-
68
- "Combining Diacritical Marks Supplement":"1DC0,1DFF",
69
- "Latin Extended Additional":"1E00,1EFF",
70
- "Greek Extended":"1F00,1FFF",
71
- "General Punctuation":"2000,206F",
72
- "Superscripts and Subscripts":"2070,209F",
73
- "Currency Symbols":"20A0,20CF",
74
- "Combining Diacritical Marks for Symbols":"20D0,20FF",
75
- "Letterlike Symbols":"2100,214F",
76
- "Number Forms":"2150,218F",
77
-
78
- "Arrows":"2190,21FF",
79
- "Mathematical Operators":"2200,22FF",
80
- "Miscellaneous Technical":"2300,23FF",
81
- "Control Pictures":"2400,243F",
82
- "Optical Character Recognition":"2440,245F",
83
- "Enclosed Alphanumerics":"2460,24FF",
84
- "Box Drawing":"2500,257F",
85
- "Block Elements":"2580,259F",
86
- "Geometric Shapes":"25A0,25FF",
87
-
88
- "Miscellaneous Symbols":"2600,26FF",
89
- "Dingbats":"2700,27BF",
90
- "Miscellaneous Mathematical Symbols-A":"27C0,27EF",
91
- "Supplemental Arrows-A":"27F0,27FF",
92
- "Braille Patterns":"2800,28FF",
93
- "Supplemental Arrows-B":"2900,297F",
94
- "Miscellaneous Mathematical Symbols-B":"2980,29FF",
95
- "Supplemental Mathematical Operators":"2A00,2AFF",
96
- "Miscellaneous Symbols and Arrows":"2B00,2BFF",
97
-
98
- "Glagolitic":"2C00,2C5F",
99
- "Coptic":"2C80,2CFF",
100
- "Georgian Supplement":"2D00,2D2F",
101
- "Tifinagh":"2D30,2D7F",
102
- "Ethiopic Extended":"2D80,2DDF",
103
- "Supplemental Punctuation":"2E00,2E7F",
104
- "CJK Radicals Supplement":"2E80,2EFF",
105
- "Kangxi Radicals":"2F00,2FDF",
106
- "Ideographic Description Characters":"2FF0,2FFF",
107
-
108
- "CJK Symbols and Punctuation":"3000,303F",
109
- "Hiragana":"3040,309F",
110
- "Katakana":"30A0,30FF",
111
- "Bopomofo":"3100,312F",
112
- "Hangul Compatibility Jamo":"3130,318F",
113
- "Kanbun":"3190,319F",
114
- "Bopomofo Extended":"31A0,31BF",
115
- "CJK Strokes":"31C0,31EF",
116
- "Katakana Phonetic Extensions":"31F0,31FF",
117
-
118
- "Enclosed CJK Letters and Months":"3200,32FF",
119
- "CJK Compatibility":"3300,33FF",
120
- "CJK Unified Ideographs Extension A":"3400,4DBF",
121
- "Yijing Hexagram Symbols":"4DC0,4DFF",
122
- "CJK Unified Ideographs":"4E00,9FFF",
123
- "Yi Syllables":"A000,A48F",
124
- "Yi Radicals":"A490,A4CF",
125
- "Modifier Tone Letters":"A700,A71F",
126
- "Syloti Nagri":"A800,A82F",
127
-
128
- "Hangul Syllables":"AC00,D7AF",
129
- "High Surrogates":"D800,DB7F",
130
- "High Private Use Surrogates":"DB80,DBFF",
131
- "Low Surrogates":"DC00,DFFF",
132
- "Private Use Area":"E000,F8FF",
133
- "CJK Compatibility Ideographs":"F900,FAFF",
134
- "Alphabetic Presentation Forms":"FB00,FB4F",
135
- "Arabic Presentation Forms-A":"FB50,FDFF",
136
- "Variation Selectors":"FE00,FE0F",
137
-
138
- "Vertical Forms":"FE10,FE1F",
139
- "Combining Half Marks":"FE20,FE2F",
140
- "CJK Compatibility Forms":"FE30,FE4F",
141
- "Small Form Variants":"FE50,FE6F",
142
- "Arabic Presentation Forms-B":"FE70,FEFF",
143
- "Halfwidth and Fullwidth Forms":"FF00,FFEF",
144
- "Specials":"FFF0,FFFF",
145
- "Linear B Syllabary":"10000,1007F",
146
- "Linear B Ideograms":"10080,100FF",
147
-
148
- "Aegean Numbers":"10100,1013F",
149
- "Ancient Greek Numbers":"10140,1018F",
150
- "Old Italic":"10300,1032F",
151
- "Gothic":"10330,1034F",
152
- "Ugaritic":"10380,1039F",
153
- "Old Persian":"103A0,103DF",
154
- "Deseret":"10400,1044F",
155
- "Shavian":"10450,1047F",
156
- "Osmanya":"10480,104AF",
157
-
158
- "Cypriot Syllabary":"10800,1083F",
159
- "Kharoshthi":"10A00,10A5F",
160
- "Byzantine Musical Symbols":"1D000,1D0FF",
161
- "Musical Symbols":"1D100,1D1FF",
162
- "Ancient Greek Musical Notation":"1D200,1D24F",
163
- "Tai Xuan Jing Symbols":"1D300,1D35F",
164
- "Mathematical Alphanumeric Symbols":"1D400,1D7FF",
165
- "CJK Unified Ideographs Extension B":"20000,2A6DF",
166
- "CJK Compatibility Ideographs Supplement":"2F800,2FA1F",
167
- "Tags":"E0000,E007F",
168
- "Variation Selectors Supplement":"E0100,E01EF"
169
- };
170
- */
171
- var char_range_list={
172
- "Aegean Numbers":"10100,1013F",
173
- "Alphabetic Presentation Forms":"FB00,FB4F",
174
- "Ancient Greek Musical Notation":"1D200,1D24F",
175
- "Ancient Greek Numbers":"10140,1018F",
176
- "Arabic":"0600,06FF",
177
- "Arabic Presentation Forms-A":"FB50,FDFF",
178
- "Arabic Presentation Forms-B":"FE70,FEFF",
179
- "Arabic Supplement":"0750,077F",
180
- "Armenian":"0530,058F",
181
- "Arrows":"2190,21FF",
182
- "Basic Latin":"0020,007F",
183
- "Bengali":"0980,09FF",
184
- "Block Elements":"2580,259F",
185
- "Bopomofo Extended":"31A0,31BF",
186
- "Bopomofo":"3100,312F",
187
- "Box Drawing":"2500,257F",
188
- "Braille Patterns":"2800,28FF",
189
- "Buginese":"1A00,1A1F",
190
- "Buhid":"1740,175F",
191
- "Byzantine Musical Symbols":"1D000,1D0FF",
192
- "CJK Compatibility Forms":"FE30,FE4F",
193
- "CJK Compatibility Ideographs Supplement":"2F800,2FA1F",
194
- "CJK Compatibility Ideographs":"F900,FAFF",
195
- "CJK Compatibility":"3300,33FF",
196
- "CJK Radicals Supplement":"2E80,2EFF",
197
- "CJK Strokes":"31C0,31EF",
198
- "CJK Symbols and Punctuation":"3000,303F",
199
- "CJK Unified Ideographs Extension A":"3400,4DBF",
200
- "CJK Unified Ideographs Extension B":"20000,2A6DF",
201
- "CJK Unified Ideographs":"4E00,9FFF",
202
- "Cherokee":"13A0,13FF",
203
- "Combining Diacritical Marks Supplement":"1DC0,1DFF",
204
- "Combining Diacritical Marks for Symbols":"20D0,20FF",
205
- "Combining Diacritical Marks":"0300,036F",
206
- "Combining Half Marks":"FE20,FE2F",
207
- "Control Pictures":"2400,243F",
208
- "Coptic":"2C80,2CFF",
209
- "Currency Symbols":"20A0,20CF",
210
- "Cypriot Syllabary":"10800,1083F",
211
- "Cyrillic Supplement":"0500,052F",
212
- "Cyrillic":"0400,04FF",
213
- "Deseret":"10400,1044F",
214
- "Devanagari":"0900,097F",
215
- "Dingbats":"2700,27BF",
216
- "Enclosed Alphanumerics":"2460,24FF",
217
- "Enclosed CJK Letters and Months":"3200,32FF",
218
- "Ethiopic Extended":"2D80,2DDF",
219
- "Ethiopic Supplement":"1380,139F",
220
- "Ethiopic":"1200,137F",
221
- "General Punctuation":"2000,206F",
222
- "Geometric Shapes":"25A0,25FF",
223
- "Georgian Supplement":"2D00,2D2F",
224
- "Georgian":"10A0,10FF",
225
- "Glagolitic":"2C00,2C5F",
226
- "Gothic":"10330,1034F",
227
- "Greek Extended":"1F00,1FFF",
228
- "Greek and Coptic":"0370,03FF",
229
- "Gujarati":"0A80,0AFF",
230
- "Gurmukhi":"0A00,0A7F",
231
- "Halfwidth and Fullwidth Forms":"FF00,FFEF",
232
- "Hangul Compatibility Jamo":"3130,318F",
233
- "Hangul Jamo":"1100,11FF",
234
- "Hangul Syllables":"AC00,D7AF",
235
- "Hanunoo":"1720,173F",
236
- "Hebrew":"0590,05FF",
237
- "High Private Use Surrogates":"DB80,DBFF",
238
- "High Surrogates":"D800,DB7F",
239
- "Hiragana":"3040,309F",
240
- "IPA Extensions":"0250,02AF",
241
- "Ideographic Description Characters":"2FF0,2FFF",
242
- "Kanbun":"3190,319F",
243
- "Kangxi Radicals":"2F00,2FDF",
244
- "Kannada":"0C80,0CFF",
245
- "Katakana Phonetic Extensions":"31F0,31FF",
246
- "Katakana":"30A0,30FF",
247
- "Kharoshthi":"10A00,10A5F",
248
- "Khmer Symbols":"19E0,19FF",
249
- "Khmer":"1780,17FF",
250
- "Lao":"0E80,0EFF",
251
- "Latin Extended Additional":"1E00,1EFF",
252
- "Latin Extended-A":"0100,017F",
253
- "Latin Extended-B":"0180,024F",
254
- "Latin-1 Supplement":"0080,00FF",
255
- "Letterlike Symbols":"2100,214F",
256
- "Limbu":"1900,194F",
257
- "Linear B Ideograms":"10080,100FF",
258
- "Linear B Syllabary":"10000,1007F",
259
- "Low Surrogates":"DC00,DFFF",
260
- "Malayalam":"0D00,0D7F",
261
- "Mathematical Alphanumeric Symbols":"1D400,1D7FF",
262
- "Mathematical Operators":"2200,22FF",
263
- "Miscellaneous Mathematical Symbols-A":"27C0,27EF",
264
- "Miscellaneous Mathematical Symbols-B":"2980,29FF",
265
- "Miscellaneous Symbols and Arrows":"2B00,2BFF",
266
- "Miscellaneous Symbols":"2600,26FF",
267
- "Miscellaneous Technical":"2300,23FF",
268
- "Modifier Tone Letters":"A700,A71F",
269
- "Mongolian":"1800,18AF",
270
- "Musical Symbols":"1D100,1D1FF",
271
- "Myanmar":"1000,109F",
272
- "New Tai Lue":"1980,19DF",
273
- "Number Forms":"2150,218F",
274
- "Ogham":"1680,169F",
275
- "Old Italic":"10300,1032F",
276
- "Old Persian":"103A0,103DF",
277
- "Optical Character Recognition":"2440,245F",
278
- "Oriya":"0B00,0B7F",
279
- "Osmanya":"10480,104AF",
280
- "Phonetic Extensions Supplement":"1D80,1DBF",
281
- "Phonetic Extensions":"1D00,1D7F",
282
- "Private Use Area":"E000,F8FF",
283
- "Runic":"16A0,16FF",
284
- "Shavian":"10450,1047F",
285
- "Sinhala":"0D80,0DFF",
286
- "Small Form Variants":"FE50,FE6F",
287
- "Spacing Modifier Letters":"02B0,02FF",
288
- "Specials":"FFF0,FFFF",
289
- "Superscripts and Subscripts":"2070,209F",
290
- "Supplemental Arrows-A":"27F0,27FF",
291
- "Supplemental Arrows-B":"2900,297F",
292
- "Supplemental Mathematical Operators":"2A00,2AFF",
293
- "Supplemental Punctuation":"2E00,2E7F",
294
- "Syloti Nagri":"A800,A82F",
295
- "Syriac":"0700,074F",
296
- "Tagalog":"1700,171F",
297
- "Tagbanwa":"1760,177F",
298
- "Tags":"E0000,E007F",
299
- "Tai Le":"1950,197F",
300
- "Tai Xuan Jing Symbols":"1D300,1D35F",
301
- "Tamil":"0B80,0BFF",
302
- "Telugu":"0C00,0C7F",
303
- "Thaana":"0780,07BF",
304
- "Thai":"0E00,0E7F",
305
- "Tibetan":"0F00,0FFF",
306
- "Tifinagh":"2D30,2D7F",
307
- "Ugaritic":"10380,1039F",
308
- "Unified Canadian Aboriginal Syllabics":"1400,167F",
309
- "Variation Selectors Supplement":"E0100,E01EF",
310
- "Variation Selectors":"FE00,FE0F",
311
- "Vertical Forms":"FE10,FE1F",
312
- "Yi Radicals":"A490,A4CF",
313
- "Yi Syllables":"A000,A48F",
314
- "Yijing Hexagram Symbols":"4DC0,4DFF"
315
- };
316
-
317
- var insert="charmap_insert";
318
-
319
- function map_load(){
320
- editArea=opener.editArea;
321
- // translate the document
322
- insert= editArea.get_translation(insert, "word");
323
- //alert(document.title);
324
- document.title= editArea.get_translation(document.title, "template");
325
- document.body.innerHTML= editArea.get_translation(document.body.innerHTML, "template");
326
- //document.title= editArea.get_translation(document.getElementBytitle, "template");
327
-
328
- var selected_lang=opener.EditArea_charmap.default_language.toLowerCase();
329
- var selected=0;
330
-
331
- var select= document.getElementById("select_range")
332
- for(var i in char_range_list){
333
- if(i.toLowerCase()==selected_lang)
334
- selected=select.options.length;
335
- select.options[select.options.length]=new Option(i, char_range_list[i]);
336
- }
337
- select.options[selected].selected=true;
338
- /* start=0;
339
- end=127;
340
- content="";
341
- for(var i=start; i<end; i++){
342
- content+="&#"+i+"; ";
343
- }
344
- document.getElementById("char_list").innerHTML=content;*/
345
- renderCharMapHTML();
346
- }
347
-
348
-
349
- function renderCharMapHTML() {
350
- range= document.getElementById("select_range").value.split(",");
351
-
352
- start= parseInt(range[0],16);
353
- end= parseInt(range[1],16);
354
- var charsPerRow = 20, tdWidth=20, tdHeight=20;
355
- html="";
356
- for (var i=start; i<end; i++) {
357
- html+="<a class='char' onmouseover='previewChar(\""+ i + "\");' onclick='insertChar(\""+ i + "\");' title='"+ insert +"'>"+ String.fromCharCode(i) +"</a>";
358
- }
359
- document.getElementById("char_list").innerHTML= html;
360
- document.getElementById("preview_char").innerHTML="";
361
- }
362
-
363
- function previewChar(i){
364
- document.getElementById("preview_char").innerHTML= String.fromCharCode(i);
365
- document.getElementById("preview_code").innerHTML= "&amp;#"+ i +";";
366
- }
367
-
368
- function insertChar(i){
369
- opener.parent.editAreaLoader.setSelectedText(editArea.id, String.fromCharCode( i));
370
- range= opener.parent.editAreaLoader.getSelectionRange(editArea.id);
371
- opener.parent.editAreaLoader.setSelectionRange(editArea.id, range["end"], range["end"]);
372
- window.focus();
373
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/bg.js DELETED
@@ -1,12 +0,0 @@
1
- /*
2
- * Bulgarian translation
3
- * Author: Valentin Hristov
4
- * Company: SOFTKIT Bulgarian
5
- * Site: http://www.softkit-bg.com
6
- */
7
- editArea.add_lang("bg",{
8
- charmap_but: "Виртуална клавиатура",
9
- charmap_title: "Виртуална клавиатура",
10
- charmap_choose_block: "избери езиков блок",
11
- charmap_insert:"постави този символ"
12
- });
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/cs.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("cs",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/de.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("de",{
2
- charmap_but: "Sonderzeichen",
3
- charmap_title: "Sonderzeichen",
4
- charmap_choose_block: "Bereich ausw&auml;hlen",
5
- charmap_insert: "dieses Zeichen einf&uuml;gen"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/dk.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("dk",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/en.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("en",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/eo.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("eo",{
2
- charmap_but: "Ekranklavaro",
3
- charmap_title: "Ekranklavaro",
4
- charmap_choose_block: "Elekto de lingvo",
5
- charmap_insert:"enmeti tiun signaron"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/es.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("es",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/fr.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("fr",{
2
- charmap_but: "Clavier visuel",
3
- charmap_title: "Clavier visuel",
4
- charmap_choose_block: "choix du language",
5
- charmap_insert:"ins&eacute;rer ce caract&egrave;re"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/hr.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("hr",{
2
- charmap_but: "Virtualna tipkovnica",
3
- charmap_title: "Virtualna tipkovnica",
4
- charmap_choose_block: "Odaberi blok s jezikom",
5
- charmap_insert:"Ubaci taj znak"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/it.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("it",{
2
- charmap_but: "Tastiera visuale",
3
- charmap_title: "Tastiera visuale",
4
- charmap_choose_block: "seleziona blocco",
5
- charmap_insert:"inserisci questo carattere"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/ja.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("ja",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/mk.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("mkn",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/nl.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("nl",{
2
- charmap_but: "Visueel toetsenbord",
3
- charmap_title: "Visueel toetsenbord",
4
- charmap_choose_block: "Kies een taal blok",
5
- charmap_insert:"Voeg dit symbool in"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/pl.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("pl",{
2
- charmap_but: "Klawiatura ekranowa",
3
- charmap_title: "Klawiatura ekranowa",
4
- charmap_choose_block: "wybierz grupę znaków",
5
- charmap_insert:"wstaw ten znak"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/pt.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("pt",{
2
- charmap_but: "Visual keyboard",
3
- charmap_title: "Visual keyboard",
4
- charmap_choose_block: "select language block",
5
- charmap_insert:"insert this character"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/ru.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("ru",{
2
- charmap_but: "Визуальная клавиатура",
3
- charmap_title: "Визуальная клавиатура",
4
- charmap_choose_block: "выбрать языковой блок",
5
- charmap_insert:"вставить этот символ"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/sk.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("sk",{
2
- charmap_but: "Vizuálna klávesnica",
3
- charmap_title: "Vizuálna klávesnica",
4
- charmap_choose_block: "vyber jazykový blok",
5
- charmap_insert: "vlož tento znak"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/langs/zh.js DELETED
@@ -1,6 +0,0 @@
1
- editArea.add_lang("zh",{
2
- charmap_but: "软键盘",
3
- charmap_title: "软键盘",
4
- charmap_choose_block: "选择一个语言块",
5
- charmap_insert:"插入此字符"
6
- });
 
 
 
 
 
 
includes/edit_area/plugins/charmap/popup.html DELETED
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
4
- <head>
5
- <title>{$charmap_title}</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <link rel="stylesheet" type="text/css" href="css/charmap.css" />
8
- <script language="Javascript" type="text/javascript" src="jscripts/map.js">
9
- </script>
10
- </head>
11
- <body onload='map_load()'>
12
- <div id='preview_code' class='preview'></div>
13
- <div id='preview_char' class='preview'></div>
14
- <h1>{$charmap_title}:</h1>
15
- <select id='select_range' onchange='renderCharMapHTML()' title='{$charmap_choose_block}'>
16
- </select>
17
- <div id='char_list'>
18
-
19
- </div>
20
-
21
-
22
-
23
- </body>
24
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/test/css/test.css DELETED
@@ -1,3 +0,0 @@
1
- select#test_select{
2
- background-color: #FF0000;
3
- }
 
 
 
includes/edit_area/plugins/test/images/Thumbs.db DELETED
Binary file
includes/edit_area/plugins/test/images/test.gif DELETED
Binary file
includes/edit_area/plugins/test/langs/bg.js DELETED
@@ -1,10 +0,0 @@
1
- /*
2
- * Bulgarian translation
3
- * Author: Valentin Hristov
4
- * Company: SOFTKIT Bulgarian
5
- * Site: http://www.softkit-bg.com
6
- */
7
- editArea.add_lang("bg",{
8
- test_select: "избери таг",
9
- test_but: "тествай копието"
10
- });
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/test/langs/cs.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("cs",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/de.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("de",{
2
- test_select: "Tag ausw&auml;hlen",
3
- test_but: "Test Button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/dk.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("dk",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/en.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("en",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/eo.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("eo",{
2
- test_select:"elekto de marko",
3
- test_but: "provo-butono"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/es.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("es",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/fr.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("fr",{
2
- test_select:"choix balise",
3
- test_but: "bouton de test"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/hr.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("hr",{
2
- test_select: "Odaberi tag",
3
- test_but: "Probna tipka"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/it.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("it",{
2
- test_select: "seleziona tag",
3
- test_but: "pulsante di test"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/ja.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("ja",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/mk.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("mk",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/nl.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("nl",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/pl.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("pl",{
2
- test_select: "wybierz tag",
3
- test_but: "test"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/pt.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("pt",{
2
- test_select: "select tag",
3
- test_but: "test button"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/ru.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("ru",{
2
- test_select: "выбрать тэг",
3
- test_but: "тестировать кнопку"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/sk.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("sk",{
2
- test_select: "vyber tag",
3
- test_but: "testovacie tlačidlo"
4
- });
 
 
 
 
includes/edit_area/plugins/test/langs/zh.js DELETED
@@ -1,4 +0,0 @@
1
- editArea.add_lang("zh",{
2
- test_select: "选择标签",
3
- test_but: "测试按钮"
4
- });
 
 
 
 
includes/edit_area/plugins/test/test.js DELETED
@@ -1,110 +0,0 @@
1
- /**
2
- * Plugin designed for test prupose. It add a button (that manage an alert) and a select (that allow to insert tags) in the toolbar.
3
- * This plugin also disable the "f" key in the editarea, and load a CSS and a JS file
4
- */
5
- var EditArea_test= {
6
- /**
7
- * Get called once this file is loaded (editArea still not initialized)
8
- *
9
- * @return nothing
10
- */
11
- init: function(){
12
- // alert("test init: "+ this._someInternalFunction(2, 3));
13
- editArea.load_css(this.baseURL+"css/test.css");
14
- editArea.load_script(this.baseURL+"test2.js");
15
- }
16
- /**
17
- * Returns the HTML code for a specific control string or false if this plugin doesn't have that control.
18
- * A control can be a button, select list or any other HTML item to present in the EditArea user interface.
19
- * Language variables such as {$lang_somekey} will also be replaced with contents from
20
- * the language packs.
21
- *
22
- * @param {string} ctrl_name: the name of the control to add
23
- * @return HTML code for a specific control or false.
24
- * @type string or boolean
25
- */
26
- ,get_control_html: function(ctrl_name){
27
- switch(ctrl_name){
28
- case "test_but":
29
- // Control id, button img, command
30
- return parent.editAreaLoader.get_button_html('test_but', 'test.gif', 'test_cmd', false, this.baseURL);
31
- case "test_select":
32
- html= "<select id='test_select' onchange='javascript:editArea.execCommand(\"test_select_change\")' fileSpecific='no'>"
33
- +" <option value='-1'>{$test_select}</option>"
34
- +" <option value='h1'>h1</option>"
35
- +" <option value='h2'>h2</option>"
36
- +" <option value='h3'>h3</option>"
37
- +" <option value='h4'>h4</option>"
38
- +" <option value='h5'>h5</option>"
39
- +" <option value='h6'>h6</option>"
40
- +" </select>";
41
- return html;
42
- }
43
- return false;
44
- }
45
- /**
46
- * Get called once EditArea is fully loaded and initialised
47
- *
48
- * @return nothing
49
- */
50
- ,onload: function(){
51
- alert("test load");
52
- }
53
-
54
- /**
55
- * Is called each time the user touch a keyboard key.
56
- *
57
- * @param (event) e: the keydown event
58
- * @return true - pass to next handler in chain, false - stop chain execution
59
- * @type boolean
60
- */
61
- ,onkeydown: function(e){
62
- var str= String.fromCharCode(e.keyCode);
63
- // desactivate the "f" character
64
- if(str.toLowerCase()=="f"){
65
- return true;
66
- }
67
- return false;
68
- }
69
-
70
- /**
71
- * Executes a specific command, this function handles plugin commands.
72
- *
73
- * @param {string} cmd: the name of the command being executed
74
- * @param {unknown} param: the parameter of the command
75
- * @return true - pass to next handler in chain, false - stop chain execution
76
- * @type boolean
77
- */
78
- ,execCommand: function(cmd, param){
79
- // Handle commands
80
- switch(cmd){
81
- case "test_select_change":
82
- var val= document.getElementById("test_select").value;
83
- if(val!=-1)
84
- parent.editAreaLoader.insertTags(editArea.id, "<"+val+">", "</"+val+">");
85
- document.getElementById("test_select").options[0].selected=true;
86
- return false;
87
- case "test_cmd":
88
- alert("user clicked on test_cmd");
89
- return false;
90
- }
91
- // Pass to next handler in chain
92
- return true;
93
- }
94
-
95
- /**
96
- * This is just an internal plugin method, prefix all internal methods with a _ character.
97
- * The prefix is needed so they doesn't collide with future EditArea callback functions.
98
- *
99
- * @param {string} a Some arg1.
100
- * @param {string} b Some arg2.
101
- * @return Some return.
102
- * @type unknown
103
- */
104
- ,_someInternalFunction : function(a, b) {
105
- return a+b;
106
- }
107
- };
108
-
109
- // Adds the plugin class to the list of available EditArea plugins
110
- editArea.add_plugin("test", EditArea_test);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/plugins/test/test2.js DELETED
@@ -1 +0,0 @@
1
- alert("test2.js is loaded from test plugin");
 
includes/edit_area/reg_syntax.js DELETED
@@ -1,166 +0,0 @@
1
- EditAreaLoader.prototype.get_regexp= function(text_array){
2
- //res="( |=|\\n|\\r|\\[|\\(|µ|)(";
3
- res="(\\b)(";
4
- for(i=0; i<text_array.length; i++){
5
- if(i>0)
6
- res+="|";
7
- //res+="("+ tab_text[i] +")";
8
- //res+=tab_text[i].replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\{|\})/g, "\\$1");
9
- res+=this.get_escaped_regexp(text_array[i]);
10
- }
11
- //res+=")( |\\.|:|\\{|\\(|\\)|\\[|\\]|\'|\"|\\r|\\n|\\t|$)";
12
- res+=")(\\b)";
13
- reg= new RegExp(res);
14
-
15
- return res;
16
- };
17
-
18
-
19
- EditAreaLoader.prototype.get_escaped_regexp= function(str){
20
- return str.toString().replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g, "\\$1");
21
- };
22
-
23
- EditAreaLoader.prototype.init_syntax_regexp= function(){
24
- var lang_style= {};
25
- for(var lang in this.load_syntax){
26
- if(!this.syntax[lang]) // init the regexp if not already initialized
27
- {
28
- this.syntax[lang]= {};
29
- this.syntax[lang]["keywords_reg_exp"]= {};
30
- this.keywords_reg_exp_nb=0;
31
-
32
- if(this.load_syntax[lang]['KEYWORDS']){
33
- param="g";
34
- if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false)
35
- param+="i";
36
- for(var i in this.load_syntax[lang]['KEYWORDS']){
37
- if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function") continue;
38
- this.syntax[lang]["keywords_reg_exp"][i]= new RegExp(this.get_regexp( this.load_syntax[lang]['KEYWORDS'][i] ), param);
39
- this.keywords_reg_exp_nb++;
40
- }
41
- }
42
-
43
- if(this.load_syntax[lang]['OPERATORS']){
44
- var str="";
45
- var nb=0;
46
- for(var i in this.load_syntax[lang]['OPERATORS']){
47
- if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function") continue;
48
- if(nb>0)
49
- str+="|";
50
- str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);
51
- nb++;
52
- }
53
- if(str.length>0)
54
- this.syntax[lang]["operators_reg_exp"]= new RegExp("("+str+")","g");
55
- }
56
-
57
- if(this.load_syntax[lang]['DELIMITERS']){
58
- var str="";
59
- var nb=0;
60
- for(var i in this.load_syntax[lang]['DELIMITERS']){
61
- if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function") continue;
62
- if(nb>0)
63
- str+="|";
64
- str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);
65
- nb++;
66
- }
67
- if(str.length>0)
68
- this.syntax[lang]["delimiters_reg_exp"]= new RegExp("("+str+")","g");
69
- }
70
-
71
-
72
- // /(("(\\"|[^"])*"?)|('(\\'|[^'])*'?)|(//(.|\r|\t)*\n)|(/\*(.|\n|\r|\t)*\*/)|(<!--(.|\n|\r|\t)*-->))/gi
73
- var syntax_trace=[];
74
-
75
- // /("(?:[^"\\]*(\\\\)*(\\"?)?)*("|$))/g
76
-
77
- this.syntax[lang]["quotes"]={};
78
- var quote_tab= [];
79
- if(this.load_syntax[lang]['QUOTEMARKS']){
80
- for(var i in this.load_syntax[lang]['QUOTEMARKS']){
81
- if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function") continue;
82
- var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);
83
- this.syntax[lang]["quotes"][x]=x;
84
- //quote_tab[quote_tab.length]="("+x+"(?:\\\\"+x+"|[^"+x+"])*("+x+"|$))";
85
- //previous working : quote_tab[quote_tab.length]="("+x+"(?:[^"+x+"\\\\]*(\\\\\\\\)*(\\\\"+x+"?)?)*("+x+"|$))";
86
- quote_tab[quote_tab.length]="("+ x +"(\\\\.|[^"+ x +"])*(?:"+ x +"|$))";
87
-
88
- syntax_trace.push(x);
89
- }
90
- }
91
-
92
- this.syntax[lang]["comments"]={};
93
- if(this.load_syntax[lang]['COMMENT_SINGLE']){
94
- for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){
95
- if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function") continue;
96
- var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);
97
- quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";
98
- syntax_trace.push(x);
99
- this.syntax[lang]["comments"][x]="\n";
100
- }
101
- }
102
- // (/\*(.|[\r\n])*?\*/)
103
- if(this.load_syntax[lang]['COMMENT_MULTI']){
104
- for(var i in this.load_syntax[lang]['COMMENT_MULTI']){
105
- if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function") continue;
106
- var start=this.get_escaped_regexp(i);
107
- var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);
108
- quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";
109
- syntax_trace.push(start);
110
- syntax_trace.push(end);
111
- this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];
112
- }
113
- }
114
- if(quote_tab.length>0)
115
- this.syntax[lang]["comment_or_quote_reg_exp"]= new RegExp("("+quote_tab.join("|")+")","gi");
116
-
117
- if(syntax_trace.length>0) // /((.|\n)*?)(\\*("|'|\/\*|\*\/|\/\/|$))/g
118
- this.syntax[lang]["syntax_trace_regexp"]= new RegExp("((.|\n)*?)(\\\\*("+ syntax_trace.join("|") +"|$))", "gmi");
119
-
120
- if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){
121
- this.syntax[lang]["script_delimiters"]= {};
122
- for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){
123
- if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function") continue;
124
- this.syntax[lang]["script_delimiters"][i]= this.load_syntax[lang]['SCRIPT_DELIMITERS'];
125
- }
126
- }
127
-
128
- this.syntax[lang]["custom_regexp"]= {};
129
- if(this.load_syntax[lang]['REGEXPS']){
130
- for(var i in this.load_syntax[lang]['REGEXPS']){
131
- if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function") continue;
132
- var val= this.load_syntax[lang]['REGEXPS'][i];
133
- if(!this.syntax[lang]["custom_regexp"][val['execute']])
134
- this.syntax[lang]["custom_regexp"][val['execute']]= {};
135
- this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp' : new RegExp(val['search'], val['modifiers'])
136
- , 'class' : val['class']};
137
- }
138
- }
139
-
140
- if(this.load_syntax[lang]['STYLES']){
141
- lang_style[lang]= {};
142
- for(var i in this.load_syntax[lang]['STYLES']){
143
- if(typeof(this.load_syntax[lang]['STYLES'][i])=="function") continue;
144
- if(typeof(this.load_syntax[lang]['STYLES'][i]) != "string"){
145
- for(var j in this.load_syntax[lang]['STYLES'][i]){
146
- lang_style[lang][j]= this.load_syntax[lang]['STYLES'][i][j];
147
- }
148
- }else{
149
- lang_style[lang][i]= this.load_syntax[lang]['STYLES'][i];
150
- }
151
- }
152
- }
153
- // build style string
154
- var style="";
155
- for(var i in lang_style[lang]){
156
- if(lang_style[lang][i].length>0){
157
- style+= "."+ lang +" ."+ i.toLowerCase() +" span{"+lang_style[lang][i]+"}\n";
158
- style+= "."+ lang +" ."+ i.toLowerCase() +"{"+lang_style[lang][i]+"}\n";
159
- }
160
- }
161
- this.syntax[lang]["styles"]=style;
162
- }
163
- }
164
- };
165
-
166
- editAreaLoader.waiting_loading["reg_syntax.js"]= "loaded";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/basic.js DELETED
@@ -1,70 +0,0 @@
1
- editAreaLoader.load_syntax["basic"] = {
2
- 'DISPLAY_NAME' : 'Basic'
3
- ,'COMMENT_SINGLE' : {1 : "'", 2 : 'rem'}
4
- ,'COMMENT_MULTI' : { }
5
- ,'QUOTEMARKS' : {1: '"'}
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'statements' : [
9
- 'if','then','for','wend','while',
10
- 'else','elseif','select','case','end select',
11
- 'until','next','step','to','end if', 'call'
12
- ]
13
- ,'keywords' : [
14
- 'sub', 'end sub', 'function', 'end function', 'exit',
15
- 'exit function', 'dim', 'redim', 'shared', 'const',
16
- 'is', 'absolute', 'access', 'any', 'append', 'as',
17
- 'base', 'beep', 'binary', 'bload', 'bsave', 'chain',
18
- 'chdir', 'circle', 'clear', 'close', 'cls', 'color',
19
- 'com', 'common', 'data', 'date', 'declare', 'def',
20
- 'defdbl', 'defint', 'deflng', 'defsng', 'defstr',
21
- 'double', 'draw', 'environ', 'erase', 'error', 'field',
22
- 'files', 'fn', 'get', 'gosub', 'goto', 'integer', 'key',
23
- 'kill', 'let', 'line', 'list', 'locate', 'lock', 'long',
24
- 'lprint', 'lset', 'mkdir', 'name', 'off', 'on', 'open',
25
- 'option', 'out', 'output', 'paint', 'palette', 'pcopy',
26
- 'poke', 'preset', 'print', 'pset', 'put', 'random',
27
- 'randomize', 'read', 'reset', 'restore', 'resume',
28
- 'return', 'rmdir', 'rset', 'run', 'screen', 'seg',
29
- 'shell', 'single', 'sleep', 'sound', 'static', 'stop',
30
- 'strig', 'string', 'swap', 'system', 'time', 'timer',
31
- 'troff', 'tron', 'type', 'unlock', 'using', 'view',
32
- 'wait', 'width', 'window', 'write'
33
- ]
34
- ,'functions' : [
35
- 'abs', 'asc', 'atn', 'cdbl', 'chr', 'cint', 'clng',
36
- 'cos', 'csng', 'csrlin', 'cvd', 'cvdmbf', 'cvi', 'cvl',
37
- 'cvs', 'cvsmbf', 'eof', 'erdev', 'erl', 'err', 'exp',
38
- 'fileattr', 'fix', 'fre', 'freefile', 'hex', 'inkey',
39
- 'inp', 'input', 'instr', 'int', 'ioctl', 'lbound',
40
- 'lcase', 'left', 'len', 'loc', 'lof', 'log', 'lpos',
41
- 'ltrim', 'mid', 'mkd', 'mkdmbf', 'mki', 'mkl', 'mks',
42
- 'mksmbf', 'oct', 'peek', 'pen', 'play', 'pmap', 'point',
43
- 'pos', 'right', 'rnd', 'rtrim', 'seek', 'sgn', 'sin',
44
- 'space', 'spc', 'sqr', 'stick', 'str', 'tab', 'tan',
45
- 'ubound', 'ucase', 'val', 'varptr', 'varseg'
46
- ]
47
- ,'operators' : [
48
- 'and', 'eqv', 'imp', 'mod', 'not', 'or', 'xor'
49
- ]
50
- }
51
- ,'OPERATORS' :[
52
- '+', '-', '/', '*', '=', '<', '>', '!', '&'
53
- ]
54
- ,'DELIMITERS' :[
55
- '(', ')', '[', ']', '{', '}'
56
- ]
57
- ,'STYLES' : {
58
- 'COMMENTS': 'color: #99CC00;'
59
- ,'QUOTESMARKS': 'color: #333399;'
60
- ,'KEYWORDS' : {
61
- 'keywords' : 'color: #3366FF;'
62
- ,'functions' : 'color: #0000FF;'
63
- ,'statements' : 'color: #3366FF;'
64
- ,'operators' : 'color: #FF0000;'
65
- }
66
- ,'OPERATORS' : 'color: #FF0000;'
67
- ,'DELIMITERS' : 'color: #0000FF;'
68
-
69
- }
70
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/brainfuck.js DELETED
@@ -1,45 +0,0 @@
1
- editAreaLoader.load_syntax["brainfuck"] = {
2
- 'DISPLAY_NAME' : 'Brainfuck'
3
- ,'COMMENT_SINGLE' : {}
4
- ,'COMMENT_MULTI' : {}
5
- ,'QUOTEMARKS' : {}
6
- ,'KEYWORD_CASE_SENSITIVE' : true
7
- ,'OPERATORS' :[
8
- '+', '-'
9
- ]
10
- ,'DELIMITERS' :[
11
- '[', ']'
12
- ]
13
- ,'REGEXPS' : {
14
- 'bfispis' : {
15
- 'search' : '()(\\.)()'
16
- ,'class' : 'bfispis'
17
- ,'modifiers' : 'g'
18
- ,'execute' : 'before'
19
- }
20
- ,'bfupis' : {
21
- 'search' : '()(\\,)()'
22
- ,'class' : 'bfupis'
23
- ,'modifiers' : 'g'
24
- ,'execute' : 'before'
25
- }
26
- ,'bfmemory' : {
27
- 'search' : '()([<>])()'
28
- ,'class' : 'bfmemory'
29
- ,'modifiers' : 'g'
30
- ,'execute' : 'before'
31
- }
32
- }
33
- ,'STYLES' : {
34
- 'COMMENTS': 'color: #AAAAAA;'
35
- ,'QUOTESMARKS': 'color: #6381F8;'
36
- ,'OPERATORS' : 'color: #88AA00;'
37
- ,'DELIMITERS' : 'color: #00C138;'
38
- ,'REGEXPS' : {
39
- 'bfispis' : 'color: #EE0000;'
40
- ,'bfupis' : 'color: #4455ee;'
41
- ,'bfmemory' : 'color: #DD00DD;'
42
- }
43
- }
44
- };
45
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/c.js DELETED
@@ -1,63 +0,0 @@
1
- editAreaLoader.load_syntax["c"] = {
2
- 'DISPLAY_NAME' : 'C'
3
- ,'COMMENT_SINGLE' : {1 : '//'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
6
- ,'KEYWORD_CASE_SENSITIVE' : true
7
- ,'KEYWORDS' : {
8
- 'constants' : [
9
- 'NULL', 'false', 'stdin', 'stdout', 'stderr', 'true'
10
- ]
11
- ,'types' : [
12
- 'FILE', 'auto', 'char', 'const', 'double',
13
- 'extern', 'float', 'inline', 'int', 'long', 'register',
14
- 'short', 'signed', 'size_t', 'static', 'struct',
15
- 'time_t', 'typedef', 'union', 'unsigned', 'void',
16
- 'volatile'
17
- ]
18
- ,'statements' : [
19
- 'do', 'else', 'enum', 'for', 'goto', 'if', 'sizeof',
20
- 'switch', 'while'
21
- ]
22
- ,'keywords' : [
23
- 'break', 'case', 'continue', 'default', 'delete',
24
- 'return'
25
- ]
26
- }
27
- ,'OPERATORS' :[
28
- '+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
29
- ]
30
- ,'DELIMITERS' :[
31
- '(', ')', '[', ']', '{', '}'
32
- ]
33
- ,'REGEXPS' : {
34
- 'precompiler' : {
35
- 'search' : '()(#[^\r\n]*)()'
36
- ,'class' : 'precompiler'
37
- ,'modifiers' : 'g'
38
- ,'execute' : 'before'
39
- }
40
- /* ,'precompilerstring' : {
41
- 'search' : '(#[\t ]*include[\t ]*)([^\r\n]*)([^\r\n]*[\r\n])'
42
- ,'class' : 'precompilerstring'
43
- ,'modifiers' : 'g'
44
- ,'execute' : 'before'
45
- }*/
46
- }
47
- ,'STYLES' : {
48
- 'COMMENTS': 'color: #AAAAAA;'
49
- ,'QUOTESMARKS': 'color: #6381F8;'
50
- ,'KEYWORDS' : {
51
- 'constants' : 'color: #EE0000;'
52
- ,'types' : 'color: #0000EE;'
53
- ,'statements' : 'color: #60CA00;'
54
- ,'keywords' : 'color: #48BDDF;'
55
- }
56
- ,'OPERATORS' : 'color: #FF00FF;'
57
- ,'DELIMITERS' : 'color: #0038E1;'
58
- ,'REGEXPS' : {
59
- 'precompiler' : 'color: #009900;'
60
- ,'precompilerstring' : 'color: #994400;'
61
- }
62
- }
63
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/coldfusion.js DELETED
@@ -1,120 +0,0 @@
1
- editAreaLoader.load_syntax["coldfusion"] = {
2
- 'DISPLAY_NAME' : 'Coldfusion'
3
- ,'COMMENT_SINGLE' : {1 : '//', 2 : '#'}
4
- ,'COMMENT_MULTI' : {'<!--' : '-->'}
5
- ,'COMMENT_MULTI2' : {'<!---' : '--->'}
6
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
7
- ,'KEYWORD_CASE_SENSITIVE' : false
8
- ,'KEYWORDS' : {
9
- 'statements' : [
10
- 'include', 'require', 'include_once', 'require_once',
11
- 'for', 'foreach', 'as', 'if', 'elseif', 'else', 'while', 'do', 'endwhile',
12
- 'endif', 'switch', 'case', 'endswitch',
13
- 'return', 'break', 'continue'
14
- ]
15
- ,'reserved' : [
16
- 'AND', 'break', 'case', 'CONTAIN', 'CONTAINS', 'continue', 'default', 'do',
17
- 'DOES', 'else', 'EQ', 'EQUAL', 'EQUALTO', 'EQV', 'FALSE', 'for', 'GE',
18
- 'GREATER', 'GT', 'GTE', 'if', 'IMP', 'in', 'IS', 'LE', 'LESS', 'LT', 'LTE',
19
- 'MOD', 'NEQ', 'NOT', 'OR', 'return', 'switch', 'THAN', 'TO', 'TRUE', 'var',
20
- 'while', 'XOR'
21
- ]
22
- ,'functions' : [
23
- 'Abs', 'ACos', 'ArrayAppend', 'ArrayAvg', 'ArrayClear', 'ArrayDeleteAt', 'ArrayInsertAt',
24
- 'ArrayIsEmpty', 'ArrayLen', 'ArrayMax', 'ArrayMin', 'ArrayNew', 'ArrayPrepend', 'ArrayResize',
25
- 'ArraySet', 'ArraySort', 'ArraySum', 'ArraySwap', 'ArrayToList', 'Asc', 'ASin', 'Atn', 'AuthenticatedContext',
26
- 'AuthenticatedUser', 'BitAnd', 'BitMaskClear', 'BitMaskRead', 'BitMaskSet', 'BitNot', 'BitOr',
27
- 'BitSHLN', 'BitSHRN', 'BitXor', 'Ceiling', 'Chr', 'CJustify', 'Compare', 'CompareNoCase', 'Cos',
28
- 'CreateDate', 'CreateDateTime', 'CreateODBCDate', 'CreateODBCDateTime', 'CreateODBCTime',
29
- 'CreateTime', 'CreateTimeSpan', 'DateAdd', 'DateCompare', 'DateConvert', 'DateDiff',
30
- 'DateFormat', 'DatePart', 'Day', 'DayOfWeek', 'DayOfWeekAsString', 'DayOfYear', 'DaysInMonth',
31
- 'DaysInYear', 'DE', 'DecimalFormat', 'DecrementValue', 'Decrypt', 'DeleteClientVariable',
32
- 'DirectoryExists', 'DollarFormat', 'Duplicate', 'Encrypt', 'Evaluate', 'Exp', 'ExpandPath',
33
- 'FileExists', 'Find', 'FindNoCase', 'FindOneOf', 'FirstDayOfMonth', 'Fix', 'FormatBaseN',
34
- 'GetBaseTagData', 'GetBaseTagList', 'GetBaseTemplatePath', 'GetClientVariablesList',
35
- 'GetCurrentTemplatePath', 'GetDirectoryFromPath', 'GetException', 'GetFileFromPath',
36
- 'GetFunctionList', 'GetHttpTimeString', 'GetHttpRequestData', 'GetLocale', 'GetMetricData',
37
- 'GetProfileString', 'GetTempDirectory', 'GetTempFile', 'GetTemplatePath', 'GetTickCount',
38
- 'GetTimeZoneInfo', 'GetToken', 'Hash', 'Hour', 'HTMLCodeFormat', 'HTMLEditFormat', 'IIf',
39
- 'IncrementValue', 'InputBaseN', 'Insert', 'Int', 'IsArray', 'IsAuthenticated', 'IsAuthorized',
40
- 'IsBoolean', 'IsBinary', 'IsCustomFunction', 'IsDate', 'IsDebugMode', 'IsDefined', 'IsLeapYear',
41
- 'IsNumeric', 'IsNumericDate', 'IsProtected', 'IsQuery', 'IsSimpleValue', 'IsStruct', 'IsWDDX',
42
- 'JavaCast', 'JSStringFormat', 'LCase', 'Left', 'Len', 'ListAppend', 'ListChangeDelims',
43
- 'ListContains', 'ListContainsNoCase', 'ListDeleteAt', 'ListFind', 'ListFindNoCase', 'ListFirst',
44
- 'ListGetAt', 'ListInsertAt', 'ListLast', 'ListLen', 'ListPrepend', 'ListQualify', 'ListRest',
45
- 'ListSetAt', 'ListSort', 'ListToArray', 'ListValueCount', 'ListValueCountNoCase', 'LJustify',
46
- 'Log', 'Log10', 'LSCurrencyFormat', 'LSDateFormat', 'LSEuroCurrencyFormat', 'LSIsCurrency',
47
- 'LSIsDate', 'LSIsNumeric', 'LSNumberFormat', 'LSParseCurrency', 'LSParseDateTime', 'LSParseNumber',
48
- 'LSTimeFormat', 'LTrim', 'Max', 'Mid', 'Min', 'Minute', 'Month', 'MonthAsString', 'Now', 'NumberFormat',
49
- 'ParagraphFormat', 'ParameterExists', 'ParseDateTime', 'Pi', 'PreserveSingleQuotes', 'Quarter',
50
- 'QueryAddRow', 'QueryNew', 'QuerySetCell', 'QuotedValueList', 'Rand', 'Randomize', 'RandRange',
51
- 'REFind', 'REFindNoCase', 'RemoveChars', 'RepeatString', 'Replace', 'ReplaceList', 'ReplaceNoCase',
52
- 'REReplace', 'REReplaceNoCase', 'Reverse', 'Right', 'RJustify', 'Round', 'RTrim', 'Second', 'SetLocale',
53
- 'SetProfileString', 'SetVariable', 'Sgn', 'Sin', 'SpanExcluding', 'SpanIncluding', 'Sqr', 'StripCR',
54
- 'StructAppend', 'StructClear', 'StructCopy', 'StructCount', 'StructDelete', 'StructFind', 'StructFindKey',
55
- 'StructFindValue', 'StructGet', 'StructInsert', 'StructIsEmpty', 'StructKeyArray', 'StructKeyExists',
56
- 'StructKeyList', 'StructNew', 'StructSort', 'StructUpdate', 'Tan', 'TimeFormat', 'ToBase64', 'ToBinary',
57
- 'ToString', 'Trim', 'UCase', 'URLDecode', 'URLEncodedFormat', 'Val', 'ValueList', 'Week', 'WriteOutput',
58
- 'XMLFormat', 'Year', 'YesNoFormat'
59
- ]
60
- }
61
- ,'OPERATORS' :[
62
- '+', '-', '/', '*', '%', '!', '&&', '||'
63
- ]
64
- ,'DELIMITERS' :[
65
- '(', ')', '[', ']', '{', '}'
66
- ]
67
- ,'REGEXPS' : {
68
- 'doctype' : {
69
- 'search' : '()(<!DOCTYPE[^>]*>)()'
70
- ,'class' : 'doctype'
71
- ,'modifiers' : ''
72
- ,'execute' : 'before' // before or after
73
- }
74
- ,'cftags' : {
75
- 'search' : '(<)(/cf[a-z][^ \r\n\t>]*)([^>]*>)'
76
- ,'class' : 'cftags'
77
- ,'modifiers' : 'gi'
78
- ,'execute' : 'before' // before or after
79
- }
80
- ,'cftags2' : {
81
- 'search' : '(<)(cf[a-z][^ \r\n\t>]*)([^>]*>)'
82
- ,'class' : 'cftags2'
83
- ,'modifiers' : 'gi'
84
- ,'execute' : 'before' // before or after
85
- }
86
- ,'tags' : {
87
- 'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)'
88
- ,'class' : 'tags'
89
- ,'modifiers' : 'gi'
90
- ,'execute' : 'before' // before or after
91
- }
92
- ,'attributes' : {
93
- 'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)'
94
- ,'class' : 'attributes'
95
- ,'modifiers' : 'g'
96
- ,'execute' : 'before' // before or after
97
- }
98
- }
99
- ,'STYLES' : {
100
- 'COMMENTS': 'color: #AAAAAA;'
101
- ,'QUOTESMARKS': 'color: #6381F8;'
102
- ,'KEYWORDS' : {
103
- 'reserved' : 'color: #48BDDF;'
104
- ,'functions' : 'color: #0000FF;'
105
- ,'statements' : 'color: #60CA00;'
106
- }
107
- ,'OPERATORS' : 'color: #E775F0;'
108
- ,'DELIMITERS' : ''
109
- ,'REGEXPS' : {
110
- 'attributes': 'color: #990033;'
111
- ,'cftags': 'color: #990033;'
112
- ,'cftags2': 'color: #990033;'
113
- ,'tags': 'color: #000099;'
114
- ,'doctype': 'color: #8DCFB5;'
115
- ,'test': 'color: #00FF00;'
116
- }
117
- }
118
- };
119
-
120
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/cpp.js DELETED
@@ -1,66 +0,0 @@
1
- editAreaLoader.load_syntax["cpp"] = {
2
- 'DISPLAY_NAME' : 'CPP'
3
- ,'COMMENT_SINGLE' : {1 : '//'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
6
- ,'KEYWORD_CASE_SENSITIVE' : true
7
- ,'KEYWORDS' : {
8
- 'constants' : [
9
- 'NULL', 'false', 'std', 'stdin', 'stdout', 'stderr',
10
- 'true'
11
- ]
12
- ,'types' : [
13
- 'FILE', 'auto', 'char', 'class', 'const', 'double',
14
- 'extern', 'float', 'friend', 'inline', 'int',
15
- 'iterator', 'long', 'map', 'operator', 'queue',
16
- 'register', 'short', 'signed', 'size_t', 'stack',
17
- 'static', 'string', 'struct', 'time_t', 'typedef',
18
- 'union', 'unsigned', 'vector', 'void', 'volatile'
19
- ]
20
- ,'statements' : [
21
- 'catch', 'do', 'else', 'enum', 'for', 'goto', 'if',
22
- 'sizeof', 'switch', 'this', 'throw', 'try', 'while'
23
- ]
24
- ,'keywords' : [
25
- 'break', 'case', 'continue', 'default', 'delete',
26
- 'namespace', 'new', 'private', 'protected', 'public',
27
- 'return', 'using'
28
- ]
29
- }
30
- ,'OPERATORS' :[
31
- '+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
32
- ]
33
- ,'DELIMITERS' :[
34
- '(', ')', '[', ']', '{', '}'
35
- ]
36
- ,'REGEXPS' : {
37
- 'precompiler' : {
38
- 'search' : '()(#[^\r\n]*)()'
39
- ,'class' : 'precompiler'
40
- ,'modifiers' : 'g'
41
- ,'execute' : 'before'
42
- }
43
- /* ,'precompilerstring' : {
44
- 'search' : '(#[\t ]*include[\t ]*)([^\r\n]*)([^\r\n]*[\r\n])'
45
- ,'class' : 'precompilerstring'
46
- ,'modifiers' : 'g'
47
- ,'execute' : 'before'
48
- }*/
49
- }
50
- ,'STYLES' : {
51
- 'COMMENTS': 'color: #AAAAAA;'
52
- ,'QUOTESMARKS': 'color: #6381F8;'
53
- ,'KEYWORDS' : {
54
- 'constants' : 'color: #EE0000;'
55
- ,'types' : 'color: #0000EE;'
56
- ,'statements' : 'color: #60CA00;'
57
- ,'keywords' : 'color: #48BDDF;'
58
- }
59
- ,'OPERATORS' : 'color: #FF00FF;'
60
- ,'DELIMITERS' : 'color: #0038E1;'
61
- ,'REGEXPS' : {
62
- 'precompiler' : 'color: #009900;'
63
- ,'precompilerstring' : 'color: #994400;'
64
- }
65
- }
66
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/css.js DELETED
@@ -1,85 +0,0 @@
1
- editAreaLoader.load_syntax["css"] = {
2
- 'DISPLAY_NAME' : 'CSS'
3
- ,'COMMENT_SINGLE' : {1 : '@'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : ['"', "'"]
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'attributes' : [
9
- 'aqua', 'azimuth', 'background-attachment', 'background-color',
10
- 'background-image', 'background-position', 'background-repeat',
11
- 'background', 'border-bottom-color', 'border-bottom-style',
12
- 'border-bottom-width', 'border-left-color', 'border-left-style',
13
- 'border-left-width', 'border-right', 'border-right-color',
14
- 'border-right-style', 'border-right-width', 'border-top-color',
15
- 'border-top-style', 'border-top-width','border-bottom', 'border-collapse',
16
- 'border-left', 'border-width', 'border-color', 'border-spacing',
17
- 'border-style', 'border-top', 'border', 'caption-side',
18
- 'clear', 'clip', 'color', 'content', 'counter-increment', 'counter-reset',
19
- 'cue-after', 'cue-before', 'cue', 'cursor', 'direction', 'display',
20
- 'elevation', 'empty-cells', 'float', 'font-family', 'font-size',
21
- 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant',
22
- 'font-weight', 'font', 'height', 'letter-spacing', 'line-height',
23
- 'list-style', 'list-style-image', 'list-style-position', 'list-style-type',
24
- 'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'margin',
25
- 'marker-offset', 'marks', 'max-height', 'max-width', 'min-height',
26
- 'min-width', 'opacity', 'orphans', 'outline', 'outline-color', 'outline-style',
27
- 'outline-width', 'overflow', 'padding-bottom', 'padding-left',
28
- 'padding-right', 'padding-top', 'padding', 'page', 'page-break-after',
29
- 'page-break-before', 'page-break-inside', 'pause-after', 'pause-before',
30
- 'pause', 'pitch', 'pitch-range', 'play-during', 'position', 'quotes',
31
- 'richness', 'right', 'size', 'speak-header', 'speak-numeral', 'speak-punctuation',
32
- 'speak', 'speech-rate', 'stress', 'table-layout', 'text-align', 'text-decoration',
33
- 'text-indent', 'text-shadow', 'text-transform', 'top', 'unicode-bidi',
34
- 'vertical-align', 'visibility', 'voice-family', 'volume', 'white-space', 'widows',
35
- 'width', 'word-spacing', 'z-index', 'bottom', 'left'
36
- ]
37
- ,'values' : [
38
- 'above', 'absolute', 'always', 'armenian', 'aural', 'auto', 'avoid',
39
- 'baseline', 'behind', 'below', 'bidi-override', 'black', 'blue', 'blink', 'block', 'bold', 'bolder', 'both',
40
- 'capitalize', 'center-left', 'center-right', 'center', 'circle', 'cjk-ideographic',
41
- 'close-quote', 'collapse', 'condensed', 'continuous', 'crop', 'crosshair', 'cross', 'cursive',
42
- 'dashed', 'decimal-leading-zero', 'decimal', 'default', 'digits', 'disc', 'dotted', 'double',
43
- 'e-resize', 'embed', 'extra-condensed', 'extra-expanded', 'expanded',
44
- 'fantasy', 'far-left', 'far-right', 'faster', 'fast', 'fixed', 'fuchsia',
45
- 'georgian', 'gray', 'green', 'groove', 'hebrew', 'help', 'hidden', 'hide', 'higher',
46
- 'high', 'hiragana-iroha', 'hiragana', 'icon', 'inherit', 'inline-table', 'inline',
47
- 'inset', 'inside', 'invert', 'italic', 'justify', 'katakana-iroha', 'katakana',
48
- 'landscape', 'larger', 'large', 'left-side', 'leftwards', 'level', 'lighter', 'lime', 'line-through', 'list-item', 'loud', 'lower-alpha', 'lower-greek', 'lower-roman', 'lowercase', 'ltr', 'lower', 'low',
49
- 'maroon', 'medium', 'message-box', 'middle', 'mix', 'monospace',
50
- 'n-resize', 'narrower', 'navy', 'ne-resize', 'no-close-quote', 'no-open-quote', 'no-repeat', 'none', 'normal', 'nowrap', 'nw-resize',
51
- 'oblique', 'olive', 'once', 'open-quote', 'outset', 'outside', 'overline',
52
- 'pointer', 'portrait', 'purple', 'px',
53
- 'red', 'relative', 'repeat-x', 'repeat-y', 'repeat', 'rgb', 'ridge', 'right-side', 'rightwards',
54
- 's-resize', 'sans-serif', 'scroll', 'se-resize', 'semi-condensed', 'semi-expanded', 'separate', 'serif', 'show', 'silent', 'silver', 'slow', 'slower', 'small-caps', 'small-caption', 'smaller', 'soft', 'solid', 'spell-out', 'square',
55
- 'static', 'status-bar', 'super', 'sw-resize',
56
- 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row', 'table-row-group', 'teal', 'text', 'text-bottom', 'text-top', 'thick', 'thin', 'transparent',
57
- 'ultra-condensed', 'ultra-expanded', 'underline', 'upper-alpha', 'upper-latin', 'upper-roman', 'uppercase', 'url',
58
- 'visible',
59
- 'w-resize', 'wait', 'white', 'wider',
60
- 'x-fast', 'x-high', 'x-large', 'x-loud', 'x-low', 'x-small', 'x-soft', 'xx-large', 'xx-small',
61
- 'yellow', 'yes'
62
- ]
63
- ,'specials' : [
64
- 'important'
65
- ]
66
- }
67
- ,'OPERATORS' :[
68
- ':', ';', '!', '.', '#'
69
- ]
70
- ,'DELIMITERS' :[
71
- '{', '}'
72
- ]
73
- ,'STYLES' : {
74
- 'COMMENTS': 'color: #AAAAAA;'
75
- ,'QUOTESMARKS': 'color: #6381F8;'
76
- ,'KEYWORDS' : {
77
- 'attributes' : 'color: #48BDDF;'
78
- ,'values' : 'color: #2B60FF;'
79
- ,'specials' : 'color: #FF0000;'
80
- }
81
- ,'OPERATORS' : 'color: #FF00FF;'
82
- ,'DELIMITERS' : 'color: #60CA00;'
83
-
84
- }
85
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/html.js DELETED
@@ -1,51 +0,0 @@
1
- /*
2
- * last update: 2006-08-24
3
- */
4
-
5
- editAreaLoader.load_syntax["html"] = {
6
- 'DISPLAY_NAME' : 'HTML'
7
- ,'COMMENT_SINGLE' : {}
8
- ,'COMMENT_MULTI' : {'<!--' : '-->'}
9
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
10
- ,'KEYWORD_CASE_SENSITIVE' : false
11
- ,'KEYWORDS' : {
12
- }
13
- ,'OPERATORS' :[
14
- ]
15
- ,'DELIMITERS' :[
16
- ]
17
- ,'REGEXPS' : {
18
- 'doctype' : {
19
- 'search' : '()(<!DOCTYPE[^>]*>)()'
20
- ,'class' : 'doctype'
21
- ,'modifiers' : ''
22
- ,'execute' : 'before' // before or after
23
- }
24
- ,'tags' : {
25
- 'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)'
26
- ,'class' : 'tags'
27
- ,'modifiers' : 'gi'
28
- ,'execute' : 'before' // before or after
29
- }
30
- ,'attributes' : {
31
- 'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)'
32
- ,'class' : 'attributes'
33
- ,'modifiers' : 'g'
34
- ,'execute' : 'before' // before or after
35
- }
36
- }
37
- ,'STYLES' : {
38
- 'COMMENTS': 'color: #AAAAAA;'
39
- ,'QUOTESMARKS': 'color: #6381F8;'
40
- ,'KEYWORDS' : {
41
- }
42
- ,'OPERATORS' : 'color: #E775F0;'
43
- ,'DELIMITERS' : ''
44
- ,'REGEXPS' : {
45
- 'attributes': 'color: #B1AC41;'
46
- ,'tags': 'color: #E62253;'
47
- ,'doctype': 'color: #8DCFB5;'
48
- ,'test': 'color: #00FF00;'
49
- }
50
- }
51
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/java.js DELETED
@@ -1,57 +0,0 @@
1
- editAreaLoader.load_syntax["java"] = {
2
- 'DISPLAY_NAME' : 'Java'
3
- ,'COMMENT_SINGLE': { 1: '//', 2: '@' }
4
- , 'COMMENT_MULTI': { '/*': '*/' }
5
- , 'QUOTEMARKS': { 1: "'", 2: '"' }
6
- , 'KEYWORD_CASE_SENSITIVE': true
7
- , 'KEYWORDS': {
8
- 'constants': [
9
- 'null', 'false', 'true'
10
- ]
11
- , 'types': [
12
- 'String', 'int', 'short', 'long', 'char', 'double', 'byte',
13
- 'float', 'static', 'void', 'private', 'boolean', 'protected',
14
- 'public', 'const', 'class', 'final', 'abstract', 'volatile',
15
- 'enum', 'transient', 'interface'
16
- ]
17
- , 'statements': [
18
- 'this', 'extends', 'if', 'do', 'while', 'try', 'catch', 'finally',
19
- 'throw', 'throws', 'else', 'for', 'switch', 'continue', 'implements',
20
- 'break', 'case', 'default', 'goto'
21
- ]
22
- , 'keywords': [
23
- 'new', 'return', 'import', 'native', 'super', 'package', 'assert', 'synchronized',
24
- 'instanceof', 'strictfp'
25
- ]
26
- }
27
- , 'OPERATORS': [
28
- '+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
29
- ]
30
- , 'DELIMITERS': [
31
- '(', ')', '[', ']', '{', '}'
32
- ]
33
- , 'REGEXPS': {
34
- 'precompiler': {
35
- 'search': '()(#[^\r\n]*)()'
36
- , 'class': 'precompiler'
37
- , 'modifiers': 'g'
38
- , 'execute': 'before'
39
- }
40
- }
41
- , 'STYLES': {
42
- 'COMMENTS': 'color: #AAAAAA;'
43
- , 'QUOTESMARKS': 'color: #6381F8;'
44
- , 'KEYWORDS': {
45
- 'constants': 'color: #EE0000;'
46
- , 'types': 'color: #0000EE;'
47
- , 'statements': 'color: #60CA00;'
48
- , 'keywords': 'color: #48BDDF;'
49
- }
50
- , 'OPERATORS': 'color: #FF00FF;'
51
- , 'DELIMITERS': 'color: #0038E1;'
52
- , 'REGEXPS': {
53
- 'precompiler': 'color: #009900;'
54
- , 'precompilerstring': 'color: #994400;'
55
- }
56
- }
57
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/js.js DELETED
@@ -1,94 +0,0 @@
1
- editAreaLoader.load_syntax["js"] = {
2
- 'DISPLAY_NAME' : 'Javascript'
3
- ,'COMMENT_SINGLE' : {1 : '//'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'statements' : [
9
- 'as', 'break', 'case', 'catch', 'continue', 'decodeURI', 'delete', 'do',
10
- 'else', 'encodeURI', 'eval', 'finally', 'for', 'if', 'in', 'is', 'item',
11
- 'instanceof', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'void',
12
- 'while', 'write', 'with'
13
- ]
14
- ,'keywords' : [
15
- 'class', 'const', 'default', 'debugger', 'export', 'extends', 'false',
16
- 'function', 'import', 'namespace', 'new', 'null', 'package', 'private',
17
- 'protected', 'public', 'super', 'true', 'use', 'var', 'window', 'document',
18
- // the list below must be sorted and checked (if it is a keywords or a function and if it is not present twice
19
- 'Link ', 'outerHeight ', 'Anchor', 'FileUpload',
20
- 'location', 'outerWidth', 'Select', 'Area', 'find', 'Location', 'Packages', 'self',
21
- 'arguments', 'locationbar', 'pageXoffset', 'Form',
22
- 'Math', 'pageYoffset', 'setTimeout', 'assign', 'Frame', 'menubar', 'parent', 'status',
23
- 'blur', 'frames', 'MimeType', 'parseFloat', 'statusbar', 'Boolean', 'Function', 'moveBy',
24
- 'parseInt', 'stop', 'Button', 'getClass', 'moveTo', 'Password', 'String', 'callee', 'Hidden',
25
- 'name', 'personalbar', 'Submit', 'caller', 'history', 'NaN', 'Plugin', 'sun', 'captureEvents',
26
- 'History', 'navigate', 'print', 'taint', 'Checkbox', 'home', 'navigator', 'prompt', 'Text',
27
- 'Image', 'Navigator', 'prototype', 'Textarea', 'clearTimeout', 'Infinity',
28
- 'netscape', 'Radio', 'toolbar', 'close', 'innerHeight', 'Number', 'ref', 'top', 'closed',
29
- 'innerWidth', 'Object', 'RegExp', 'toString', 'confirm', 'isFinite', 'onBlur', 'releaseEvents',
30
- 'unescape', 'constructor', 'isNan', 'onError', 'Reset', 'untaint', 'Date', 'java', 'onFocus',
31
- 'resizeBy', 'unwatch', 'defaultStatus', 'JavaArray', 'onLoad', 'resizeTo', 'valueOf', 'document',
32
- 'JavaClass', 'onUnload', 'routeEvent', 'watch', 'Document', 'JavaObject', 'open', 'scroll', 'window',
33
- 'Element', 'JavaPackage', 'opener', 'scrollbars', 'Window', 'escape', 'length', 'Option', 'scrollBy'
34
- ]
35
- ,'functions' : [
36
- // common functions for Window object
37
- 'alert', 'Array', 'back', 'blur', 'clearInterval', 'close', 'confirm', 'eval ', 'focus', 'forward', 'home',
38
- 'name', 'navigate', 'onblur', 'onerror', 'onfocus', 'onload', 'onmove',
39
- 'onresize', 'onunload', 'open', 'print', 'prompt', 'scroll', 'scrollTo', 'setInterval', 'status',
40
- 'stop'
41
- ]
42
- }
43
- ,'OPERATORS' :[
44
- '+', '-', '/', '*', '=', '<', '>', '%', '!'
45
- ]
46
- ,'DELIMITERS' :[
47
- '(', ')', '[', ']', '{', '}'
48
- ]
49
- ,'STYLES' : {
50
- 'COMMENTS': 'color: #AAAAAA;'
51
- ,'QUOTESMARKS': 'color: #6381F8;'
52
- ,'KEYWORDS' : {
53
- 'statements' : 'color: #60CA00;'
54
- ,'keywords' : 'color: #48BDDF;'
55
- ,'functions' : 'color: #2B60FF;'
56
- }
57
- ,'OPERATORS' : 'color: #FF00FF;'
58
- ,'DELIMITERS' : 'color: #0038E1;'
59
-
60
- }
61
- ,'AUTO_COMPLETION' : {
62
- "default": { // the name of this definition group. It's posisble to have different rules inside the same definition file
63
- "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.|
64
- ,"possible_words_letters": "[a-zA-Z0-9_]+"
65
- ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$"
66
- ,"prefix_separator": "\\."
67
- }
68
- ,"CASE_SENSITIVE": true
69
- ,"MAX_TEXT_LENGTH": 100 // the maximum length of the text being analyzed before the cursor position
70
- ,"KEYWORDS": {
71
- '': [ // the prefix of thoses items
72
- /**
73
- * 0 : the keyword the user is typing
74
- * 1 : (optionnal) the string inserted in code ("{@}" being the new position of the cursor, "§" beeing the equivalent to the value the typed string indicated if the previous )
75
- * If empty the keyword will be displayed
76
- * 2 : (optionnal) the text that appear in the suggestion box (if empty, the string to insert will be displayed)
77
- */
78
- ['Array', '§()', '']
79
- ,['alert', '§({@})', 'alert(String message)']
80
- ,['document']
81
- ,['window']
82
- ]
83
- ,'window' : [
84
- ['location']
85
- ,['document']
86
- ,['scrollTo', 'scrollTo({@})', 'scrollTo(Int x,Int y)']
87
- ]
88
- ,'location' : [
89
- ['href']
90
- ]
91
- }
92
- }
93
- }
94
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/pas.js DELETED
@@ -1,83 +0,0 @@
1
- editAreaLoader.load_syntax["pas"] = {
2
- 'DISPLAY_NAME' : 'Pascal'
3
- ,'COMMENT_SINGLE' : {}
4
- ,'COMMENT_MULTI' : {'{' : '}', '(*':'*)'}
5
- ,'QUOTEMARKS' : {1: '"', 2: "'"}
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'constants' : [
9
- 'Blink', 'Black', 'Blue', 'Green', 'Cyan', 'Red',
10
- 'Magenta', 'Brown', 'LightGray', 'DarkGray',
11
- 'LightBlue', 'LightGreen', 'LightCyan', 'LightRed',
12
- 'LightMagenta', 'Yellow', 'White', 'MaxSIntValue',
13
- 'MaxUIntValue', 'maxint', 'maxLongint', 'maxSmallint',
14
- 'erroraddr', 'errorcode', 'LineEnding'
15
- ]
16
- ,'keywords' : [
17
- 'in', 'or', 'div', 'mod', 'and', 'shl', 'shr', 'xor',
18
- 'pow', 'is', 'not','Absolute', 'And_then', 'Array',
19
- 'Begin', 'Bindable', 'Case', 'Const', 'Do', 'Downto',
20
- 'Else', 'End', 'Export', 'File', 'For', 'Function',
21
- 'Goto', 'If', 'Import', 'Implementation', 'Inherited',
22
- 'Inline', 'Interface', 'Label', 'Module', 'Nil',
23
- 'Object', 'Of', 'Only', 'Operator', 'Or_else',
24
- 'Otherwise', 'Packed', 'Procedure', 'Program',
25
- 'Protected', 'Qualified', 'Record', 'Repeat',
26
- 'Restricted', 'Set', 'Then', 'To', 'Type', 'Unit',
27
- 'Until', 'Uses', 'Value', 'Var', 'Virtual', 'While',
28
- 'With'
29
- ]
30
- ,'functions' : [
31
- 'Abs', 'Addr', 'Append', 'Arctan', 'Assert', 'Assign',
32
- 'Assigned', 'BinStr', 'Blockread', 'Blockwrite',
33
- 'Break', 'Chdir', 'Chr', 'Close', 'CompareByte',
34
- 'CompareChar', 'CompareDWord', 'CompareWord', 'Concat',
35
- 'Continue', 'Copy', 'Cos', 'CSeg', 'Dec', 'Delete',
36
- 'Dispose', 'DSeg', 'Eof', 'Eoln', 'Erase', 'Exclude',
37
- 'Exit', 'Exp', 'Filepos', 'Filesize', 'FillByte',
38
- 'Fillchar', 'FillDWord', 'Fillword', 'Flush', 'Frac',
39
- 'Freemem', 'Getdir', 'Getmem', 'GetMemoryManager',
40
- 'Halt', 'HexStr', 'Hi', 'High', 'Inc', 'Include',
41
- 'IndexByte', 'IndexChar', 'IndexDWord', 'IndexWord',
42
- 'Insert', 'IsMemoryManagerSet', 'Int', 'IOresult',
43
- 'Length', 'Ln', 'Lo', 'LongJmp', 'Low', 'Lowercase',
44
- 'Mark', 'Maxavail', 'Memavail', 'Mkdir', 'Move',
45
- 'MoveChar0', 'New', 'Odd', 'OctStr', 'Ofs', 'Ord',
46
- 'Paramcount', 'Paramstr', 'Pi', 'Pos', 'Power', 'Pred',
47
- 'Ptr', 'Random', 'Randomize', 'Read', 'Readln',
48
- 'Real2Double', 'Release', 'Rename', 'Reset', 'Rewrite',
49
- 'Rmdir', 'Round', 'Runerror', 'Seek', 'SeekEof',
50
- 'SeekEoln', 'Seg', 'SetMemoryManager', 'SetJmp',
51
- 'SetLength', 'SetString', 'SetTextBuf', 'Sin', 'SizeOf',
52
- 'Sptr', 'Sqr', 'Sqrt', 'SSeg', 'Str', 'StringOfChar',
53
- 'Succ', 'Swap', 'Trunc', 'Truncate', 'Upcase', 'Val',
54
- 'Write', 'WriteLn'
55
- ]
56
- ,'types' : [
57
- 'Integer', 'Shortint', 'SmallInt', 'Longint',
58
- 'Longword', 'Int64', 'Byte', 'Word', 'Cardinal',
59
- 'QWord', 'Boolean', 'ByteBool', 'LongBool', 'Char',
60
- 'Real', 'Single', 'Double', 'Extended', 'Comp',
61
- 'String', 'ShortString', 'AnsiString', 'PChar'
62
- ]
63
- }
64
- ,'OPERATORS' :[
65
- '@', '*', '+', '-', '/', '^', ':=', '<', '=', '>'
66
- ]
67
- ,'DELIMITERS' :[
68
- '(', ')', '[', ']'
69
- ]
70
- ,'STYLES' : {
71
- 'COMMENTS': 'color: #AAAAAA;'
72
- ,'QUOTESMARKS': 'color: #6381F8;'
73
- ,'KEYWORDS' : {
74
- 'specials' : 'color: #EE0000;'
75
- ,'constants' : 'color: #654321;'
76
- ,'keywords' : 'color: #48BDDF;'
77
- ,'functions' : 'color: #449922;'
78
- ,'types' : 'color: #2B60FF;'
79
- }
80
- ,'OPERATORS' : 'color: #FF00FF;'
81
- ,'DELIMITERS' : 'color: #60CA00;'
82
- }
83
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/perl.js DELETED
@@ -1,88 +0,0 @@
1
- /***************************************************************************
2
- * (c) 2008 - file created by Christoph Pinkel, MTC Infomedia OHG.
3
- *
4
- * You may choose any license of the current release or any future release
5
- * of editarea to use, modify and/or redistribute this file.
6
- *
7
- * This language specification file supports for syntax checking on
8
- * a large subset of Perl 5.x.
9
- * The basic common syntax of Perl is fully supported, but as for
10
- * the highlighting of built-in operations, it's mainly designed
11
- * to support for hightlighting Perl code in a Safe environment (compartment)
12
- * as used by CoMaNet for evaluation of administrative scripts. This Safe
13
- * compartment basically allows for all of Opcode's :default operations,
14
- * but little others. See http://perldoc.perl.org/Opcode.html to learn
15
- * more.
16
- ***************************************************************************/
17
-
18
- editAreaLoader.load_syntax["perl"] = {
19
- 'DISPLAY_NAME' : 'Perl',
20
- 'COMMENT_SINGLE' : {1 : '#'},
21
- 'QUOTEMARKS' : {1: "'", 2: '"'},
22
- 'KEYWORD_CASE_SENSITIVE' : true,
23
- 'KEYWORDS' :
24
- {
25
- 'core' :
26
- [ "if", "else", "elsif", "while", "for", "each", "foreach",
27
- "next", "last", "goto", "exists", "delete", "undef",
28
- "my", "our", "local", "use", "require", "package", "keys", "values",
29
- "sub", "bless", "ref", "return" ],
30
- 'functions' :
31
- [
32
- //from :base_core
33
- "int", "hex", "oct", "abs", "substr", "vec", "study", "pos",
34
- "length", "index", "rindex", "ord", "chr", "ucfirst", "lcfirst",
35
- "uc", "lc", "quotemeta", "chop", "chomp", "split", "list", "splice",
36
- "push", "pop", "shift", "unshift", "reverse", "and", "or", "dor",
37
- "xor", "warn", "die", "prototype",
38
- //from :base_mem
39
- "concat", "repeat", "join", "range",
40
- //none from :base_loop, as we'll see them as basic statements...
41
- //from :base_orig
42
- "sprintf", "crypt", "tie", "untie", "select", "localtime", "gmtime",
43
- //others
44
- "print", "open", "close"
45
- ]
46
- },
47
- 'OPERATORS' :
48
- [ '+', '-', '/', '*', '=', '<', '>', '!', '||', '.', '&&',
49
- ' eq ', ' ne ', '=~' ],
50
- 'DELIMITERS' :
51
- [ '(', ')', '[', ']', '{', '}' ],
52
- 'REGEXPS' :
53
- {
54
- 'packagedecl' : { 'search': '(package )([^ \r\n\t#;]*)()',
55
- 'class' : 'scopingnames',
56
- 'modifiers' : 'g', 'execute' : 'before' },
57
- 'subdecl' : { 'search': '(sub )([^ \r\n\t#]*)()',
58
- 'class' : 'scopingnames',
59
- 'modifiers' : 'g', 'execute' : 'before' },
60
- 'scalars' : { 'search': '()(\\\$[a-zA-Z0-9_:]*)()',
61
- 'class' : 'vars',
62
- 'modifiers' : 'g', 'execute' : 'after' },
63
- 'arrays' : { 'search': '()(@[a-zA-Z0-9_:]*)()',
64
- 'class' : 'vars',
65
- 'modifiers' : 'g', 'execute' : 'after' },
66
- 'hashs' : { 'search': '()(%[a-zA-Z0-9_:]*)()',
67
- 'class' : 'vars',
68
- 'modifiers' : 'g', 'execute' : 'after' },
69
- },
70
-
71
- 'STYLES' :
72
- {
73
- 'COMMENTS': 'color: #AAAAAA;',
74
- 'QUOTESMARKS': 'color: #DC0000;',
75
- 'KEYWORDS' :
76
- {
77
- 'core' : 'color: #8aca00;',
78
- 'functions' : 'color: #2B60FF;'
79
- },
80
- 'OPERATORS' : 'color: #8aca00;',
81
- 'DELIMITERS' : 'color: #0038E1;',
82
- 'REGEXPS':
83
- {
84
- 'scopingnames' : 'color: #ff0000;',
85
- 'vars' : 'color: #00aaaa;',
86
- }
87
- } //'STYLES'
88
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/php.js DELETED
@@ -1,157 +0,0 @@
1
- editAreaLoader.load_syntax["php"] = {
2
- 'DISPLAY_NAME' : 'Php'
3
- ,'COMMENT_SINGLE' : {1 : '//', 2 : '#'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'statements' : [
9
- 'include', 'require', 'include_once', 'require_once',
10
- 'for', 'foreach', 'as', 'if', 'elseif', 'else', 'while', 'do', 'endwhile',
11
- 'endif', 'switch', 'case', 'endswitch',
12
- 'return', 'break', 'continue'
13
- ]
14
- ,'reserved' : [
15
- '_GET', '_POST', '_SESSION', '_SERVER', '_FILES', '_ENV', '_COOKIE', '_REQUEST',
16
- 'null', '__LINE__', '__FILE__',
17
- 'false', '&lt;?php', '?&gt;', '&lt;?',
18
- '&lt;script language', '&lt;/script&gt;',
19
- 'true', 'var', 'default',
20
- 'function', 'class', 'new', '&amp;new', 'this',
21
- '__FUNCTION__', '__CLASS__', '__METHOD__', 'PHP_VERSION',
22
- 'PHP_OS', 'DEFAULT_INCLUDE_PATH', 'PEAR_INSTALL_DIR', 'PEAR_EXTENSION_DIR',
23
- 'PHP_EXTENSION_DIR', 'PHP_BINDIR', 'PHP_LIBDIR', 'PHP_DATADIR', 'PHP_SYSCONFDIR',
24
- 'PHP_LOCALSTATEDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_OUTPUT_HANDLER_START', 'PHP_OUTPUT_HANDLER_CONT',
25
- 'PHP_OUTPUT_HANDLER_END', 'E_ERROR', 'E_WARNING', 'E_PARSE', 'E_NOTICE',
26
- 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_USER_ERROR',
27
- 'E_USER_WARNING', 'E_USER_NOTICE', 'E_ALL'
28
-
29
- ]
30
- ,'functions' : [
31
- 'func_num_args', 'func_get_arg', 'func_get_args', 'strlen', 'strcmp', 'strncmp', 'strcasecmp', 'strncasecmp', 'each', 'error_reporting', 'define', 'defined',
32
- 'trigger_error', 'user_error', 'set_error_handler', 'restore_error_handler', 'get_declared_classes', 'get_loaded_extensions',
33
- 'extension_loaded', 'get_extension_funcs', 'debug_backtrace',
34
- 'constant', 'bin2hex', 'sleep', 'usleep', 'time', 'mktime', 'gmmktime', 'strftime', 'gmstrftime', 'strtotime', 'date', 'gmdate', 'getdate', 'localtime', 'checkdate', 'flush', 'wordwrap', 'htmlspecialchars', 'htmlentities', 'html_entity_decode', 'md5', 'md5_file', 'crc32', 'getimagesize', 'image_type_to_mime_type', 'phpinfo', 'phpversion', 'phpcredits', 'strnatcmp', 'strnatcasecmp', 'substr_count', 'strspn', 'strcspn', 'strtok', 'strtoupper', 'strtolower', 'strpos', 'strrpos', 'strrev', 'hebrev', 'hebrevc', 'nl2br', 'basename', 'dirname', 'pathinfo', 'stripslashes', 'stripcslashes', 'strstr', 'stristr', 'strrchr', 'str_shuffle', 'str_word_count', 'strcoll', 'substr', 'substr_replace', 'quotemeta', 'ucfirst', 'ucwords', 'strtr', 'addslashes', 'addcslashes', 'rtrim', 'str_replace', 'str_repeat', 'count_chars', 'chunk_split', 'trim', 'ltrim', 'strip_tags', 'similar_text', 'explode', 'implode', 'setlocale', 'localeconv',
35
- 'parse_str', 'str_pad', 'chop', 'strchr', 'sprintf', 'printf', 'vprintf', 'vsprintf', 'sscanf', 'fscanf', 'parse_url', 'urlencode', 'urldecode', 'rawurlencode', 'rawurldecode', 'readlink', 'linkinfo', 'link', 'unlink', 'exec', 'system', 'escapeshellcmd', 'escapeshellarg', 'passthru', 'shell_exec', 'proc_open', 'proc_close', 'rand', 'srand', 'getrandmax', 'mt_rand', 'mt_srand', 'mt_getrandmax', 'base64_decode', 'base64_encode', 'abs', 'ceil', 'floor', 'round', 'is_finite', 'is_nan', 'is_infinite', 'bindec', 'hexdec', 'octdec', 'decbin', 'decoct', 'dechex', 'base_convert', 'number_format', 'fmod', 'ip2long', 'long2ip', 'getenv', 'putenv', 'getopt', 'microtime', 'gettimeofday', 'getrusage', 'uniqid', 'quoted_printable_decode', 'set_time_limit', 'get_cfg_var', 'magic_quotes_runtime', 'set_magic_quotes_runtime', 'get_magic_quotes_gpc', 'get_magic_quotes_runtime',
36
- 'import_request_variables', 'error_log', 'serialize', 'unserialize', 'memory_get_usage', 'var_dump', 'var_export', 'debug_zval_dump', 'print_r','highlight_file', 'show_source', 'highlight_string', 'ini_get', 'ini_get_all', 'ini_set', 'ini_alter', 'ini_restore', 'get_include_path', 'set_include_path', 'restore_include_path', 'setcookie', 'header', 'headers_sent', 'connection_aborted', 'connection_status', 'ignore_user_abort', 'parse_ini_file', 'is_uploaded_file', 'move_uploaded_file', 'intval', 'floatval', 'doubleval', 'strval', 'gettype', 'settype', 'is_null', 'is_resource', 'is_bool', 'is_long', 'is_float', 'is_int', 'is_integer', 'is_double', 'is_real', 'is_numeric', 'is_string', 'is_array', 'is_object', 'is_scalar',
37
- 'ereg', 'ereg_replace', 'eregi', 'eregi_replace', 'split', 'spliti', 'join', 'sql_regcase', 'dl', 'pclose', 'popen', 'readfile', 'rewind', 'rmdir', 'umask', 'fclose', 'feof', 'fgetc', 'fgets', 'fgetss', 'fread', 'fopen', 'fpassthru', 'ftruncate', 'fstat', 'fseek', 'ftell', 'fflush', 'fwrite', 'fputs', 'mkdir', 'rename', 'copy', 'tempnam', 'tmpfile', 'file', 'file_get_contents', 'stream_select', 'stream_context_create', 'stream_context_set_params', 'stream_context_set_option', 'stream_context_get_options', 'stream_filter_prepend', 'stream_filter_append', 'fgetcsv', 'flock', 'get_meta_tags', 'stream_set_write_buffer', 'set_file_buffer', 'set_socket_blocking', 'stream_set_blocking', 'socket_set_blocking', 'stream_get_meta_data', 'stream_register_wrapper', 'stream_wrapper_register', 'stream_set_timeout', 'socket_set_timeout', 'socket_get_status', 'realpath', 'fnmatch', 'fsockopen', 'pfsockopen', 'pack', 'unpack', 'get_browser', 'crypt', 'opendir', 'closedir', 'chdir', 'getcwd', 'rewinddir', 'readdir', 'dir', 'glob', 'fileatime', 'filectime', 'filegroup', 'fileinode', 'filemtime', 'fileowner', 'fileperms', 'filesize', 'filetype', 'file_exists', 'is_writable', 'is_writeable', 'is_readable', 'is_executable', 'is_file', 'is_dir', 'is_link', 'stat', 'lstat', 'chown',
38
- 'touch', 'clearstatcache', 'mail', 'ob_start', 'ob_flush', 'ob_clean', 'ob_end_flush', 'ob_end_clean', 'ob_get_flush', 'ob_get_clean', 'ob_get_length', 'ob_get_level', 'ob_get_status', 'ob_get_contents', 'ob_implicit_flush', 'ob_list_handlers', 'ksort', 'krsort', 'natsort', 'natcasesort', 'asort', 'arsort', 'sort', 'rsort', 'usort', 'uasort', 'uksort', 'shuffle', 'array_walk', 'count', 'end', 'prev', 'next', 'reset', 'current', 'key', 'min', 'max', 'in_array', 'array_search', 'extract', 'compact', 'array_fill', 'range', 'array_multisort', 'array_push', 'array_pop', 'array_shift', 'array_unshift', 'array_splice', 'array_slice', 'array_merge', 'array_merge_recursive', 'array_keys', 'array_values', 'array_count_values', 'array_reverse', 'array_reduce', 'array_pad', 'array_flip', 'array_change_key_case', 'array_rand', 'array_unique', 'array_intersect', 'array_intersect_assoc', 'array_diff', 'array_diff_assoc', 'array_sum', 'array_filter', 'array_map', 'array_chunk', 'array_key_exists', 'pos', 'sizeof', 'key_exists', 'assert', 'assert_options', 'version_compare', 'ftok', 'str_rot13', 'aggregate',
39
- 'session_name', 'session_module_name', 'session_save_path', 'session_id', 'session_regenerate_id', 'session_decode', 'session_register', 'session_unregister', 'session_is_registered', 'session_encode',
40
- 'session_start', 'session_destroy', 'session_unset', 'session_set_save_handler', 'session_cache_limiter', 'session_cache_expire', 'session_set_cookie_params', 'session_get_cookie_params', 'session_write_close', 'preg_match', 'preg_match_all', 'preg_replace', 'preg_replace_callback', 'preg_split', 'preg_quote', 'preg_grep', 'overload', 'ctype_alnum', 'ctype_alpha', 'ctype_cntrl', 'ctype_digit', 'ctype_lower', 'ctype_graph', 'ctype_print', 'ctype_punct', 'ctype_space', 'ctype_upper', 'ctype_xdigit', 'virtual', 'apache_request_headers', 'apache_note', 'apache_lookup_uri', 'apache_child_terminate', 'apache_setenv', 'apache_response_headers', 'apache_get_version', 'getallheaders', 'mysql_connect', 'mysql_pconnect', 'mysql_close', 'mysql_select_db', 'mysql_create_db', 'mysql_drop_db', 'mysql_query', 'mysql_unbuffered_query', 'mysql_db_query', 'mysql_list_dbs', 'mysql_list_tables', 'mysql_list_fields', 'mysql_list_processes', 'mysql_error', 'mysql_errno', 'mysql_affected_rows', 'mysql_insert_id', 'mysql_result', 'mysql_num_rows', 'mysql_num_fields', 'mysql_fetch_row', 'mysql_fetch_array', 'mysql_fetch_assoc', 'mysql_fetch_object', 'mysql_data_seek', 'mysql_fetch_lengths', 'mysql_fetch_field', 'mysql_field_seek', 'mysql_free_result', 'mysql_field_name', 'mysql_field_table', 'mysql_field_len', 'mysql_field_type', 'mysql_field_flags', 'mysql_escape_string', 'mysql_real_escape_string', 'mysql_stat',
41
- 'mysql_thread_id', 'mysql_client_encoding', 'mysql_get_client_info', 'mysql_get_host_info', 'mysql_get_proto_info', 'mysql_get_server_info', 'mysql_info', 'mysql', 'mysql_fieldname', 'mysql_fieldtable', 'mysql_fieldlen', 'mysql_fieldtype', 'mysql_fieldflags', 'mysql_selectdb', 'mysql_createdb', 'mysql_dropdb', 'mysql_freeresult', 'mysql_numfields', 'mysql_numrows', 'mysql_listdbs', 'mysql_listtables', 'mysql_listfields', 'mysql_db_name', 'mysql_dbname', 'mysql_tablename', 'mysql_table_name', 'pg_connect', 'pg_pconnect', 'pg_close', 'pg_connection_status', 'pg_connection_busy', 'pg_connection_reset', 'pg_host', 'pg_dbname', 'pg_port', 'pg_tty', 'pg_options', 'pg_ping', 'pg_query', 'pg_send_query', 'pg_cancel_query', 'pg_fetch_result', 'pg_fetch_row', 'pg_fetch_assoc', 'pg_fetch_array', 'pg_fetch_object', 'pg_fetch_all', 'pg_affected_rows', 'pg_get_result', 'pg_result_seek', 'pg_result_status', 'pg_free_result', 'pg_last_oid', 'pg_num_rows', 'pg_num_fields', 'pg_field_name', 'pg_field_num', 'pg_field_size', 'pg_field_type', 'pg_field_prtlen', 'pg_field_is_null', 'pg_get_notify', 'pg_get_pid', 'pg_result_error', 'pg_last_error', 'pg_last_notice', 'pg_put_line', 'pg_end_copy', 'pg_copy_to', 'pg_copy_from',
42
- 'pg_trace', 'pg_untrace', 'pg_lo_create', 'pg_lo_unlink', 'pg_lo_open', 'pg_lo_close', 'pg_lo_read', 'pg_lo_write', 'pg_lo_read_all', 'pg_lo_import', 'pg_lo_export', 'pg_lo_seek', 'pg_lo_tell', 'pg_escape_string', 'pg_escape_bytea', 'pg_unescape_bytea', 'pg_client_encoding', 'pg_set_client_encoding', 'pg_meta_data', 'pg_convert', 'pg_insert', 'pg_update', 'pg_delete', 'pg_select', 'pg_exec', 'pg_getlastoid', 'pg_cmdtuples', 'pg_errormessage', 'pg_numrows', 'pg_numfields', 'pg_fieldname', 'pg_fieldsize', 'pg_fieldtype', 'pg_fieldnum', 'pg_fieldprtlen', 'pg_fieldisnull', 'pg_freeresult', 'pg_result', 'pg_loreadall', 'pg_locreate', 'pg_lounlink', 'pg_loopen', 'pg_loclose', 'pg_loread', 'pg_lowrite', 'pg_loimport', 'pg_loexport',
43
- 'echo', 'print', 'global', 'static', 'exit', 'array', 'empty', 'eval', 'isset', 'unset', 'die'
44
-
45
- ]
46
- }
47
- ,'OPERATORS' :[
48
- '+', '-', '/', '*', '=', '<', '>', '%', '!', '&&', '||'
49
- ]
50
- ,'DELIMITERS' :[
51
- '(', ')', '[', ']', '{', '}'
52
- ]
53
- ,'REGEXPS' : {
54
- // highlight all variables ($...)
55
- 'variables' : {
56
- 'search' : '()(\\$\\w+)()'
57
- ,'class' : 'variables'
58
- ,'modifiers' : 'g'
59
- ,'execute' : 'before' // before or after
60
- }
61
- }
62
- ,'STYLES' : {
63
- 'COMMENTS': 'color: #AAAAAA;'
64
- ,'QUOTESMARKS': 'color: #879EFA;'
65
- ,'KEYWORDS' : {
66
- 'reserved' : 'color: #48BDDF;'
67
- ,'functions' : 'color: #0040FD;'
68
- ,'statements' : 'color: #60CA00;'
69
- }
70
- ,'OPERATORS' : 'color: #FF00FF;'
71
- ,'DELIMITERS' : 'color: #2B60FF;'
72
- ,'REGEXPS' : {
73
- 'variables' : 'color: #E0BD54;'
74
- }
75
- }
76
- ,'AUTO_COMPLETION' : {
77
- "default": { // the name of this definition group. It's posisble to have different rules inside the same definition file
78
- "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.|
79
- ,"possible_words_letters": "[a-zA-Z0-9_\$]+"
80
- ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$"
81
- ,"prefix_separator": "\\-\\>|\\:\\:"
82
- }
83
- ,"CASE_SENSITIVE": true
84
- ,"MAX_TEXT_LENGTH": 100 // the maximum length of the text being analyzed before the cursor position
85
- ,"KEYWORDS": {
86
- '': [ // the prefix of thoses items
87
- /**
88
- * 0 : the keyword the user is typing
89
- * 1 : (optionnal) the string inserted in code ("{@}" being the new position of the cursor, "§" beeing the equivalent to the value the typed string indicated if the previous )
90
- * If empty the keyword will be displayed
91
- * 2 : (optionnal) the text that appear in the suggestion box (if empty, the string to insert will be displayed)
92
- */
93
- ['$_POST']
94
- ,['$_GET']
95
- ,['$_SESSION']
96
- ,['$_SERVER']
97
- ,['$_FILES']
98
- ,['$_ENV']
99
- ,['$_COOKIE']
100
- ,['$_REQUEST']
101
- // magic methods
102
- ,['__construct', '§( {@} )']
103
- ,['__destruct', '§( {@} )']
104
- ,['__sleep', '§( {@} )']
105
- ,['__wakeup', '§( {@} )']
106
- ,['__toString', '§( {@} )']
107
- // include
108
- ,['include', '§ "{@}";']
109
- ,['include_once', '§ "{@}";']
110
- ,['require', '§ "{@}";']
111
- ,['require_once', '§ "{@}";']
112
- // statements
113
- ,['for', '§( {@} )']
114
- ,['foreach', '§( {@} )']
115
- ,['if', '§( {@} )']
116
- ,['elseif', '§( {@} )']
117
- ,['while', '§( {@} )']
118
- ,['switch', '§( {@} )']
119
- ,['break']
120
- ,['case']
121
- ,['continue']
122
- ,['do']
123
- ,['else']
124
- ,['endif']
125
- ,['endswitch']
126
- ,['endwhile']
127
- ,['return']
128
- // function
129
- ,['unset', '§( {@} )']
130
- ]
131
- }
132
- }
133
- ,"live": {
134
-
135
- // class NAME: /class\W+([a-z]+)\W+/gi
136
- // method: /^(public|private|protected)?\s*function\s+([a-z][a-z0-9\_]*)\s*(\([^\{]*\))/gmi
137
- // static: /^(public|private|protected)?\s+static\s+(public|private|protected)?\s*function\s+([a-z][a-z0-9\_]*)\s*(\([^\{]*\))/gmi
138
- // attributes: /(\$this\-\>|(?:var|public|protected|private)\W+\$)([a-z0-9\_]+)(?!\()\b/gi
139
- // v1 : /(\$this\-\>|var\W+|public\W+|protected\W+|private\W+)([a-z0-9\_]+)\W*(=|;)/gi
140
- // var type: /(\$(this\-\>)?[a-z0-9\_]+)\s*\=\s*new\s+([a-z0-9\_])+/gi
141
-
142
-
143
- "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.|
144
- ,"possible_words_letters": "[a-zA-Z0-9_\$]+"
145
- ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$"
146
- ,"prefix_separator": "\\-\\>"
147
- }
148
- ,"CASE_SENSITIVE": true
149
- ,"MAX_TEXT_LENGTH": 100 // the maximum length of the text being analyzed before the cursor position
150
- ,"KEYWORDS": {
151
- '$this': [ // the prefix of thoses items
152
- ['test']
153
- ]
154
- }
155
- }
156
- }
157
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/python.js DELETED
@@ -1,145 +0,0 @@
1
- /**
2
- * Python syntax v 1.1
3
- *
4
- * v1.1 by Andre Roberge (2006/12/27)
5
- *
6
- **/
7
- editAreaLoader.load_syntax["python"] = {
8
- 'DISPLAY_NAME' : 'Python'
9
- ,'COMMENT_SINGLE' : {1 : '#'}
10
- ,'COMMENT_MULTI' : {}
11
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
12
- ,'KEYWORD_CASE_SENSITIVE' : true
13
- ,'KEYWORDS' : {
14
- /*
15
- ** Set 1: reserved words
16
- ** http://python.org/doc/current/ref/keywords.html
17
- ** Note: 'as' and 'with' have been added starting with Python 2.5
18
- */
19
- 'reserved' : [
20
- 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
21
- 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if',
22
- 'import', 'is', 'in', 'lambda', 'not', 'or', 'pass', 'print', 'raise',
23
- 'return', 'try', 'while', 'with', 'yield'
24
- //the following are *almost* reserved; we'll treat them as such
25
- , 'False', 'True', 'None'
26
- ]
27
- /*
28
- ** Set 2: builtins
29
- ** http://python.org/doc/current/lib/built-in-funcs.html
30
- */
31
- ,'builtins' : [
32
- '__import__', 'abs', 'basestring', 'bool', 'callable', 'chr', 'classmethod', 'cmp',
33
- 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile',
34
- 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
35
- 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals',
36
- 'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
37
- 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
38
- 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode',
39
- 'vars', 'xrange', 'zip',
40
- // Built-in constants: http://www.python.org/doc/2.4.1/lib/node35.html
41
- //'False', 'True', 'None' have been included in 'reserved'
42
- 'NotImplemented', 'Ellipsis',
43
- // Built-in Exceptions: http://python.org/doc/current/lib/module-exceptions.html
44
- 'Exception', 'StandardError', 'ArithmeticError', 'LookupError', 'EnvironmentError',
45
- 'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'IOError',
46
- 'ImportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError',
47
- 'NotImplementedError', 'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError',
48
- 'StopIteration', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError',
49
- 'UnboundlocalError', 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError',
50
- 'UnicodeTranslateError', 'ValueError', 'WindowsError', 'ZeroDivisionError', 'Warning',
51
- 'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning',
52
- 'RuntimeWarning', 'FutureWarning',
53
- // we will include the string methods as well
54
- // http://python.org/doc/current/lib/string-methods.html
55
- 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs',
56
- 'find', 'index', 'isalnum', 'isaplpha', 'isdigit', 'islower', 'isspace', 'istitle',
57
- 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust',
58
- 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',
59
- 'translate', 'upper', 'zfill'
60
- ]
61
- /*
62
- ** Set 3: standard library
63
- ** http://python.org/doc/current/lib/modindex.html
64
- */
65
- ,'stdlib' : [
66
- '__builtin__', '__future__', '__main__', '_winreg', 'aifc', 'AL', 'al', 'anydbm',
67
- 'array', 'asynchat', 'asyncore', 'atexit', 'audioop', 'base64', 'BaseHTTPServer',
68
- 'Bastion', 'binascii', 'binhex', 'bisect', 'bsddb', 'bz2', 'calendar', 'cd', 'cgi',
69
- 'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop',
70
- 'collections', 'colorsys', 'commands', 'compileall', 'compiler', 'compiler',
71
- 'ConfigParser', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'crypt',
72
- 'cStringIO', 'csv', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE',
73
- 'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm',
74
- 'dummy_thread', 'dummy_threading', 'email', 'encodings', 'errno', 'exceptions', 'fcntl',
75
- 'filecmp', 'fileinput', 'FL', 'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl',
76
- 'fpformat', 'ftplib', 'gc', 'gdbm', 'getopt', 'getpass', 'gettext', 'GL', 'gl', 'glob',
77
- 'gopherlib', 'grp', 'gzip', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib',
78
- 'HTMLParser', 'httplib', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'inspect',
79
- 'itertools', 'jpeg', 'keyword', 'linecache', 'locale', 'logging', 'mailbox', 'mailcap',
80
- 'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify',
81
- 'mmap', 'msvcrt', 'multifile', 'mutex', 'netrc', 'new', 'nis', 'nntplib', 'operator',
82
- 'optparse', 'os', 'ossaudiodev', 'parser', 'pdb', 'pickle', 'pickletools', 'pipes',
83
- 'pkgutil', 'platform', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile',
84
- 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random',
85
- 're', 'readline', 'repr', 'resource', 'rexec', 'rfc822', 'rgbimg', 'rlcompleter',
86
- 'robotparser', 'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve',
87
- 'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd',
88
- 'smtplib', 'sndhdr', 'socket', 'SocketServer', 'stat', 'statcache', 'statvfs', 'string',
89
- 'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'SUNAUDIODEV', 'sunaudiodev',
90
- 'symbol', 'sys', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios',
91
- 'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token',
92
- 'tokenize', 'traceback', 'tty', 'turtle', 'types', 'unicodedata', 'unittest', 'urllib2',
93
- 'urllib', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'warnings',
94
- 'wave', 'weakref', 'webbrowser', 'whichdb', 'whrandom', 'winsound', 'xdrlib', 'xml',
95
- 'xmllib', 'xmlrpclib', 'zipfile', 'zipimport', 'zlib'
96
-
97
- ]
98
- /*
99
- ** Set 4: special methods
100
- ** http://python.org/doc/current/ref/specialnames.html
101
- */
102
- ,'special' : [
103
- // Basic customization: http://python.org/doc/current/ref/customization.html
104
- '__new__', '__init__', '__del__', '__repr__', '__str__',
105
- '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__cmp__', '__rcmp__',
106
- '__hash__', '__nonzero__', '__unicode__', '__dict__',
107
- // Attribute access: http://python.org/doc/current/ref/attribute-access.html
108
- '__setattr__', '__delattr__', '__getattr__', '__getattribute__', '__get__', '__set__',
109
- '__delete__', '__slots__',
110
- // Class creation, callable objects
111
- '__metaclass__', '__call__',
112
- // Container types: http://python.org/doc/current/ref/sequence-types.html
113
- '__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__',
114
- '__getslice__', '__setslice__', '__delslice__',
115
- // Numeric types: http://python.org/doc/current/ref/numeric-types.html
116
- '__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__',
117
- '__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__',
118
- '__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__',
119
- '__long__','__lshift__',
120
- '__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__',
121
- '__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__',
122
- '__rshift__','__rsub__','__rmul__','__repr__','__rand__','__rxor__','__ror__',
123
- '__sub__','__xor__'
124
- ]
125
- }
126
- ,'OPERATORS' :[
127
- '+', '-', '/', '*', '=', '<', '>', '%', '!', '&', ';', '?', '`', ':', ','
128
- ]
129
- ,'DELIMITERS' :[
130
- '(', ')', '[', ']', '{', '}'
131
- ]
132
- ,'STYLES' : {
133
- 'COMMENTS': 'color: #AAAAAA;'
134
- ,'QUOTESMARKS': 'color: #660066;'
135
- ,'KEYWORDS' : {
136
- 'reserved' : 'color: #0000FF;'
137
- ,'builtins' : 'color: #009900;'
138
- ,'stdlib' : 'color: #009900;'
139
- ,'special': 'color: #006666;'
140
- }
141
- ,'OPERATORS' : 'color: #993300;'
142
- ,'DELIMITERS' : 'color: #993300;'
143
-
144
- }
145
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/robotstxt.js DELETED
@@ -1,25 +0,0 @@
1
- editAreaLoader.load_syntax["robotstxt"] = {
2
- 'DISPLAY_NAME' : 'Robots txt',
3
- 'COMMENT_SINGLE' : {1 : '#'},
4
- 'COMMENT_MULTI' : {},
5
- 'QUOTEMARKS' : [],
6
- 'KEYWORD_CASE_SENSITIVE' : false,
7
- 'KEYWORDS' : {
8
- 'attributes' : ['User-agent', 'Disallow', 'Allow', 'Crawl-delay'],
9
- 'values' : ['*'],
10
- 'specials' : ['*']
11
- },
12
- 'OPERATORS' :[':'],
13
- 'DELIMITERS' :[],
14
- 'STYLES' : {
15
- 'COMMENTS': 'color: #AAAAAA;',
16
- 'QUOTESMARKS': 'color: #6381F8;',
17
- 'KEYWORDS' : {
18
- 'attributes' : 'color: #48BDDF;',
19
- 'values' : 'color: #2B60FF;',
20
- 'specials' : 'color: #FF0000;'
21
- },
22
- 'OPERATORS' : 'color: #FF00FF;',
23
- 'DELIMITERS' : 'color: #60CA00;'
24
- }
25
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/ruby.js DELETED
@@ -1,68 +0,0 @@
1
- /**
2
- * Ruby syntax v 1.0
3
- *
4
- * v1.0 by Patrice De Saint Steban (2007/01/03)
5
- *
6
- **/
7
- editAreaLoader.load_syntax["ruby"] = {
8
- 'DISPLAY_NAME' : 'Ruby'
9
- ,'COMMENT_SINGLE' : {1 : '#'}
10
- ,'COMMENT_MULTI' : {}
11
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
12
- ,'KEYWORD_CASE_SENSITIVE' : true
13
- ,'KEYWORDS' : {
14
- 'reserved' : [
15
- 'alias', 'and', 'BEGIN', 'begin', 'break', 'case', 'class', 'def', 'defined', 'do', 'else',
16
- 'elsif', 'END', 'end', 'ensure', 'false', 'for', 'if',
17
- 'in', 'module', 'next', 'not', 'or', 'redo', 'rescue', 'retry',
18
- 'return', 'self', 'super', 'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
19
- ]
20
- }
21
- ,'OPERATORS' :[
22
- '+', '-', '/', '*', '=', '<', '>', '%', '!', '&', ';', '?', '`', ':', ','
23
- ]
24
- ,'DELIMITERS' :[
25
- '(', ')', '[', ']', '{', '}'
26
- ]
27
- ,'REGEXPS' : {
28
- 'constants' : {
29
- 'search' : '()([A-Z]\\w*)()'
30
- ,'class' : 'constants'
31
- ,'modifiers' : 'g'
32
- ,'execute' : 'before'
33
- }
34
- ,'variables' : {
35
- 'search' : '()([\$\@\%]+\\w+)()'
36
- ,'class' : 'variables'
37
- ,'modifiers' : 'g'
38
- ,'execute' : 'before'
39
- }
40
- ,'numbers' : {
41
- 'search' : '()(-?[0-9]+)()'
42
- ,'class' : 'numbers'
43
- ,'modifiers' : 'g'
44
- ,'execute' : 'before'
45
- }
46
- ,'symbols' : {
47
- 'search' : '()(:\\w+)()'
48
- ,'class' : 'symbols'
49
- ,'modifiers' : 'g'
50
- ,'execute' : 'before'
51
- }
52
- }
53
- ,'STYLES' : {
54
- 'COMMENTS': 'color: #AAAAAA;'
55
- ,'QUOTESMARKS': 'color: #660066;'
56
- ,'KEYWORDS' : {
57
- 'reserved' : 'font-weight: bold; color: #0000FF;'
58
- }
59
- ,'OPERATORS' : 'color: #993300;'
60
- ,'DELIMITERS' : 'color: #993300;'
61
- ,'REGEXPS' : {
62
- 'variables' : 'color: #E0BD54;'
63
- ,'numbers' : 'color: green;'
64
- ,'constants' : 'color: #00AA00;'
65
- ,'symbols' : 'color: #879EFA;'
66
- }
67
- }
68
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/sql.js DELETED
@@ -1,56 +0,0 @@
1
- editAreaLoader.load_syntax["sql"] = {
2
- 'DISPLAY_NAME' : 'SQL'
3
- ,'COMMENT_SINGLE' : {1 : '--'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : {1: "'", 2: '"', 3: '`'}
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'statements' : [
9
- 'select', 'SELECT', 'where', 'order', 'by',
10
- 'insert', 'from', 'update', 'grant', 'left join', 'right join',
11
- 'union', 'group', 'having', 'limit', 'alter', 'LIKE','IN','CASE'
12
- ]
13
- ,'reserved' : [
14
- 'null', 'enum', 'int', 'boolean', 'add', 'varchar'
15
-
16
- ]
17
- ,'functions' : [
18
- 'ABS','ACOS','ADDDATE','ADDTIME','AES_DECRYPT','AES_ENCRYPT','ASCII','ASIN','ATAN2 ATAN','ATAN','AVG','BENCHMARK','DISTINCT','BIN','BIT_AND','BIT_COUNT','BIT_LENGTH','BIT_OR','BIT_XOR','CAST','CEILING CEIL','CHAR_LENGTH','CHAR',
19
- 'CHARACTER_LENGTH','CHARSET','COALESCE','COERCIBILITY','COLLATION','COMPRESS','CONCAT_WS','CONCAT','CONNECTION_ID','CONV','CONVERT_TZ','COS','COT','COUNT','CRC32','CURDATE','CURRENT_DATE','CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','CURTIME','DATABASE','DATE_ADD','DATE_FORMAT','DATE_SUB','DATE','DATEDIFF','DAY','DAYNAME','DAYOFMONTH',
20
- 'DAYOFWEEK','DAYOFYEAR','DECODE','DEFAULT','DEGREES','DES_DECRYPT','DES_ENCRYPT','ELT','ENCODE','ENCRYPT','EXP','EXPORT_SET','EXTRACT','FIELD','FIND_IN_SET','FLOOR','FORMAT','FOUND_ROWS','FROM_DAYS','FROM_UNIXTIME','GET_FORMAT','GET_LOCK','GREATEST','GROUP_CONCAT','HEX','HOUR','IF','IFNULL','INET_ATON','INET_NTOA',
21
- 'INSERT','INSTR','INTERVAL','IS_FREE_LOCK','IS_USED_LOCK','ISNULL','LAST_DAY','LAST_INSERT_ID','LCASE','LEAST','LEFT','LENGTH','LN','LOAD_FILE','LOCALTIME','LOCALTIMESTAMP','LOCATE','LOG10','LOG2','LOG','LOWER','LPAD','LTRIM','MAKE_SET','MAKEDATE','MAKETIME','MASTER_POS_WAIT','MAX','MD5','MICROSECOND',
22
- 'MID','MIN','MINUTE','MOD','MONTH','MONTHNAME','NOW','NULLIF','OCT','OCTET_LENGTH','OLD_PASSWORD','ORD','PASSWORD','PERIOD_ADD','PERIOD_DIFF','PI','POSITION','POW','POWER','PROCEDURE ANALYSE','QUARTER','QUOTE','RADIANS','RAND','RELEASE_LOCK','REPEAT','REPLACE','REVERSE','RIGHT','ROUND',
23
- 'RPAD','RTRIM','SEC_TO_TIME','SECOND','SESSION_USER','SHA1','SHA','SIGN','SIN','SOUNDEX','SOUNDS LIKE','SPACE','SQRT','STD','STDDEV','STR_TO_DATE','STRCMP','SUBDATE','SUBSTRING_INDEX','SUBSTRING','SUBSTR','SUBTIME','SUM','SYSDATE','SYSTEM_USER','TAN','TIME_FORMAT','TIME_TO_SEC','TIME','TIMEDIFF',
24
- 'TIMESTAMP','TO_DAYS','TRIM','TRUNCATE','UCASE','UNCOMPRESS','UNCOMPRESSED_LENGTH','UNHEX','UNIX_TIMESTAMP','UPPER','USER','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','UUID','VALUES','VARIANCE','WEEK','WEEKDAY','WEEKOFYEAR','YEAR','YEARWEEK'
25
- ]
26
- }
27
- ,'OPERATORS' :[
28
- 'AND','&&','BETWEEN','BINARY','&','|','^','/','DIV','<=>','=','>=','>','<<','>>','IS','NULL','<=','<','-','%','!=','<>','!','||','OR','+','REGEXP','RLIKE','XOR','~','*'
29
- ]
30
- ,'DELIMITERS' :[
31
- '(', ')', '[', ']', '{', '}'
32
- ]
33
- ,'REGEXPS' : {
34
- // highlight all variables (@...)
35
- 'variables' : {
36
- 'search' : '()(\\@\\w+)()'
37
- ,'class' : 'variables'
38
- ,'modifiers' : 'g'
39
- ,'execute' : 'before' // before or after
40
- }
41
- }
42
- ,'STYLES' : {
43
- 'COMMENTS': 'color: #AAAAAA;'
44
- ,'QUOTESMARKS': 'color: #879EFA;'
45
- ,'KEYWORDS' : {
46
- 'reserved' : 'color: #48BDDF;'
47
- ,'functions' : 'color: #0040FD;'
48
- ,'statements' : 'color: #60CA00;'
49
- }
50
- ,'OPERATORS' : 'color: #FF00FF;'
51
- ,'DELIMITERS' : 'color: #2B60FF;'
52
- ,'REGEXPS' : {
53
- 'variables' : 'color: #E0BD54;'
54
- }
55
- }
56
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/tsql.js DELETED
@@ -1,88 +0,0 @@
1
- editAreaLoader.load_syntax["tsql"] = {
2
- 'DISPLAY_NAME' : 'T-SQL'
3
- ,'COMMENT_SINGLE' : {1 : '--'}
4
- ,'COMMENT_MULTI' : {'/*' : '*/'}
5
- ,'QUOTEMARKS' : {1: "'" }
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'statements': [
9
- 'ADD', 'EXCEPT', 'PERCENT', 'EXEC', 'PLAN', 'ALTER', 'EXECUTE', 'PRECISION',
10
- 'PRIMARY', 'EXIT', 'PRINT', 'AS', 'FETCH', 'PROC', 'ASC',
11
- 'FILE', 'PROCEDURE', 'AUTHORIZATION', 'FILLFACTOR', 'PUBLIC', 'BACKUP', 'FOR', 'RAISERROR',
12
- 'BEGIN', 'FOREIGN', 'READ', 'FREETEXT', 'READTEXT', 'BREAK', 'FREETEXTTABLE',
13
- 'RECONFIGURE', 'BROWSE', 'FROM', 'REFERENCES', 'BULK', 'FULL', 'REPLICATION', 'BY',
14
- 'FUNCTION', 'RESTORE', 'CASCADE', 'GOTO', 'RESTRICT', 'CASE', 'GRANT', 'RETURN',
15
- 'CHECK', 'GROUP', 'REVOKE', 'CHECKPOINT', 'HAVING', 'RIGHT', 'CLOSE', 'HOLDLOCK', 'ROLLBACK',
16
- 'CLUSTERED', 'IDENTITY', 'ROWCOUNT', 'IDENTITY_INSERT', 'ROWGUIDCOL', 'COLLATE',
17
- 'IDENTITYCOL', 'RULE', 'COLUMN', 'IF', 'SAVE', 'COMMIT', 'SCHEMA', 'COMPUTE', 'INDEX',
18
- 'SELECT', 'CONSTRAINT', 'CONTAINS', 'INSERT', 'SET',
19
- 'CONTAINSTABLE', 'INTERSECT', 'SETUSER', 'CONTINUE', 'INTO', 'SHUTDOWN', 'SOME',
20
- 'CREATE', 'STATISTICS', 'KEY', 'CURRENT', 'KILL', 'TABLE',
21
- 'CURRENT_DATE', 'TEXTSIZE', 'CURRENT_TIME', 'THEN', 'LINENO',
22
- 'TO', 'LOAD', 'TOP', 'CURSOR', 'NATIONAL', 'TRAN', 'DATABASE', 'NOCHECK',
23
- 'TRANSACTION', 'DBCC', 'NONCLUSTERED', 'TRIGGER', 'DEALLOCATE', 'TRUNCATE',
24
- 'DECLARE', 'TSEQUAL', 'DEFAULT', 'UNION', 'DELETE', 'OF', 'UNIQUE',
25
- 'DENY', 'OFF', 'UPDATE', 'DESC', 'OFFSETS', 'UPDATETEXT', 'DISK', 'ON', 'USE', 'DISTINCT', 'OPEN',
26
- 'DISTRIBUTED', 'OPENDATASOURCE', 'VALUES', 'DOUBLE', 'OPENQUERY', 'VARYING', 'DROP',
27
- 'OPENROWSET', 'VIEW', 'DUMMY', 'OPENXML', 'WAITFOR', 'DUMP', 'OPTION', 'WHEN', 'ELSE', 'WHERE',
28
- 'END', 'ORDER', 'WHILE', 'ERRLVL', 'WITH', 'ESCAPE', 'OVER', 'WRITETEXT'
29
- ],
30
- 'functions': [
31
- 'COALESCE', 'SESSION_USER', 'CONVERT', 'SYSTEM_USER', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'NULLIF', 'USER',
32
- 'AVG', 'MIN', 'CHECKSUM', 'SUM', 'CHECKSUM_AGG', 'STDEV', 'COUNT', 'STDEVP', 'COUNT_BIG', 'VAR', 'GROUPING', 'VARP', 'MAX',
33
- '@@DATEFIRST', '@@OPTIONS', '@@DBTS', '@@REMSERVER', '@@LANGID', '@@SERVERNAME', '@@LANGUAGE', '@@SERVICENAME', '@@LOCK_TIMEOUT',
34
- '@@SPID', '@@MAX_CONNECTIONS', '@@TEXTSIZE', '@@MAX_PRECISION', '@@VERSION', '@@NESTLEVEL',
35
- '@@CURSOR_ROWS', 'CURSOR_STATUS', '@@FETCH_STATUS',
36
- 'DATEADD', 'DATEDIFF', 'DATENAME', 'DATEPART', 'DAY', 'GETDATE', 'GETUTCDATE', 'MONTH', 'YEAR',
37
- 'ABS', 'DEGREES', 'RAND', 'ACOS', 'EXP', 'ROUND', 'ASIN', 'FLOOR', 'SIGN', 'ATAN', 'LOG', 'SIN', 'ATN2', 'LOG10', 'SQRT',
38
- 'CEILING', 'PI ', 'SQUARE', 'COS', 'POWER', 'TAN', 'COT', 'RADIANS',
39
- '@@PROCID', 'COL_LENGTH', 'FULLTEXTCATALOGPROPERTY', 'COL_NAME', 'FULLTEXTSERVICEPROPERTY', 'COLUMNPROPERTY', 'INDEX_COL',
40
- 'DATABASEPROPERTY', 'INDEXKEY_PROPERTY', 'DATABASEPROPERTYEX', 'INDEXPROPERTY', 'DB_ID', 'OBJECT_ID', 'DB_NAME', 'OBJECT_NAME',
41
- 'FILE_ID', 'OBJECTPROPERTY', 'OBJECTPROPERTYEX', 'FILE_NAME', 'SQL_VARIANT_PROPERTY', 'FILEGROUP_ID', 'FILEGROUP_NAME',
42
- 'FILEGROUPPROPERTY', 'TYPEPROPERTY', 'FILEPROPERTY',
43
- 'CURRENT_USER', 'SUSER_ID', 'SUSER_SID', 'IS_MEMBER', 'SUSER_SNAME', 'IS_SRVROLEMEMBER', 'PERMISSIONS', 'SYSTEM_USER',
44
- 'SUSER_NAME', 'USER_ID', 'SESSION_USER', 'USER_NAME', 'ASCII', 'SOUNDEX', 'PATINDEX', 'SPACE', 'CHARINDEX', 'QUOTENAME',
45
- 'STR', 'DIFFERENCE', 'REPLACE', 'STUFF', 'REPLICATE', 'SUBSTRING', 'LEN', 'REVERSE', 'UNICODE', 'LOWER',
46
- 'UPPER', 'LTRIM', 'RTRIM', 'APP_NAME', 'CAST', 'CONVERT', 'COALESCE', 'COLLATIONPROPERTY', 'COLUMNS_UPDATED', 'CURRENT_TIMESTAMP',
47
- 'CURRENT_USER', 'DATALENGTH', '@@ERROR', 'FORMATMESSAGE', 'GETANSINULL', 'HOST_ID', 'HOST_NAME', 'IDENT_CURRENT', 'IDENT_INCR',
48
- 'IDENT_SEED', '@@IDENTITY', 'ISDATE', 'ISNULL', 'ISNUMERIC', 'NEWID', 'NULLIF', 'PARSENAME', '@@ROWCOUNT',
49
- 'SCOPE_IDENTITY', 'SERVERPROPERTY', 'SESSIONPROPERTY', 'SESSION_USER', 'STATS_DATE', 'SYSTEM_USER', '@@TRANCOUNT', 'USER_NAME',
50
- '@@CONNECTIONS', '@@PACK_RECEIVED', '@@CPU_BUSY', '@@PACK_SENT', '@@TIMETICKS', '@@IDLE', '@@TOTAL_ERRORS', '@@IO_BUSY', '@@TOTAL_READ',
51
- '@@PACKET_ERRORS', '@@TOTAL_WRITE', 'PATINDEX', 'TEXTVALID', 'TEXTPTR'
52
- ],
53
- 'reserved': [
54
- 'RIGHT', 'INNER', 'IS', 'JOIN', 'CROSS', 'LEFT', 'NULL', 'OUTER'
55
- ]
56
- }
57
- ,'OPERATORS' :[
58
- '+', '-', '*', '/', '%', '=', '&' ,'|', '^', '>', '<', '>=', '<=', '<>', '!=', '!<', '!>', 'ALL', 'AND', 'ANY', 'BETWEEN', 'EXISTS', 'IN', 'LIKE', 'NOT', 'OR', '~'
59
- ]
60
- ,'DELIMITERS' :[
61
- '(', ')', '[', ']', '{', '}'
62
- ]
63
- ,'REGEXPS' : {
64
- // highlight all variables (@...)
65
- 'variables' : {
66
- 'search' : '()(\\@\\w+)()'
67
- ,'class' : 'variables'
68
- ,'modifiers' : 'g'
69
- ,'execute' : 'before' // before or after
70
- }
71
- }
72
- ,'STYLES' : {
73
- 'COMMENTS': 'color: #008000;'
74
- ,'QUOTESMARKS': 'color: #FF0000;'
75
- ,'KEYWORDS' : {
76
- 'reserved' : 'color: #808080;'
77
- ,'functions' : 'color: #FF00FF;'
78
- ,'statements' : 'color: #0000FF;'
79
- }
80
- ,'OPERATORS' : 'color: #808080;'
81
- ,'DELIMITERS' : 'color: #FF8000;'
82
- ,'REGEXPS' : {
83
- 'variables' : 'color: #E0BD54;'
84
- }
85
- }
86
- };
87
-
88
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/vb.js DELETED
@@ -1,53 +0,0 @@
1
- editAreaLoader.load_syntax["vb"] = {
2
- 'DISPLAY_NAME' : 'Visual Basic'
3
- ,'COMMENT_SINGLE' : {1 : "'"}
4
- ,'COMMENT_MULTI' : { }
5
- ,'QUOTEMARKS' : {1: '"'}
6
- ,'KEYWORD_CASE_SENSITIVE' : false
7
- ,'KEYWORDS' : {
8
- 'statements' : [
9
- 'if','then','for','each','while','do','loop',
10
- 'else','elseif','select','case','end select',
11
- 'until','next','step','to','in','end if'
12
- ]
13
- ,'keywords' : [
14
- 'empty','isempty','nothing','null','isnull','true','false',
15
- 'set','call',
16
- 'sub','end sub','function','end function','exit','exit function',
17
- 'dim','Mod','In','private','public','shared','const'
18
- ]
19
-
20
- ,'functions' : [
21
- 'CDate','Date','DateAdd','DateDiff','DatePart','DateSerial','DateValue','Day','FormatDateTime',
22
- 'Hour','IsDate','Minute','Month',
23
- 'MonthName','Now','Second','Time','Timer','TimeSerial','TimeValue','Weekday','WeekdayName ','Year',
24
- 'Asc','CBool','CByte','CCur','CDate','CDbl','Chr','CInt','CLng','CSng','CStr','Hex','Oct','FormatCurrency',
25
- 'FormatDateTime','FormatNumber','FormatPercent','Abs','Atn','Cos','Exp','Hex','Int','Fix','Log','Oct',
26
- 'Rnd','Sgn','Sin','Sqr','Tan',
27
- 'Array','Filter','IsArray','Join','LBound','Split','UBound',
28
- 'InStr','InStrRev','LCase','Left','Len','LTrim','RTrim','Trim','Mid','Replace','Right','Space','StrComp',
29
- 'String','StrReverse','UCase',
30
- 'CreateObject','Eval','GetLocale','GetObject','GetRef','InputBox','IsEmpty','IsNull','IsNumeric',
31
- 'IsObject','LoadPicture','MsgBox','RGB','Round','ScriptEngine','ScriptEngineBuildVersion','ScriptEngineMajorVersion',
32
- 'ScriptEngineMinorVersion','SetLocale','TypeName','VarType'
33
- ]
34
- }
35
- ,'OPERATORS' :[
36
- '+', '-', '/', '*', '=', '<', '>', '!', '&'
37
- ]
38
- ,'DELIMITERS' :[
39
- '(', ')', '[', ']', '{', '}'
40
- ]
41
- ,'STYLES' : {
42
- 'COMMENTS': 'color: #99CC00;'
43
- ,'QUOTESMARKS': 'color: #333399;'
44
- ,'KEYWORDS' : {
45
- 'keywords' : 'color: #3366FF;'
46
- ,'functions' : 'color: #0000FF;'
47
- ,'statements' : 'color: #3366FF;'
48
- }
49
- ,'OPERATORS' : 'color: #FF0000;'
50
- ,'DELIMITERS' : 'color: #0000FF;'
51
-
52
- }
53
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/reg_syntax/xml.js DELETED
@@ -1,57 +0,0 @@
1
- /*
2
- * last update: 2006-08-24
3
- */
4
-
5
- editAreaLoader.load_syntax["xml"] = {
6
- 'DISPLAY_NAME' : 'XML'
7
- ,'COMMENT_SINGLE' : {}
8
- ,'COMMENT_MULTI' : {'<!--' : '-->'}
9
- ,'QUOTEMARKS' : {1: "'", 2: '"'}
10
- ,'KEYWORD_CASE_SENSITIVE' : false
11
- ,'KEYWORDS' : {
12
- }
13
- ,'OPERATORS' :[
14
- ]
15
- ,'DELIMITERS' :[
16
- ]
17
- ,'REGEXPS' : {
18
- 'xml' : {
19
- 'search' : '()(<\\?[^>]*?\\?>)()'
20
- ,'class' : 'xml'
21
- ,'modifiers' : 'g'
22
- ,'execute' : 'before' // before or after
23
- }
24
- ,'cdatas' : {
25
- 'search' : '()(<!\\[CDATA\\[.*?\\]\\]>)()'
26
- ,'class' : 'cdata'
27
- ,'modifiers' : 'g'
28
- ,'execute' : 'before' // before or after
29
- }
30
- ,'tags' : {
31
- 'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)'
32
- ,'class' : 'tags'
33
- ,'modifiers' : 'gi'
34
- ,'execute' : 'before' // before or after
35
- }
36
- ,'attributes' : {
37
- 'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)'
38
- ,'class' : 'attributes'
39
- ,'modifiers' : 'g'
40
- ,'execute' : 'before' // before or after
41
- }
42
- }
43
- ,'STYLES' : {
44
- 'COMMENTS': 'color: #AAAAAA;'
45
- ,'QUOTESMARKS': 'color: #6381F8;'
46
- ,'KEYWORDS' : {
47
- }
48
- ,'OPERATORS' : 'color: #E775F0;'
49
- ,'DELIMITERS' : ''
50
- ,'REGEXPS' : {
51
- 'attributes': 'color: #B1AC41;'
52
- ,'tags': 'color: #E62253;'
53
- ,'xml': 'color: #8DCFB5;'
54
- ,'cdata': 'color: #50B020;'
55
- }
56
- }
57
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/regexp.js DELETED
@@ -1,139 +0,0 @@
1
- /*EditArea.prototype.comment_or_quotes= function(v0, v1, v2, v3, v4,v5,v6,v7,v8,v9, v10){
2
- new_class="quotes";
3
- if(v6 && v6 != undefined && v6!="")
4
- new_class="comments";
5
- return "µ__"+ new_class +"__µ"+v0+"µ_END_µ";
6
-
7
- };*/
8
-
9
- /* EditArea.prototype.htmlTag= function(v0, v1, v2, v3, v4,v5,v6,v7,v8,v9, v10){
10
- res="<span class=htmlTag>"+v2;
11
- alert("v2: "+v2+" v3: "+v3);
12
- tab=v3.split("=");
13
- attributes="";
14
- if(tab.length>1){
15
- attributes="<span class=attribute>"+tab[0]+"</span>=";
16
- for(i=1; i<tab.length-1; i++){
17
- cut=tab[i].lastIndexOf("&nbsp;");
18
- attributes+="<span class=attributeVal>"+tab[i].substr(0,cut)+"</span>";
19
- attributes+="<span class=attribute>"+tab[i].substr(cut)+"</span>=";
20
- }
21
- attributes+="<span class=attributeVal>"+tab[tab.length-1]+"</span>";
22
- }
23
- res+=attributes+v5+"</span>";
24
- return res;
25
- };*/
26
-
27
- // determine if the selected text if a comment or a quoted text
28
- EditArea.prototype.comment_or_quote= function(){
29
- var new_class="", close_tag="", sy, arg, i;
30
- sy = parent.editAreaLoader.syntax[editArea.current_code_lang];
31
- arg = EditArea.prototype.comment_or_quote.arguments[0];
32
-
33
- for( i in sy["quotes"] ){
34
- if(arg.indexOf(i)==0){
35
- new_class="quotesmarks";
36
- close_tag=sy["quotes"][i];
37
- }
38
- }
39
- if(new_class.length==0)
40
- {
41
- for(var i in sy["comments"]){
42
- if( arg.indexOf(i)==0 ){
43
- new_class="comments";
44
- close_tag=sy["comments"][i];
45
- }
46
- }
47
- }
48
- // for single line comment the \n must not be included in the span tags
49
- if(close_tag=="\n"){
50
- return "µ__"+ new_class +"__µ"+ arg.replace(/(\r?\n)?$/m, "µ_END_µ$1");
51
- }else{
52
- // the closing tag must be set only if the comment or quotes is closed
53
- reg= new RegExp(parent.editAreaLoader.get_escaped_regexp(close_tag)+"$", "m");
54
- if( arg.search(reg)!=-1 )
55
- return "µ__"+ new_class +"__µ"+ arg +"µ_END_µ";
56
- else
57
- return "µ__"+ new_class +"__µ"+ arg;
58
- }
59
- };
60
-
61
- /*
62
- // apply special tags arround text to highlight
63
- EditArea.prototype.custom_highlight= function(){
64
- res= EditArea.prototype.custom_highlight.arguments[1]+"µ__"+ editArea.reg_exp_span_tag +"__µ" + EditArea.prototype.custom_highlight.arguments[2]+"µ_END_µ";
65
- if(EditArea.prototype.custom_highlight.arguments.length>5)
66
- res+= EditArea.prototype.custom_highlight.arguments[ EditArea.prototype.custom_highlight.arguments.length-3 ];
67
- return res;
68
- };
69
- */
70
-
71
- // return identication that allow to know if revalidating only the text line won't make the syntax go mad
72
- EditArea.prototype.get_syntax_trace= function(text){
73
- if(this.settings["syntax"].length>0 && parent.editAreaLoader.syntax[this.settings["syntax"]]["syntax_trace_regexp"])
74
- return text.replace(parent.editAreaLoader.syntax[this.settings["syntax"]]["syntax_trace_regexp"], "$3");
75
- };
76
-
77
-
78
- EditArea.prototype.colorize_text= function(text){
79
- //text="<div id='result' class='area' style='position: relative; z-index: 4; height: 500px; overflow: scroll;border: solid black 1px;'> ";
80
- /*
81
- if(this.isOpera){
82
- // opera can't use pre element tabulation cause a tab=6 chars in the textarea and 8 chars in the pre
83
- text= this.replace_tab(text);
84
- }*/
85
-
86
- text= " "+text; // for easier regExp
87
-
88
- /*if(this.do_html_tags)
89
- text= text.replace(/(<[a-z]+ [^>]*>)/gi, '[__htmlTag__]$1[_END_]');*/
90
- if(this.settings["syntax"].length>0)
91
- text= this.apply_syntax(text, this.settings["syntax"]);
92
-
93
- // remove the first space added
94
- return text.substr(1).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/µ_END_µ/g,"</span>").replace(/µ__([a-zA-Z0-9]+)__µ/g,"<span class='$1'>");
95
- };
96
-
97
- EditArea.prototype.apply_syntax= function(text, lang){
98
- var sy;
99
- this.current_code_lang=lang;
100
-
101
- if(!parent.editAreaLoader.syntax[lang])
102
- return text;
103
-
104
- sy = parent.editAreaLoader.syntax[lang];
105
- if(sy["custom_regexp"]['before']){
106
- for( var i in sy["custom_regexp"]['before']){
107
- var convert="$1µ__"+ sy["custom_regexp"]['before'][i]['class'] +"__µ$2µ_END_µ$3";
108
- text= text.replace(sy["custom_regexp"]['before'][i]['regexp'], convert);
109
- }
110
- }
111
-
112
- if(sy["comment_or_quote_reg_exp"]){
113
- //setTimeout("_$('debug_area').value=editArea.comment_or_quote_reg_exp;", 500);
114
- text= text.replace(sy["comment_or_quote_reg_exp"], this.comment_or_quote);
115
- }
116
-
117
- if(sy["keywords_reg_exp"]){
118
- for(var i in sy["keywords_reg_exp"]){
119
- text= text.replace(sy["keywords_reg_exp"][i], 'µ__'+i+'__µ$2µ_END_µ');
120
- }
121
- }
122
-
123
- if(sy["delimiters_reg_exp"]){
124
- text= text.replace(sy["delimiters_reg_exp"], 'µ__delimiters__µ$1µ_END_µ');
125
- }
126
-
127
- if(sy["operators_reg_exp"]){
128
- text= text.replace(sy["operators_reg_exp"], 'µ__operators__µ$1µ_END_µ');
129
- }
130
-
131
- if(sy["custom_regexp"]['after']){
132
- for( var i in sy["custom_regexp"]['after']){
133
- var convert="$1µ__"+ sy["custom_regexp"]['after'][i]['class'] +"__µ$2µ_END_µ$3";
134
- text= text.replace(sy["custom_regexp"]['after'][i]['regexp'], convert);
135
- }
136
- }
137
-
138
- return text;
139
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/resize_area.js DELETED
@@ -1,73 +0,0 @@
1
-
2
- EditAreaLoader.prototype.start_resize_area= function(){
3
- var d=document,a,div,width,height,father;
4
-
5
- d.onmouseup= editAreaLoader.end_resize_area;
6
- d.onmousemove= editAreaLoader.resize_area;
7
- editAreaLoader.toggle(editAreaLoader.resize["id"]);
8
-
9
- a = editAreas[editAreaLoader.resize["id"]]["textarea"];
10
- div = d.getElementById("edit_area_resize");
11
- if(!div){
12
- div= d.createElement("div");
13
- div.id="edit_area_resize";
14
- div.style.border="dashed #888888 1px";
15
- }
16
- width = a.offsetWidth -2;
17
- height = a.offsetHeight -2;
18
-
19
- div.style.display = "block";
20
- div.style.width = width+"px";
21
- div.style.height = height+"px";
22
- father= a.parentNode;
23
- father.insertBefore(div, a);
24
-
25
- a.style.display="none";
26
-
27
- editAreaLoader.resize["start_top"]= calculeOffsetTop(div);
28
- editAreaLoader.resize["start_left"]= calculeOffsetLeft(div);
29
- };
30
-
31
- EditAreaLoader.prototype.end_resize_area= function(e){
32
- var d=document,div,a,width,height;
33
-
34
- d.onmouseup="";
35
- d.onmousemove="";
36
-
37
- div = d.getElementById("edit_area_resize");
38
- a= editAreas[editAreaLoader.resize["id"]]["textarea"];
39
- width = Math.max(editAreas[editAreaLoader.resize["id"]]["settings"]["min_width"], div.offsetWidth-4);
40
- height = Math.max(editAreas[editAreaLoader.resize["id"]]["settings"]["min_height"], div.offsetHeight-4);
41
- if(editAreaLoader.isIE==6){
42
- width-=2;
43
- height-=2;
44
- }
45
- a.style.width = width+"px";
46
- a.style.height = height+"px";
47
- div.style.display = "none";
48
- a.style.display = "inline";
49
- a.selectionStart = editAreaLoader.resize["selectionStart"];
50
- a.selectionEnd = editAreaLoader.resize["selectionEnd"];
51
- editAreaLoader.toggle(editAreaLoader.resize["id"]);
52
-
53
- return false;
54
- };
55
-
56
- EditAreaLoader.prototype.resize_area= function(e){
57
- var allow,newHeight,newWidth;
58
- allow = editAreas[editAreaLoader.resize["id"]]["settings"]["allow_resize"];
59
- if(allow=="both" || allow=="y")
60
- {
61
- newHeight = Math.max(20, getMouseY(e)- editAreaLoader.resize["start_top"]);
62
- document.getElementById("edit_area_resize").style.height= newHeight+"px";
63
- }
64
- if(allow=="both" || allow=="x")
65
- {
66
- newWidth= Math.max(20, getMouseX(e)- editAreaLoader.resize["start_left"]);
67
- document.getElementById("edit_area_resize").style.width= newWidth+"px";
68
- }
69
-
70
- return false;
71
- };
72
-
73
- editAreaLoader.waiting_loading["resize_area.js"]= "loaded";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/search_replace.js DELETED
@@ -1,174 +0,0 @@
1
- EditArea.prototype.show_search = function(){
2
- if(_$("area_search_replace").style.visibility=="visible"){
3
- this.hidden_search();
4
- }else{
5
- this.open_inline_popup("area_search_replace");
6
- var text= this.area_get_selection();
7
- var search= text.split("\n")[0];
8
- _$("area_search").value= search;
9
- _$("area_search").focus();
10
- }
11
- };
12
-
13
- EditArea.prototype.hidden_search= function(){
14
- /*_$("area_search_replace").style.visibility="hidden";
15
- this.textarea.focus();
16
- var icon= _$("search");
17
- setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") );*/
18
- this.close_inline_popup("area_search_replace");
19
- };
20
-
21
- EditArea.prototype.area_search= function(mode){
22
-
23
- if(!mode)
24
- mode="search";
25
- _$("area_search_msg").innerHTML="";
26
- var search=_$("area_search").value;
27
-
28
- this.textarea.focus();
29
- this.textarea.textareaFocused=true;
30
-
31
- var infos= this.get_selection_infos();
32
- var start= infos["selectionStart"];
33
- var pos=-1;
34
- var pos_begin=-1;
35
- var length=search.length;
36
-
37
- if(_$("area_search_replace").style.visibility!="visible"){
38
- this.show_search();
39
- return;
40
- }
41
- if(search.length==0){
42
- _$("area_search_msg").innerHTML=this.get_translation("search_field_empty");
43
- return;
44
- }
45
- // advance to the next occurence if no text selected
46
- if(mode!="replace" ){
47
- if(_$("area_search_reg_exp").checked)
48
- start++;
49
- else
50
- start+= search.length;
51
- }
52
-
53
- //search
54
- if(_$("area_search_reg_exp").checked){
55
- // regexp search
56
- var opt="m";
57
- if(!_$("area_search_match_case").checked)
58
- opt+="i";
59
- var reg= new RegExp(search, opt);
60
- pos= infos["full_text"].substr(start).search(reg);
61
- pos_begin= infos["full_text"].search(reg);
62
- if(pos!=-1){
63
- pos+=start;
64
- length=infos["full_text"].substr(start).match(reg)[0].length;
65
- }else if(pos_begin!=-1){
66
- length=infos["full_text"].match(reg)[0].length;
67
- }
68
- }else{
69
- if(_$("area_search_match_case").checked){
70
- pos= infos["full_text"].indexOf(search, start);
71
- pos_begin= infos["full_text"].indexOf(search);
72
- }else{
73
- pos= infos["full_text"].toLowerCase().indexOf(search.toLowerCase(), start);
74
- pos_begin= infos["full_text"].toLowerCase().indexOf(search.toLowerCase());
75
- }
76
- }
77
-
78
- // interpret result
79
- if(pos==-1 && pos_begin==-1){
80
- _$("area_search_msg").innerHTML="<strong>"+search+"</strong> "+this.get_translation("not_found");
81
- return;
82
- }else if(pos==-1 && pos_begin != -1){
83
- begin= pos_begin;
84
- _$("area_search_msg").innerHTML=this.get_translation("restart_search_at_begin");
85
- }else
86
- begin= pos;
87
-
88
- //_$("area_search_msg").innerHTML+="<strong>"+search+"</strong> found at "+begin+" strat at "+start+" pos "+pos+" curs"+ infos["indexOfCursor"]+".";
89
- if(mode=="replace" && pos==infos["indexOfCursor"]){
90
- var replace= _$("area_replace").value;
91
- var new_text="";
92
- if(_$("area_search_reg_exp").checked){
93
- var opt="m";
94
- if(!_$("area_search_match_case").checked)
95
- opt+="i";
96
- var reg= new RegExp(search, opt);
97
- new_text= infos["full_text"].substr(0, begin) + infos["full_text"].substr(start).replace(reg, replace);
98
- }else{
99
- new_text= infos["full_text"].substr(0, begin) + replace + infos["full_text"].substr(begin + length);
100
- }
101
- this.textarea.value=new_text;
102
- this.area_select(begin, length);
103
- this.area_search();
104
- }else
105
- this.area_select(begin, length);
106
- };
107
-
108
-
109
-
110
-
111
- EditArea.prototype.area_replace= function(){
112
- this.area_search("replace");
113
- };
114
-
115
- EditArea.prototype.area_replace_all= function(){
116
- /* this.area_select(0, 0);
117
- _$("area_search_msg").innerHTML="";
118
- while(_$("area_search_msg").innerHTML==""){
119
- this.area_replace();
120
- }*/
121
-
122
- var base_text= this.textarea.value;
123
- var search= _$("area_search").value;
124
- var replace= _$("area_replace").value;
125
- if(search.length==0){
126
- _$("area_search_msg").innerHTML=this.get_translation("search_field_empty");
127
- return ;
128
- }
129
-
130
- var new_text="";
131
- var nb_change=0;
132
- if(_$("area_search_reg_exp").checked){
133
- // regExp
134
- var opt="mg";
135
- if(!_$("area_search_match_case").checked)
136
- opt+="i";
137
- var reg= new RegExp(search, opt);
138
- nb_change= infos["full_text"].match(reg).length;
139
- new_text= infos["full_text"].replace(reg, replace);
140
-
141
- }else{
142
-
143
- if(_$("area_search_match_case").checked){
144
- var tmp_tab=base_text.split(search);
145
- nb_change= tmp_tab.length -1 ;
146
- new_text= tmp_tab.join(replace);
147
- }else{
148
- // case insensitive
149
- var lower_value=base_text.toLowerCase();
150
- var lower_search=search.toLowerCase();
151
-
152
- var start=0;
153
- var pos= lower_value.indexOf(lower_search);
154
- while(pos!=-1){
155
- nb_change++;
156
- new_text+= this.textarea.value.substring(start , pos)+replace;
157
- start=pos+ search.length;
158
- pos= lower_value.indexOf(lower_search, pos+1);
159
- }
160
- new_text+= this.textarea.value.substring(start);
161
- }
162
- }
163
- if(new_text==base_text){
164
- _$("area_search_msg").innerHTML="<strong>"+search+"</strong> "+this.get_translation("not_found");
165
- }else{
166
- this.textarea.value= new_text;
167
- _$("area_search_msg").innerHTML="<strong>"+nb_change+"</strong> "+this.get_translation("occurrence_replaced");
168
- // firefox and opera doesn't manage with the focus if it's done directly
169
- //editArea.textarea.focus();editArea.textarea.textareaFocused=true;
170
- setTimeout("editArea.textarea.focus();editArea.textarea.textareaFocused=true;", 100);
171
- }
172
-
173
-
174
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/edit_area/template.html DELETED
@@ -1,100 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
4
- <head>
5
- <title>EditArea</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
8
- [__CSSRULES__]
9
- [__JSCODE__]
10
- </head>
11
- <body>
12
- <div id='editor'>
13
- <div class='area_toolbar' id='toolbar_1'>[__TOOLBAR__]</div>
14
- <div class='area_toolbar' id='tab_browsing_area'><ul id='tab_browsing_list' class='menu'> <li> </li> </ul></div>
15
- <div id='result'>
16
- <div id='no_file_selected'></div>
17
- <div id='container'>
18
- <div id='cursor_pos' class='edit_area_cursor'>&nbsp;</div>
19
- <div id='end_bracket' class='edit_area_cursor'>&nbsp;</div>
20
- <div id='selection_field'></div>
21
- <div id='line_number' selec='none'></div>
22
- <div id='content_highlight'></div>
23
- <div id='test_font_size'></div>
24
- <div id='selection_field_text'></div>
25
- <textarea id='textarea' wrap='off' onchange='editArea.execCommand("onchange");' onfocus='javascript:editArea.textareaFocused=true;' onblur='javascript:editArea.textareaFocused=false;'>
26
- </textarea>
27
-
28
- </div>
29
- </div>
30
- <div class='area_toolbar' id='toolbar_2'>
31
- <table class='statusbar' cellspacing='0' cellpadding='0'>
32
- <tr>
33
- <td class='total' selec='none'>{$position}:</td>
34
- <td class='infos' selec='none'>
35
- {$line_abbr} <span id='linePos'>0</span>, {$char_abbr} <span id='currPos'>0</span>
36
- </td>
37
- <td class='total' selec='none'>{$total}:</td>
38
- <td class='infos' selec='none'>
39
- {$line_abbr} <span id='nbLine'>0</span>, {$char_abbr} <span id='nbChar'>0</span>
40
- </td>
41
- <td class='resize'>
42
- <span id='resize_area'><img src='[__BASEURL__]images/statusbar_resize.gif' alt='resize' selec='none'></span>
43
- </td>
44
- </tr>
45
- </table>
46
- </div>
47
- </div>
48
- <div id='processing'>
49
- <div id='processing_text'>
50
- {$processing}
51
- </div>
52
- </div>
53
-
54
- <div id='area_search_replace' class='editarea_popup'>
55
- <table cellspacing='2' cellpadding='0' style='width: 100%'>
56
- <tr>
57
- <td selec='none'>{$search}</td>
58
- <td><input type='text' id='area_search' /></td>
59
- <td id='close_area_search_replace'>
60
- <a onclick='Javascript:editArea.execCommand("hidden_search")'><img selec='none' src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a><br />
61
- </tr><tr>
62
- <td selec='none'>{$replace}</td>
63
- <td><input type='text' id='area_replace' /></td>
64
- <td><img id='move_area_search_replace' onmousedown='return parent.start_move_element(event,"area_search_replace", parent.frames["frame_"+editArea.id]);' src='[__BASEURL__]images/move.gif' alt='{$move_popup}' title='{$move_popup}' /></td>
65
- </tr>
66
- </table>
67
- <div class='button'>
68
- <input type='checkbox' id='area_search_match_case' /><label for='area_search_match_case' selec='none'>{$match_case}</label>
69
- <input type='checkbox' id='area_search_reg_exp' /><label for='area_search_reg_exp' selec='none'>{$reg_exp}</label>
70
- <br />
71
- <a onclick='Javascript:editArea.execCommand("area_search")' selec='none'>{$find_next}</a>
72
- <a onclick='Javascript:editArea.execCommand("area_replace")' selec='none'>{$replace}</a>
73
- <a onclick='Javascript:editArea.execCommand("area_replace_all")' selec='none'>{$replace_all}</a><br />
74
- </div>
75
- <div id='area_search_msg' selec='none'></div>
76
- </div>
77
- <div id='edit_area_help' class='editarea_popup'>
78
- <div class='close_popup'>
79
- <a onclick='Javascript:editArea.execCommand("close_all_inline_popup")'><img src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a>
80
- </div>
81
- <div><h2>Editarea [__EA_VERSION__]</h2><br />
82
- <h3>{$shortcuts}:</h3>
83
- {$tab}: {$add_tab}<br />
84
- {$shift}+{$tab}: {$remove_tab}<br />
85
- {$ctrl}+f: {$search_command}<br />
86
- {$ctrl}+r: {$replace_command}<br />
87
- {$ctrl}+h: {$highlight}<br />
88
- {$ctrl}+g: {$go_to_line}<br />
89
- {$ctrl}+z: {$undo}<br />
90
- {$ctrl}+y: {$redo}<br />
91
- {$ctrl}+e: {$help}<br />
92
- {$ctrl}+q, {$esc}: {$close_popup}<br />
93
- {$accesskey} E: {$toggle}<br />
94
- <br />
95
- <em>{$about_notice}</em>
96
- <br /><div class='copyright'>&copy; Christophe Dolivet 2007-2010</div>
97
- </div>
98
- </div>
99
- </body>
100
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/export.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
  /**
3
- * cs_export
4
  * Exports seleted snippets as a Code Snippets (.xml) export file.
5
  *
6
  * @package Code Snippets
1
  <?php
2
  /**
 
3
  * Exports seleted snippets as a Code Snippets (.xml) export file.
4
  *
5
  * @package Code Snippets
includes/help/admin-import-help.php CHANGED
@@ -25,5 +25,7 @@ $screen->set_help_sidebar(
25
  "<p><strong>For more information:</strong></p>" .
26
  "<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
27
  "<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
28
- "<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
29
- );
 
 
25
  "<p><strong>For more information:</strong></p>" .
26
  "<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
27
  "<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
28
+ "<p><a href='http://cs.bungeshea.com' target='_blank'>SheaPress</a></p>"
29
+ );
30
+
31
+ ?>
includes/help/admin-manage-help.php CHANGED
@@ -6,25 +6,28 @@ $screen->add_help_tab( array(
6
  'content' =>
7
  "<p>Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting.</p>"
8
  ) );
 
9
  $screen->add_help_tab( array(
10
- 'id' => 'compatibility-problems',
11
- 'title' => 'Troubleshooting',
12
  'content' =>
13
- "<p>Be sure to check your snippets for errors before you activate them as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time.</p>" .
14
- "<p>If something goes wrong with a snippet and you can&#8217;t use WordPress, you can use a database manager like phpMyAdmin to access the <code>$this->table</code> table in your WordPress database. Locate the offending snippet (if you know which one is the trouble) and change the 1 in the 'active' column into a 0. If this doesn't work try doing this for all snippets.<br/>You can also delete or rename the <code>$this->table</code> table and the table will automaticly be reconstructed so you can re-add snippets one at a time.</p>"
15
  ) );
16
 
17
  $screen->add_help_tab( array(
18
  'id' => 'uninstall',
19
  'title' => 'Uninstall',
20
  'content' =>
21
- "<p>When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>$this->table</code> table and a few other bits of data stored in the database. If you want to keep this data (ie you are only temporally uninstalling Code Snippets) then remove the <code>".dirname(__FILE__)."</code> folder using FTP." .
22
- "<p>Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installaion, you may want to use phpMyAdmin to back up the <code>$this->table</code> table in the database. You can later use phpMyAdmin to import it back.</p>"
23
  ) );
24
 
25
  $screen->set_help_sidebar(
26
  "<p><strong>For more information:</strong></p>" .
27
  "<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
28
  "<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
29
- "<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
30
- );
 
 
6
  'content' =>
7
  "<p>Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can manage your existing snippets and preform tasks on them such as activating, deactivating, deleting and exporting.</p>"
8
  ) );
9
+
10
  $screen->add_help_tab( array(
11
+ 'id' => 'safe-mode',
12
+ 'title' => 'Safe Mode',
13
  'content' =>
14
+ "<p>Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time.</p>" .
15
+ "<p>If something goes wrong with a snippet and you can&#8217;t use WordPress, you can cause all snippets to stop executing by adding <code>define('CS_SAFE_MODE', true);</code> to your wp-config.php file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>."
16
  ) );
17
 
18
  $screen->add_help_tab( array(
19
  'id' => 'uninstall',
20
  'title' => 'Uninstall',
21
  'content' =>
22
+ "<p>When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>$this->table</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>$this->plugin_dir</code> folder using FTP." .
23
+ "<p>Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets.</p>"
24
  ) );
25
 
26
  $screen->set_help_sidebar(
27
  "<p><strong>For more information:</strong></p>" .
28
  "<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
29
  "<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
30
+ "<p><a href='http://cs.bungeshea.com' target='_blank'>SheaPress</a></p>"
31
+ );
32
+
33
+ ?>
includes/help/{admin-edit-help.php → admin-single-help.php} RENAMED
@@ -28,7 +28,7 @@ $screen->add_help_tab( array(
28
  <li><a title='Watermark images on the fly' href='http://www.catswhocode.com/blog/snippets/watermark-images-on-the-fly'>Watermark images on the fly</a></li>
29
  <li><a title='Display number of Facebook fans in full text' href='http://www.catswhocode.com/blog/snippets/display-number-of-facebook-fans-in-full-text'>Display number of Facebook fans in full text</a></li>
30
  </ul>
31
- Snippets can be installed through the <a href='$this->admin_edit_url'>Add New Snippet</a> page or by addng them to the <code>$this->table</code> table in the database (Warning: for advanced users only). Once a snippet has been installed, you can activate it here.</p>"
32
  ) );
33
  $screen->add_help_tab( array(
34
  'id' => 'adding',
@@ -36,12 +36,14 @@ $screen->add_help_tab( array(
36
  'content' =>
37
  "<p>You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional.</p>" .
38
  "<p>Make sure that you don't add the <code>&lt;?php</code>, <code>&lt;?</code> or <code>?&gt;</code> the beginning and end of the code. You can however use these tags in the code to stop and start PHP sections</p>" .
39
- "<p>Please be sure to check thst your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straght away, it will help to minimise the chance of a faulty snippet becoming active on your site.</p>"
40
  ) );
41
 
42
  $screen->set_help_sidebar(
43
  "<p><strong>For more information:</strong></p>" .
44
  "<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
45
  "<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
46
- "<p><a href='http://bungeshea.wordpress.com/plugins/code-snippets' target='_blank'>SheaPress</a></p>"
47
- );
 
 
28
  <li><a title='Watermark images on the fly' href='http://www.catswhocode.com/blog/snippets/watermark-images-on-the-fly'>Watermark images on the fly</a></li>
29
  <li><a title='Display number of Facebook fans in full text' href='http://www.catswhocode.com/blog/snippets/display-number-of-facebook-fans-in-full-text'>Display number of Facebook fans in full text</a></li>
30
  </ul>
31
+ Snippets can be installed through the <a href='$this->admin_single_url'>Add New Snippet</a> page or by adding them to the <code>$this->table</code> table in the database (Warning: for advanced users only). Once a snippet has been installed, you can activate it here.</p>"
32
  ) );
33
  $screen->add_help_tab( array(
34
  'id' => 'adding',
36
  'content' =>
37
  "<p>You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional.</p>" .
38
  "<p>Make sure that you don't add the <code>&lt;?php</code>, <code>&lt;?</code> or <code>?&gt;</code> the beginning and end of the code. You can however use these tags in the code to stop and start PHP sections</p>" .
39
+ "<p>Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site.</p>"
40
  ) );
41
 
42
  $screen->set_help_sidebar(
43
  "<p><strong>For more information:</strong></p>" .
44
  "<p><a href='http://wordpress.org/extend/plugins/code-snippets' target='_blank'>WordPress Extend</a></p>" .
45
  "<p><a href='http://wordpress.org/support/plugin/code-snippets' target='_blank'>Support Forums</a></p>" .
46
+ "<p><a href='http://cs.bungeshea.com' target='_blank'>SheaPress</a></p>"
47
+ );
48
+
49
+ ?>
js/clike.js ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CodeMirror.defineMode("clike", function(config, parserConfig) {
2
+ var indentUnit = config.indentUnit,
3
+ keywords = parserConfig.keywords || {},
4
+ builtin = parserConfig.builtin || {},
5
+ blockKeywords = parserConfig.blockKeywords || {},
6
+ atoms = parserConfig.atoms || {},
7
+ hooks = parserConfig.hooks || {},
8
+ multiLineStrings = parserConfig.multiLineStrings;
9
+ var isOperatorChar = /[+\-*&%=<>!?|\/]/;
10
+
11
+ var curPunc;
12
+
13
+ function tokenBase(stream, state) {
14
+ var ch = stream.next();
15
+ if (hooks[ch]) {
16
+ var result = hooks[ch](stream, state);
17
+ if (result !== false) return result;
18
+ }
19
+ if (ch == '"' || ch == "'") {
20
+ state.tokenize = tokenString(ch);
21
+ return state.tokenize(stream, state);
22
+ }
23
+ if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
24
+ curPunc = ch;
25
+ return null;
26
+ }
27
+ if (/\d/.test(ch)) {
28
+ stream.eatWhile(/[\w\.]/);
29
+ return "number";
30
+ }
31
+ if (ch == "/") {
32
+ if (stream.eat("*")) {
33
+ state.tokenize = tokenComment;
34
+ return tokenComment(stream, state);
35
+ }
36
+ if (stream.eat("/")) {
37
+ stream.skipToEnd();
38
+ return "comment";
39
+ }
40
+ }
41
+ if (isOperatorChar.test(ch)) {
42
+ stream.eatWhile(isOperatorChar);
43
+ return "operator";
44
+ }
45
+ stream.eatWhile(/[\w\$_]/);
46
+ var cur = stream.current();
47
+ if (keywords.propertyIsEnumerable(cur)) {
48
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
49
+ return "keyword";
50
+ }
51
+ if (builtin.propertyIsEnumerable(cur)) {
52
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
53
+ return "builtin";
54
+ }
55
+ if (atoms.propertyIsEnumerable(cur)) return "atom";
56
+ return "variable";
57
+ }
58
+
59
+ function tokenString(quote) {
60
+ return function(stream, state) {
61
+ var escaped = false, next, end = false;
62
+ while ((next = stream.next()) != null) {
63
+ if (next == quote && !escaped) {end = true; break;}
64
+ escaped = !escaped && next == "\\";
65
+ }
66
+ if (end || !(escaped || multiLineStrings))
67
+ state.tokenize = null;
68
+ return "string";
69
+ };
70
+ }
71
+
72
+ function tokenComment(stream, state) {
73
+ var maybeEnd = false, ch;
74
+ while (ch = stream.next()) {
75
+ if (ch == "/" && maybeEnd) {
76
+ state.tokenize = null;
77
+ break;
78
+ }
79
+ maybeEnd = (ch == "*");
80
+ }
81
+ return "comment";
82
+ }
83
+
84
+ function Context(indented, column, type, align, prev) {
85
+ this.indented = indented;
86
+ this.column = column;
87
+ this.type = type;
88
+ this.align = align;
89
+ this.prev = prev;
90
+ }
91
+ function pushContext(state, col, type) {
92
+ return state.context = new Context(state.indented, col, type, null, state.context);
93
+ }
94
+ function popContext(state) {
95
+ var t = state.context.type;
96
+ if (t == ")" || t == "]" || t == "}")
97
+ state.indented = state.context.indented;
98
+ return state.context = state.context.prev;
99
+ }
100
+
101
+ // Interface
102
+
103
+ return {
104
+ startState: function(basecolumn) {
105
+ return {
106
+ tokenize: null,
107
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
108
+ indented: 0,
109
+ startOfLine: true
110
+ };
111
+ },
112
+
113
+ token: function(stream, state) {
114
+ var ctx = state.context;
115
+ if (stream.sol()) {
116
+ if (ctx.align == null) ctx.align = false;
117
+ state.indented = stream.indentation();
118
+ state.startOfLine = true;
119
+ }
120
+ if (stream.eatSpace()) return null;
121
+ curPunc = null;
122
+ var style = (state.tokenize || tokenBase)(stream, state);
123
+ if (style == "comment" || style == "meta") return style;
124
+ if (ctx.align == null) ctx.align = true;
125
+
126
+ if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
127
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
128
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
129
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
130
+ else if (curPunc == "}") {
131
+ while (ctx.type == "statement") ctx = popContext(state);
132
+ if (ctx.type == "}") ctx = popContext(state);
133
+ while (ctx.type == "statement") ctx = popContext(state);
134
+ }
135
+ else if (curPunc == ctx.type) popContext(state);
136
+ else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
137
+ pushContext(state, stream.column(), "statement");
138
+ state.startOfLine = false;
139
+ return style;
140
+ },
141
+
142
+ indent: function(state, textAfter) {
143
+ if (state.tokenize != tokenBase && state.tokenize != null) return 0;
144
+ var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
145
+ if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
146
+ var closing = firstChar == ctx.type;
147
+ if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
148
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
149
+ else return ctx.indented + (closing ? 0 : indentUnit);
150
+ },
151
+
152
+ electricChars: "{}"
153
+ };
154
+ });
155
+
156
+ (function() {
157
+ function words(str) {
158
+ var obj = {}, words = str.split(" ");
159
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
160
+ return obj;
161
+ }
162
+ var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
163
+ "double static else struct entry switch extern typedef float union for unsigned " +
164
+ "goto while enum void const signed volatile";
165
+
166
+ function cppHook(stream, state) {
167
+ if (!state.startOfLine) return false;
168
+ stream.skipToEnd();
169
+ return "meta";
170
+ }
171
+
172
+ // C#-style strings where "" escapes a quote.
173
+ function tokenAtString(stream, state) {
174
+ var next;
175
+ while ((next = stream.next()) != null) {
176
+ if (next == '"' && !stream.eat('"')) {
177
+ state.tokenize = null;
178
+ break;
179
+ }
180
+ }
181
+ return "string";
182
+ }
183
+
184
+ CodeMirror.defineMIME("text/x-csrc", {
185
+ name: "clike",
186
+ keywords: words(cKeywords),
187
+ blockKeywords: words("case do else for if switch while struct"),
188
+ atoms: words("null"),
189
+ hooks: {"#": cppHook}
190
+ });
191
+ CodeMirror.defineMIME("text/x-c++src", {
192
+ name: "clike",
193
+ keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
194
+ "static_cast typeid catch operator template typename class friend private " +
195
+ "this using const_cast inline public throw virtual delete mutable protected " +
196
+ "wchar_t"),
197
+ blockKeywords: words("catch class do else finally for if struct switch try while"),
198
+ atoms: words("true false null"),
199
+ hooks: {"#": cppHook}
200
+ });
201
+ CodeMirror.defineMIME("text/x-java", {
202
+ name: "clike",
203
+ keywords: words("abstract assert boolean break byte case catch char class const continue default " +
204
+ "do double else enum extends final finally float for goto if implements import " +
205
+ "instanceof int interface long native new package private protected public " +
206
+ "return short static strictfp super switch synchronized this throw throws transient " +
207
+ "try void volatile while"),
208
+ blockKeywords: words("catch class do else finally for if switch try while"),
209
+ atoms: words("true false null"),
210
+ hooks: {
211
+ "@": function(stream, state) {
212
+ stream.eatWhile(/[\w\$_]/);
213
+ return "meta";
214
+ }
215
+ }
216
+ });
217
+ CodeMirror.defineMIME("text/x-csharp", {
218
+ name: "clike",
219
+ keywords: words("abstract as base break case catch checked class const continue" +
220
+ " default delegate do else enum event explicit extern finally fixed for" +
221
+ " foreach goto if implicit in interface internal is lock namespace new" +
222
+ " operator out override params private protected public readonly ref return sealed" +
223
+ " sizeof stackalloc static struct switch this throw try typeof unchecked" +
224
+ " unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
225
+ " global group into join let orderby partial remove select set value var yield"),
226
+ blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
227
+ builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" +
228
+ " Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" +
229
+ " UInt64 bool byte char decimal double short int long object" +
230
+ " sbyte float string ushort uint ulong"),
231
+ atoms: words("true false null"),
232
+ hooks: {
233
+ "@": function(stream, state) {
234
+ if (stream.eat('"')) {
235
+ state.tokenize = tokenAtString;
236
+ return tokenAtString(stream, state);
237
+ }
238
+ stream.eatWhile(/[\w\$_]/);
239
+ return "meta";
240
+ }
241
+ }
242
+ });
243
+ CodeMirror.defineMIME("text/x-scala", {
244
+ name: "clike",
245
+ keywords: words(
246
+
247
+ /* scala */
248
+ "abstract case catch class def do else extends false final finally for forSome if " +
249
+ "implicit import lazy match new null object override package private protected return " +
250
+ "sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
251
+ "<% >: # @ " +
252
+
253
+ /* package scala */
254
+ "assert assume require print println printf readLine readBoolean readByte readShort " +
255
+ "readChar readInt readLong readFloat readDouble " +
256
+
257
+ "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
258
+ "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
259
+ "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
260
+ "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
261
+ "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
262
+
263
+ /* package java.lang */
264
+ "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
265
+ "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
266
+ "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
267
+ "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
268
+
269
+
270
+ ),
271
+ blockKeywords: words("catch class do else finally for forSome if match switch try while"),
272
+ atoms: words("true false null"),
273
+ hooks: {
274
+ "@": function(stream, state) {
275
+ stream.eatWhile(/[\w\$_]/);
276
+ return "meta";
277
+ }
278
+ }
279
+ });
280
+ }());
js/codemirror.js ADDED
@@ -0,0 +1,3231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror version 2.32
2
+ //
3
+ // All functions that need access to the editor's state live inside
4
+ // the CodeMirror function. Below that, at the bottom of the file,
5
+ // some utilities are defined.
6
+
7
+ // CodeMirror is the only global var we claim
8
+ var CodeMirror = (function() {
9
+ // This is the function that produces an editor instance. Its
10
+ // closure is used to store the editor state.
11
+ function CodeMirror(place, givenOptions) {
12
+ // Determine effective options based on given values and defaults.
13
+ var options = {}, defaults = CodeMirror.defaults;
14
+ for (var opt in defaults)
15
+ if (defaults.hasOwnProperty(opt))
16
+ options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
17
+
18
+ // The element in which the editor lives.
19
+ var wrapper = document.createElement("div");
20
+ wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");
21
+ // This mess creates the base DOM structure for the editor.
22
+ wrapper.innerHTML =
23
+ '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea
24
+ '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' +
25
+ 'autocorrect="off" autocapitalize="off"></textarea></div>' +
26
+ '<div class="CodeMirror-scrollbar">' + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself.
27
+ '<div class="CodeMirror-scrollbar-inner">' + // The empty scrollbar content, used solely for managing the scrollbar thumb.
28
+ '</div></div>' + // This must be before the scroll area because it's float-right.
29
+ '<div class="CodeMirror-scroll" tabindex="-1">' +
30
+ '<div style="position: relative">' + // Set to the height of the text, causes scrolling
31
+ '<div style="position: relative">' + // Moved around its parent to cover visible view
32
+ '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' +
33
+ // Provides positioning relative to (visible) text origin
34
+ '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' +
35
+ // Used to measure text size
36
+ '<div style="position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"></div>' +
37
+ '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor
38
+ '<pre class="CodeMirror-cursor" style="visibility: hidden">&#160;</pre>' + // Used to force a width
39
+ '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code
40
+ '</div></div></div></div></div>';
41
+ if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
42
+ // I've never seen more elegant code in my life.
43
+ var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
44
+ scroller = wrapper.lastChild, code = scroller.firstChild,
45
+ mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,
46
+ lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,
47
+ cursor = measure.nextSibling, widthForcer = cursor.nextSibling,
48
+ selectionDiv = widthForcer.nextSibling, lineDiv = selectionDiv.nextSibling,
49
+ scrollbar = inputDiv.nextSibling, scrollbarInner = scrollbar.firstChild;
50
+ themeChanged(); keyMapChanged();
51
+ // Needed to hide big blue blinking cursor on Mobile Safari
52
+ if (ios) input.style.width = "0px";
53
+ if (!webkit) scroller.draggable = true;
54
+ lineSpace.style.outline = "none";
55
+ if (options.tabindex != null) input.tabIndex = options.tabindex;
56
+ if (options.autofocus) focusInput();
57
+ if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
58
+ // Needed to handle Tab key in KHTML
59
+ if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";
60
+
61
+ // Check for OS X >= 10.7. If so, we need to force a width on the scrollbar, and
62
+ // make it overlap the content. (But we only do this if the scrollbar doesn't already
63
+ // have a natural width. If the mouse is plugged in or the user sets the system pref
64
+ // to always show scrollbars, the scrollbar shouldn't overlap.)
65
+ if (mac_geLion) {
66
+ scrollbar.className += (overlapScrollbars() ? " cm-sb-overlap" : " cm-sb-nonoverlap");
67
+ } else if (ie_lt8) {
68
+ // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
69
+ scrollbar.className += " cm-sb-ie7";
70
+ }
71
+
72
+ // Check for problem with IE innerHTML not working when we have a
73
+ // P (or similar) parent node.
74
+ try { stringWidth("x"); }
75
+ catch (e) {
76
+ if (e.message.match(/runtime/i))
77
+ e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
78
+ throw e;
79
+ }
80
+
81
+ // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
82
+ var poll = new Delayed(), highlight = new Delayed(), blinker;
83
+
84
+ // mode holds a mode API object. doc is the tree of Line objects,
85
+ // work an array of lines that should be parsed, and history the
86
+ // undo history (instance of History constructor).
87
+ var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused;
88
+ loadMode();
89
+ // The selection. These are always maintained to point at valid
90
+ // positions. Inverted is used to remember that the user is
91
+ // selecting bottom-to-top.
92
+ var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
93
+ // Selection-related flags. shiftSelecting obviously tracks
94
+ // whether the user is holding shift.
95
+ var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, lastScrollLeft = 0, draggingText,
96
+ overwrite = false, suppressEdits = false;
97
+ // Variables used by startOperation/endOperation to track what
98
+ // happened during the operation.
99
+ var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,
100
+ gutterDirty, callbacks;
101
+ // Current visible range (may be bigger than the view window).
102
+ var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
103
+ // bracketHighlighted is used to remember that a bracket has been
104
+ // marked.
105
+ var bracketHighlighted;
106
+ // Tracks the maximum line length so that the horizontal scrollbar
107
+ // can be kept static when scrolling.
108
+ var maxLine = "", updateMaxLine = false, maxLineChanged = true;
109
+ var tabCache = {};
110
+
111
+ // Initialize the content.
112
+ operation(function(){setValue(options.value || ""); updateInput = false;})();
113
+ var history = new History();
114
+
115
+ // Register our event handlers.
116
+ connect(scroller, "mousedown", operation(onMouseDown));
117
+ connect(scroller, "dblclick", operation(onDoubleClick));
118
+ connect(lineSpace, "selectstart", e_preventDefault);
119
+ // Gecko browsers fire contextmenu *after* opening the menu, at
120
+ // which point we can't mess with it anymore. Context menu is
121
+ // handled in onMouseDown for Gecko.
122
+ if (!gecko) connect(scroller, "contextmenu", onContextMenu);
123
+ connect(scroller, "scroll", onScroll);
124
+ connect(scrollbar, "scroll", onScroll);
125
+ connect(scrollbar, "mousedown", function() {if (focused) setTimeout(focusInput, 0);});
126
+ connect(scroller, "mousewheel", onMouseWheel);
127
+ connect(scroller, "DOMMouseScroll", onMouseWheel);
128
+ connect(window, "resize", function() {updateDisplay(true);});
129
+ connect(input, "keyup", operation(onKeyUp));
130
+ connect(input, "input", fastPoll);
131
+ connect(input, "keydown", operation(onKeyDown));
132
+ connect(input, "keypress", operation(onKeyPress));
133
+ connect(input, "focus", onFocus);
134
+ connect(input, "blur", onBlur);
135
+
136
+ if (options.dragDrop) {
137
+ connect(scroller, "dragstart", onDragStart);
138
+ function drag_(e) {
139
+ if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
140
+ e_stop(e);
141
+ }
142
+ connect(scroller, "dragenter", drag_);
143
+ connect(scroller, "dragover", drag_);
144
+ connect(scroller, "drop", operation(onDrop));
145
+ }
146
+ connect(scroller, "paste", function(){focusInput(); fastPoll();});
147
+ connect(input, "paste", fastPoll);
148
+ connect(input, "cut", operation(function(){
149
+ if (!options.readOnly) replaceSelection("");
150
+ }));
151
+
152
+ // Needed to handle Tab key in KHTML
153
+ if (khtml) connect(code, "mouseup", function() {
154
+ if (document.activeElement == input) input.blur();
155
+ focusInput();
156
+ });
157
+
158
+ // IE throws unspecified error in certain cases, when
159
+ // trying to access activeElement before onload
160
+ var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }
161
+ if (hasFocus || options.autofocus) setTimeout(onFocus, 20);
162
+ else onBlur();
163
+
164
+ function isLine(l) {return l >= 0 && l < doc.size;}
165
+ // The instance object that we'll return. Mostly calls out to
166
+ // local functions in the CodeMirror function. Some do some extra
167
+ // range checking and/or clipping. operation is used to wrap the
168
+ // call so that changes it makes are tracked, and the display is
169
+ // updated afterwards.
170
+ var instance = wrapper.CodeMirror = {
171
+ getValue: getValue,
172
+ setValue: operation(setValue),
173
+ getSelection: getSelection,
174
+ replaceSelection: operation(replaceSelection),
175
+ focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},
176
+ setOption: function(option, value) {
177
+ var oldVal = options[option];
178
+ options[option] = value;
179
+ if (option == "mode" || option == "indentUnit") loadMode();
180
+ else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();}
181
+ else if (option == "readOnly" && !value) {resetInput(true);}
182
+ else if (option == "theme") themeChanged();
183
+ else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
184
+ else if (option == "tabSize") updateDisplay(true);
185
+ else if (option == "keyMap") keyMapChanged();
186
+ if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") {
187
+ gutterChanged();
188
+ updateDisplay(true);
189
+ }
190
+ },
191
+ getOption: function(option) {return options[option];},
192
+ undo: operation(undo),
193
+ redo: operation(redo),
194
+ indentLine: operation(function(n, dir) {
195
+ if (typeof dir != "string") {
196
+ if (dir == null) dir = options.smartIndent ? "smart" : "prev";
197
+ else dir = dir ? "add" : "subtract";
198
+ }
199
+ if (isLine(n)) indentLine(n, dir);
200
+ }),
201
+ indentSelection: operation(indentSelected),
202
+ historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
203
+ clearHistory: function() {history = new History();},
204
+ setHistory: function(histData) {
205
+ history = new History();
206
+ history.done = histData.done;
207
+ history.undone = histData.undone;
208
+ },
209
+ getHistory: function() {
210
+ history.time = 0;
211
+ return {done: history.done.concat([]), undone: history.undone.concat([])};
212
+ },
213
+ matchBrackets: operation(function(){matchBrackets(true);}),
214
+ getTokenAt: operation(function(pos) {
215
+ pos = clipPos(pos);
216
+ return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);
217
+ }),
218
+ getStateAfter: function(line) {
219
+ line = clipLine(line == null ? doc.size - 1: line);
220
+ return getStateBefore(line + 1);
221
+ },
222
+ cursorCoords: function(start, mode) {
223
+ if (start == null) start = sel.inverted;
224
+ return this.charCoords(start ? sel.from : sel.to, mode);
225
+ },
226
+ charCoords: function(pos, mode) {
227
+ pos = clipPos(pos);
228
+ if (mode == "local") return localCoords(pos, false);
229
+ if (mode == "div") return localCoords(pos, true);
230
+ return pageCoords(pos);
231
+ },
232
+ coordsChar: function(coords) {
233
+ var off = eltOffset(lineSpace);
234
+ return coordsChar(coords.x - off.left, coords.y - off.top);
235
+ },
236
+ markText: operation(markText),
237
+ setBookmark: setBookmark,
238
+ findMarksAt: findMarksAt,
239
+ setMarker: operation(addGutterMarker),
240
+ clearMarker: operation(removeGutterMarker),
241
+ setLineClass: operation(setLineClass),
242
+ hideLine: operation(function(h) {return setLineHidden(h, true);}),
243
+ showLine: operation(function(h) {return setLineHidden(h, false);}),
244
+ onDeleteLine: function(line, f) {
245
+ if (typeof line == "number") {
246
+ if (!isLine(line)) return null;
247
+ line = getLine(line);
248
+ }
249
+ (line.handlers || (line.handlers = [])).push(f);
250
+ return line;
251
+ },
252
+ lineInfo: lineInfo,
253
+ addWidget: function(pos, node, scroll, vert, horiz) {
254
+ pos = localCoords(clipPos(pos));
255
+ var top = pos.yBot, left = pos.x;
256
+ node.style.position = "absolute";
257
+ code.appendChild(node);
258
+ if (vert == "over") top = pos.y;
259
+ else if (vert == "near") {
260
+ var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),
261
+ hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
262
+ if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
263
+ top = pos.y - node.offsetHeight;
264
+ if (left + node.offsetWidth > hspace)
265
+ left = hspace - node.offsetWidth;
266
+ }
267
+ node.style.top = (top + paddingTop()) + "px";
268
+ node.style.left = node.style.right = "";
269
+ if (horiz == "right") {
270
+ left = code.clientWidth - node.offsetWidth;
271
+ node.style.right = "0px";
272
+ } else {
273
+ if (horiz == "left") left = 0;
274
+ else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;
275
+ node.style.left = (left + paddingLeft()) + "px";
276
+ }
277
+ if (scroll)
278
+ scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
279
+ },
280
+
281
+ lineCount: function() {return doc.size;},
282
+ clipPos: clipPos,
283
+ getCursor: function(start) {
284
+ if (start == null) start = sel.inverted;
285
+ return copyPos(start ? sel.from : sel.to);
286
+ },
287
+ somethingSelected: function() {return !posEq(sel.from, sel.to);},
288
+ setCursor: operation(function(line, ch, user) {
289
+ if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user);
290
+ else setCursor(line, ch, user);
291
+ }),
292
+ setSelection: operation(function(from, to, user) {
293
+ (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));
294
+ }),
295
+ getLine: function(line) {if (isLine(line)) return getLine(line).text;},
296
+ getLineHandle: function(line) {if (isLine(line)) return getLine(line);},
297
+ setLine: operation(function(line, text) {
298
+ if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});
299
+ }),
300
+ removeLine: operation(function(line) {
301
+ if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
302
+ }),
303
+ replaceRange: operation(replaceRange),
304
+ getRange: function(from, to, lineSep) {return getRange(clipPos(from), clipPos(to), lineSep);},
305
+
306
+ triggerOnKeyDown: operation(onKeyDown),
307
+ execCommand: function(cmd) {return commands[cmd](instance);},
308
+ // Stuff used by commands, probably not much use to outside code.
309
+ moveH: operation(moveH),
310
+ deleteH: operation(deleteH),
311
+ moveV: operation(moveV),
312
+ toggleOverwrite: function() {
313
+ if(overwrite){
314
+ overwrite = false;
315
+ cursor.className = cursor.className.replace(" CodeMirror-overwrite", "");
316
+ } else {
317
+ overwrite = true;
318
+ cursor.className += " CodeMirror-overwrite";
319
+ }
320
+ },
321
+
322
+ posFromIndex: function(off) {
323
+ var lineNo = 0, ch;
324
+ doc.iter(0, doc.size, function(line) {
325
+ var sz = line.text.length + 1;
326
+ if (sz > off) { ch = off; return true; }
327
+ off -= sz;
328
+ ++lineNo;
329
+ });
330
+ return clipPos({line: lineNo, ch: ch});
331
+ },
332
+ indexFromPos: function (coords) {
333
+ if (coords.line < 0 || coords.ch < 0) return 0;
334
+ var index = coords.ch;
335
+ doc.iter(0, coords.line, function (line) {
336
+ index += line.text.length + 1;
337
+ });
338
+ return index;
339
+ },
340
+ scrollTo: function(x, y) {
341
+ if (x != null) scroller.scrollLeft = x;
342
+ if (y != null) scrollbar.scrollTop = y;
343
+ updateDisplay([]);
344
+ },
345
+ getScrollInfo: function() {
346
+ return {x: scroller.scrollLeft, y: scrollbar.scrollTop,
347
+ height: scrollbar.scrollHeight, width: scroller.scrollWidth};
348
+ },
349
+ setSize: function(width, height) {
350
+ function interpret(val) {
351
+ val = String(val);
352
+ return /^\d+$/.test(val) ? val + "px" : val;
353
+ }
354
+ if (width != null) wrapper.style.width = interpret(width);
355
+ if (height != null) scroller.style.height = interpret(height);
356
+ },
357
+
358
+ operation: function(f){return operation(f)();},
359
+ compoundChange: function(f){return compoundChange(f);},
360
+ refresh: function(){
361
+ updateDisplay(true, null, lastScrollTop);
362
+ if (scrollbar.scrollHeight > lastScrollTop)
363
+ scrollbar.scrollTop = lastScrollTop;
364
+ },
365
+ getInputField: function(){return input;},
366
+ getWrapperElement: function(){return wrapper;},
367
+ getScrollerElement: function(){return scroller;},
368
+ getGutterElement: function(){return gutter;}
369
+ };
370
+
371
+ function getLine(n) { return getLineAt(doc, n); }
372
+ function updateLineHeight(line, height) {
373
+ gutterDirty = true;
374
+ var diff = height - line.height;
375
+ for (var n = line; n; n = n.parent) n.height += diff;
376
+ }
377
+
378
+ function setValue(code) {
379
+ var top = {line: 0, ch: 0};
380
+ updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},
381
+ splitLines(code), top, top);
382
+ updateInput = true;
383
+ }
384
+ function getValue(lineSep) {
385
+ var text = [];
386
+ doc.iter(0, doc.size, function(line) { text.push(line.text); });
387
+ return text.join(lineSep || "\n");
388
+ }
389
+
390
+ function onScroll(e) {
391
+ if (scroller.scrollTop) {
392
+ scrollbar.scrollTop += scroller.scrollTop;
393
+ scroller.scrollTop = 0;
394
+ }
395
+ if (lastScrollTop != scrollbar.scrollTop || lastScrollLeft != scroller.scrollLeft) {
396
+ lastScrollTop = scrollbar.scrollTop;
397
+ lastScrollLeft = scroller.scrollLeft;
398
+ updateDisplay([]);
399
+ if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";
400
+ if (options.onScroll) options.onScroll(instance);
401
+ }
402
+ }
403
+
404
+ function onMouseDown(e) {
405
+ setShift(e_prop(e, "shiftKey"));
406
+ // Check whether this is a click in a widget
407
+ for (var n = e_target(e); n != wrapper; n = n.parentNode)
408
+ if (n.parentNode == code && n != mover) return;
409
+
410
+ // See if this is a click in the gutter
411
+ for (var n = e_target(e); n != wrapper; n = n.parentNode)
412
+ if (n.parentNode == gutterText) {
413
+ if (options.onGutterClick)
414
+ options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
415
+ return e_preventDefault(e);
416
+ }
417
+
418
+ var start = posFromMouse(e);
419
+
420
+ switch (e_button(e)) {
421
+ case 3:
422
+ if (gecko) onContextMenu(e);
423
+ return;
424
+ case 2:
425
+ if (start) setCursor(start.line, start.ch, true);
426
+ setTimeout(focusInput, 20);
427
+ e_preventDefault(e);
428
+ return;
429
+ }
430
+ // For button 1, if it was clicked inside the editor
431
+ // (posFromMouse returning non-null), we have to adjust the
432
+ // selection.
433
+ if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
434
+
435
+ if (!focused) onFocus();
436
+
437
+ var now = +new Date, type = "single";
438
+ if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
439
+ type = "triple";
440
+ e_preventDefault(e);
441
+ setTimeout(focusInput, 20);
442
+ selectLine(start.line);
443
+ } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
444
+ type = "double";
445
+ lastDoubleClick = {time: now, pos: start};
446
+ e_preventDefault(e);
447
+ var word = findWordAt(start);
448
+ setSelectionUser(word.from, word.to);
449
+ } else { lastClick = {time: now, pos: start}; }
450
+
451
+ var last = start, going;
452
+ if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&
453
+ !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
454
+ // Let the drag handler handle this.
455
+ if (webkit) scroller.draggable = true;
456
+ function dragEnd(e2) {
457
+ if (webkit) scroller.draggable = false;
458
+ draggingText = false;
459
+ up(); drop();
460
+ if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
461
+ e_preventDefault(e2);
462
+ setCursor(start.line, start.ch, true);
463
+ focusInput();
464
+ }
465
+ }
466
+ var up = connect(document, "mouseup", operation(dragEnd), true);
467
+ var drop = connect(scroller, "drop", operation(dragEnd), true);
468
+ draggingText = true;
469
+ // IE's approach to draggable
470
+ if (scroller.dragDrop) scroller.dragDrop();
471
+ return;
472
+ }
473
+ e_preventDefault(e);
474
+ if (type == "single") setCursor(start.line, start.ch, true);
475
+
476
+ var startstart = sel.from, startend = sel.to;
477
+
478
+ function doSelect(cur) {
479
+ if (type == "single") {
480
+ setSelectionUser(start, cur);
481
+ } else if (type == "double") {
482
+ var word = findWordAt(cur);
483
+ if (posLess(cur, startstart)) setSelectionUser(word.from, startend);
484
+ else setSelectionUser(startstart, word.to);
485
+ } else if (type == "triple") {
486
+ if (posLess(cur, startstart)) setSelectionUser(startend, clipPos({line: cur.line, ch: 0}));
487
+ else setSelectionUser(startstart, clipPos({line: cur.line + 1, ch: 0}));
488
+ }
489
+ }
490
+
491
+ function extend(e) {
492
+ var cur = posFromMouse(e, true);
493
+ if (cur && !posEq(cur, last)) {
494
+ if (!focused) onFocus();
495
+ last = cur;
496
+ doSelect(cur);
497
+ updateInput = false;
498
+ var visible = visibleLines();
499
+ if (cur.line >= visible.to || cur.line < visible.from)
500
+ going = setTimeout(operation(function(){extend(e);}), 150);
501
+ }
502
+ }
503
+
504
+ function done(e) {
505
+ clearTimeout(going);
506
+ var cur = posFromMouse(e);
507
+ if (cur) doSelect(cur);
508
+ e_preventDefault(e);
509
+ focusInput();
510
+ updateInput = true;
511
+ move(); up();
512
+ }
513
+ var move = connect(document, "mousemove", operation(function(e) {
514
+ clearTimeout(going);
515
+ e_preventDefault(e);
516
+ if (!ie && !e_button(e)) done(e);
517
+ else extend(e);
518
+ }), true);
519
+ var up = connect(document, "mouseup", operation(done), true);
520
+ }
521
+ function onDoubleClick(e) {
522
+ for (var n = e_target(e); n != wrapper; n = n.parentNode)
523
+ if (n.parentNode == gutterText) return e_preventDefault(e);
524
+ e_preventDefault(e);
525
+ }
526
+ function onDrop(e) {
527
+ if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;
528
+ e.preventDefault();
529
+ var pos = posFromMouse(e, true), files = e.dataTransfer.files;
530
+ if (!pos || options.readOnly) return;
531
+ if (files && files.length && window.FileReader && window.File) {
532
+ function loadFile(file, i) {
533
+ var reader = new FileReader;
534
+ reader.onload = function() {
535
+ text[i] = reader.result;
536
+ if (++read == n) {
537
+ pos = clipPos(pos);
538
+ operation(function() {
539
+ var end = replaceRange(text.join(""), pos, pos);
540
+ setSelectionUser(pos, end);
541
+ })();
542
+ }
543
+ };
544
+ reader.readAsText(file);
545
+ }
546
+ var n = files.length, text = Array(n), read = 0;
547
+ for (var i = 0; i < n; ++i) loadFile(files[i], i);
548
+ } else {
549
+ // Don't do a replace if the drop happened inside of the selected text.
550
+ if (draggingText && !(posLess(pos, sel.from) || posLess(sel.to, pos))) return;
551
+ try {
552
+ var text = e.dataTransfer.getData("Text");
553
+ if (text) {
554
+ compoundChange(function() {
555
+ var curFrom = sel.from, curTo = sel.to;
556
+ setSelectionUser(pos, pos);
557
+ if (draggingText) replaceRange("", curFrom, curTo);
558
+ replaceSelection(text);
559
+ focusInput();
560
+ });
561
+ }
562
+ }
563
+ catch(e){}
564
+ }
565
+ }
566
+ function onDragStart(e) {
567
+ var txt = getSelection();
568
+ e.dataTransfer.setData("Text", txt);
569
+
570
+ // Use dummy image instead of default browsers image.
571
+ if (gecko || chrome || opera) {
572
+ var img = document.createElement('img');
573
+ img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image
574
+ e.dataTransfer.setDragImage(img, 0, 0);
575
+ }
576
+ }
577
+
578
+ function doHandleBinding(bound, dropShift) {
579
+ if (typeof bound == "string") {
580
+ bound = commands[bound];
581
+ if (!bound) return false;
582
+ }
583
+ var prevShift = shiftSelecting;
584
+ try {
585
+ if (options.readOnly) suppressEdits = true;
586
+ if (dropShift) shiftSelecting = null;
587
+ bound(instance);
588
+ } catch(e) {
589
+ if (e != Pass) throw e;
590
+ return false;
591
+ } finally {
592
+ shiftSelecting = prevShift;
593
+ suppressEdits = false;
594
+ }
595
+ return true;
596
+ }
597
+ function handleKeyBinding(e) {
598
+ // Handle auto keymap transitions
599
+ var startMap = getKeyMap(options.keyMap), next = startMap.auto;
600
+ clearTimeout(maybeTransition);
601
+ if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
602
+ if (getKeyMap(options.keyMap) == startMap) {
603
+ options.keyMap = (next.call ? next.call(null, instance) : next);
604
+ }
605
+ }, 50);
606
+
607
+ var name = keyNames[e_prop(e, "keyCode")], handled = false;
608
+ if (name == null || e.altGraphKey) return false;
609
+ if (e_prop(e, "altKey")) name = "Alt-" + name;
610
+ if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
611
+ if (e_prop(e, "metaKey")) name = "Cmd-" + name;
612
+
613
+ var stopped = false;
614
+ function stop() { stopped = true; }
615
+
616
+ if (e_prop(e, "shiftKey")) {
617
+ handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,
618
+ function(b) {return doHandleBinding(b, true);}, stop)
619
+ || lookupKey(name, options.extraKeys, options.keyMap, function(b) {
620
+ if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);
621
+ }, stop);
622
+ } else {
623
+ handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);
624
+ }
625
+ if (stopped) handled = false;
626
+ if (handled) {
627
+ e_preventDefault(e);
628
+ restartBlink();
629
+ if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
630
+ }
631
+ return handled;
632
+ }
633
+ function handleCharBinding(e, ch) {
634
+ var handled = lookupKey("'" + ch + "'", options.extraKeys,
635
+ options.keyMap, function(b) { return doHandleBinding(b, true); });
636
+ if (handled) {
637
+ e_preventDefault(e);
638
+ restartBlink();
639
+ }
640
+ return handled;
641
+ }
642
+
643
+ var lastStoppedKey = null, maybeTransition;
644
+ function onKeyDown(e) {
645
+ if (!focused) onFocus();
646
+ if (ie && e.keyCode == 27) { e.returnValue = false; }
647
+ if (pollingFast) { if (readInput()) pollingFast = false; }
648
+ if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
649
+ var code = e_prop(e, "keyCode");
650
+ // IE does strange things with escape.
651
+ setShift(code == 16 || e_prop(e, "shiftKey"));
652
+ // First give onKeyEvent option a chance to handle this.
653
+ var handled = handleKeyBinding(e);
654
+ if (opera) {
655
+ lastStoppedKey = handled ? code : null;
656
+ // Opera has no cut event... we try to at least catch the key combo
657
+ if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))
658
+ replaceSelection("");
659
+ }
660
+ }
661
+ function onKeyPress(e) {
662
+ if (pollingFast) readInput();
663
+ if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
664
+ var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
665
+ if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
666
+ if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;
667
+ var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
668
+ if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
669
+ if (mode.electricChars.indexOf(ch) > -1)
670
+ setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75);
671
+ }
672
+ if (handleCharBinding(e, ch)) return;
673
+ fastPoll();
674
+ }
675
+ function onKeyUp(e) {
676
+ if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
677
+ if (e_prop(e, "keyCode") == 16) shiftSelecting = null;
678
+ }
679
+
680
+ function onFocus() {
681
+ if (options.readOnly == "nocursor") return;
682
+ if (!focused) {
683
+ if (options.onFocus) options.onFocus(instance);
684
+ focused = true;
685
+ if (scroller.className.search(/\bCodeMirror-focused\b/) == -1)
686
+ scroller.className += " CodeMirror-focused";
687
+ if (!leaveInputAlone) resetInput(true);
688
+ }
689
+ slowPoll();
690
+ restartBlink();
691
+ }
692
+ function onBlur() {
693
+ if (focused) {
694
+ if (options.onBlur) options.onBlur(instance);
695
+ focused = false;
696
+ if (bracketHighlighted)
697
+ operation(function(){
698
+ if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }
699
+ })();
700
+ scroller.className = scroller.className.replace(" CodeMirror-focused", "");
701
+ }
702
+ clearInterval(blinker);
703
+ setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
704
+ }
705
+
706
+ function chopDelta(delta) {
707
+ // Make sure we always scroll a little bit for any nonzero delta.
708
+ if (delta > 0.0 && delta < 1.0) return 1;
709
+ else if (delta > -1.0 && delta < 0.0) return -1;
710
+ else return Math.round(delta);
711
+ }
712
+
713
+ function onMouseWheel(e) {
714
+ var deltaX = 0, deltaY = 0;
715
+ if (e.type == "DOMMouseScroll") { // Firefox
716
+ var delta = -e.detail * 8.0;
717
+ if (e.axis == e.HORIZONTAL_AXIS) deltaX = delta;
718
+ else if (e.axis == e.VERTICAL_AXIS) deltaY = delta;
719
+ } else if (e.wheelDeltaX !== undefined && e.wheelDeltaY !== undefined) { // WebKit
720
+ deltaX = e.wheelDeltaX / 3.0;
721
+ deltaY = e.wheelDeltaY / 3.0;
722
+ } else if (e.wheelDelta !== undefined) { // IE or Opera
723
+ deltaY = e.wheelDelta / 3.0;
724
+ }
725
+
726
+ var scrolled = false;
727
+ deltaX = chopDelta(deltaX);
728
+ deltaY = chopDelta(deltaY);
729
+ if ((deltaX > 0 && scroller.scrollLeft > 0) ||
730
+ (deltaX < 0 && scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth)) {
731
+ scroller.scrollLeft -= deltaX;
732
+ scrolled = true;
733
+ }
734
+ if ((deltaY > 0 && scrollbar.scrollTop > 0) ||
735
+ (deltaY < 0 && scrollbar.scrollTop + scrollbar.clientHeight < scrollbar.scrollHeight)) {
736
+ scrollbar.scrollTop -= deltaY;
737
+ scrolled = true;
738
+ }
739
+ if (scrolled) e_stop(e);
740
+ }
741
+
742
+ // Replace the range from from to to by the strings in newText.
743
+ // Afterwards, set the selection to selFrom, selTo.
744
+ function updateLines(from, to, newText, selFrom, selTo) {
745
+ if (suppressEdits) return;
746
+ if (history) {
747
+ var old = [];
748
+ doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });
749
+ history.addChange(from.line, newText.length, old);
750
+ while (history.done.length > options.undoDepth) history.done.shift();
751
+ }
752
+ updateLinesNoUndo(from, to, newText, selFrom, selTo);
753
+ }
754
+ function unredoHelper(from, to) {
755
+ if (!from.length) return;
756
+ var set = from.pop(), out = [];
757
+ for (var i = set.length - 1; i >= 0; i -= 1) {
758
+ var change = set[i];
759
+ var replaced = [], end = change.start + change.added;
760
+ doc.iter(change.start, end, function(line) { replaced.push(line.text); });
761
+ out.push({start: change.start, added: change.old.length, old: replaced});
762
+ var pos = {line: change.start + change.old.length - 1,
763
+ ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])};
764
+ updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);
765
+ }
766
+ updateInput = true;
767
+ to.push(out);
768
+ }
769
+ function undo() {unredoHelper(history.done, history.undone);}
770
+ function redo() {unredoHelper(history.undone, history.done);}
771
+
772
+ function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
773
+ if (suppressEdits) return;
774
+ var recomputeMaxLength = false, maxLineLength = maxLine.length;
775
+ if (!options.lineWrapping)
776
+ doc.iter(from.line, to.line + 1, function(line) {
777
+ if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
778
+ });
779
+ if (from.line != to.line || newText.length > 1) gutterDirty = true;
780
+
781
+ var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);
782
+ // First adjust the line structure, taking some care to leave highlighting intact.
783
+ if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") {
784
+ // This is a whole-line replace. Treated specially to make
785
+ // sure line objects move the way they are supposed to.
786
+ var added = [], prevLine = null;
787
+ if (from.line) {
788
+ prevLine = getLine(from.line - 1);
789
+ prevLine.fixMarkEnds(lastLine);
790
+ } else lastLine.fixMarkStarts();
791
+ for (var i = 0, e = newText.length - 1; i < e; ++i)
792
+ added.push(Line.inheritMarks(newText[i], prevLine));
793
+ if (nlines) doc.remove(from.line, nlines, callbacks);
794
+ if (added.length) doc.insert(from.line, added);
795
+ } else if (firstLine == lastLine) {
796
+ if (newText.length == 1)
797
+ firstLine.replace(from.ch, to.ch, newText[0]);
798
+ else {
799
+ lastLine = firstLine.split(to.ch, newText[newText.length-1]);
800
+ firstLine.replace(from.ch, null, newText[0]);
801
+ firstLine.fixMarkEnds(lastLine);
802
+ var added = [];
803
+ for (var i = 1, e = newText.length - 1; i < e; ++i)
804
+ added.push(Line.inheritMarks(newText[i], firstLine));
805
+ added.push(lastLine);
806
+ doc.insert(from.line + 1, added);
807
+ }
808
+ } else if (newText.length == 1) {
809
+ firstLine.replace(from.ch, null, newText[0]);
810
+ lastLine.replace(null, to.ch, "");
811
+ firstLine.append(lastLine);
812
+ doc.remove(from.line + 1, nlines, callbacks);
813
+ } else {
814
+ var added = [];
815
+ firstLine.replace(from.ch, null, newText[0]);
816
+ lastLine.replace(null, to.ch, newText[newText.length-1]);
817
+ firstLine.fixMarkEnds(lastLine);
818
+ for (var i = 1, e = newText.length - 1; i < e; ++i)
819
+ added.push(Line.inheritMarks(newText[i], firstLine));
820
+ if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);
821
+ doc.insert(from.line + 1, added);
822
+ }
823
+ if (options.lineWrapping) {
824
+ var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);
825
+ doc.iter(from.line, from.line + newText.length, function(line) {
826
+ if (line.hidden) return;
827
+ var guess = Math.ceil(line.text.length / perLine) || 1;
828
+ if (guess != line.height) updateLineHeight(line, guess);
829
+ });
830
+ } else {
831
+ doc.iter(from.line, from.line + newText.length, function(line) {
832
+ var l = line.text;
833
+ if (!line.hidden && l.length > maxLineLength) {
834
+ maxLine = l; maxLineLength = l.length; maxLineChanged = true;
835
+ recomputeMaxLength = false;
836
+ }
837
+ });
838
+ if (recomputeMaxLength) updateMaxLine = true;
839
+ }
840
+
841
+ // Add these lines to the work array, so that they will be
842
+ // highlighted. Adjust work lines if lines were added/removed.
843
+ var newWork = [], lendiff = newText.length - nlines - 1;
844
+ for (var i = 0, l = work.length; i < l; ++i) {
845
+ var task = work[i];
846
+ if (task < from.line) newWork.push(task);
847
+ else if (task > to.line) newWork.push(task + lendiff);
848
+ }
849
+ var hlEnd = from.line + Math.min(newText.length, 500);
850
+ highlightLines(from.line, hlEnd);
851
+ newWork.push(hlEnd);
852
+ work = newWork;
853
+ startWorker(100);
854
+ // Remember that these lines changed, for updating the display
855
+ changes.push({from: from.line, to: to.line + 1, diff: lendiff});
856
+ var changeObj = {from: from, to: to, text: newText};
857
+ if (textChanged) {
858
+ for (var cur = textChanged; cur.next; cur = cur.next) {}
859
+ cur.next = changeObj;
860
+ } else textChanged = changeObj;
861
+
862
+ // Update the selection
863
+ function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
864
+ setSelection(clipPos(selFrom), clipPos(selTo),
865
+ updateLine(sel.from.line), updateLine(sel.to.line));
866
+ }
867
+
868
+ function needsScrollbar() {
869
+ var realHeight = doc.height * textHeight() + 2 * paddingTop();
870
+ return realHeight - 1 > scroller.offsetHeight ? realHeight : false;
871
+ }
872
+
873
+ function updateVerticalScroll(scrollTop) {
874
+ var scrollHeight = needsScrollbar();
875
+ scrollbar.style.display = scrollHeight ? "block" : "none";
876
+ if (scrollHeight) {
877
+ scrollbarInner.style.height = scrollHeight + "px";
878
+ scrollbar.style.height = scroller.offsetHeight + "px";
879
+ if (scrollTop != null) scrollbar.scrollTop = scrollTop;
880
+ }
881
+ // Position the mover div to align with the current virtual scroll position
882
+ mover.style.top = (displayOffset * textHeight() - scrollbar.scrollTop) + "px";
883
+ }
884
+
885
+ // On Mac OS X Lion and up, detect whether the mouse is plugged in by measuring
886
+ // the width of a div with a scrollbar in it. If the width is <= 1, then
887
+ // the mouse isn't plugged in and scrollbars should overlap the content.
888
+ function overlapScrollbars() {
889
+ var tmpSb = document.createElement('div'),
890
+ tmpSbInner = document.createElement('div');
891
+ tmpSb.className = "CodeMirror-scrollbar";
892
+ tmpSb.style.cssText = "position: absolute; left: -9999px; height: 100px;";
893
+ tmpSbInner.className = "CodeMirror-scrollbar-inner";
894
+ tmpSbInner.style.height = "200px";
895
+ tmpSb.appendChild(tmpSbInner);
896
+
897
+ document.body.appendChild(tmpSb);
898
+ var result = (tmpSb.offsetWidth <= 1);
899
+ document.body.removeChild(tmpSb);
900
+ return result;
901
+ }
902
+
903
+ function computeMaxLength() {
904
+ var maxLineLength = 0;
905
+ maxLine = ""; maxLineChanged = true;
906
+ doc.iter(0, doc.size, function(line) {
907
+ var l = line.text;
908
+ if (!line.hidden && l.length > maxLineLength) {
909
+ maxLineLength = l.length; maxLine = l;
910
+ }
911
+ });
912
+ updateMaxLine = false;
913
+ }
914
+
915
+ function replaceRange(code, from, to) {
916
+ from = clipPos(from);
917
+ if (!to) to = from; else to = clipPos(to);
918
+ code = splitLines(code);
919
+ function adjustPos(pos) {
920
+ if (posLess(pos, from)) return pos;
921
+ if (!posLess(to, pos)) return end;
922
+ var line = pos.line + code.length - (to.line - from.line) - 1;
923
+ var ch = pos.ch;
924
+ if (pos.line == to.line)
925
+ ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
926
+ return {line: line, ch: ch};
927
+ }
928
+ var end;
929
+ replaceRange1(code, from, to, function(end1) {
930
+ end = end1;
931
+ return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
932
+ });
933
+ return end;
934
+ }
935
+ function replaceSelection(code, collapse) {
936
+ replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
937
+ if (collapse == "end") return {from: end, to: end};
938
+ else if (collapse == "start") return {from: sel.from, to: sel.from};
939
+ else return {from: sel.from, to: end};
940
+ });
941
+ }
942
+ function replaceRange1(code, from, to, computeSel) {
943
+ var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
944
+ var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
945
+ updateLines(from, to, code, newSel.from, newSel.to);
946
+ }
947
+
948
+ function getRange(from, to, lineSep) {
949
+ var l1 = from.line, l2 = to.line;
950
+ if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
951
+ var code = [getLine(l1).text.slice(from.ch)];
952
+ doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
953
+ code.push(getLine(l2).text.slice(0, to.ch));
954
+ return code.join(lineSep || "\n");
955
+ }
956
+ function getSelection(lineSep) {
957
+ return getRange(sel.from, sel.to, lineSep);
958
+ }
959
+
960
+ var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
961
+ function slowPoll() {
962
+ if (pollingFast) return;
963
+ poll.set(options.pollInterval, function() {
964
+ startOperation();
965
+ readInput();
966
+ if (focused) slowPoll();
967
+ endOperation();
968
+ });
969
+ }
970
+ function fastPoll() {
971
+ var missed = false;
972
+ pollingFast = true;
973
+ function p() {
974
+ startOperation();
975
+ var changed = readInput();
976
+ if (!changed && !missed) {missed = true; poll.set(60, p);}
977
+ else {pollingFast = false; slowPoll();}
978
+ endOperation();
979
+ }
980
+ poll.set(20, p);
981
+ }
982
+
983
+ // Previnput is a hack to work with IME. If we reset the textarea
984
+ // on every change, that breaks IME. So we look for changes
985
+ // compared to the previous content instead. (Modern browsers have
986
+ // events that indicate IME taking place, but these are not widely
987
+ // supported or compatible enough yet to rely on.)
988
+ var prevInput = "";
989
+ function readInput() {
990
+ if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;
991
+ var text = input.value;
992
+ if (text == prevInput) return false;
993
+ shiftSelecting = null;
994
+ var same = 0, l = Math.min(prevInput.length, text.length);
995
+ while (same < l && prevInput[same] == text[same]) ++same;
996
+ if (same < prevInput.length)
997
+ sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};
998
+ else if (overwrite && posEq(sel.from, sel.to))
999
+ sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
1000
+ replaceSelection(text.slice(same), "end");
1001
+ if (text.length > 1000) { input.value = prevInput = ""; }
1002
+ else prevInput = text;
1003
+ return true;
1004
+ }
1005
+ function resetInput(user) {
1006
+ if (!posEq(sel.from, sel.to)) {
1007
+ prevInput = "";
1008
+ input.value = getSelection();
1009
+ selectInput(input);
1010
+ } else if (user) prevInput = input.value = "";
1011
+ }
1012
+
1013
+ function focusInput() {
1014
+ if (options.readOnly != "nocursor") input.focus();
1015
+ }
1016
+
1017
+ function scrollEditorIntoView() {
1018
+ var rect = cursor.getBoundingClientRect();
1019
+ // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden
1020
+ if (ie && rect.top == rect.bottom) return;
1021
+ var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
1022
+ if (rect.top < 0 || rect.bottom > winH) scrollCursorIntoView();
1023
+ }
1024
+ function scrollCursorIntoView() {
1025
+ var coords = calculateCursorCoords();
1026
+ return scrollIntoView(coords.x, coords.y, coords.x, coords.yBot);
1027
+ }
1028
+ function calculateCursorCoords() {
1029
+ var cursor = localCoords(sel.inverted ? sel.from : sel.to);
1030
+ var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;
1031
+ return {x: x, y: cursor.y, yBot: cursor.yBot};
1032
+ }
1033
+ function scrollIntoView(x1, y1, x2, y2) {
1034
+ var scrollPos = calculateScrollPos(x1, y1, x2, y2), scrolled = false;
1035
+ if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft; scrolled = true;}
1036
+ if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scrollPos.scrollTop; scrolled = true;}
1037
+ if (scrolled && options.onScroll) options.onScroll(instance);
1038
+ }
1039
+ function calculateScrollPos(x1, y1, x2, y2) {
1040
+ var pl = paddingLeft(), pt = paddingTop();
1041
+ y1 += pt; y2 += pt; x1 += pl; x2 += pl;
1042
+ var screen = scroller.clientHeight, screentop = scrollbar.scrollTop, result = {};
1043
+ var docBottom = scroller.scrollHeight;
1044
+ var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;;
1045
+ if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);
1046
+ else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen;
1047
+
1048
+ var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
1049
+ var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
1050
+ var atLeft = x1 < gutterw + pl + 10;
1051
+ if (x1 < screenleft + gutterw || atLeft) {
1052
+ if (atLeft) x1 = 0;
1053
+ result.scrollLeft = Math.max(0, x1 - 10 - gutterw);
1054
+ } else if (x2 > screenw + screenleft - 3) {
1055
+ result.scrollLeft = x2 + 10 - screenw;
1056
+ }
1057
+ return result;
1058
+ }
1059
+
1060
+ function visibleLines(scrollTop) {
1061
+ var lh = textHeight(), top = (scrollTop != null ? scrollTop : scrollbar.scrollTop) - paddingTop();
1062
+ var fromHeight = Math.max(0, Math.floor(top / lh));
1063
+ var toHeight = Math.ceil((top + scroller.clientHeight) / lh);
1064
+ return {from: lineAtHeight(doc, fromHeight),
1065
+ to: lineAtHeight(doc, toHeight)};
1066
+ }
1067
+ // Uses a set of changes plus the current scroll position to
1068
+ // determine which DOM updates have to be made, and makes the
1069
+ // updates.
1070
+ function updateDisplay(changes, suppressCallback, scrollTop) {
1071
+ if (!scroller.clientWidth) {
1072
+ showingFrom = showingTo = displayOffset = 0;
1073
+ return;
1074
+ }
1075
+ // Compute the new visible window
1076
+ // If scrollTop is specified, use that to determine which lines
1077
+ // to render instead of the current scrollbar position.
1078
+ var visible = visibleLines(scrollTop);
1079
+ // Bail out if the visible area is already rendered and nothing changed.
1080
+ if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) {
1081
+ updateVerticalScroll(scrollTop);
1082
+ return;
1083
+ }
1084
+ var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);
1085
+ if (showingFrom < from && from - showingFrom < 20) from = showingFrom;
1086
+ if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);
1087
+
1088
+ // Create a range of theoretically intact lines, and punch holes
1089
+ // in that using the change info.
1090
+ var intact = changes === true ? [] :
1091
+ computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);
1092
+ // Clip off the parts that won't be visible
1093
+ var intactLines = 0;
1094
+ for (var i = 0; i < intact.length; ++i) {
1095
+ var range = intact[i];
1096
+ if (range.from < from) {range.domStart += (from - range.from); range.from = from;}
1097
+ if (range.to > to) range.to = to;
1098
+ if (range.from >= range.to) intact.splice(i--, 1);
1099
+ else intactLines += range.to - range.from;
1100
+ }
1101
+ if (intactLines == to - from && from == showingFrom && to == showingTo) {
1102
+ updateVerticalScroll(scrollTop);
1103
+ return;
1104
+ }
1105
+ intact.sort(function(a, b) {return a.domStart - b.domStart;});
1106
+
1107
+ var th = textHeight(), gutterDisplay = gutter.style.display;
1108
+ lineDiv.style.display = "none";
1109
+ patchDisplay(from, to, intact);
1110
+ lineDiv.style.display = gutter.style.display = "";
1111
+
1112
+ var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;
1113
+ // This is just a bogus formula that detects when the editor is
1114
+ // resized or the font size changes.
1115
+ if (different) lastSizeC = scroller.clientHeight + th;
1116
+ showingFrom = from; showingTo = to;
1117
+ displayOffset = heightAtLine(doc, from);
1118
+
1119
+ // Since this is all rather error prone, it is honoured with the
1120
+ // only assertion in the whole file.
1121
+ if (lineDiv.childNodes.length != showingTo - showingFrom)
1122
+ throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
1123
+ " nodes=" + lineDiv.childNodes.length);
1124
+
1125
+ function checkHeights() {
1126
+ var curNode = lineDiv.firstChild, heightChanged = false;
1127
+ doc.iter(showingFrom, showingTo, function(line) {
1128
+ if (!line.hidden) {
1129
+ var height = Math.round(curNode.offsetHeight / th) || 1;
1130
+ if (line.height != height) {
1131
+ updateLineHeight(line, height);
1132
+ gutterDirty = heightChanged = true;
1133
+ }
1134
+ }
1135
+ curNode = curNode.nextSibling;
1136
+ });
1137
+ return heightChanged;
1138
+ }
1139
+
1140
+ if (options.lineWrapping) {
1141
+ checkHeights();
1142
+ var scrollHeight = needsScrollbar();
1143
+ var shouldHaveScrollbar = scrollHeight ? "block" : "none";
1144
+ if (scrollbar.style.display != shouldHaveScrollbar) {
1145
+ scrollbar.style.display = shouldHaveScrollbar;
1146
+ if (scrollHeight) scrollbarInner.style.height = scrollHeight + "px";
1147
+ checkHeights();
1148
+ }
1149
+ }
1150
+
1151
+ gutter.style.display = gutterDisplay;
1152
+ if (different || gutterDirty) {
1153
+ // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.
1154
+ updateGutter() && options.lineWrapping && checkHeights() && updateGutter();
1155
+ }
1156
+ updateVerticalScroll(scrollTop);
1157
+ updateSelection();
1158
+ if (!suppressCallback && options.onUpdate) options.onUpdate(instance);
1159
+ return true;
1160
+ }
1161
+
1162
+ function computeIntact(intact, changes) {
1163
+ for (var i = 0, l = changes.length || 0; i < l; ++i) {
1164
+ var change = changes[i], intact2 = [], diff = change.diff || 0;
1165
+ for (var j = 0, l2 = intact.length; j < l2; ++j) {
1166
+ var range = intact[j];
1167
+ if (change.to <= range.from && change.diff)
1168
+ intact2.push({from: range.from + diff, to: range.to + diff,
1169
+ domStart: range.domStart});
1170
+ else if (change.to <= range.from || change.from >= range.to)
1171
+ intact2.push(range);
1172
+ else {
1173
+ if (change.from > range.from)
1174
+ intact2.push({from: range.from, to: change.from, domStart: range.domStart});
1175
+ if (change.to < range.to)
1176
+ intact2.push({from: change.to + diff, to: range.to + diff,
1177
+ domStart: range.domStart + (change.to - range.from)});
1178
+ }
1179
+ }
1180
+ intact = intact2;
1181
+ }
1182
+ return intact;
1183
+ }
1184
+
1185
+ function patchDisplay(from, to, intact) {
1186
+ // The first pass removes the DOM nodes that aren't intact.
1187
+ if (!intact.length) lineDiv.innerHTML = "";
1188
+ else {
1189
+ function killNode(node) {
1190
+ var tmp = node.nextSibling;
1191
+ node.parentNode.removeChild(node);
1192
+ return tmp;
1193
+ }
1194
+ var domPos = 0, curNode = lineDiv.firstChild, n;
1195
+ for (var i = 0; i < intact.length; ++i) {
1196
+ var cur = intact[i];
1197
+ while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}
1198
+ for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}
1199
+ }
1200
+ while (curNode) curNode = killNode(curNode);
1201
+ }
1202
+ // This pass fills in the lines that actually changed.
1203
+ var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;
1204
+ var scratch = document.createElement("div");
1205
+ doc.iter(from, to, function(line) {
1206
+ if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();
1207
+ if (!nextIntact || nextIntact.from > j) {
1208
+ if (line.hidden) var html = scratch.innerHTML = "<pre></pre>";
1209
+ else {
1210
+ var html = '<pre' + (line.className ? ' class="' + line.className + '"' : '') + '>'
1211
+ + line.getHTML(makeTab) + '</pre>';
1212
+ // Kludge to make sure the styled element lies behind the selection (by z-index)
1213
+ if (line.bgClassName)
1214
+ html = '<div style="position: relative"><pre class="' + line.bgClassName +
1215
+ '" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2">&#160;</pre>' + html + "</div>";
1216
+ }
1217
+ scratch.innerHTML = html;
1218
+ lineDiv.insertBefore(scratch.firstChild, curNode);
1219
+ } else {
1220
+ curNode = curNode.nextSibling;
1221
+ }
1222
+ ++j;
1223
+ });
1224
+ }
1225
+
1226
+ function updateGutter() {
1227
+ if (!options.gutter && !options.lineNumbers) return;
1228
+ var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
1229
+ gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
1230
+ var html = [], i = showingFrom, normalNode;
1231
+ doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {
1232
+ if (line.hidden) {
1233
+ html.push("<pre></pre>");
1234
+ } else {
1235
+ var marker = line.gutterMarker;
1236
+ var text = options.lineNumbers ? options.lineNumberFormatter(i + options.firstLineNumber) : null;
1237
+ if (marker && marker.text)
1238
+ text = marker.text.replace("%N%", text != null ? text : "");
1239
+ else if (text == null)
1240
+ text = "\u00a0";
1241
+ html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text);
1242
+ for (var j = 1; j < line.height; ++j) html.push("<br/>&#160;");
1243
+ html.push("</pre>");
1244
+ if (!marker) normalNode = i;
1245
+ }
1246
+ ++i;
1247
+ });
1248
+ gutter.style.display = "none";
1249
+ gutterText.innerHTML = html.join("");
1250
+ // Make sure scrolling doesn't cause number gutter size to pop
1251
+ if (normalNode != null && options.lineNumbers) {
1252
+ var node = gutterText.childNodes[normalNode - showingFrom];
1253
+ var minwidth = String(doc.size).length, val = eltText(node.firstChild), pad = "";
1254
+ while (val.length + pad.length < minwidth) pad += "\u00a0";
1255
+ if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);
1256
+ }
1257
+ gutter.style.display = "";
1258
+ var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;
1259
+ lineSpace.style.marginLeft = gutter.offsetWidth + "px";
1260
+ gutterDirty = false;
1261
+ return resized;
1262
+ }
1263
+ function updateSelection() {
1264
+ var collapsed = posEq(sel.from, sel.to);
1265
+ var fromPos = localCoords(sel.from, true);
1266
+ var toPos = collapsed ? fromPos : localCoords(sel.to, true);
1267
+ var headPos = sel.inverted ? fromPos : toPos, th = textHeight();
1268
+ var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);
1269
+ inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px";
1270
+ inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px";
1271
+ if (collapsed) {
1272
+ cursor.style.top = headPos.y + "px";
1273
+ cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px";
1274
+ cursor.style.display = "";
1275
+ selectionDiv.style.display = "none";
1276
+ } else {
1277
+ var sameLine = fromPos.y == toPos.y, html = "";
1278
+ var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;
1279
+ var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;
1280
+ function add(left, top, right, height) {
1281
+ var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px"
1282
+ : "right: " + right + "px";
1283
+ html += '<div class="CodeMirror-selected" style="position: absolute; left: ' + left +
1284
+ 'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px"></div>';
1285
+ }
1286
+ if (sel.from.ch && fromPos.y >= 0) {
1287
+ var right = sameLine ? clientWidth - toPos.x : 0;
1288
+ add(fromPos.x, fromPos.y, right, th);
1289
+ }
1290
+ var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));
1291
+ var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;
1292
+ if (middleHeight > 0.2 * th)
1293
+ add(0, middleStart, 0, middleHeight);
1294
+ if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)
1295
+ add(0, toPos.y, clientWidth - toPos.x, th);
1296
+ selectionDiv.innerHTML = html;
1297
+ cursor.style.display = "none";
1298
+ selectionDiv.style.display = "";
1299
+ }
1300
+ }
1301
+
1302
+ function setShift(val) {
1303
+ if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
1304
+ else shiftSelecting = null;
1305
+ }
1306
+ function setSelectionUser(from, to) {
1307
+ var sh = shiftSelecting && clipPos(shiftSelecting);
1308
+ if (sh) {
1309
+ if (posLess(sh, from)) from = sh;
1310
+ else if (posLess(to, sh)) to = sh;
1311
+ }
1312
+ setSelection(from, to);
1313
+ userSelChange = true;
1314
+ }
1315
+ // Update the selection. Last two args are only used by
1316
+ // updateLines, since they have to be expressed in the line
1317
+ // numbers before the update.
1318
+ function setSelection(from, to, oldFrom, oldTo) {
1319
+ goalColumn = null;
1320
+ if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
1321
+ if (posEq(sel.from, from) && posEq(sel.to, to)) return;
1322
+ if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
1323
+
1324
+ // Skip over hidden lines.
1325
+ if (from.line != oldFrom) {
1326
+ var from1 = skipHidden(from, oldFrom, sel.from.ch);
1327
+ // If there is no non-hidden line left, force visibility on current line
1328
+ if (!from1) setLineHidden(from.line, false);
1329
+ else from = from1;
1330
+ }
1331
+ if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
1332
+
1333
+ if (posEq(from, to)) sel.inverted = false;
1334
+ else if (posEq(from, sel.to)) sel.inverted = false;
1335
+ else if (posEq(to, sel.from)) sel.inverted = true;
1336
+
1337
+ if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {
1338
+ var head = sel.inverted ? from : to;
1339
+ if (head.line != sel.from.line && sel.from.line < doc.size) {
1340
+ var oldLine = getLine(sel.from.line);
1341
+ if (/^\s+$/.test(oldLine.text))
1342
+ setTimeout(operation(function() {
1343
+ if (oldLine.parent && /^\s+$/.test(oldLine.text)) {
1344
+ var no = lineNo(oldLine);
1345
+ replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});
1346
+ }
1347
+ }, 10));
1348
+ }
1349
+ }
1350
+
1351
+ sel.from = from; sel.to = to;
1352
+ selectionChanged = true;
1353
+ }
1354
+ function skipHidden(pos, oldLine, oldCh) {
1355
+ function getNonHidden(dir) {
1356
+ var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;
1357
+ while (lNo != end) {
1358
+ var line = getLine(lNo);
1359
+ if (!line.hidden) {
1360
+ var ch = pos.ch;
1361
+ if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;
1362
+ return {line: lNo, ch: ch};
1363
+ }
1364
+ lNo += dir;
1365
+ }
1366
+ }
1367
+ var line = getLine(pos.line);
1368
+ var toEnd = pos.ch == line.text.length && pos.ch != oldCh;
1369
+ if (!line.hidden) return pos;
1370
+ if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);
1371
+ else return getNonHidden(-1) || getNonHidden(1);
1372
+ }
1373
+ function setCursor(line, ch, user) {
1374
+ var pos = clipPos({line: line, ch: ch || 0});
1375
+ (user ? setSelectionUser : setSelection)(pos, pos);
1376
+ }
1377
+
1378
+ function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}
1379
+ function clipPos(pos) {
1380
+ if (pos.line < 0) return {line: 0, ch: 0};
1381
+ if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};
1382
+ var ch = pos.ch, linelen = getLine(pos.line).text.length;
1383
+ if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
1384
+ else if (ch < 0) return {line: pos.line, ch: 0};
1385
+ else return pos;
1386
+ }
1387
+
1388
+ function findPosH(dir, unit) {
1389
+ var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;
1390
+ var lineObj = getLine(line);
1391
+ function findNextLine() {
1392
+ for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {
1393
+ var lo = getLine(l);
1394
+ if (!lo.hidden) { line = l; lineObj = lo; return true; }
1395
+ }
1396
+ }
1397
+ function moveOnce(boundToLine) {
1398
+ if (ch == (dir < 0 ? 0 : lineObj.text.length)) {
1399
+ if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;
1400
+ else return false;
1401
+ } else ch += dir;
1402
+ return true;
1403
+ }
1404
+ if (unit == "char") moveOnce();
1405
+ else if (unit == "column") moveOnce(true);
1406
+ else if (unit == "word") {
1407
+ var sawWord = false;
1408
+ for (;;) {
1409
+ if (dir < 0) if (!moveOnce()) break;
1410
+ if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
1411
+ else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
1412
+ if (dir > 0) if (!moveOnce()) break;
1413
+ }
1414
+ }
1415
+ return {line: line, ch: ch};
1416
+ }
1417
+ function moveH(dir, unit) {
1418
+ var pos = dir < 0 ? sel.from : sel.to;
1419
+ if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);
1420
+ setCursor(pos.line, pos.ch, true);
1421
+ }
1422
+ function deleteH(dir, unit) {
1423
+ if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to);
1424
+ else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to);
1425
+ else replaceRange("", sel.from, findPosH(dir, unit));
1426
+ userSelChange = true;
1427
+ }
1428
+ var goalColumn = null;
1429
+ function moveV(dir, unit) {
1430
+ var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);
1431
+ if (goalColumn != null) pos.x = goalColumn;
1432
+ if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);
1433
+ else if (unit == "line") dist = textHeight();
1434
+ var target = coordsChar(pos.x, pos.y + dist * dir + 2);
1435
+ if (unit == "page") scrollbar.scrollTop += localCoords(target, true).y - pos.y;
1436
+ setCursor(target.line, target.ch, true);
1437
+ goalColumn = pos.x;
1438
+ }
1439
+
1440
+ function findWordAt(pos) {
1441
+ var line = getLine(pos.line).text;
1442
+ var start = pos.ch, end = pos.ch;
1443
+ var check = isWordChar(line.charAt(start < line.length ? start : start - 1)) ?
1444
+ isWordChar : function(ch) {return !isWordChar(ch);};
1445
+ while (start > 0 && check(line.charAt(start - 1))) --start;
1446
+ while (end < line.length && check(line.charAt(end))) ++end;
1447
+ return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}};
1448
+ }
1449
+ function selectLine(line) {
1450
+ setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));
1451
+ }
1452
+ function indentSelected(mode) {
1453
+ if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
1454
+ var e = sel.to.line - (sel.to.ch ? 0 : 1);
1455
+ for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
1456
+ }
1457
+
1458
+ function indentLine(n, how) {
1459
+ if (!how) how = "add";
1460
+ if (how == "smart") {
1461
+ if (!mode.indent) how = "prev";
1462
+ else var state = getStateBefore(n);
1463
+ }
1464
+
1465
+ var line = getLine(n), curSpace = line.indentation(options.tabSize),
1466
+ curSpaceString = line.text.match(/^\s*/)[0], indentation;
1467
+ if (how == "smart") {
1468
+ indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);
1469
+ if (indentation == Pass) how = "prev";
1470
+ }
1471
+ if (how == "prev") {
1472
+ if (n) indentation = getLine(n-1).indentation(options.tabSize);
1473
+ else indentation = 0;
1474
+ }
1475
+ else if (how == "add") indentation = curSpace + options.indentUnit;
1476
+ else if (how == "subtract") indentation = curSpace - options.indentUnit;
1477
+ indentation = Math.max(0, indentation);
1478
+ var diff = indentation - curSpace;
1479
+
1480
+ var indentString = "", pos = 0;
1481
+ if (options.indentWithTabs)
1482
+ for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";}
1483
+ while (pos < indentation) {++pos; indentString += " ";}
1484
+
1485
+ replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
1486
+ }
1487
+
1488
+ function loadMode() {
1489
+ mode = CodeMirror.getMode(options, options.mode);
1490
+ doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
1491
+ work = [0];
1492
+ startWorker();
1493
+ }
1494
+ function gutterChanged() {
1495
+ var visible = options.gutter || options.lineNumbers;
1496
+ gutter.style.display = visible ? "" : "none";
1497
+ if (visible) gutterDirty = true;
1498
+ else lineDiv.parentNode.style.marginLeft = 0;
1499
+ }
1500
+ function wrappingChanged(from, to) {
1501
+ if (options.lineWrapping) {
1502
+ wrapper.className += " CodeMirror-wrap";
1503
+ var perLine = scroller.clientWidth / charWidth() - 3;
1504
+ doc.iter(0, doc.size, function(line) {
1505
+ if (line.hidden) return;
1506
+ var guess = Math.ceil(line.text.length / perLine) || 1;
1507
+ if (guess != 1) updateLineHeight(line, guess);
1508
+ });
1509
+ lineSpace.style.width = code.style.width = "";
1510
+ widthForcer.style.left = "";
1511
+ } else {
1512
+ wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");
1513
+ maxLine = ""; maxLineChanged = true;
1514
+ doc.iter(0, doc.size, function(line) {
1515
+ if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);
1516
+ if (line.text.length > maxLine.length) maxLine = line.text;
1517
+ });
1518
+ }
1519
+ changes.push({from: 0, to: doc.size});
1520
+ }
1521
+ function makeTab(col) {
1522
+ var w = options.tabSize - col % options.tabSize, cached = tabCache[w];
1523
+ if (cached) return cached;
1524
+ for (var str = '<span class="cm-tab">', i = 0; i < w; ++i) str += " ";
1525
+ return (tabCache[w] = {html: str + "</span>", width: w});
1526
+ }
1527
+ function themeChanged() {
1528
+ scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") +
1529
+ options.theme.replace(/(^|\s)\s*/g, " cm-s-");
1530
+ }
1531
+ function keyMapChanged() {
1532
+ var style = keyMap[options.keyMap].style;
1533
+ wrapper.className = wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
1534
+ (style ? " cm-keymap-" + style : "");
1535
+ }
1536
+
1537
+ function TextMarker() { this.set = []; }
1538
+ TextMarker.prototype.clear = operation(function() {
1539
+ var min = Infinity, max = -Infinity;
1540
+ for (var i = 0, e = this.set.length; i < e; ++i) {
1541
+ var line = this.set[i], mk = line.marked;
1542
+ if (!mk || !line.parent) continue;
1543
+ var lineN = lineNo(line);
1544
+ min = Math.min(min, lineN); max = Math.max(max, lineN);
1545
+ for (var j = 0; j < mk.length; ++j)
1546
+ if (mk[j].marker == this) mk.splice(j--, 1);
1547
+ }
1548
+ if (min != Infinity)
1549
+ changes.push({from: min, to: max + 1});
1550
+ });
1551
+ TextMarker.prototype.find = function() {
1552
+ var from, to;
1553
+ for (var i = 0, e = this.set.length; i < e; ++i) {
1554
+ var line = this.set[i], mk = line.marked;
1555
+ for (var j = 0; j < mk.length; ++j) {
1556
+ var mark = mk[j];
1557
+ if (mark.marker == this) {
1558
+ if (mark.from != null || mark.to != null) {
1559
+ var found = lineNo(line);
1560
+ if (found != null) {
1561
+ if (mark.from != null) from = {line: found, ch: mark.from};
1562
+ if (mark.to != null) to = {line: found, ch: mark.to};
1563
+ }
1564
+ }
1565
+ }
1566
+ }
1567
+ }
1568
+ return {from: from, to: to};
1569
+ };
1570
+
1571
+ function markText(from, to, className) {
1572
+ from = clipPos(from); to = clipPos(to);
1573
+ var tm = new TextMarker();
1574
+ if (!posLess(from, to)) return tm;
1575
+ function add(line, from, to, className) {
1576
+ getLine(line).addMark(new MarkedText(from, to, className, tm));
1577
+ }
1578
+ if (from.line == to.line) add(from.line, from.ch, to.ch, className);
1579
+ else {
1580
+ add(from.line, from.ch, null, className);
1581
+ for (var i = from.line + 1, e = to.line; i < e; ++i)
1582
+ add(i, null, null, className);
1583
+ add(to.line, null, to.ch, className);
1584
+ }
1585
+ changes.push({from: from.line, to: to.line + 1});
1586
+ return tm;
1587
+ }
1588
+
1589
+ function setBookmark(pos) {
1590
+ pos = clipPos(pos);
1591
+ var bm = new Bookmark(pos.ch);
1592
+ getLine(pos.line).addMark(bm);
1593
+ return bm;
1594
+ }
1595
+
1596
+ function findMarksAt(pos) {
1597
+ pos = clipPos(pos);
1598
+ var markers = [], marked = getLine(pos.line).marked;
1599
+ if (!marked) return markers;
1600
+ for (var i = 0, e = marked.length; i < e; ++i) {
1601
+ var m = marked[i];
1602
+ if ((m.from == null || m.from <= pos.ch) &&
1603
+ (m.to == null || m.to >= pos.ch))
1604
+ markers.push(m.marker || m);
1605
+ }
1606
+ return markers;
1607
+ }
1608
+
1609
+ function addGutterMarker(line, text, className) {
1610
+ if (typeof line == "number") line = getLine(clipLine(line));
1611
+ line.gutterMarker = {text: text, style: className};
1612
+ gutterDirty = true;
1613
+ return line;
1614
+ }
1615
+ function removeGutterMarker(line) {
1616
+ if (typeof line == "number") line = getLine(clipLine(line));
1617
+ line.gutterMarker = null;
1618
+ gutterDirty = true;
1619
+ }
1620
+
1621
+ function changeLine(handle, op) {
1622
+ var no = handle, line = handle;
1623
+ if (typeof handle == "number") line = getLine(clipLine(handle));
1624
+ else no = lineNo(handle);
1625
+ if (no == null) return null;
1626
+ if (op(line, no)) changes.push({from: no, to: no + 1});
1627
+ else return null;
1628
+ return line;
1629
+ }
1630
+ function setLineClass(handle, className, bgClassName) {
1631
+ return changeLine(handle, function(line) {
1632
+ if (line.className != className || line.bgClassName != bgClassName) {
1633
+ line.className = className;
1634
+ line.bgClassName = bgClassName;
1635
+ return true;
1636
+ }
1637
+ });
1638
+ }
1639
+ function setLineHidden(handle, hidden) {
1640
+ return changeLine(handle, function(line, no) {
1641
+ if (line.hidden != hidden) {
1642
+ line.hidden = hidden;
1643
+ if (!options.lineWrapping) {
1644
+ var l = line.text;
1645
+ if (hidden && l.length == maxLine.length) {
1646
+ updateMaxLine = true;
1647
+ } else if (!hidden && l.length > maxLine.length) {
1648
+ maxLine = l; updateMaxLine = false;
1649
+ }
1650
+ }
1651
+ updateLineHeight(line, hidden ? 0 : 1);
1652
+ var fline = sel.from.line, tline = sel.to.line;
1653
+ if (hidden && (fline == no || tline == no)) {
1654
+ var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;
1655
+ var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;
1656
+ // Can't hide the last visible line, we'd have no place to put the cursor
1657
+ if (!to) return;
1658
+ setSelection(from, to);
1659
+ }
1660
+ return (gutterDirty = true);
1661
+ }
1662
+ });
1663
+ }
1664
+
1665
+ function lineInfo(line) {
1666
+ if (typeof line == "number") {
1667
+ if (!isLine(line)) return null;
1668
+ var n = line;
1669
+ line = getLine(line);
1670
+ if (!line) return null;
1671
+ } else {
1672
+ var n = lineNo(line);
1673
+ if (n == null) return null;
1674
+ }
1675
+ var marker = line.gutterMarker;
1676
+ return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
1677
+ markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};
1678
+ }
1679
+
1680
+ function stringWidth(str) {
1681
+ measure.innerHTML = "<pre><span>x</span></pre>";
1682
+ measure.firstChild.firstChild.firstChild.nodeValue = str;
1683
+ return measure.firstChild.firstChild.offsetWidth || 10;
1684
+ }
1685
+ // These are used to go from pixel positions to character
1686
+ // positions, taking varying character widths into account.
1687
+ function charFromX(line, x) {
1688
+ if (x <= 0) return 0;
1689
+ var lineObj = getLine(line), text = lineObj.text;
1690
+ function getX(len) {
1691
+ return measureLine(lineObj, len).left;
1692
+ }
1693
+ var from = 0, fromX = 0, to = text.length, toX;
1694
+ // Guess a suitable upper bound for our search.
1695
+ var estimated = Math.min(to, Math.ceil(x / charWidth()));
1696
+ for (;;) {
1697
+ var estX = getX(estimated);
1698
+ if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
1699
+ else {toX = estX; to = estimated; break;}
1700
+ }
1701
+ if (x > toX) return to;
1702
+ // Try to guess a suitable lower bound as well.
1703
+ estimated = Math.floor(to * 0.8); estX = getX(estimated);
1704
+ if (estX < x) {from = estimated; fromX = estX;}
1705
+ // Do a binary search between these bounds.
1706
+ for (;;) {
1707
+ if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
1708
+ var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
1709
+ if (middleX > x) {to = middle; toX = middleX;}
1710
+ else {from = middle; fromX = middleX;}
1711
+ }
1712
+ }
1713
+
1714
+ var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16);
1715
+ function measureLine(line, ch) {
1716
+ if (ch == 0) return {top: 0, left: 0};
1717
+ var wbr = options.lineWrapping && ch < line.text.length &&
1718
+ spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));
1719
+ measure.innerHTML = "<pre>" + line.getHTML(makeTab, ch, tempId, wbr) + "</pre>";
1720
+ var elt = document.getElementById(tempId);
1721
+ var top = elt.offsetTop, left = elt.offsetLeft;
1722
+ // Older IEs report zero offsets for spans directly after a wrap
1723
+ if (ie && top == 0 && left == 0) {
1724
+ var backup = document.createElement("span");
1725
+ backup.innerHTML = "x";
1726
+ elt.parentNode.insertBefore(backup, elt.nextSibling);
1727
+ top = backup.offsetTop;
1728
+ }
1729
+ return {top: top, left: left};
1730
+ }
1731
+ function localCoords(pos, inLineWrap) {
1732
+ var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));
1733
+ if (pos.ch == 0) x = 0;
1734
+ else {
1735
+ var sp = measureLine(getLine(pos.line), pos.ch);
1736
+ x = sp.left;
1737
+ if (options.lineWrapping) y += Math.max(0, sp.top);
1738
+ }
1739
+ return {x: x, y: y, yBot: y + lh};
1740
+ }
1741
+ // Coords must be lineSpace-local
1742
+ function coordsChar(x, y) {
1743
+ if (y < 0) y = 0;
1744
+ var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
1745
+ var lineNo = lineAtHeight(doc, heightPos);
1746
+ if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};
1747
+ var lineObj = getLine(lineNo), text = lineObj.text;
1748
+ var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;
1749
+ if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};
1750
+ function getX(len) {
1751
+ var sp = measureLine(lineObj, len);
1752
+ if (tw) {
1753
+ var off = Math.round(sp.top / th);
1754
+ return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);
1755
+ }
1756
+ return sp.left;
1757
+ }
1758
+ var from = 0, fromX = 0, to = text.length, toX;
1759
+ // Guess a suitable upper bound for our search.
1760
+ var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));
1761
+ for (;;) {
1762
+ var estX = getX(estimated);
1763
+ if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
1764
+ else {toX = estX; to = estimated; break;}
1765
+ }
1766
+ if (x > toX) return {line: lineNo, ch: to};
1767
+ // Try to guess a suitable lower bound as well.
1768
+ estimated = Math.floor(to * 0.8); estX = getX(estimated);
1769
+ if (estX < x) {from = estimated; fromX = estX;}
1770
+ // Do a binary search between these bounds.
1771
+ for (;;) {
1772
+ if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};
1773
+ var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
1774
+ if (middleX > x) {to = middle; toX = middleX;}
1775
+ else {from = middle; fromX = middleX;}
1776
+ }
1777
+ }
1778
+ function pageCoords(pos) {
1779
+ var local = localCoords(pos, true), off = eltOffset(lineSpace);
1780
+ return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
1781
+ }
1782
+
1783
+ var cachedHeight, cachedHeightFor, measureText;
1784
+ function textHeight() {
1785
+ if (measureText == null) {
1786
+ measureText = "<pre>";
1787
+ for (var i = 0; i < 49; ++i) measureText += "x<br/>";
1788
+ measureText += "x</pre>";
1789
+ }
1790
+ var offsetHeight = lineDiv.clientHeight;
1791
+ if (offsetHeight == cachedHeightFor) return cachedHeight;
1792
+ cachedHeightFor = offsetHeight;
1793
+ measure.innerHTML = measureText;
1794
+ cachedHeight = measure.firstChild.offsetHeight / 50 || 1;
1795
+ measure.innerHTML = "";
1796
+ return cachedHeight;
1797
+ }
1798
+ var cachedWidth, cachedWidthFor = 0;
1799
+ function charWidth() {
1800
+ if (scroller.clientWidth == cachedWidthFor) return cachedWidth;
1801
+ cachedWidthFor = scroller.clientWidth;
1802
+ return (cachedWidth = stringWidth("x"));
1803
+ }
1804
+ function paddingTop() {return lineSpace.offsetTop;}
1805
+ function paddingLeft() {return lineSpace.offsetLeft;}
1806
+
1807
+ function posFromMouse(e, liberal) {
1808
+ var offW = eltOffset(scroller, true), x, y;
1809
+ // Fails unpredictably on IE[67] when mouse is dragged around quickly.
1810
+ try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
1811
+ // This is a mess of a heuristic to try and determine whether a
1812
+ // scroll-bar was clicked or not, and to return null if one was
1813
+ // (and !liberal).
1814
+ if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
1815
+ return null;
1816
+ var offL = eltOffset(lineSpace, true);
1817
+ return coordsChar(x - offL.left, y - offL.top);
1818
+ }
1819
+ function onContextMenu(e) {
1820
+ var pos = posFromMouse(e), scrollPos = scrollbar.scrollTop;
1821
+ if (!pos || opera) return; // Opera is difficult.
1822
+ if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
1823
+ operation(setCursor)(pos.line, pos.ch);
1824
+
1825
+ var oldCSS = input.style.cssText;
1826
+ inputDiv.style.position = "absolute";
1827
+ input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
1828
+ "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
1829
+ "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
1830
+ leaveInputAlone = true;
1831
+ var val = input.value = getSelection();
1832
+ focusInput();
1833
+ selectInput(input);
1834
+ function rehide() {
1835
+ var newVal = splitLines(input.value).join("\n");
1836
+ if (newVal != val && !options.readOnly) operation(replaceSelection)(newVal, "end");
1837
+ inputDiv.style.position = "relative";
1838
+ input.style.cssText = oldCSS;
1839
+ if (ie_lt9) scrollbar.scrollTop = scrollPos;
1840
+ leaveInputAlone = false;
1841
+ resetInput(true);
1842
+ slowPoll();
1843
+ }
1844
+
1845
+ if (gecko) {
1846
+ e_stop(e);
1847
+ var mouseup = connect(window, "mouseup", function() {
1848
+ mouseup();
1849
+ setTimeout(rehide, 20);
1850
+ }, true);
1851
+ } else {
1852
+ setTimeout(rehide, 50);
1853
+ }
1854
+ }
1855
+
1856
+ // Cursor-blinking
1857
+ function restartBlink() {
1858
+ clearInterval(blinker);
1859
+ var on = true;
1860
+ cursor.style.visibility = "";
1861
+ blinker = setInterval(function() {
1862
+ cursor.style.visibility = (on = !on) ? "" : "hidden";
1863
+ }, 650);
1864
+ }
1865
+
1866
+ var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
1867
+ function matchBrackets(autoclear) {
1868
+ var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;
1869
+ var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
1870
+ if (!match) return;
1871
+ var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
1872
+ for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
1873
+ if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
1874
+
1875
+ var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
1876
+ function scan(line, from, to) {
1877
+ if (!line.text) return;
1878
+ var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
1879
+ for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
1880
+ var text = st[i];
1881
+ if (st[i+1] != style) {pos += d * text.length; continue;}
1882
+ for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
1883
+ if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
1884
+ var match = matching[cur];
1885
+ if (match.charAt(1) == ">" == forward) stack.push(cur);
1886
+ else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
1887
+ else if (!stack.length) return {pos: pos, match: true};
1888
+ }
1889
+ }
1890
+ }
1891
+ }
1892
+ for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {
1893
+ var line = getLine(i), first = i == head.line;
1894
+ var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
1895
+ if (found) break;
1896
+ }
1897
+ if (!found) found = {pos: null, match: false};
1898
+ var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
1899
+ var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
1900
+ two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);
1901
+ var clear = operation(function(){one.clear(); two && two.clear();});
1902
+ if (autoclear) setTimeout(clear, 800);
1903
+ else bracketHighlighted = clear;
1904
+ }
1905
+
1906
+ // Finds the line to start with when starting a parse. Tries to
1907
+ // find a line with a stateAfter, so that it can start with a
1908
+ // valid state. If that fails, it returns the line with the
1909
+ // smallest indentation, which tends to need the least context to
1910
+ // parse correctly.
1911
+ function findStartLine(n) {
1912
+ var minindent, minline;
1913
+ for (var search = n, lim = n - 40; search > lim; --search) {
1914
+ if (search == 0) return 0;
1915
+ var line = getLine(search-1);
1916
+ if (line.stateAfter) return search;
1917
+ var indented = line.indentation(options.tabSize);
1918
+ if (minline == null || minindent > indented) {
1919
+ minline = search - 1;
1920
+ minindent = indented;
1921
+ }
1922
+ }
1923
+ return minline;
1924
+ }
1925
+ function getStateBefore(n) {
1926
+ var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
1927
+ if (!state) state = startState(mode);
1928
+ else state = copyState(mode, state);
1929
+ doc.iter(start, n, function(line) {
1930
+ line.highlight(mode, state, options.tabSize);
1931
+ line.stateAfter = copyState(mode, state);
1932
+ });
1933
+ if (start < n) changes.push({from: start, to: n});
1934
+ if (n < doc.size && !getLine(n).stateAfter) work.push(n);
1935
+ return state;
1936
+ }
1937
+ function highlightLines(start, end) {
1938
+ var state = getStateBefore(start);
1939
+ doc.iter(start, end, function(line) {
1940
+ line.highlight(mode, state, options.tabSize);
1941
+ line.stateAfter = copyState(mode, state);
1942
+ });
1943
+ }
1944
+ function highlightWorker() {
1945
+ var end = +new Date + options.workTime;
1946
+ var foundWork = work.length;
1947
+ while (work.length) {
1948
+ if (!getLine(showingFrom).stateAfter) var task = showingFrom;
1949
+ else var task = work.pop();
1950
+ if (task >= doc.size) continue;
1951
+ var start = findStartLine(task), state = start && getLine(start-1).stateAfter;
1952
+ if (state) state = copyState(mode, state);
1953
+ else state = startState(mode);
1954
+
1955
+ var unchanged = 0, compare = mode.compareStates, realChange = false,
1956
+ i = start, bail = false;
1957
+ doc.iter(i, doc.size, function(line) {
1958
+ var hadState = line.stateAfter;
1959
+ if (+new Date > end) {
1960
+ work.push(i);
1961
+ startWorker(options.workDelay);
1962
+ if (realChange) changes.push({from: task, to: i + 1});
1963
+ return (bail = true);
1964
+ }
1965
+ var changed = line.highlight(mode, state, options.tabSize);
1966
+ if (changed) realChange = true;
1967
+ line.stateAfter = copyState(mode, state);
1968
+ var done = null;
1969
+ if (compare) {
1970
+ var same = hadState && compare(hadState, state);
1971
+ if (same != Pass) done = !!same;
1972
+ }
1973
+ if (done == null) {
1974
+ if (changed !== false || !hadState) unchanged = 0;
1975
+ else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, "")))
1976
+ done = true;
1977
+ }
1978
+ if (done) return true;
1979
+ ++i;
1980
+ });
1981
+ if (bail) return;
1982
+ if (realChange) changes.push({from: task, to: i + 1});
1983
+ }
1984
+ if (foundWork && options.onHighlightComplete)
1985
+ options.onHighlightComplete(instance);
1986
+ }
1987
+ function startWorker(time) {
1988
+ if (!work.length) return;
1989
+ highlight.set(time, operation(highlightWorker));
1990
+ }
1991
+
1992
+ // Operations are used to wrap changes in such a way that each
1993
+ // change won't have to update the cursor and display (which would
1994
+ // be awkward, slow, and error-prone), but instead updates are
1995
+ // batched and then all combined and executed at once.
1996
+ function startOperation() {
1997
+ updateInput = userSelChange = textChanged = null;
1998
+ changes = []; selectionChanged = false; callbacks = [];
1999
+ }
2000
+ function endOperation() {
2001
+ if (updateMaxLine) computeMaxLength();
2002
+ if (maxLineChanged && !options.lineWrapping) {
2003
+ var cursorWidth = widthForcer.offsetWidth, left = stringWidth(maxLine);
2004
+ widthForcer.style.left = left + "px";
2005
+ lineSpace.style.minWidth = (left + cursorWidth) + "px";
2006
+ maxLineChanged = false;
2007
+ }
2008
+ var newScrollPos, updated;
2009
+ if (selectionChanged) {
2010
+ var coords = calculateCursorCoords();
2011
+ newScrollPos = calculateScrollPos(coords.x, coords.y, coords.x, coords.yBot);
2012
+ }
2013
+ if (changes.length) updated = updateDisplay(changes, true, (newScrollPos ? newScrollPos.scrollTop : null));
2014
+ else {
2015
+ if (selectionChanged) updateSelection();
2016
+ if (gutterDirty) updateGutter();
2017
+ }
2018
+ if (newScrollPos) scrollCursorIntoView();
2019
+ if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
2020
+
2021
+ if (focused && !leaveInputAlone &&
2022
+ (updateInput === true || (updateInput !== false && selectionChanged)))
2023
+ resetInput(userSelChange);
2024
+
2025
+ if (selectionChanged && options.matchBrackets)
2026
+ setTimeout(operation(function() {
2027
+ if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
2028
+ if (posEq(sel.from, sel.to)) matchBrackets(false);
2029
+ }), 20);
2030
+ var sc = selectionChanged, cbs = callbacks; // these can be reset by callbacks
2031
+ if (textChanged && options.onChange && instance)
2032
+ options.onChange(instance, textChanged);
2033
+ if (sc && options.onCursorActivity)
2034
+ options.onCursorActivity(instance);
2035
+ for (var i = 0; i < cbs.length; ++i) cbs[i](instance);
2036
+ if (updated && options.onUpdate) options.onUpdate(instance);
2037
+ }
2038
+ var nestedOperation = 0;
2039
+ function operation(f) {
2040
+ return function() {
2041
+ if (!nestedOperation++) startOperation();
2042
+ try {var result = f.apply(this, arguments);}
2043
+ finally {if (!--nestedOperation) endOperation();}
2044
+ return result;
2045
+ };
2046
+ }
2047
+
2048
+ function compoundChange(f) {
2049
+ history.startCompound();
2050
+ try { return f(); } finally { history.endCompound(); }
2051
+ }
2052
+
2053
+ for (var ext in extensions)
2054
+ if (extensions.propertyIsEnumerable(ext) &&
2055
+ !instance.propertyIsEnumerable(ext))
2056
+ instance[ext] = extensions[ext];
2057
+ return instance;
2058
+ } // (end of function CodeMirror)
2059
+
2060
+ // The default configuration options.
2061
+ CodeMirror.defaults = {
2062
+ value: "",
2063
+ mode: null,
2064
+ theme: "default",
2065
+ indentUnit: 2,
2066
+ indentWithTabs: false,
2067
+ smartIndent: true,
2068
+ tabSize: 4,
2069
+ keyMap: "default",
2070
+ extraKeys: null,
2071
+ electricChars: true,
2072
+ autoClearEmptyLines: false,
2073
+ onKeyEvent: null,
2074
+ onDragEvent: null,
2075
+ lineWrapping: false,
2076
+ lineNumbers: false,
2077
+ gutter: false,
2078
+ fixedGutter: false,
2079
+ firstLineNumber: 1,
2080
+ readOnly: false,
2081
+ dragDrop: true,
2082
+ onChange: null,
2083
+ onCursorActivity: null,
2084
+ onGutterClick: null,
2085
+ onHighlightComplete: null,
2086
+ onUpdate: null,
2087
+ onFocus: null, onBlur: null, onScroll: null,
2088
+ matchBrackets: false,
2089
+ workTime: 100,
2090
+ workDelay: 200,
2091
+ pollInterval: 100,
2092
+ undoDepth: 40,
2093
+ tabindex: null,
2094
+ autofocus: null,
2095
+ lineNumberFormatter: function(integer) { return integer; }
2096
+ };
2097
+
2098
+ var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
2099
+ var mac = ios || /Mac/.test(navigator.platform);
2100
+ var win = /Win/.test(navigator.platform);
2101
+
2102
+ // Known modes, by name and by MIME
2103
+ var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
2104
+ CodeMirror.defineMode = function(name, mode) {
2105
+ if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
2106
+ if (arguments.length > 2) {
2107
+ mode.dependencies = [];
2108
+ for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
2109
+ }
2110
+ modes[name] = mode;
2111
+ };
2112
+ CodeMirror.defineMIME = function(mime, spec) {
2113
+ mimeModes[mime] = spec;
2114
+ };
2115
+ CodeMirror.resolveMode = function(spec) {
2116
+ if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
2117
+ spec = mimeModes[spec];
2118
+ else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))
2119
+ return CodeMirror.resolveMode("application/xml");
2120
+ if (typeof spec == "string") return {name: spec};
2121
+ else return spec || {name: "null"};
2122
+ };
2123
+ CodeMirror.getMode = function(options, spec) {
2124
+ var spec = CodeMirror.resolveMode(spec);
2125
+ var mfactory = modes[spec.name];
2126
+ if (!mfactory) return CodeMirror.getMode(options, "text/plain");
2127
+ return mfactory(options, spec);
2128
+ };
2129
+ CodeMirror.listModes = function() {
2130
+ var list = [];
2131
+ for (var m in modes)
2132
+ if (modes.propertyIsEnumerable(m)) list.push(m);
2133
+ return list;
2134
+ };
2135
+ CodeMirror.listMIMEs = function() {
2136
+ var list = [];
2137
+ for (var m in mimeModes)
2138
+ if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});
2139
+ return list;
2140
+ };
2141
+
2142
+ var extensions = CodeMirror.extensions = {};
2143
+ CodeMirror.defineExtension = function(name, func) {
2144
+ extensions[name] = func;
2145
+ };
2146
+
2147
+ var commands = CodeMirror.commands = {
2148
+ selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},
2149
+ killLine: function(cm) {
2150
+ var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
2151
+ if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, {line: from.line + 1, ch: 0});
2152
+ else cm.replaceRange("", from, sel ? to : {line: from.line});
2153
+ },
2154
+ deleteLine: function(cm) {var l = cm.getCursor().line; cm.replaceRange("", {line: l, ch: 0}, {line: l});},
2155
+ undo: function(cm) {cm.undo();},
2156
+ redo: function(cm) {cm.redo();},
2157
+ goDocStart: function(cm) {cm.setCursor(0, 0, true);},
2158
+ goDocEnd: function(cm) {cm.setSelection({line: cm.lineCount() - 1}, null, true);},
2159
+ goLineStart: function(cm) {cm.setCursor(cm.getCursor().line, 0, true);},
2160
+ goLineStartSmart: function(cm) {
2161
+ var cur = cm.getCursor();
2162
+ var text = cm.getLine(cur.line), firstNonWS = Math.max(0, text.search(/\S/));
2163
+ cm.setCursor(cur.line, cur.ch <= firstNonWS && cur.ch ? 0 : firstNonWS, true);
2164
+ },
2165
+ goLineEnd: function(cm) {cm.setSelection({line: cm.getCursor().line}, null, true);},
2166
+ goLineUp: function(cm) {cm.moveV(-1, "line");},
2167
+ goLineDown: function(cm) {cm.moveV(1, "line");},
2168
+ goPageUp: function(cm) {cm.moveV(-1, "page");},
2169
+ goPageDown: function(cm) {cm.moveV(1, "page");},
2170
+ goCharLeft: function(cm) {cm.moveH(-1, "char");},
2171
+ goCharRight: function(cm) {cm.moveH(1, "char");},
2172
+ goColumnLeft: function(cm) {cm.moveH(-1, "column");},
2173
+ goColumnRight: function(cm) {cm.moveH(1, "column");},
2174
+ goWordLeft: function(cm) {cm.moveH(-1, "word");},
2175
+ goWordRight: function(cm) {cm.moveH(1, "word");},
2176
+ delCharLeft: function(cm) {cm.deleteH(-1, "char");},
2177
+ delCharRight: function(cm) {cm.deleteH(1, "char");},
2178
+ delWordLeft: function(cm) {cm.deleteH(-1, "word");},
2179
+ delWordRight: function(cm) {cm.deleteH(1, "word");},
2180
+ indentAuto: function(cm) {cm.indentSelection("smart");},
2181
+ indentMore: function(cm) {cm.indentSelection("add");},
2182
+ indentLess: function(cm) {cm.indentSelection("subtract");},
2183
+ insertTab: function(cm) {cm.replaceSelection("\t", "end");},
2184
+ defaultTab: function(cm) {
2185
+ if (cm.somethingSelected()) cm.indentSelection("add");
2186
+ else cm.replaceSelection("\t", "end");
2187
+ },
2188
+ transposeChars: function(cm) {
2189
+ var cur = cm.getCursor(), line = cm.getLine(cur.line);
2190
+ if (cur.ch > 0 && cur.ch < line.length - 1)
2191
+ cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
2192
+ {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});
2193
+ },
2194
+ newlineAndIndent: function(cm) {
2195
+ cm.replaceSelection("\n", "end");
2196
+ cm.indentLine(cm.getCursor().line);
2197
+ },
2198
+ toggleOverwrite: function(cm) {cm.toggleOverwrite();}
2199
+ };
2200
+
2201
+ var keyMap = CodeMirror.keyMap = {};
2202
+ keyMap.basic = {
2203
+ "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
2204
+ "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
2205
+ "Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "defaultTab", "Shift-Tab": "indentAuto",
2206
+ "Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
2207
+ };
2208
+ // Note that the save and find-related commands aren't defined by
2209
+ // default. Unknown commands are simply ignored.
2210
+ keyMap.pcDefault = {
2211
+ "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
2212
+ "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
2213
+ "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
2214
+ "Ctrl-Backspace": "delWordLeft", "Ctrl-Delete": "delWordRight", "Ctrl-S": "save", "Ctrl-F": "find",
2215
+ "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
2216
+ "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
2217
+ fallthrough: "basic"
2218
+ };
2219
+ keyMap.macDefault = {
2220
+ "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
2221
+ "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft",
2222
+ "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordLeft",
2223
+ "Ctrl-Alt-Backspace": "delWordRight", "Alt-Delete": "delWordRight", "Cmd-S": "save", "Cmd-F": "find",
2224
+ "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
2225
+ "Cmd-[": "indentLess", "Cmd-]": "indentMore",
2226
+ fallthrough: ["basic", "emacsy"]
2227
+ };
2228
+ keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
2229
+ keyMap.emacsy = {
2230
+ "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
2231
+ "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
2232
+ "Ctrl-V": "goPageUp", "Shift-Ctrl-V": "goPageDown", "Ctrl-D": "delCharRight", "Ctrl-H": "delCharLeft",
2233
+ "Alt-D": "delWordRight", "Alt-Backspace": "delWordLeft", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
2234
+ };
2235
+
2236
+ function getKeyMap(val) {
2237
+ if (typeof val == "string") return keyMap[val];
2238
+ else return val;
2239
+ }
2240
+ function lookupKey(name, extraMap, map, handle, stop) {
2241
+ function lookup(map) {
2242
+ map = getKeyMap(map);
2243
+ var found = map[name];
2244
+ if (found != null && handle(found)) return true;
2245
+ if (map.nofallthrough) {
2246
+ if (stop) stop();
2247
+ return true;
2248
+ }
2249
+ var fallthrough = map.fallthrough;
2250
+ if (fallthrough == null) return false;
2251
+ if (Object.prototype.toString.call(fallthrough) != "[object Array]")
2252
+ return lookup(fallthrough);
2253
+ for (var i = 0, e = fallthrough.length; i < e; ++i) {
2254
+ if (lookup(fallthrough[i])) return true;
2255
+ }
2256
+ return false;
2257
+ }
2258
+ if (extraMap && lookup(extraMap)) return true;
2259
+ return lookup(map);
2260
+ }
2261
+ function isModifierKey(event) {
2262
+ var name = keyNames[e_prop(event, "keyCode")];
2263
+ return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
2264
+ }
2265
+
2266
+ CodeMirror.fromTextArea = function(textarea, options) {
2267
+ if (!options) options = {};
2268
+ options.value = textarea.value;
2269
+ if (!options.tabindex && textarea.tabindex)
2270
+ options.tabindex = textarea.tabindex;
2271
+ if (options.autofocus == null && textarea.getAttribute("autofocus") != null)
2272
+ options.autofocus = true;
2273
+
2274
+ function save() {textarea.value = instance.getValue();}
2275
+ if (textarea.form) {
2276
+ // Deplorable hack to make the submit method do the right thing.
2277
+ var rmSubmit = connect(textarea.form, "submit", save, true);
2278
+ if (typeof textarea.form.submit == "function") {
2279
+ var realSubmit = textarea.form.submit;
2280
+ function wrappedSubmit() {
2281
+ save();
2282
+ textarea.form.submit = realSubmit;
2283
+ textarea.form.submit();
2284
+ textarea.form.submit = wrappedSubmit;
2285
+ }
2286
+ textarea.form.submit = wrappedSubmit;
2287
+ }
2288
+ }
2289
+
2290
+ textarea.style.display = "none";
2291
+ var instance = CodeMirror(function(node) {
2292
+ textarea.parentNode.insertBefore(node, textarea.nextSibling);
2293
+ }, options);
2294
+ instance.save = save;
2295
+ instance.getTextArea = function() { return textarea; };
2296
+ instance.toTextArea = function() {
2297
+ save();
2298
+ textarea.parentNode.removeChild(instance.getWrapperElement());
2299
+ textarea.style.display = "";
2300
+ if (textarea.form) {
2301
+ rmSubmit();
2302
+ if (typeof textarea.form.submit == "function")
2303
+ textarea.form.submit = realSubmit;
2304
+ }
2305
+ };
2306
+ return instance;
2307
+ };
2308
+
2309
+ // Utility functions for working with state. Exported because modes
2310
+ // sometimes need to do this.
2311
+ function copyState(mode, state) {
2312
+ if (state === true) return state;
2313
+ if (mode.copyState) return mode.copyState(state);
2314
+ var nstate = {};
2315
+ for (var n in state) {
2316
+ var val = state[n];
2317
+ if (val instanceof Array) val = val.concat([]);
2318
+ nstate[n] = val;
2319
+ }
2320
+ return nstate;
2321
+ }
2322
+ CodeMirror.copyState = copyState;
2323
+ function startState(mode, a1, a2) {
2324
+ return mode.startState ? mode.startState(a1, a2) : true;
2325
+ }
2326
+ CodeMirror.startState = startState;
2327
+
2328
+ // The character stream used by a mode's parser.
2329
+ function StringStream(string, tabSize) {
2330
+ this.pos = this.start = 0;
2331
+ this.string = string;
2332
+ this.tabSize = tabSize || 8;
2333
+ }
2334
+ StringStream.prototype = {
2335
+ eol: function() {return this.pos >= this.string.length;},
2336
+ sol: function() {return this.pos == 0;},
2337
+ peek: function() {return this.string.charAt(this.pos);},
2338
+ next: function() {
2339
+ if (this.pos < this.string.length)
2340
+ return this.string.charAt(this.pos++);
2341
+ },
2342
+ eat: function(match) {
2343
+ var ch = this.string.charAt(this.pos);
2344
+ if (typeof match == "string") var ok = ch == match;
2345
+ else var ok = ch && (match.test ? match.test(ch) : match(ch));
2346
+ if (ok) {++this.pos; return ch;}
2347
+ },
2348
+ eatWhile: function(match) {
2349
+ var start = this.pos;
2350
+ while (this.eat(match)){}
2351
+ return this.pos > start;
2352
+ },
2353
+ eatSpace: function() {
2354
+ var start = this.pos;
2355
+ while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
2356
+ return this.pos > start;
2357
+ },
2358
+ skipToEnd: function() {this.pos = this.string.length;},
2359
+ skipTo: function(ch) {
2360
+ var found = this.string.indexOf(ch, this.pos);
2361
+ if (found > -1) {this.pos = found; return true;}
2362
+ },
2363
+ backUp: function(n) {this.pos -= n;},
2364
+ column: function() {return countColumn(this.string, this.start, this.tabSize);},
2365
+ indentation: function() {return countColumn(this.string, null, this.tabSize);},
2366
+ match: function(pattern, consume, caseInsensitive) {
2367
+ if (typeof pattern == "string") {
2368
+ function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
2369
+ if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
2370
+ if (consume !== false) this.pos += pattern.length;
2371
+ return true;
2372
+ }
2373
+ } else {
2374
+ var match = this.string.slice(this.pos).match(pattern);
2375
+ if (match && consume !== false) this.pos += match[0].length;
2376
+ return match;
2377
+ }
2378
+ },
2379
+ current: function(){return this.string.slice(this.start, this.pos);}
2380
+ };
2381
+ CodeMirror.StringStream = StringStream;
2382
+
2383
+ function MarkedText(from, to, className, marker) {
2384
+ this.from = from; this.to = to; this.style = className; this.marker = marker;
2385
+ }
2386
+ MarkedText.prototype = {
2387
+ attach: function(line) { this.marker.set.push(line); },
2388
+ detach: function(line) {
2389
+ var ix = indexOf(this.marker.set, line);
2390
+ if (ix > -1) this.marker.set.splice(ix, 1);
2391
+ },
2392
+ split: function(pos, lenBefore) {
2393
+ if (this.to <= pos && this.to != null) return null;
2394
+ var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore;
2395
+ var to = this.to == null ? null : this.to - pos + lenBefore;
2396
+ return new MarkedText(from, to, this.style, this.marker);
2397
+ },
2398
+ dup: function() { return new MarkedText(null, null, this.style, this.marker); },
2399
+ clipTo: function(fromOpen, from, toOpen, to, diff) {
2400
+ if (fromOpen && to > this.from && (to < this.to || this.to == null))
2401
+ this.from = null;
2402
+ else if (this.from != null && this.from >= from)
2403
+ this.from = Math.max(to, this.from) + diff;
2404
+ if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null))
2405
+ this.to = null;
2406
+ else if (this.to != null && this.to > from)
2407
+ this.to = to < this.to ? this.to + diff : from;
2408
+ },
2409
+ isDead: function() { return this.from != null && this.to != null && this.from >= this.to; },
2410
+ sameSet: function(x) { return this.marker == x.marker; }
2411
+ };
2412
+
2413
+ function Bookmark(pos) {
2414
+ this.from = pos; this.to = pos; this.line = null;
2415
+ }
2416
+ Bookmark.prototype = {
2417
+ attach: function(line) { this.line = line; },
2418
+ detach: function(line) { if (this.line == line) this.line = null; },
2419
+ split: function(pos, lenBefore) {
2420
+ if (pos < this.from) {
2421
+ this.from = this.to = (this.from - pos) + lenBefore;
2422
+ return this;
2423
+ }
2424
+ },
2425
+ isDead: function() { return this.from > this.to; },
2426
+ clipTo: function(fromOpen, from, toOpen, to, diff) {
2427
+ if ((fromOpen || from < this.from) && (toOpen || to > this.to)) {
2428
+ this.from = 0; this.to = -1;
2429
+ } else if (this.from > from) {
2430
+ this.from = this.to = Math.max(to, this.from) + diff;
2431
+ }
2432
+ },
2433
+ sameSet: function(x) { return false; },
2434
+ find: function() {
2435
+ if (!this.line || !this.line.parent) return null;
2436
+ return {line: lineNo(this.line), ch: this.from};
2437
+ },
2438
+ clear: function() {
2439
+ if (this.line) {
2440
+ var found = indexOf(this.line.marked, this);
2441
+ if (found != -1) this.line.marked.splice(found, 1);
2442
+ this.line = null;
2443
+ }
2444
+ }
2445
+ };
2446
+
2447
+ // Line objects. These hold state related to a line, including
2448
+ // highlighting info (the styles array).
2449
+ function Line(text, styles) {
2450
+ this.styles = styles || [text, null];
2451
+ this.text = text;
2452
+ this.height = 1;
2453
+ this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null;
2454
+ this.stateAfter = this.parent = this.hidden = null;
2455
+ }
2456
+ Line.inheritMarks = function(text, orig) {
2457
+ var ln = new Line(text), mk = orig && orig.marked;
2458
+ if (mk) {
2459
+ for (var i = 0; i < mk.length; ++i) {
2460
+ if (mk[i].to == null && mk[i].style) {
2461
+ var newmk = ln.marked || (ln.marked = []), mark = mk[i];
2462
+ var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln);
2463
+ }
2464
+ }
2465
+ }
2466
+ return ln;
2467
+ }
2468
+ Line.prototype = {
2469
+ // Replace a piece of a line, keeping the styles around it intact.
2470
+ replace: function(from, to_, text) {
2471
+ var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_;
2472
+ copyStyles(0, from, this.styles, st);
2473
+ if (text) st.push(text, null);
2474
+ copyStyles(to, this.text.length, this.styles, st);
2475
+ this.styles = st;
2476
+ this.text = this.text.slice(0, from) + text + this.text.slice(to);
2477
+ this.stateAfter = null;
2478
+ if (mk) {
2479
+ var diff = text.length - (to - from);
2480
+ for (var i = 0; i < mk.length; ++i) {
2481
+ var mark = mk[i];
2482
+ mark.clipTo(from == null, from || 0, to_ == null, to, diff);
2483
+ if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);}
2484
+ }
2485
+ }
2486
+ },
2487
+ // Split a part off a line, keeping styles and markers intact.
2488
+ split: function(pos, textBefore) {
2489
+ var st = [textBefore, null], mk = this.marked;
2490
+ copyStyles(pos, this.text.length, this.styles, st);
2491
+ var taken = new Line(textBefore + this.text.slice(pos), st);
2492
+ if (mk) {
2493
+ for (var i = 0; i < mk.length; ++i) {
2494
+ var mark = mk[i];
2495
+ var newmark = mark.split(pos, textBefore.length);
2496
+ if (newmark) {
2497
+ if (!taken.marked) taken.marked = [];
2498
+ taken.marked.push(newmark); newmark.attach(taken);
2499
+ if (newmark == mark) mk.splice(i--, 1);
2500
+ }
2501
+ }
2502
+ }
2503
+ return taken;
2504
+ },
2505
+ append: function(line) {
2506
+ var mylen = this.text.length, mk = line.marked, mymk = this.marked;
2507
+ this.text += line.text;
2508
+ copyStyles(0, line.text.length, line.styles, this.styles);
2509
+ if (mymk) {
2510
+ for (var i = 0; i < mymk.length; ++i)
2511
+ if (mymk[i].to == null) mymk[i].to = mylen;
2512
+ }
2513
+ if (mk && mk.length) {
2514
+ if (!mymk) this.marked = mymk = [];
2515
+ outer: for (var i = 0; i < mk.length; ++i) {
2516
+ var mark = mk[i];
2517
+ if (!mark.from) {
2518
+ for (var j = 0; j < mymk.length; ++j) {
2519
+ var mymark = mymk[j];
2520
+ if (mymark.to == mylen && mymark.sameSet(mark)) {
2521
+ mymark.to = mark.to == null ? null : mark.to + mylen;
2522
+ if (mymark.isDead()) {
2523
+ mymark.detach(this);
2524
+ mk.splice(i--, 1);
2525
+ }
2526
+ continue outer;
2527
+ }
2528
+ }
2529
+ }
2530
+ mymk.push(mark);
2531
+ mark.attach(this);
2532
+ mark.from += mylen;
2533
+ if (mark.to != null) mark.to += mylen;
2534
+ }
2535
+ }
2536
+ },
2537
+ fixMarkEnds: function(other) {
2538
+ var mk = this.marked, omk = other.marked;
2539
+ if (!mk) return;
2540
+ outer: for (var i = 0; i < mk.length; ++i) {
2541
+ var mark = mk[i], close = mark.to == null;
2542
+ if (close && omk) {
2543
+ for (var j = 0; j < omk.length; ++j) {
2544
+ var om = omk[j];
2545
+ if (!om.sameSet(mark) || om.from != null) continue
2546
+ if (mark.from == this.text.length && om.to == 0) {
2547
+ omk.splice(j, 1);
2548
+ mk.splice(i--, 1);
2549
+ continue outer;
2550
+ } else {
2551
+ close = false; break;
2552
+ }
2553
+ }
2554
+ }
2555
+ if (close) mark.to = this.text.length;
2556
+ }
2557
+ },
2558
+ fixMarkStarts: function() {
2559
+ var mk = this.marked;
2560
+ if (!mk) return;
2561
+ for (var i = 0; i < mk.length; ++i)
2562
+ if (mk[i].from == null) mk[i].from = 0;
2563
+ },
2564
+ addMark: function(mark) {
2565
+ mark.attach(this);
2566
+ if (this.marked == null) this.marked = [];
2567
+ this.marked.push(mark);
2568
+ this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);});
2569
+ },
2570
+ // Run the given mode's parser over a line, update the styles
2571
+ // array, which contains alternating fragments of text and CSS
2572
+ // classes.
2573
+ highlight: function(mode, state, tabSize) {
2574
+ var stream = new StringStream(this.text, tabSize), st = this.styles, pos = 0;
2575
+ var changed = false, curWord = st[0], prevWord;
2576
+ if (this.text == "" && mode.blankLine) mode.blankLine(state);
2577
+ while (!stream.eol()) {
2578
+ var style = mode.token(stream, state);
2579
+ var substr = this.text.slice(stream.start, stream.pos);
2580
+ stream.start = stream.pos;
2581
+ if (pos && st[pos-1] == style)
2582
+ st[pos-2] += substr;
2583
+ else if (substr) {
2584
+ if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;
2585
+ st[pos++] = substr; st[pos++] = style;
2586
+ prevWord = curWord; curWord = st[pos];
2587
+ }
2588
+ // Give up when line is ridiculously long
2589
+ if (stream.pos > 5000) {
2590
+ st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
2591
+ break;
2592
+ }
2593
+ }
2594
+ if (st.length != pos) {st.length = pos; changed = true;}
2595
+ if (pos && st[pos-2] != prevWord) changed = true;
2596
+ // Short lines with simple highlights return null, and are
2597
+ // counted as changed by the driver because they are likely to
2598
+ // highlight the same way in various contexts.
2599
+ return changed || (st.length < 5 && this.text.length < 10 ? null : false);
2600
+ },
2601
+ // Fetch the parser token for a given character. Useful for hacks
2602
+ // that want to inspect the mode state (say, for completion).
2603
+ getTokenAt: function(mode, state, ch) {
2604
+ var txt = this.text, stream = new StringStream(txt);
2605
+ while (stream.pos < ch && !stream.eol()) {
2606
+ stream.start = stream.pos;
2607
+ var style = mode.token(stream, state);
2608
+ }
2609
+ return {start: stream.start,
2610
+ end: stream.pos,
2611
+ string: stream.current(),
2612
+ className: style || null,
2613
+ state: state};
2614
+ },
2615
+ indentation: function(tabSize) {return countColumn(this.text, null, tabSize);},
2616
+ // Produces an HTML fragment for the line, taking selection,
2617
+ // marking, and highlighting into account.
2618
+ getHTML: function(makeTab, wrapAt, wrapId, wrapWBR) {
2619
+ var html = [], first = true, col = 0;
2620
+ function span_(text, style) {
2621
+ if (!text) return;
2622
+ // Work around a bug where, in some compat modes, IE ignores leading spaces
2623
+ if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1);
2624
+ first = false;
2625
+ if (text.indexOf("\t") == -1) {
2626
+ col += text.length;
2627
+ var escaped = htmlEscape(text);
2628
+ } else {
2629
+ var escaped = "";
2630
+ for (var pos = 0;;) {
2631
+ var idx = text.indexOf("\t", pos);
2632
+ if (idx == -1) {
2633
+ escaped += htmlEscape(text.slice(pos));
2634
+ col += text.length - pos;
2635
+ break;
2636
+ } else {
2637
+ col += idx - pos;
2638
+ var tab = makeTab(col);
2639
+ escaped += htmlEscape(text.slice(pos, idx)) + tab.html;
2640
+ col += tab.width;
2641
+ pos = idx + 1;
2642
+ }
2643
+ }
2644
+ }
2645
+ if (style) html.push('<span class="', style, '">', escaped, "</span>");
2646
+ else html.push(escaped);
2647
+ }
2648
+ var span = span_;
2649
+ if (wrapAt != null) {
2650
+ var outPos = 0, open = "<span id=\"" + wrapId + "\">";
2651
+ span = function(text, style) {
2652
+ var l = text.length;
2653
+ if (wrapAt >= outPos && wrapAt < outPos + l) {
2654
+ if (wrapAt > outPos) {
2655
+ span_(text.slice(0, wrapAt - outPos), style);
2656
+ // See comment at the definition of spanAffectsWrapping
2657
+ if (wrapWBR) html.push("<wbr>");
2658
+ }
2659
+ html.push(open);
2660
+ var cut = wrapAt - outPos;
2661
+ span_(opera ? text.slice(cut, cut + 1) : text.slice(cut), style);
2662
+ html.push("</span>");
2663
+ if (opera) span_(text.slice(cut + 1), style);
2664
+ wrapAt--;
2665
+ outPos += l;
2666
+ } else {
2667
+ outPos += l;
2668
+ span_(text, style);
2669
+ // Output empty wrapper when at end of line
2670
+ // (Gecko and IE8+ do strange wrapping when adding a space
2671
+ // to the end of the line. Other browsers don't react well
2672
+ // to zero-width spaces. So we do hideous browser sniffing
2673
+ // to determine which to use.)
2674
+ if (outPos == wrapAt && outPos == len)
2675
+ html.push(open + (gecko || (ie && !ie_lt8) ? "&#x200b;" : " ") + "</span>");
2676
+ // Stop outputting HTML when gone sufficiently far beyond measure
2677
+ else if (outPos > wrapAt + 10 && /\s/.test(text)) span = function(){};
2678
+ }
2679
+ }
2680
+ }
2681
+
2682
+ var st = this.styles, allText = this.text, marked = this.marked;
2683
+ var len = allText.length;
2684
+ function styleToClass(style) {
2685
+ if (!style) return null;
2686
+ return "cm-" + style.replace(/ +/g, " cm-");
2687
+ }
2688
+
2689
+ if (!allText && wrapAt == null) {
2690
+ span(" ");
2691
+ } else if (!marked || !marked.length) {
2692
+ for (var i = 0, ch = 0; ch < len; i+=2) {
2693
+ var str = st[i], style = st[i+1], l = str.length;
2694
+ if (ch + l > len) str = str.slice(0, len - ch);
2695
+ ch += l;
2696
+ span(str, styleToClass(style));
2697
+ }
2698
+ } else {
2699
+ var pos = 0, i = 0, text = "", style, sg = 0;
2700
+ var nextChange = marked[0].from || 0, marks = [], markpos = 0;
2701
+ function advanceMarks() {
2702
+ var m;
2703
+ while (markpos < marked.length &&
2704
+ ((m = marked[markpos]).from == pos || m.from == null)) {
2705
+ if (m.style != null) marks.push(m);
2706
+ ++markpos;
2707
+ }
2708
+ nextChange = markpos < marked.length ? marked[markpos].from : Infinity;
2709
+ for (var i = 0; i < marks.length; ++i) {
2710
+ var to = marks[i].to;
2711
+ if (to == null) to = Infinity;
2712
+ if (to == pos) marks.splice(i--, 1);
2713
+ else nextChange = Math.min(to, nextChange);
2714
+ }
2715
+ }
2716
+ var m = 0;
2717
+ while (pos < len) {
2718
+ if (nextChange == pos) advanceMarks();
2719
+ var upto = Math.min(len, nextChange);
2720
+ while (true) {
2721
+ if (text) {
2722
+ var end = pos + text.length;
2723
+ var appliedStyle = style;
2724
+ for (var j = 0; j < marks.length; ++j)
2725
+ appliedStyle = (appliedStyle ? appliedStyle + " " : "") + marks[j].style;
2726
+ span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);
2727
+ if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
2728
+ pos = end;
2729
+ }
2730
+ text = st[i++]; style = styleToClass(st[i++]);
2731
+ }
2732
+ }
2733
+ }
2734
+ return html.join("");
2735
+ },
2736
+ cleanUp: function() {
2737
+ this.parent = null;
2738
+ if (this.marked)
2739
+ for (var i = 0, e = this.marked.length; i < e; ++i) this.marked[i].detach(this);
2740
+ }
2741
+ };
2742
+ // Utility used by replace and split above
2743
+ function copyStyles(from, to, source, dest) {
2744
+ for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
2745
+ var part = source[i], end = pos + part.length;
2746
+ if (state == 0) {
2747
+ if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
2748
+ if (end >= from) state = 1;
2749
+ } else if (state == 1) {
2750
+ if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
2751
+ else dest.push(part, source[i+1]);
2752
+ }
2753
+ pos = end;
2754
+ }
2755
+ }
2756
+
2757
+ // Data structure that holds the sequence of lines.
2758
+ function LeafChunk(lines) {
2759
+ this.lines = lines;
2760
+ this.parent = null;
2761
+ for (var i = 0, e = lines.length, height = 0; i < e; ++i) {
2762
+ lines[i].parent = this;
2763
+ height += lines[i].height;
2764
+ }
2765
+ this.height = height;
2766
+ }
2767
+ LeafChunk.prototype = {
2768
+ chunkSize: function() { return this.lines.length; },
2769
+ remove: function(at, n, callbacks) {
2770
+ for (var i = at, e = at + n; i < e; ++i) {
2771
+ var line = this.lines[i];
2772
+ this.height -= line.height;
2773
+ line.cleanUp();
2774
+ if (line.handlers)
2775
+ for (var j = 0; j < line.handlers.length; ++j) callbacks.push(line.handlers[j]);
2776
+ }
2777
+ this.lines.splice(at, n);
2778
+ },
2779
+ collapse: function(lines) {
2780
+ lines.splice.apply(lines, [lines.length, 0].concat(this.lines));
2781
+ },
2782
+ insertHeight: function(at, lines, height) {
2783
+ this.height += height;
2784
+ this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
2785
+ for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
2786
+ },
2787
+ iterN: function(at, n, op) {
2788
+ for (var e = at + n; at < e; ++at)
2789
+ if (op(this.lines[at])) return true;
2790
+ }
2791
+ };
2792
+ function BranchChunk(children) {
2793
+ this.children = children;
2794
+ var size = 0, height = 0;
2795
+ for (var i = 0, e = children.length; i < e; ++i) {
2796
+ var ch = children[i];
2797
+ size += ch.chunkSize(); height += ch.height;
2798
+ ch.parent = this;
2799
+ }
2800
+ this.size = size;
2801
+ this.height = height;
2802
+ this.parent = null;
2803
+ }
2804
+ BranchChunk.prototype = {
2805
+ chunkSize: function() { return this.size; },
2806
+ remove: function(at, n, callbacks) {
2807
+ this.size -= n;
2808
+ for (var i = 0; i < this.children.length; ++i) {
2809
+ var child = this.children[i], sz = child.chunkSize();
2810
+ if (at < sz) {
2811
+ var rm = Math.min(n, sz - at), oldHeight = child.height;
2812
+ child.remove(at, rm, callbacks);
2813
+ this.height -= oldHeight - child.height;
2814
+ if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
2815
+ if ((n -= rm) == 0) break;
2816
+ at = 0;
2817
+ } else at -= sz;
2818
+ }
2819
+ if (this.size - n < 25) {
2820
+ var lines = [];
2821
+ this.collapse(lines);
2822
+ this.children = [new LeafChunk(lines)];
2823
+ this.children[0].parent = this;
2824
+ }
2825
+ },
2826
+ collapse: function(lines) {
2827
+ for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);
2828
+ },
2829
+ insert: function(at, lines) {
2830
+ var height = 0;
2831
+ for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
2832
+ this.insertHeight(at, lines, height);
2833
+ },
2834
+ insertHeight: function(at, lines, height) {
2835
+ this.size += lines.length;
2836
+ this.height += height;
2837
+ for (var i = 0, e = this.children.length; i < e; ++i) {
2838
+ var child = this.children[i], sz = child.chunkSize();
2839
+ if (at <= sz) {
2840
+ child.insertHeight(at, lines, height);
2841
+ if (child.lines && child.lines.length > 50) {
2842
+ while (child.lines.length > 50) {
2843
+ var spilled = child.lines.splice(child.lines.length - 25, 25);
2844
+ var newleaf = new LeafChunk(spilled);
2845
+ child.height -= newleaf.height;
2846
+ this.children.splice(i + 1, 0, newleaf);
2847
+ newleaf.parent = this;
2848
+ }
2849
+ this.maybeSpill();
2850
+ }
2851
+ break;
2852
+ }
2853
+ at -= sz;
2854
+ }
2855
+ },
2856
+ maybeSpill: function() {
2857
+ if (this.children.length <= 10) return;
2858
+ var me = this;
2859
+ do {
2860
+ var spilled = me.children.splice(me.children.length - 5, 5);
2861
+ var sibling = new BranchChunk(spilled);
2862
+ if (!me.parent) { // Become the parent node
2863
+ var copy = new BranchChunk(me.children);
2864
+ copy.parent = me;
2865
+ me.children = [copy, sibling];
2866
+ me = copy;
2867
+ } else {
2868
+ me.size -= sibling.size;
2869
+ me.height -= sibling.height;
2870
+ var myIndex = indexOf(me.parent.children, me);
2871
+ me.parent.children.splice(myIndex + 1, 0, sibling);
2872
+ }
2873
+ sibling.parent = me.parent;
2874
+ } while (me.children.length > 10);
2875
+ me.parent.maybeSpill();
2876
+ },
2877
+ iter: function(from, to, op) { this.iterN(from, to - from, op); },
2878
+ iterN: function(at, n, op) {
2879
+ for (var i = 0, e = this.children.length; i < e; ++i) {
2880
+ var child = this.children[i], sz = child.chunkSize();
2881
+ if (at < sz) {
2882
+ var used = Math.min(n, sz - at);
2883
+ if (child.iterN(at, used, op)) return true;
2884
+ if ((n -= used) == 0) break;
2885
+ at = 0;
2886
+ } else at -= sz;
2887
+ }
2888
+ }
2889
+ };
2890
+
2891
+ function getLineAt(chunk, n) {
2892
+ while (!chunk.lines) {
2893
+ for (var i = 0;; ++i) {
2894
+ var child = chunk.children[i], sz = child.chunkSize();
2895
+ if (n < sz) { chunk = child; break; }
2896
+ n -= sz;
2897
+ }
2898
+ }
2899
+ return chunk.lines[n];
2900
+ }
2901
+ function lineNo(line) {
2902
+ if (line.parent == null) return null;
2903
+ var cur = line.parent, no = indexOf(cur.lines, line);
2904
+ for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
2905
+ for (var i = 0, e = chunk.children.length; ; ++i) {
2906
+ if (chunk.children[i] == cur) break;
2907
+ no += chunk.children[i].chunkSize();
2908
+ }
2909
+ }
2910
+ return no;
2911
+ }
2912
+ function lineAtHeight(chunk, h) {
2913
+ var n = 0;
2914
+ outer: do {
2915
+ for (var i = 0, e = chunk.children.length; i < e; ++i) {
2916
+ var child = chunk.children[i], ch = child.height;
2917
+ if (h < ch) { chunk = child; continue outer; }
2918
+ h -= ch;
2919
+ n += child.chunkSize();
2920
+ }
2921
+ return n;
2922
+ } while (!chunk.lines);
2923
+ for (var i = 0, e = chunk.lines.length; i < e; ++i) {
2924
+ var line = chunk.lines[i], lh = line.height;
2925
+ if (h < lh) break;
2926
+ h -= lh;
2927
+ }
2928
+ return n + i;
2929
+ }
2930
+ function heightAtLine(chunk, n) {
2931
+ var h = 0;
2932
+ outer: do {
2933
+ for (var i = 0, e = chunk.children.length; i < e; ++i) {
2934
+ var child = chunk.children[i], sz = child.chunkSize();
2935
+ if (n < sz) { chunk = child; continue outer; }
2936
+ n -= sz;
2937
+ h += child.height;
2938
+ }
2939
+ return h;
2940
+ } while (!chunk.lines);
2941
+ for (var i = 0; i < n; ++i) h += chunk.lines[i].height;
2942
+ return h;
2943
+ }
2944
+
2945
+ // The history object 'chunks' changes that are made close together
2946
+ // and at almost the same time into bigger undoable units.
2947
+ function History() {
2948
+ this.time = 0;
2949
+ this.done = []; this.undone = [];
2950
+ this.compound = 0;
2951
+ this.closed = false;
2952
+ }
2953
+ History.prototype = {
2954
+ addChange: function(start, added, old) {
2955
+ this.undone.length = 0;
2956
+ var time = +new Date, cur = this.done[this.done.length - 1], last = cur && cur[cur.length - 1];
2957
+ var dtime = time - this.time;
2958
+
2959
+ if (this.compound && cur && !this.closed) {
2960
+ cur.push({start: start, added: added, old: old});
2961
+ } else if (dtime > 400 || !last || this.closed ||
2962
+ last.start > start + old.length || last.start + last.added < start) {
2963
+ this.done.push([{start: start, added: added, old: old}]);
2964
+ this.closed = false;
2965
+ } else {
2966
+ var startBefore = Math.max(0, last.start - start),
2967
+ endAfter = Math.max(0, (start + old.length) - (last.start + last.added));
2968
+ for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]);
2969
+ for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]);
2970
+ if (startBefore) last.start = start;
2971
+ last.added += added - (old.length - startBefore - endAfter);
2972
+ }
2973
+ this.time = time;
2974
+ },
2975
+ startCompound: function() {
2976
+ if (!this.compound++) this.closed = true;
2977
+ },
2978
+ endCompound: function() {
2979
+ if (!--this.compound) this.closed = true;
2980
+ }
2981
+ };
2982
+
2983
+ function stopMethod() {e_stop(this);}
2984
+ // Ensure an event has a stop method.
2985
+ function addStop(event) {
2986
+ if (!event.stop) event.stop = stopMethod;
2987
+ return event;
2988
+ }
2989
+
2990
+ function e_preventDefault(e) {
2991
+ if (e.preventDefault) e.preventDefault();
2992
+ else e.returnValue = false;
2993
+ }
2994
+ function e_stopPropagation(e) {
2995
+ if (e.stopPropagation) e.stopPropagation();
2996
+ else e.cancelBubble = true;
2997
+ }
2998
+ function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
2999
+ CodeMirror.e_stop = e_stop;
3000
+ CodeMirror.e_preventDefault = e_preventDefault;
3001
+ CodeMirror.e_stopPropagation = e_stopPropagation;
3002
+
3003
+ function e_target(e) {return e.target || e.srcElement;}
3004
+ function e_button(e) {
3005
+ var b = e.which;
3006
+ if (b == null) {
3007
+ if (e.button & 1) b = 1;
3008
+ else if (e.button & 2) b = 3;
3009
+ else if (e.button & 4) b = 2;
3010
+ }
3011
+ if (mac && e.ctrlKey && b == 1) b = 3;
3012
+ return b;
3013
+ }
3014
+
3015
+ // Allow 3rd-party code to override event properties by adding an override
3016
+ // object to an event object.
3017
+ function e_prop(e, prop) {
3018
+ var overridden = e.override && e.override.hasOwnProperty(prop);
3019
+ return overridden ? e.override[prop] : e[prop];
3020
+ }
3021
+
3022
+ // Event handler registration. If disconnect is true, it'll return a
3023
+ // function that unregisters the handler.
3024
+ function connect(node, type, handler, disconnect) {
3025
+ if (typeof node.addEventListener == "function") {
3026
+ node.addEventListener(type, handler, false);
3027
+ if (disconnect) return function() {node.removeEventListener(type, handler, false);};
3028
+ } else {
3029
+ var wrapHandler = function(event) {handler(event || window.event);};
3030
+ node.attachEvent("on" + type, wrapHandler);
3031
+ if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
3032
+ }
3033
+ }
3034
+ CodeMirror.connect = connect;
3035
+
3036
+ function Delayed() {this.id = null;}
3037
+ Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
3038
+
3039
+ var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
3040
+
3041
+ var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
3042
+ var ie = /MSIE \d/.test(navigator.userAgent);
3043
+ var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
3044
+ var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
3045
+ var quirksMode = ie && document.documentMode == 5;
3046
+ var webkit = /WebKit\//.test(navigator.userAgent);
3047
+ var chrome = /Chrome\//.test(navigator.userAgent);
3048
+ var opera = /Opera\//.test(navigator.userAgent);
3049
+ var safari = /Apple Computer/.test(navigator.vendor);
3050
+ var khtml = /KHTML\//.test(navigator.userAgent);
3051
+ var mac_geLion = /Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);
3052
+
3053
+ // Detect drag-and-drop
3054
+ var dragAndDrop = function() {
3055
+ // There is *some* kind of drag-and-drop support in IE6-8, but I
3056
+ // couldn't get it to work yet.
3057
+ if (ie_lt9) return false;
3058
+ var div = document.createElement('div');
3059
+ return "draggable" in div || "dragDrop" in div;
3060
+ }();
3061
+
3062
+ // Feature-detect whether newlines in textareas are converted to \r\n
3063
+ var lineSep = function () {
3064
+ var te = document.createElement("textarea");
3065
+ te.value = "foo\nbar";
3066
+ if (te.value.indexOf("\r") > -1) return "\r\n";
3067
+ return "\n";
3068
+ }();
3069
+
3070
+ // For a reason I have yet to figure out, some browsers disallow
3071
+ // word wrapping between certain characters *only* if a new inline
3072
+ // element is started between them. This makes it hard to reliably
3073
+ // measure the position of things, since that requires inserting an
3074
+ // extra span. This terribly fragile set of regexps matches the
3075
+ // character combinations that suffer from this phenomenon on the
3076
+ // various browsers.
3077
+ var spanAffectsWrapping = /^$/; // Won't match any two-character string
3078
+ if (gecko) spanAffectsWrapping = /$'/;
3079
+ else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;
3080
+ else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/;
3081
+
3082
+ // Counts the column offset in a string, taking tabs into account.
3083
+ // Used mostly to find indentation.
3084
+ function countColumn(string, end, tabSize) {
3085
+ if (end == null) {
3086
+ end = string.search(/[^\s\u00a0]/);
3087
+ if (end == -1) end = string.length;
3088
+ }
3089
+ for (var i = 0, n = 0; i < end; ++i) {
3090
+ if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
3091
+ else ++n;
3092
+ }
3093
+ return n;
3094
+ }
3095
+
3096
+ function computedStyle(elt) {
3097
+ if (elt.currentStyle) return elt.currentStyle;
3098
+ return window.getComputedStyle(elt, null);
3099
+ }
3100
+
3101
+ function eltOffset(node, screen) {
3102
+ // Take the parts of bounding client rect that we are interested in so we are able to edit if need be,
3103
+ // since the returned value cannot be changed externally (they are kept in sync as the element moves within the page)
3104
+ try { var box = node.getBoundingClientRect(); box = { top: box.top, left: box.left }; }
3105
+ catch(e) { box = {top: 0, left: 0}; }
3106
+ if (!screen) {
3107
+ // Get the toplevel scroll, working around browser differences.
3108
+ if (window.pageYOffset == null) {
3109
+ var t = document.documentElement || document.body.parentNode;
3110
+ if (t.scrollTop == null) t = document.body;
3111
+ box.top += t.scrollTop; box.left += t.scrollLeft;
3112
+ } else {
3113
+ box.top += window.pageYOffset; box.left += window.pageXOffset;
3114
+ }
3115
+ }
3116
+ return box;
3117
+ }
3118
+
3119
+ // Get a node's text content.
3120
+ function eltText(node) {
3121
+ return node.textContent || node.innerText || node.nodeValue || "";
3122
+ }
3123
+ function selectInput(node) {
3124
+ if (ios) { // Mobile Safari apparently has a bug where select() is broken.
3125
+ node.selectionStart = 0;
3126
+ node.selectionEnd = node.value.length;
3127
+ } else node.select();
3128
+ }
3129
+
3130
+ // Operations on {line, ch} objects.
3131
+ function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
3132
+ function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
3133
+ function copyPos(x) {return {line: x.line, ch: x.ch};}
3134
+
3135
+ var escapeElement = document.createElement("pre");
3136
+ function htmlEscape(str) {
3137
+ escapeElement.textContent = str;
3138
+ return escapeElement.innerHTML;
3139
+ }
3140
+ // Recent (late 2011) Opera betas insert bogus newlines at the start
3141
+ // of the textContent, so we strip those.
3142
+ if (htmlEscape("a") == "\na") {
3143
+ htmlEscape = function(str) {
3144
+ escapeElement.textContent = str;
3145
+ return escapeElement.innerHTML.slice(1);
3146
+ };
3147
+ // Some IEs don't preserve tabs through innerHTML
3148
+ } else if (htmlEscape("\t") != "\t") {
3149
+ htmlEscape = function(str) {
3150
+ escapeElement.innerHTML = "";
3151
+ escapeElement.appendChild(document.createTextNode(str));
3152
+ return escapeElement.innerHTML;
3153
+ };
3154
+ }
3155
+ CodeMirror.htmlEscape = htmlEscape;
3156
+
3157
+ // Used to position the cursor after an undo/redo by finding the
3158
+ // last edited character.
3159
+ function editEnd(from, to) {
3160
+ if (!to) return 0;
3161
+ if (!from) return to.length;
3162
+ for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
3163
+ if (from.charAt(i) != to.charAt(j)) break;
3164
+ return j + 1;
3165
+ }
3166
+
3167
+ function indexOf(collection, elt) {
3168
+ if (collection.indexOf) return collection.indexOf(elt);
3169
+ for (var i = 0, e = collection.length; i < e; ++i)
3170
+ if (collection[i] == elt) return i;
3171
+ return -1;
3172
+ }
3173
+ function isWordChar(ch) {
3174
+ return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase();
3175
+ }
3176
+
3177
+ // See if "".split is the broken IE version, if so, provide an
3178
+ // alternative way to split lines.
3179
+ var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
3180
+ var pos = 0, result = [], l = string.length;
3181
+ while (pos <= l) {
3182
+ var nl = string.indexOf("\n", pos);
3183
+ if (nl == -1) nl = string.length;
3184
+ var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
3185
+ var rt = line.indexOf("\r");
3186
+ if (rt != -1) {
3187
+ result.push(line.slice(0, rt));
3188
+ pos += rt + 1;
3189
+ } else {
3190
+ result.push(line);
3191
+ pos = nl + 1;
3192
+ }
3193
+ }
3194
+ return result;
3195
+ } : function(string){return string.split(/\r\n?|\n/);};
3196
+ CodeMirror.splitLines = splitLines;
3197
+
3198
+ var hasSelection = window.getSelection ? function(te) {
3199
+ try { return te.selectionStart != te.selectionEnd; }
3200
+ catch(e) { return false; }
3201
+ } : function(te) {
3202
+ try {var range = te.ownerDocument.selection.createRange();}
3203
+ catch(e) {}
3204
+ if (!range || range.parentElement() != te) return false;
3205
+ return range.compareEndPoints("StartToEnd", range) != 0;
3206
+ };
3207
+
3208
+ CodeMirror.defineMode("null", function() {
3209
+ return {token: function(stream) {stream.skipToEnd();}};
3210
+ });
3211
+ CodeMirror.defineMIME("text/plain", "null");
3212
+
3213
+ var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
3214
+ 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
3215
+ 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
3216
+ 46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete",
3217
+ 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
3218
+ 221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home",
3219
+ 63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"};
3220
+ CodeMirror.keyNames = keyNames;
3221
+ (function() {
3222
+ // Number keys
3223
+ for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i);
3224
+ // Alphabetic keys
3225
+ for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
3226
+ // Function keys
3227
+ for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
3228
+ })();
3229
+
3230
+ return CodeMirror;
3231
+ })();
js/css.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CodeMirror.defineMode("css", function(config) {
2
+ var indentUnit = config.indentUnit, type;
3
+ function ret(style, tp) {type = tp; return style;}
4
+
5
+ function tokenBase(stream, state) {
6
+ var ch = stream.next();
7
+ if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
8
+ else if (ch == "/" && stream.eat("*")) {
9
+ state.tokenize = tokenCComment;
10
+ return tokenCComment(stream, state);
11
+ }
12
+ else if (ch == "<" && stream.eat("!")) {
13
+ state.tokenize = tokenSGMLComment;
14
+ return tokenSGMLComment(stream, state);
15
+ }
16
+ else if (ch == "=") ret(null, "compare");
17
+ else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
18
+ else if (ch == "\"" || ch == "'") {
19
+ state.tokenize = tokenString(ch);
20
+ return state.tokenize(stream, state);
21
+ }
22
+ else if (ch == "#") {
23
+ stream.eatWhile(/[\w\\\-]/);
24
+ return ret("atom", "hash");
25
+ }
26
+ else if (ch == "!") {
27
+ stream.match(/^\s*\w*/);
28
+ return ret("keyword", "important");
29
+ }
30
+ else if (/\d/.test(ch)) {
31
+ stream.eatWhile(/[\w.%]/);
32
+ return ret("number", "unit");
33
+ }
34
+ else if (/[,.+>*\/]/.test(ch)) {
35
+ return ret(null, "select-op");
36
+ }
37
+ else if (/[;{}:\[\]]/.test(ch)) {
38
+ return ret(null, ch);
39
+ }
40
+ else {
41
+ stream.eatWhile(/[\w\\\-]/);
42
+ return ret("variable", "variable");
43
+ }
44
+ }
45
+
46
+ function tokenCComment(stream, state) {
47
+ var maybeEnd = false, ch;
48
+ while ((ch = stream.next()) != null) {
49
+ if (maybeEnd && ch == "/") {
50
+ state.tokenize = tokenBase;
51
+ break;
52
+ }
53
+ maybeEnd = (ch == "*");
54
+ }
55
+ return ret("comment", "comment");
56
+ }
57
+
58
+ function tokenSGMLComment(stream, state) {
59
+ var dashes = 0, ch;
60
+ while ((ch = stream.next()) != null) {
61
+ if (dashes >= 2 && ch == ">") {
62
+ state.tokenize = tokenBase;
63
+ break;
64
+ }
65
+ dashes = (ch == "-") ? dashes + 1 : 0;
66
+ }
67
+ return ret("comment", "comment");
68
+ }
69
+
70
+ function tokenString(quote) {
71
+ return function(stream, state) {
72
+ var escaped = false, ch;
73
+ while ((ch = stream.next()) != null) {
74
+ if (ch == quote && !escaped)
75
+ break;
76
+ escaped = !escaped && ch == "\\";
77
+ }
78
+ if (!escaped) state.tokenize = tokenBase;
79
+ return ret("string", "string");
80
+ };
81
+ }
82
+
83
+ return {
84
+ startState: function(base) {
85
+ return {tokenize: tokenBase,
86
+ baseIndent: base || 0,
87
+ stack: []};
88
+ },
89
+
90
+ token: function(stream, state) {
91
+ if (stream.eatSpace()) return null;
92
+ var style = state.tokenize(stream, state);
93
+
94
+ var context = state.stack[state.stack.length-1];
95
+ if (type == "hash" && context != "rule") style = "string-2";
96
+ else if (style == "variable") {
97
+ if (context == "rule") style = "number";
98
+ else if (!context || context == "@media{") style = "tag";
99
+ }
100
+
101
+ if (context == "rule" && /^[\{\};]$/.test(type))
102
+ state.stack.pop();
103
+ if (type == "{") {
104
+ if (context == "@media") state.stack[state.stack.length-1] = "@media{";
105
+ else state.stack.push("{");
106
+ }
107
+ else if (type == "}") state.stack.pop();
108
+ else if (type == "@media") state.stack.push("@media");
109
+ else if (context == "{" && type != "comment") state.stack.push("rule");
110
+ return style;
111
+ },
112
+
113
+ indent: function(state, textAfter) {
114
+ var n = state.stack.length;
115
+ if (/^\}/.test(textAfter))
116
+ n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
117
+ return state.baseIndent + n * indentUnit;
118
+ },
119
+
120
+ electricChars: "}"
121
+ };
122
+ });
123
+
124
+ CodeMirror.defineMIME("text/css", "css");
js/dialog.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Open simple dialogs on top of an editor. Relies on dialog.css.
2
+
3
+ (function() {
4
+ function dialogDiv(cm, template) {
5
+ var wrap = cm.getWrapperElement();
6
+ var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
7
+ dialog.className = "CodeMirror-dialog";
8
+ dialog.innerHTML = '<div>' + template + '</div>';
9
+ return dialog;
10
+ }
11
+
12
+ CodeMirror.defineExtension("openDialog", function(template, callback) {
13
+ var dialog = dialogDiv(this, template);
14
+ var closed = false, me = this;
15
+ function close() {
16
+ if (closed) return;
17
+ closed = true;
18
+ dialog.parentNode.removeChild(dialog);
19
+ }
20
+ var inp = dialog.getElementsByTagName("input")[0], button;
21
+ if (inp) {
22
+ CodeMirror.connect(inp, "keydown", function(e) {
23
+ if (e.keyCode == 13 || e.keyCode == 27) {
24
+ CodeMirror.e_stop(e);
25
+ close();
26
+ me.focus();
27
+ if (e.keyCode == 13) callback(inp.value);
28
+ }
29
+ });
30
+ inp.focus();
31
+ CodeMirror.connect(inp, "blur", close);
32
+ } else if (button = dialog.getElementsByTagName("button")[0]) {
33
+ CodeMirror.connect(button, "click", close);
34
+ button.focus();
35
+ CodeMirror.connect(button, "blur", close);
36
+ }
37
+ return close;
38
+ });
39
+
40
+ CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
41
+ var dialog = dialogDiv(this, template);
42
+ var buttons = dialog.getElementsByTagName("button");
43
+ var closed = false, me = this, blurring = 1;
44
+ function close() {
45
+ if (closed) return;
46
+ closed = true;
47
+ dialog.parentNode.removeChild(dialog);
48
+ me.focus();
49
+ }
50
+ buttons[0].focus();
51
+ for (var i = 0; i < buttons.length; ++i) {
52
+ var b = buttons[i];
53
+ (function(callback) {
54
+ CodeMirror.connect(b, "click", function(e) {
55
+ CodeMirror.e_preventDefault(e);
56
+ close();
57
+ if (callback) callback(me);
58
+ });
59
+ })(callbacks[i]);
60
+ CodeMirror.connect(b, "blur", function() {
61
+ --blurring;
62
+ setTimeout(function() { if (blurring <= 0) close(); }, 200);
63
+ });
64
+ CodeMirror.connect(b, "focus", function() { ++blurring; });
65
+ }
66
+ });
67
+ })();
js/javascript.js ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CodeMirror.defineMode("javascript", function(config, parserConfig) {
2
+ var indentUnit = config.indentUnit;
3
+ var jsonMode = parserConfig.json;
4
+
5
+ // Tokenizer
6
+
7
+ var keywords = function(){
8
+ function kw(type) {return {type: type, style: "keyword"};}
9
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
10
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"};
11
+ return {
12
+ "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
13
+ "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
14
+ "var": kw("var"), "const": kw("var"), "let": kw("var"),
15
+ "function": kw("function"), "catch": kw("catch"),
16
+ "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
17
+ "in": operator, "typeof": operator, "instanceof": operator,
18
+ "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
19
+ };
20
+ }();
21
+
22
+ var isOperatorChar = /[+\-*&%=<>!?|]/;
23
+
24
+ function chain(stream, state, f) {
25
+ state.tokenize = f;
26
+ return f(stream, state);
27
+ }
28
+
29
+ function nextUntilUnescaped(stream, end) {
30
+ var escaped = false, next;
31
+ while ((next = stream.next()) != null) {
32
+ if (next == end && !escaped)
33
+ return false;
34
+ escaped = !escaped && next == "\\";
35
+ }
36
+ return escaped;
37
+ }
38
+
39
+ // Used as scratch variables to communicate multiple values without
40
+ // consing up tons of objects.
41
+ var type, content;
42
+ function ret(tp, style, cont) {
43
+ type = tp; content = cont;
44
+ return style;
45
+ }
46
+
47
+ function jsTokenBase(stream, state) {
48
+ var ch = stream.next();
49
+ if (ch == '"' || ch == "'")
50
+ return chain(stream, state, jsTokenString(ch));
51
+ else if (/[\[\]{}\(\),;\:\.]/.test(ch))
52
+ return ret(ch);
53
+ else if (ch == "0" && stream.eat(/x/i)) {
54
+ stream.eatWhile(/[\da-f]/i);
55
+ return ret("number", "number");
56
+ }
57
+ else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
58
+ stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
59
+ return ret("number", "number");
60
+ }
61
+ else if (ch == "/") {
62
+ if (stream.eat("*")) {
63
+ return chain(stream, state, jsTokenComment);
64
+ }
65
+ else if (stream.eat("/")) {
66
+ stream.skipToEnd();
67
+ return ret("comment", "comment");
68
+ }
69
+ else if (state.reAllowed) {
70
+ nextUntilUnescaped(stream, "/");
71
+ stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
72
+ return ret("regexp", "string-2");
73
+ }
74
+ else {
75
+ stream.eatWhile(isOperatorChar);
76
+ return ret("operator", null, stream.current());
77
+ }
78
+ }
79
+ else if (ch == "#") {
80
+ stream.skipToEnd();
81
+ return ret("error", "error");
82
+ }
83
+ else if (isOperatorChar.test(ch)) {
84
+ stream.eatWhile(isOperatorChar);
85
+ return ret("operator", null, stream.current());
86
+ }
87
+ else {
88
+ stream.eatWhile(/[\w\$_]/);
89
+ var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
90
+ return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
91
+ ret("variable", "variable", word);
92
+ }
93
+ }
94
+
95
+ function jsTokenString(quote) {
96
+ return function(stream, state) {
97
+ if (!nextUntilUnescaped(stream, quote))
98
+ state.tokenize = jsTokenBase;
99
+ return ret("string", "string");
100
+ };
101
+ }
102
+
103
+ function jsTokenComment(stream, state) {
104
+ var maybeEnd = false, ch;
105
+ while (ch = stream.next()) {
106
+ if (ch == "/" && maybeEnd) {
107
+ state.tokenize = jsTokenBase;
108
+ break;
109
+ }
110
+ maybeEnd = (ch == "*");
111
+ }
112
+ return ret("comment", "comment");
113
+ }
114
+
115
+ // Parser
116
+
117
+ var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
118
+
119
+ function JSLexical(indented, column, type, align, prev, info) {
120
+ this.indented = indented;
121
+ this.column = column;
122
+ this.type = type;
123
+ this.prev = prev;
124
+ this.info = info;
125
+ if (align != null) this.align = align;
126
+ }
127
+
128
+ function inScope(state, varname) {
129
+ for (var v = state.localVars; v; v = v.next)
130
+ if (v.name == varname) return true;
131
+ }
132
+
133
+ function parseJS(state, style, type, content, stream) {
134
+ var cc = state.cc;
135
+ // Communicate our context to the combinators.
136
+ // (Less wasteful than consing up a hundred closures on every call.)
137
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
138
+
139
+ if (!state.lexical.hasOwnProperty("align"))
140
+ state.lexical.align = true;
141
+
142
+ while(true) {
143
+ var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
144
+ if (combinator(type, content)) {
145
+ while(cc.length && cc[cc.length - 1].lex)
146
+ cc.pop()();
147
+ if (cx.marked) return cx.marked;
148
+ if (type == "variable" && inScope(state, content)) return "variable-2";
149
+ return style;
150
+ }
151
+ }
152
+ }
153
+
154
+ // Combinator utils
155
+
156
+ var cx = {state: null, column: null, marked: null, cc: null};
157
+ function pass() {
158
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
159
+ }
160
+ function cont() {
161
+ pass.apply(null, arguments);
162
+ return true;
163
+ }
164
+ function register(varname) {
165
+ var state = cx.state;
166
+ if (state.context) {
167
+ cx.marked = "def";
168
+ for (var v = state.localVars; v; v = v.next)
169
+ if (v.name == varname) return;
170
+ state.localVars = {name: varname, next: state.localVars};
171
+ }
172
+ }
173
+
174
+ // Combinators
175
+
176
+ var defaultVars = {name: "this", next: {name: "arguments"}};
177
+ function pushcontext() {
178
+ if (!cx.state.context) cx.state.localVars = defaultVars;
179
+ cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
180
+ }
181
+ function popcontext() {
182
+ cx.state.localVars = cx.state.context.vars;
183
+ cx.state.context = cx.state.context.prev;
184
+ }
185
+ function pushlex(type, info) {
186
+ var result = function() {
187
+ var state = cx.state;
188
+ state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
189
+ };
190
+ result.lex = true;
191
+ return result;
192
+ }
193
+ function poplex() {
194
+ var state = cx.state;
195
+ if (state.lexical.prev) {
196
+ if (state.lexical.type == ")")
197
+ state.indented = state.lexical.indented;
198
+ state.lexical = state.lexical.prev;
199
+ }
200
+ }
201
+ poplex.lex = true;
202
+
203
+ function expect(wanted) {
204
+ return function expecting(type) {
205
+ if (type == wanted) return cont();
206
+ else if (wanted == ";") return pass();
207
+ else return cont(arguments.callee);
208
+ };
209
+ }
210
+
211
+ function statement(type) {
212
+ if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
213
+ if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
214
+ if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
215
+ if (type == "{") return cont(pushlex("}"), block, poplex);
216
+ if (type == ";") return cont();
217
+ if (type == "function") return cont(functiondef);
218
+ if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
219
+ poplex, statement, poplex);
220
+ if (type == "variable") return cont(pushlex("stat"), maybelabel);
221
+ if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
222
+ block, poplex, poplex);
223
+ if (type == "case") return cont(expression, expect(":"));
224
+ if (type == "default") return cont(expect(":"));
225
+ if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
226
+ statement, poplex, popcontext);
227
+ return pass(pushlex("stat"), expression, expect(";"), poplex);
228
+ }
229
+ function expression(type) {
230
+ if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
231
+ if (type == "function") return cont(functiondef);
232
+ if (type == "keyword c") return cont(maybeexpression);
233
+ if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
234
+ if (type == "operator") return cont(expression);
235
+ if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
236
+ if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
237
+ return cont();
238
+ }
239
+ function maybeexpression(type) {
240
+ if (type.match(/[;\}\)\],]/)) return pass();
241
+ return pass(expression);
242
+ }
243
+
244
+ function maybeoperator(type, value) {
245
+ if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
246
+ if (type == "operator" || type == ":") return cont(expression);
247
+ if (type == ";") return;
248
+ if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
249
+ if (type == ".") return cont(property, maybeoperator);
250
+ if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
251
+ }
252
+ function maybelabel(type) {
253
+ if (type == ":") return cont(poplex, statement);
254
+ return pass(maybeoperator, expect(";"), poplex);
255
+ }
256
+ function property(type) {
257
+ if (type == "variable") {cx.marked = "property"; return cont();}
258
+ }
259
+ function objprop(type) {
260
+ if (type == "variable") cx.marked = "property";
261
+ if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
262
+ }
263
+ function commasep(what, end) {
264
+ function proceed(type) {
265
+ if (type == ",") return cont(what, proceed);
266
+ if (type == end) return cont();
267
+ return cont(expect(end));
268
+ }
269
+ return function commaSeparated(type) {
270
+ if (type == end) return cont();
271
+ else return pass(what, proceed);
272
+ };
273
+ }
274
+ function block(type) {
275
+ if (type == "}") return cont();
276
+ return pass(statement, block);
277
+ }
278
+ function vardef1(type, value) {
279
+ if (type == "variable"){register(value); return cont(vardef2);}
280
+ return cont();
281
+ }
282
+ function vardef2(type, value) {
283
+ if (value == "=") return cont(expression, vardef2);
284
+ if (type == ",") return cont(vardef1);
285
+ }
286
+ function forspec1(type) {
287
+ if (type == "var") return cont(vardef1, forspec2);
288
+ if (type == ";") return pass(forspec2);
289
+ if (type == "variable") return cont(formaybein);
290
+ return pass(forspec2);
291
+ }
292
+ function formaybein(type, value) {
293
+ if (value == "in") return cont(expression);
294
+ return cont(maybeoperator, forspec2);
295
+ }
296
+ function forspec2(type, value) {
297
+ if (type == ";") return cont(forspec3);
298
+ if (value == "in") return cont(expression);
299
+ return cont(expression, expect(";"), forspec3);
300
+ }
301
+ function forspec3(type) {
302
+ if (type != ")") cont(expression);
303
+ }
304
+ function functiondef(type, value) {
305
+ if (type == "variable") {register(value); return cont(functiondef);}
306
+ if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
307
+ }
308
+ function funarg(type, value) {
309
+ if (type == "variable") {register(value); return cont();}
310
+ }
311
+
312
+ // Interface
313
+
314
+ return {
315
+ startState: function(basecolumn) {
316
+ return {
317
+ tokenize: jsTokenBase,
318
+ reAllowed: true,
319
+ kwAllowed: true,
320
+ cc: [],
321
+ lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
322
+ localVars: parserConfig.localVars,
323
+ context: parserConfig.localVars && {vars: parserConfig.localVars},
324
+ indented: 0
325
+ };
326
+ },
327
+
328
+ token: function(stream, state) {
329
+ if (stream.sol()) {
330
+ if (!state.lexical.hasOwnProperty("align"))
331
+ state.lexical.align = false;
332
+ state.indented = stream.indentation();
333
+ }
334
+ if (stream.eatSpace()) return null;
335
+ var style = state.tokenize(stream, state);
336
+ if (type == "comment") return style;
337
+ state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
338
+ state.kwAllowed = type != '.';
339
+ return parseJS(state, style, type, content, stream);
340
+ },
341
+
342
+ indent: function(state, textAfter) {
343
+ if (state.tokenize != jsTokenBase) return 0;
344
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
345
+ if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
346
+ var type = lexical.type, closing = firstChar == type;
347
+ if (type == "vardef") return lexical.indented + 4;
348
+ else if (type == "form" && firstChar == "{") return lexical.indented;
349
+ else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
350
+ else if (lexical.info == "switch" && !closing)
351
+ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
352
+ else if (lexical.align) return lexical.column + (closing ? 0 : 1);
353
+ else return lexical.indented + (closing ? 0 : indentUnit);
354
+ },
355
+
356
+ electricChars: ":{}"
357
+ };
358
+ });
359
+
360
+ CodeMirror.defineMIME("text/javascript", "javascript");
361
+ CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
js/php.js ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ function keywords(str) {
3
+ var obj = {}, words = str.split(" ");
4
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
5
+ return obj;
6
+ }
7
+ function heredoc(delim) {
8
+ return function(stream, state) {
9
+ if (stream.match(delim)) state.tokenize = null;
10
+ else stream.skipToEnd();
11
+ return "string";
12
+ }
13
+ }
14
+ var phpConfig = {
15
+ name: "clike",
16
+ keywords: keywords("abstract and array as break case catch class clone const continue declare default " +
17
+ "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
18
+ "for foreach function global goto if implements interface instanceof namespace " +
19
+ "new or private protected public static switch throw trait try use var while xor " +
20
+ "die echo empty exit eval include include_once isset list require require_once return " +
21
+ "print unset __halt_compiler self static parent"),
22
+ blockKeywords: keywords("catch do else elseif for foreach if switch try while"),
23
+ atoms: keywords("true false null TRUE FALSE NULL"),
24
+ multiLineStrings: true,
25
+ hooks: {
26
+ "$": function(stream, state) {
27
+ stream.eatWhile(/[\w\$_]/);
28
+ return "variable-2";
29
+ },
30
+ "<": function(stream, state) {
31
+ if (stream.match(/<</)) {
32
+ stream.eatWhile(/[\w\.]/);
33
+ state.tokenize = heredoc(stream.current().slice(3));
34
+ return state.tokenize(stream, state);
35
+ }
36
+ return false;
37
+ },
38
+ "#": function(stream, state) {
39
+ while (!stream.eol() && !stream.match("?>", false)) stream.next();
40
+ return "comment";
41
+ },
42
+ "/": function(stream, state) {
43
+ if (stream.eat("/")) {
44
+ while (!stream.eol() && !stream.match("?>", false)) stream.next();
45
+ return "comment";
46
+ }
47
+ return false;
48
+ }
49
+ }
50
+ };
51
+
52
+ CodeMirror.defineMode("php", function(config, parserConfig) {
53
+ var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
54
+ var jsMode = CodeMirror.getMode(config, "javascript");
55
+ var cssMode = CodeMirror.getMode(config, "css");
56
+ var phpMode = CodeMirror.getMode(config, phpConfig);
57
+
58
+ function dispatch(stream, state) { // TODO open PHP inside text/css
59
+ var isPHP = state.mode == "php";
60
+ if (stream.sol() && state.pending != '"') state.pending = null;
61
+ if (state.curMode == htmlMode) {
62
+ if (stream.match(/^<\?\w*/)) {
63
+ state.curMode = phpMode;
64
+ state.curState = state.php;
65
+ state.curClose = "?>";
66
+ state.mode = "php";
67
+ return "meta";
68
+ }
69
+ if (state.pending == '"') {
70
+ while (!stream.eol() && stream.next() != '"') {}
71
+ var style = "string";
72
+ } else if (state.pending && stream.pos < state.pending.end) {
73
+ stream.pos = state.pending.end;
74
+ var style = state.pending.style;
75
+ } else {
76
+ var style = htmlMode.token(stream, state.curState);
77
+ }
78
+ state.pending = null;
79
+ var cur = stream.current(), openPHP = cur.search(/<\?/);
80
+ if (openPHP != -1) {
81
+ if (style == "string" && /\"$/.test(cur) && !/\?>/.test(cur)) state.pending = '"';
82
+ else state.pending = {end: stream.pos, style: style};
83
+ stream.backUp(cur.length - openPHP);
84
+ } else if (style == "tag" && stream.current() == ">" && state.curState.context) {
85
+ if (/^script$/i.test(state.curState.context.tagName)) {
86
+ state.curMode = jsMode;
87
+ state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
88
+ state.curClose = /^<\/\s*script\s*>/i;
89
+ state.mode = "javascript";
90
+ }
91
+ else if (/^style$/i.test(state.curState.context.tagName)) {
92
+ state.curMode = cssMode;
93
+ state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
94
+ state.curClose = /^<\/\s*style\s*>/i;
95
+ state.mode = "css";
96
+ }
97
+ }
98
+ return style;
99
+ } else if ((!isPHP || state.php.tokenize == null) &&
100
+ stream.match(state.curClose, isPHP)) {
101
+ state.curMode = htmlMode;
102
+ state.curState = state.html;
103
+ state.curClose = null;
104
+ state.mode = "html";
105
+ if (isPHP) return "meta";
106
+ else return dispatch(stream, state);
107
+ } else {
108
+ return state.curMode.token(stream, state.curState);
109
+ }
110
+ }
111
+
112
+ return {
113
+ startState: function() {
114
+ var html = htmlMode.startState();
115
+ return {html: html,
116
+ php: phpMode.startState(),
117
+ curMode: parserConfig.startOpen ? phpMode : htmlMode,
118
+ curState: parserConfig.startOpen ? phpMode.startState() : html,
119
+ curClose: parserConfig.startOpen ? /^\?>/ : null,
120
+ mode: parserConfig.startOpen ? "php" : "html",
121
+ pending: null}
122
+ },
123
+
124
+ copyState: function(state) {
125
+ var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
126
+ php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;
127
+ if (state.curState == html) cur = htmlNew;
128
+ else if (state.curState == php) cur = phpNew;
129
+ else cur = CodeMirror.copyState(state.curMode, state.curState);
130
+ return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
131
+ curClose: state.curClose, mode: state.mode,
132
+ pending: state.pending};
133
+ },
134
+
135
+ token: dispatch,
136
+
137
+ indent: function(state, textAfter) {
138
+ if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
139
+ (state.curMode == phpMode && /^\?>/.test(textAfter)))
140
+ return htmlMode.indent(state.html, textAfter);
141
+ return state.curMode.indent(state.curState, textAfter);
142
+ },
143
+
144
+ electricChars: "/{}:"
145
+ }
146
+ }, "xml", "clike", "javascript", "css");
147
+ CodeMirror.defineMIME("application/x-httpd-php", "php");
148
+ CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
149
+ CodeMirror.defineMIME("text/x-php", phpConfig);
150
+ })();
js/search.js ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Define search commands. Depends on dialog.js or another
2
+ // implementation of the openDialog method.
3
+
4
+ // Replace works a little oddly -- it will do the replace on the next
5
+ // Ctrl-G (or whatever is bound to findNext) press. You prevent a
6
+ // replace by making sure the match is no longer selected when hitting
7
+ // Ctrl-G.
8
+
9
+ (function() {
10
+ function SearchState() {
11
+ this.posFrom = this.posTo = this.query = null;
12
+ this.marked = [];
13
+ }
14
+ function getSearchState(cm) {
15
+ return cm._searchState || (cm._searchState = new SearchState());
16
+ }
17
+ function getSearchCursor(cm, query, pos) {
18
+ // Heuristic: if the query string is all lowercase, do a case insensitive search.
19
+ return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());
20
+ }
21
+ function dialog(cm, text, shortText, f) {
22
+ if (cm.openDialog) cm.openDialog(text, f);
23
+ else f(prompt(shortText, ""));
24
+ }
25
+ function confirmDialog(cm, text, shortText, fs) {
26
+ if (cm.openConfirm) cm.openConfirm(text, fs);
27
+ else if (confirm(shortText)) fs[0]();
28
+ }
29
+ function parseQuery(query) {
30
+ var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
31
+ return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;
32
+ }
33
+ var queryDialog =
34
+ 'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
35
+ function doSearch(cm, rev) {
36
+ var state = getSearchState(cm);
37
+ if (state.query) return findNext(cm, rev);
38
+ dialog(cm, queryDialog, "Search for:", function(query) {
39
+ cm.operation(function() {
40
+ if (!query || state.query) return;
41
+ state.query = parseQuery(query);
42
+ if (cm.lineCount() < 2000) { // This is too expensive on big documents.
43
+ for (var cursor = getSearchCursor(cm, query); cursor.findNext();)
44
+ state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));
45
+ }
46
+ state.posFrom = state.posTo = cm.getCursor();
47
+ findNext(cm, rev);
48
+ });
49
+ });
50
+ }
51
+ function findNext(cm, rev) {cm.operation(function() {
52
+ var state = getSearchState(cm);
53
+ var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
54
+ if (!cursor.find(rev)) {
55
+ cursor = getSearchCursor(cm, state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0});
56
+ if (!cursor.find(rev)) return;
57
+ }
58
+ cm.setSelection(cursor.from(), cursor.to());
59
+ state.posFrom = cursor.from(); state.posTo = cursor.to();
60
+ })}
61
+ function clearSearch(cm) {cm.operation(function() {
62
+ var state = getSearchState(cm);
63
+ if (!state.query) return;
64
+ state.query = null;
65
+ for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear();
66
+ state.marked.length = 0;
67
+ })}
68
+
69
+ var replaceQueryDialog =
70
+ 'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
71
+ var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';
72
+ var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
73
+ function replace(cm, all) {
74
+ dialog(cm, replaceQueryDialog, "Replace:", function(query) {
75
+ if (!query) return;
76
+ query = parseQuery(query);
77
+ dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
78
+ if (all) {
79
+ cm.compoundChange(function() { cm.operation(function() {
80
+ for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
81
+ if (typeof query != "string") {
82
+ var match = cm.getRange(cursor.from(), cursor.to()).match(query);
83
+ cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));
84
+ } else cursor.replace(text);
85
+ }
86
+ })});
87
+ } else {
88
+ clearSearch(cm);
89
+ var cursor = getSearchCursor(cm, query, cm.getCursor());
90
+ function advance() {
91
+ var start = cursor.from(), match;
92
+ if (!(match = cursor.findNext())) {
93
+ cursor = getSearchCursor(cm, query);
94
+ if (!(match = cursor.findNext()) ||
95
+ (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
96
+ }
97
+ cm.setSelection(cursor.from(), cursor.to());
98
+ confirmDialog(cm, doReplaceConfirm, "Replace?",
99
+ [function() {doReplace(match);}, advance]);
100
+ }
101
+ function doReplace(match) {
102
+ cursor.replace(typeof query == "string" ? text :
103
+ text.replace(/\$(\d)/, function(w, i) {return match[i];}));
104
+ advance();
105
+ }
106
+ advance();
107
+ }
108
+ });
109
+ });
110
+ }
111
+
112
+ CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
113
+ CodeMirror.commands.findNext = doSearch;
114
+ CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
115
+ CodeMirror.commands.clearSearch = clearSearch;
116
+ CodeMirror.commands.replace = replace;
117
+ CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
118
+ })();
js/searchcursor.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(){
2
+ function SearchCursor(cm, query, pos, caseFold) {
3
+ this.atOccurrence = false; this.cm = cm;
4
+ if (caseFold == null && typeof query == "string") caseFold = false;
5
+
6
+ pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};
7
+ this.pos = {from: pos, to: pos};
8
+
9
+ // The matches method is filled in based on the type of query.
10
+ // It takes a position and a direction, and returns an object
11
+ // describing the next occurrence of the query, or null if no
12
+ // more matches were found.
13
+ if (typeof query != "string") // Regexp match
14
+ this.matches = function(reverse, pos) {
15
+ if (reverse) {
16
+ var line = cm.getLine(pos.line).slice(0, pos.ch), match = line.match(query), start = 0;
17
+ while (match) {
18
+ var ind = line.indexOf(match[0]);
19
+ start += ind;
20
+ line = line.slice(ind + 1);
21
+ var newmatch = line.match(query);
22
+ if (newmatch) match = newmatch;
23
+ else break;
24
+ start++;
25
+ }
26
+ }
27
+ else {
28
+ var line = cm.getLine(pos.line).slice(pos.ch), match = line.match(query),
29
+ start = match && pos.ch + line.indexOf(match[0]);
30
+ }
31
+ if (match)
32
+ return {from: {line: pos.line, ch: start},
33
+ to: {line: pos.line, ch: start + match[0].length},
34
+ match: match};
35
+ };
36
+ else { // String query
37
+ if (caseFold) query = query.toLowerCase();
38
+ var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
39
+ var target = query.split("\n");
40
+ // Different methods for single-line and multi-line queries
41
+ if (target.length == 1)
42
+ this.matches = function(reverse, pos) {
43
+ var line = fold(cm.getLine(pos.line)), len = query.length, match;
44
+ if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
45
+ : (match = line.indexOf(query, pos.ch)) != -1)
46
+ return {from: {line: pos.line, ch: match},
47
+ to: {line: pos.line, ch: match + len}};
48
+ };
49
+ else
50
+ this.matches = function(reverse, pos) {
51
+ var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
52
+ var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
53
+ if (reverse ? offsetA >= pos.ch || offsetA != match.length
54
+ : offsetA <= pos.ch || offsetA != line.length - match.length)
55
+ return;
56
+ for (;;) {
57
+ if (reverse ? !ln : ln == cm.lineCount() - 1) return;
58
+ line = fold(cm.getLine(ln += reverse ? -1 : 1));
59
+ match = target[reverse ? --idx : ++idx];
60
+ if (idx > 0 && idx < target.length - 1) {
61
+ if (line != match) return;
62
+ else continue;
63
+ }
64
+ var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
65
+ if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
66
+ return;
67
+ var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
68
+ return {from: reverse ? end : start, to: reverse ? start : end};
69
+ }
70
+ };
71
+ }
72
+ }
73
+
74
+ SearchCursor.prototype = {
75
+ findNext: function() {return this.find(false);},
76
+ findPrevious: function() {return this.find(true);},
77
+
78
+ find: function(reverse) {
79
+ var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
80
+ function savePosAndFail(line) {
81
+ var pos = {line: line, ch: 0};
82
+ self.pos = {from: pos, to: pos};
83
+ self.atOccurrence = false;
84
+ return false;
85
+ }
86
+
87
+ for (;;) {
88
+ if (this.pos = this.matches(reverse, pos)) {
89
+ this.atOccurrence = true;
90
+ return this.pos.match || true;
91
+ }
92
+ if (reverse) {
93
+ if (!pos.line) return savePosAndFail(0);
94
+ pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};
95
+ }
96
+ else {
97
+ var maxLine = this.cm.lineCount();
98
+ if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
99
+ pos = {line: pos.line+1, ch: 0};
100
+ }
101
+ }
102
+ },
103
+
104
+ from: function() {if (this.atOccurrence) return this.pos.from;},
105
+ to: function() {if (this.atOccurrence) return this.pos.to;},
106
+
107
+ replace: function(newText) {
108
+ var self = this;
109
+ if (this.atOccurrence)
110
+ self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);
111
+ }
112
+ };
113
+
114
+ CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
115
+ return new SearchCursor(this, query, pos, caseFold);
116
+ });
117
+ })();
js/xml.js ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CodeMirror.defineMode("xml", function(config, parserConfig) {
2
+ var indentUnit = config.indentUnit;
3
+ var Kludges = parserConfig.htmlMode ? {
4
+ autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
5
+ 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
6
+ 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
7
+ 'track': true, 'wbr': true},
8
+ implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
9
+ 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
10
+ 'th': true, 'tr': true},
11
+ contextGrabbers: {
12
+ 'dd': {'dd': true, 'dt': true},
13
+ 'dt': {'dd': true, 'dt': true},
14
+ 'li': {'li': true},
15
+ 'option': {'option': true, 'optgroup': true},
16
+ 'optgroup': {'optgroup': true},
17
+ 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
18
+ 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
19
+ 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
20
+ 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
21
+ 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
22
+ 'rp': {'rp': true, 'rt': true},
23
+ 'rt': {'rp': true, 'rt': true},
24
+ 'tbody': {'tbody': true, 'tfoot': true},
25
+ 'td': {'td': true, 'th': true},
26
+ 'tfoot': {'tbody': true},
27
+ 'th': {'td': true, 'th': true},
28
+ 'thead': {'tbody': true, 'tfoot': true},
29
+ 'tr': {'tr': true}
30
+ },
31
+ doNotIndent: {"pre": true},
32
+ allowUnquoted: true,
33
+ allowMissing: false
34
+ } : {
35
+ autoSelfClosers: {},
36
+ implicitlyClosed: {},
37
+ contextGrabbers: {},
38
+ doNotIndent: {},
39
+ allowUnquoted: false,
40
+ allowMissing: false
41
+ };
42
+ var alignCDATA = parserConfig.alignCDATA;
43
+
44
+ // Return variables for tokenizers
45
+ var tagName, type;
46
+
47
+ function inText(stream, state) {
48
+ function chain(parser) {
49
+ state.tokenize = parser;
50
+ return parser(stream, state);
51
+ }
52
+
53
+ var ch = stream.next();
54
+ if (ch == "<") {
55
+ if (stream.eat("!")) {
56
+ if (stream.eat("[")) {
57
+ if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
58
+ else return null;
59
+ }
60
+ else if (stream.match("--")) return chain(inBlock("comment", "-->"));
61
+ else if (stream.match("DOCTYPE", true, true)) {
62
+ stream.eatWhile(/[\w\._\-]/);
63
+ return chain(doctype(1));
64
+ }
65
+ else return null;
66
+ }
67
+ else if (stream.eat("?")) {
68
+ stream.eatWhile(/[\w\._\-]/);
69
+ state.tokenize = inBlock("meta", "?>");
70
+ return "meta";
71
+ }
72
+ else {
73
+ type = stream.eat("/") ? "closeTag" : "openTag";
74
+ stream.eatSpace();
75
+ tagName = "";
76
+ var c;
77
+ while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
78
+ state.tokenize = inTag;
79
+ return "tag";
80
+ }
81
+ }
82
+ else if (ch == "&") {
83
+ var ok;
84
+ if (stream.eat("#")) {
85
+ if (stream.eat("x")) {
86
+ ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
87
+ } else {
88
+ ok = stream.eatWhile(/[\d]/) && stream.eat(";");
89
+ }
90
+ } else {
91
+ ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
92
+ }
93
+ return ok ? "atom" : "error";
94
+ }
95
+ else {
96
+ stream.eatWhile(/[^&<]/);
97
+ return null;
98
+ }
99
+ }
100
+
101
+ function inTag(stream, state) {
102
+ var ch = stream.next();
103
+ if (ch == ">" || (ch == "/" && stream.eat(">"))) {
104
+ state.tokenize = inText;
105
+ type = ch == ">" ? "endTag" : "selfcloseTag";
106
+ return "tag";
107
+ }
108
+ else if (ch == "=") {
109
+ type = "equals";
110
+ return null;
111
+ }
112
+ else if (/[\'\"]/.test(ch)) {
113
+ state.tokenize = inAttribute(ch);
114
+ return state.tokenize(stream, state);
115
+ }
116
+ else {
117
+ stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
118
+ return "word";
119
+ }
120
+ }
121
+
122
+ function inAttribute(quote) {
123
+ return function(stream, state) {
124
+ while (!stream.eol()) {
125
+ if (stream.next() == quote) {
126
+ state.tokenize = inTag;
127
+ break;
128
+ }
129
+ }
130
+ return "string";
131
+ };
132
+ }
133
+
134
+ function inBlock(style, terminator) {
135
+ return function(stream, state) {
136
+ while (!stream.eol()) {
137
+ if (stream.match(terminator)) {
138
+ state.tokenize = inText;
139
+ break;
140
+ }
141
+ stream.next();
142
+ }
143
+ return style;
144
+ };
145
+ }
146
+ function doctype(depth) {
147
+ return function(stream, state) {
148
+ var ch;
149
+ while ((ch = stream.next()) != null) {
150
+ if (ch == "<") {
151
+ state.tokenize = doctype(depth + 1);
152
+ return state.tokenize(stream, state);
153
+ } else if (ch == ">") {
154
+ if (depth == 1) {
155
+ state.tokenize = inText;
156
+ break;
157
+ } else {
158
+ state.tokenize = doctype(depth - 1);
159
+ return state.tokenize(stream, state);
160
+ }
161
+ }
162
+ }
163
+ return "meta";
164
+ };
165
+ }
166
+
167
+ var curState, setStyle;
168
+ function pass() {
169
+ for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
170
+ }
171
+ function cont() {
172
+ pass.apply(null, arguments);
173
+ return true;
174
+ }
175
+
176
+ function pushContext(tagName, startOfLine) {
177
+ var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
178
+ curState.context = {
179
+ prev: curState.context,
180
+ tagName: tagName,
181
+ indent: curState.indented,
182
+ startOfLine: startOfLine,
183
+ noIndent: noIndent
184
+ };
185
+ }
186
+ function popContext() {
187
+ if (curState.context) curState.context = curState.context.prev;
188
+ }
189
+
190
+ function element(type) {
191
+ if (type == "openTag") {
192
+ curState.tagName = tagName;
193
+ return cont(attributes, endtag(curState.startOfLine));
194
+ } else if (type == "closeTag") {
195
+ var err = false;
196
+ if (curState.context) {
197
+ if (curState.context.tagName != tagName) {
198
+ if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
199
+ popContext();
200
+ }
201
+ err = !curState.context || curState.context.tagName != tagName;
202
+ }
203
+ } else {
204
+ err = true;
205
+ }
206
+ if (err) setStyle = "error";
207
+ return cont(endclosetag(err));
208
+ }
209
+ return cont();
210
+ }
211
+ function endtag(startOfLine) {
212
+ return function(type) {
213
+ if (type == "selfcloseTag" ||
214
+ (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase()))) {
215
+ maybePopContext(curState.tagName.toLowerCase());
216
+ return cont();
217
+ }
218
+ if (type == "endTag") {
219
+ maybePopContext(curState.tagName.toLowerCase());
220
+ pushContext(curState.tagName, startOfLine);
221
+ return cont();
222
+ }
223
+ return cont();
224
+ };
225
+ }
226
+ function endclosetag(err) {
227
+ return function(type) {
228
+ if (err) setStyle = "error";
229
+ if (type == "endTag") { popContext(); return cont(); }
230
+ setStyle = "error";
231
+ return cont(arguments.callee);
232
+ }
233
+ }
234
+ function maybePopContext(nextTagName) {
235
+ var parentTagName;
236
+ while (true) {
237
+ if (!curState.context) {
238
+ return;
239
+ }
240
+ parentTagName = curState.context.tagName.toLowerCase();
241
+ if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
242
+ !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
243
+ return;
244
+ }
245
+ popContext();
246
+ }
247
+ }
248
+
249
+ function attributes(type) {
250
+ if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
251
+ if (type == "endTag" || type == "selfcloseTag") return pass();
252
+ setStyle = "error";
253
+ return cont(attributes);
254
+ }
255
+ function attribute(type) {
256
+ if (type == "equals") return cont(attvalue, attributes);
257
+ if (!Kludges.allowMissing) setStyle = "error";
258
+ return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
259
+ }
260
+ function attvalue(type) {
261
+ if (type == "string") return cont(attvaluemaybe);
262
+ if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
263
+ setStyle = "error";
264
+ return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
265
+ }
266
+ function attvaluemaybe(type) {
267
+ if (type == "string") return cont(attvaluemaybe);
268
+ else return pass();
269
+ }
270
+
271
+ return {
272
+ startState: function() {
273
+ return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
274
+ },
275
+
276
+ token: function(stream, state) {
277
+ if (stream.sol()) {
278
+ state.startOfLine = true;
279
+ state.indented = stream.indentation();
280
+ }
281
+ if (stream.eatSpace()) return null;
282
+
283
+ setStyle = type = tagName = null;
284
+ var style = state.tokenize(stream, state);
285
+ state.type = type;
286
+ if ((style || type) && style != "comment") {
287
+ curState = state;
288
+ while (true) {
289
+ var comb = state.cc.pop() || element;
290
+ if (comb(type || style)) break;
291
+ }
292
+ }
293
+ state.startOfLine = false;
294
+ return setStyle || style;
295
+ },
296
+
297
+ indent: function(state, textAfter, fullLine) {
298
+ var context = state.context;
299
+ if ((state.tokenize != inTag && state.tokenize != inText) ||
300
+ context && context.noIndent)
301
+ return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
302
+ if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
303
+ if (context && /^<\//.test(textAfter))
304
+ context = context.prev;
305
+ while (context && !context.startOfLine)
306
+ context = context.prev;
307
+ if (context) return context.indent + indentUnit;
308
+ else return 0;
309
+ },
310
+
311
+ compareStates: function(a, b) {
312
+ if (a.indented != b.indented || a.tokenize != b.tokenize) return false;
313
+ for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
314
+ if (!ca || !cb) return ca == cb;
315
+ if (ca.tagName != cb.tagName || ca.indent != cb.indent) return false;
316
+ }
317
+ },
318
+
319
+ electricChars: "/"
320
+ };
321
+ });
322
+
323
+ CodeMirror.defineMIME("text/xml", "xml");
324
+ CodeMirror.defineMIME("application/xml", "xml");
325
+ if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
326
+ CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
readme.txt CHANGED
@@ -1,43 +1,45 @@
1
  === Code Snippets ===
2
  Contributors: bungeshea
3
- Donate link: http://bungeshea.wordpress.com/donate/
4
- Tags: snippets, code, php
5
  Requires at least: 3.3
6
  Tested up to: 3.4.1
7
- Stable tag: 1.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/copyleft/gpl.html
10
 
11
- Allows you to easily add code snippets through a GUI interface.
12
 
13
  == Description ==
14
 
15
- **Code Snippets** is a easy, clean and simple way to add code snippets to your site.
16
 
17
- Use the top level menu to manage your snippets. You can activate, deactivate, edit and delete snippets using a page similar to the Plugins menu. You can add a name for your snippet, a description using the visual editor and the code using a textarea with syntax highlighting and other features.
18
 
19
- Snippets are stored in the `wp_snippets` table in the WordPress database (the table name may differ depending on what your table prefix is set to).
20
 
21
- Code Snippets will automaticly clean ut its data when deleted through the WordPress dashboard. Each screen includes a help tab just in case you get stuck.
22
 
23
- Further information and screenshots are available on the [plugin homepage](http://bungeshea.wordpress.com/plugins/code-snippets).
24
 
25
- Code Snippets was featured on WPMU: [WordPress Code Snippets: Keep them Organized with this Plugin!](http://wpmu.org/wordpress-code-snippets)
26
 
27
- If you have any feedback, issues or suggestions for improvements please leave start a topic in the [Support Forum](http://wordpress.org/support/plugin/code-snippets) and if you like the plugin please give it a perfect rating at [WordPress.org](http://wordpress.org/extend/plugins/code-snippets) :-)
28
-
29
- You can also contribute to the code at [GitHub](https://github.com/bungeshea/code-snippets).
30
 
31
  == Installation ==
32
 
33
  1. Download the `code-snippets.zip` file to your local machine.
34
- 2. Either use the automatic plugin installer *(Plugins - Add New)* or Unzip the file and upload the **code-snippets** folder to your `/wp-content/plugins/` directory.
35
  3. Activate the plugin through the Plugins menu
36
  4. Visit the **Add New Snippet** menu page *(Snippets > Add New)* to add or edit Snippets.
37
  5. Activate your snippets through the Manage Snippets page *(Snippets > Manage Snippets)*
38
 
 
 
39
  == Frequently Asked Questions ==
40
 
 
 
41
  = Do I need to include the &lt;?php, &lt;?, ?&gt; tags in my snippet? =
42
  No, just copy all the content inside those tags.
43
 
@@ -45,7 +47,7 @@ No, just copy all the content inside those tags.
45
  Yes. Just add it but do not activate it yet.
46
 
47
  = What do I use to write my snippets? =
48
- The [EditArea](http://www.cdolivet.com/editarea/) source-code editor will add line numbers, syntax highlighting, search and replace, tablature and other cool features to the code editor.
49
 
50
  = Will I lose my snippets if I change the theme or upgrade WordPress? =
51
  No, the snippets are added to the WordPress database so are independent of the theme and unaffected by WordPress upgrades.
@@ -54,10 +56,10 @@ No, the snippets are added to the WordPress database so are independent of the t
54
  Yes, when you delete Code Snippets using the 'Plugins' menu in WordPress it will clean up the database table and a few other bits of data. Be careful not to remove Code Snippets using the Plugins menu unless you want this to happen.
55
 
56
  = Can I copy any snippets I've created to another WordPress site? =
57
- Yes! You can individualy export a single snippet using the link below the snippet name on the 'Manage Snippets' page or bulk export multiple snippets using the 'Bulk Actions' feature. Snippets can later be imported using the 'Import Snippets' page by uploading the export file.
58
 
59
  = Can I run network-wide snippets on a multisite installation? =
60
- No, this feature is currently not avalible and will be coming in a future release. In the mean time activate Code Snippets individualy on the desired sites.
61
 
62
  = I have an idea for a cool feature for Code Snippets! =
63
  That's great! Let me know by starting (or adding to) a topic in the [Support Forums](http://wordpress.org/support/plugin/code-snippets/).
@@ -71,6 +73,19 @@ That's great! Let me know by starting (or adding to) a topic in the [Support For
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  = 1.3 =
75
  * Added export option to 'Manage Snippets' page
76
  * Added 'Import Snippets' page
@@ -79,7 +94,7 @@ That's great! Let me know by starting (or adding to) a topic in the [Support For
79
  * Minor improvements
80
  * Added code highlighting
81
  * Removed 'Uninstall Plugin' page
82
- * Data will now be cleaned up when plugin is deleted through WordPress admin.
83
 
84
  = 1.1 =
85
  * Fixed a permissions bug with `DISALLOW_FILE_EDIT` being set to true
@@ -88,15 +103,30 @@ That's great! Let me know by starting (or adding to) a topic in the [Support For
88
  = 1.0 =
89
  * Stable version released.
90
 
 
 
 
 
 
 
 
 
 
91
  == Upgrade Notice ==
92
 
 
 
 
 
 
 
93
  = 1.3 =
94
  Added import/export feature
95
 
96
  = 1.2 =
97
- Minor improvments |
98
  Added code highlighting |
99
  Plugin data will now be cleaned up when you delete the plugin.
100
 
101
  = 1.1 =
102
- * Minor bug fixes and improvements on the the 'Edit Snippet' page
1
  === Code Snippets ===
2
  Contributors: bungeshea
3
+ Donate link: http://cs.bungeshea.com/donate/
4
+ Tags: snippets, code, php, network, multisite
5
  Requires at least: 3.3
6
  Tested up to: 3.4.1
7
+ Stable tag: 1.4
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/copyleft/gpl.html
10
 
11
+ An easy, clean and simple way to add code snippets to your site.
12
 
13
  == Description ==
14
 
15
+ **Code Snippets** is an easy, clean and simple way to add code snippets to your site. No need to edit to your theme's `functions.php` file again!
16
 
17
+ A snippet is a small chunk of PHP code that you can use to extend the functionality of a WordPress-powered website; essentially a mini-plugin with much less load on your site. Most snippet-hosting sites tell you to add snippet code to your active theme's `functions.php` file, which can get rather long and messy after a while. Code Snippets changes that by providing a GUI interface for adding snippets and actually running them on your site as if they were in your active theme's `functions.php` file.
18
 
19
+ You can use a graphical interface similar to the Plugins menu to manage, activate, deactivate, edit and delete your snippets. Easily organise your snippets by adding add a name an description using the visual editor. Code Snippets includes built-in syntax highlighting and other features to help you write your code.
20
 
21
+ Although Code Snippets is designed to be easy-to-use and its interface looks, feels and acts as if it was a native part of WordPress, each screen includes a help tab, just in case you get stuck.
22
 
23
+ Further information, documentation and updates are available on the [plugin homepage](http://cs.bungeshea.com).
24
 
25
+ [As featured on the WPMU blog](http://wpmu.org/wordpress-code-snippets)
26
 
27
+ If you have any feedback, issues or suggestions for improvements please leave a topic in the [Support Forum](http://wordpress.org/support/plugin/code-snippets) and if you like the plugin please give it a perfect rating at [WordPress.org](http://wordpress.org/extend/plugins/code-snippets)
 
 
28
 
29
  == Installation ==
30
 
31
  1. Download the `code-snippets.zip` file to your local machine.
32
+ 2. Either use the automatic plugin installer *(Plugins > Add New)* or Unzip the file and upload the **code-snippets** folder to your `/wp-content/plugins/` directory.
33
  3. Activate the plugin through the Plugins menu
34
  4. Visit the **Add New Snippet** menu page *(Snippets > Add New)* to add or edit Snippets.
35
  5. Activate your snippets through the Manage Snippets page *(Snippets > Manage Snippets)*
36
 
37
+ 'Network Activating' Code Snippets through the Network Dashboard will enable a special interface for running snippets across the entire network.
38
+
39
  == Frequently Asked Questions ==
40
 
41
+ Further documentation available on the [plugin website](http://cs.bungeshea.com/docs/).
42
+
43
  = Do I need to include the &lt;?php, &lt;?, ?&gt; tags in my snippet? =
44
  No, just copy all the content inside those tags.
45
 
47
  Yes. Just add it but do not activate it yet.
48
 
49
  = What do I use to write my snippets? =
50
+ The [CodeMirror](http://codemirror.net) source-code editor will add line numbers, syntax highlighting, search, tabulate and other cool features to the code editor.
51
 
52
  = Will I lose my snippets if I change the theme or upgrade WordPress? =
53
  No, the snippets are added to the WordPress database so are independent of the theme and unaffected by WordPress upgrades.
56
  Yes, when you delete Code Snippets using the 'Plugins' menu in WordPress it will clean up the database table and a few other bits of data. Be careful not to remove Code Snippets using the Plugins menu unless you want this to happen.
57
 
58
  = Can I copy any snippets I've created to another WordPress site? =
59
+ Yes! You can individually export a single snippet using the link below the snippet name on the 'Manage Snippets' page or bulk export multiple snippets using the 'Bulk Actions' feature. Snippets can later be imported using the 'Import Snippets' page by uploading the export file.
60
 
61
  = Can I run network-wide snippets on a multisite installation? =
62
+ You can run snippets across an entire multisite network by 'Network Activating' Code Snippets through the Network Dashboard.
63
 
64
  = I have an idea for a cool feature for Code Snippets! =
65
  That's great! Let me know by starting (or adding to) a topic in the [Support Forums](http://wordpress.org/support/plugin/code-snippets/).
73
 
74
  == Changelog ==
75
 
76
+ = 1.4 =
77
+ * Added interface to Network Dashboard
78
+ * Updated uninstall to support multisite
79
+ * Replaced EditArea with [CodeMirror](http://codemirror.net)
80
+ * Small improvements
81
+
82
+ = 1.3.2 =
83
+ * Fixed a bug with version 1.3.1
84
+
85
+ = 1.3.1 =
86
+ * Changed plugin website URI
87
+ * Cleaned up some code
88
+
89
  = 1.3 =
90
  * Added export option to 'Manage Snippets' page
91
  * Added 'Import Snippets' page
94
  * Minor improvements
95
  * Added code highlighting
96
  * Removed 'Uninstall Plugin' page
97
+ * Data will now be cleaned up when plugin is deleted through WordPress admin
98
 
99
  = 1.1 =
100
  * Fixed a permissions bug with `DISALLOW_FILE_EDIT` being set to true
103
  = 1.0 =
104
  * Stable version released.
105
 
106
+ == Other Notes ==
107
+
108
+ Plugin updates will be posted on the [plugin's homepage](http://cs.bungeshea.com) ([RSS](http://cs.bungehea.tk/feed/)).
109
+
110
+ * Snippets are stored in the `wp_snippets` table in the WordPress database (the table name may differ depending on what your table prefix is set to).
111
+ * Code Snippets will automatically clean up its data when deleted through the WordPress dashboard.
112
+
113
+ You can also contribute to the code at [GitHub](https://github.com/bungeshea/code-snippets).
114
+
115
  == Upgrade Notice ==
116
 
117
+ = 1.4 =
118
+ Better code highlighting and improved multisite support
119
+
120
+ = 1.3.2 =
121
+ Check out Code Snippet's new website: http://cs.bungeshea.com
122
+
123
  = 1.3 =
124
  Added import/export feature
125
 
126
  = 1.2 =
127
+ Minor improvements |
128
  Added code highlighting |
129
  Plugin data will now be cleaned up when you delete the plugin.
130
 
131
  = 1.1 =
132
+ Minor bug fixes and improvements on the the 'Edit Snippet' page