diff --git a/lib/WebGUI/Form/Codearea.pm b/lib/WebGUI/Form/Codearea.pm index 88a33b661..653dd0bd0 100644 --- a/lib/WebGUI/Form/Codearea.pm +++ b/lib/WebGUI/Form/Codearea.pm @@ -157,6 +157,7 @@ sub toHtml { id : "$id", syntax : "$syntax", start_highlight : true, + show_line_colors: true, toolbar : "search, go_to_line, |, undo, redo, |, syntax_selection, highlight, reset_highlight, |, help" }); diff --git a/www/extras/editarea/change_log.txt b/www/extras/editarea/change_log.txt index e2699d5d5..3d1425a07 100644 --- a/www/extras/editarea/change_log.txt +++ b/www/extras/editarea/change_log.txt @@ -1,3 +1,50 @@ +**** v 0.8.1.1 **** +- Fix bug of frequent syntax desynchronisation when the first character of the textarea was highlighted +- In unload now check that parent.editareaLoader still exists before calling it +- Now consider that gecko and webkit based browser are valid browsers (but I won't test them all) + +**** v 0.8.1 **** +- Improved speed of text highlighting process for huge file. Now we try to only insert or delete the changed caracters inside DOM text node instead of refreshing the whole area. (3 time faster in firefox) +- Greatly improved speed of line-height management in word-wrap context +- Add java syntax (thanks to Dawson Goodell) +- Use faster regexp for matching quoted strings +- Bug fix: if a highlighted quote or comment string contains cariage return, editing text on one of the lines was causin a highlight desynchronisation +- Bug fix: text war blur on Safari 3.2 (thanks to spellcoder) +- Bug fix: there had several mistake with non-monospace font (thanks to spellcoder) +- Bug fix: if show_line_colors was disabled and word wrap enable, highlighted text wasn't refreshed if a new line appears +- Bug fix: in multi file edition, closing the last tab was throwing an error in Firefox and let the content of the textarea displayed +- Browser bug detection: when using non-monospace font Firefox will sometime have strange behavior on text-width (the highlighted text-width in the background may change fron textarea one and simply can change after beeing updated); look likes a browser rendering bug + +**** v 0.8 **** +- Word-wrap is now supported (except for opera...). The new init() option is 'word_wrap' to set to 'true' (default is false). A new button appears in the default toolbar (button_code: 'word_wrap' ) +- We can now clearly see the selected text +- Add Internet explorer 8 support (but sadly I must use IE7 emulate mode in iframe due to a bug with tabulation width not beeing resized in IE's textarea) +- Add Safari 4 support +- Add Chrome 2 support +- Better support of Opera 9.6 +- Add Simplified Chinese translation "zh" (thanks to Abentian) +- Add Bulgarian translation "bg" (thanks to Valentin Hristov) +- Rename internal function $() by _$() +- Delete EditArea.add_event() method (duplicate af editAreaLoader.add_event() method) +- Do some code cleanup-up +- Bug fix: highlight optimisation process was not working under IE (don't known how long it remain broken but must be since a long time) +- Bug fix: EditArea.update_size sometimes uses undefined variable (fix this possibility and cleanup events) +- Bug fix: Template.html was not valid XHTML +- Bug fix: The checked attribute of the toogle button was not defined in xhtml syntax +- Bug fix: If the editArea was loaded on a page related to a domain which was itself an iframe comming from another domain a JS error was thrown on load +- Bug fix: When EditArea is used to replace a textarea which has style="visibility:hidden;", switching off EditArea would throw an error under IE + +**** v 0.7.3 **** +- Add Finnish transaltion (thanks to Janne Mäntyharju) +- Add 'cursor_position' init() option for defining where the cursor should be when the editor is show on the first time ('auto' or 'begin'). This was like 'auto' before now this is like 'begin' by default +- better add_style method (faster than old one) thanks to Spellcoder +- Bug fix: fix bug with mootools 1.2 +- Bug fix: if page had no stylesheets when editarea load, it would generate an error + +**** v 0.7.2.3 **** +- it's now released under both LGPL, Apache, BSD license (you can use the one you prefer) +- add support for bonEcho browser + **** v 0.7.2.2 **** - Fix bug regression introduced in 0.7.2 that make IE7 not working - add Esperento translation (thanks to Olivier) diff --git a/www/extras/editarea/docs/about.html b/www/extras/editarea/docs/about.html index 5df27abec..c854b5e9f 100644 --- a/www/extras/editarea/docs/about.html +++ b/www/extras/editarea/docs/about.html @@ -1,48 +1,49 @@ - - - - - EditArea documentation - - - - -
-

About

-
-
-

General information

-

EditArea is a free javascript editor for source code. It allow to write - well formated source code. That's no way a WYSIWYG editor. -

-

- EditArea is developed by Christophe Dolivet - (contact) - and is currently released - under the "LGPL" license, read the license agreement for details. -

-

Features

- - -
- - - + + + + + EditArea documentation + + + + +
+

About

+
+
+

General information

+

EditArea is a free javascript editor for source code. It allow to write + well formated source code. That's no way a WYSIWYG editor. +

+

+ EditArea is developed by Christophe Dolivet + and is currently released + under the "LGPL", "Apache" and "BSD" licenses (use the one you want), read the licenses agreement for details. +

+

Features

+ + +
+ + + diff --git a/www/extras/editarea/docs/compatibility.html b/www/extras/editarea/docs/compatibility.html index c34c24981..996acee91 100644 --- a/www/extras/editarea/docs/compatibility.html +++ b/www/extras/editarea/docs/compatibility.html @@ -19,7 +19,7 @@ The table was reset to only show the browsers I take care of.

-

Since I have no mac, I can't make test for safari, neither testing multi-plateform browsers. +

Since I have no mac and currently have no computer under linux, I can't testing multi-plateform browsers. Let me know if you constat that such browsers are working.

@@ -31,31 +31,31 @@ MacOS X - MSIE 7 & 6 + MSIE 6 & 7 & 8 OK     - Firefox 3 & 2 & 1.5 + Firefox 1.5 & 2 & 3 OK OK OK - Safari 3.0 & 3.1 + Safari 3.0 & 3.1 & 4 OK   OK - Chrome + Chrome 1 & 2 OK ??? ??? - Opera 9 & 9.5 + Opera 9 & 9.6 OK OK OK @@ -83,7 +83,7 @@

diff --git a/www/extras/editarea/docs/configuration.html b/www/extras/editarea/docs/configuration.html index eec35c739..e4678d510 100644 --- a/www/extras/editarea/docs/configuration.html +++ b/www/extras/editarea/docs/configuration.html @@ -73,10 +73,10 @@
Default: "onload"
  • toolbar: define the toolbar that will be displayed, each element being separated by a ",". -
    Type: String (combinaison of: "|", "*", "search", "go_to_line", "undo", "redo", "change_smooth_selection", "reset_highlight", "highlight", "help", "save", "load", "new_document", "syntax_selection") +
    Type: String (combinaison of: "|", "*", "search", "go_to_line", "undo", "redo", "change_smooth_selection", "reset_highlight", "highlight", "word_wrap", "help", "save", "load", "new_document", "syntax_selection")
    "|" or "separator" make appears a separator in the toolbar.
    "*" or "return" make appears a line-break in the toolbar -
    Default: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, |, help" +
    Default: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help"
  • begin_toolbar: toolbar button list to add before the toolbar defined by the "toolbar" option.
    Type: String (cf. "toolbar" option) @@ -94,6 +94,9 @@
    Type: String
    Default: "monospace"
  • +
  • cursor_position: define if the cursor should be placed where it was in the textarea before replacement (auto) or at the beginning of the file (begin). +
    Type: String ("begin" or "auto") +
    Default: "begin"
  • gecko_spellcheck: allow to disable/enable the Firefox 2 spellchecker
    Type: Boolean @@ -112,6 +115,11 @@
    Type: Boolean
    Default: true
  • +
  • word_wrap: determine if the text will be automatically wrapped to the next line when it reach the end of a line. This is linked ot the word_wrap icon available in the toolbar. + +
    Type: Boolean +
    Default: false +
  • replace_tab_by_spaces: define the number of spaces that will replace tabulations (\t) in text. If tabulation should stay tabulation, set this option to false.
    Type: Integer (or false)
    Default: false @@ -209,7 +217,7 @@ editAreaLoader.init({ diff --git a/www/extras/editarea/docs/credits.html b/www/extras/editarea/docs/credits.html index d71b136c3..9a293bec7 100644 --- a/www/extras/editarea/docs/credits.html +++ b/www/extras/editarea/docs/credits.html @@ -27,21 +27,25 @@
  • Donation @@ -64,7 +69,7 @@ diff --git a/www/extras/editarea/docs/customization_language.html b/www/extras/editarea/docs/customization_language.html index b72d9a3a2..ccfc6cf2b 100644 --- a/www/extras/editarea/docs/customization_language.html +++ b/www/extras/editarea/docs/customization_language.html @@ -58,7 +58,7 @@ test_but: "test button" diff --git a/www/extras/editarea/docs/customization_plugin.html b/www/extras/editarea/docs/customization_plugin.html index bc294ffc3..5180fbcce 100644 --- a/www/extras/editarea/docs/customization_plugin.html +++ b/www/extras/editarea/docs/customization_plugin.html @@ -168,7 +168,7 @@ editArea.add_plugin("test", EditArea_ - +
    diff --git a/www/extras/editarea/docs/customization_syntax.html b/www/extras/editarea/docs/customization_syntax.html index 2b0d70fd8..472411b92 100644 --- a/www/extras/editarea/docs/customization_syntax.html +++ b/www/extras/editarea/docs/customization_syntax.html @@ -132,7 +132,7 @@ diff --git a/www/extras/editarea/docs/include.html b/www/extras/editarea/docs/include.html index 369bf8506..e04051146 100644 --- a/www/extras/editarea/docs/include.html +++ b/www/extras/editarea/docs/include.html @@ -152,7 +152,7 @@ diff --git a/www/extras/editarea/docs/index.html b/www/extras/editarea/docs/index.html index 2a7e02a26..fb9d27fa5 100644 --- a/www/extras/editarea/docs/index.html +++ b/www/extras/editarea/docs/index.html @@ -29,12 +29,12 @@
  • Compatibility chart
  • Credits
  • -
  • License
  • +
  • Licenses
  • diff --git a/www/extras/editarea/docs/installation.html b/www/extras/editarea/docs/installation.html index 803551614..cfbb9a7ec 100644 --- a/www/extras/editarea/docs/installation.html +++ b/www/extras/editarea/docs/installation.html @@ -96,14 +96,12 @@ body, html{ Here is an example of EditArea possibilities: Full exemple.

    - If you have any problems, you could contact me on - my website. Just be sure you've read the documentation before...

    diff --git a/www/extras/editarea/docs/javascript_functions.html b/www/extras/editarea/docs/javascript_functions.html index 9eb30d4c9..1a1f5c12d 100644 --- a/www/extras/editarea/docs/javascript_functions.html +++ b/www/extras/editarea/docs/javascript_functions.html @@ -1 +1 @@ - EditArea documentation

    Javascript Functions

    This is for advanced users. The object editAreaLoader has some public functions that can be called from the page in order to manage the EditArea editors.

    editAreaLoader.getValue(editor_id)

    This method return the content text of the editor. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea

    Returns: the content text of the editor. String

    editAreaLoader.setValue(editor_id, new_text)

    This method allow to update the content text of an editor. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    new_text The new text that will replace the Editor content.

    Returns: Nothing.

    editAreaLoader.insertTags(editor_id, open_tag, close_tag)

    This method allow to insert tags at the current position. If no text was selected, the cursor is then displayed between the open and the close tags. Otherwise, the cursor is positionned after the close tag. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    open_tag The open tag string.
    close_tag The close tag string.

    Returns: Nothing.

    editAreaLoader.getSelectedText(editor_id)

    This method return the text contained in the the selection range. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea

    Returns: The text contained in the the selection range. String

    editAreaLoader.setSelectedText(editor_id, new_text)

    This method allow to replace the text contained in the selection range with a given string. The selection range will then contain the new string. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    new_text The string that will replace the current selected text.

    Returns: Nothing.

    editAreaLoader.getSelectionRange(editor_id)

    This method return the position start and position end of the selection range in the editor. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea

    Returns: An array containing the index of the selection start and end. Array("start", "end")

    editAreaLoader.setSelectionRange(editor_id, new_start, new_end)

    This method allow to set the selection range with the given start and end positions. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    new_start The character position determining the start of the selection range.
    new_end The character position determining the end of the selection range.

    Returns: Nothing.

    editAreaLoader.execCommand(editor_id, command, command_param)

    Allow to access to EditArea functions and datas (for advanced users only).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    command The function or the parameter of the EditArea object that will be returned.
    command_param (optionnal) If command is a function, the you can pass one parameter to the function with command_param

    Returns: the value of the executed command or data. unknown

    Examples
    Change edit mode

    Allow to toggle EditArea etit mode from normal edition to readonly with no toolbars.

    editAreaLoader.execCommand('editor_id', 'set_editable', !editAreaLoader.execCommand('editor_id', 'is_editable'));
    Insert tags

    Insert tags arround selected text or at current cursor position if not text is selected

    editAreaLoader.insertTags('editor_id', "[OPEN]", "[CLOSE]");

    editAreaLoader.delete_instance(editor_id)

    Delete an instance of EditArea and restore simple textarea.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: Nothing.

    editAreaLoader.hide(editor_id)

    Hide a textarea and it's related EditArea.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: Nothing.

    editAreaLoader.show(editor_id)

    Restore a textarea and it's related EditArea hidden with the hide() function.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: Nothing.

    editAreaLoader.openFile(editor_id, file_infos)

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_infos An object containing datas of the file that will be openned. Here are the main fields (for the other possible fields see the returned Object of the getFile function):
    • id : (required) A string that will identify the file. it's the only required field.
      Type: String
    • title : (optionnal) The title that will be displayed in the tab area.
      Type: String
      Default: set with the id field value
    • text : (optionnal) The text content of the file.
      Type: String
      Default: ""
    • syntax : (optionnal) The syntax to use for this file.
      Type: String
      Default: ""
    • do_highlight : (optionnal) Set if the file should start highlighted or not
      Type: String
      Default: ""

    Returns: Nothing.

    editAreaLoader.getCurrentFile(editor_id)

    Return datas of the currently selected file (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: An object containing datas related to the file.Object

    editAreaLoader.getFile(editor_id, file_id)

    Return datas of the file identified by file_id (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_id The id of the file to close.

    Returns: An object containing datas related to the file.Object

    editAreaLoader.getAllFiles(editor_id)

    Return datas of all the currently openned files (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: An object containing datas of each files.Object

    editAreaLoader.closeFile(editor_id, file_id)

    Close the file identified by file_id (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_id The id of the file to close.

    Returns: Nothing.

    editAreaLoader.setFileEditedMode(editor_id, file_id, edited_mode)

    Define is the file should appears as edited or not.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_id The id of the file to close.
    edited_mode A boolean that indicate if the file should be set edited or not edited.

    Returns: Nothing.

    \ No newline at end of file + EditArea documentation

    Javascript Functions

    This is for advanced users. The object editAreaLoader has some public functions that can be called from the page in order to manage the EditArea editors.

    editAreaLoader.getValue(editor_id)

    This method return the content text of the editor. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea

    Returns: the content text of the editor. String

    editAreaLoader.setValue(editor_id, new_text)

    This method allow to update the content text of an editor. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    new_text The new text that will replace the Editor content.

    Returns: Nothing.

    editAreaLoader.insertTags(editor_id, open_tag, close_tag)

    This method allow to insert tags at the current position. If no text was selected, the cursor is then displayed between the open and the close tags. Otherwise, the cursor is positionned after the close tag. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    open_tag The open tag string.
    close_tag The close tag string.

    Returns: Nothing.

    editAreaLoader.getSelectedText(editor_id)

    This method return the text contained in the the selection range. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea

    Returns: The text contained in the the selection range. String

    editAreaLoader.setSelectedText(editor_id, new_text)

    This method allow to replace the text contained in the selection range with a given string. The selection range will then contain the new string. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    new_text The string that will replace the current selected text.

    Returns: Nothing.

    editAreaLoader.getSelectionRange(editor_id)

    This method return the position start and position end of the selection range in the editor. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea

    Returns: An array containing the index of the selection start and end. Array("start", "end")

    editAreaLoader.setSelectionRange(editor_id, new_start, new_end)

    This method allow to set the selection range with the given start and end positions. Works on normal textarea if the EditArea is toggled off.

    Parameters
    editor_id The id of the converted textarea
    new_start The character position determining the start of the selection range.
    new_end The character position determining the end of the selection range.

    Returns: Nothing.

    editAreaLoader.execCommand(editor_id, command, command_param)

    Allow to access to EditArea functions and datas (for advanced users only).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    command The function or the parameter of the EditArea object that will be returned.
    command_param (optionnal) If command is a function, the you can pass one parameter to the function with command_param

    Returns: the value of the executed command or data. unknown

    Examples
    Change edit mode

    Allow to toggle EditArea etit mode from normal edition to readonly with no toolbars.

    editAreaLoader.execCommand('editor_id', 'set_editable', !editAreaLoader.execCommand('editor_id', 'is_editable'));
    Insert tags

    Insert tags arround selected text or at current cursor position if not text is selected

    editAreaLoader.insertTags('editor_id', "[OPEN]", "[CLOSE]");

    editAreaLoader.delete_instance(editor_id)

    Delete an instance of EditArea and restore simple textarea.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: Nothing.

    editAreaLoader.hide(editor_id)

    Hide a textarea and it's related EditArea.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: Nothing.

    editAreaLoader.show(editor_id)

    Restore a textarea and it's related EditArea hidden with the hide() function.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: Nothing.

    editAreaLoader.openFile(editor_id, file_infos)

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_infos An object containing datas of the file that will be openned. Here are the main fields (for the other possible fields see the returned Object of the getFile function):
    • id : (required) A string that will identify the file. it's the only required field.
      Type: String
    • title : (optionnal) The title that will be displayed in the tab area.
      Type: String
      Default: set with the id field value
    • text : (optionnal) The text content of the file.
      Type: String
      Default: ""
    • syntax : (optionnal) The syntax to use for this file.
      Type: String
      Default: ""
    • do_highlight : (optionnal) Set if the file should start highlighted or not
      Type: String
      Default: ""

    Returns: Nothing.

    editAreaLoader.getCurrentFile(editor_id)

    Return datas of the currently selected file (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: An object containing datas related to the file.Object

    editAreaLoader.getFile(editor_id, file_id)

    Return datas of the file identified by file_id (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_id The id of the file to close.

    Returns: An object containing datas related to the file.Object

    editAreaLoader.getAllFiles(editor_id)

    Return datas of all the currently openned files (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.

    Returns: An object containing datas of each files.Object

    editAreaLoader.closeFile(editor_id, file_id)

    Close the file identified by file_id (for multi file editing mode).

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_id The id of the file to close.

    Returns: Nothing.

    editAreaLoader.setFileEditedMode(editor_id, file_id, edited_mode)

    Define is the file should appears as edited or not.

    Parameters
    editor_id The id of the converted textarea on which the command should be executed.
    file_id The id of the file to close.
    edited_mode A boolean that indicate if the file should be set edited or not edited.

    Returns: Nothing.

    \ No newline at end of file diff --git a/www/extras/editarea/docs/license.html b/www/extras/editarea/docs/license.html index 3f5fcbe01..9b7268a50 100644 --- a/www/extras/editarea/docs/license.html +++ b/www/extras/editarea/docs/license.html @@ -7,477 +7,41 @@ +
    +

    EditArea licenses

    +
    +
    +

    + EditArea is released under "LGPL", "Apache" and "BSD" licenses, which mean that you can use EditArea if you follow at least one of thoses licenses. +

    +
    -

    EditArea license (LGPL)

    +

    LGPL

    - Visit http://www.fsf.org for more information about Open-Source licenses. -

    -
    -		  GNU LESSER GENERAL PUBLIC LICENSE
    -		       Version 2.1, February 1999
    -
    - Copyright (C) 1991, 1999 Free Software Foundation, Inc.
    - 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    - Everyone is permitted to copy and distribute verbatim copies
    - of this license document, but changing it is not allowed.
    -
    -[This is the first released version of the Lesser GPL.  It also counts
    - as the successor of the GNU Library Public License, version 2, hence
    - the version number 2.1.]
    -
    -			    Preamble
    -
    -  The licenses for most software are designed to take away your
    -freedom to share and change it.  By contrast, the GNU General Public
    -Licenses are intended to guarantee your freedom to share and change
    -free software--to make sure the software is free for all its users.
    -
    -  This license, the Lesser General Public License, applies to some
    -specially designated software packages--typically libraries--of the
    -Free Software Foundation and other authors who decide to use it.  You
    -can use it too, but we suggest you first think carefully about whether
    -this license or the ordinary General Public License is the better
    -strategy to use in any particular case, based on the explanations below.
    -
    -  When we speak of free software, we are referring to freedom of use,
    -not price.  Our General Public Licenses are designed to make sure that
    -you have the freedom to distribute copies of free software (and charge
    -for this service if you wish); that you receive source code or can get
    -it if you want it; that you can change the software and use pieces of
    -it in new free programs; and that you are informed that you can do
    -these things.
    -
    -  To protect your rights, we need to make restrictions that forbid
    -distributors to deny you these rights or to ask you to surrender these
    -rights.  These restrictions translate to certain responsibilities for
    -you if you distribute copies of the library or if you modify it.
    -
    -  For example, if you distribute copies of the library, whether gratis
    -or for a fee, you must give the recipients all the rights that we gave
    -you.  You must make sure that they, too, receive or can get the source
    -code.  If you link other code with the library, you must provide
    -complete object files to the recipients, so that they can relink them
    -with the library after making changes to the library and recompiling
    -it.  And you must show them these terms so they know their rights.
    -
    -  We protect your rights with a two-step method: (1) we copyright the
    -library, and (2) we offer you this license, which gives you legal
    -permission to copy, distribute and/or modify the library.
    -
    -  To protect each distributor, we want to make it very clear that
    -there is no warranty for the free library.  Also, if the library is
    -modified by someone else and passed on, the recipients should know
    -that what they have is not the original version, so that the original
    -author's reputation will not be affected by problems that might be
    -introduced by others.
    -
    -  Finally, software patents pose a constant threat to the existence of
    -any free program.  We wish to make sure that a company cannot
    -effectively restrict the users of a free program by obtaining a
    -restrictive license from a patent holder.  Therefore, we insist that
    -any patent license obtained for a version of the library must be
    -consistent with the full freedom of use specified in this license.
    -
    -  Most GNU software, including some libraries, is covered by the
    -ordinary GNU General Public License.  This license, the GNU Lesser
    -General Public License, applies to certain designated libraries, and
    -is quite different from the ordinary General Public License.  We use
    -this license for certain libraries in order to permit linking those
    -libraries into non-free programs.
    -
    -  When a program is linked with a library, whether statically or using
    -a shared library, the combination of the two is legally speaking a
    -combined work, a derivative of the original library.  The ordinary
    -General Public License therefore permits such linking only if the
    -entire combination fits its criteria of freedom.  The Lesser General
    -Public License permits more lax criteria for linking other code with
    -the library.
    -
    -  We call this license the "Lesser" General Public License because it
    -does Less to protect the user's freedom than the ordinary General
    -Public License.  It also provides other free software developers Less
    -of an advantage over competing non-free programs.  These disadvantages
    -are the reason we use the ordinary General Public License for many
    -libraries.  However, the Lesser license provides advantages in certain
    -special circumstances.
    -
    -  For example, on rare occasions, there may be a special need to
    -encourage the widest possible use of a certain library, so that it becomes
    -a de-facto standard.  To achieve this, non-free programs must be
    -allowed to use the library.  A more frequent case is that a free
    -library does the same job as widely used non-free libraries.  In this
    -case, there is little to gain by limiting the free library to free
    -software only, so we use the Lesser General Public License.
    -
    -  In other cases, permission to use a particular library in non-free
    -programs enables a greater number of people to use a large body of
    -free software.  For example, permission to use the GNU C Library in
    -non-free programs enables many more people to use the whole GNU
    -operating system, as well as its variant, the GNU/Linux operating
    -system.
    -
    -  Although the Lesser General Public License is Less protective of the
    -users' freedom, it does ensure that the user of a program that is
    -linked with the Library has the freedom and the wherewithal to run
    -that program using a modified version of the Library.
    -
    -  The precise terms and conditions for copying, distribution and
    -modification follow.  Pay close attention to the difference between a
    -"work based on the library" and a "work that uses the library".  The
    -former contains code derived from the library, whereas the latter must
    -be combined with the library in order to run.
    -
    -		  GNU LESSER GENERAL PUBLIC LICENSE
    -   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    -
    -  0. This License Agreement applies to any software library or other
    -program which contains a notice placed by the copyright holder or
    -other authorized party saying it may be distributed under the terms of
    -this Lesser General Public License (also called "this License").
    -Each licensee is addressed as "you".
    -
    -  A "library" means a collection of software functions and/or data
    -prepared so as to be conveniently linked with application programs
    -(which use some of those functions and data) to form executables.
    -
    -  The "Library", below, refers to any such software library or work
    -which has been distributed under these terms.  A "work based on the
    -Library" means either the Library or any derivative work under
    -copyright law: that is to say, a work containing the Library or a
    -portion of it, either verbatim or with modifications and/or translated
    -straightforwardly into another language.  (Hereinafter, translation is
    -included without limitation in the term "modification".)
    -
    -  "Source code" for a work means the preferred form of the work for
    -making modifications to it.  For a library, complete source code means
    -all the source code for all modules it contains, plus any associated
    -interface definition files, plus the scripts used to control compilation
    -and installation of the library.
    -
    -  Activities other than copying, distribution and modification are not
    -covered by this License; they are outside its scope.  The act of
    -running a program using the Library is not restricted, and output from
    -such a program is covered only if its contents constitute a work based
    -on the Library (independent of the use of the Library in a tool for
    -writing it).  Whether that is true depends on what the Library does
    -and what the program that uses the Library does.
    -  
    -  1. You may copy and distribute verbatim copies of the Library's
    -complete source code as you receive it, in any medium, provided that
    -you conspicuously and appropriately publish on each copy an
    -appropriate copyright notice and disclaimer of warranty; keep intact
    -all the notices that refer to this License and to the absence of any
    -warranty; and distribute a copy of this License along with the
    -Library.
    -
    -  You may charge a fee for the physical act of transferring a copy,
    -and you may at your option offer warranty protection in exchange for a
    -fee.
    -
    -  2. You may modify your copy or copies of the Library or any portion
    -of it, thus forming a work based on the Library, and copy and
    -distribute such modifications or work under the terms of Section 1
    -above, provided that you also meet all of these conditions:
    -
    -    a) The modified work must itself be a software library.
    -
    -    b) You must cause the files modified to carry prominent notices
    -    stating that you changed the files and the date of any change.
    -
    -    c) You must cause the whole of the work to be licensed at no
    -    charge to all third parties under the terms of this License.
    -
    -    d) If a facility in the modified Library refers to a function or a
    -    table of data to be supplied by an application program that uses
    -    the facility, other than as an argument passed when the facility
    -    is invoked, then you must make a good faith effort to ensure that,
    -    in the event an application does not supply such function or
    -    table, the facility still operates, and performs whatever part of
    -    its purpose remains meaningful.
    -
    -    (For example, a function in a library to compute square roots has
    -    a purpose that is entirely well-defined independent of the
    -    application.  Therefore, Subsection 2d requires that any
    -    application-supplied function or table used by this function must
    -    be optional: if the application does not supply it, the square
    -    root function must still compute square roots.)
    -
    -These requirements apply to the modified work as a whole.  If
    -identifiable sections of that work are not derived from the Library,
    -and can be reasonably considered independent and separate works in
    -themselves, then this License, and its terms, do not apply to those
    -sections when you distribute them as separate works.  But when you
    -distribute the same sections as part of a whole which is a work based
    -on the Library, the distribution of the whole must be on the terms of
    -this License, whose permissions for other licensees extend to the
    -entire whole, and thus to each and every part regardless of who wrote
    -it.
    -
    -Thus, it is not the intent of this section to claim rights or contest
    -your rights to work written entirely by you; rather, the intent is to
    -exercise the right to control the distribution of derivative or
    -collective works based on the Library.
    -
    -In addition, mere aggregation of another work not based on the Library
    -with the Library (or with a work based on the Library) on a volume of
    -a storage or distribution medium does not bring the other work under
    -the scope of this License.
    -
    -  3. You may opt to apply the terms of the ordinary GNU General Public
    -License instead of this License to a given copy of the Library.  To do
    -this, you must alter all the notices that refer to this License, so
    -that they refer to the ordinary GNU General Public License, version 2,
    -instead of to this License.  (If a newer version than version 2 of the
    -ordinary GNU General Public License has appeared, then you can specify
    -that version instead if you wish.)  Do not make any other change in
    -these notices.
    -
    -  Once this change is made in a given copy, it is irreversible for
    -that copy, so the ordinary GNU General Public License applies to all
    -subsequent copies and derivative works made from that copy.
    -
    -  This option is useful when you wish to copy part of the code of
    -the Library into a program that is not a library.
    -
    -  4. You may copy and distribute the Library (or a portion or
    -derivative of it, under Section 2) in object code or executable form
    -under the terms of Sections 1 and 2 above provided that you accompany
    -it with the complete corresponding machine-readable source code, which
    -must be distributed under the terms of Sections 1 and 2 above on a
    -medium customarily used for software interchange.
    -
    -  If distribution of object code is made by offering access to copy
    -from a designated place, then offering equivalent access to copy the
    -source code from the same place satisfies the requirement to
    -distribute the source code, even though third parties are not
    -compelled to copy the source along with the object code.
    -
    -  5. A program that contains no derivative of any portion of the
    -Library, but is designed to work with the Library by being compiled or
    -linked with it, is called a "work that uses the Library".  Such a
    -work, in isolation, is not a derivative work of the Library, and
    -therefore falls outside the scope of this License.
    -
    -  However, linking a "work that uses the Library" with the Library
    -creates an executable that is a derivative of the Library (because it
    -contains portions of the Library), rather than a "work that uses the
    -library".  The executable is therefore covered by this License.
    -Section 6 states terms for distribution of such executables.
    -
    -  When a "work that uses the Library" uses material from a header file
    -that is part of the Library, the object code for the work may be a
    -derivative work of the Library even though the source code is not.
    -Whether this is true is especially significant if the work can be
    -linked without the Library, or if the work is itself a library.  The
    -threshold for this to be true is not precisely defined by law.
    -
    -  If such an object file uses only numerical parameters, data
    -structure layouts and accessors, and small macros and small inline
    -functions (ten lines or less in length), then the use of the object
    -file is unrestricted, regardless of whether it is legally a derivative
    -work.  (Executables containing this object code plus portions of the
    -Library will still fall under Section 6.)
    -
    -  Otherwise, if the work is a derivative of the Library, you may
    -distribute the object code for the work under the terms of Section 6.
    -Any executables containing that work also fall under Section 6,
    -whether or not they are linked directly with the Library itself.
    -
    -  6. As an exception to the Sections above, you may also combine or
    -link a "work that uses the Library" with the Library to produce a
    -work containing portions of the Library, and distribute that work
    -under terms of your choice, provided that the terms permit
    -modification of the work for the customer's own use and reverse
    -engineering for debugging such modifications.
    -
    -  You must give prominent notice with each copy of the work that the
    -Library is used in it and that the Library and its use are covered by
    -this License.  You must supply a copy of this License.  If the work
    -during execution displays copyright notices, you must include the
    -copyright notice for the Library among them, as well as a reference
    -directing the user to the copy of this License.  Also, you must do one
    -of these things:
    -
    -    a) Accompany the work with the complete corresponding
    -    machine-readable source code for the Library including whatever
    -    changes were used in the work (which must be distributed under
    -    Sections 1 and 2 above); and, if the work is an executable linked
    -    with the Library, with the complete machine-readable "work that
    -    uses the Library", as object code and/or source code, so that the
    -    user can modify the Library and then relink to produce a modified
    -    executable containing the modified Library.  (It is understood
    -    that the user who changes the contents of definitions files in the
    -    Library will not necessarily be able to recompile the application
    -    to use the modified definitions.)
    -
    -    b) Use a suitable shared library mechanism for linking with the
    -    Library.  A suitable mechanism is one that (1) uses at run time a
    -    copy of the library already present on the user's computer system,
    -    rather than copying library functions into the executable, and (2)
    -    will operate properly with a modified version of the library, if
    -    the user installs one, as long as the modified version is
    -    interface-compatible with the version that the work was made with.
    -
    -    c) Accompany the work with a written offer, valid for at
    -    least three years, to give the same user the materials
    -    specified in Subsection 6a, above, for a charge no more
    -    than the cost of performing this distribution.
    -
    -    d) If distribution of the work is made by offering access to copy
    -    from a designated place, offer equivalent access to copy the above
    -    specified materials from the same place.
    -
    -    e) Verify that the user has already received a copy of these
    -    materials or that you have already sent this user a copy.
    -
    -  For an executable, the required form of the "work that uses the
    -Library" must include any data and utility programs needed for
    -reproducing the executable from it.  However, as a special exception,
    -the materials to be distributed need not include anything that is
    -normally distributed (in either source or binary form) with the major
    -components (compiler, kernel, and so on) of the operating system on
    -which the executable runs, unless that component itself accompanies
    -the executable.
    -
    -  It may happen that this requirement contradicts the license
    -restrictions of other proprietary libraries that do not normally
    -accompany the operating system.  Such a contradiction means you cannot
    -use both them and the Library together in an executable that you
    -distribute.
    -
    -  7. You may place library facilities that are a work based on the
    -Library side-by-side in a single library together with other library
    -facilities not covered by this License, and distribute such a combined
    -library, provided that the separate distribution of the work based on
    -the Library and of the other library facilities is otherwise
    -permitted, and provided that you do these two things:
    -
    -    a) Accompany the combined library with a copy of the same work
    -    based on the Library, uncombined with any other library
    -    facilities.  This must be distributed under the terms of the
    -    Sections above.
    -
    -    b) Give prominent notice with the combined library of the fact
    -    that part of it is a work based on the Library, and explaining
    -    where to find the accompanying uncombined form of the same work.
    -
    -  8. You may not copy, modify, sublicense, link with, or distribute
    -the Library except as expressly provided under this License.  Any
    -attempt otherwise to copy, modify, sublicense, link with, or
    -distribute the Library is void, and will automatically terminate your
    -rights under this License.  However, parties who have received copies,
    -or rights, from you under this License will not have their licenses
    -terminated so long as such parties remain in full compliance.
    -
    -  9. You are not required to accept this License, since you have not
    -signed it.  However, nothing else grants you permission to modify or
    -distribute the Library or its derivative works.  These actions are
    -prohibited by law if you do not accept this License.  Therefore, by
    -modifying or distributing the Library (or any work based on the
    -Library), you indicate your acceptance of this License to do so, and
    -all its terms and conditions for copying, distributing or modifying
    -the Library or works based on it.
    -
    -  10. Each time you redistribute the Library (or any work based on the
    -Library), the recipient automatically receives a license from the
    -original licensor to copy, distribute, link with or modify the Library
    -subject to these terms and conditions.  You may not impose any further
    -restrictions on the recipients' exercise of the rights granted herein.
    -You are not responsible for enforcing compliance by third parties with
    -this License.
    -
    -  11. If, as a consequence of a court judgment or allegation of patent
    -infringement or for any other reason (not limited to patent issues),
    -conditions are imposed on you (whether by court order, agreement or
    -otherwise) that contradict the conditions of this License, they do not
    -excuse you from the conditions of this License.  If you cannot
    -distribute so as to satisfy simultaneously your obligations under this
    -License and any other pertinent obligations, then as a consequence you
    -may not distribute the Library at all.  For example, if a patent
    -license would not permit royalty-free redistribution of the Library by
    -all those who receive copies directly or indirectly through you, then
    -the only way you could satisfy both it and this License would be to
    -refrain entirely from distribution of the Library.
    -
    -If any portion of this section is held invalid or unenforceable under any
    -particular circumstance, the balance of the section is intended to apply,
    -and the section as a whole is intended to apply in other circumstances.
    -
    -It is not the purpose of this section to induce you to infringe any
    -patents or other property right claims or to contest validity of any
    -such claims; this section has the sole purpose of protecting the
    -integrity of the free software distribution system which is
    -implemented by public license practices.  Many people have made
    -generous contributions to the wide range of software distributed
    -through that system in reliance on consistent application of that
    -system; it is up to the author/donor to decide if he or she is willing
    -to distribute software through any other system and a licensee cannot
    -impose that choice.
    -
    -This section is intended to make thoroughly clear what is believed to
    -be a consequence of the rest of this License.
    -
    -  12. If the distribution and/or use of the Library is restricted in
    -certain countries either by patents or by copyrighted interfaces, the
    -original copyright holder who places the Library under this License may add
    -an explicit geographical distribution limitation excluding those countries,
    -so that distribution is permitted only in or among countries not thus
    -excluded.  In such case, this License incorporates the limitation as if
    -written in the body of this License.
    -
    -  13. The Free Software Foundation may publish revised and/or new
    -versions of the Lesser General Public License from time to time.
    -Such new versions will be similar in spirit to the present version,
    -but may differ in detail to address new problems or concerns.
    -
    -Each version is given a distinguishing version number.  If the Library
    -specifies a version number of this License which applies to it and
    -"any later version", you have the option of following the terms and
    -conditions either of that version or of any later version published by
    -the Free Software Foundation.  If the Library does not specify a
    -license version number, you may choose any version ever published by
    -the Free Software Foundation.
    -
    -  14. If you wish to incorporate parts of the Library into other free
    -programs whose distribution conditions are incompatible with these,
    -write to the author to ask for permission.  For software which is
    -copyrighted by the Free Software Foundation, write to the Free
    -Software Foundation; we sometimes make exceptions for this.  Our
    -decision will be guided by the two goals of preserving the free status
    -of all derivatives of our free software and of promoting the sharing
    -and reuse of software generally.
    -
    -			    NO WARRANTY
    -
    -  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
    -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
    -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
    -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
    -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
    -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    -PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
    -LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
    -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
    -
    -  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
    -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
    -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
    -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
    -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
    -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
    -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
    -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
    -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    -DAMAGES.
    -
    -		     END OF TERMS AND CONDITIONS
    -		
    + Visit http://www.gnu.org/copyleft/lesser.html for more information about LGPL license. +

    +
    +
    +

    BSD

    +
    +
    +

    + Visit http://www.opensource.org/licenses/bsd-license.php for more information about BSD license. +

    +
    +

    APACHE

    +
    +
    +

    + Visit http://www.apache.org/licenses/LICENSE-2.0 for more information about Apache license. +

    +
    diff --git a/www/extras/editarea/edit_area/autocompletion.js b/www/extras/editarea/edit_area/autocompletion.js index 29e3fb1eb..c5d646a33 100644 --- a/www/extras/editarea/edit_area/autocompletion.js +++ b/www/extras/editarea/edit_area/autocompletion.js @@ -74,8 +74,8 @@ var EditArea_autocompletion= { editArea.container.insertBefore( this.container, editArea.container.firstChild ); // add event detection for hiding suggestion box - editArea.add_event( document, "click", function(){ editArea.plugins['autocompletion']._hide();} ); - editArea.add_event( editArea.textarea, "blur", function(){ editArea.plugins['autocompletion']._hide();} ); + parent.editAreaLoader.add_event( document, "click", function(){ editArea.plugins['autocompletion']._hide();} ); + parent.editAreaLoader.add_event( editArea.textarea, "blur", function(){ editArea.plugins['autocompletion']._hide();} ); } @@ -140,7 +140,7 @@ var EditArea_autocompletion= { // show current suggestion list and do autoSelect if possible (no matter it's shown or hidden) if( letter=="Space" && CtrlPressed(e) ) { - parent.console.log('SHOW SUGGEST'); + //parent.console.log('SHOW SUGGEST'); this.forceDisplay = true; this.autoSelectIfOneResult = true; this._checkLetter(); @@ -251,8 +251,7 @@ var EditArea_autocompletion= { { cursor_forced_position = content.indexOf( '{@}' ); content = content.replace(/{@}/g, '' ); - if(editArea.nav['isIE']) - editArea.getIESelection(); + editArea.getIESelection(); // retrive the number of matching characters var start_index = Math.max( 0, editArea.textarea.selectionEnd - content.length ); @@ -308,7 +307,7 @@ var EditArea_autocompletion= { tmp["match_word"]= new RegExp("(?:"+ datas["REGEXP"]["before_word"] +")("+ datas["REGEXP"]["possible_words_letters"] +")$", tmp["modifiers"]); tmp["match_next_letter"]= new RegExp("^("+ datas["REGEXP"]["letter_after_word_must_match"] +")$", tmp["modifiers"]); tmp["keywords"]= {}; - console.log( datas["KEYWORDS"] ); + //console.log( datas["KEYWORDS"] ); for( var prefix in datas["KEYWORDS"] ) { tmp["keywords"][prefix]= { @@ -352,19 +351,18 @@ var EditArea_autocompletion= { this._parseSyntaxAutoCompletionDatas(); this.curr_syntax= parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion']; this.curr_syntax_str = editArea.settings['syntax']; - console.log( this.curr_syntax ); + //console.log( this.curr_syntax ); } if( editArea.is_editable ) { time=new Date; t1= time.getTime(); - if(editArea.nav['isIE']) - editArea.getIESelection(); + editArea.getIESelection(); this.selectIndex = -1; start=editArea.textarea.selectionStart; var str = editArea.textarea.value; - var results= new Array(); + var results= []; for(var i in this.curr_syntax) @@ -385,7 +383,7 @@ var EditArea_autocompletion= { { var begin_word= match_word[1]; var match_curr_word= new RegExp("^"+ parent.editAreaLoader.get_escaped_regexp( begin_word ), this.curr_syntax[i]["modifiers"]); - console.log( match_curr_word ); + //console.log( match_curr_word ); for(var prefix in this.curr_syntax[i]["keywords"]) { // parent.console.log( this.curr_syntax[i]["keywords"][prefix] ); @@ -451,7 +449,7 @@ var EditArea_autocompletion= { // there is only one result, and we can select it automatically if( results.length == 1 && this.autoSelectIfOneResult ) { - console.log( results ); + // console.log( results ); this._select( results[0][1]['replace_with'] ); } else if( results.length == 0 ) @@ -473,7 +471,7 @@ var EditArea_autocompletion= { // sort results this.container.innerHTML = ''; - var cursor = $("cursor_pos"); + var cursor = _$("cursor_pos"); this.container.style.top = ( cursor.cursor_top + editArea.lineHeight ) +"px"; this.container.style.left = ( cursor.cursor_left + 8 ) +"px"; this._show(); diff --git a/www/extras/editarea/edit_area/edit_area.css b/www/extras/editarea/edit_area/edit_area.css index 2b96af9b2..172b366f2 100644 --- a/www/extras/editarea/edit_area/edit_area.css +++ b/www/extras/editarea/edit_area/edit_area.css @@ -13,7 +13,7 @@ body, html, table, form, textarea{ #editor{ border: solid #888 1px; - overflow: visible; + overflow: hidden; } #result{ @@ -51,6 +51,7 @@ body, html, table, form, textarea{ z-index: 7; border-width: 0; background-color: transparent; + resize: none; } #textarea, #textarea:hover{ @@ -67,10 +68,10 @@ body, html, table, form, textarea{ } -#selection_field{ +#selection_field, #selection_field_text{ margin: 0; background-color: #E1F2F9; - height: 1px; +/* height: 1px; */ position: absolute; z-index: 5; top: -100px; @@ -79,13 +80,35 @@ body, html, table, form, textarea{ overflow: hidden; } -#selection_field.show_colors{ +#selection_field.show_colors { z-index: 3; background-color:#EDF9FC; - color:transparent; + } -#container.wrap_text #content_highlight, #container.wrap_text #selection_field{ +#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; /* css-3 */ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ @@ -129,7 +152,7 @@ pre{ z-index:6; background-color: #FF6633; top: -100px; - margin: 1px 0 0 0; + margin: 0; } #result .edit_area_selection_field .overline{ diff --git a/www/extras/editarea/edit_area/edit_area.js b/www/extras/editarea/edit_area/edit_area.js index ac0c62daf..27674f675 100644 --- a/www/extras/editarea/edit_area/edit_area.js +++ b/www/extras/editarea/edit_area/edit_area.js @@ -2,168 +2,139 @@ * * EditArea * Developped by Christophe Dolivet - * Released under LGPL and Apache licenses + * Released under LGPL, Apache and BSD licenses (use the one you want) * ******/ function EditArea(){ - this.error= false; // to know if load is interrrupt + var t=this; + t.error= false; // to know if load is interrrupt - this.inlinePopup= new Array({popup_id: "area_search_replace", icon_id: "search"}, - {popup_id: "edit_area_help", icon_id: "help"}); - this.plugins= new Object(); + t.inlinePopup= [{popup_id: "area_search_replace", icon_id: "search"}, + {popup_id: "edit_area_help", icon_id: "help"}]; + t.plugins= {}; - this.line_number=0; + t.line_number=0; - this.nav=parent.editAreaLoader.nav; // navigator identification + parent.editAreaLoader.set_browser_infos(t); // navigator identification + // fix IE8 detection as we run in IE7 emulate mode through X-UA tag + if( t.isIE >= 8 ) + t.isIE = 7; - this.last_selection=new Object(); - this.last_text_to_highlight=""; - this.last_hightlighted_text= ""; - this.syntax_list= new Array(); - this.allready_used_syntax= new Object(); - this.check_line_selection_timer= 50; // the timer delay for modification and/or selection change detection + t.last_selection={}; + t.last_text_to_highlight=""; + t.last_hightlighted_text= ""; + t.syntax_list= []; + t.allready_used_syntax= {}; + t.check_line_selection_timer= 50; // the timer delay for modification and/or selection change detection - this.textareaFocused= false; - this.highlight_selection_line= null; - this.previous= new Array(); - this.next= new Array(); - this.last_undo=""; - this.files= new Object(); - this.filesIdAssoc= new Object(); - this.curr_file= ''; - //this.loaded= false; - this.assocBracket=new Object(); - this.revertAssocBracket= new Object(); + t.textareaFocused= false; + t.highlight_selection_line= null; + t.previous= []; + t.next= []; + t.last_undo=""; + t.files= {}; + t.filesIdAssoc= {}; + t.curr_file= ''; + //t.loaded= false; + t.assocBracket={}; + t.revertAssocBracket= {}; // bracket selection init - this.assocBracket["("]=")"; - this.assocBracket["{"]="}"; - this.assocBracket["["]="]"; - for(var index in this.assocBracket){ - this.revertAssocBracket[this.assocBracket[index]]=index; + t.assocBracket["("]=")"; + t.assocBracket["{"]="}"; + t.assocBracket["["]="]"; + for(var index in t.assocBracket){ + t.revertAssocBracket[t.assocBracket[index]]=index; } - this.is_editable= true; + t.is_editable= true; - /*this.textarea=""; + /*t.textarea=""; - this.state="declare"; - this.code = new Array(); // store highlight syntax for languagues*/ + t.state="declare"; + t.code = []; // store highlight syntax for languagues*/ // font datas - this.lineHeight= 16; - /*this.default_font_family= "monospace"; - this.default_font_size= 10;*/ - this.tab_nb_char= 8; //nb of white spaces corresponding to a tabulation - if(this.nav['isOpera']) - this.tab_nb_char= 6; + t.lineHeight= 16; + /*t.default_font_family= "monospace"; + t.default_font_size= 10;*/ + t.tab_nb_char= 8; //nb of white spaces corresponding to a tabulation + if(t.isOpera) + t.tab_nb_char= 6; - this.is_tabbing= false; + t.is_tabbing= false; - this.fullscreen= {'isFull': false}; + t.fullscreen= {'isFull': false}; - this.isResizing=false; // resize var + t.isResizing=false; // resize var - // init with settings and ID - this.id= area_id; - this.settings= editAreas[this.id]["settings"]; + // init with settings and ID (area_id is a global var defined by editAreaLoader on iframe creation + t.id= area_id; + t.settings= editAreas[t.id]["settings"]; - if((""+this.settings['replace_tab_by_spaces']).match(/^[0-9]+$/)) + if((""+t.settings['replace_tab_by_spaces']).match(/^[0-9]+$/)) { - this.tab_nb_char= this.settings['replace_tab_by_spaces']; - this.tabulation=""; - for(var i=0; i0) - this.syntax_list= this.settings["syntax_selection_allow"].replace(/ /g,"").split(","); + if(t.settings["syntax_selection_allow"] && t.settings["syntax_selection_allow"].length>0) + t.syntax_list= t.settings["syntax_selection_allow"].replace(/ /g,"").split(","); - if(this.settings['syntax']) - this.allready_used_syntax[this.settings['syntax']]=true; + if(t.settings['syntax']) + t.allready_used_syntax[t.settings['syntax']]=true; }; - - - //called by the toggle_on - EditArea.prototype.update_size= function(){ - - if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]==true){ - if(editArea.fullscreen['isFull']){ - parent.document.getElementById("frame_"+editArea.id).style.width= parent.document.getElementsByTagName("html")[0].clientWidth + "px"; - parent.document.getElementById("frame_"+editArea.id).style.height= parent.document.getElementsByTagName("html")[0].clientHeight + "px"; - } - - if(editArea.tab_browsing_area.style.display=='block' && !editArea.nav['isIE']) - { - editArea.tab_browsing_area.style.height= "0px"; - editArea.tab_browsing_area.style.height= (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px"; - } - - var height= document.body.offsetHeight - editArea.get_all_toolbar_height() - 4; - editArea.result.style.height= height +"px"; - - var width=document.body.offsetWidth -2; - editArea.result.style.width= width+"px"; - //alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight); - - // check that the popups don't get out of the screen - for(var i=0; imax_top) - popup.style.top= max_top+"px"; - if(popup.offsetLeft>max_left) - popup.style.left= max_left+"px"; - } - } - }; - EditArea.prototype.init= function(){ - this.textarea= $("textarea"); - this.container= $("container"); - this.result= $("result"); - this.content_highlight= $("content_highlight"); - this.selection_field= $("selection_field"); - this.processing_screen= $("processing"); - this.editor_area= $("editor"); - this.tab_browsing_area= $("tab_browsing_area"); + var t=this, a, s=t.settings; + t.textarea = _$("textarea"); + 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.textarea; - if(!this.settings['is_editable']) - this.set_editable(false); + if(!s['is_editable']) + t.set_editable(false); - this.set_show_line_colors( this.settings['show_line_colors'] ); + t.set_show_line_colors( s['show_line_colors'] ); - if(syntax_selec= $("syntax_selection")) + if(syntax_selec= _$("syntax_selection")) { // set up syntax selection lsit in the toolbar - for(var i=0; i= '3' ) - this.content_highlight.style.borderLeft= "solid 1px transparent"; + if( t.isFirefox >= '3' ) { + t.content_highlight.style.paddingLeft= "1px"; + t.selection_field.style.paddingLeft= "1px"; + t.selection_field_text.style.paddingLeft= "1px"; + } - if(this.nav['isIE']){ - this.textarea.style.marginTop= "-1px"; + if(t.isIE && t.isIE < 8 ){ + a.style.marginTop= "-1px"; } /* - if(this.nav['isOpera']){ - this.editor_area.style.position= "absolute"; + if(t.isOpera){ + t.editor_area.style.position= "absolute"; }*/ - if(this.nav['isSafari'] ){ - this.editor_area.style.position= "absolute"; - this.textarea.style.marginLeft="-3px"; - this.textarea.style.marginTop="1px"; - } - - if( this.nav['isChrome'] ){ - this.editor_area.style.position= "absolute"; - this.textarea.style.marginLeft="0px"; - this.textarea.style.marginTop="0px"; + if( t.isSafari ){ + t.editor_area.style.position = "absolute"; + a.style.marginLeft ="-3px"; + if( t.isSafari < 3.2 ) // Safari 3.0 (3.1?) + a.style.marginTop ="1px"; } // si le textarea n'est pas grand, un click sous le textarea doit provoquer un focus sur le textarea - parent.editAreaLoader.add_event(this.result, "click", function(e){ if((e.target || e.srcElement)==editArea.result) { editArea.area_select(editArea.textarea.value.length, 0);} }); + parent.editAreaLoader.add_event(t.result, "click", function(e){ if((e.target || e.srcElement)==editArea.result) { editArea.area_select(editArea.textarea.value.length, 0);} }); - if(this.settings['is_multi_files']!=false) - this.open_file({'id': this.curr_file, 'text': ''}); + if(s['is_multi_files']!=false) + t.open_file({'id': t.curr_file, 'text': ''}); - this.set_wrap_text( this.settings['wrap_text'] ); + t.set_word_wrap( s['word_wrap'] ); setTimeout("editArea.focus();editArea.manage_size();editArea.execCommand('EA_load');", 10); //start checkup routine - this.check_undo(); - this.check_line_selection(true); - this.scroll_to_view(); + t.check_undo(); + t.check_line_selection(true); + t.scroll_to_view(); - for(var i in this.plugins){ - if(typeof(this.plugins[i].onload)=="function") - this.plugins[i].onload(); + for(var i in t.plugins){ + if(typeof(t.plugins[i].onload)=="function") + t.plugins[i].onload(); } - if(this.settings['fullscreen']==true) - this.toggle_full_screen(true); + if(s['fullscreen']==true) + t.toggle_full_screen(true); parent.editAreaLoader.add_event(window, "resize", editArea.update_size); parent.editAreaLoader.add_event(parent.window, "resize", editArea.update_size); parent.editAreaLoader.add_event(top.window, "resize", editArea.update_size); - parent.editAreaLoader.add_event(window, "unload", function(){if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]) editArea.execCommand("EA_unload");}); + parent.editAreaLoader.add_event(window, "unload", function(){ + // in case where editAreaLoader have been already cleaned + if( parent.editAreaLoader ) + { + parent.editAreaLoader.remove_event(parent.window, "resize", editArea.update_size); + parent.editAreaLoader.remove_event(top.window, "resize", editArea.update_size); + } + if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]){ + editArea.execCommand("EA_unload"); + } + }); /*date= new Date(); @@ -293,50 +273,94 @@ }; + + //called by the toggle_on + EditArea.prototype.update_size= function(){ + var d=document,pd=parent.document,height,width,popup,maxLeft,maxTop; + + if( typeof editAreas != 'undefined' && editAreas[editArea.id] && editAreas[editArea.id]["displayed"]==true){ + if(editArea.fullscreen['isFull']){ + pd.getElementById("frame_"+editArea.id).style.width = pd.getElementsByTagName("html")[0].clientWidth + "px"; + pd.getElementById("frame_"+editArea.id).style.height = pd.getElementsByTagName("html")[0].clientHeight + "px"; + } + + if(editArea.tab_browsing_area.style.display=='block' && ( !editArea.isIE || editArea.isIE >= 8 ) ) + { + editArea.tab_browsing_area.style.height = "0px"; + editArea.tab_browsing_area.style.height = (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px"; + } + + height = d.body.offsetHeight - editArea.get_all_toolbar_height() - 4; + editArea.result.style.height = height +"px"; + + width = d.body.offsetWidth -2; + editArea.result.style.width = width+"px"; + //alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight); + + // check that the popups don't get out of the screen + for( i=0; i < editArea.inlinePopup.length; i++ ) + { + popup = _$(editArea.inlinePopup[i]["popup_id"]); + maxLeft = d.body.offsetWidth - popup.offsetWidth; + maxTop = d.body.offsetHeight - popup.offsetHeight; + if( popup.offsetTop > maxTop ) + popup.style.top = maxTop+"px"; + if( popup.offsetLeft > maxLeft ) + popup.style.left = maxLeft+"px"; + } + + editArea.manage_size( true ); + editArea.fixLinesHeight( editArea.textarea.value, 0,-1); + } + }; + + EditArea.prototype.manage_size= function(onlyOneTime){ if(!editAreas[this.id]) return false; + if(editAreas[this.id]["displayed"]==true && this.textareaFocused) { - var resized= false; + var area_height,resized= false; //1) Manage display width //1.1) Calc the new width to use for display - if( this.settings['wrap_text'] ) - { - // var area_width= this.result.offsetWidth -50; - } - else + if( !this.settings['word_wrap'] ) { var area_width= this.textarea.scrollWidth; - var area_height= this.textarea.scrollHeight; - if(this.nav['isOpera']){ - area_width=10000; /* TODO: find a better way to fix the width problem */ + area_height= this.textarea.scrollHeight; + // bug on old opera versions + if(this.isOpera && this.isOpera < 9.6 ){ + area_width=10000; + } + //1.2) the width is not the same, we must resize elements + if(this.textarea.previous_scrollWidth!=area_width) + { + this.container.style.width= area_width+"px"; + this.textarea.style.width= area_width+"px"; + this.content_highlight.style.width= area_width+"px"; + this.textarea.previous_scrollWidth=area_width; + resized=true; } } - - - //1.2) the width is not the same, we must resize elements - if(this.textarea.previous_scrollWidth!=area_width) - { - - this.container.style.width= area_width+"px"; - this.textarea.style.width= area_width+"px"; - this.content_highlight.style.width= area_width+"px"; - this.textarea.previous_scrollWidth=area_width; - resized=true; - } - + // manage wrap width + if( this.settings['word_wrap'] ) + { + newW=this.textarea.offsetWidth; + if( this.isFirefox || this.isIE ) + newW-=2; + if( this.isSafari ) + newW-=6; + this.content_highlight.style.width=this.selection_field_text.style.width=this.selection_field.style.width=this.test_font_size.style.width=newW+"px"; + } //2) Manage display height //2.1) Calc the new height to use for display - var area_height = this.textarea.scrollHeight; - if(this.nav['isOpera']){ - area_height= this.last_selection['nb_line']*this.lineHeight; - } - - if(this.nav['isGecko'] && this.smooth_selection && this.last_selection["nb_line"]) - area_height= this.last_selection["nb_line"]*this.lineHeight; + if( this.isOpera || this.isFirefox || this.isSafari ) { + area_height= this.getLinePosTop( this.last_selection["nb_line"] + 1 ); + } else { + area_height = this.textarea.scrollHeight; + } //2.2) the width is not the same, we must resize elements if(this.textarea.previous_scrollHeight!=area_height) { @@ -350,17 +374,15 @@ //3) if there is new lines, we add new line numbers in the line numeration area if(this.last_selection["nb_line"] >= this.line_number) { - var div_line_number=""; - for(i=this.line_number+1; i"; + newLines+='
    '+i+"
    "; this.line_number++; } - var span= document.createElement("span"); - if(this.nav['isIE']) - span.unselectable=true; - span.innerHTML=div_line_number; - $("line_number").appendChild(span); + destDiv.innerHTML= destDiv.innerHTML + newLines; + + this.fixLinesHeight( this.textarea.value, start, -1 ); } //4) be sure the text is well displayed @@ -370,18 +392,11 @@ this.scroll_to_view(); } } + if(!onlyOneTime) setTimeout("editArea.manage_size();", 100); }; - EditArea.prototype.add_event = function(obj, name, handler) { - if (this.nav['isIE']) { - obj.attachEvent("on" + name, handler); - } else{ - obj.addEventListener(name, handler, false); - } - }; - EditArea.prototype.execCommand= function(cmd, param){ for(var i in this.plugins){ @@ -494,16 +509,16 @@ // add plugin translation to language translation array EditArea.prototype.add_lang= function(language, values){ if(!parent.editAreaLoader.lang[language]) - parent.editAreaLoader.lang[language]=new Object(); + parent.editAreaLoader.lang[language]={}; for(var i in values) parent.editAreaLoader.lang[language][i]= values[i]; }; // short cut for document.getElementById() - function $(id){return document.getElementById( id );}; + function _$(id){return document.getElementById( id );}; var editArea = new EditArea(); - editArea.add_event(window, "load", init); + parent.editAreaLoader.add_event(window, "load", init); function init(){ setTimeout("editArea.init(); ", 10); diff --git a/www/extras/editarea/edit_area/edit_area_compressor.php b/www/extras/editarea/edit_area/edit_area_compressor.php index 5b76bfef6..f2cc532af 100644 --- a/www/extras/editarea/edit_area/edit_area_compressor.php +++ b/www/extras/editarea/edit_area/edit_area_compressor.php @@ -3,7 +3,7 @@ * * EditArea PHP compressor * Developped by Christophe Dolivet - * Released under LGPL and Apache licenses + * Released under LGPL, Apache and BSD licenses * v1.1.3 (2007/01/18) * ******/ @@ -143,11 +143,11 @@ $loader= $this->get_content("edit_area_loader.js")."\n"; // get the list of other files to load - $loader= preg_replace("/(this\.scripts_to_load= new Array)\(([^\)]*)\);/e" + $loader= preg_replace("/(t\.scripts_to_load=\s*)\[([^\]]*)\];/e" , "\$this->replace_scripts('script_list', '\\1', '\\2')" , $loader); - $loader= preg_replace("/(this\.sub_scripts_to_load= new Array)\(([^\)]*)\);/e" + $loader= preg_replace("/(t\.sub_scripts_to_load=\s*)\[([^\]]*)\];/e" , "\$this->replace_scripts('sub_script_list', '\\1', '\\2')" , $loader); @@ -332,7 +332,7 @@ // add line break before "else" otherwise navigators can't manage to parse the file $code= preg_replace('/(\b(else)\b)/', "\n$1", $code); // remove unnecessary spaces - $code= preg_replace('/( |\t|\r)?(;|\{|\}|=|==|\-|\+|,|\(|\)|\|\||&\&|\:)( |\t|\r)+/', "$2", $code); + $code= preg_replace('/( |\t|\r)*(;|\{|\}|=|==|\-|\+|,|\(|\)|\|\||&\&|\:)( |\t|\r)*/', "$2", $code); } } @@ -372,7 +372,7 @@ function replace_scripts($var, $param1, $param2) { $this->$var=stripslashes($param2); - return $param1."();"; + return $param1."[];"; } /* for php version that have not thoses functions */ diff --git a/www/extras/editarea/edit_area/edit_area_full.gz b/www/extras/editarea/edit_area/edit_area_full.gz index 980e86079..8cfc846f1 100644 Binary files a/www/extras/editarea/edit_area/edit_area_full.gz and b/www/extras/editarea/edit_area/edit_area_full.gz differ diff --git a/www/extras/editarea/edit_area/edit_area_full.js b/www/extras/editarea/edit_area/edit_area_full.js index c81809f5c..db136a89a 100644 --- a/www/extras/editarea/edit_area/edit_area_full.js +++ b/www/extras/editarea/edit_area/edit_area_full.js @@ -1,38 +1,38 @@ - function EAL(){this.version="0.7.2.2";date=new Date();this.start_time=date.getTime();this.win="loading";this.error=false;this.baseURL="";this.template="";this.lang=new Object();this.load_syntax=new Object();this.syntax=new Object();this.loadedFiles=new Array();this.waiting_loading=new Object();this.scripts_to_load=new Array();this.sub_scripts_to_load=new Array();this.resize=new Array();this.hidden=new Object();this.default_settings={debug:false ,smooth_selection:true ,font_size:"10" ,font_family:"monospace" ,start_highlight:false ,autocompletion:false ,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,|,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,c,coldfusion,cpp,css,html,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 ,wrap_text: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:"" };this.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],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];ua=navigator.userAgent;this.nav=new Object();this.nav['isMacOS']=(ua.indexOf('Mac OS')!=-1);this.nav['isIE']=(navigator.appName=="Microsoft Internet Explorer");if(this.nav['isIE']){this.nav['isIE']=ua.replace(/^.*?MSIE ([0-9\.]*).*$/,"$1");if(this.nav['isIE']<6)this.has_error();}if(this.nav['isNS']=ua.indexOf('Netscape/')!=-1){this.nav['isNS']=ua.substr(ua.indexOf('Netscape/')+9);if(this.nav['isNS']<8||!this.nav['isIE'])this.has_error();}if(this.nav['isOpera']=(ua.indexOf('Opera')!=-1)){this.nav['isOpera']=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(this.nav['isOpera']<9)this.has_error();this.nav['isIE']=false;}this.nav['isGecko']=(ua.indexOf('Gecko')!=-1);if(this.nav['isFirefox'] =(ua.indexOf('Firefox')!=-1))this.nav['isFirefox']=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(this.nav['isIceweasel'] =(ua.indexOf('Iceweasel')!=-1))this.nav['isFirefox']=this.nav['isIceweasel']=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(this.nav['GranParadiso'] =(ua.indexOf('GranParadiso')!=-1))this.nav['isFirefox']=this.nav['isGranParadiso']=ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i,"$1");if(this.nav['isCamino'] =(ua.indexOf('Camino')!=-1))this.nav['isCamino']=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(this.nav['isChrome'] =(ua.indexOf('Chrome')!=-1))this.nav['isChrome']=ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i,"$1");if(this.nav['isSafari'] =(ua.indexOf('Safari')!=-1))this.nav['isSafari']=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(this.nav['isIE']>=6||this.nav['isOpera']>=9||this.nav['isFirefox']||this.nav['isChrome']||this.nav['isCamino']||this.nav['isSafari']>=3)this.nav['isValidBrowser']=true; -else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i0)settings["toolbar"]=settings["begin_toolbar"] +","+settings["toolbar"];if(settings["end_toolbar"].length>0)settings["toolbar"]=settings["toolbar"] +","+settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL+"reg_syntax/"+settings["syntax"]+".js");}eAs[settings["id"]]={"settings":settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);},delete_instance:function(id){eAL.execCommand(id,"EA_delete");if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];},start:function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded"&&typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!eAL.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="
    ";html+="";html+="
    ";}if(eAs[id]["settings"]["debug"])html+="
    ";html=eAL.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null)father.appendChild(span); -else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){this.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(this.nav['isIE']){eAL.init_ie_textarea(id);}var html_toolbar_content="";area=eAs[id];for(var i=0;i';}for(var i=0;i';this.iframe_script+='';}if(!this.iframe_css){this.iframe_css="";}var template=this.template.replace(/\[__BASEURL__\]/g,this.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=this.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",this.iframe_css);template=template.replace("[__JSCODE__]",this.iframe_script);template=template.replace("[__EA_VERSION__]",this.version);area.textarea=document.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"]];var father=area.textarea.parentNode;var content=document.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";var next=area.textarea.nextSibling;if(next==null)father.appendChild(content); -else father.insertBefore(content,next);var frame=window.frames["frame_"+area["settings"]["id"]];frame.document.open();frame.eAs=eAs;frame.area_id=area["settings"]["id"];frame.document.area_id=area["settings"]["id"];frame.document.write(template);frame.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);} -else if(eAs[id]["displayed"]==false &&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];if(frame.editArea.fullscreen['isFull'])frame.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;eAs[id]["textarea"].wrap="off";setAttribute(eAs[id]["textarea"],"wrap","off");var parNod=eAs[id]["textarea"].parentNode;var nxtSib=eAs[id]["textarea"].nextSibling;parNod.removeChild(eAs[id]["textarea"]);parNod.insertBefore(eAs[id]["textarea"],nxtSib);eAs[id]["textarea"].value=frame.editArea.textarea.value;var selStart=frame.editArea.last_selection["selectionStart"];var selEnd=frame.editArea.last_selection["selectionEnd"];var scrollTop=frame.document.getElementById("result").scrollTop;var scrollLeft=frame.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';eAs[id]["textarea"].style.display="inline";eAs[id]["textarea"].focus();if(this.nav['isIE']){eAs[id]["textarea"].selectionStart=selStart;eAs[id]["textarea"].selectionEnd=selEnd;eAs[id]["textarea"].focused=true;set_IE_selection(eAs[id]["textarea"]);} -else{if(this.nav['isOpera']){eAs[id]["textarea"].setSelectionRange(0,0);}try{eAs[id]["textarea"].setSelectionRange(selStart,selEnd);}catch(e){};}eAs[id]["textarea"].scrollTop=scrollTop;eAs[id]["textarea"].scrollLeft=scrollLeft;frame.editArea.execCommand("toggle_off");}},toggle_on:function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];area=window.frames["frame_"+id].editArea;area.textarea.value=eAs[id]["textarea"].value;var selStart=0;var selEnd=0;var scrollTop=0;var scrollLeft=0;if(eAs[id]["textarea"].use_last==true){var selStart=eAs[id]["textarea"].last_selectionStart;var selEnd=eAs[id]["textarea"].last_selectionEnd;var scrollTop=eAs[id]["textarea"].last_scrollTop;var scrollLeft=eAs[id]["textarea"].last_scrollLeft;eAs[id]["textarea"].use_last=false;} -else{try{var selStart=eAs[id]["textarea"].selectionStart;var selEnd=eAs[id]["textarea"].selectionEnd;var scrollTop=eAs[id]["textarea"].scrollTop;var scrollLeft=eAs[id]["textarea"].scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id,document.getElementById("frame_"+id));eAs[id]["textarea"].style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");window.frames["frame_"+id].document.getElementById("result").scrollTop=scrollTop;window.frames["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart,selEnd-selStart);area.execCommand("toggle_on");} -else{var 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=document.getElementById(id);var width=Math.max(eAs[id]["settings"]["min_width"],elem.offsetWidth)+"px";var 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(){if (!this.baseURL){var elements=document.getElementsByTagName('script');for (var i=0;i';html+='';return html;},get_control_html:function(button_name,lang){for (var i=0;i";case "|":case "separator":return '';case "select_font":html="";return html;case "syntax_selection":var html="";return html;}return "["+button_name+"]";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); + function EAL(){var t=this;t.version="0.8.1.1";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.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; +else t.isValidBrowser=false;t.set_base_url();for(var i=0;i0)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;i0){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+="
    ";html+="";html+="
    ";}if(eAs[id]["settings"]["debug"])html+="
    ";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); +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);}area=eAs[id];for(i=0;i';}for(i=0;i';t.iframe_script+='';}if(!t.iframe_css){t.iframe_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); +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);} +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);} +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;} +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");} +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';html+='';return html;},get_control_html:function(button_name,lang){var t=this,i,but,html,si;for(i=0;i";case "|":case "separator":return '';case "select_font":html="";return html;case "syntax_selection":html="";return html;}return "["+button_name+"]";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); else if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP"); 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; else this.has_error();}},translate:function(text,lang,mode){if(mode=="word")text=eAL.get_word_translation(text,lang); -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){for(var i in eAL.lang[lang]){if(i==val)return eAL.lang[lang][i];}return "_"+val;},load_script:function(url){if (this.loadedFiles[url])return;try{var script=document.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";var head=document.getElementsByTagName("head");head[0].appendChild(script);}catch(e){document.write('');}this.loadedFiles[url]=true;},add_event:function(obj,name,handler){if (obj.attachEvent){obj.attachEvent("on"+name,handler);} -else{obj.addEventListener(name,handler,false);}},remove_event:function(obj,name,handler){if (obj.detachEvent)obj.detachEvent("on"+name,handler); -else obj.removeEventListener(name,handler,false);},reset:function(e){var formObj=eAL.nav['isIE'] ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(var i in eAs){var is_child=false;for (var x=0;x');}t.loadedFiles[url]=true;},add_event:function(obj,name,handler){try{if(obj.attachEvent){obj.attachEvent("on"+name,handler);} +else{obj.addEventListener(name,handler,false);}}catch(e){}},remove_event:function(obj,name,handler){try{if(obj.detachEvent)obj.detachEvent("on"+name,handler); +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 old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); -else this.setSelectionRange(id,old_sel["start"]+open_tag.length,old_sel["start"]+open_tag.length);},hide:function(id){if(document.getElementById(id)&&!this.hidden[id]){this.hidden[id]=new Object();this.hidden[id]["selectionRange"]=this.getSelectionRange(id);if(document.getElementById(id).style.display!="none"){this.hidden[id]["scrollTop"]=document.getElementById(id).scrollTop;this.hidden[id]["scrollLeft"]=document.getElementById(id).scrollLeft;}if(window.frames["frame_"+id]){this.hidden[id]["toggle"]=eAs[id]["displayed"];if(window.frames["frame_"+id]&&eAs[id]["displayed"]==true){var scrollTop=window.frames["frame_"+id].document.getElementById("result").scrollTop;var scrollLeft=window.frames["frame_"+id].document.getElementById("result").scrollLeft;} -else{var scrollTop=document.getElementById(id).scrollTop;var scrollLeft=document.getElementById(id).scrollLeft;}this.hidden[id]["scrollTop"]=scrollTop;this.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true)eAL.toggle_off(id);}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}document.getElementById(id).style.display="none";}},show:function(id){if((elem=document.getElementById(id))&&this.hidden[id]){elem.style.display="inline";elem.scrollTop=this.hidden[id]["scrollTop"];elem.scrollLeft=this.hidden[id]["scrollLeft"];var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(window.frames["frame_"+id]){elem.style.display="inline";if(this.hidden[id]["toggle"]==true)eAL.toggle_on(id);scrollTop=this.hidden[id]["scrollTop"];scrollLeft=this.hidden[id]["scrollLeft"];if(window.frames["frame_"+id]&&eAs[id]["displayed"]==true){window.frames["frame_"+id].document.getElementById("result").scrollTop=scrollTop;window.frames["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;} -else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=this.hidden[id]["selectionRange"];this.setSelectionRange(id,sel["start"],sel["end"]);delete this.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=new RegExp('\\\\','g');var 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);'); -else return eval('window.frames["frame_'+id +'"].editArea.'+cmd +';');}return false;}};var eAL=new EAL();var eAs=new Object(); function getAttribute(elm,aname){try{var avalue=elm.getAttribute(aname );}catch(exept){}if(! avalue){for(var i=0;i < elm.attributes.length;i ++){var 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);} -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=new Array();for (var x=0;x old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); +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;} +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;} +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);'); +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);} +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;x0){results=results.concat(result);}} 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;} -else{return (e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} -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);} +else{return(e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} +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);} else if(elem.currentStyle){var prop=prop.replace(/-\D/gi,function(sMatch){return sMatch.charAt(sMatch.length-1).toUpperCase();});return elem.currentStyle[prop];} -else return null;}var move_current_element;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;move_current_element=frame.document.getElementById(elem_id);move_current_element.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);move_current_element.start_pos_x=mouse_x-(move_current_element.style.left.replace("px","")||calculeOffsetLeft(move_current_element));move_current_element.start_pos_y=mouse_y-(move_current_element.style.top.replace("px","")||calculeOffsetTop(move_current_element));return false;};function end_move_element(e){move_current_element.frame.document.onmousemove="";move_current_element.frame.document.onmouseup="";move_current_element=null;};function move_element(e){if(move_current_element.frame&&move_current_element.frame.event)e=move_current_element.frame.event;var mouse_x=getMouseX(e);var mouse_y=getMouseY(e);var new_top=mouse_y-move_current_element.start_pos_y;var new_left=mouse_x-move_current_element.start_pos_x;var max_left=move_current_element.frame.document.body.offsetWidth-move_current_element.offsetWidth;max_top=move_current_element.frame.document.body.offsetHeight-move_current_element.offsetHeight;new_top=Math.min(Math.max(0,new_top),max_top);new_left=Math.min(Math.max(0,new_left),max_left);move_current_element.style.top=new_top+"px";move_current_element.style.left=new_left+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return {"start":textarea.selectionStart,"end":textarea.selectionEnd};};function setSelectionRange(textarea,start,end){textarea.focus();start=Math.max(0,Math.min(textarea.value.length,start));end=Math.max(start,Math.min(textarea.value.length,end));if(nav['isOpera']){textarea.selectionEnd=1;textarea.selectionStart=0;textarea.selectionEnd=1;textarea.selectionStart=0;}textarea.selectionStart=start;textarea.selectionEnd=end;if(nav['isIE'])set_IE_selection(textarea);};function get_IE_selection(textarea){if(textarea&&textarea.focused){if(!textarea.ea_line_height){var div=document.createElement("div");div.style.fontFamily=get_css_property(textarea,"font-family");div.style.fontSize=get_css_property(textarea,"font-size");div.style.visibility="hidden";div.innerHTML="0";document.body.appendChild(div);textarea.ea_line_height=div.offsetHeight;document.body.removeChild(div);}var range=document.selection.createRange();var stored_range=range.duplicate();stored_range.moveToElementText(textarea );stored_range.setEndPoint('EndToEnd',range );if(stored_range.parentElement()==textarea){var elem=textarea;var scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}var relative_top=range.offsetTop-calculeOffsetTop(textarea)+scrollTop;var line_start=Math.round((relative_top / textarea.ea_line_height)+1);var line_nb=Math.round(range.boundingHeight / textarea.ea_line_height);var range_start=stored_range.text.length-range.text.length;var tab=textarea.value.substr(0,range_start).split("\n");range_start+=(line_start-tab.length)*2;textarea.selectionStart=range_start;var range_end=textarea.selectionStart+range.text.length;tab=textarea.value.substr(0,range_start+range.text.length).split("\n");range_end+=(line_start+line_nb-1-tab.length)*2;textarea.selectionEnd=range_end;}}setTimeout("get_IE_selection(document.getElementById('"+textarea.id +"'));",50);};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(textarea){if(!window.closed){var nbLineStart=textarea.value.substr(0,textarea.selectionStart).split("\n").length-1;var nbLineEnd=textarea.value.substr(0,textarea.selectionEnd).split("\n").length-1;var range=document.selection.createRange();range.moveToElementText(textarea );range.setEndPoint('EndToStart',range );range.moveStart('character',textarea.selectionStart-nbLineStart);range.moveEnd('character',textarea.selectionEnd-nbLineEnd-(textarea.selectionStart-nbLineStart));range.select();}};eAL.waiting_loading["elements_functions.js"]="loaded"; - EAL.prototype.start_resize_area=function(){document.onmouseup=eAL.end_resize_area;document.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);var textarea=eAs[eAL.resize["id"]]["textarea"];var div=document.getElementById("edit_area_resize");if(!div){div=document.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}var width=textarea.offsetWidth -2;var height=textarea.offsetHeight -2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";var father=textarea.parentNode;father.insertBefore(div,textarea);textarea.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){document.onmouseup="";document.onmousemove="";var div=document.getElementById("edit_area_resize");var textarea=eAs[eAL.resize["id"]]["textarea"];var width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);var height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.nav['isIE']==6){width-=2;height-=2;}textarea.style.width=width+"px";textarea.style.height=height+"px";div.style.display="none";textarea.style.display="inline";textarea.selectionStart=eAL.resize["selectionStart"];textarea.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){new_y=getMouseY(e);var new_height=Math.max(20,new_y-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=new_height+"px";}if(allow=="both"||allow=="x"){new_x=getMouseX(e);var new_width=Math.max(20,new_x-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=new_width+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; - EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)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.replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style=new Object();for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]=new Object();this.syntax[lang]["keywords_reg_exp"]=new Object();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=new Array();this.syntax[lang]["quotes"]=new Object();var quote_tab=new Array();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+"?)?)*("+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]=new Object();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"]=new Object();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"]=new Object();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']]=new Object();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]=new Object();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];}} -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"; -var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_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'); -editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
    [__TOOLBAR__]
     
     
    {$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
    {$processing}
    {$search} {$close_popup}
    {$replace} {$move_popup}

    {$find_next} {$replace} {$replace_all}
    {$close_popup}

    Editarea [__EA_VERSION__]


    {$shortcuts}:

    {$tab}: {$add_tab}
    {$shift}+{$tab}: {$remove_tab}
    {$ctrl}+f: {$search_command}
    {$ctrl}+r: {$replace_command}
    {$ctrl}+h: {$highlight}
    {$ctrl}+g: {$go_to_line}
    {$ctrl}+z: {$undo}
    {$ctrl}+y: {$redo}
    {$ctrl}+e: {$help}
    {$ctrl}+q, {$esc}: {$close_popup}
    {$accesskey} E: {$toggle}

    {$about_notice}
    "; -editAreaLoader.iframe_css= ""; +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(this.isOpera&&this.isOpera < 9.6){t.selectionEnd=1;t.selectionStart=0;t.selectionEnd=1;t.selectionStart=0;}t.selectionStart=start;t.selectionEnd=end;if(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){}}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"; + 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"; + EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)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];}} +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"; +var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_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'); +editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
    [__TOOLBAR__]
     
     
    {$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
    {$processing}
    {$search} {$close_popup}
    {$replace} {$move_popup}

    {$find_next} {$replace} {$replace_all}
    {$close_popup}

    Editarea [__EA_VERSION__]


    {$shortcuts}:

    {$tab}: {$add_tab}
    {$shift}+{$tab}: {$remove_tab}
    {$ctrl}+f: {$search_command}
    {$ctrl}+r: {$replace_command}
    {$ctrl}+h: {$highlight}
    {$ctrl}+g: {$go_to_line}
    {$ctrl}+z: {$undo}
    {$ctrl}+y: {$redo}
    {$ctrl}+e: {$help}
    {$ctrl}+q, {$esc}: {$close_popup}
    {$accesskey} E: {$toggle}

    {$about_notice}
    "; +editAreaLoader.iframe_css= ""; diff --git a/www/extras/editarea/edit_area/edit_area_full_with_plugins.gz b/www/extras/editarea/edit_area/edit_area_full_with_plugins.gz index 7f70156fd..19cd98c4f 100644 Binary files a/www/extras/editarea/edit_area/edit_area_full_with_plugins.gz and b/www/extras/editarea/edit_area/edit_area_full_with_plugins.gz differ diff --git a/www/extras/editarea/edit_area/edit_area_full_with_plugins.js b/www/extras/editarea/edit_area/edit_area_full_with_plugins.js index 9d04eec1e..4e218100d 100644 --- a/www/extras/editarea/edit_area/edit_area_full_with_plugins.js +++ b/www/extras/editarea/edit_area/edit_area_full_with_plugins.js @@ -1,39 +1,39 @@ - function EAL(){this.version="0.7.2.2";date=new Date();this.start_time=date.getTime();this.win="loading";this.error=false;this.baseURL="";this.template="";this.lang=new Object();this.load_syntax=new Object();this.syntax=new Object();this.loadedFiles=new Array();this.waiting_loading=new Object();this.scripts_to_load=new Array();this.sub_scripts_to_load=new Array();this.resize=new Array();this.hidden=new Object();this.default_settings={debug:false ,smooth_selection:true ,font_size:"10" ,font_family:"monospace" ,start_highlight:false ,autocompletion:false ,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,|,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,c,coldfusion,cpp,css,html,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 ,wrap_text: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:"" };this.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],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];ua=navigator.userAgent;this.nav=new Object();this.nav['isMacOS']=(ua.indexOf('Mac OS')!=-1);this.nav['isIE']=(navigator.appName=="Microsoft Internet Explorer");if(this.nav['isIE']){this.nav['isIE']=ua.replace(/^.*?MSIE ([0-9\.]*).*$/,"$1");if(this.nav['isIE']<6)this.has_error();}if(this.nav['isNS']=ua.indexOf('Netscape/')!=-1){this.nav['isNS']=ua.substr(ua.indexOf('Netscape/')+9);if(this.nav['isNS']<8||!this.nav['isIE'])this.has_error();}if(this.nav['isOpera']=(ua.indexOf('Opera')!=-1)){this.nav['isOpera']=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(this.nav['isOpera']<9)this.has_error();this.nav['isIE']=false;}this.nav['isGecko']=(ua.indexOf('Gecko')!=-1);if(this.nav['isFirefox'] =(ua.indexOf('Firefox')!=-1))this.nav['isFirefox']=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(this.nav['isIceweasel'] =(ua.indexOf('Iceweasel')!=-1))this.nav['isFirefox']=this.nav['isIceweasel']=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(this.nav['GranParadiso'] =(ua.indexOf('GranParadiso')!=-1))this.nav['isFirefox']=this.nav['isGranParadiso']=ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i,"$1");if(this.nav['isCamino'] =(ua.indexOf('Camino')!=-1))this.nav['isCamino']=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(this.nav['isChrome'] =(ua.indexOf('Chrome')!=-1))this.nav['isChrome']=ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i,"$1");if(this.nav['isSafari'] =(ua.indexOf('Safari')!=-1))this.nav['isSafari']=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(this.nav['isIE']>=6||this.nav['isOpera']>=9||this.nav['isFirefox']||this.nav['isChrome']||this.nav['isCamino']||this.nav['isSafari']>=3)this.nav['isValidBrowser']=true; -else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i0)settings["toolbar"]=settings["begin_toolbar"] +","+settings["toolbar"];if(settings["end_toolbar"].length>0)settings["toolbar"]=settings["toolbar"] +","+settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL+"reg_syntax/"+settings["syntax"]+".js");}eAs[settings["id"]]={"settings":settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);},delete_instance:function(id){eAL.execCommand(id,"EA_delete");if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];},start:function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded"&&typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!eAL.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="
    ";html+="";html+="
    ";}if(eAs[id]["settings"]["debug"])html+="
    ";html=eAL.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null)father.appendChild(span); -else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){this.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(this.nav['isIE']){eAL.init_ie_textarea(id);}var html_toolbar_content="";area=eAs[id];for(var i=0;i';}for(var i=0;i';this.iframe_script+='';}if(!this.iframe_css){this.iframe_css="";}var template=this.template.replace(/\[__BASEURL__\]/g,this.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=this.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",this.iframe_css);template=template.replace("[__JSCODE__]",this.iframe_script);template=template.replace("[__EA_VERSION__]",this.version);area.textarea=document.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"]];var father=area.textarea.parentNode;var content=document.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";var next=area.textarea.nextSibling;if(next==null)father.appendChild(content); -else father.insertBefore(content,next);var frame=window.frames["frame_"+area["settings"]["id"]];frame.document.open();frame.eAs=eAs;frame.area_id=area["settings"]["id"];frame.document.area_id=area["settings"]["id"];frame.document.write(template);frame.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);} -else if(eAs[id]["displayed"]==false &&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];if(frame.editArea.fullscreen['isFull'])frame.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;eAs[id]["textarea"].wrap="off";setAttribute(eAs[id]["textarea"],"wrap","off");var parNod=eAs[id]["textarea"].parentNode;var nxtSib=eAs[id]["textarea"].nextSibling;parNod.removeChild(eAs[id]["textarea"]);parNod.insertBefore(eAs[id]["textarea"],nxtSib);eAs[id]["textarea"].value=frame.editArea.textarea.value;var selStart=frame.editArea.last_selection["selectionStart"];var selEnd=frame.editArea.last_selection["selectionEnd"];var scrollTop=frame.document.getElementById("result").scrollTop;var scrollLeft=frame.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';eAs[id]["textarea"].style.display="inline";eAs[id]["textarea"].focus();if(this.nav['isIE']){eAs[id]["textarea"].selectionStart=selStart;eAs[id]["textarea"].selectionEnd=selEnd;eAs[id]["textarea"].focused=true;set_IE_selection(eAs[id]["textarea"]);} -else{if(this.nav['isOpera']){eAs[id]["textarea"].setSelectionRange(0,0);}try{eAs[id]["textarea"].setSelectionRange(selStart,selEnd);}catch(e){};}eAs[id]["textarea"].scrollTop=scrollTop;eAs[id]["textarea"].scrollLeft=scrollLeft;frame.editArea.execCommand("toggle_off");}},toggle_on:function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];area=window.frames["frame_"+id].editArea;area.textarea.value=eAs[id]["textarea"].value;var selStart=0;var selEnd=0;var scrollTop=0;var scrollLeft=0;if(eAs[id]["textarea"].use_last==true){var selStart=eAs[id]["textarea"].last_selectionStart;var selEnd=eAs[id]["textarea"].last_selectionEnd;var scrollTop=eAs[id]["textarea"].last_scrollTop;var scrollLeft=eAs[id]["textarea"].last_scrollLeft;eAs[id]["textarea"].use_last=false;} -else{try{var selStart=eAs[id]["textarea"].selectionStart;var selEnd=eAs[id]["textarea"].selectionEnd;var scrollTop=eAs[id]["textarea"].scrollTop;var scrollLeft=eAs[id]["textarea"].scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id,document.getElementById("frame_"+id));eAs[id]["textarea"].style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");window.frames["frame_"+id].document.getElementById("result").scrollTop=scrollTop;window.frames["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart,selEnd-selStart);area.execCommand("toggle_on");} -else{var 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=document.getElementById(id);var width=Math.max(eAs[id]["settings"]["min_width"],elem.offsetWidth)+"px";var 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(){if (!this.baseURL){var elements=document.getElementsByTagName('script');for (var i=0;i';html+='';return html;},get_control_html:function(button_name,lang){for (var i=0;i";case "|":case "separator":return '';case "select_font":html="";return html;case "syntax_selection":var html="";return html;}return "["+button_name+"]";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); + function EAL(){var t=this;t.version="0.8.1.1";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.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; +else t.isValidBrowser=false;t.set_base_url();for(var i=0;i0)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;i0){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+="
    ";html+="";html+="
    ";}if(eAs[id]["settings"]["debug"])html+="
    ";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); +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);}area=eAs[id];for(i=0;i';}for(i=0;i';t.iframe_script+='';}if(!t.iframe_css){t.iframe_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); +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);} +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);} +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;} +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");} +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';html+='';return html;},get_control_html:function(button_name,lang){var t=this,i,but,html,si;for(i=0;i";case "|":case "separator":return '';case "select_font":html="";return html;case "syntax_selection":html="";return html;}return "["+button_name+"]";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); else if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP"); 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; else this.has_error();}},translate:function(text,lang,mode){if(mode=="word")text=eAL.get_word_translation(text,lang); -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){for(var i in eAL.lang[lang]){if(i==val)return eAL.lang[lang][i];}return "_"+val;},load_script:function(url){if (this.loadedFiles[url])return;try{var script=document.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";var head=document.getElementsByTagName("head");head[0].appendChild(script);}catch(e){document.write('');}this.loadedFiles[url]=true;},add_event:function(obj,name,handler){if (obj.attachEvent){obj.attachEvent("on"+name,handler);} -else{obj.addEventListener(name,handler,false);}},remove_event:function(obj,name,handler){if (obj.detachEvent)obj.detachEvent("on"+name,handler); -else obj.removeEventListener(name,handler,false);},reset:function(e){var formObj=eAL.nav['isIE'] ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(var i in eAs){var is_child=false;for (var x=0;x');}t.loadedFiles[url]=true;},add_event:function(obj,name,handler){try{if(obj.attachEvent){obj.attachEvent("on"+name,handler);} +else{obj.addEventListener(name,handler,false);}}catch(e){}},remove_event:function(obj,name,handler){try{if(obj.detachEvent)obj.detachEvent("on"+name,handler); +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 old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); -else this.setSelectionRange(id,old_sel["start"]+open_tag.length,old_sel["start"]+open_tag.length);},hide:function(id){if(document.getElementById(id)&&!this.hidden[id]){this.hidden[id]=new Object();this.hidden[id]["selectionRange"]=this.getSelectionRange(id);if(document.getElementById(id).style.display!="none"){this.hidden[id]["scrollTop"]=document.getElementById(id).scrollTop;this.hidden[id]["scrollLeft"]=document.getElementById(id).scrollLeft;}if(window.frames["frame_"+id]){this.hidden[id]["toggle"]=eAs[id]["displayed"];if(window.frames["frame_"+id]&&eAs[id]["displayed"]==true){var scrollTop=window.frames["frame_"+id].document.getElementById("result").scrollTop;var scrollLeft=window.frames["frame_"+id].document.getElementById("result").scrollLeft;} -else{var scrollTop=document.getElementById(id).scrollTop;var scrollLeft=document.getElementById(id).scrollLeft;}this.hidden[id]["scrollTop"]=scrollTop;this.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true)eAL.toggle_off(id);}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}document.getElementById(id).style.display="none";}},show:function(id){if((elem=document.getElementById(id))&&this.hidden[id]){elem.style.display="inline";elem.scrollTop=this.hidden[id]["scrollTop"];elem.scrollLeft=this.hidden[id]["scrollLeft"];var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(window.frames["frame_"+id]){elem.style.display="inline";if(this.hidden[id]["toggle"]==true)eAL.toggle_on(id);scrollTop=this.hidden[id]["scrollTop"];scrollLeft=this.hidden[id]["scrollLeft"];if(window.frames["frame_"+id]&&eAs[id]["displayed"]==true){window.frames["frame_"+id].document.getElementById("result").scrollTop=scrollTop;window.frames["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;} -else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=this.hidden[id]["selectionRange"];this.setSelectionRange(id,sel["start"],sel["end"]);delete this.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=new RegExp('\\\\','g');var 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);'); -else return eval('window.frames["frame_'+id +'"].editArea.'+cmd +';');}return false;}};var eAL=new EAL();var eAs=new Object(); function getAttribute(elm,aname){try{var avalue=elm.getAttribute(aname );}catch(exept){}if(! avalue){for(var i=0;i < elm.attributes.length;i ++){var 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);} -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=new Array();for (var x=0;x old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); +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;} +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;} +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);'); +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);} +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;x0){results=results.concat(result);}} 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;} -else{return (e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} -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);} +else{return(e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} +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);} else if(elem.currentStyle){var prop=prop.replace(/-\D/gi,function(sMatch){return sMatch.charAt(sMatch.length-1).toUpperCase();});return elem.currentStyle[prop];} -else return null;}var move_current_element;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;move_current_element=frame.document.getElementById(elem_id);move_current_element.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);move_current_element.start_pos_x=mouse_x-(move_current_element.style.left.replace("px","")||calculeOffsetLeft(move_current_element));move_current_element.start_pos_y=mouse_y-(move_current_element.style.top.replace("px","")||calculeOffsetTop(move_current_element));return false;};function end_move_element(e){move_current_element.frame.document.onmousemove="";move_current_element.frame.document.onmouseup="";move_current_element=null;};function move_element(e){if(move_current_element.frame&&move_current_element.frame.event)e=move_current_element.frame.event;var mouse_x=getMouseX(e);var mouse_y=getMouseY(e);var new_top=mouse_y-move_current_element.start_pos_y;var new_left=mouse_x-move_current_element.start_pos_x;var max_left=move_current_element.frame.document.body.offsetWidth-move_current_element.offsetWidth;max_top=move_current_element.frame.document.body.offsetHeight-move_current_element.offsetHeight;new_top=Math.min(Math.max(0,new_top),max_top);new_left=Math.min(Math.max(0,new_left),max_left);move_current_element.style.top=new_top+"px";move_current_element.style.left=new_left+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return {"start":textarea.selectionStart,"end":textarea.selectionEnd};};function setSelectionRange(textarea,start,end){textarea.focus();start=Math.max(0,Math.min(textarea.value.length,start));end=Math.max(start,Math.min(textarea.value.length,end));if(nav['isOpera']){textarea.selectionEnd=1;textarea.selectionStart=0;textarea.selectionEnd=1;textarea.selectionStart=0;}textarea.selectionStart=start;textarea.selectionEnd=end;if(nav['isIE'])set_IE_selection(textarea);};function get_IE_selection(textarea){if(textarea&&textarea.focused){if(!textarea.ea_line_height){var div=document.createElement("div");div.style.fontFamily=get_css_property(textarea,"font-family");div.style.fontSize=get_css_property(textarea,"font-size");div.style.visibility="hidden";div.innerHTML="0";document.body.appendChild(div);textarea.ea_line_height=div.offsetHeight;document.body.removeChild(div);}var range=document.selection.createRange();var stored_range=range.duplicate();stored_range.moveToElementText(textarea );stored_range.setEndPoint('EndToEnd',range );if(stored_range.parentElement()==textarea){var elem=textarea;var scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}var relative_top=range.offsetTop-calculeOffsetTop(textarea)+scrollTop;var line_start=Math.round((relative_top / textarea.ea_line_height)+1);var line_nb=Math.round(range.boundingHeight / textarea.ea_line_height);var range_start=stored_range.text.length-range.text.length;var tab=textarea.value.substr(0,range_start).split("\n");range_start+=(line_start-tab.length)*2;textarea.selectionStart=range_start;var range_end=textarea.selectionStart+range.text.length;tab=textarea.value.substr(0,range_start+range.text.length).split("\n");range_end+=(line_start+line_nb-1-tab.length)*2;textarea.selectionEnd=range_end;}}setTimeout("get_IE_selection(document.getElementById('"+textarea.id +"'));",50);};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(textarea){if(!window.closed){var nbLineStart=textarea.value.substr(0,textarea.selectionStart).split("\n").length-1;var nbLineEnd=textarea.value.substr(0,textarea.selectionEnd).split("\n").length-1;var range=document.selection.createRange();range.moveToElementText(textarea );range.setEndPoint('EndToStart',range );range.moveStart('character',textarea.selectionStart-nbLineStart);range.moveEnd('character',textarea.selectionEnd-nbLineEnd-(textarea.selectionStart-nbLineStart));range.select();}};eAL.waiting_loading["elements_functions.js"]="loaded"; - EAL.prototype.start_resize_area=function(){document.onmouseup=eAL.end_resize_area;document.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);var textarea=eAs[eAL.resize["id"]]["textarea"];var div=document.getElementById("edit_area_resize");if(!div){div=document.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}var width=textarea.offsetWidth -2;var height=textarea.offsetHeight -2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";var father=textarea.parentNode;father.insertBefore(div,textarea);textarea.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){document.onmouseup="";document.onmousemove="";var div=document.getElementById("edit_area_resize");var textarea=eAs[eAL.resize["id"]]["textarea"];var width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);var height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.nav['isIE']==6){width-=2;height-=2;}textarea.style.width=width+"px";textarea.style.height=height+"px";div.style.display="none";textarea.style.display="inline";textarea.selectionStart=eAL.resize["selectionStart"];textarea.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){new_y=getMouseY(e);var new_height=Math.max(20,new_y-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=new_height+"px";}if(allow=="both"||allow=="x"){new_x=getMouseX(e);var new_width=Math.max(20,new_x-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=new_width+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; - EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)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.replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style=new Object();for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]=new Object();this.syntax[lang]["keywords_reg_exp"]=new Object();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=new Array();this.syntax[lang]["quotes"]=new Object();var quote_tab=new Array();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+"?)?)*("+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]=new Object();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"]=new Object();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"]=new Object();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']]=new Object();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]=new Object();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];}} -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"; -var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_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'); +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(this.isOpera&&this.isOpera < 9.6){t.selectionEnd=1;t.selectionStart=0;t.selectionEnd=1;t.selectionStart=0;}t.selectionStart=start;t.selectionEnd=end;if(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){}}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"; + 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"; + EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)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];}} +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"; +var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_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'); editAreaLoader.all_plugins_loaded=true; -editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
    [__TOOLBAR__]
     
     
    {$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
    {$processing}
    {$search} {$close_popup}
    {$replace} {$move_popup}

    {$find_next} {$replace} {$replace_all}
    {$close_popup}

    Editarea [__EA_VERSION__]


    {$shortcuts}:

    {$tab}: {$add_tab}
    {$shift}+{$tab}: {$remove_tab}
    {$ctrl}+f: {$search_command}
    {$ctrl}+r: {$replace_command}
    {$ctrl}+h: {$highlight}
    {$ctrl}+g: {$go_to_line}
    {$ctrl}+z: {$undo}
    {$ctrl}+y: {$redo}
    {$ctrl}+e: {$help}
    {$ctrl}+q, {$esc}: {$close_popup}
    {$accesskey} E: {$toggle}

    {$about_notice}
    "; -editAreaLoader.iframe_css= ""; +editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
    [__TOOLBAR__]
     
     
    {$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
    {$processing}
    {$search} {$close_popup}
    {$replace} {$move_popup}

    {$find_next} {$replace} {$replace_all}
    {$close_popup}

    Editarea [__EA_VERSION__]


    {$shortcuts}:

    {$tab}: {$add_tab}
    {$shift}+{$tab}: {$remove_tab}
    {$ctrl}+f: {$search_command}
    {$ctrl}+r: {$replace_command}
    {$ctrl}+h: {$highlight}
    {$ctrl}+g: {$go_to_line}
    {$ctrl}+z: {$undo}
    {$ctrl}+y: {$redo}
    {$ctrl}+e: {$help}
    {$ctrl}+q, {$esc}: {$close_popup}
    {$accesskey} E: {$toggle}

    {$about_notice}
    "; +editAreaLoader.iframe_css= ""; diff --git a/www/extras/editarea/edit_area/edit_area_functions.js b/www/extras/editarea/edit_area/edit_area_functions.js index 3b40f9049..984d4c610 100644 --- a/www/extras/editarea/edit_area/edit_area_functions.js +++ b/www/extras/editarea/edit_area/edit_area_functions.js @@ -10,16 +10,17 @@ }; EditArea.prototype.show_waiting_screen= function(){ - width= this.editor_area.offsetWidth; - height= this.editor_area.offsetHeight; - if(this.nav['isGecko'] || this.nav['isOpera'] || this.nav['isIE']>=7){ - width-=2; - height-=2; + width = this.editor_area.offsetWidth; + height = this.editor_area.offsetHeight; + if( !(this.isIE && this.isIE<6) ) + { + width -= 2; + height -= 2; } - this.processing_screen.style.display="block"; - this.processing_screen.style.width= width+"px"; - this.processing_screen.style.height= height+"px"; - this.waiting_screen_displayed= true; + this.processing_screen.style.display= "block"; + this.processing_screen.style.width = width+"px"; + this.processing_screen.style.height = height+"px"; + this.waiting_screen_displayed = true; }; EditArea.prototype.hide_waiting_screen= function(){ @@ -32,86 +33,126 @@ newcss = document.createElement("style"); newcss.type="text/css"; newcss.media="all"; + if(newcss.styleSheet){ // IE + newcss.styleSheet.cssText = styles; + } else { // W3C + newcss.appendChild(document.createTextNode(styles)); + } document.getElementsByTagName("head")[0].appendChild(newcss); - cssrules = styles.split("}"); - newcss = document.styleSheets[0]; - if(newcss.rules) { //IE - for(i=cssrules.length-2;i>=0;i--) { - newrule = cssrules[i].split("{"); - newcss.addRule(newrule[0],newrule[1]) - } - } - else if(newcss.cssRules) { //Firefox etc - for(i=cssrules.length-1;i>=0;i--) { - if(cssrules[i].indexOf("{")!=-1){ - newcss.insertRule(cssrules[i]+"}",0); - } - } - } } }; EditArea.prototype.set_font= function(family, size){ - var elems= new Array("textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "line_number"); + var t=this, a=this.textarea, s=this.settings, elem_font, i, elem; + // list all elements concerned by font changes + var elems= ["textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "selection_field_text", "line_number"]; + if(family && family!="") - this.settings["font_family"]= family; + s["font_family"]= family; if(size && size>0) - this.settings["font_size"]=size; - if(this.nav['isOpera']) // opera can't manage non monospace font - this.settings['font_family']="monospace"; - var elem_font=$("area_font_size"); - if(elem_font){ - for(var i=0; i looks like a browser internal random bug as text width can change while content_highlight is updated + * 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 + * + * This is an ugly fix + */ + if( t.isFirefox ) + { + var nbTry = 3; + do { + var div1 = document.createElement( 'div' ), text1 = document.createElement( 'textarea' ); + var styles = { + 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 = false; + for( i in styles ) + { + div1.style[ i ] = styles[i]; + text1.style[ i ] = styles[i]; + } + // no wrap for this text + text1.wrap = 'off'; + text1.setAttribute('wrap', 'off'); + t.container.appendChild( div1 ); + t.container.appendChild( text1 ); + // try to make FF to bug + div1.innerHTML = text1.value = 'azertyuiopqsdfghjklm'; + div1.innerHTML = text1.value = text1.value+'wxcvbn^p*ù$!:;,,'; + diff = text1.scrollWidth - div1.scrollWidth; + + // firefox return here a diff of 1 px between equals scrollWidth (can't explain) + if( Math.abs( diff ) >= 2 ) + { + s["font_size"]++; + changed = true; + } + t.container.removeChild( div1 ); + t.container.removeChild( text1 ); + nbTry--; + }while( changed && nbTry > 0 ); + } + + // calc line height - elem = $("test_font_size"); - elem.style.fontFamily= ""+this.settings["font_family"]; - elem.style.fontSize= this.settings["font_size"]+"pt"; - elem.innerHTML="0"; - this.lineHeight= elem.offsetHeight; - - - for(var i=0; i tags + t.add_style("pre{font-family:"+s["font_family"]+"}"); + + // old opera and IE>=8 doesn't update font changes to the textarea + if( ( t.isOpera && t.isOpera < 9.6 ) || t.isIE >= 8 ) + { + var parNod = a.parentNode, nxtSib = a.nextSibling, start= a.selectionStart, end= a.selectionEnd; + parNod.removeChild(a); + parNod.insertBefore(a, nxtSib); + t.area_select(start, end-start); } - this.add_style("pre{font-family:"+this.settings["font_family"]+"}"); - - //alert( getAttribute($("edit_area_test_font_size"), "style")); - - - //alert("font "+this.textarea.style.font); // force update of selection field - this.last_line_selected=-1; - //if(this.state=="loaded"){ - this.last_selection= new Array(); - this.resync_highlight(); - //} - /* this.last_selection["indexOfCursor"]=-1; - this.last_selection["curr_pos"]=-1; - this.last_selection["line_start"]=-1; - this.focus();*/ - //this.check_line_selection(false); - //alert("line_h"+ this.lineHeight + " this.id: "+this.id+ "(size: "+size+")"); + this.focus(); + this.update_size(); + this.check_line_selection(); }; EditArea.prototype.change_font_size= function(){ - var size=$("area_font_size").value; + var size=_$("area_font_size").value; if(size>0) this.set_font("", size); }; @@ -119,13 +160,13 @@ EditArea.prototype.open_inline_popup= function(popup_id){ this.close_all_inline_popup(); - var popup= $(popup_id); - var editor= $("editor"); + var popup= _$(popup_id); + var editor= _$("editor"); // search matching icon for(var i=0; i0){ //alert(miss_top); zone.scrollTop= zone.scrollTop + miss_top; @@ -289,8 +334,10 @@ //alert("else: "+cursor_pos_top); zone.scrollTop= cursor_pos_top; } - //var cursor_pos_left= parseInt($("cursor_pos").style.left.replace("px","")); - var cursor_pos_left= $("cursor_pos").cursor_left; + + // manage left scroll + //var cursor_pos_left= parseInt(_$("cursor_pos").style.left.replace("px","")); + 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){ @@ -309,7 +356,7 @@ if(this.textareaFocused && editAreas[this.id]["displayed"]==true){ var text=this.textarea.value; if(this.previous.length<=1) - this.switchClassSticky($("undo"), 'editAreaButtonDisabled', true); + this.switchClassSticky(_$("undo"), 'editAreaButtonDisabled', true); if(!this.previous[this.previous.length-1] || this.previous[this.previous.length-1]["text"] != text){ this.previous.push({"text": text, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd}); @@ -318,7 +365,7 @@ } if(this.previous.length >= 2) - this.switchClassSticky($("undo"), 'editAreaButtonNormal', false); + this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false); } if(!only_once) @@ -327,18 +374,18 @@ EditArea.prototype.undo= function(){ //alert("undo"+this.previous.length); - if(this.previous.length > 0){ - if(this.nav['isIE']) - this.getIESelection(); + if(this.previous.length > 0) + { + this.getIESelection(); // var pos_cursor=this.textarea.selectionStart; - this.next.push({"text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd}); + this.next.push( { "text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd } ); var prev= this.previous.pop(); - if(prev["text"]==this.textarea.value && this.previous.length > 0) - prev=this.previous.pop(); - this.textarea.value= prev["text"]; - this.last_undo= prev["text"]; + if( prev["text"] == this.textarea.value && this.previous.length > 0 ) + prev =this.previous.pop(); + this.textarea.value = prev["text"]; + this.last_undo = prev["text"]; this.area_select(prev["selStart"], prev["selEnd"]-prev["selStart"]); - this.switchClassSticky($("redo"), 'editAreaButtonNormal', false); + this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false); this.resync_highlight(true); //alert("undo"+this.previous.length); this.check_file_changes(); @@ -346,31 +393,31 @@ }; EditArea.prototype.redo= function(){ - if(this.next.length > 0){ - /*if(this.nav['isIE']) - this.getIESelection();*/ + if(this.next.length > 0) + { + /*this.getIESelection();*/ //var pos_cursor=this.textarea.selectionStart; var next= this.next.pop(); this.previous.push(next); this.textarea.value= next["text"]; this.last_undo= next["text"]; this.area_select(next["selStart"], next["selEnd"]-next["selStart"]); - this.switchClassSticky($("undo"), 'editAreaButtonNormal', false); + this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false); this.resync_highlight(true); this.check_file_changes(); } if( this.next.length == 0) - this.switchClassSticky($("redo"), 'editAreaButtonDisabled', true); + this.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); }; EditArea.prototype.check_redo= function(){ if(editArea.next.length == 0 || editArea.textarea.value!=editArea.last_undo){ - editArea.next= new Array(); // undo the ability to use "redo" button - editArea.switchClassSticky($("redo"), 'editAreaButtonDisabled', true); + editArea.next= []; // undo the ability to use "redo" button + editArea.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); } else { - this.switchClassSticky($("redo"), 'editAreaButtonNormal', false); + this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false); } }; @@ -424,20 +471,27 @@ //make the "page up" and "page down" buttons works correctly EditArea.prototype.scroll_page= function(params){ - var dir= params["dir"]; - var shift_pressed= params["shift"]; - screen_height=$("result").clientHeight; + var dir= params["dir"], shift_pressed= params["shift"]; var lines= this.textarea.value.split("\n"); - var new_pos=0; - var length=0; - var char_left=0; - var line_nb=0; + var new_pos=0, length=0, char_left=0, line_nb=0, curLine=0; + var toScrollAmount = _$("result").clientHeight -30; + var nbLineToScroll = 0, diff= 0; + if(dir=="up"){ - //val= Math.max(0, $("result").scrollTop - screen_height); - //$("result").scrollTop= val; - var scroll_line= Math.ceil((screen_height -30)/this.lineHeight); + nbLineToScroll = Math.ceil( toScrollAmount / this.lineHeight ); + + // fix number of line to scroll + for( i = this.last_selection["line_start"]; i - diff > this.last_selection["line_start"] - nbLineToScroll ; i-- ) + { + if( elem = _$('line_'+ i) ) + { + diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight ); + } + } + nbLineToScroll -= diff; + if(this.last_selection["selec_direction"]=="up"){ - for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-scroll_line, lines.length); line_nb++){ + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-nbLineToScroll, lines.length); line_nb++){ new_pos+= lines[line_nb].length + 1; } char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1); @@ -447,7 +501,7 @@ view="top"; }else{ view="bottom"; - for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-scroll_line, lines.length); line_nb++){ + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-nbLineToScroll, lines.length); line_nb++){ new_pos+= lines[line_nb].length + 1; } char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1); @@ -462,13 +516,23 @@ this.area_select(start, length); } - }else{ - //val= Math.max($("result").style.height.replace("px", ""), $("result").scrollTop + screen_height); - //$("result").scrollTop= val; - var scroll_line= Math.floor((screen_height-30)/this.lineHeight); + } + else + { + var nbLineToScroll= Math.floor( toScrollAmount / this.lineHeight ); + // fix number of line to scroll + for( i = this.last_selection["line_start"]; i + diff < this.last_selection["line_start"] + nbLineToScroll ; i++ ) + { + if( elem = _$('line_'+ i) ) + { + diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight ); + } + } + nbLineToScroll -= diff; + if(this.last_selection["selec_direction"]=="down"){ view="bottom"; - for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+scroll_line, lines.length); line_nb++){ + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+nbLineToScroll, lines.length); line_nb++){ if(line_nb==this.last_selection["line_start"]-1) char_left= this.last_selection["selectionStart"] -new_pos; new_pos+= lines[line_nb].length + 1; @@ -485,7 +549,7 @@ }else{ view="top"; - for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+scroll_line-1, lines.length, lines.length); line_nb++){ + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+nbLineToScroll-1, lines.length, lines.length); line_nb++){ if(line_nb==this.last_selection["line_start"]-1) char_left= this.last_selection["selectionStart"] -new_pos; new_pos+= lines[line_nb].length + 1; @@ -502,137 +566,131 @@ } } - } - + } + //console.log( new_pos, char_left, length, nbLineToScroll, toScrollAmount, _$("result").clientHeigh ); this.check_line_selection(); this.scroll_to_view(view); }; - EditArea.prototype.start_resize= function(e){ - parent.editAreaLoader.resize["id"]= editArea.id; - parent.editAreaLoader.resize["start_x"]= (e)? e.pageX : event.x + document.body.scrollLeft; - parent.editAreaLoader.resize["start_y"]= (e)? e.pageY : event.y + document.body.scrollTop; - if(editArea.nav['isIE']){ + EditArea.prototype.start_resize= function(e){ + parent.editAreaLoader.resize["id"] = editArea.id; + parent.editAreaLoader.resize["start_x"] = (e)? e.pageX : event.x + document.body.scrollLeft; + parent.editAreaLoader.resize["start_y"] = (e)? e.pageY : event.y + document.body.scrollTop; + if(editArea.isIE) + { editArea.textarea.focus(); editArea.getIESelection(); } - parent.editAreaLoader.resize["selectionStart"]= editArea.textarea.selectionStart; - parent.editAreaLoader.resize["selectionEnd"]= editArea.textarea.selectionEnd; - /*parent.editAreaLoader.resize["frame_top"]= parent.calculeOffsetTop(parent.editAreas[editArea.id]["textarea"]); - /*parent.editAreaLoader.resize["frame_left"]= parent.calculeOffsetLeft(parent.frames[editArea.id]);*/ + parent.editAreaLoader.resize["selectionStart"] = editArea.textarea.selectionStart; + parent.editAreaLoader.resize["selectionEnd"] = editArea.textarea.selectionEnd; parent.editAreaLoader.start_resize_area(); }; EditArea.prototype.toggle_full_screen= function(to){ + var t=this, p=parent, a=t.textarea, html, frame, selStart, selEnd, old, icon; if(typeof(to)=="undefined") - to= !this.fullscreen['isFull']; - var old= this.fullscreen['isFull']; - this.fullscreen['isFull']= to; - var icon= $("fullscreen"); + to= !t.fullscreen['isFull']; + old = t.fullscreen['isFull']; + t.fullscreen['isFull']= to; + icon = _$("fullscreen"); + selStart = t.textarea.selectionStart; + selEnd = t.textarea.selectionEnd; + html = p.document.getElementsByTagName("html")[0]; + frame = p.document.getElementById("frame_"+t.id); + if(to && to!=old) { // toogle on fullscreen - var selStart= this.textarea.selectionStart; - var selEnd= this.textarea.selectionEnd; - var html= parent.document.getElementsByTagName("html")[0]; - var frame= parent.document.getElementById("frame_"+this.id); - - this.fullscreen['old_overflow']= parent.get_css_property(html, "overflow"); - this.fullscreen['old_height']= parent.get_css_property(html, "height"); - this.fullscreen['old_width']= parent.get_css_property(html, "width"); - this.fullscreen['old_scrollTop']= html.scrollTop; - this.fullscreen['old_scrollLeft']= html.scrollLeft; - this.fullscreen['old_zIndex']= parent.get_css_property(frame, "z-index"); - if(this.nav['isOpera']){ - html.style.height= "100%"; - html.style.width= "100%"; + + 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.style.height = "100%"; + html.style.width = "100%"; } - html.style.overflow= "hidden"; - html.scrollTop=0; - html.scrollLeft=0; + html.style.overflow = "hidden"; + html.scrollTop = 0; + html.scrollLeft = 0; - - //html.style.backgroundColor= "#FF0000"; -// alert(screen.height+"\n"+window.innerHeight+"\n"+html.clientHeight+"\n"+window.offsetHeight+"\n"+document.body.offsetHeight); - - - frame.style.position="absolute"; - frame.style.width= html.clientWidth+"px"; - frame.style.height= html.clientHeight+"px"; - frame.style.display="block"; - frame.style.zIndex="999999"; - frame.style.top="0px"; - frame.style.left="0px"; + frame.style.position = "absolute"; + frame.style.width = html.clientWidth+"px"; + frame.style.height = html.clientHeight+"px"; + frame.style.display = "block"; + frame.style.zIndex = "999999"; + frame.style.top = "0px"; + frame.style.left = "0px"; // if the iframe was in a div with position absolute, the top and left are the one of the div, // so I fix it by seeing at witch position the iframe start and correcting it - frame.style.top= "-"+parent.calculeOffsetTop(frame)+"px"; - frame.style.left= "-"+parent.calculeOffsetLeft(frame)+"px"; + frame.style.top = "-"+p.calculeOffsetTop(frame)+"px"; + frame.style.left = "-"+p.calculeOffsetLeft(frame)+"px"; - // parent.editAreaLoader.execCommand(this.id, "update_size();"); + // parent.editAreaLoader.execCommand(t.id, "update_size();"); // var body=parent.document.getElementsByTagName("body")[0]; // body.appendChild(frame); - this.switchClassSticky(icon, 'editAreaButtonSelected', false); - this.fullscreen['allow_resize']= this.resize_allowed; - this.allow_resize(false); + t.switchClassSticky(icon, 'editAreaButtonSelected', false); + t.fullscreen['allow_resize']= t.resize_allowed; + t.allow_resize(false); - //this.area_select(selStart, selEnd-selStart); + //t.area_select(selStart, selEnd-selStart); // opera can't manage to do a direct size update - if(this.nav['isFirefox']){ - parent.editAreaLoader.execCommand(this.id, "update_size();"); - this.area_select(selStart, selEnd-selStart); - this.scroll_to_view(); - this.focus(); + if(t.isFirefox){ + p.editAreaLoader.execCommand(t.id, "update_size();"); + t.area_select(selStart, selEnd-selStart); + t.scroll_to_view(); + t.focus(); }else{ - setTimeout("parent.editAreaLoader.execCommand('"+ this.id +"', 'update_size();');editArea.focus();", 10); + setTimeout("p.editAreaLoader.execCommand('"+ t.id +"', 'update_size();');editArea.focus();", 10); } } else if(to!=old) { // toogle off fullscreen - var selStart= this.textarea.selectionStart; - var selEnd= this.textarea.selectionEnd; - - var frame= parent.document.getElementById("frame_"+this.id); frame.style.position="static"; - frame.style.zIndex= this.fullscreen['old_zIndex']; + frame.style.zIndex= t.fullscreen['old_zIndex']; - var html= parent.document.getElementsByTagName("html")[0]; - // html.style.overflow= this.fullscreen['old_overflow']; - - if(this.nav['isOpera']){ - html.style.height= "auto"; - html.style.width= "auto"; - html.style.overflow= "auto"; - }else if(this.nav['isIE'] && parent!=top){ // IE doesn't manage html overflow in frames like in normal page... - html.style.overflow= "auto"; + if(t.isOpera) + { + html.style.height = "auto"; + html.style.width = "auto"; + html.style.overflow = "auto"; + } + else if(t.isIE && p!=top) + { // IE doesn't manage html overflow in frames like in normal page... + html.style.overflow = "auto"; } else - html.style.overflow= this.fullscreen['old_overflow']; - html.scrollTop= this.fullscreen['old_scrollTop']; - html.scrollTop= this.fullscreen['old_scrollLeft']; + { + html.style.overflow = t.fullscreen['old_overflow']; + } + html.scrollTop = t.fullscreen['old_scrollTop']; + html.scrollLeft = t.fullscreen['old_scrollLeft']; - parent.editAreaLoader.hide(this.id); - parent.editAreaLoader.show(this.id); + p.editAreaLoader.hide(t.id); + p.editAreaLoader.show(t.id); - this.switchClassSticky(icon, 'editAreaButtonNormal', false); - if(this.fullscreen['allow_resize']) - this.allow_resize(this.fullscreen['allow_resize']); - if(this.nav['isFirefox']){ - this.area_select(selStart, selEnd-selStart); + t.switchClassSticky(icon, 'editAreaButtonNormal', false); + if(t.fullscreen['allow_resize']) + t.allow_resize(t.fullscreen['allow_resize']); + if(t.isFirefox){ + t.area_select(selStart, selEnd-selStart); setTimeout("editArea.scroll_to_view();", 10); } - //parent.editAreaLoader.remove_event(parent.window, "resize", editArea.update_size); + //p.editAreaLoader.remove_event(p.window, "resize", editArea.update_size); } }; EditArea.prototype.allow_resize= function(allow){ - var resize= $("resize_area"); + var resize= _$("resize_area"); if(allow){ resize.style.visibility="visible"; @@ -681,7 +739,7 @@ this.allready_used_syntax[new_syntax]=true; } // be sure that the select option is correctly updated - var sel= $("syntax_selection"); + var sel= _$("syntax_selection"); if(sel && sel.value!=new_syntax) { for(var i=0; i"; elem.innerHTML= "*"+ this.files[id]['title'] + close +""; - $('tab_browsing_list').appendChild(elem); + _$('tab_browsing_list').appendChild(elem); var elem= document.createElement('text'); this.update_size(); } @@ -834,7 +920,7 @@ if(this.execCommand('file_close', this.files[id])!==false) { // remove the tab in the toolbar - var li= $(this.files[id]['html_id']); + var li= _$(this.files[id]['html_id']); li.parentNode.removeChild(li); // select a new file if(id== this.curr_file) @@ -843,15 +929,15 @@ var is_next= false; for(var i in this.files) { - if(is_next) + if( is_next ) { - next_file= i; + next_file = i; break; } - else if(i==id) - is_next= true; + else if( i == id ) + is_next = true; else - next_file= i; + next_file = i; } // display the next file this.switch_to_file(next_file); @@ -865,57 +951,61 @@ // backup current file datas EditArea.prototype.save_file= function(id){ - if(this.files[id]) + var t= this, save, a_links, a_selects, save_butt, img, i; + if(t.files[id]) { - var save= this.files[id]; - save['last_selection']= this.last_selection; - save['last_text_to_highlight']= this.last_text_to_highlight; - save['last_hightlighted_text']= this.last_hightlighted_text; - save['previous']= this.previous; - save['next']= this.next; - save['last_undo']= this.last_undo; - save['smooth_selection']= this.smooth_selection; - save['do_highlight']= this.do_highlight; - save['syntax']= this.settings['syntax']; - save['text']= this.textarea.value; - save['scroll_top']= this.result.scrollTop; - save['scroll_left']= this.result.scrollLeft; - save['selection_start']= this.last_selection["selectionStart"]; - save['selection_end']= this.last_selection["selectionEnd"]; - save['font_size']= this.settings["font_size"]; - save['font_family']= this.settings["font_family"]; - save['toolbar']= {'links':{}, 'selects': {}}; + var save= t.files[id]; + save['last_selection'] = t.last_selection; + 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.settings['syntax']; + save['text'] = t.textarea.value; + save['scroll_top'] = t.result.scrollTop; + save['scroll_left'] = t.result.scrollLeft; + save['selection_start'] = t.last_selection["selectionStart"]; + save['selection_end'] = t.last_selection["selectionEnd"]; + save['font_size'] = t.settings["font_size"]; + save['font_family'] = t.settings["font_family"]; + save['word_wrap'] = t.settings["word_wrap"]; + save['toolbar'] = {'links':{}, 'selects': {}}; + // save toolbar buttons state for fileSpecific buttons - var links= $("toolbar_1").getElementsByTagName("a"); - for(var i=0; i