Commit c2589de4b871c40dab8d78881a1066a99c13a4dc
1 parent
950d181d
added demo page
Showing
144 changed files
with
13081 additions
and
0 deletions
Too many changes.
To preserve performance only 100 of 144 files are displayed.
demo.html
0 → 100644
1 | +<!DOCTYPE html> | |
2 | +<html lang="en"> | |
3 | +<head> | |
4 | + <link rel="import" href="bower_components/iron-component-page/iron-component-page.html"> | |
5 | + <link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html"> | |
6 | + <link rel="import" href="bower_components/paper-menu/paper-menu.html"> | |
7 | + <link rel="import" href="bower_components/paper-item/paper-item.html"> | |
8 | + <link rel="import" href="bower_components/paper-dropdown-menu/paper-dropdown-menu.html"> | |
9 | + <link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html"> | |
10 | + <link rel="import" href="bower_components/paper-styles/color.html"> | |
11 | + <link rel="import" href="bower_components/paper-input/paper-textarea.html"> | |
12 | + <link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html"> | |
13 | + <link rel="import" href="bower_components/iron-ajax/iron-ajax.html"> | |
14 | + | |
15 | + <link rel="import" href="controllets/items-slider-controllet/items-slider-controllet.html"> | |
16 | + <link rel="import" href="controllets/draggable-element-controllet/draggable-element-controllet.html"> | |
17 | + <link rel="import" href="controllets/treeview-controllet/treeview-controllet.html"> | |
18 | + <link rel="import" href="controllets/text-element-controllet/text-element-controllet.html"> | |
19 | + | |
20 | + <script type="text/javascript" src="datalets/shared_js/jquery-1.11.2.min.js"></script> | |
21 | + <script type="text/javascript" src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> | |
22 | + <script src="controllets/shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script> | |
23 | + <script src="../DEEPCLIENT/js/deepClient.js"></script> | |
24 | + <script type="text/javascript" src="docs/js/editarea_0_8_2/edit_area/edit_area_full.js"></script> | |
25 | + | |
26 | + <link rel="stylesheet" href="controllets/shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css"> | |
27 | + <link rel="import" href="bower_components/paper-menu-button/paper-menu-button.html"> | |
28 | + <meta charset="UTF-8"> | |
29 | + | |
30 | + | |
31 | + <script type="text/javascript"> | |
32 | + selected_component_url = ""; | |
33 | + | |
34 | + $(document).ready(function () { | |
35 | + window.addEventListener("treeview-controllet_fileds-selected", DEEP._fieldsSelected, false); | |
36 | + window.addEventListener("items-slider-controllet_item-selected", DEEP._dataletSelected, false); | |
37 | + window.addEventListener("draggable-element-controllet_content-dragged", DEEP._fieldsMapped, false); | |
38 | + window.addEventListener("text-element-controllet_content-changed", DEEP._textElementChanged, false); | |
39 | + | |
40 | + editAreaLoader.init({ | |
41 | + id : "sbiricuda" // textarea id | |
42 | + ,syntax: "html" // syntax to be uses for highgliting | |
43 | + ,start_highlight: true // to display with highlight mode on start-up | |
44 | + ,syntax: "html" | |
45 | + ,replace_tab_by_spaces: 4, | |
46 | + isEditable : false, | |
47 | + }); | |
48 | + }); | |
49 | + </script> | |
50 | + | |
51 | + <style> | |
52 | + .avatar | |
53 | + { | |
54 | + display: inline-block; | |
55 | + height: 0.5em; | |
56 | + width: 0.5em; | |
57 | + border-radius: 50%; | |
58 | + /*background: #3f51b5;*/ | |
59 | + color: white; | |
60 | + line-height: 2em; | |
61 | + font-size: 1.87em; | |
62 | + text-align: center; | |
63 | + margin-right: 5px; | |
64 | + } | |
65 | + | |
66 | + #toolbar{ | |
67 | + background: #2196F3 ; | |
68 | + } | |
69 | + #logo{ | |
70 | + width: 56px; | |
71 | + height: 56px; | |
72 | + background-image: url("http://spod.routetopa.eu/ow_static/themes/rtpa_matter/images/logo.png"); | |
73 | + background-size: auto 41px; | |
74 | + background-repeat: no-repeat; | |
75 | + background-position: center center; | |
76 | + | |
77 | + } | |
78 | + .area_container | |
79 | + { | |
80 | + overflow: hidden; | |
81 | + margin : 0.8em; | |
82 | + padding : 0.8em; | |
83 | + border-width: 1em; | |
84 | + border-radius: 0.125rem; | |
85 | + box-shadow: 0.125em 0.125em 0.1125em 0.125em rgba(0, 0, 0, 0.25); | |
86 | + } | |
87 | + | |
88 | + #visualization_slider_area | |
89 | + { | |
90 | + min-width: 566px; | |
91 | + min-height: 200px; | |
92 | + height: 175px; | |
93 | + } | |
94 | + .content-card { | |
95 | + position: relative; | |
96 | + float: left; | |
97 | + margin: .2em; | |
98 | + width: 14%; | |
99 | + min-height: 100px; | |
100 | + height: 40%; | |
101 | + background: #fff; | |
102 | + -moz-border-radius: 0.125rem; | |
103 | + -webkit-border-radius: 0.125rem; | |
104 | + border-radius: 0.125rem; | |
105 | + box-shadow: 0 0.625em 0.5125em 0 rgba(0, 0, 0, 0.25); | |
106 | + -webkit-box-shadow: 0 0.625em 0.5125em 0 rgba(0, 0, 0, 0.25); | |
107 | + -moz-box-shadow: 0 0.625em 0.5125em 0 rgba(0, 0, 0, 0.25); | |
108 | + padding: 1em; | |
109 | + } | |
110 | + | |
111 | + .content-selected{ | |
112 | + position: relative; | |
113 | + float: left; | |
114 | + top : 5%; | |
115 | + margin : .2em; | |
116 | + width: 14%; | |
117 | + height: 40%; | |
118 | + | |
119 | + background: #fff; | |
120 | + border-style: solid; | |
121 | + border-width: 0.03em; | |
122 | + -moz-border-radius: 0.125rem;; /* Firefox */ | |
123 | + -webkit-border-radius: 0.125rem;; /* Safari, Chrome */ | |
124 | + border-radius: 0.125rem; | |
125 | + box-shadow: 0 1.825em 1.7125em 0 rgba(0, 0, 0, 0.50); | |
126 | + -webkit-box-shadow: 0 1.825em 1.7125em 0 rgba(0, 0, 0, 0.50); | |
127 | + -moz-box-shadow: 0 1.825em 1.7125em 0 rgba(0, 0, 0, 0.50); | |
128 | + padding: 1em; | |
129 | + } | |
130 | + | |
131 | + </style> | |
132 | + | |
133 | +</head> | |
134 | +<body unresolved> | |
135 | + | |
136 | +<template id="DEEP" is="dom-bind"> | |
137 | + | |
138 | + <iron-ajax | |
139 | + auto | |
140 | + id="data_request" | |
141 | + url="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=07843fc3-07e1-4c66-9be4-fed43ca4a26f" | |
142 | + verbose="true" | |
143 | + on-response="handleResponseData" | |
144 | + debounce-duration="300"> | |
145 | + </iron-ajax> | |
146 | + | |
147 | + <iron-ajax | |
148 | + id="datales_list_request" | |
149 | + auto | |
150 | + url={{datasetsList}} | |
151 | + handle-as="json" | |
152 | + on-response="handleResponseDatalets" | |
153 | + debounce-duration="300"> | |
154 | + </iron-ajax> | |
155 | + | |
156 | + <iron-ajax | |
157 | + id="selected_datalet_request" | |
158 | + url={{deepUrl}} | |
159 | + verbose="true" | |
160 | + on-response="handleSelectedDatalet" | |
161 | + debounce-duration="300"> | |
162 | + </iron-ajax> | |
163 | + | |
164 | + <paper-toolbar id="toolbar"> | |
165 | + <paper-menu-button> | |
166 | + <paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button> | |
167 | + <paper-menu class="dropdown-content"> | |
168 | + <paper-item><a href="http://routetopa.eu/" target="_blank">ROUTE-TO PA European Project</a></paper-item> | |
169 | + <paper-item><a href="docs/docs.html" target="_blank">DEEP Documentation</a></paper-item> | |
170 | + </paper-menu> | |
171 | + </paper-menu-button> | |
172 | + <span class="title">DatalEts-Ecosystem Provider - Datalet Creator</span> | |
173 | + <a href="http://routetopa.eu/" target="_blank"><paper-icon-button id="logo" ></paper-icon-button></a> | |
174 | + </paper-toolbar> | |
175 | + <div id="main_content"> | |
176 | + <div class="vertical justified layout" style="margin-top: 40px;"> | |
177 | + | |
178 | + <div class="horizontal layout"> | |
179 | + <paper-textarea style="width: 80%;margin-top: 8px;" id="data_url" label="Dataset api data url" floatingLabel value="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=07843fc3-07e1-4c66-9be4-fed43ca4a26f" on-change="_textElementChanged"></paper-textarea> | |
180 | + <paper-dropdown-menu style="width: 20%;" id="datasets-sources" label="Example datasets"> | |
181 | + <paper-menu class="dropdown-content"> | |
182 | + <template is="dom-repeat" items="[[Datasets.names]]" as="dataset" index-as="i"> | |
183 | + <paper-item id="[[i]]" on-tap="_datasourceSelected">[[dataset]]</paper-item> | |
184 | + </template> | |
185 | + </paper-menu> | |
186 | + </paper-dropdown-menu> | |
187 | + </div> | |
188 | + | |
189 | + <div class="horizontal layout"> | |
190 | + | |
191 | + <div style="position:relative;width: 50%;min-height: 40vh;max-height: 40vh;" id="fields_placeholder" class="area_container flexchild" style="min-width:300px"> | |
192 | + <treeview-controllet id="fields_treeview"></treeview-controllet> | |
193 | + </div> | |
194 | + | |
195 | + <div style="position:relative;width: 50%;min-height: 40vh;max-height: 40vh;" id="table_fields_container" class="area_container flex2child"> | |
196 | + <div id="table_component_place_holder"></div> | |
197 | + </div> | |
198 | + | |
199 | + </div> | |
200 | + | |
201 | + <div class="horizontal layout"> | |
202 | + | |
203 | + <div style="position:relative;width: 50%;min-height: 80vh;max-height: 80vh;" id="datalet_params_main_placeholder" class="area_container flexchild" style="min-width:300px"> | |
204 | + <div class=""> | |
205 | + <div id="visualization_slider_area" class="area_container"></div> | |
206 | + <div id="fields_mapping_area" class="area_container horizontal layout"> | |
207 | + | |
208 | + <div id="selected_fields_main_container" class="field-mapping-card" style="position:relative;width: 50%;min-height: 40vh;max-height: 40vh;"> | |
209 | + <div class="title"> | |
210 | + <div class="medium">Selected fields</div> | |
211 | + </div> | |
212 | + <div id="selected_fields_container" class="area_container"></div> | |
213 | + </div> | |
214 | + | |
215 | + <div id="idm_fields_main_container" class="field-mapping-card" style="position:relative;width: 50%;min-height: 40vh;max-height: 40vh;"> | |
216 | + <div class="title"> | |
217 | + <div class="medium">Datalet fields</div> | |
218 | + </div> | |
219 | + <div id="datalet_idm_fields_container" class="area_container"></div> | |
220 | + </div> | |
221 | + </div> | |
222 | + <div id="idm_layout_main_container" class="area_container" style="position:relative;min-height: 20vh;max-height: 20vh;"> | |
223 | + <div class="title"> | |
224 | + <div class="medium">Layout fields</div> | |
225 | + </div> | |
226 | + <div id="idm_layout_container" class="area_container"></div> | |
227 | + </div> | |
228 | + </div> | |
229 | + | |
230 | + </div> | |
231 | + | |
232 | + <div style="position:relative;width: 50%;min-height: 80vh;max-height: 80vh;" id="datalet_main_container" class="area_container flex2child"> | |
233 | + </div> | |
234 | + | |
235 | + </div> | |
236 | + | |
237 | + <div class="horizontal layout"> | |
238 | + <div id="code_area" style="position:relative;width: 100%;min-height: 20vh;max-height: 20vh;" class="area_container flex2child"> | |
239 | + <textarea id="sbiricuda" style="position:relative;width: 100%;min-height: 20vh;max-height: 20vh;" style="" rows="4" cols="50"> | |
240 | + Copy and paste this code to inject the datalet in you page. | |
241 | + </textarea> | |
242 | + </div> | |
243 | + </div> | |
244 | + | |
245 | + </div> | |
246 | + | |
247 | + </div> | |
248 | +</template> | |
249 | +<script> | |
250 | + DEEP.Datasets = { | |
251 | + names:[ | |
252 | + 'Italy - Consuntivo entrate 2009', | |
253 | + 'Italy - Consuntivo entrate 2010', | |
254 | + 'Italy - Consuntivo entrate 2011', | |
255 | + 'Italy - Consuntivo entrate 2012', | |
256 | + 'Italy - Consuntivo entrate 2014', | |
257 | + 'Holland - Vestigingen register gemeente Groningen', | |
258 | + 'Holland - Woonruimte gemeente Groningen', | |
259 | + 'Ireland - SDCC Traffic Cameras', | |
260 | + 'Ireland - Derelict Site Register', | |
261 | + 'Ireland - Dublin City Council Commencement Notices', | |
262 | + 'Ireland - Dublin City Council Planning Applications', | |
263 | + 'Ireland - Dun Laoghaire-Rathdown County Council Planning Application 2008-2014', | |
264 | + 'Ireland - Fingal Council Planning Applications for last 7 years', | |
265 | + 'Ireland - Planning Register', | |
266 | + 'Ireland - Fingal Development Plan 2011-2017 Record of Protected Structures' | |
267 | + ], | |
268 | + urls: [ | |
269 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=07843fc3-07e1-4c66-9be4-fed43ca4a26f', | |
270 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=48a4db73-d3d4-4639-bbc2-9c797d0e6cda', | |
271 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=a14cc2fb-0c24-48d7-9370-834045797d89', | |
272 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fb32fcb6-5e44-4e52-b132-01c6540ddbee', | |
273 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=0cb600fc-19ad-4aaf-9794-1e6ea851840a', | |
274 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=ba554c1f-02a7-4d76-b449-fb9daa1f8bfd', | |
275 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=af7b3916-4347-469a-8354-3c2d559bd92f', | |
276 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52', | |
277 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fcbee83e-3d3d-4303-a568-24dd33d02adc', | |
278 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=ee00de68-f2e4-482f-a003-3c0561351075', | |
279 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=2f4a9d44-b52f-4c8b-a5db-d8f4a676d81e', | |
280 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=c479f061-9638-489d-ac55-0c68765548ff', | |
281 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=d29a477a-4734-43ef-8002-048c8640d441', | |
282 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=2b23f32d-e27e-4eef-af1e-27e05103df7d', | |
283 | + 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=5ea813bc-fdf9-4edb-b3b1-0142b593d5c6' | |
284 | + ] | |
285 | + }; | |
286 | + | |
287 | + DEEP.deepUrl = "http://192.168.214.128/DatalEts-Ecosystem-Provider/DEEP/"; | |
288 | + DEEP.datasetsList = "http://192.168.214.128/DatalEts-Ecosystem-Provider/DEEP/datalets-list"; | |
289 | + | |
290 | + DEEP.handleResponseData = function(e){ | |
291 | + DEEP.$.fields_treeview.init(e.detail.response); | |
292 | + $("#fields_placeholder").perfectScrollbar(); | |
293 | + $("#table_fields_container").perfectScrollbar(); | |
294 | + }; | |
295 | + | |
296 | + DEEP.handleResponseDatalets = function(e){ | |
297 | + DEEP.datalets_list = new Array(); | |
298 | + for(var i=0;i < e.detail.response.length;i++){ | |
299 | + var datalet_info = { name : e.detail.response[i].name , | |
300 | + image : e.detail.response[i].url + e.detail.response[i].name + ".png" | |
301 | + }; | |
302 | + | |
303 | + DEEP.datalets_list.push(datalet_info); | |
304 | + } | |
305 | + | |
306 | + DEEP.$.visualization_slider_area.innerHTML = '<items-slider-controllet items=\'' + JSON.stringify(DEEP.datalets_list) + '\'' + | |
307 | + '\'></items-slider-controllet>'; | |
308 | + }; | |
309 | + | |
310 | + DEEP.handleSelectedDatalet = function(e){ | |
311 | + | |
312 | + var response = e.detail.response; | |
313 | + DEEP.$.datalet_idm_fields_container.innerHTML = ""; | |
314 | + DEEP.$.idm_layout_container.innerHTML = ""; | |
315 | + | |
316 | + if(response.idm.inputs.input.constructor == Object) { | |
317 | + var input = response.idm.inputs.input; | |
318 | + if(input.selection == "*") { | |
319 | + var input_selected_fields = Polymer.dom(DEEP.$.selected_fields_container).querySelectorAll('draggable-element-controllet'); | |
320 | + for (var j = 0; j < input_selected_fields.length; j++) { | |
321 | + DEEP.$.datalet_idm_fields_container.innerHTML += '<draggable-element-controllet is-target="true" heading="Field ' + (j + 1) + '" description="' + input.description + '" number="' + (j + 1) + '"></draggable-element-controllet><br>'; | |
322 | + } | |
323 | + } | |
324 | + }else{ | |
325 | + for(var i =0; i < response.idm.inputs.input.length; i++){ | |
326 | + var input = response.idm.inputs.input[i]; | |
327 | + DEEP.$.datalet_idm_fields_container.innerHTML += '<draggable-element-controllet is-target="true" id="' + input.name + '" heading="' + input.name + '" description="' + input.description + '" number="' + (i + 1) + '"></draggable-element-controllet><br>'; | |
328 | + } | |
329 | + } | |
330 | + | |
331 | + if(response.idm.inputs.layouts.input.constructor == Object) { | |
332 | + var input = response.idm.inputs.layouts.input; | |
333 | + DEEP.$.idm_layout_container.innerHTML += '<text-element-controllet heading="' + input.name + '" description="' + input.description + '" number="1"></text-element-controllet>'; | |
334 | + }else{ | |
335 | + for(var i =0; i < response.idm.inputs.layouts.input.length; i++){ | |
336 | + var input = response.idm.inputs.layouts.input[i]; | |
337 | + DEEP.$.idm_layout_container.innerHTML += '<text-element-controllet heading="' + input.name + '" ' + | |
338 | + 'description="' + input.description + '" ' + | |
339 | + 'number="' + (i+1) + '">' + | |
340 | + '</text-element-controllet>'; | |
341 | + } | |
342 | + } | |
343 | + | |
344 | + $("#selected_fields_main_container").perfectScrollbar(); | |
345 | + $("#idm_fields_main_container").perfectScrollbar(); | |
346 | + $("#idm_layout_main_container").perfectScrollbar(); | |
347 | + $("#datalet_params_main_placeholder").perfectScrollbar(); | |
348 | + }; | |
349 | + | |
350 | + DEEP._urlChanged = function(event){ | |
351 | + DEEP.$.data_request.url = event.target.value; | |
352 | + DEEP.$.data_request.generateRequest(); | |
353 | + DEEP.$.table_component_place_holder.innerHTML = ""; | |
354 | + }; | |
355 | + | |
356 | + DEEP._datasourceSelected = function(event){ | |
357 | + DEEP.$.data_url.value = DEEP.Datasets.urls[parseInt(event.target.id)]; | |
358 | + DEEP.$.data_request.url = DEEP.Datasets.urls[parseInt(event.target.id)]; | |
359 | + DEEP.$.data_request.generateRequest(); | |
360 | + DEEP.$.table_component_place_holder.innerHTML = ""; | |
361 | + }; | |
362 | + | |
363 | + DEEP._fieldsSelected = function(e){ | |
364 | + | |
365 | + DEEP.$.selected_fields_container.innerHTML = ""; | |
366 | + for(var i=0;i<e.detail.fields.length;i++) { | |
367 | + DEEP.$.selected_fields_container.innerHTML += '<draggable-element-controllet identifier="' + e.detail.fields[i] + | |
368 | + '" label="' + e.detail.fields[i].split(",")[e.detail.fields[i].split(",").length -1] + | |
369 | + '"></draggable-element-controllet><br>'; | |
370 | + } | |
371 | + | |
372 | + ComponentService.deep_url = DEEP.deepUrl; | |
373 | + | |
374 | + ComponentService.getComponent({ | |
375 | + component : "datatable-datalet", | |
376 | + params :{ | |
377 | + 'data-url' : DEEP.$.data_url.value | |
378 | + }, | |
379 | + fields : e.detail.fields, | |
380 | + placeHolder : DEEP.$.table_component_place_holder | |
381 | + }); | |
382 | + | |
383 | + }; | |
384 | + | |
385 | + DEEP._dataletSelected = function(e){ | |
386 | + DEEP.selected_datalet = e.detail.datalet; | |
387 | + DEEP.$.selected_datalet_request.url = DEEP.deepUrl + e.detail.datalet; | |
388 | + DEEP.$.selected_datalet_request.generateRequest(); | |
389 | + }; | |
390 | + | |
391 | + DEEP._fieldsMapped = function(e){ | |
392 | + DEEP.generateDataletPreview(); | |
393 | + }; | |
394 | + | |
395 | + DEEP.timer = 0; | |
396 | + DEEP._textElementChanged = function(e){ | |
397 | + clearTimeout (DEEP.timer); | |
398 | + DEEP.timer = setTimeout(DEEP.generateDataletPreview, 1500); | |
399 | + }; | |
400 | + | |
401 | + DEEP.getXMLHttpRequest = function() | |
402 | + { | |
403 | + if (window.XMLHttpRequest) { | |
404 | + return new XMLHttpRequest(); | |
405 | + } | |
406 | + else { | |
407 | + try { | |
408 | + return new ActiveXObject("MSXML2.XMLHTTP.3.0"); | |
409 | + } | |
410 | + catch(ex) { | |
411 | + return null; | |
412 | + } | |
413 | + } | |
414 | + }; | |
415 | + | |
416 | + DEEP.generateDataletPreview = function(){ | |
417 | + | |
418 | + var input_mapped_fields = Polymer.dom(DEEP.$.datalet_idm_fields_container).querySelectorAll('draggable-element-controllet[is-target=true]'); | |
419 | + DEEP.selected_fields = Array(); | |
420 | + | |
421 | + for (var i = 0; i < input_mapped_fields.length; i++) { | |
422 | + if (input_mapped_fields[i].value != "") { | |
423 | + DEEP.selected_fields.push(input_mapped_fields[i].value); | |
424 | + } | |
425 | + } | |
426 | + | |
427 | + var input_layouts_fields = Polymer.dom(DEEP.$.idm_layout_container).querySelectorAll('text-element-controllet'); | |
428 | + DEEP.params_fields = {'data-url' : DEEP.$.data_url.value}; | |
429 | + | |
430 | + for (var i = 0; i < input_layouts_fields.length; i++) { | |
431 | + if (input_layouts_fields[i].value != "") { | |
432 | + DEEP.params_fields[input_layouts_fields[i].heading] = input_layouts_fields[i].value; | |
433 | + } | |
434 | + } | |
435 | + | |
436 | + ComponentService.deep_url = DEEP.deepUrl; | |
437 | + ComponentService.getComponent({ | |
438 | + component : DEEP.selected_datalet, | |
439 | + params : DEEP.params_fields, | |
440 | + fields : DEEP.selected_fields, | |
441 | + placeHolder : DEEP.$.datalet_main_container | |
442 | + }); | |
443 | + | |
444 | + var request = DEEP.getXMLHttpRequest(); | |
445 | + | |
446 | + request.onreadystatechange = function(){ | |
447 | + if(request.readyState == 4){ | |
448 | + try { | |
449 | + var resp = JSON.parse(request.response); | |
450 | + var link = '<link rel="import" href="' + resp.bridge_link + resp.component_link +'">\n'; | |
451 | + | |
452 | + //Build datalet injecting html code | |
453 | + var datalet_code = link + '<' + DEEP.selected_datalet; | |
454 | + var keys = Object.keys(DEEP.params_fields); | |
455 | + for(var i = 0; i < keys.length; i++){ | |
456 | + datalet_code += ' ' + keys[i] + '=\'' + DEEP.params_fields[keys[i]] +'\''; | |
457 | + } | |
458 | + datalet_code += " fields='" + JSON.stringify(DEEP.selected_fields) + "'></" + DEEP.selected_datalet + ">"; | |
459 | + | |
460 | + DEEP.$.code_area.innerHTML = '<textarea id="sbiricuda" style="position:relative;width: 100%;min-height: 20vh;max-height: 20vh;" style="" rows="4" cols="50" autofocus="false">' + | |
461 | + '<!-- ADD THE POLYFILL TO YOUR PAGE - https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.14/webcomponents.min.js -->\n' + datalet_code + | |
462 | + '</textarea>'; | |
463 | + | |
464 | + editAreaLoader.init({ | |
465 | + id : "sbiricuda" // textarea id | |
466 | + ,syntax: "html" // syntax to be uses for highgliting | |
467 | + ,start_highlight: true // to display with highlight mode on start-up | |
468 | + ,syntax: "html" | |
469 | + ,replace_tab_by_spaces: 4, | |
470 | + isEditable : false, | |
471 | + }); | |
472 | + | |
473 | + } catch (e){ | |
474 | + var resp = { | |
475 | + status: 'error', | |
476 | + data: 'Unknown error occurred: [' + request.response + ']' | |
477 | + }; | |
478 | + } | |
479 | + }}; | |
480 | + | |
481 | + request.open('GET', DEEP.deepUrl + DEEP.selected_datalet); | |
482 | + request.send(); | |
483 | + | |
484 | + }; | |
485 | + | |
486 | +</script> | |
487 | + | |
488 | +</body> | |
489 | +</html> | |
0 | 490 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/change_log.txt
0 → 100644
1 | +**** v 0.8.2 **** | |
2 | +- Change back to remove the speed optimization for highlight process introduced in 0.8.1 that has too much bugs | |
3 | +- Syntax name are no more stored in language files but in syntax files. Thoses display names will be used only if the compressor tools is used, otherwise syntax code is displayed | |
4 | +- Activate word-wrap feature for opera > 9.6 | |
5 | +- Bug fix: Selection wasn't corretcly remembered between file tabs | |
6 | +- Bug fix: [2886499] Page up and page Down action are no more executed if Alt touch is pressed | |
7 | +- Bug fix: [2887118] UTF-8 encoded URLs return wrong base URL | |
8 | +- Bug fix: [2851936] Unresolved reference to isIE in elements_functions.js | |
9 | +- Bug fix: [2886836] get_IE_selection bug when closed... | |
10 | +- bug fix: JavaScript error when switching to fullscreen (https://sourceforge.net/projects/editarea/forums/forum/556921/topic/3388824) | |
11 | +- Bug fix (but not applicable due to change back) : [2854519, 2854642, 2792217, 2834579 ] Desynchronisation occcured with <, > and & characters | |
12 | + | |
13 | +**** v 0.8.1.1 **** | |
14 | +- Fix bug of frequent syntax desynchronisation when the first character of the textarea was highlighted | |
15 | +- In unload now check that parent.editareaLoader still exists before calling it | |
16 | +- Now consider that gecko and webkit based browser are valid browsers (but I won't test them all) | |
17 | + | |
18 | +**** v 0.8.1 **** | |
19 | +- 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) | |
20 | +- Greatly improved speed of line-height management in word-wrap context | |
21 | +- Add java syntax (thanks to Dawson Goodell) | |
22 | +- Use faster regexp for matching quoted strings | |
23 | +- Bug fix: if a highlighted quote or comment string contains cariage return, editing text on one of the lines was causin a highlight desynchronisation | |
24 | +- Bug fix: text war blur on Safari 3.2 (thanks to spellcoder) | |
25 | +- Bug fix: there had several mistake with non-monospace font (thanks to spellcoder) | |
26 | +- Bug fix: if show_line_colors was disabled and word wrap enable, highlighted text wasn't refreshed if a new line appears | |
27 | +- Bug fix: in multi file edition, closing the last tab was throwing an error in Firefox and let the content of the textarea displayed | |
28 | +- 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 | |
29 | + | |
30 | +**** v 0.8 **** | |
31 | +- 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' ) | |
32 | +- We can now clearly see the selected text | |
33 | +- 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) | |
34 | +- Add Safari 4 support | |
35 | +- Add Chrome 2 support | |
36 | +- Better support of Opera 9.6 | |
37 | +- Add Simplified Chinese translation "zh" (thanks to Abentian) | |
38 | +- Add Bulgarian translation "bg" (thanks to Valentin Hristov) | |
39 | +- Rename internal function $() by _$() | |
40 | +- Delete EditArea.add_event() method (duplicate af editAreaLoader.add_event() method) | |
41 | +- Do some code cleanup-up | |
42 | +- 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) | |
43 | +- Bug fix: EditArea.update_size sometimes uses undefined variable (fix this possibility and cleanup events) | |
44 | +- Bug fix: Template.html was not valid XHTML | |
45 | +- Bug fix: The checked attribute of the toogle button was not defined in xhtml syntax | |
46 | +- 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 | |
47 | +- Bug fix: When EditArea is used to replace a textarea which has style="visibility:hidden;", switching off EditArea would throw an error under IE | |
48 | + | |
49 | +**** v 0.7.3 **** | |
50 | +- Add Finnish transaltion (thanks to Janne Mäntyharju) | |
51 | +- 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 | |
52 | +- better add_style method (faster than old one) thanks to Spellcoder | |
53 | +- Bug fix: fix bug with mootools 1.2 | |
54 | +- Bug fix: if page had no stylesheets when editarea load, it would generate an error | |
55 | + | |
56 | +**** v 0.7.2.3 **** | |
57 | +- it's now released under both LGPL, Apache, BSD license (you can use the one you prefer) | |
58 | +- add support for bonEcho browser | |
59 | + | |
60 | +**** v 0.7.2.2 **** | |
61 | +- Fix bug regression introduced in 0.7.2 that make IE7 not working | |
62 | +- add Esperento translation (thanks to Olivier) | |
63 | +- add Coldfusion syntax (thanks to Max Leynov) | |
64 | + | |
65 | +**** v 0.7.2.1 **** | |
66 | +- fix bug for firefox rendering of highlighted lines that doesn't begin with a tab | |
67 | +- support for browser with grandParadisio agent instead of firefox | |
68 | + | |
69 | +**** v 0.7.2 **** | |
70 | +- add Chrome support | |
71 | +- add show_line_colors init() option for enabling syntax color display and update on the currently edited line (disable the blue bar) (default to false) | |
72 | +- Add Perl syntax definition file (thanks to Christoph Pinkel) | |
73 | +- Bug fix: there allways was an horizontal scrollbar even if the content fit in the area. | |
74 | + | |
75 | +**** v 0.7.1.3 **** | |
76 | +- Fix a bug introduced in Firefox 3.0.1 => the browser is no more able to render properly "pre" element with left padding... | |
77 | +- Add Robots.txt (thanks to Pavle Ggardijan) and T-SQL syntax definition files (thanks to Miladin Joksic) | |
78 | + | |
79 | +**** v 0.7.1.2 **** | |
80 | +- Fix a bug on the full screen mode (regression added on 0.7.1.1) | |
81 | + | |
82 | +**** v 0.7.1.1 **** | |
83 | +- Firefox 3 RC1 compatibility | |
84 | +- Code size reduction: 120Ko => 107Ko for edit_area_full.js | |
85 | + | |
86 | +**** v 0.7.1 **** | |
87 | +- released under both LGPL and Apache license (you can use the one you prefer) | |
88 | +- it's now possible to get a readonly mode: | |
89 | + * new EditAreaLoader.init()'s option: "is_editable": true/false | |
90 | + * Possibility to switch edition mode by using the execCommand function: editAreaLoader.execCommand('editor_id', 'set_editable', !editAreaLoader.execCommand('editor_id', 'is_editable')); | |
91 | +- Added Ruby syntax (thanks to Patrice De Saint Steban) | |
92 | +- Fix a bug where the textarea lose the focus under firefox for Mac | |
93 | +- Minor other bug fixes | |
94 | + | |
95 | +**** v 0.7.0.2 **** | |
96 | +- Fixed a bug with translation files containing non-latin caracters. Translations files must be in UTF-8. | |
97 | +- Added Czech, Macedionian and Russian translations | |
98 | + | |
99 | + | |
100 | +**** v 0.7.0.1 **** | |
101 | +- in multiple file mode, it's now possible to cancel the 'EA_file_close_callback' function. if the callback return false, the edited file won't be closed | |
102 | +- bug fix: if no syntax was defined in the main init() function in multifile mode, the first time the text was not highlighted | |
103 | + | |
104 | + | |
105 | +**** v 0.7 **** | |
106 | +- it's now possible to edit multiple files into one instance of EditArea. This (sponsored by Jupiter) feature comes with: | |
107 | + * new EditAreaLoader.init()'s option: "is_multi_files": true | |
108 | + * new editAreaLoader's functions: editAreaLoader.getCurrentFile(editArea_id), editAreaLoader.getFile(editArea_id, file_id), editAreaLoader.getAllFiles(editArea_id), editAreaLoader.openFile(editArea_id, file_infos), editAreaLoader.closeFile(editArea_id, file_id), editAreaLoader.setFileEditedMode(editArea_id, file_id, edited_mode) | |
109 | + * new callabacks: EA_file_switch_on_callback, EA_file_switch_off_callback, EA_file_close_callback | |
110 | +- look likes Safari 3 is working with EditArea | |
111 | +- add spanish translation (thanks Garito) | |
112 | +- add slovak translation (thanks Gabriel Schwardy) | |
113 | +- add SQL syntax definition file (thanks to Philippe Lewicki) | |
114 | +- the syntax selection plugin has been integrated to editarea core and load only needed files (the plugins was loading all the possible syntax files...). Toolbar button name: "syntax_selection", comma separated available syntax list: "syntax_selection_allow" | |
115 | +- add a 'compression' option in edit_area_compressor.php that allow to set where the code should be compressed or just packed (simple packed mode usefull for debugging) | |
116 | +- the yellow area that indicate the current edited line is now blue | |
117 | +- bug fix: parenthesis matching was not working correctly if there where an "<" between parenthesis | |
118 | + | |
119 | +**** v 0.6.7 **** | |
120 | +- add a new plugin that allow the user to change the syntax definition in use. It adds a select in the toolbar. - plugin name to add to the plugin list: "syntax_selection". - plugin name to add to the toolbar list: "syntax_selection". - possible parameter to add to EditAreaLoader.init(): | |
121 | +"syntax_selection_allow": (String) define a list separated by "," of possible language syntax to use (eg: "php,js,python,html") | |
122 | +- add Croatian translation (HR) (thanks to Ivan Vucica and Davor Cihlar) | |
123 | +- add BASIC, Brainf*ck, C, C++ and Pascal syntax definition files (thanks to Ivan Vucica and Davor Cihlar) | |
124 | +- add Iceweasel as a known working navigator (its a clone of Firefox) | |
125 | +- improved the php syntax by highlighting the variables ($...) | |
126 | +- reactivate gzip compression for IE7 (was desactivate for IE as it sometimes failed). (Let me know if you see that the load fails under IE7) | |
127 | +- pressing "enter" while being in the search box now perform a search. | |
128 | +- add Camino as a supported browser | |
129 | +- bug fix: when clicking between the bottom toolbar and the textarea (when there is only few lines of text), the textarea didn't get the focus | |
130 | +- bug fix: under IE the delete_instance() method was throwing an error | |
131 | +- bug fix: if the textarea to convert in an EditArea was in a frame (or iframe) getting back from fullscreen to normal display was not restoring the correct settings to the frame containing the textarea. | |
132 | +- bug fix (at least I hope): in IE if the textarea to convert in an EditArea was in a frame, resizing the frame was not correctly resizing the editor if it was in fullscreen. | |
133 | +- bug fix: in Opera the selectionned line was not rendered correctly if containing \t caracters (bug introduced in one of the latest version...) | |
134 | +- bug fix: "altgr+f" was openning the searchbox and avoid to write "[" and "]" in croatian keyboards. | |
135 | +- bug fix: in Firefox "ctrl+tab" was inserting a tabulation while switching active tab (window) | |
136 | + | |
137 | +Note: v 0.6.5 and v 0.6.6 have been private release (change log is regrouped in v 0.6.7) | |
138 | + | |
139 | +**** v 0.6.4 **** | |
140 | +- add replace_tab_by_spaces init() option which allow to replace all tabulation caracters typped in the text by a given number of spaces | |
141 | +- add min_width and min_height init() option for the minimum size in pixel for the editor | |
142 | +- add dutch translation files (NL) (thanks to Bart Bosma) | |
143 | +- pressing Shift+Tab when no text is selected now delete the tabulation before the cursor (if a tabulation is present directly behing the cursor) | |
144 | +- improve Python syntax (thanks to Andre Roberge) | |
145 | +- bug fix: the fullpage plugin was not working correctly when the Editor was placed inside several divs that have positioning of there own | |
146 | +- bug fix: one regexp used in edit_area_compressor.php was not compatible with latest PCRE version | |
147 | + | |
148 | +- fix the my_load and my_save functions of the 'exemple_full.html' page | |
149 | + | |
150 | +**** v 0.6.3.1 **** | |
151 | +- regression: restore monospace as default font | |
152 | +- add little improvements to the PHP compressor: allow to win 7 Ko on edit_area_full.js | |
153 | +- add the version number in the about popup | |
154 | +- bug fix: fix a regexp that was not compliant with newer version of PCRE | |
155 | +- bug fix: fix some bug with the fullscreen mode (still not perfect in Opera) | |
156 | +- bug fix: the close button of the help popup was not correctly translated | |
157 | +- bug fix: when deleting an instance of editArea toggle_off was called even if the editArea was not displayed | |
158 | + | |
159 | + | |
160 | +**** v 0.6.3 **** | |
161 | +- allow to use non monospace font using the font_family init option. Firefox get smaller tabulation with non monospace fonts. IE doesn't change the tabulation width and Opera doesn't take this option into account... new default font-familly: 'verdana,monospace' | |
162 | +- add fullscreen option in the toolbar and as an init() option. | |
163 | +- if the based textarea has a width (or height) in '%', EditArea will get the same '%' width (or height), allowing EditArea to be resized in the same time than the window. | |
164 | +- add many callback possibility: submit_callback, EA_load_callback, EA_unload_callback, EA_init_callback, EA_toggle_on_callback, EA_toggle_off_callback, EA_delete_callback (see documentation for more information) | |
165 | +- bug fix: when toggling from textarea to editarea, IE was almost of the time not keeping the selection | |
166 | +- bug fix: the brackets where still highlighted in red when being deleted | |
167 | +- bug fix: brackets where not placed correctly when the line contains html entitites (& " etc....) | |
168 | + | |
169 | + | |
170 | +**** v 0.6.2 **** | |
171 | +WARNING => POSSIBLE BREAK COMPATIBILITY: | |
172 | +- the load_callback now receive the 'id' of the textarea and no more a reference to the textarea. Developpers should use editAreaLoder methods rather than modfying directly the textarea. | |
173 | +- the save_callback now receive the 'id' of the textarea as first argument, and it's content in the second argument. | |
174 | + | |
175 | +- EditArea is now compatible with javascript libraries like "prototype" (1.5) and "mootools" (release 83) | |
176 | +- add two function to EditAreaLoader: hide(id) and show(id), that will allow to completly hide/restore both EditArea and normal textarea (usefull when EditArea is included in tabs). | |
177 | +- it's no more possible to move the search window out of the frame. | |
178 | +- gecko_spellcheck option is now set to false by default. | |
179 | +- add a onchange_callback option (cf doc) | |
180 | +- bug fix: in IE when syntax highlight was on, clicking on the textarea outside the range of the text, the click wasn't taking into account. | |
181 | +- bug fix: references to the orginal textarea could be lost while using EditArea. | |
182 | +- bug fix: using insertTags, getSelectionRange when editArea was not focused, IE failed | |
183 | +- bug fix: main script could fail to load additionnal files in certain specific cases | |
184 | + | |
185 | +**** v 0.6.1 **** | |
186 | +- compatiblity with Firefox 2 checked (was already compatible before). | |
187 | +- compatiblity with IE7 checked (was already compatible before). | |
188 | +- added possibility to call the editAreaLoader.init() function at any moment (no more limited to window load). Allow to replace an EditArea instance by a new one with other options. | |
189 | +- added new gecko_spellcheck option, this enables you to disable/enable the FF 2.0 spellchecker. | |
190 | +- added editAreaLoader.delete_instance(id) to allow to delete an EditArea instance | |
191 | +- Fix a bug where "Ctrl+G" wasn't openning anymore the go to line prompt box. | |
192 | + | |
193 | + | |
194 | +**** v 0.6.0.1 **** | |
195 | +- add italian translation (thanks to Luciano Vernaschi) | |
196 | +- add polish translation (thanks to Piotr Furman) | |
197 | +- improve deutsh translation (thanks to Felix Riesterer) | |
198 | +- add a little style improvement for buttons in search popup. they can't be splited in two line anymore | |
199 | +- change color for tags in html and xml syntax due to visibility problems | |
200 | + | |
201 | + | |
202 | +**** v 0.6 **** | |
203 | +- add plugins possibilies | |
204 | +- add editAreaLoader.insertTags function to allow easy tags insertion. | |
205 | +- improve undo & redo functionnality | |
206 | +- improve php compression: "edit_area_full.js" is 9 Ko smaller | |
207 | +- improve syntax highlight regexp for quotted string. \\" or \\' (or \\\\", etc...) will now effectively close quotted string | |
208 | +- add scrollbars to the popups when the popup's height is smaller than the editor's height | |
209 | +- add japanese translation file (thanks to ISHITOYA Kentaro) | |
210 | +- add possibility to add line-break in toolbar ("*") | |
211 | +- disable gzip compression for IE (see: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q312496) | |
212 | +- bug fix: when submitting form while editarea toggled off, the post value was equals to the old content of editarea and not the visible textarea | |
213 | +- bug fix: under IE the editor was scrolling when pressing enter | |
214 | +- bug fix: when insterting text on first line there was an highlight desynchronization | |
215 | + | |
216 | + | |
217 | + | |
218 | +**** v 0.5.3 **** | |
219 | +WARNING => POSSIBLE BREAK COMPATIBILITY: | |
220 | +- correct a spelling error: "toogle" become "toggle" in the whole code. This can perturb the initialization with the "allow_toggle" init parameters | |
221 | + | |
222 | +- add a case sensitive option in syntax definition files | |
223 | +- improve html syntax definition file | |
224 | +- add xml syntax definition file | |
225 | +- add vb syntax definition file (thanks to Martin Gottlieb) | |
226 | +- add some function that will allow dynamic EditArea content management, taking into account if the editor is displayed or toggled off (editAreaLodaer.getValue(), editAreaLoader.setValue(), editAreaLoader.getSelectedText(), editAreaLoader.setSelectedText(), editAreaLoader.getSelectionRange and editAreaLoader.setSelectionRange()). See "javascript functions" documentation for more informations | |
227 | +- add a generic function (editaAreaLoader.execCommand) to allow to access EditArea's functions and datas | |
228 | +- add portuguese translation file (thanks to Leonardo Sapucaia) | |
229 | +- add compatibility to IE7 RC1 | |
230 | + | |
231 | + | |
232 | +**** v 0.5.2 **** | |
233 | +- Opera improvement: text indentation is now working, and "go to line" is now working as in other browsers | |
234 | +- Bug fix: It was still possible to select text in search popup | |
235 | +- Bug fix: the "go to line" popup wasn't displaying anymore | |
236 | +- There was still some hard codded word in the search field => added them to translation files | |
237 | +- Bug fix: when multiple languages were used in the same page, there could have translation exchange between the different editors | |
238 | + | |
239 | + | |
240 | +**** v 0.5.1 **** | |
241 | +- Bug fix: the highlighted bracket was displayed on line 1 when it should be in line 2 | |
242 | +- Bug fix: the highlighted bracket were bad displayed in IE | |
243 | +- Bug fix: their was some error in the optimisation process of the highlight mode | |
244 | +- Bug fix: their was a bug when moving the search popup on IE | |
245 | + | |
246 | +**** v 0.5 **** | |
247 | +- Now released under LGPL | |
248 | +- Rewrite nearly from scratch | |
249 | +- Added Danish translation file (thanks to Peter Klein) | |
250 | +- Add python syntax | |
251 | + | |
252 | + | |
253 | +WARNING => BREAK COMPATIBILITY: | |
254 | +- the whole loading process (javascript include and init function call) is changed (but it's similar to the old version) | |
255 | +- the languages translation files are not stored in the same variable | |
256 | + | |
257 | + | |
258 | +IMPROVEMENTS: | |
259 | +- The whole code is more stable | |
260 | +- Allow several instance on the same page | |
261 | +- Faster to load | |
262 | +- The highlight process is more stable and there is nearly no more to use the "re sync" button | |
263 | +- Add support of Opera 9 (even if its still not perfect) | |
264 | +- Add the possibility to load a new compressed script of only 20Ko for the whole core script even if PHP is not installed | |
265 | +- The textarea can be toggled to an EditArea on window load or later | |
266 | +- The EditArea is loaded in a iframe => there is no more interaction with user css | |
267 | +- Support the reset action of a form | |
268 | +- Add support for "page up" & "page down" button | |
269 | +- There is now a waiting screen when toggling on the highlight syntax (but it can't be an animated one, even gif are not animated due to CPU load) | |
270 | +- All supported browsers can now change font-size | |
271 | + | |
272 | +BUG FIXES: | |
273 | +- Sometimes while using the "toggle editor" button to turn of the editor, the standard textarea was expanded to the full size of the textarea content. | |
274 | +- When resizing the area the selection was lost | |
275 | +- Allow translation for some forgotten hard-coded word (the "move" button for search popup, and "font size", and keys word in help panel). | |
276 | +- It was possible to "drag" the buttons from the Search/Replace popup into the content of the textarea. | |
277 | +- On first display (when the files are not in cache) or with xhtml doctype there is a display bug (the content of the textarea exceed of 4px) | |
278 | +- when the cursor was at the beginning of the 1st line of the textarea, the caracter position was set to 0 instead of 1 | |
279 | + | |
280 | + | |
281 | + | |
282 | +***v 0.4**** | |
283 | +- Increases syntax highlight proccess speed by 5 => allow a better live editing mode with syntax highlight. | |
284 | +- Now syntax highlight has a real language syntax. Text is parsing with rules depending of the language definition file. (limitation: there is only one language on the same time > doesn't allow to parse html and php on the same page). | |
285 | +- Syntax highlight can be easily extended with new code languages (there is currently: php, css, js, html). | |
286 | +- Add german language file (thanks to Olaf Brambrink). | |
287 | +- Fix some little bugs. | |
288 | + | |
289 | + | |
290 | + | |
291 | + | |
292 | +***v0.33*** | |
293 | +- First release. | ... | ... |
docs/js/editarea_0_8_2/docs/about.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>About</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <h2>General information</h2> | |
15 | + <p>EditArea is a free javascript editor for source code. It allow to write | |
16 | + well formated source code. That's no way a WYSIWYG editor. | |
17 | + </p> | |
18 | + <p> | |
19 | + EditArea is developed by Christophe Dolivet | |
20 | + and is currently released | |
21 | + under the "LGPL", "Apache" and "BSD" licenses (use the one you want), read the licenses agreement for details. | |
22 | + </p> | |
23 | + <h2>Features</h2> | |
24 | + <ul> | |
25 | + <li>Easy to integrate, only one script include and one function call</li> | |
26 | + <li>Tabulation support (allow to write well formated source code)</li> | |
27 | + <li>Customizable real-time syntax highlighting (currently: PHP, CSS, Javascript, Python, HTML, XML, VB, C, CPP, SQL, Pascal, Basic, Brainf*ck, and probably more...)</li> | |
28 | + <li>Word-wrap support</li> | |
29 | + <li>Search and replace (with regexp)</li> | |
30 | + <li>Auto-indenting new lines</li> | |
31 | + <li>Line numerotation</li> | |
32 | + <li>Multilanguage support (currently: Croatian, Czech, Danish, Dutch, English, Esperanto, French, German, Italian, Japanese, Macedonian, Polish, Portuguese, Russian, Slovak, Spanish, and probably more...)</li> | |
33 | + <li>Possible PHP gzip compression (compress the core files to one file of ~25Ko)</li> | |
34 | + <li>Allow multiple instances</li> | |
35 | + <li>Full screen mode</li> | |
36 | + <li>Possible plugin integration</li> | |
37 | + <li>Possible save and load callback functions</li> | |
38 | + <li>Possible dynamic content management</li> | |
39 | + <li>Can work in the same environment than "prototype" and "mootools"'s like libraries.</li> | |
40 | + </ul> | |
41 | + | |
42 | + </div> | |
43 | + <div class='footer'> | |
44 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
45 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
46 | + <br style="clear: both" /> | |
47 | + </div> | |
48 | +</body> | |
49 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/compatibility.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Compatiblity Chart</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <h2>Browser support</h2> | |
15 | + <p>EditArea uses advanced JavaScript and tries to be as smart as possible when it comes to | |
16 | + different browsers. But as every browser (and every version of thoses browser) manage | |
17 | + css and javascript implementation with some little change, it will probably be bad | |
18 | + displayed on other browser. | |
19 | + The table was reset to only show the browsers I take care of. | |
20 | + </p> | |
21 | + | |
22 | + <p> Since I have no mac and currently have no computer under linux, I can't testing multi-plateform browsers. | |
23 | + Let me know if you constat that such browsers are working. | |
24 | + </p> | |
25 | + <p> | |
26 | + <table border="1" cellspacing="0" cellpadding="4"> | |
27 | + <tr> | |
28 | + <td> </td> | |
29 | + <td>Windows XP</td> | |
30 | + <td>Linux</td> | |
31 | + <td>MacOS X</td> | |
32 | + </tr> | |
33 | + <tr> | |
34 | + <td>MSIE 6 & 7 & 8</td> | |
35 | + <td>OK</td> | |
36 | + <td> </td> | |
37 | + <td> </td> | |
38 | + </tr> | |
39 | + <tr> | |
40 | + <td>Firefox 1.5 & 2 & 3 & 3.5</td> | |
41 | + <td>OK</td> | |
42 | + <td>OK</td> | |
43 | + <td>OK</td> | |
44 | + </tr> | |
45 | + <tr> | |
46 | + <td>Safari 3.0 & 3.1 & 4</td> | |
47 | + <td>OK</td> | |
48 | + <td> </td> | |
49 | + <td>OK</td> | |
50 | + </tr> | |
51 | + <tr> | |
52 | + <td>Chrome 1 & 2 & 3</td> | |
53 | + <td>OK</td> | |
54 | + <td>???</td> | |
55 | + <td>???</td> | |
56 | + </tr> | |
57 | + <tr> | |
58 | + <td>Opera 9 & 9.6 & 10.1</td> | |
59 | + <td>OK</td> | |
60 | + <td>OK</td> | |
61 | + <td>OK</td> | |
62 | + </tr> | |
63 | + <tr> | |
64 | + <td>Camino 1.2</td> | |
65 | + <td> </td> | |
66 | + <td> </td> | |
67 | + <td>OK</td> | |
68 | + </tr> | |
69 | + </table> | |
70 | + </p> | |
71 | + <p> | |
72 | + (1) - Partialy working<br /> | |
73 | + (2) - Buggy browser version | |
74 | + </p> | |
75 | + <br /> | |
76 | + <strong>Notices:</strong> | |
77 | + <ul> | |
78 | + <li>The Opera 9 full compatibility is nearly impossible due to some javascript implementation bugs in Opera.</li> | |
79 | + <li>Iceweasel is considered to be the same as Firefox.</li> | |
80 | + <li>As Mozilla is replaced by Firefox, I don't include it in my testcase.</li> | |
81 | + <li>As Netscape 8 is not a world release I also don't include it in my testcase.</li> | |
82 | + </ul> | |
83 | + </div> | |
84 | + <div class='footer'> | |
85 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
86 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
87 | + <br style="clear: both" /> | |
88 | + </div> | |
89 | +</body> | |
90 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/configuration.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Configuration reference</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <p>This document is the index/reference page for all available core configuration | |
15 | + options in EditArea.</p> | |
16 | + <div class="separator"></div> | |
17 | + | |
18 | + <h2>Configuration options</h2> | |
19 | + <p>All configuration options below is to be placed within the init JavaScript call.<br /> | |
20 | + <ul class='optionlist'> | |
21 | + <li><strong>Needed option</strong> | |
22 | + <ul> | |
23 | + <li><strong>id</strong>: should contain the id of the textarea that should be converted into an editor | |
24 | + <br /><span class='underline'>Type</span>: String | |
25 | + <br /><span class='underline'>Default</span>: null</li> | |
26 | + </ul> | |
27 | + <br /> | |
28 | + </li> | |
29 | + <li><strong>General</strong> | |
30 | + <ul> | |
31 | + <li><strong>language</strong>: should contain a code of the language pack to be used for translation. If EditArea doesn't have a language pack for your language you could always write your own and contribute this back to this project by uploading it as a Patch at <a href='http://sourceforge.net/projects/editarea/'>SourceForge</a>. | |
32 | + <br /><span class='underline'>Type</span>: String | |
33 | + <br /><span class='underline'>Default</span>: "en" | |
34 | + </li> | |
35 | + <li><strong>syntax</strong>: should contain a code of the syntax definition file that must be used for the highlight mode. | |
36 | + <br /><span class='underline'>Type</span>: String | |
37 | + <br /><span class='underline'>Default</span>: "" | |
38 | + </li> | |
39 | + <li><strong>start_highlight</strong>: set if the editor should start with highlighted syntax displayed. | |
40 | + <br /><span class='underline'>Type</span>: Boolean | |
41 | + <br /><span class='underline'>Default</span>: false | |
42 | + </li> | |
43 | + <li><strong>is_multi_files</strong>: determine if the editor load the content of the textarea (false) or if it wait for an openFile() call for allowing file editing. | |
44 | + <br /><span class='underline'>Type</span>: Boolean | |
45 | + <br /><span class='underline'>Default</span>: false | |
46 | + </li> | |
47 | + <li><strong>min_width</strong>: define the minimum width of the editor | |
48 | + <br /><span class='underline'>Type</span>: Integer | |
49 | + <br /><span class='underline'>Default</span>: 400 | |
50 | + </li> | |
51 | + <li><strong>min_height</strong>: define the minimum height of the editor | |
52 | + <br /><span class='underline'>Type</span>: Integer | |
53 | + <br /><span class='underline'>Default</span>: 100 | |
54 | + </li> | |
55 | + <li><strong>allow_resize</strong>: define one with axis the editor can be resized by the user. | |
56 | + <br /><span class='underline'>Type</span>: String ("no" (no resize allowed), "both" (x and y axis), "x", "y") | |
57 | + <br /><span class='underline'>Default</span>: "both" | |
58 | + </li> | |
59 | + <li><strong>allow_toggle</strong>: define if a toggle button must be added under the editor in order to allow to toggle between the editor and the orginal textarea. | |
60 | + <br /><span class='underline'>Type</span>: Boolean | |
61 | + <br /><span class='underline'>Default</span>: true | |
62 | + </li> | |
63 | + <li><strong>plugins</strong>: a comma separated list of plugins to load. | |
64 | + <br /><span class='underline'>Type</span>: String | |
65 | + <br /><span class='underline'>Default</span>: "" | |
66 | + </li> | |
67 | + <li><strong>browsers</strong>: define if the editor must be loaded only when the user navigotr is known to be a working one, or if it will be loaded for all navigators. | |
68 | + <br /><span class='underline'>Type</span>: String ("all" or "known") | |
69 | + <br /><span class='underline'>Default</span>: "known" | |
70 | + </li> | |
71 | + <li><strong>display</strong>: specify when the textarea will be converted into an editor. If set to "later", the toogle button will be displayed to allow later conversion. | |
72 | + <br /><span class='underline'>Type</span>: String ("onload" or "later") | |
73 | + <br /><span class='underline'>Default</span>: "onload" | |
74 | + </li> | |
75 | + <li><strong>toolbar</strong>: define the toolbar that will be displayed, each element being separated by a ",". | |
76 | + <br /><span class='underline'>Type</span>: String (combinaison of: "|", "*", "search", "go_to_line", "undo", "redo", "change_smooth_selection", "reset_highlight", "highlight", "word_wrap", "help", "save", "load", "new_document", "syntax_selection") | |
77 | + <br />"|" or "separator" make appears a separator in the toolbar. | |
78 | + <br />"*" or "return" make appears a line-break in the toolbar | |
79 | + <br /><span class='underline'>Default</span>: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help" | |
80 | + </li> | |
81 | + <li><strong>begin_toolbar</strong>: toolbar button list to add before the toolbar defined by the "toolbar" option. | |
82 | + <br /><span class='underline'>Type</span>: String (cf. "toolbar" option) | |
83 | + <br /><span class='underline'>Default</span>: "" | |
84 | + </li> | |
85 | + <li><strong>end_toolbar</strong>: toolbar button list to add after the toolbar defined by the "toolbar" option. | |
86 | + <br /><span class='underline'>Type</span>: String (cf. "toolbar" option) | |
87 | + <br /><span class='underline'>Default</span>: "" | |
88 | + </li> | |
89 | + <li><strong>font_size</strong>: define the font-size used to display the text in the editor. | |
90 | + <br /><span class='underline'>Type</span>: Integer | |
91 | + <br /><span class='underline'>Default</span>: 10 | |
92 | + </li> | |
93 | + <li><strong>font_family</strong>: define the font-familly used to display the text in the editor. (eg: "monospace" or "verdana,monospace"). Opera will always use "monospace". | |
94 | + <br /><span class='underline'>Type</span>: String | |
95 | + <br /><span class='underline'>Default</span>: "monospace" | |
96 | + </li> | |
97 | + <li><strong>cursor_position</strong>: define if the cursor should be placed where it was in the textarea before replacement (auto) or at the beginning of the file (begin). | |
98 | + <br /><span class='underline'>Type</span>: String ("begin" or "auto") | |
99 | + <br /><span class='underline'>Default</span>: "begin" | |
100 | + </li> | |
101 | + <li><strong>gecko_spellcheck</strong>: allow to disable/enable the Firefox 2 spellchecker | |
102 | + <br /><span class='underline'>Type</span>: Boolean | |
103 | + <br /><span class='underline'>Default</span>: false | |
104 | + </li> | |
105 | + <li><strong>max_undo</strong>: number of undo action allowed | |
106 | + <br /><span class='underline'>Type</span>: Integer | |
107 | + <br /><span class='underline'>Default</span>: 20 | |
108 | + </li> | |
109 | + <li><strong>fullscreen</strong>: determine if EditArea start in fullscreen mode or not | |
110 | + <br /><span class='underline'>Type</span>: Boolean | |
111 | + <br /><span class='underline'>Default</span>: false | |
112 | + </li> | |
113 | + <li><strong>is_editable</strong>: determine if EditArea display only the highlighted syntax (no edition possiblities, no toolbars). | |
114 | + It's possible to switch the editable mode whenever you want (code example for a toggle edit mode: <em>editAreaLoader.execCommand('editor_id', 'set_editable', !editAreaLoader.execCommand('editor_id', 'is_editable'));</em>). | |
115 | + <br /><span class='underline'>Type</span>: Boolean | |
116 | + <br /><span class='underline'>Default</span>: true | |
117 | + </li> | |
118 | + <li><strong>word_wrap</strong>: 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. | |
119 | + | |
120 | + <br /><span class='underline'>Type</span>: Boolean | |
121 | + <br /><span class='underline'>Default</span>: false | |
122 | + </li> | |
123 | + <li><strong>replace_tab_by_spaces</strong>: define the number of spaces that will replace tabulations (\t) in text. If tabulation should stay tabulation, set this option to false. | |
124 | + <br /><span class='underline'>Type</span>: Integer (or false) | |
125 | + <br /><span class='underline'>Default</span>: false | |
126 | + </li> | |
127 | + <li><strong>debug</strong>: used to display some debug information into a newly created textarea. Can be usefull to display trace info in it if you want to modify the code. | |
128 | + <br /><span class='underline'>Type</span>: Boolean | |
129 | + <br /><span class='underline'>Default</span>: false | |
130 | + </li> | |
131 | + </ul> | |
132 | + <br /> | |
133 | + </li> | |
134 | + <li><strong>Callback</strong> | |
135 | + <ul> | |
136 | + <li><strong>load_callback</strong>: the function name that will be called when the user will press the "load" button in the toolbar. This function will reveice one parameter that will be the id of the textarea. You can update the content of the textarea by using "editAreaLoader.setValue(the_id, new_value);". | |
137 | + <br /><span class='underline'>Type</span>: String | |
138 | + <br /><span class='underline'>Default</span>: "" | |
139 | + </li> | |
140 | + <li><strong>save_callback</strong>: the function name that will be called when the user will press the "save" button in the toolbar. This function will reveice two parameters, the first being the id of the textarea and the second containing the content of the textarea. | |
141 | + <br /><span class='underline'>Type</span>: String | |
142 | + <br /><span class='underline'>Default</span>: "" | |
143 | + </li> | |
144 | + <li><strong>change_callback</strong>: the function name that will be called when the onchange event of the textarea of EditArea will be triggered. This function will reveice one parameter that will be the id of the textarea. Will be triggered only is EditArea is displayed. | |
145 | + <br /><span class='underline'>Type</span>: String | |
146 | + <br /><span class='underline'>Default</span>: "" | |
147 | + </li> | |
148 | + <li><strong>submit_callback</strong>: the function name that will be called when the form containing the EditArea will be submitted. This function will reveice one parameter that will be the id of the textarea. Will be triggered regardless the state of EditArea (displayed or not). | |
149 | + <br /><span class='underline'>Type</span>: String | |
150 | + <br /><span class='underline'>Default</span>: "" | |
151 | + </li> | |
152 | + <li><strong>EA_init_callback</strong>: the function name that will be called just after the editAreaLoader.init() function, once EditAreaLoader will be initalized but still not displayed. This function will receive one parameter that will be the id of the textarea. | |
153 | + <br /><span class='underline'>Type</span>: String | |
154 | + <br /><span class='underline'>Default</span>: "" | |
155 | + </li> | |
156 | + <li><strong>EA_delete_callback</strong>: the function name that will be called when EditArea will be destroyed regardless the fact that it has been displayed or not. This function will reveice one parameter that will be the id of the textarea. | |
157 | + <br /><span class='underline'>Type</span>: String | |
158 | + <br /><span class='underline'>Default</span>: "" | |
159 | + </li> | |
160 | + <li><strong>EA_toggle_on_callback</strong>: the function name that will be called when EditArea will be toogled on for. This function will reveice one parameter that will be the id of the textarea. | |
161 | + <br /><span class='underline'>Type</span>: String | |
162 | + <br /><span class='underline'>Default</span>: "" | |
163 | + </li> | |
164 | + <li><strong>EA_toggle_off_callback</strong>: the function name that will be called when EditArea will be toggled off. This function will reveice one parameter that will be the id of the textarea. | |
165 | + <br /><span class='underline'>Type</span>: String | |
166 | + <br /><span class='underline'>Default</span>: "" | |
167 | + </li> | |
168 | + <li><strong>EA_load_callback</strong>: the function name that will be called when EditArea will be displayed for the first time. This function will reveice one parameter that will be the id of the textarea. | |
169 | + <br /><span class='underline'>Type</span>: String | |
170 | + <br /><span class='underline'>Default</span>: "" | |
171 | + </li> | |
172 | + <li><strong>EA_unload_callback</strong>: the function name that will be called when EditArea will be destroyed (if it have been displayed at least one time). This function will reveice one parameter that will be the id of the textarea. | |
173 | + <br /><span class='underline'>Type</span>: String | |
174 | + <br /><span class='underline'>Default</span>: "" | |
175 | + </li> | |
176 | + <li><strong>EA_file_switch_on_callback</strong>: the function name that will be called when the tabulation of the file will be selected. This function will reveice one parameter that will be an associative array containing all file's infos. | |
177 | + <br /><span class='underline'>Type</span>: String | |
178 | + <br /><span class='underline'>Default</span>: "" | |
179 | + </li> | |
180 | + <li><strong>EA_file_switch_off_callback</strong>: the function name that will be called when the tabulation of the file will be blur (the file was selected, and another file receive focus). This function will reveice one parameter that will be an associative array containing all file infos. | |
181 | + <br /><span class='underline'>Type</span>: String | |
182 | + <br /><span class='underline'>Default</span>: "" | |
183 | + </li> | |
184 | + <li><strong>EA_file_close_callback</strong>: the function name that will be called when the tabulation of a file will be closed. This function will reveice one parameter that will be an associative array containing all file infos. If the callback function return false, the file won't be closed. | |
185 | + <br /><span class='underline'>Type</span>: String | |
186 | + <br /><span class='underline'>Default</span>: "" | |
187 | + </li> | |
188 | + </ul> | |
189 | + <br /> | |
190 | + </li> | |
191 | + </ul> | |
192 | + <div class="separator"></div> | |
193 | + | |
194 | + <h2>Initialization of EditArea</h2> | |
195 | + <p>In order to initialize EditArea the following code must be placed within HEAD element | |
196 | + of a document. The following example is configurated to convert the TEXTAREA element | |
197 | + which has "textarea_1" as id into editor when the page loads. The "id" | |
198 | + option is the only obligatory option. | |
199 | +<pre> | |
200 | +<html> | |
201 | +<head> | |
202 | +<strong><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.js"></script> | |
203 | +<script language="javascript" type="text/javascript"> | |
204 | +editAreaLoader.init({ | |
205 | + id : "textarea_1" // textarea id | |
206 | + ,syntax: "css" // syntax to be uses for highgliting | |
207 | + ,start_highlight: true // to display with highlight mode on start-up | |
208 | +}); | |
209 | +</script></strong> | |
210 | +</head> | |
211 | +</pre> | |
212 | + </p> | |
213 | + <p>See the <a href='include.html'>include</a> document to learn more about the way to use the best script include. | |
214 | + </p> | |
215 | + <p>If you want to convert several textarea on your webpage, just call several time the init function with a different id parameter.</p> | |
216 | + | |
217 | + </div> | |
218 | + <div class='footer'> | |
219 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
220 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
221 | + <br style="clear: both" /> | |
222 | + </div> | |
223 | +</body> | |
224 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/credits.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Credits</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <h2>Special thanks</h2> | |
15 | + <p> | |
16 | + I would like to make a special thanks to <a href='http://tinymce.moxiecode.com'>TinyMCE</a> | |
17 | + developpers. I have taken some of their WYSIWYG editor functions | |
18 | + (managing the toolbar buttons), | |
19 | + and it give me inspiration for some point (gzip compression, translation, documentation) | |
20 | + of my project. | |
21 | + </p> | |
22 | + <h2>Contributors</h2> | |
23 | + <p> These are the people that have contributed in some way to the EditArea project. | |
24 | + If you feel we are missing someone please inform me right away and I will correct this | |
25 | + in future versions of EditArea. | |
26 | + </p> | |
27 | + <ul> | |
28 | + <li>Global help | |
29 | + <ul> | |
30 | + <li>Gildas Noël</li> | |
31 | + <li>Spellcoder</li> | |
32 | + </ul> | |
33 | + </li> | |
34 | + <li>Languages translation | |
35 | + <ul> | |
36 | + <li>Olaf Brambrink & Felix Riesterer & Christoph Pinkel (Deutsh)</li> | |
37 | + <li>Peter Klein (Danish)</li> | |
38 | + <li>Leonardo Sapucaia (Portuguese)</li> | |
39 | + <li>Ishitoya Kentaro (Japanese)</li> | |
40 | + <li>Piotr Furman (Polish)</li> | |
41 | + <li>Luciano Vernaschi (Italian)</li> | |
42 | + <li>Ivan Vucica and Davor Cihlar (Croatian)</li> | |
43 | + <li>Garito (Spanish)</li> | |
44 | + <li>Gabriel Schwardy (Slovak)</li> | |
45 | + <li>Olivier (Esperento)</li> | |
46 | + <li>Janne Mäntyharju (Finnish)</li> | |
47 | + <li>Abentian (Simplified chinese)</li> | |
48 | + <li>Valentin Hristov (Bulgarian)</li> | |
49 | + </ul> | |
50 | + </li> | |
51 | + <li>Syntax definitions | |
52 | + <ul> | |
53 | + <li>Martin Gottlieb (VB)</li> | |
54 | + <li>Ivan Vucica and Davor Cihlar (Basic, C, CPP, Pascal and Brainfuck)</li> | |
55 | + <li>Philippe Lewicki (SQL)</li> | |
56 | + <li>Pavle Ggardijan (Robots.txt)</li> | |
57 | + <li>Miladin Joksic (T-SQL)</li> | |
58 | + <li>Christoph Pinkel (Perl)</li> | |
59 | + <li>Max Leynov (Coldfusion)</li> | |
60 | + <li>Dawson Goodel (Java)</li> | |
61 | + </ul> | |
62 | + </li> | |
63 | + <li>Donation | |
64 | + <ul> | |
65 | + <li>Jupiter</li> | |
66 | + </ul> | |
67 | + </li> | |
68 | + </ul> | |
69 | + </div> | |
70 | + <div class='footer'> | |
71 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
72 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
73 | + <br style="clear: both" /> | |
74 | + </div> | |
75 | +</body> | |
76 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/customization_language.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Customization - Creating a language translation</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <h2>Making language file</h2> | |
15 | + | |
16 | + <p>Language packs are simply JavaScript name/value arrays placed in the ".js" | |
17 | + files in the "lang" directory. Notice there are two kinds of language packs.</p> | |
18 | + <ul> | |
19 | + <li><p>The first one is the general one located at "edit_area/langs/" and used by the EditArea core. | |
20 | + The example below shows how the search and replace texts are lang packed.</p> | |
21 | +<pre>editAreaLoader.lang["en"]={ | |
22 | +search: "search", | |
23 | +replace: "replace" | |
24 | +};</pre> | |
25 | + </li> | |
26 | + <li><p>The second ones are plugins specific language packs. These are contained in | |
27 | + "edit_area/plugins/<plugin_name>/langs/". Here is the example of the test plugin.</p> | |
28 | +<pre>editArea.add_lang("en",{ | |
29 | +test_select: "select tag", | |
30 | +test_but: "test button" | |
31 | +});</pre> | |
32 | + <p>For creating a new plugin, remember to always use the "<plugin_name>" | |
33 | + prefix for these value names so that they don't override other variables in the templates. | |
34 | + </p> | |
35 | + </li> | |
36 | + </ul> | |
37 | + <p> | |
38 | + Remember, the last translation line should not have a , character at the end. | |
39 | + </p> | |
40 | + | |
41 | + <h3>Files to edit</h3> | |
42 | + | |
43 | + <p> | |
44 | + When translating EditArea, these are the files that currently needs to be translated: | |
45 | + </p> | |
46 | + <p> | |
47 | + edit_area/langs/en.js<br /> | |
48 | + edit_area/plugins/<plugin_name>/langs/en.js<br /> | |
49 | + </p> | |
50 | + | |
51 | + <h3>Contributing your language pack</h3> | |
52 | + <p> | |
53 | + Go to the <a href="http://sourceforge.net/tracker/?atid=829999&group_id=164008&func=browse">sourceforge patch page</a> | |
54 | + and upload a zip containing all the language files in the correct directory structure.<br /><br /> | |
55 | + | |
56 | + Please translate all the plugins, even if you aren't using them.<br /> | |
57 | + </p> | |
58 | + </div> | |
59 | + <div class='footer'> | |
60 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
61 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
62 | + <br style="clear: both" /> | |
63 | + </div> | |
64 | +</body> | |
65 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/customization_plugin.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Customization - Creating a plugin</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <h2>Creating your own plugins</h2> | |
15 | + <p> | |
16 | + Creating you own plugins for EditArea is fairly easy if you know the basics of HTML, CSS and Javascript. | |
17 | + The most easy way is to copy the "test" directory and work from there. The "test" | |
18 | + directory is a tutorial plugin that shows how to create a plugin. After you copy the template you need to | |
19 | + change the red sections marked below to the name of your plugin this is needed so that plugins don't | |
20 | + overlap in other words it gives the plugin a unique name. Notice that when you write a new plugin, | |
21 | + you have to end each javascript instructions by ";", even if it's optionnal in javascript. | |
22 | + </p> | |
23 | + | |
24 | + <p>If you want you may add plugin specific options/settings but remember to namespace them in the | |
25 | + following format "<your plugin>_<option>" for example "yourplugin_someoption".</p> | |
26 | + | |
27 | + <p>Specific callback functions that you don't need or doesn't do anything can be removed.</p> | |
28 | + | |
29 | + <p>If you want you can try the test plugin by adding the following parameters to the EditAreaLoader.init command.</p> | |
30 | + <pre>end_toolbar: "*,test_but, |,test_select", | |
31 | +plugins: "test",</pre> | |
32 | + | |
33 | + <div class="separator"></div> | |
34 | + <h3>Plugin directory structure</h3> | |
35 | + <p> | |
36 | + <table class="btable"> | |
37 | + <thead> | |
38 | + <th>File/Directory</td> | |
39 | + <th>Description</td> | |
40 | + </thead> | |
41 | + <tbody> | |
42 | + <tr><td>css</td><td>Plugin specific CSS files</td></tr> | |
43 | + <tr><td>images</td><td>Plugin specific images</td></tr> | |
44 | + <tr><td>langs</td><td>Plugin specific language files</td></tr> | |
45 | + <tr><td><your_plugin>.js</td><td>Main plugin file</td></tr> | |
46 | + | |
47 | + </table> | |
48 | + </p> | |
49 | + <div class="separator"></div> | |
50 | + <h3>Plugin example source</h3> | |
51 | + <p> | |
52 | + The example below shows a simple empty plugin and all possible callbacks. | |
53 | + </p> | |
54 | + <p> | |
55 | + | |
56 | + <div class="example"> | |
57 | + <pre>/** | |
58 | + * Plugin designed for test prupose. It add a button (that manage an alert) and a select (that allow to insert tags) in the toolbar. | |
59 | + * This plugin also disable the "f" key in the editarea, and load a CSS and a JS file | |
60 | + */ | |
61 | +var EditArea_<span class='marked'>test</span>= { | |
62 | + /** | |
63 | + * Get called once this file is loaded (editArea still not initialized) | |
64 | + * | |
65 | + * @return nothing | |
66 | + */ | |
67 | + init: function(){ | |
68 | + // alert("test init: "+ this._someInternalFunction(2, 3)); | |
69 | + editArea.load_css(this.baseURL+"css/test.css"); | |
70 | + editArea.load_script(this.baseURL+"test2.js"); | |
71 | + } | |
72 | + /** | |
73 | + * Returns the HTML code for a specific control string or false if this plugin doesn't have that control. | |
74 | + * A control can be a button, select list or any other HTML item to present in the EditArea user interface. | |
75 | + * Language variables such as {$lang_somekey} will also be replaced with contents from | |
76 | + * the language packs. | |
77 | + * | |
78 | + * @param {string} ctrl_name: the name of the control to add | |
79 | + * @return HTML code for a specific control or false. | |
80 | + * @type string or boolean | |
81 | + */ | |
82 | + ,get_control_html: function(ctrl_name){ | |
83 | + switch(ctrl_name){ | |
84 | + case "<span class='marked'>test_but</span>": | |
85 | + // Control id, button img, isFileSpecific, command | |
86 | + return parent.editAreaLoader.get_button_html('<span class='marked'>test_but</span>', '<span class='marked'>test.gif</span>', '<span class='marked'>test_cmd</span>', false, this.baseURL); | |
87 | + case "<span class='marked'>test_select</span>": | |
88 | + html= "<select id='<span class='marked'>test_select</span>' onchange='javascript:editArea.execCommand(\"<span class='marked'>test_select_change</span>\")'>" | |
89 | + +" <option value='-1'><span class='marked'>{$test_select}</span></option>" | |
90 | + +" <option value='h1'>h1</option>" | |
91 | + +" <option value='h2'>h2</option>" | |
92 | + +" <option value='h3'>h3</option>" | |
93 | + +" <option value='h4'>h4</option>" | |
94 | + +" <option value='h5'>h5</option>" | |
95 | + +" <option value='h6'>h6</option>" | |
96 | + +" </select>"; | |
97 | + return html; | |
98 | + } | |
99 | + return false; | |
100 | + } | |
101 | + /** | |
102 | + * Get called once EditArea is fully loaded and initialised | |
103 | + * | |
104 | + * @return nothing | |
105 | + */ | |
106 | + ,onload: function(){ | |
107 | + alert("test load"); | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * Is called each time the user touch a keyboard key. | |
112 | + * | |
113 | + * @param (event) e: the keydown event | |
114 | + * @return true - pass to next handler in chain, false - stop chain execution | |
115 | + * @type boolean | |
116 | + */ | |
117 | + ,onkeydown: function(e){ | |
118 | + var str= String.fromCharCode(e.keyCode); | |
119 | + // desactivate the "f" character | |
120 | + if(str.toLowerCase()=="f"){ | |
121 | + return true; | |
122 | + } | |
123 | + return false; | |
124 | + } | |
125 | + | |
126 | + /** | |
127 | + * Executes a specific command, this function handles plugin commands. | |
128 | + * | |
129 | + * @param {string} cmd: the name of the command being executed | |
130 | + * @param {unknown} param: the parameter of the command | |
131 | + * @return true - pass to next handler in chain, false - stop chain execution | |
132 | + * @type boolean | |
133 | + */ | |
134 | + ,execCommand: function(cmd, param){ | |
135 | + // Handle commands | |
136 | + switch(cmd){ | |
137 | + case "<span class='marked'>test_select_change</span>": | |
138 | + var val= document.getElementById("test_select").value; | |
139 | + if(val!=-1) | |
140 | + parent.editAreaLoader.insertTags(editArea.id, "<"+val+">", "</"+val+">"); | |
141 | + document.getElementById("test_select").options[0].selected=true; | |
142 | + return false; | |
143 | + case "<span class='marked'>test_cmd</span>": | |
144 | + alert("user clicked on test_cmd"); | |
145 | + return false; | |
146 | + } | |
147 | + // Pass to next handler in chain | |
148 | + return true; | |
149 | + } | |
150 | + | |
151 | + /** | |
152 | + * This is just an internal plugin method, prefix all internal methods with a _ character. | |
153 | + * The prefix is needed so they doesn't collide with future EditArea callback functions. | |
154 | + * | |
155 | + * @param {string} a Some arg1. | |
156 | + * @param {string} b Some arg2. | |
157 | + * @return Some return. | |
158 | + * @type unknown | |
159 | + */ | |
160 | + ,_someInternalFunction : function(a, b) { | |
161 | + return a+b; | |
162 | + } | |
163 | +}; | |
164 | + | |
165 | +// Adds the plugin class to the list of available EditArea plugins | |
166 | +editArea.add_plugin("<span class='marked'>test</span>", EditArea_<span class='marked'>test</span>);</pre> | |
167 | +<br /> | |
168 | + </div> | |
169 | + <div class='footer'> | |
170 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
171 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
172 | + <br style="clear: both" /> | |
173 | + </div> | |
174 | +</body> | |
175 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/customization_syntax.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Customization - Creating a syntax definition file</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <h3>Creating your own syntax definition file</h3> | |
15 | + <p>Creating you own syntax definition file for EditArea is fairly easy. You just have to know the language syntax, | |
16 | + it's kewords, and then fill a javascript array with thoses values.</p> | |
17 | + <p>If your want to create a new syntax file for a given language, choose a language abbreviation for it | |
18 | + (<language_abbr>) in lowercase. Then create the file "edit_area/reg_syntax/<language_abbr>.js".</p> | |
19 | + <p>Here is a "css" example:</p> | |
20 | +<pre>editAreaLoader.load_syntax["css"] = { <strong>// here <language_abbr> is "css" so the file is "css.js"</strong> | |
21 | + 'DISPLAY_NAME' : 'Css' <strong>// String: used to define a better syntax name to display. Used only when using script using compressed version of the script</strong> | |
22 | + ,'COMMENT_SINGLE' : ['@'] <strong>// Array: possible single line comments</strong> | |
23 | + ,'COMMENT_MULTI' : {'/*' : '*/'} <strong>// associated Array: possible multiple line comments</strong> | |
24 | + <strong>// ("open_mark1" : "close mark1", "open_mark2" : "close_mark2"}</strong> | |
25 | + ,'QUOTEMARKS' : ['"', "'"] <strong>// Array: the different possible quotemarks that delimitate strings</strong> | |
26 | + ,'KEYWORD_CASE_SENSITIVE' : false <strong>// Boolean: define if the language is case-sensitive</strong> | |
27 | + ,'KEYWORDS' : { <strong>// Array: an array of array containing the different keywords class</strong> | |
28 | + 'attributes' : [ <strong>// the name 'attribute' can be changed with no problem. I</strong> | |
29 | + <strong>// it's only used to define the matching style class</strong> | |
30 | + 'aqua', 'azimuth', 'background-attachment', 'background-color' <strong>// etc...</strong> | |
31 | + ] | |
32 | + ,'values' : [ | |
33 | + 'absolute', 'block', 'bold', 'bolder', 'both' <strong>// etc...</strong> | |
34 | + ] | |
35 | + ,'specials' : [ | |
36 | + 'important' | |
37 | + ] | |
38 | + } | |
39 | + ,'OPERATORS' :[ <strong>// Array: the operators to highlight (eg, can also contain: +, -, * or / in other languages).</strong> | |
40 | + ':', ';', '!', '.', '#' | |
41 | + ] | |
42 | + ,'DELIMITERS' :[ <strong>// Array: the block code delimiters to highlight</strong> | |
43 | + '{', '}' | |
44 | + ] | |
45 | + ,'STYLES' : { <strong>// Array: an array of array, containing all style to apply for categories defined before.</strong> | |
46 | + <strong>// Better to define color style only. </strong> | |
47 | + 'COMMENTS': 'color: #AAAAAA;' | |
48 | + ,'QUOTESMARKS': 'color: #6381F8;' | |
49 | + ,'KEYWORDS' : { <strong>// contain the associated style foreach keywords categories</strong> | |
50 | + 'attributes' : 'color: #48BDDF;' | |
51 | + ,'values' : 'color: #2B60FF;' | |
52 | + ,'specials' : 'color: #FF0000;' | |
53 | + } | |
54 | + ,'OPERATORS' : 'color: #FF00FF;' | |
55 | + ,'DELIMITERS' : 'color: #60CA00;' | |
56 | + | |
57 | + } | |
58 | +};</pre> | |
59 | + <p>After reading this example you should be able to create your own syntax file.</p> | |
60 | + <div class='separator'></div> | |
61 | + <h3>Advanced syntax definition</h3> | |
62 | + | |
63 | +<pre>editAreaLoader.load_syntax["xml"] = { | |
64 | + 'COMMENT_SINGLE' : {} | |
65 | + ,'COMMENT_MULTI' : {'<!--' : '-->'} | |
66 | + ,'QUOTEMARKS' : {1: "'", 2: '"'} | |
67 | + ,'KEYWORD_CASE_SENSITIVE' : false | |
68 | + ,'KEYWORDS' : { | |
69 | + } | |
70 | + ,'OPERATORS' :[ | |
71 | + ] | |
72 | + ,'DELIMITERS' :[ | |
73 | + ] | |
74 | + ,'REGEXPS' : { <strong>// advance syntax highlight through regexp</strong> | |
75 | + 'xml' : { <strong>// the name 'doctype' can be changed with no problem.</strong> | |
76 | + 'search' : '()(<\\?[^>]*?\\?>)()' <strong>// the regexp</strong> | |
77 | + ,'class' : 'xml' <strong>// the css class</strong> | |
78 | + ,'modifiers' : 'g' <strong>// the modifier ("g" and/or "i")</strong> | |
79 | + ,'execute' : 'before' <strong>// "before" or "after". Determine if the regexp must </strong> | |
80 | + <strong>// be done before or after the main highlight process</strong> | |
81 | + } | |
82 | + ,'cdatas' : { | |
83 | + 'search' : '()(<!\\[CDATA\\[.*?\\]\\]>)()' | |
84 | + ,'class' : 'cdata' | |
85 | + ,'modifiers' : 'g' | |
86 | + ,'execute' : 'before' | |
87 | + } | |
88 | + ,'tags' : { | |
89 | + 'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)' | |
90 | + ,'class' : 'tags' | |
91 | + ,'modifiers' : 'gi' | |
92 | + ,'execute' : 'before' | |
93 | + } | |
94 | + ,'attributes' : { | |
95 | + 'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)' | |
96 | + ,'class' : 'attributes' | |
97 | + ,'modifiers' : 'g' | |
98 | + ,'execute' : 'before' | |
99 | + } | |
100 | + } | |
101 | + ,'STYLES' : { | |
102 | + 'COMMENTS': 'color: #AAAAAA;' | |
103 | + ,'QUOTESMARKS': 'color: #6381F8;' | |
104 | + ,'KEYWORDS' : { | |
105 | + } | |
106 | + ,'OPERATORS' : 'color: #E775F0;' | |
107 | + ,'DELIMITERS' : '' | |
108 | + ,'REGEXPS' : { | |
109 | + 'attributes': 'color: #B1AC41;' | |
110 | + ,'tags': 'color: #800080;' | |
111 | + ,'xml': 'color: #8DCFB5;' | |
112 | + ,'cdata': 'color: #50B020;' | |
113 | + } | |
114 | + } | |
115 | +};</pre> | |
116 | + <p>Well, as you can see in this example, the syntax highlight for xml is not based on keywords but on regexp. | |
117 | + The text that will be highlighted, is the one between the second parentheses. The search parameter should always | |
118 | + be like this: | |
119 | + </p> | |
120 | + <pre>(<before_highlight>)(<code_to_highlight>)(<after_highlight>)</pre> | |
121 | + <p>For the pattern modifier, "g" signify that all occurences will be highlighted, "i" signify | |
122 | + that the regexp will be case-insensitive.</p> | |
123 | + | |
124 | + <div class='separator'></div> | |
125 | + | |
126 | + <h3>Contributing your syntax definition file</h3> | |
127 | + <p> | |
128 | + Go to the <a href="http://sourceforge.net/tracker/?atid=829999&group_id=164008&func=browse">sourceforge patch page</a> | |
129 | + and upload the syntax file. | |
130 | + </p> | |
131 | + | |
132 | + | |
133 | + </div> | |
134 | + <div class='footer'> | |
135 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
136 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
137 | + <br style="clear: both" /> | |
138 | + </div> | |
139 | +</body> | |
140 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/doc_style.css
0 → 100644
1 | +body { | |
2 | + background-color: #FFFFFF; | |
3 | + font-family: Verdana, Arial, helvetica, sans-serif; | |
4 | + font-size: 12px; | |
5 | +} | |
6 | + | |
7 | +h1{ | |
8 | + font-size: 18px; | |
9 | + font-weight: bold; | |
10 | + padding: 0; | |
11 | + margin: 4px; | |
12 | +} | |
13 | + | |
14 | +h2 { | |
15 | + font-size: 14px; | |
16 | + font-weight: bold; | |
17 | + padding: 0; | |
18 | + margin: 0; | |
19 | + margin-top: 4px; | |
20 | + margin-bottom: 4px; | |
21 | +} | |
22 | + | |
23 | +h3 { | |
24 | + font-size: 11px; | |
25 | + font-weight: bold; | |
26 | + padding: 0; | |
27 | + margin: 0; | |
28 | + margin-bottom: 3px; | |
29 | +} | |
30 | + | |
31 | +h4, h5, h6{ | |
32 | + margin: 0; | |
33 | + padding: 0; | |
34 | +} | |
35 | + | |
36 | +pre, code{ | |
37 | + margin: 0; | |
38 | + padding: 0 5px; | |
39 | + background-color: #E6EBF1; | |
40 | +} | |
41 | + | |
42 | + | |
43 | +a:hover{ | |
44 | + color: #666666; | |
45 | + text-decoration: underline; | |
46 | +} | |
47 | + | |
48 | +a{ | |
49 | + color: #666666; | |
50 | + text-decoration: underline; | |
51 | +} | |
52 | + | |
53 | +ul, ol{ | |
54 | + padding: 0px; | |
55 | + margin: 3px 0 3px 10px; | |
56 | +} | |
57 | + | |
58 | +li{ | |
59 | + padding: 0; | |
60 | + margin: 3px 0 3px 10px; | |
61 | +} | |
62 | + | |
63 | +li li{ | |
64 | + padding: 0; | |
65 | + margin-left: 30px; | |
66 | +} | |
67 | + | |
68 | +table{ | |
69 | + border-collapse: collapse; | |
70 | +} | |
71 | + | |
72 | +td, th{ | |
73 | + padding: 4px; | |
74 | + border: 2px groove #000000; | |
75 | +} | |
76 | + | |
77 | +thead { | |
78 | + background-color: #E6EBF1; | |
79 | +} | |
80 | + | |
81 | +.header{ | |
82 | + border: #E0E0E0 solid 1px; | |
83 | +} | |
84 | + | |
85 | +.footer{ | |
86 | + border: #E0E0E0 solid 1px; | |
87 | + height: 1.3em; | |
88 | + padding: 2px; | |
89 | +} | |
90 | + | |
91 | +.content{ | |
92 | + padding: 10px 0 10px 10px; | |
93 | +} | |
94 | + | |
95 | +.indexlink{ | |
96 | + float: right; | |
97 | +} | |
98 | + | |
99 | +.separator { | |
100 | + border-bottom: 1px solid #E6EBF1; | |
101 | + margin-top: 10px; | |
102 | + margin-bottom: 10px; | |
103 | +} | |
104 | + | |
105 | + | |
106 | +.optionlist li li{ | |
107 | + text-indent: -15px; | |
108 | + padding-left: 15px; | |
109 | + line-height: 1.3em; | |
110 | +} | |
111 | + | |
112 | +.optionlist .underline{ | |
113 | + background-color: #E6EBF1; | |
114 | + border-bottom: dashed #000000 1px; | |
115 | +} | |
116 | + | |
117 | +.marked{ | |
118 | + color: #FF0000; | |
119 | + font-weight: bold; | |
120 | +} | ... | ... |
docs/js/editarea_0_8_2/docs/include.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Main script include</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <p>As you have seen it before in <a href='installation.html'>installation</a> and | |
15 | + <a href='configuration.html'>configuration</a>, in order to make EditArea work on a | |
16 | + webpage, you must include one external javascript file and call an init | |
17 | + function for each textarea you want to convert. | |
18 | + In thoses examples the file "edit_area_full.js" whas the file included, | |
19 | + but in fact there are 5 possible files to include EditArea scripts | |
20 | + into your webpage. All thoses files are in the same directory, | |
21 | + and they all have advantage and inconvenient. | |
22 | + </p> | |
23 | + | |
24 | + <h2>edit_area_full.js</h2> | |
25 | + <blockquote> | |
26 | + <p>This is the easier file to use for script integration. The file is nearly 100Kb length. | |
27 | +<pre><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.js"></script></pre> | |
28 | + <br /> | |
29 | + <h3>Advantage:</h3> | |
30 | + <ul> | |
31 | + <li>The simplest choice.</li> | |
32 | + <li>Load the core script in one call to server.</li> | |
33 | + </ul> | |
34 | + <h3>Inconvient:</h3> | |
35 | + <ul> | |
36 | + <li>Not designed to allow core script modification.</li> | |
37 | + <li>Need to make additional server calls for plugins.</li> | |
38 | + </ul> | |
39 | + <br /> | |
40 | + </p> | |
41 | + </blockquote> | |
42 | + | |
43 | + <div class='separator'></div> | |
44 | + | |
45 | + <h2>edit_area_compressor.php</h2> | |
46 | + <blockquote> | |
47 | + <p>This php file send in a gzipped file the whole core script to the brower (if the browser | |
48 | + has not already an updated version in cache). | |
49 | + <br /> | |
50 | + If the source core script files have changed, it take thoses files and merge them into one file. | |
51 | + Then it remove all comments, white-spaces, etc... and save it in | |
52 | + "edit_area_full.js". It also save a gzip version in | |
53 | + "edit_area_full.gz". Then it send the gzip content to the browser (except for IE for which it is not gzipped due to IE bug with compression). | |
54 | +<pre><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_compressor.php"></script></pre> | |
55 | + <br /> | |
56 | + <h3>Advantage:</h3> | |
57 | + <ul> | |
58 | + <li>The script is very small if gzip is supported (~25Ko).</li> | |
59 | + <li>Designed to allow core script modification.</li> | |
60 | + <li>Load the core script in one call to server.</li> | |
61 | + </ul> | |
62 | + <h3>Inconvient:</h3> | |
63 | + <ul> | |
64 | + <li>Need PHP to be installed on the server (and allowed to write in editarea directory for disk caching).</li> | |
65 | + <li>Need to make additional server calls for plugins.</li> | |
66 | + </ul> | |
67 | + <br /> | |
68 | + </p> | |
69 | + <p>If you plan to use "edit_area_compressor.php" be sure that PHP scripts are allowed | |
70 | + to write in editarea directory (at the same level than the file "edit_area_compressor.php") | |
71 | + for disk caching. | |
72 | + </p> | |
73 | + </blockquote> | |
74 | + | |
75 | + <div class='separator'></div> | |
76 | + | |
77 | + <h2>edit_area_compressor.php?plugins</h2> | |
78 | + <h5 class='marked'>recommanded version</h5> | |
79 | + <blockquote> | |
80 | + <p>This include is very similar to "edit_area_compressor.php". The difference is that | |
81 | + with "plugins" parameter, the compressor also include the main script of all the plugins | |
82 | + in the merged file and also compress them. This will avoid later server calls for plugin main script. | |
83 | + <br /> | |
84 | + In this case, the saved files are "edit_area_full_with_plugins.js" and "edit_area_full_with_plugins.gz". | |
85 | +<pre><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_compressor.php?plugins"></script></pre> | |
86 | + <br /> | |
87 | + <h3>Advantage:</h3> | |
88 | + <ul> | |
89 | + <li>The script is very small if gzip is supported.</li> | |
90 | + <li>Designed to allow core script modification.</li> | |
91 | + <li>Load the core script in one call to server.</li> | |
92 | + <li>Load plugins script in the same call.</li> | |
93 | + </ul> | |
94 | + <h3>Inconvient:</h3> | |
95 | + <ul> | |
96 | + <li>Need PHP to be installed on the server (and allowed to write in editarea directory for disk caching).</li> | |
97 | + </ul> | |
98 | + <br /> | |
99 | + </p> | |
100 | + <p>If you plan to use "edit_area_compressor.php" be sure that PHP scripts are allowed | |
101 | + to write in editarea directory (at the same level than the file "edit_area_compressor.php") | |
102 | + for disk caching. | |
103 | + </p> | |
104 | + </blockquote> | |
105 | + | |
106 | + <div class='separator'></div> | |
107 | + | |
108 | + <h2>edit_area_full.gz</h2> | |
109 | + <blockquote> | |
110 | + <p>This is the smaller file to use for script integration. The file is gzipped and is only 20Kb | |
111 | + length. | |
112 | +<pre><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.gz"></script></pre> | |
113 | + <br /> | |
114 | + <h3>Advantage:</h3> | |
115 | + <ul> | |
116 | + <li>The script is only 20Kb length.</li> | |
117 | + <li>Load the core script in one call to server.</li> | |
118 | + </ul> | |
119 | + <h3>Inconvient:</h3> | |
120 | + <ul> | |
121 | + <li>Is server dependant: It will work only on servers that will return a | |
122 | + "Content-Encoding: gzip" for *.gz files (can work with Apache). | |
123 | + So you must test if it work on your server.</li> | |
124 | + <li>Not designed to allow core script modification.</li> | |
125 | + <li>Need to make additional server calls for plugins.</li> | |
126 | + </ul> | |
127 | + <br /> | |
128 | + </p> | |
129 | + </blockquote> | |
130 | + | |
131 | + <div class='separator'></div> | |
132 | + | |
133 | + <h2>edit_area_loader.js</h2> | |
134 | + <blockquote> | |
135 | + <p>This is the original loading script of EditArea. Use this one only if you can't use | |
136 | + any of the 3 other loading files. There is no code epuration nor gzip compression. | |
137 | +<pre><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_loader.js"></script></pre> | |
138 | + <br /> | |
139 | + <h3>Advantage:</h3> | |
140 | + <ul> | |
141 | + <li>Designed to allow core script modification.</li> | |
142 | + </ul> | |
143 | + <h3>Inconvient:</h3> | |
144 | + <ul> | |
145 | + <li>Load the core scripts in 12 call to the server.</li> | |
146 | + <li>Need to make additional server calls for plugins.</li> | |
147 | + </ul> | |
148 | + <br /> | |
149 | + </p> | |
150 | + </blockquote> | |
151 | + | |
152 | + </div> | |
153 | + <div class='footer'> | |
154 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
155 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
156 | + <br style="clear: both" /> | |
157 | + </div> | |
158 | +</body> | |
159 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/index.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>EditArea documentation</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <ul> | |
15 | + <li><a href='about.html'>About</a></li> | |
16 | + <li><a href='installation.html'>Installation</a></li> | |
17 | + <li><strong>Reference</strong> | |
18 | + <ul> | |
19 | + <li><a href='configuration.html'>Configuration</a></li> | |
20 | + <li><a href='javascript_functions.html'>JavaScript functions</a></li> | |
21 | + </ul> | |
22 | + </li> | |
23 | + <li><strong>Customization</strong> | |
24 | + <ul> | |
25 | + <li><a href='customization_plugin.html'>Creating a plugin</a></li> | |
26 | + <li><a href='customization_language.html'>Creating a language translation</a></li> | |
27 | + <li><a href='customization_syntax.html'>Creating a syntax definition file</a></li> | |
28 | + </ul> | |
29 | + </li> | |
30 | + <li><a href='compatibility.html'>Compatibility chart</a></li> | |
31 | + <li><a href='credits.html'>Credits</a></li> | |
32 | + <li><a href='license.html'>Licenses</a></li> | |
33 | + </ul> | |
34 | + </div> | |
35 | + <div class='footer'> | |
36 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
37 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
38 | + <br style="clear: both" /> | |
39 | + </div> | |
40 | +</body> | |
41 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/installation.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>Installation instructions</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <p>Installing EditArea is very simple, follow the instructions here. Also look at the | |
15 | + <a href="configuration.html">options for configuration</a> and the different | |
16 | + <a href='include.html'>javascript load possibility</a>. | |
17 | + </p> | |
18 | + <div class="separator"></div> | |
19 | + | |
20 | + <h2>Requirements</h2> | |
21 | + <p>EditArea has no direct requirements except for <a href="compatiblity.html">browser | |
22 | + compatibility</a> and of course JavaScript needs to be turned on. | |
23 | + For developpers there is also a PHP compressor that is included in the release. | |
24 | + </p> | |
25 | + <div class="separator"></div> | |
26 | + | |
27 | + <h2>Downloading</h2> | |
28 | + <p>For downloading check the <a href="https://sourceforge.net/projects/editarea/"> | |
29 | + sourceforge web site.</a> | |
30 | + </p> | |
31 | + <div class="separator"></div> | |
32 | + | |
33 | + <h2>Extracting the archives</h2> | |
34 | + <p>On windows you could use <a href="http://www.winzip.com">WinZip</a> or something similar. | |
35 | + And on other operating systems such as Linux you simply extract the archive with | |
36 | + the tar command. | |
37 | + </p> | |
38 | + <p> | |
39 | + You should extract EditArea somewhere in your website. Notice that EditArea loads additionnal files | |
40 | + while being used (language translation, syntax definition and images), so don't delete any of the | |
41 | + file in the archive, and be sure that any files can be accessed. | |
42 | + </p> | |
43 | + <p> | |
44 | + If you plan to use "edit_area_compressor.php" be sure that PHP scripts are allowed | |
45 | + to write in editarea repertory (at the same level than the file "edit_area_compressor.php") | |
46 | + in order to allow disk caching. | |
47 | + </p> | |
48 | + <div class="separator"></div> | |
49 | + | |
50 | + <h2>Making changes on your web site</h2> | |
51 | + <p>Once you have extracted the archive you will need to edit the pages | |
52 | + to include the configuration and javascript for EditArea. | |
53 | + Please note that you should probably only include the EditArea javascript on the pages | |
54 | + that need it, not all the pages of the web site. Remember to change the URL to | |
55 | + the .js below to match your installation path.</p> | |
56 | + <p> | |
57 | + <h3>The most basic page integration (converts one textarea into editor):</h3> | |
58 | + <p> | |
59 | +<pre> | |
60 | +<html> | |
61 | +<head> | |
62 | +<title>EditArea Test</title> | |
63 | +<strong><script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.js"></script> | |
64 | +<script language="javascript" type="text/javascript"> | |
65 | +editAreaLoader.init({ | |
66 | + id : "textarea_1" // textarea id | |
67 | + ,syntax: "css" // syntax to be uses for highgliting | |
68 | + ,start_highlight: true // to display with highlight mode on start-up | |
69 | +}); | |
70 | +</script></strong> | |
71 | +</head> | |
72 | +<body> | |
73 | +<form method="post"> | |
74 | + <textarea id="textarea_1" name="content" cols="80" rows="15"> | |
75 | +/*This is some css that will be editable with EditArea.*/ | |
76 | +body, html{ | |
77 | + margin: 0; | |
78 | + padding: 0; | |
79 | + height: 100%; | |
80 | + border: none; | |
81 | + overflow: hidden; | |
82 | +}</textarea> | |
83 | + | |
84 | +</form> | |
85 | +</body> | |
86 | +</html> | |
87 | +</pre> | |
88 | + </p> | |
89 | + <p> | |
90 | + See the <a href='configuration.html'>configuration help</a> to learn about | |
91 | + initialization options, | |
92 | + and the <a href='include.html'>include help</a> to learn more about the way | |
93 | + to use the best script include (there is 4 possible files for EditArea loading). | |
94 | + </p> | |
95 | + <p> | |
96 | + Here is an example of EditArea possibilities: <a href="../exemples/exemple_full.html">Full exemple</a>. | |
97 | + </p> | |
98 | + <p> | |
99 | + Just be sure you've read the documentation before... | |
100 | + </p> | |
101 | + </div> | |
102 | + <div class='footer'> | |
103 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
104 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
105 | + <br style="clear: both" /> | |
106 | + </div> | |
107 | +</body> | |
108 | +</html> | ... | ... |
docs/js/editarea_0_8_2/docs/javascript_functions.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>EditArea documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="doc_style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class='header'> <h1>Javascript Functions</h1> </div> <div class='content'> <p>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.</p> <h3>editAreaLoader.getValue(editor_id)</h3> <blockquote> <p>This method return the content text of the editor. Works on normal textarea if the EditArea is toggled off.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> </tbody> </table> <p><strong>Returns</strong>: the content text of the editor. <code>String</code></p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.setValue(editor_id, new_text)</h3> <blockquote> <p>This method allow to update the content text of an editor. Works on normal textarea if the EditArea is toggled off.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> <tr> <td>new_text</td> <td>The new text that will replace the Editor content.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.insertTags(editor_id, open_tag, close_tag)</h3> <blockquote> <p>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.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> <tr> <td>open_tag</td> <td>The open tag string.</td> </tr> <tr> <td>close_tag</td> <td>The close tag string.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.getSelectedText(editor_id)</h3> <blockquote> <p>This method return the text contained in the the selection range. Works on normal textarea if the EditArea is toggled off.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> </tbody> </table> <p><strong>Returns</strong>: The text contained in the the selection range. <code>String</code></p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.setSelectedText(editor_id, new_text)</h3> <blockquote> <p>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.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> <tr> <td>new_text</td> <td>The string that will replace the current selected text.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.getSelectionRange(editor_id)</h3> <blockquote> <p>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.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> </tbody> </table> <p><strong>Returns</strong>: An array containing the index of the selection start and end. <code>Array("start", "end")</code> </p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.setSelectionRange(editor_id, new_start, new_end)</h3> <blockquote> <p>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.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea</td> </tr> <tr> <td>new_start</td> <td>The character position determining the start of the selection range.</td> </tr> <tr> <td>new_end</td> <td>The character position determining the end of the selection range.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.execCommand(editor_id, command, command_param)</h3> <blockquote> <p>Allow to access to EditArea functions and datas (for advanced users only).</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> <tr> <td>command</td> <td>The function or the parameter of the EditArea object that will be returned.</td> </tr> <tr> <td>command_param (optionnal)</td> <td>If command is a function, the you can pass one parameter to the function with command_param</td> </tr> </tbody> </table> <p><strong>Returns</strong>: the value of the executed command or data. <code>unknown</code></p> <table> <thead> <tr> <td colspan="2">Examples</td> </tr> </thead> <tbody> <tr> <td>Change edit mode</td> <td> <p>Allow to toggle EditArea etit mode from normal edition to readonly with no toolbars.</p> <pre>editAreaLoader.execCommand('editor_id', 'set_editable', !editAreaLoader.execCommand('editor_id', 'is_editable'));</pre> </td> </tr> <tr> <td>Insert tags</td> <td> <p>Insert tags arround selected text or at current cursor position if not text is selected</p> <pre>editAreaLoader.insertTags('editor_id', "[OPEN]", "[CLOSE]");</pre> </td> </tr> </tbody> </table> </blockquote> <div class='separator'></div> <h3>editAreaLoader.delete_instance(editor_id)</h3> <blockquote> <p>Delete an instance of EditArea and restore simple textarea.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.hide(editor_id)</h3> <blockquote> <p>Hide a textarea and it's related EditArea.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.show(editor_id)</h3> <blockquote> <p>Restore a textarea and it's related EditArea hidden with the hide() function.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.openFile(editor_id, file_infos)</h3> <blockquote> <p></p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> <tr> <td>file_infos</td> <td>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):<br> <ul> <li><strong>id</strong> : (required) A string that will identify the file. it's the only required field. <br /><span class='underline'>Type</span>: String </li> <li><strong>title</strong> : (optionnal) The title that will be displayed in the tab area. <br /><span class='underline'>Type</span>: String <br /><span class='underline'>Default</span>: set with the id field value </li> <li><strong>text</strong> : (optionnal) The text content of the file. <br /><span class='underline'>Type</span>: String <br /><span class='underline'>Default</span>: "" </li> <li><strong>syntax</strong> : (optionnal) The syntax to use for this file. <br /><span class='underline'>Type</span>: String <br /><span class='underline'>Default</span>: "" </li> <li><strong>do_highlight</strong> : (optionnal) Set if the file should start highlighted or not <br /><span class='underline'>Type</span>: String <br /><span class='underline'>Default</span>: "" </li> </ul> </td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.getCurrentFile(editor_id)</h3> <blockquote> <p>Return datas of the currently selected file (for multi file editing mode).</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: An object containing datas related to the file.<code>Object</code></p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.getFile(editor_id, file_id)</h3> <blockquote> <p>Return datas of the file identified by file_id (for multi file editing mode).</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> <tr> <td>file_id</td> <td>The id of the file to close.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: An object containing datas related to the file.<code>Object</code></p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.getAllFiles(editor_id)</h3> <blockquote> <p>Return datas of all the currently openned files (for multi file editing mode).</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: An object containing datas of each files.<code>Object</code></p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.closeFile(editor_id, file_id)</h3> <blockquote> <p>Close the file identified by file_id (for multi file editing mode).</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> <tr> <td>file_id</td> <td>The id of the file to close.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> <div class='separator'></div> <h3>editAreaLoader.setFileEditedMode(editor_id, file_id, edited_mode)</h3> <blockquote> <p>Define is the file should appears as edited or not.</p> <table> <thead> <tr> <td colspan="2">Parameters</td> </tr> </thead> <tbody> <tr> <td>editor_id</td> <td>The id of the converted textarea on which the command should be executed.</td> </tr> <tr> <td>file_id</td> <td>The id of the file to close.</td> </tr> <tr> <td>edited_mode</td> <td>A boolean that indicate if the file should be set edited or not edited.</td> </tr> </tbody> </table> <p><strong>Returns</strong>: Nothing.</p> </blockquote> </div> <div class='footer'> <div class="indexlink"><a href="index.html">Index</a></div> <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> <br style="clear: both" /> </div> </body> </html> | |
0 | 2 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/docs/license.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | + <title>EditArea documentation</title> | |
6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | + <link href="doc_style.css" rel="stylesheet" type="text/css" /> | |
8 | +</head> | |
9 | +<body> | |
10 | + <div class='header'> | |
11 | + <h1>EditArea licenses</h1> | |
12 | + </div> | |
13 | + <div class='content'> | |
14 | + <p> | |
15 | + 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. | |
16 | + </p> | |
17 | + </div> | |
18 | + <div class='header'> | |
19 | + <h1>LGPL</h1> | |
20 | + </div> | |
21 | + <div class='content'> | |
22 | + <p> | |
23 | + Visit <a href='http://www.gnu.org/copyleft/lesser.html'>http://www.gnu.org/copyleft/lesser.html</a> for more information about LGPL license. | |
24 | + </p> | |
25 | + </div> | |
26 | + <div class='header'> | |
27 | + <h1>BSD</h1> | |
28 | + </div> | |
29 | + <div class='content'> | |
30 | + <p> | |
31 | + Visit <a href='http://www.opensource.org/licenses/bsd-license.php'>http://www.opensource.org/licenses/bsd-license.php</a> for more information about BSD license. | |
32 | + </p> | |
33 | + </div> | |
34 | + <div class='header'> | |
35 | + <h1>APACHE</h1> | |
36 | + </div> | |
37 | + <div class='content'> | |
38 | + <p> | |
39 | + Visit <a href='http://www.apache.org/licenses/LICENSE-2.0'>http://www.apache.org/licenses/LICENSE-2.0</a> for more information about Apache license. | |
40 | + </p> | |
41 | + </div> | |
42 | + <div class='footer'> | |
43 | + <div class="indexlink"><a href="index.html">Index</a></div> | |
44 | + <div class='copyright'>EditArea - © Christophe Dolivet 2007-2010</div> | |
45 | + <br style="clear: both" /> | |
46 | + </div> | |
47 | +</body> | |
48 | +</html> | ... | ... |
docs/js/editarea_0_8_2/edit_area/autocompletion.js
0 → 100644
1 | +/** | |
2 | + * Autocompletion class | |
3 | + * | |
4 | + * An auto completion box appear while you're writing. It's possible to force it to appear with Ctrl+Space short cut | |
5 | + * | |
6 | + * Loaded as a plugin inside editArea (everything made here could have been made in the plugin directory) | |
7 | + * But is definitly linked to syntax selection (no need to do 2 different files for color and auto complete for each syntax language) | |
8 | + * and add a too important feature that many people would miss if included as a plugin | |
9 | + * | |
10 | + * - init param: autocompletion_start | |
11 | + * - Button name: "autocompletion" | |
12 | + */ | |
13 | + | |
14 | +var EditArea_autocompletion= { | |
15 | + | |
16 | + /** | |
17 | + * Get called once this file is loaded (editArea still not initialized) | |
18 | + * | |
19 | + * @return nothing | |
20 | + */ | |
21 | + init: function(){ | |
22 | + // alert("test init: "+ this._someInternalFunction(2, 3)); | |
23 | + | |
24 | + if(editArea.settings["autocompletion"]) | |
25 | + this.enabled= true; | |
26 | + else | |
27 | + this.enabled= false; | |
28 | + this.current_word = false; | |
29 | + this.shown = false; | |
30 | + this.selectIndex = -1; | |
31 | + this.forceDisplay = false; | |
32 | + this.isInMiddleWord = false; | |
33 | + this.autoSelectIfOneResult = false; | |
34 | + this.delayBeforeDisplay = 100; | |
35 | + this.checkDelayTimer = false; | |
36 | + this.curr_syntax_str = ''; | |
37 | + | |
38 | + this.file_syntax_datas = {}; | |
39 | + } | |
40 | + /** | |
41 | + * Returns the HTML code for a specific control string or false if this plugin doesn't have that control. | |
42 | + * A control can be a button, select list or any other HTML item to present in the EditArea user interface. | |
43 | + * Language variables such as {$lang_somekey} will also be replaced with contents from | |
44 | + * the language packs. | |
45 | + * | |
46 | + * @param {string} ctrl_name: the name of the control to add | |
47 | + * @return HTML code for a specific control or false. | |
48 | + * @type string or boolean | |
49 | + */ | |
50 | + /*,get_control_html: function(ctrl_name){ | |
51 | + switch( ctrl_name ){ | |
52 | + case 'autocompletion': | |
53 | + // Control id, button img, command | |
54 | + return parent.editAreaLoader.get_button_html('autocompletion_but', 'autocompletion.gif', 'toggle_autocompletion', false, this.baseURL); | |
55 | + break; | |
56 | + } | |
57 | + return false; | |
58 | + }*/ | |
59 | + /** | |
60 | + * Get called once EditArea is fully loaded and initialised | |
61 | + * | |
62 | + * @return nothing | |
63 | + */ | |
64 | + ,onload: function(){ | |
65 | + if(this.enabled) | |
66 | + { | |
67 | + var icon= document.getElementById("autocompletion"); | |
68 | + if(icon) | |
69 | + editArea.switchClassSticky(icon, 'editAreaButtonSelected', true); | |
70 | + } | |
71 | + | |
72 | + this.container = document.createElement('div'); | |
73 | + this.container.id = "auto_completion_area"; | |
74 | + editArea.container.insertBefore( this.container, editArea.container.firstChild ); | |
75 | + | |
76 | + // add event detection for hiding suggestion box | |
77 | + parent.editAreaLoader.add_event( document, "click", function(){ editArea.plugins['autocompletion']._hide();} ); | |
78 | + parent.editAreaLoader.add_event( editArea.textarea, "blur", function(){ editArea.plugins['autocompletion']._hide();} ); | |
79 | + | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * Is called each time the user touch a keyboard key. | |
84 | + * | |
85 | + * @param (event) e: the keydown event | |
86 | + * @return true - pass to next handler in chain, false - stop chain execution | |
87 | + * @type boolean | |
88 | + */ | |
89 | + ,onkeydown: function(e){ | |
90 | + if(!this.enabled) | |
91 | + return true; | |
92 | + | |
93 | + if (EA_keys[e.keyCode]) | |
94 | + letter=EA_keys[e.keyCode]; | |
95 | + else | |
96 | + letter=String.fromCharCode(e.keyCode); | |
97 | + // shown | |
98 | + if( this._isShown() ) | |
99 | + { | |
100 | + // if escape, hide the box | |
101 | + if(letter=="Esc") | |
102 | + { | |
103 | + this._hide(); | |
104 | + return false; | |
105 | + } | |
106 | + // Enter | |
107 | + else if( letter=="Entrer") | |
108 | + { | |
109 | + var as = this.container.getElementsByTagName('A'); | |
110 | + // select a suggested entry | |
111 | + if( this.selectIndex >= 0 && this.selectIndex < as.length ) | |
112 | + { | |
113 | + as[ this.selectIndex ].onmousedown(); | |
114 | + return false | |
115 | + } | |
116 | + // simply add an enter in the code | |
117 | + else | |
118 | + { | |
119 | + this._hide(); | |
120 | + return true; | |
121 | + } | |
122 | + } | |
123 | + else if( letter=="Tab" || letter=="Down") | |
124 | + { | |
125 | + this._selectNext(); | |
126 | + return false; | |
127 | + } | |
128 | + else if( letter=="Up") | |
129 | + { | |
130 | + this._selectBefore(); | |
131 | + return false; | |
132 | + } | |
133 | + } | |
134 | + // hidden | |
135 | + else | |
136 | + { | |
137 | + | |
138 | + } | |
139 | + | |
140 | + // show current suggestion list and do autoSelect if possible (no matter it's shown or hidden) | |
141 | + if( letter=="Space" && CtrlPressed(e) ) | |
142 | + { | |
143 | + //parent.console.log('SHOW SUGGEST'); | |
144 | + this.forceDisplay = true; | |
145 | + this.autoSelectIfOneResult = true; | |
146 | + this._checkLetter(); | |
147 | + return false; | |
148 | + } | |
149 | + | |
150 | + // wait a short period for check that the cursor isn't moving | |
151 | + setTimeout("editArea.plugins['autocompletion']._checkDelayAndCursorBeforeDisplay();", editArea.check_line_selection_timer +5 ); | |
152 | + this.checkDelayTimer = false; | |
153 | + return true; | |
154 | + } | |
155 | + /** | |
156 | + * Executes a specific command, this function handles plugin commands. | |
157 | + * | |
158 | + * @param {string} cmd: the name of the command being executed | |
159 | + * @param {unknown} param: the parameter of the command | |
160 | + * @return true - pass to next handler in chain, false - stop chain execution | |
161 | + * @type boolean | |
162 | + */ | |
163 | + ,execCommand: function(cmd, param){ | |
164 | + switch( cmd ){ | |
165 | + case 'toggle_autocompletion': | |
166 | + var icon= document.getElementById("autocompletion"); | |
167 | + if(!this.enabled) | |
168 | + { | |
169 | + if(icon != null){ | |
170 | + editArea.restoreClass(icon); | |
171 | + editArea.switchClassSticky(icon, 'editAreaButtonSelected', true); | |
172 | + } | |
173 | + this.enabled= true; | |
174 | + } | |
175 | + else | |
176 | + { | |
177 | + this.enabled= false; | |
178 | + if(icon != null) | |
179 | + editArea.switchClassSticky(icon, 'editAreaButtonNormal', false); | |
180 | + } | |
181 | + return true; | |
182 | + } | |
183 | + return true; | |
184 | + } | |
185 | + ,_checkDelayAndCursorBeforeDisplay: function() | |
186 | + { | |
187 | + this.checkDelayTimer = setTimeout("if(editArea.textarea.selectionStart == "+ editArea.textarea.selectionStart +") EditArea_autocompletion._checkLetter();", this.delayBeforeDisplay - editArea.check_line_selection_timer - 5 ); | |
188 | + } | |
189 | + // hide the suggested box | |
190 | + ,_hide: function(){ | |
191 | + this.container.style.display="none"; | |
192 | + this.selectIndex = -1; | |
193 | + this.shown = false; | |
194 | + this.forceDisplay = false; | |
195 | + this.autoSelectIfOneResult = false; | |
196 | + } | |
197 | + // display the suggested box | |
198 | + ,_show: function(){ | |
199 | + if( !this._isShown() ) | |
200 | + { | |
201 | + this.container.style.display="block"; | |
202 | + this.selectIndex = -1; | |
203 | + this.shown = true; | |
204 | + } | |
205 | + } | |
206 | + // is the suggested box displayed? | |
207 | + ,_isShown: function(){ | |
208 | + return this.shown; | |
209 | + } | |
210 | + // setter and getter | |
211 | + ,_isInMiddleWord: function( new_value ){ | |
212 | + if( typeof( new_value ) == "undefined" ) | |
213 | + return this.isInMiddleWord; | |
214 | + else | |
215 | + this.isInMiddleWord = new_value; | |
216 | + } | |
217 | + // select the next element in the suggested box | |
218 | + ,_selectNext: function() | |
219 | + { | |
220 | + var as = this.container.getElementsByTagName('A'); | |
221 | + | |
222 | + // clean existing elements | |
223 | + for( var i=0; i<as.length; i++ ) | |
224 | + { | |
225 | + if( as[i].className ) | |
226 | + as[i].className = as[i].className.replace(/ focus/g, ''); | |
227 | + } | |
228 | + | |
229 | + this.selectIndex++; | |
230 | + this.selectIndex = ( this.selectIndex >= as.length || this.selectIndex < 0 ) ? 0 : this.selectIndex; | |
231 | + as[ this.selectIndex ].className += " focus"; | |
232 | + } | |
233 | + // select the previous element in the suggested box | |
234 | + ,_selectBefore: function() | |
235 | + { | |
236 | + var as = this.container.getElementsByTagName('A'); | |
237 | + | |
238 | + // clean existing elements | |
239 | + for( var i=0; i<as.length; i++ ) | |
240 | + { | |
241 | + if( as[i].className ) | |
242 | + as[i].className = as[ i ].className.replace(/ focus/g, ''); | |
243 | + } | |
244 | + | |
245 | + this.selectIndex--; | |
246 | + | |
247 | + this.selectIndex = ( this.selectIndex >= as.length || this.selectIndex < 0 ) ? as.length-1 : this.selectIndex; | |
248 | + as[ this.selectIndex ].className += " focus"; | |
249 | + } | |
250 | + ,_select: function( content ) | |
251 | + { | |
252 | + cursor_forced_position = content.indexOf( '{@}' ); | |
253 | + content = content.replace(/{@}/g, '' ); | |
254 | + editArea.getIESelection(); | |
255 | + | |
256 | + // retrive the number of matching characters | |
257 | + var start_index = Math.max( 0, editArea.textarea.selectionEnd - content.length ); | |
258 | + | |
259 | + line_string = editArea.textarea.value.substring( start_index, editArea.textarea.selectionEnd + 1); | |
260 | + limit = line_string.length -1; | |
261 | + nbMatch = 0; | |
262 | + for( i =0; i<limit ; i++ ) | |
263 | + { | |
264 | + if( line_string.substring( limit - i - 1, limit ) == content.substring( 0, i + 1 ) ) | |
265 | + nbMatch = i + 1; | |
266 | + } | |
267 | + // if characters match, we should include them in the selection that will be replaced | |
268 | + if( nbMatch > 0 ) | |
269 | + parent.editAreaLoader.setSelectionRange(editArea.id, editArea.textarea.selectionStart - nbMatch , editArea.textarea.selectionEnd); | |
270 | + | |
271 | + parent.editAreaLoader.setSelectedText(editArea.id, content ); | |
272 | + range= parent.editAreaLoader.getSelectionRange(editArea.id); | |
273 | + | |
274 | + if( cursor_forced_position != -1 ) | |
275 | + new_pos = range["end"] - ( content.length-cursor_forced_position ); | |
276 | + else | |
277 | + new_pos = range["end"]; | |
278 | + parent.editAreaLoader.setSelectionRange(editArea.id, new_pos, new_pos); | |
279 | + this._hide(); | |
280 | + } | |
281 | + | |
282 | + | |
283 | + /** | |
284 | + * Parse the AUTO_COMPLETION part of syntax definition files | |
285 | + */ | |
286 | + ,_parseSyntaxAutoCompletionDatas: function(){ | |
287 | + //foreach syntax loaded | |
288 | + for(var lang in parent.editAreaLoader.load_syntax) | |
289 | + { | |
290 | + if(!parent.editAreaLoader.syntax[lang]['autocompletion']) // init the regexp if not already initialized | |
291 | + { | |
292 | + parent.editAreaLoader.syntax[lang]['autocompletion']= {}; | |
293 | + // the file has auto completion datas | |
294 | + if(parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION']) | |
295 | + { | |
296 | + // parse them | |
297 | + for(var i in parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION']) | |
298 | + { | |
299 | + datas = parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'][i]; | |
300 | + tmp = {}; | |
301 | + if(datas["CASE_SENSITIVE"]!="undefined" && datas["CASE_SENSITIVE"]==false) | |
302 | + tmp["modifiers"]="i"; | |
303 | + else | |
304 | + tmp["modifiers"]=""; | |
305 | + tmp["prefix_separator"]= datas["REGEXP"]["prefix_separator"]; | |
306 | + tmp["match_prefix_separator"]= new RegExp( datas["REGEXP"]["prefix_separator"] +"$", tmp["modifiers"]); | |
307 | + tmp["match_word"]= new RegExp("(?:"+ datas["REGEXP"]["before_word"] +")("+ datas["REGEXP"]["possible_words_letters"] +")$", tmp["modifiers"]); | |
308 | + tmp["match_next_letter"]= new RegExp("^("+ datas["REGEXP"]["letter_after_word_must_match"] +")$", tmp["modifiers"]); | |
309 | + tmp["keywords"]= {}; | |
310 | + //console.log( datas["KEYWORDS"] ); | |
311 | + for( var prefix in datas["KEYWORDS"] ) | |
312 | + { | |
313 | + tmp["keywords"][prefix]= { | |
314 | + prefix: prefix, | |
315 | + prefix_name: prefix, | |
316 | + prefix_reg: new RegExp("(?:"+ parent.editAreaLoader.get_escaped_regexp( prefix ) +")(?:"+ tmp["prefix_separator"] +")$", tmp["modifiers"] ), | |
317 | + datas: [] | |
318 | + }; | |
319 | + for( var j=0; j<datas["KEYWORDS"][prefix].length; j++ ) | |
320 | + { | |
321 | + tmp["keywords"][prefix]['datas'][j]= { | |
322 | + is_typing: datas["KEYWORDS"][prefix][j][0], | |
323 | + // if replace with is empty, replace with the is_typing value | |
324 | + replace_with: datas["KEYWORDS"][prefix][j][1] ? datas["KEYWORDS"][prefix][j][1].replace('§', datas["KEYWORDS"][prefix][j][0] ) : '', | |
325 | + comment: datas["KEYWORDS"][prefix][j][2] ? datas["KEYWORDS"][prefix][j][2] : '' | |
326 | + }; | |
327 | + | |
328 | + // the replace with shouldn't be empty | |
329 | + if( tmp["keywords"][prefix]['datas'][j]['replace_with'].length == 0 ) | |
330 | + tmp["keywords"][prefix]['datas'][j]['replace_with'] = tmp["keywords"][prefix]['datas'][j]['is_typing']; | |
331 | + | |
332 | + // if the comment is empty, display the replace_with value | |
333 | + if( tmp["keywords"][prefix]['datas'][j]['comment'].length == 0 ) | |
334 | + tmp["keywords"][prefix]['datas'][j]['comment'] = tmp["keywords"][prefix]['datas'][j]['replace_with'].replace(/{@}/g, '' ); | |
335 | + } | |
336 | + | |
337 | + } | |
338 | + tmp["max_text_length"]= datas["MAX_TEXT_LENGTH"]; | |
339 | + parent.editAreaLoader.syntax[lang]['autocompletion'][i] = tmp; | |
340 | + } | |
341 | + } | |
342 | + } | |
343 | + } | |
344 | + } | |
345 | + | |
346 | + ,_checkLetter: function(){ | |
347 | + // check that syntax hasn't changed | |
348 | + if( this.curr_syntax_str != editArea.settings['syntax'] ) | |
349 | + { | |
350 | + if( !parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion'] ) | |
351 | + this._parseSyntaxAutoCompletionDatas(); | |
352 | + this.curr_syntax= parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion']; | |
353 | + this.curr_syntax_str = editArea.settings['syntax']; | |
354 | + //console.log( this.curr_syntax ); | |
355 | + } | |
356 | + | |
357 | + if( editArea.is_editable ) | |
358 | + { | |
359 | + time=new Date; | |
360 | + t1= time.getTime(); | |
361 | + editArea.getIESelection(); | |
362 | + this.selectIndex = -1; | |
363 | + start=editArea.textarea.selectionStart; | |
364 | + var str = editArea.textarea.value; | |
365 | + var results= []; | |
366 | + | |
367 | + | |
368 | + for(var i in this.curr_syntax) | |
369 | + { | |
370 | + var last_chars = str.substring(Math.max(0, start-this.curr_syntax[i]["max_text_length"]), start); | |
371 | + var matchNextletter = str.substring(start, start+1).match( this.curr_syntax[i]["match_next_letter"]); | |
372 | + // if not writting in the middle of a word or if forcing display | |
373 | + if( matchNextletter || this.forceDisplay ) | |
374 | + { | |
375 | + // check if the last chars match a separator | |
376 | + var match_prefix_separator = last_chars.match(this.curr_syntax[i]["match_prefix_separator"]); | |
377 | + | |
378 | + // check if it match a possible word | |
379 | + var match_word= last_chars.match(this.curr_syntax[i]["match_word"]); | |
380 | + | |
381 | + //console.log( match_word ); | |
382 | + if( match_word ) | |
383 | + { | |
384 | + var begin_word= match_word[1]; | |
385 | + var match_curr_word= new RegExp("^"+ parent.editAreaLoader.get_escaped_regexp( begin_word ), this.curr_syntax[i]["modifiers"]); | |
386 | + //console.log( match_curr_word ); | |
387 | + for(var prefix in this.curr_syntax[i]["keywords"]) | |
388 | + { | |
389 | + // parent.console.log( this.curr_syntax[i]["keywords"][prefix] ); | |
390 | + for(var j=0; j<this.curr_syntax[i]["keywords"][prefix]['datas'].length; j++) | |
391 | + { | |
392 | + // parent.console.log( this.curr_syntax[i]["keywords"][prefix]['datas'][j]['is_typing'] ); | |
393 | + // the key word match or force display | |
394 | + if( this.curr_syntax[i]["keywords"][prefix]['datas'][j]['is_typing'].match(match_curr_word) ) | |
395 | + { | |
396 | + // parent.console.log('match'); | |
397 | + hasMatch = false; | |
398 | + var before = last_chars.substr( 0, last_chars.length - begin_word.length ); | |
399 | + | |
400 | + // no prefix to match => it's valid | |
401 | + if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 ) | |
402 | + { | |
403 | + if( ! before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) ) | |
404 | + hasMatch = true; | |
405 | + } | |
406 | + // we still need to check the prefix if there is one | |
407 | + else if( this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 ) | |
408 | + { | |
409 | + if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) ) | |
410 | + hasMatch = true; | |
411 | + } | |
412 | + | |
413 | + if( hasMatch ) | |
414 | + results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ]; | |
415 | + } | |
416 | + } | |
417 | + } | |
418 | + } | |
419 | + // it doesn't match any possible word but we want to display something | |
420 | + // we'll display to list of all available words | |
421 | + else if( this.forceDisplay || match_prefix_separator ) | |
422 | + { | |
423 | + for(var prefix in this.curr_syntax[i]["keywords"]) | |
424 | + { | |
425 | + for(var j=0; j<this.curr_syntax[i]["keywords"][prefix]['datas'].length; j++) | |
426 | + { | |
427 | + hasMatch = false; | |
428 | + // no prefix to match => it's valid | |
429 | + if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 ) | |
430 | + { | |
431 | + hasMatch = true; | |
432 | + } | |
433 | + // we still need to check the prefix if there is one | |
434 | + else if( match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 ) | |
435 | + { | |
436 | + var before = last_chars; //.substr( 0, last_chars.length ); | |
437 | + if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) ) | |
438 | + hasMatch = true; | |
439 | + } | |
440 | + | |
441 | + if( hasMatch ) | |
442 | + results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ]; | |
443 | + } | |
444 | + } | |
445 | + } | |
446 | + } | |
447 | + } | |
448 | + | |
449 | + // there is only one result, and we can select it automatically | |
450 | + if( results.length == 1 && this.autoSelectIfOneResult ) | |
451 | + { | |
452 | + // console.log( results ); | |
453 | + this._select( results[0][1]['replace_with'] ); | |
454 | + } | |
455 | + else if( results.length == 0 ) | |
456 | + { | |
457 | + this._hide(); | |
458 | + } | |
459 | + else | |
460 | + { | |
461 | + // build the suggestion box content | |
462 | + var lines=[]; | |
463 | + for(var i=0; i<results.length; i++) | |
464 | + { | |
465 | + var line= "<li><a href=\"#\" class=\"entry\" onmousedown=\"EditArea_autocompletion._select('"+ results[i][1]['replace_with'].replace(new RegExp('"', "g"), """) +"');return false;\">"+ results[i][1]['comment']; | |
466 | + if(results[i][0]['prefix_name'].length>0) | |
467 | + line+='<span class="prefix">'+ results[i][0]['prefix_name'] +'</span>'; | |
468 | + line+='</a></li>'; | |
469 | + lines[lines.length]=line; | |
470 | + } | |
471 | + // sort results | |
472 | + this.container.innerHTML = '<ul>'+ lines.sort().join('') +'</ul>'; | |
473 | + | |
474 | + var cursor = _$("cursor_pos"); | |
475 | + this.container.style.top = ( cursor.cursor_top + editArea.lineHeight ) +"px"; | |
476 | + this.container.style.left = ( cursor.cursor_left + 8 ) +"px"; | |
477 | + this._show(); | |
478 | + } | |
479 | + | |
480 | + this.autoSelectIfOneResult = false; | |
481 | + time=new Date; | |
482 | + t2= time.getTime(); | |
483 | + | |
484 | + //parent.console.log( begin_word +"\n"+ (t2-t1) +"\n"+ html ); | |
485 | + } | |
486 | + } | |
487 | +}; | |
488 | + | |
489 | +// Load as a plugin | |
490 | +editArea.settings['plugins'][ editArea.settings['plugins'].length ] = 'autocompletion'; | |
491 | +editArea.add_plugin('autocompletion', EditArea_autocompletion); | |
0 | 492 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/edit_area.css
0 → 100644
1 | +body, html{ | |
2 | + margin: 0; | |
3 | + padding: 0; | |
4 | + height: 100%; | |
5 | + border: none; | |
6 | + overflow: hidden; | |
7 | + background-color: #FFF; | |
8 | +} | |
9 | + | |
10 | +body, html, table, form, textarea{ | |
11 | + font: 12px monospace, sans-serif; | |
12 | +} | |
13 | + | |
14 | +#editor{ | |
15 | + border: solid #888 1px; | |
16 | + overflow: hidden; | |
17 | +} | |
18 | + | |
19 | +#result{ | |
20 | + z-index: 4; | |
21 | + overflow-x: auto; | |
22 | + overflow-y: scroll; | |
23 | + border-top: solid #888 1px; | |
24 | + border-bottom: solid #888 1px; | |
25 | + position: relative; | |
26 | + clear: both; | |
27 | +} | |
28 | + | |
29 | +#result.empty{ | |
30 | + overflow: hidden; | |
31 | +} | |
32 | + | |
33 | +#container{ | |
34 | + overflow: hidden; | |
35 | + border: solid blue 0; | |
36 | + position: relative; | |
37 | + z-index: 10; | |
38 | + padding: 0 5px 0 45px; | |
39 | + /*padding-right: 5px;*/ | |
40 | +} | |
41 | + | |
42 | +#textarea{ | |
43 | + position: relative; | |
44 | + top: 0; | |
45 | + left: 0; | |
46 | + margin: 0; | |
47 | + padding: 0; | |
48 | + width: 100%; | |
49 | + height: 100%; | |
50 | + overflow: hidden; | |
51 | + z-index: 7; | |
52 | + border-width: 0; | |
53 | + background-color: transparent; | |
54 | + resize: none; | |
55 | +} | |
56 | + | |
57 | +#textarea, #textarea:hover{ | |
58 | + outline: none; /* safari outline fix */ | |
59 | +} | |
60 | + | |
61 | +#content_highlight{ | |
62 | + white-space: pre; | |
63 | + margin: 0; | |
64 | + padding: 0; | |
65 | + position : absolute; | |
66 | + z-index: 4; | |
67 | + overflow: visible; | |
68 | +} | |
69 | + | |
70 | + | |
71 | +#selection_field, #selection_field_text{ | |
72 | + margin: 0; | |
73 | + background-color: #E1F2F9; | |
74 | +/* height: 1px; */ | |
75 | + position: absolute; | |
76 | + z-index: 5; | |
77 | + top: -100px; | |
78 | + padding: 0; | |
79 | + white-space: pre; | |
80 | + overflow: hidden; | |
81 | +} | |
82 | + | |
83 | +#selection_field.show_colors { | |
84 | + z-index: 3; | |
85 | + background-color:#EDF9FC; | |
86 | + | |
87 | +} | |
88 | + | |
89 | +#selection_field strong{ | |
90 | + font-weight:normal; | |
91 | +} | |
92 | + | |
93 | +#selection_field.show_colors *, #selection_field_text * { | |
94 | + visibility: hidden; | |
95 | +} | |
96 | + | |
97 | +#selection_field_text{ | |
98 | + background-color:transparent; | |
99 | +} | |
100 | + | |
101 | +#selection_field_text strong{ | |
102 | + font-weight:normal; | |
103 | + background-color:#3399FE; | |
104 | + color: #FFF; | |
105 | + visibility:visible; | |
106 | +} | |
107 | + | |
108 | +#container.word_wrap #content_highlight, | |
109 | +#container.word_wrap #selection_field, | |
110 | +#container.word_wrap #selection_field_text, | |
111 | +#container.word_wrap #test_font_size{ | |
112 | + white-space: pre-wrap; /* css-3 */ | |
113 | + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ | |
114 | + white-space: -pre-wrap; /* Opera 4-6 */ | |
115 | + white-space: -o-pre-wrap; /* Opera 7 */ | |
116 | + word-wrap: break-word; /* Internet Explorer 5.5+ */ | |
117 | + width: 99%; | |
118 | +} | |
119 | + | |
120 | +#line_number{ | |
121 | + position: absolute; | |
122 | + overflow: hidden; | |
123 | + border-right: solid black 1px; | |
124 | + z-index:8; | |
125 | + width: 38px; | |
126 | + padding: 0 5px 0 0; | |
127 | + margin: 0 0 0 -45px; | |
128 | + text-align: right; | |
129 | + color: #AAAAAA; | |
130 | +} | |
131 | + | |
132 | +#test_font_size{ | |
133 | + padding: 0; | |
134 | + margin: 0; | |
135 | + visibility: hidden; | |
136 | + position: absolute; | |
137 | + white-space: pre; | |
138 | +} | |
139 | + | |
140 | +pre{ | |
141 | + margin: 0; | |
142 | + padding: 0; | |
143 | +} | |
144 | + | |
145 | +.hidden{ | |
146 | + opacity: 0.2; | |
147 | + filter:alpha(opacity=20); | |
148 | +} | |
149 | + | |
150 | +#result .edit_area_cursor{ | |
151 | + position: absolute; | |
152 | + z-index:6; | |
153 | + background-color: #FF6633; | |
154 | + top: -100px; | |
155 | + margin: 0; | |
156 | +} | |
157 | + | |
158 | +#result .edit_area_selection_field .overline{ | |
159 | + background-color: #996600; | |
160 | +} | |
161 | + | |
162 | + | |
163 | +/* area popup */ | |
164 | +.editarea_popup{ | |
165 | + border: solid 1px #888888; | |
166 | + background-color: #ECE9D8; | |
167 | + width: 250px; | |
168 | + padding: 4px; | |
169 | + position: absolute; | |
170 | + visibility: hidden; | |
171 | + z-index: 15; | |
172 | + top: -500px; | |
173 | +} | |
174 | + | |
175 | +.editarea_popup, .editarea_popup table{ | |
176 | + font-family: sans-serif; | |
177 | + font-size: 10pt; | |
178 | +} | |
179 | + | |
180 | +.editarea_popup img{ | |
181 | + border: 0; | |
182 | +} | |
183 | + | |
184 | +.editarea_popup .close_popup{ | |
185 | + float: right; | |
186 | + line-height: 16px; | |
187 | + border: 0; | |
188 | + padding: 0; | |
189 | +} | |
190 | + | |
191 | +.editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{ | |
192 | + margin: 0; | |
193 | + padding: 0; | |
194 | +} | |
195 | + | |
196 | +.editarea_popup .copyright{ | |
197 | + text-align: right; | |
198 | +} | |
199 | + | |
200 | +/* Area_search */ | |
201 | +div#area_search_replace{ | |
202 | + /*width: 250px;*/ | |
203 | +} | |
204 | + | |
205 | +div#area_search_replace img{ | |
206 | + border: 0; | |
207 | +} | |
208 | + | |
209 | +div#area_search_replace div.button{ | |
210 | + text-align: center; | |
211 | + line-height: 1.7em; | |
212 | +} | |
213 | + | |
214 | +div#area_search_replace .button a{ | |
215 | + cursor: pointer; | |
216 | + border: solid 1px #888888; | |
217 | + background-color: #DEDEDE; | |
218 | + text-decoration: none; | |
219 | + padding: 0 2px; | |
220 | + color: #000000; | |
221 | + white-space: nowrap; | |
222 | +} | |
223 | + | |
224 | +div#area_search_replace a:hover{ | |
225 | + /*border: solid 1px #888888;*/ | |
226 | + background-color: #EDEDED; | |
227 | +} | |
228 | + | |
229 | +div#area_search_replace #move_area_search_replace{ | |
230 | + cursor: move; | |
231 | + border: solid 1px #888; | |
232 | +} | |
233 | + | |
234 | +div#area_search_replace #close_area_search_replace{ | |
235 | + text-align: right; | |
236 | + vertical-align: top; | |
237 | + white-space: nowrap; | |
238 | +} | |
239 | + | |
240 | +div#area_search_replace #area_search_msg{ | |
241 | + height: 18px; | |
242 | + overflow: hidden; | |
243 | + border-top: solid 1px #888; | |
244 | + margin-top: 3px; | |
245 | +} | |
246 | + | |
247 | +/* area help */ | |
248 | +#edit_area_help{ | |
249 | + width: 350px; | |
250 | +} | |
251 | + | |
252 | +#edit_area_help div.close_popup{ | |
253 | + float: right; | |
254 | +} | |
255 | + | |
256 | +/* area_toolbar */ | |
257 | +.area_toolbar{ | |
258 | + /*font: 11px sans-serif;*/ | |
259 | + width: 100%; | |
260 | + /*height: 21px; */ | |
261 | + margin: 0; | |
262 | + padding: 0; | |
263 | + background-color: #ECE9D8; | |
264 | + text-align: center; | |
265 | +} | |
266 | + | |
267 | +.area_toolbar, .area_toolbar table{ | |
268 | + font: 11px sans-serif; | |
269 | +} | |
270 | + | |
271 | +.area_toolbar img{ | |
272 | + border: 0; | |
273 | + vertical-align: middle; | |
274 | +} | |
275 | + | |
276 | +.area_toolbar input{ | |
277 | + margin: 0; | |
278 | + padding: 0; | |
279 | +} | |
280 | + | |
281 | +.area_toolbar select{ | |
282 | + font-family: 'MS Sans Serif',sans-serif,Verdana,Arial; | |
283 | + font-size: 7pt; | |
284 | + font-weight: normal; | |
285 | + margin: 2px 0 0 0 ; | |
286 | + padding: 0; | |
287 | + vertical-align: top; | |
288 | + background-color: #F0F0EE; | |
289 | +} | |
290 | + | |
291 | +table.statusbar{ | |
292 | + width: 100%; | |
293 | +} | |
294 | + | |
295 | +.area_toolbar td.infos{ | |
296 | + text-align: center; | |
297 | + width: 130px; | |
298 | + border-right: solid 1px #888; | |
299 | + border-width: 0 1px 0 0; | |
300 | + padding: 0; | |
301 | +} | |
302 | + | |
303 | +.area_toolbar td.total{ | |
304 | + text-align: right; | |
305 | + width: 50px; | |
306 | + padding: 0; | |
307 | +} | |
308 | + | |
309 | +.area_toolbar td.resize{ | |
310 | + text-align: right; | |
311 | +} | |
312 | +/* | |
313 | +.area_toolbar span{ | |
314 | + line-height: 1px; | |
315 | + padding: 0; | |
316 | + margin: 0; | |
317 | +}*/ | |
318 | + | |
319 | +.area_toolbar span#resize_area{ | |
320 | + cursor: nw-resize; | |
321 | + visibility: hidden; | |
322 | +} | |
323 | + | |
324 | +/* toolbar buttons */ | |
325 | +.editAreaButtonNormal, .editAreaButtonOver, .editAreaButtonDown, .editAreaSeparator, .editAreaSeparatorLine, .editAreaButtonDisabled, .editAreaButtonSelected { | |
326 | + border: 0; margin: 0; padding: 0; background: transparent; | |
327 | + margin-top: 0; | |
328 | + margin-left: 1px; | |
329 | + padding: 0; | |
330 | +} | |
331 | + | |
332 | +.editAreaButtonNormal { | |
333 | + border: 1px solid #ECE9D8 !important; | |
334 | + cursor: pointer; | |
335 | +} | |
336 | + | |
337 | +.editAreaButtonOver { | |
338 | + border: 1px solid #0A246A !important; | |
339 | + cursor: pointer; | |
340 | + background-color: #B6BDD2; | |
341 | +} | |
342 | + | |
343 | +.editAreaButtonDown { | |
344 | + cursor: pointer; | |
345 | + border: 1px solid #0A246A !important; | |
346 | + background-color: #8592B5; | |
347 | +} | |
348 | + | |
349 | +.editAreaButtonSelected { | |
350 | + border: 1px solid #C0C0BB !important; | |
351 | + cursor: pointer; | |
352 | + background-color: #F4F2E8; | |
353 | +} | |
354 | + | |
355 | +.editAreaButtonDisabled { | |
356 | + filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); | |
357 | + -moz-opacity:0.3; | |
358 | + opacity: 0.3; | |
359 | + border: 1px solid #F0F0EE !important; | |
360 | + cursor: pointer; | |
361 | +} | |
362 | + | |
363 | +.editAreaSeparatorLine { | |
364 | + margin: 1px 2px; | |
365 | + background-color: #C0C0BB; | |
366 | + width: 2px; | |
367 | + height: 18px; | |
368 | +} | |
369 | + | |
370 | +/* waiting screen */ | |
371 | +#processing{ | |
372 | + display: none; | |
373 | + background-color:#ECE9D8; | |
374 | + border: solid #888 1px; | |
375 | + position: absolute; | |
376 | + top: 0; | |
377 | + left: 0; | |
378 | + width: 100%; | |
379 | + height: 100%; | |
380 | + z-index: 100; | |
381 | + text-align: center; | |
382 | +} | |
383 | + | |
384 | +#processing_text{ | |
385 | + position:absolute; | |
386 | + left: 50%; | |
387 | + top: 50%; | |
388 | + width: 200px; | |
389 | + height: 20px; | |
390 | + margin-left: -100px; | |
391 | + margin-top: -10px; | |
392 | + text-align: center; | |
393 | +} | |
394 | +/* end */ | |
395 | + | |
396 | + | |
397 | +/**** tab browsing area ****/ | |
398 | +#tab_browsing_area{ | |
399 | + display: none; | |
400 | + background-color: #CCC9A8; | |
401 | + border-top: 1px solid #888; | |
402 | + text-align: left; | |
403 | + margin: 0; | |
404 | +} | |
405 | + | |
406 | +#tab_browsing_list { | |
407 | + padding: 0; | |
408 | + margin: 0; | |
409 | + list-style-type: none; | |
410 | + white-space: nowrap; | |
411 | +} | |
412 | +#tab_browsing_list li { | |
413 | + float: left; | |
414 | + margin: -1px; | |
415 | +} | |
416 | +#tab_browsing_list a { | |
417 | + position: relative; | |
418 | + display: block; | |
419 | + text-decoration: none; | |
420 | + float: left; | |
421 | + cursor: pointer; | |
422 | + line-height:14px; | |
423 | +} | |
424 | + | |
425 | +#tab_browsing_list a span { | |
426 | + display: block; | |
427 | + color: #000; | |
428 | + background: #ECE9D8; | |
429 | + border: 1px solid #888; | |
430 | + border-width: 1px 1px 0; | |
431 | + text-align: center; | |
432 | + padding: 2px 2px 1px 4px; | |
433 | + position: relative; /*IE 6 hack */ | |
434 | +} | |
435 | + | |
436 | +#tab_browsing_list a b { | |
437 | + display: block; | |
438 | + border-bottom: 2px solid #617994; | |
439 | +} | |
440 | + | |
441 | +#tab_browsing_list a .edited { | |
442 | + display: none; | |
443 | +} | |
444 | + | |
445 | +#tab_browsing_list a.edited .edited { | |
446 | + display: inline; | |
447 | +} | |
448 | + | |
449 | +#tab_browsing_list a img{ | |
450 | + margin-left: 7px; | |
451 | +} | |
452 | + | |
453 | +#tab_browsing_list a.edited img{ | |
454 | + margin-left: 3px; | |
455 | +} | |
456 | + | |
457 | +#tab_browsing_list a:hover span { | |
458 | + background: #F4F2E8; | |
459 | + border-color: #0A246A; | |
460 | +} | |
461 | + | |
462 | +#tab_browsing_list .selected a span{ | |
463 | + background: #046380; | |
464 | + color: #FFF; | |
465 | +} | |
466 | + | |
467 | + | |
468 | +#no_file_selected{ | |
469 | + height: 100%; | |
470 | + width: 150%; /* Opera need more than 100% */ | |
471 | + background: #CCC; | |
472 | + display: none; | |
473 | + z-index: 20; | |
474 | + position: absolute; | |
475 | +} | |
476 | + | |
477 | + | |
478 | +/*** Non-editable mode ***/ | |
479 | +.non_editable #editor | |
480 | +{ | |
481 | + border-width: 0 1px; | |
482 | +} | |
483 | + | |
484 | +.non_editable .area_toolbar | |
485 | +{ | |
486 | + display: none; | |
487 | +} | |
488 | + | |
489 | +/*** Auto completion ***/ | |
490 | +#auto_completion_area | |
491 | +{ | |
492 | + background: #FFF; | |
493 | + border: solid 1px #888; | |
494 | + position: absolute; | |
495 | + z-index: 15; | |
496 | + width: 280px; | |
497 | + height: 180px; | |
498 | + overflow: auto; | |
499 | + display:none; | |
500 | +} | |
501 | + | |
502 | +#auto_completion_area a, #auto_completion_area a:visited | |
503 | +{ | |
504 | + display: block; | |
505 | + padding: 0 2px 1px; | |
506 | + color: #000; | |
507 | + text-decoration:none; | |
508 | +} | |
509 | + | |
510 | +#auto_completion_area a:hover, #auto_completion_area a:focus, #auto_completion_area a.focus | |
511 | +{ | |
512 | + background: #D6E1FE; | |
513 | + text-decoration:none; | |
514 | +} | |
515 | + | |
516 | +#auto_completion_area ul | |
517 | +{ | |
518 | + margin: 0; | |
519 | + padding: 0; | |
520 | + list-style: none inside; | |
521 | +} | |
522 | +#auto_completion_area li | |
523 | +{ | |
524 | + padding: 0; | |
525 | +} | |
526 | +#auto_completion_area .prefix | |
527 | +{ | |
528 | + font-style: italic; | |
529 | + padding: 0 3px; | |
530 | +} | |
0 | 531 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/edit_area.js
0 → 100644
1 | +/****** | |
2 | + * | |
3 | + * EditArea | |
4 | + * Developped by Christophe Dolivet | |
5 | + * Released under LGPL, Apache and BSD licenses (use the one you want) | |
6 | + * | |
7 | +******/ | |
8 | + | |
9 | + function EditArea(){ | |
10 | + var t=this; | |
11 | + t.error= false; // to know if load is interrrupt | |
12 | + | |
13 | + t.inlinePopup= [{popup_id: "area_search_replace", icon_id: "search"}, | |
14 | + {popup_id: "edit_area_help", icon_id: "help"}]; | |
15 | + t.plugins= {}; | |
16 | + | |
17 | + t.line_number=0; | |
18 | + | |
19 | + parent.editAreaLoader.set_browser_infos(t); // navigator identification | |
20 | + // fix IE8 detection as we run in IE7 emulate mode through X-UA <meta> tag | |
21 | + if( t.isIE >= 8 ) | |
22 | + t.isIE = 7; | |
23 | + | |
24 | + t.last_selection={}; | |
25 | + t.last_text_to_highlight=""; | |
26 | + t.last_hightlighted_text= ""; | |
27 | + t.syntax_list= []; | |
28 | + t.allready_used_syntax= {}; | |
29 | + t.check_line_selection_timer= 50; // the timer delay for modification and/or selection change detection | |
30 | + | |
31 | + t.textareaFocused= false; | |
32 | + t.highlight_selection_line= null; | |
33 | + t.previous= []; | |
34 | + t.next= []; | |
35 | + t.last_undo=""; | |
36 | + t.files= {}; | |
37 | + t.filesIdAssoc= {}; | |
38 | + t.curr_file= ''; | |
39 | + //t.loaded= false; | |
40 | + t.assocBracket={}; | |
41 | + t.revertAssocBracket= {}; | |
42 | + // bracket selection init | |
43 | + t.assocBracket["("]=")"; | |
44 | + t.assocBracket["{"]="}"; | |
45 | + t.assocBracket["["]="]"; | |
46 | + for(var index in t.assocBracket){ | |
47 | + t.revertAssocBracket[t.assocBracket[index]]=index; | |
48 | + } | |
49 | + t.is_editable= true; | |
50 | + | |
51 | + | |
52 | + /*t.textarea=""; | |
53 | + | |
54 | + t.state="declare"; | |
55 | + t.code = []; // store highlight syntax for languagues*/ | |
56 | + // font datas | |
57 | + t.lineHeight= 16; | |
58 | + /*t.default_font_family= "monospace"; | |
59 | + t.default_font_size= 10;*/ | |
60 | + t.tab_nb_char= 8; //nb of white spaces corresponding to a tabulation | |
61 | + if(t.isOpera) | |
62 | + t.tab_nb_char= 6; | |
63 | + | |
64 | + t.is_tabbing= false; | |
65 | + | |
66 | + t.fullscreen= {'isFull': false}; | |
67 | + | |
68 | + t.isResizing=false; // resize var | |
69 | + | |
70 | + // init with settings and ID (area_id is a global var defined by editAreaLoader on iframe creation | |
71 | + t.id= area_id; | |
72 | + t.settings= editAreas[t.id]["settings"]; | |
73 | + | |
74 | + if((""+t.settings['replace_tab_by_spaces']).match(/^[0-9]+$/)) | |
75 | + { | |
76 | + t.tab_nb_char= t.settings['replace_tab_by_spaces']; | |
77 | + t.tabulation=""; | |
78 | + for(var i=0; i<t.tab_nb_char; i++) | |
79 | + t.tabulation+=" "; | |
80 | + }else{ | |
81 | + t.tabulation="\t"; | |
82 | + } | |
83 | + | |
84 | + // retrieve the init parameter for syntax | |
85 | + if(t.settings["syntax_selection_allow"] && t.settings["syntax_selection_allow"].length>0) | |
86 | + t.syntax_list= t.settings["syntax_selection_allow"].replace(/ /g,"").split(","); | |
87 | + | |
88 | + if(t.settings['syntax']) | |
89 | + t.allready_used_syntax[t.settings['syntax']]=true; | |
90 | + | |
91 | + | |
92 | + }; | |
93 | + EditArea.prototype.init= function(){ | |
94 | + var t=this, a, s=t.settings; | |
95 | + t.textarea = _$("textarea"); | |
96 | + t.container = _$("container"); | |
97 | + t.result = _$("result"); | |
98 | + t.content_highlight = _$("content_highlight"); | |
99 | + t.selection_field = _$("selection_field"); | |
100 | + t.selection_field_text= _$("selection_field_text"); | |
101 | + t.processing_screen = _$("processing"); | |
102 | + t.editor_area = _$("editor"); | |
103 | + t.tab_browsing_area = _$("tab_browsing_area"); | |
104 | + t.test_font_size = _$("test_font_size"); | |
105 | + a = t.textarea; | |
106 | + | |
107 | + if(!s['is_editable']) | |
108 | + t.set_editable(false); | |
109 | + | |
110 | + t.set_show_line_colors( s['show_line_colors'] ); | |
111 | + | |
112 | + if(syntax_selec= _$("syntax_selection")) | |
113 | + { | |
114 | + // set up syntax selection lsit in the toolbar | |
115 | + for(var i=0; i<t.syntax_list.length; i++) { | |
116 | + var syntax= t.syntax_list[i]; | |
117 | + var option= document.createElement("option"); | |
118 | + option.value= syntax; | |
119 | + if(syntax==s['syntax']) | |
120 | + option.selected= "selected"; | |
121 | + dispSyntax = parent.editAreaLoader.syntax_display_name[ syntax ]; | |
122 | + option.innerHTML= typeof( dispSyntax ) == 'undefined' ? syntax.substring( 0, 1 ).toUpperCase() + syntax.substring( 1 ) : dispSyntax;//t.get_translation("syntax_" + syntax, "word"); | |
123 | + syntax_selec.appendChild(option); | |
124 | + } | |
125 | + } | |
126 | + | |
127 | + // add plugins buttons in the toolbar | |
128 | + spans= parent.getChildren(_$("toolbar_1"), "span", "", "", "all", -1); | |
129 | + | |
130 | + for(var i=0; i<spans.length; i++){ | |
131 | + | |
132 | + id=spans[i].id.replace(/tmp_tool_(.*)/, "$1"); | |
133 | + if(id!= spans[i].id){ | |
134 | + for(var j in t.plugins){ | |
135 | + if(typeof(t.plugins[j].get_control_html)=="function" ){ | |
136 | + html=t.plugins[j].get_control_html(id); | |
137 | + if(html!=false){ | |
138 | + html= t.get_translation(html, "template"); | |
139 | + var new_span= document.createElement("span"); | |
140 | + new_span.innerHTML= html; | |
141 | + var father= spans[i].parentNode; | |
142 | + spans[i].parentNode.replaceChild(new_span, spans[i]); | |
143 | + break; // exit the for loop | |
144 | + } | |
145 | + } | |
146 | + } | |
147 | + } | |
148 | + } | |
149 | + | |
150 | + // init datas | |
151 | + //a.value = 'a';//editAreas[t.id]["textarea"].value; | |
152 | + | |
153 | + if(s["debug"]) | |
154 | + { | |
155 | + t.debug=parent.document.getElementById("edit_area_debug_"+t.id); | |
156 | + } | |
157 | + // init size | |
158 | + //this.update_size(); | |
159 | + | |
160 | + if(_$("redo") != null) | |
161 | + t.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); | |
162 | + | |
163 | + // insert css rules for highlight mode | |
164 | + if(typeof(parent.editAreaLoader.syntax[s["syntax"]])!="undefined"){ | |
165 | + for(var i in parent.editAreaLoader.syntax){ | |
166 | + if (typeof(parent.editAreaLoader.syntax[i]["styles"]) != "undefined"){ | |
167 | + t.add_style(parent.editAreaLoader.syntax[i]["styles"]); | |
168 | + } | |
169 | + } | |
170 | + } | |
171 | + | |
172 | + // init key events | |
173 | + if(t.isOpera) | |
174 | + _$("editor").onkeypress = keyDown; | |
175 | + else | |
176 | + _$("editor").onkeydown = keyDown; | |
177 | + | |
178 | + for(var i=0; i<t.inlinePopup.length; i++){ | |
179 | + if(t.isOpera) | |
180 | + _$(t.inlinePopup[i]["popup_id"]).onkeypress = keyDown; | |
181 | + else | |
182 | + _$(t.inlinePopup[i]["popup_id"]).onkeydown = keyDown; | |
183 | + } | |
184 | + | |
185 | + if(s["allow_resize"]=="both" || s["allow_resize"]=="x" || s["allow_resize"]=="y") | |
186 | + t.allow_resize(true); | |
187 | + | |
188 | + parent.editAreaLoader.toggle(t.id, "on"); | |
189 | + //a.focus(); | |
190 | + // line selection init | |
191 | + t.change_smooth_selection_mode(editArea.smooth_selection); | |
192 | + // highlight | |
193 | + t.execCommand("change_highlight", s["start_highlight"]); | |
194 | + | |
195 | + // get font size datas | |
196 | + t.set_font(editArea.settings["font_family"], editArea.settings["font_size"]); | |
197 | + | |
198 | + // set unselectable text | |
199 | + children= parent.getChildren(document.body, "", "selec", "none", "all", -1); | |
200 | + for(var i=0; i<children.length; i++){ | |
201 | + if(t.isIE) | |
202 | + children[i].unselectable = true; // IE | |
203 | + else | |
204 | + children[i].onmousedown= function(){return false}; | |
205 | + /* children[i].style.MozUserSelect = "none"; // Moz | |
206 | + children[i].style.KhtmlUserSelect = "none"; // Konqueror/Safari*/ | |
207 | + } | |
208 | + | |
209 | + a.spellcheck= s["gecko_spellcheck"]; | |
210 | + | |
211 | + /** Browser specific style fixes **/ | |
212 | + | |
213 | + // fix rendering bug for highlighted lines beginning with no tabs | |
214 | + if( t.isFirefox >= '3' ) { | |
215 | + t.content_highlight.style.paddingLeft= "1px"; | |
216 | + t.selection_field.style.paddingLeft= "1px"; | |
217 | + t.selection_field_text.style.paddingLeft= "1px"; | |
218 | + } | |
219 | + | |
220 | + if(t.isIE && t.isIE < 8 ){ | |
221 | + a.style.marginTop= "-1px"; | |
222 | + } | |
223 | + /* | |
224 | + if(t.isOpera){ | |
225 | + t.editor_area.style.position= "absolute"; | |
226 | + }*/ | |
227 | + | |
228 | + if( t.isSafari ){ | |
229 | + t.editor_area.style.position = "absolute"; | |
230 | + a.style.marginLeft ="-3px"; | |
231 | + if( t.isSafari < 3.2 ) // Safari 3.0 (3.1?) | |
232 | + a.style.marginTop ="1px"; | |
233 | + } | |
234 | + | |
235 | + // si le textarea n'est pas grand, un click sous le textarea doit provoquer un focus sur le textarea | |
236 | + parent.editAreaLoader.add_event(t.result, "click", function(e){ if((e.target || e.srcElement)==editArea.result) { editArea.area_select(editArea.textarea.value.length, 0);} }); | |
237 | + | |
238 | + if(s['is_multi_files']!=false) | |
239 | + t.open_file({'id': t.curr_file, 'text': ''}); | |
240 | + | |
241 | + t.set_word_wrap( s['word_wrap'] ); | |
242 | + | |
243 | + setTimeout("editArea.focus();editArea.manage_size();editArea.execCommand('EA_load');", 10); | |
244 | + //start checkup routine | |
245 | + t.check_undo(); | |
246 | + t.check_line_selection(true); | |
247 | + t.scroll_to_view(); | |
248 | + | |
249 | + for(var i in t.plugins){ | |
250 | + if(typeof(t.plugins[i].onload)=="function") | |
251 | + t.plugins[i].onload(); | |
252 | + } | |
253 | + if(s['fullscreen']==true) | |
254 | + t.toggle_full_screen(true); | |
255 | + | |
256 | + parent.editAreaLoader.add_event(window, "resize", editArea.update_size); | |
257 | + parent.editAreaLoader.add_event(parent.window, "resize", editArea.update_size); | |
258 | + parent.editAreaLoader.add_event(top.window, "resize", editArea.update_size); | |
259 | + parent.editAreaLoader.add_event(window, "unload", function(){ | |
260 | + // in case where editAreaLoader have been already cleaned | |
261 | + if( parent.editAreaLoader ) | |
262 | + { | |
263 | + parent.editAreaLoader.remove_event(parent.window, "resize", editArea.update_size); | |
264 | + parent.editAreaLoader.remove_event(top.window, "resize", editArea.update_size); | |
265 | + } | |
266 | + if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]){ | |
267 | + editArea.execCommand("EA_unload"); | |
268 | + } | |
269 | + }); | |
270 | + | |
271 | + | |
272 | + /*date= new Date(); | |
273 | + alert(date.getTime()- parent.editAreaLoader.start_time);*/ | |
274 | + }; | |
275 | + | |
276 | + | |
277 | + | |
278 | + //called by the toggle_on | |
279 | + EditArea.prototype.update_size= function(){ | |
280 | + var d=document,pd=parent.document,height,width,popup,maxLeft,maxTop; | |
281 | + | |
282 | + if( typeof editAreas != 'undefined' && editAreas[editArea.id] && editAreas[editArea.id]["displayed"]==true){ | |
283 | + if(editArea.fullscreen['isFull']){ | |
284 | + pd.getElementById("frame_"+editArea.id).style.width = pd.getElementsByTagName("html")[0].clientWidth + "px"; | |
285 | + pd.getElementById("frame_"+editArea.id).style.height = pd.getElementsByTagName("html")[0].clientHeight + "px"; | |
286 | + } | |
287 | + | |
288 | + if(editArea.tab_browsing_area.style.display=='block' && ( !editArea.isIE || editArea.isIE >= 8 ) ) | |
289 | + { | |
290 | + editArea.tab_browsing_area.style.height = "0px"; | |
291 | + editArea.tab_browsing_area.style.height = (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px"; | |
292 | + } | |
293 | + | |
294 | + height = d.body.offsetHeight - editArea.get_all_toolbar_height() - 4; | |
295 | + editArea.result.style.height = height +"px"; | |
296 | + | |
297 | + width = d.body.offsetWidth -2; | |
298 | + editArea.result.style.width = width+"px"; | |
299 | + //alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight); | |
300 | + | |
301 | + // check that the popups don't get out of the screen | |
302 | + for( i=0; i < editArea.inlinePopup.length; i++ ) | |
303 | + { | |
304 | + popup = _$(editArea.inlinePopup[i]["popup_id"]); | |
305 | + maxLeft = d.body.offsetWidth - popup.offsetWidth; | |
306 | + maxTop = d.body.offsetHeight - popup.offsetHeight; | |
307 | + if( popup.offsetTop > maxTop ) | |
308 | + popup.style.top = maxTop+"px"; | |
309 | + if( popup.offsetLeft > maxLeft ) | |
310 | + popup.style.left = maxLeft+"px"; | |
311 | + } | |
312 | + | |
313 | + editArea.manage_size( true ); | |
314 | + editArea.fixLinesHeight( editArea.textarea.value, 0,-1); | |
315 | + } | |
316 | + }; | |
317 | + | |
318 | + | |
319 | + EditArea.prototype.manage_size= function(onlyOneTime){ | |
320 | + if(!editAreas[this.id]) | |
321 | + return false; | |
322 | + | |
323 | + if(editAreas[this.id]["displayed"]==true && this.textareaFocused) | |
324 | + { | |
325 | + var area_height,resized= false; | |
326 | + | |
327 | + //1) Manage display width | |
328 | + //1.1) Calc the new width to use for display | |
329 | + if( !this.settings['word_wrap'] ) | |
330 | + { | |
331 | + var area_width= this.textarea.scrollWidth; | |
332 | + area_height= this.textarea.scrollHeight; | |
333 | + // bug on old opera versions | |
334 | + if(this.isOpera && this.isOpera < 9.6 ){ | |
335 | + area_width=10000; | |
336 | + } | |
337 | + //1.2) the width is not the same, we must resize elements | |
338 | + if(this.textarea.previous_scrollWidth!=area_width) | |
339 | + { | |
340 | + this.container.style.width= area_width+"px"; | |
341 | + this.textarea.style.width= area_width+"px"; | |
342 | + this.content_highlight.style.width= area_width+"px"; | |
343 | + this.textarea.previous_scrollWidth=area_width; | |
344 | + resized=true; | |
345 | + } | |
346 | + } | |
347 | + // manage wrap width | |
348 | + if( this.settings['word_wrap'] ) | |
349 | + { | |
350 | + newW=this.textarea.offsetWidth; | |
351 | + if( this.isFirefox || this.isIE ) | |
352 | + newW-=2; | |
353 | + if( this.isSafari ) | |
354 | + newW-=6; | |
355 | + this.content_highlight.style.width=this.selection_field_text.style.width=this.selection_field.style.width=this.test_font_size.style.width=newW+"px"; | |
356 | + } | |
357 | + | |
358 | + //2) Manage display height | |
359 | + //2.1) Calc the new height to use for display | |
360 | + if( this.isOpera || this.isFirefox || this.isSafari ) { | |
361 | + area_height= this.getLinePosTop( this.last_selection["nb_line"] + 1 ); | |
362 | + } else { | |
363 | + area_height = this.textarea.scrollHeight; | |
364 | + } | |
365 | + //2.2) the width is not the same, we must resize elements | |
366 | + if(this.textarea.previous_scrollHeight!=area_height) | |
367 | + { | |
368 | + this.container.style.height= (area_height+2)+"px"; | |
369 | + this.textarea.style.height= area_height+"px"; | |
370 | + this.content_highlight.style.height= area_height+"px"; | |
371 | + this.textarea.previous_scrollHeight= area_height; | |
372 | + resized=true; | |
373 | + } | |
374 | + | |
375 | + //3) if there is new lines, we add new line numbers in the line numeration area | |
376 | + if(this.last_selection["nb_line"] >= this.line_number) | |
377 | + { | |
378 | + var newLines= '', destDiv=_$("line_number"), start=this.line_number, end=this.last_selection["nb_line"]+100; | |
379 | + for( i = start+1; i < end; i++ ) | |
380 | + { | |
381 | + newLines+='<div id="line_'+ i +'">'+i+"</div>"; | |
382 | + this.line_number++; | |
383 | + } | |
384 | + destDiv.innerHTML= destDiv.innerHTML + newLines; | |
385 | + if(this.settings['word_wrap']){ | |
386 | + this.fixLinesHeight( this.textarea.value, start, -1 ); | |
387 | + } | |
388 | + } | |
389 | + | |
390 | + //4) be sure the text is well displayed | |
391 | + this.textarea.scrollTop="0px"; | |
392 | + this.textarea.scrollLeft="0px"; | |
393 | + if(resized==true){ | |
394 | + this.scroll_to_view(); | |
395 | + } | |
396 | + } | |
397 | + | |
398 | + if(!onlyOneTime) | |
399 | + setTimeout("editArea.manage_size();", 100); | |
400 | + }; | |
401 | + | |
402 | + EditArea.prototype.execCommand= function(cmd, param){ | |
403 | + | |
404 | + for(var i in this.plugins){ | |
405 | + if(typeof(this.plugins[i].execCommand)=="function"){ | |
406 | + if(!this.plugins[i].execCommand(cmd, param)) | |
407 | + return; | |
408 | + } | |
409 | + } | |
410 | + switch(cmd){ | |
411 | + case "save": | |
412 | + if(this.settings["save_callback"].length>0) | |
413 | + eval("parent."+this.settings["save_callback"]+"('"+ this.id +"', editArea.textarea.value);"); | |
414 | + break; | |
415 | + case "load": | |
416 | + if(this.settings["load_callback"].length>0) | |
417 | + eval("parent."+this.settings["load_callback"]+"('"+ this.id +"');"); | |
418 | + break; | |
419 | + case "onchange": | |
420 | + if(this.settings["change_callback"].length>0) | |
421 | + eval("parent."+this.settings["change_callback"]+"('"+ this.id +"');"); | |
422 | + break; | |
423 | + case "EA_load": | |
424 | + if(this.settings["EA_load_callback"].length>0) | |
425 | + eval("parent."+this.settings["EA_load_callback"]+"('"+ this.id +"');"); | |
426 | + break; | |
427 | + case "EA_unload": | |
428 | + if(this.settings["EA_unload_callback"].length>0) | |
429 | + eval("parent."+this.settings["EA_unload_callback"]+"('"+ this.id +"');"); | |
430 | + break; | |
431 | + case "toggle_on": | |
432 | + if(this.settings["EA_toggle_on_callback"].length>0) | |
433 | + eval("parent."+this.settings["EA_toggle_on_callback"]+"('"+ this.id +"');"); | |
434 | + break; | |
435 | + case "toggle_off": | |
436 | + if(this.settings["EA_toggle_off_callback"].length>0) | |
437 | + eval("parent."+this.settings["EA_toggle_off_callback"]+"('"+ this.id +"');"); | |
438 | + break; | |
439 | + case "re_sync": | |
440 | + if(!this.do_highlight) | |
441 | + break; | |
442 | + case "file_switch_on": | |
443 | + if(this.settings["EA_file_switch_on_callback"].length>0) | |
444 | + eval("parent."+this.settings["EA_file_switch_on_callback"]+"(param);"); | |
445 | + break; | |
446 | + case "file_switch_off": | |
447 | + if(this.settings["EA_file_switch_off_callback"].length>0) | |
448 | + eval("parent."+this.settings["EA_file_switch_off_callback"]+"(param);"); | |
449 | + break; | |
450 | + case "file_close": | |
451 | + if(this.settings["EA_file_close_callback"].length>0) | |
452 | + return eval("parent."+this.settings["EA_file_close_callback"]+"(param);"); | |
453 | + break; | |
454 | + | |
455 | + default: | |
456 | + if(typeof(eval("editArea."+cmd))=="function") | |
457 | + { | |
458 | + if(this.settings["debug"]) | |
459 | + eval("editArea."+ cmd +"(param);"); | |
460 | + else | |
461 | + try{eval("editArea."+ cmd +"(param);");}catch(e){}; | |
462 | + } | |
463 | + } | |
464 | + }; | |
465 | + | |
466 | + EditArea.prototype.get_translation= function(word, mode){ | |
467 | + if(mode=="template") | |
468 | + return parent.editAreaLoader.translate(word, this.settings["language"], mode); | |
469 | + else | |
470 | + return parent.editAreaLoader.get_word_translation(word, this.settings["language"]); | |
471 | + }; | |
472 | + | |
473 | + EditArea.prototype.add_plugin= function(plug_name, plug_obj){ | |
474 | + for(var i=0; i<this.settings["plugins"].length; i++){ | |
475 | + if(this.settings["plugins"][i]==plug_name){ | |
476 | + this.plugins[plug_name]=plug_obj; | |
477 | + plug_obj.baseURL=parent.editAreaLoader.baseURL + "plugins/" + plug_name + "/"; | |
478 | + if( typeof(plug_obj.init)=="function" ) | |
479 | + plug_obj.init(); | |
480 | + } | |
481 | + } | |
482 | + }; | |
483 | + | |
484 | + EditArea.prototype.load_css= function(url){ | |
485 | + try{ | |
486 | + link = document.createElement("link"); | |
487 | + link.type = "text/css"; | |
488 | + link.rel= "stylesheet"; | |
489 | + link.media="all"; | |
490 | + link.href = url; | |
491 | + head = document.getElementsByTagName("head"); | |
492 | + head[0].appendChild(link); | |
493 | + }catch(e){ | |
494 | + document.write("<link href='"+ url +"' rel='stylesheet' type='text/css' />"); | |
495 | + } | |
496 | + }; | |
497 | + | |
498 | + EditArea.prototype.load_script= function(url){ | |
499 | + try{ | |
500 | + script = document.createElement("script"); | |
501 | + script.type = "text/javascript"; | |
502 | + script.src = url; | |
503 | + script.charset= "UTF-8"; | |
504 | + head = document.getElementsByTagName("head"); | |
505 | + head[0].appendChild(script); | |
506 | + }catch(e){ | |
507 | + document.write("<script type='text/javascript' src='" + url + "' charset=\"UTF-8\"><"+"/script>"); | |
508 | + } | |
509 | + }; | |
510 | + | |
511 | + // add plugin translation to language translation array | |
512 | + EditArea.prototype.add_lang= function(language, values){ | |
513 | + if(!parent.editAreaLoader.lang[language]) | |
514 | + parent.editAreaLoader.lang[language]={}; | |
515 | + for(var i in values) | |
516 | + parent.editAreaLoader.lang[language][i]= values[i]; | |
517 | + }; | |
518 | + | |
519 | + // short cut for document.getElementById() | |
520 | + function _$(id){return document.getElementById( id );}; | |
521 | + | |
522 | + var editArea = new EditArea(); | |
523 | + parent.editAreaLoader.add_event(window, "load", init); | |
524 | + | |
525 | + function init(){ | |
526 | + setTimeout("editArea.init(); ", 10); | |
527 | + }; | ... | ... |
docs/js/editarea_0_8_2/edit_area/edit_area_compressor.php
0 → 100644
1 | +<?php | |
2 | + /****** | |
3 | + * | |
4 | + * EditArea PHP compressor | |
5 | + * Developped by Christophe Dolivet | |
6 | + * Released under LGPL, Apache and BSD licenses | |
7 | + * v1.1.3 (2007/01/18) | |
8 | + * | |
9 | + ******/ | |
10 | + | |
11 | + // CONFIG | |
12 | + $param['cache_duration']= 3600 * 24 * 10; // 10 days util client cache expires | |
13 | + $param['compress'] = true; // enable the code compression, should be activated but it can be usefull to desactivate it for easier error retrieving (true or false) | |
14 | + $param['debug'] = false; // Enable this option if you need debuging info | |
15 | + $param['use_disk_cache']= true; // If you enable this option gzip files will be cached on disk. | |
16 | + $param['use_gzip']= true; // Enable gzip compression | |
17 | + // END CONFIG | |
18 | + | |
19 | + $compressor= new Compressor($param); | |
20 | + | |
21 | + class Compressor{ | |
22 | + | |
23 | + | |
24 | + function compressor($param) | |
25 | + { | |
26 | + $this->__construct($param); | |
27 | + } | |
28 | + | |
29 | + function __construct($param) | |
30 | + { | |
31 | + $this->start_time= $this->get_microtime(); | |
32 | + $this->file_loaded_size=0; | |
33 | + $this->param= $param; | |
34 | + $this->script_list=""; | |
35 | + $this->path= dirname(__FILE__)."/"; | |
36 | + if(isset($_GET['plugins'])){ | |
37 | + $this->load_all_plugins= true; | |
38 | + $this->full_cache_file= $this->path."edit_area_full_with_plugins.js"; | |
39 | + $this->gzip_cache_file= $this->path."edit_area_full_with_plugins.gz"; | |
40 | + }else{ | |
41 | + $this->load_all_plugins= false; | |
42 | + $this->full_cache_file= $this->path."edit_area_full.js"; | |
43 | + $this->gzip_cache_file= $this->path."edit_area_full.gz"; | |
44 | + } | |
45 | + | |
46 | + $this->check_gzip_use(); | |
47 | + $this->send_headers(); | |
48 | + $this->check_cache(); | |
49 | + $this->load_files(); | |
50 | + $this->send_datas(); | |
51 | + } | |
52 | + | |
53 | + function send_headers() | |
54 | + { | |
55 | + header("Content-type: text/javascript; charset: UTF-8"); | |
56 | + header("Vary: Accept-Encoding"); // Handle proxies | |
57 | + header(sprintf("Expires: %s GMT", gmdate("D, d M Y H:i:s", time() + $this->param['cache_duration'])) ); | |
58 | + if($this->use_gzip) | |
59 | + header("Content-Encoding: ".$this->gzip_enc_header); | |
60 | + } | |
61 | + | |
62 | + function check_gzip_use() | |
63 | + { | |
64 | + $encodings = array(); | |
65 | + $desactivate_gzip=false; | |
66 | + | |
67 | + if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) | |
68 | + $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); | |
69 | + | |
70 | + // desactivate gzip for IE version < 7 | |
71 | + if(preg_match("/(?:msie )([0-9.]+)/i", $_SERVER['HTTP_USER_AGENT'], $ie)) | |
72 | + { | |
73 | + if($ie[1]<7) | |
74 | + $desactivate_gzip=true; | |
75 | + } | |
76 | + | |
77 | + // Check for gzip header or northon internet securities | |
78 | + if (!$desactivate_gzip && $this->param['use_gzip'] && (in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) { | |
79 | + $this->gzip_enc_header= in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; | |
80 | + $this->use_gzip=true; | |
81 | + $this->cache_file=$this->gzip_cache_file; | |
82 | + }else{ | |
83 | + $this->use_gzip=false; | |
84 | + $this->cache_file=$this->full_cache_file; | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + function check_cache() | |
89 | + { | |
90 | + // Only gzip the contents if clients and server support it | |
91 | + if (file_exists($this->cache_file)) { | |
92 | + // check if cache file must be updated | |
93 | + $cache_date=0; | |
94 | + if ($dir = opendir($this->path)) { | |
95 | + while (($file = readdir($dir)) !== false) { | |
96 | + if(is_file($this->path.$file) && $file!="." && $file!="..") | |
97 | + $cache_date= max($cache_date, filemtime($this->path.$file)); | |
98 | + } | |
99 | + closedir($dir); | |
100 | + } | |
101 | + if($this->load_all_plugins){ | |
102 | + $plug_path= $this->path."plugins/"; | |
103 | + if (($dir = @opendir($plug_path)) !== false) | |
104 | + { | |
105 | + while (($file = readdir($dir)) !== false) | |
106 | + { | |
107 | + if ($file !== "." && $file !== "..") | |
108 | + { | |
109 | + if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js")) | |
110 | + $cache_date= max($cache_date, filemtime("plugins/".$file."/".$file.".js")); | |
111 | + } | |
112 | + } | |
113 | + closedir($dir); | |
114 | + } | |
115 | + } | |
116 | + | |
117 | + if(filemtime($this->cache_file) >= $cache_date){ | |
118 | + // if cache file is up to date | |
119 | + $last_modified = gmdate("D, d M Y H:i:s",filemtime($this->cache_file))." GMT"; | |
120 | + if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && strcasecmp($_SERVER["HTTP_IF_MODIFIED_SINCE"], $last_modified) === 0) | |
121 | + { | |
122 | + header("HTTP/1.1 304 Not Modified"); | |
123 | + header("Last-modified: ".$last_modified); | |
124 | + header("Cache-Control: Public"); // Tells HTTP 1.1 clients to cache | |
125 | + header("Pragma:"); // Tells HTTP 1.0 clients to cache | |
126 | + } | |
127 | + else | |
128 | + { | |
129 | + header("Last-modified: ".$last_modified); | |
130 | + header("Cache-Control: Public"); // Tells HTTP 1.1 clients to cache | |
131 | + header("Pragma:"); // Tells HTTP 1.0 clients to cache | |
132 | + header('Content-Length: '.filesize($this->cache_file)); | |
133 | + echo file_get_contents($this->cache_file); | |
134 | + } | |
135 | + die; | |
136 | + } | |
137 | + } | |
138 | + return false; | |
139 | + } | |
140 | + | |
141 | + function load_files() | |
142 | + { | |
143 | + $loader= $this->get_content("edit_area_loader.js")."\n"; | |
144 | + | |
145 | + // get the list of other files to load | |
146 | + $loader= preg_replace("/(t\.scripts_to_load=\s*)\[([^\]]*)\];/e" | |
147 | + , "\$this->replace_scripts('script_list', '\\1', '\\2')" | |
148 | + , $loader); | |
149 | + | |
150 | + $loader= preg_replace("/(t\.sub_scripts_to_load=\s*)\[([^\]]*)\];/e" | |
151 | + , "\$this->replace_scripts('sub_script_list', '\\1', '\\2')" | |
152 | + , $loader); | |
153 | + | |
154 | + // replace languages names | |
155 | + $reg_path= $this->path."reg_syntax/"; | |
156 | + $a_displayName = array(); | |
157 | + if (($dir = @opendir($reg_path)) !== false) | |
158 | + { | |
159 | + while (($file = readdir($dir)) !== false) | |
160 | + { | |
161 | + if( $file !== "." && $file !== ".." && ( $pos = strpos( $file, '.js' ) ) !== false ) | |
162 | + { | |
163 | + $jsContent = $this->file_get_contents( $reg_path.$file ); | |
164 | + if( preg_match( '@(\'|")DISPLAY_NAME\1\s*:\s*(\'|")(.*)\2@', $jsContent, $match ) ) | |
165 | + { | |
166 | + $a_displayName[] = "'". substr( $file, 0, $pos ) ."':'". htmlspecialchars( $match[3], ENT_QUOTES ) ."'"; | |
167 | + } | |
168 | + } | |
169 | + } | |
170 | + closedir($dir); | |
171 | + } | |
172 | + $loader = str_replace( '/*syntax_display_name_AUTO-FILL-BY-COMPRESSOR*/', implode( ",", $a_displayName ), $loader ); | |
173 | + | |
174 | + $this->datas= $loader; | |
175 | + $this->compress_javascript($this->datas); | |
176 | + | |
177 | + // load other scripts needed for the loader | |
178 | + preg_match_all('/"([^"]*)"/', $this->script_list, $match); | |
179 | + foreach($match[1] as $key => $value) | |
180 | + { | |
181 | + $content= $this->get_content(preg_replace("/\\|\//i", "", $value).".js"); | |
182 | + $this->compress_javascript($content); | |
183 | + $this->datas.= $content."\n"; | |
184 | + } | |
185 | + //$this->datas); | |
186 | + //$this->datas= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', "", $this->datas); | |
187 | + | |
188 | + // improved compression step 1/2 | |
189 | + $this->datas= preg_replace(array("/(\b)EditAreaLoader(\b)/", "/(\b)editAreaLoader(\b)/", "/(\b)editAreas(\b)/"), array("EAL", "eAL", "eAs"), $this->datas); | |
190 | + //$this->datas= str_replace(array("EditAreaLoader", "editAreaLoader", "editAreas"), array("EAL", "eAL", "eAs"), $this->datas); | |
191 | + $this->datas.= "var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;"; | |
192 | + | |
193 | + // load sub scripts | |
194 | + $sub_scripts=""; | |
195 | + $sub_scripts_list= array(); | |
196 | + preg_match_all('/"([^"]*)"/', $this->sub_script_list, $match); | |
197 | + foreach($match[1] as $value){ | |
198 | + $sub_scripts_list[]= preg_replace("/\\|\//i", "", $value).".js"; | |
199 | + } | |
200 | + | |
201 | + if($this->load_all_plugins){ | |
202 | + // load plugins scripts | |
203 | + $plug_path= $this->path."plugins/"; | |
204 | + if (($dir = @opendir($plug_path)) !== false) | |
205 | + { | |
206 | + while (($file = readdir($dir)) !== false) | |
207 | + { | |
208 | + if ($file !== "." && $file !== "..") | |
209 | + { | |
210 | + if(is_dir($plug_path.$file) && file_exists($plug_path.$file."/".$file.".js")) | |
211 | + $sub_scripts_list[]= "plugins/".$file."/".$file.".js"; | |
212 | + } | |
213 | + } | |
214 | + closedir($dir); | |
215 | + } | |
216 | + } | |
217 | + | |
218 | + foreach($sub_scripts_list as $value){ | |
219 | + $sub_scripts.= $this->get_javascript_content($value); | |
220 | + } | |
221 | + // improved compression step 2/2 | |
222 | + $sub_scripts= preg_replace(array("/(\b)editAreaLoader(\b)/", "/(\b)editAreas(\b)/", "/(\b)editArea(\b)/", "/(\b)EditArea(\b)/"), array("eAL", "eAs", "eA", "EA"), $sub_scripts); | |
223 | + // $sub_scripts= str_replace(array("editAreaLoader", "editAreas", "editArea", "EditArea"), array("eAL", "eAs", "eA", "EA"), $sub_scripts); | |
224 | + $sub_scripts.= "var editArea= eA;EditArea=EA;"; | |
225 | + | |
226 | + | |
227 | + // add the scripts | |
228 | + // $this->datas.= sprintf("editAreaLoader.iframe_script= \"<script type='text/javascript'>%s</script>\";\n", $sub_scripts); | |
229 | + | |
230 | + | |
231 | + // add the script and use a last compression | |
232 | + if( $this->param['compress'] ) | |
233 | + { | |
234 | + $last_comp = array( 'Á' => 'this', | |
235 | + 'Â' => 'textarea', | |
236 | + 'Ã' => 'function', | |
237 | + 'Ä' => 'prototype', | |
238 | + 'Å' => 'settings', | |
239 | + 'Æ' => 'length', | |
240 | + 'Ç' => 'style', | |
241 | + 'È' => 'parent', | |
242 | + 'É' => 'last_selection', | |
243 | + 'Ê' => 'value', | |
244 | + 'Ë' => 'true', | |
245 | + 'Ì' => 'false' | |
246 | + /*, | |
247 | + 'Î' => '"', | |
248 | + 'Ï' => "\n", | |
249 | + 'À' => "\r"*/); | |
250 | + } | |
251 | + else | |
252 | + { | |
253 | + $last_comp = array(); | |
254 | + } | |
255 | + | |
256 | + $js_replace= ''; | |
257 | + foreach( $last_comp as $key => $val ) | |
258 | + $js_replace .= ".replace(/". $key ."/g,'". str_replace( array("\n", "\r"), array('\n','\r'), $val ) ."')"; | |
259 | + | |
260 | + $this->datas.= sprintf("editAreaLoader.iframe_script= \"<script type='text/javascript'>%s</script>\"%s;\n", | |
261 | + str_replace( array_values($last_comp), array_keys($last_comp), $sub_scripts ), | |
262 | + $js_replace); | |
263 | + | |
264 | + if($this->load_all_plugins) | |
265 | + $this->datas.="editAreaLoader.all_plugins_loaded=true;\n"; | |
266 | + | |
267 | + | |
268 | + // load the template | |
269 | + $this->datas.= sprintf("editAreaLoader.template= \"%s\";\n", $this->get_html_content("template.html")); | |
270 | + // load the css | |
271 | + $this->datas.= sprintf("editAreaLoader.iframe_css= \"<style>%s</style>\";\n", $this->get_css_content("edit_area.css")); | |
272 | + | |
273 | + // $this->datas= "function editArea(){};editArea.prototype.loader= function(){alert('bouhbouh');} var a= new editArea();a.loader();"; | |
274 | + | |
275 | + } | |
276 | + | |
277 | + function send_datas() | |
278 | + { | |
279 | + if($this->param['debug']){ | |
280 | + $header=sprintf("/* USE PHP COMPRESSION\n"); | |
281 | + $header.=sprintf("javascript size: based files: %s => PHP COMPRESSION => %s ", $this->file_loaded_size, strlen($this->datas)); | |
282 | + if($this->use_gzip){ | |
283 | + $gzip_datas= gzencode($this->datas, 9, FORCE_GZIP); | |
284 | + $header.=sprintf("=> GZIP COMPRESSION => %s", strlen($gzip_datas)); | |
285 | + $ratio = round(100 - strlen($gzip_datas) / $this->file_loaded_size * 100.0); | |
286 | + }else{ | |
287 | + $ratio = round(100 - strlen($this->datas) / $this->file_loaded_size * 100.0); | |
288 | + } | |
289 | + $header.=sprintf(", reduced by %s%%\n", $ratio); | |
290 | + $header.=sprintf("compression time: %s\n", $this->get_microtime()-$this->start_time); | |
291 | + $header.=sprintf("%s\n", implode("\n", $this->infos)); | |
292 | + $header.=sprintf("*/\n"); | |
293 | + $this->datas= $header.$this->datas; | |
294 | + } | |
295 | + $mtime= time(); // ensure that the 2 disk files will have the same update time | |
296 | + // generate gzip file and cahce it if using disk cache | |
297 | + if($this->use_gzip){ | |
298 | + $this->gzip_datas= gzencode($this->datas, 9, FORCE_GZIP); | |
299 | + if($this->param['use_disk_cache']) | |
300 | + $this->file_put_contents($this->gzip_cache_file, $this->gzip_datas, $mtime); | |
301 | + } | |
302 | + | |
303 | + // generate full js file and cache it if using disk cache | |
304 | + if($this->param['use_disk_cache']) | |
305 | + $this->file_put_contents($this->full_cache_file, $this->datas, $mtime); | |
306 | + | |
307 | + // generate output | |
308 | + if($this->use_gzip) | |
309 | + echo $this->gzip_datas; | |
310 | + else | |
311 | + echo $this->datas; | |
312 | + | |
313 | +// die; | |
314 | + } | |
315 | + | |
316 | + | |
317 | + function get_content($end_uri) | |
318 | + { | |
319 | + $end_uri=preg_replace("/\.\./", "", $end_uri); // Remove any .. (security) | |
320 | + $file= $this->path.$end_uri; | |
321 | + if(file_exists($file)){ | |
322 | + $this->infos[]=sprintf("'%s' loaded", $end_uri); | |
323 | + /*$fd = fopen($file, 'rb'); | |
324 | + $content = fread($fd, filesize($file)); | |
325 | + fclose($fd); | |
326 | + return $content;*/ | |
327 | + return $this->file_get_contents($file); | |
328 | + }else{ | |
329 | + $this->infos[]=sprintf("'%s' not loaded", $end_uri); | |
330 | + return ""; | |
331 | + } | |
332 | + } | |
333 | + | |
334 | + function get_javascript_content($end_uri) | |
335 | + { | |
336 | + $val=$this->get_content($end_uri); | |
337 | + | |
338 | + $this->compress_javascript($val); | |
339 | + $this->prepare_string_for_quotes($val); | |
340 | + return $val; | |
341 | + } | |
342 | + | |
343 | + function compress_javascript(&$code) | |
344 | + { | |
345 | + if($this->param['compress']) | |
346 | + { | |
347 | + // remove all comments | |
348 | + // (\"(?:[^\"\\]*(?:\\\\)*(?:\\\"?)?)*(?:\"|$))|(\'(?:[^\'\\]*(?:\\\\)*(?:\\'?)?)*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$)) | |
349 | + $code= preg_replace("/(\"(?:[^\"\\\\]*(?:\\\\\\\\)*(?:\\\\\"?)?)*(?:\"|$))|(\'(?:[^\'\\\\]*(?:\\\\\\\\)*(?:\\\\\'?)?)*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "$1$2$3", $code); | |
350 | + // remove line return, empty line and tabulation | |
351 | + $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', " ", $code); | |
352 | + // add line break before "else" otherwise navigators can't manage to parse the file | |
353 | + $code= preg_replace('/(\b(else)\b)/', "\n$1", $code); | |
354 | + // remove unnecessary spaces | |
355 | + $code= preg_replace('/( |\t|\r)*(;|\{|\}|=|==|\-|\+|,|\(|\)|\|\||&\&|\:)( |\t|\r)*/', "$2", $code); | |
356 | + } | |
357 | + } | |
358 | + | |
359 | + function get_css_content($end_uri){ | |
360 | + $code=$this->get_content($end_uri); | |
361 | + // remove comments | |
362 | + $code= preg_replace("/(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "", $code); | |
363 | + // remove spaces | |
364 | + $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', "", $code); | |
365 | + // remove spaces | |
366 | + $code= preg_replace('/( |\t|\r)?(\:|,|\{|\})( |\t|\r)+/', "$2", $code); | |
367 | + | |
368 | + $this->prepare_string_for_quotes($code); | |
369 | + return $code; | |
370 | + } | |
371 | + | |
372 | + function get_html_content($end_uri){ | |
373 | + $code=$this->get_content($end_uri); | |
374 | + //$code= preg_replace('/(\"(?:\\\"|[^\"])*(?:\"|$))|' . "(\'(?:\\\'|[^\'])*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "$1$2$3", $code); | |
375 | + $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', " ", $code); | |
376 | + $this->prepare_string_for_quotes($code); | |
377 | + return $code; | |
378 | + } | |
379 | + | |
380 | + function prepare_string_for_quotes(&$str){ | |
381 | + // prepare the code to be putted into quotes | |
382 | + /*$pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/"); | |
383 | + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\\\n"$1+"');*/ | |
384 | + $pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/"); | |
385 | + if($this->param['compress']) | |
386 | + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\n'); | |
387 | + else | |
388 | + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , "\\n\"\n+\""); | |
389 | + $str= preg_replace($pattern, $replace, $str); | |
390 | + } | |
391 | + | |
392 | + function replace_scripts($var, $param1, $param2) | |
393 | + { | |
394 | + $this->$var=stripslashes($param2); | |
395 | + return $param1."[];"; | |
396 | + } | |
397 | + | |
398 | + /* for php version that have not thoses functions */ | |
399 | + function file_get_contents($file) | |
400 | + { | |
401 | + $fd = fopen($file, 'rb'); | |
402 | + $content = fread($fd, filesize($file)); | |
403 | + fclose($fd); | |
404 | + $this->file_loaded_size+= strlen($content); | |
405 | + return $content; | |
406 | + } | |
407 | + | |
408 | + function file_put_contents($file, &$content, $mtime=-1) | |
409 | + { | |
410 | + if($mtime==-1) | |
411 | + $mtime=time(); | |
412 | + $fp = @fopen($file, "wb"); | |
413 | + if ($fp) { | |
414 | + fwrite($fp, $content); | |
415 | + fclose($fp); | |
416 | + touch($file, $mtime); | |
417 | + return true; | |
418 | + } | |
419 | + return false; | |
420 | + } | |
421 | + | |
422 | + function get_microtime() | |
423 | + { | |
424 | + list($usec, $sec) = explode(" ", microtime()); | |
425 | + return ((float)$usec + (float)$sec); | |
426 | + } | |
427 | + } | |
428 | +?> | ... | ... |
docs/js/editarea_0_8_2/edit_area/edit_area_full.gz
0 → 100644
No preview for this file type
docs/js/editarea_0_8_2/edit_area/edit_area_full.js
0 → 100644
1 | + function EAL(){var t=this;t.version="0.8.2";date=new Date();t.start_time=date.getTime();t.win="loading";t.error=false;t.baseURL="";t.template="";t.lang={};t.load_syntax={};t.syntax={};t.loadedFiles=[];t.waiting_loading={};t.scripts_to_load=[];t.sub_scripts_to_load=[];t.syntax_display_name={'basic':'Basic','brainfuck':'Brainfuck','c':'C','coldfusion':'Coldfusion','cpp':'CPP','css':'CSS','html':'HTML','java':'Java','js':'Javascript','pas':'Pascal','perl':'Perl','php':'Php','python':'Python','robotstxt':'Robots txt','ruby':'Ruby','sql':'SQL','tsql':'T-SQL','vb':'Visual Basic','xml':'XML'};t.resize=[];t.hidden={};t.default_settings={debug:false,smooth_selection:true,font_size:"10",font_family:"monospace",start_highlight:false,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,word_wrap,|,help",begin_toolbar:"",end_toolbar:"",is_multi_files:false,allow_resize:"both",show_line_colors:false,min_width:400,min_height:125,replace_tab_by_spaces:false,allow_toggle:true,language:"en",syntax:"",syntax_selection_allow:"basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml",display:"onload",max_undo:30,browsers:"known",plugins:"",gecko_spellcheck:false,fullscreen:false,is_editable:true,cursor_position:"begin",word_wrap:false,autocompletion:false,load_callback:"",save_callback:"",change_callback:"",submit_callback:"",EA_init_callback:"",EA_delete_callback:"",EA_load_callback:"",EA_unload_callback:"",EA_toggle_on_callback:"",EA_toggle_off_callback:"",EA_file_switch_on_callback:"",EA_file_switch_off_callback:"",EA_file_close_callback:""};t.advanced_buttons=[ ['new_document','newdocument.gif','new_document',false],['search','search.gif','show_search',false],['go_to_line','go_to_line.gif','go_to_line',false],['undo','undo.gif','undo',true],['redo','redo.gif','redo',true],['change_smooth_selection','smooth_selection.gif','change_smooth_selection_mode',true],['reset_highlight','reset_highlight.gif','resync_highlight',true],['highlight','highlight.gif','change_highlight',true],['help','help.gif','show_help',false],['save','save.gif','save',false],['load','load.gif','load',false],['fullscreen','fullscreen.gif','toggle_full_screen',false],['word_wrap','word_wrap.gif','toggle_word_wrap',true],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];t.set_browser_infos(t);if(t.isIE>=6||t.isGecko||(t.isWebKit&&!t.isSafari<3)||t.isOpera>=9||t.isCamino)t.isValidBrowser=true; | |
2 | +else t.isValidBrowser=false;t.set_base_url();for(var i=0;i<t.scripts_to_load.length;i++){setTimeout("eAL.load_script('"+t.baseURL+t.scripts_to_load[i]+".js');",1);t.waiting_loading[t.scripts_to_load[i]+".js"]=false;}t.add_event(window,"load",EAL.prototype.window_loaded);};EAL.prototype={has_error:function(){this.error=true;for(var i in EAL.prototype){EAL.prototype[i]=function(){};}},set_browser_infos:function(o){ua=navigator.userAgent;o.isWebKit=/WebKit/.test(ua);o.isGecko=!o.isWebKit&&/Gecko/.test(ua);o.isMac=/Mac/.test(ua);o.isIE=(navigator.appName=="Microsoft Internet Explorer");if(o.isIE){o.isIE=ua.replace(/^.*?MSIE\s+([0-9\.]+).*$/,"$1");if(o.isIE<6)o.has_error();}if(o.isOpera=(ua.indexOf('Opera')!=-1)){o.isOpera=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(o.isOpera<9)o.has_error();o.isIE=false;}if(o.isFirefox=(ua.indexOf('Firefox')!=-1))o.isFirefox=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('Iceweasel')!=-1)o.isFirefox=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('GranParadiso')!=-1)o.isFirefox=ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('BonEcho')!=-1)o.isFirefox=ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('SeaMonkey')!=-1)o.isFirefox=(ua.replace(/^.*?SeaMonkey.*?([0-9\.]+).*$/i,"$1"))+1;if(o.isCamino=(ua.indexOf('Camino')!=-1))o.isCamino=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(o.isSafari=(ua.indexOf('Safari')!=-1))o.isSafari=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(o.isChrome=(ua.indexOf('Chrome')!=-1)){o.isChrome=ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i,"$1");o.isSafari=false;}},window_loaded:function(){eAL.win="loaded";if(document.forms){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];form.edit_area_replaced_submit=null;try{form.edit_area_replaced_submit=form.onsubmit;form.onsubmit="";}catch(e){}eAL.add_event(form,"submit",EAL.prototype.submit);eAL.add_event(form,"reset",EAL.prototype.reset);}}eAL.add_event(window,"unload",function(){for(var i in eAs){eAL.delete_instance(i);}});},init_ie_textarea:function(id){var a=document.getElementById(id);try{if(a&&typeof(a.focused)=="undefined"){a.focus();a.focused=true;a.selectionStart=a.selectionEnd=0;get_IE_selection(a);eAL.add_event(a,"focus",IE_textarea_focus);eAL.add_event(a,"blur",IE_textarea_blur);}}catch(ex){}},init:function(settings){var t=this,s=settings,i;if(!s["id"])t.has_error();if(t.error)return;if(eAs[s["id"]])t.delete_instance(s["id"]);for(i in t.default_settings){if(typeof(s[i])=="undefined")s[i]=t.default_settings[i];}if(s["browsers"]=="known"&&t.isValidBrowser==false){return;}if(s["begin_toolbar"].length>0)s["toolbar"]=s["begin_toolbar"]+","+s["toolbar"];if(s["end_toolbar"].length>0)s["toolbar"]=s["toolbar"]+","+s["end_toolbar"];s["tab_toolbar"]=s["toolbar"].replace(/ /g,"").split(",");s["plugins"]=s["plugins"].replace(/ /g,"").split(",");for(i=0;i<s["plugins"].length;i++){if(s["plugins"][i].length==0)s["plugins"].splice(i,1);}t.get_template();t.load_script(t.baseURL+"langs/"+s["language"]+".js");if(s["syntax"].length>0){s["syntax"]=s["syntax"].toLowerCase();t.load_script(t.baseURL+"reg_syntax/"+s["syntax"]+".js");}eAs[s["id"]]={"settings":s};eAs[s["id"]]["displayed"]=false;eAs[s["id"]]["hidden"]=false;t.start(s["id"]);},delete_instance:function(id){var d=document,fs=window.frames,span,iframe;eAL.execCommand(id,"EA_delete");if(fs["frame_"+id]&&fs["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");fs["frame_"+id].editArea.execCommand("EA_unload");}span=d.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);iframe=d.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete fs["frame_"+id];}catch(e){}}delete eAs[id];},start:function(id){var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;if(t.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(i in t.waiting_loading){if(t.waiting_loading[i]!="loaded"&&typeof(t.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!t.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!t.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)t.init_syntax_regexp();if(!d.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){span=d.createElement("span");span.id="EditAreaArroundInfos_"+id;if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked='checked'":"";html+="<div id='edit_area_toggle_"+i+"'>";html+="<input id='edit_area_toggle_checkbox_"+id+"' class='toggle_"+id+"' type='checkbox' onclick='eAL.toggle(\""+id+"\");' accesskey='e' "+checked+" />";html+="<label for='edit_area_toggle_checkbox_"+id+"'>{$toggle}</label></div>";}if(eAs[id]["settings"]["debug"])html+="<textarea id='edit_area_debug_"+id+"' spellcheck='off' style='z-index:20;width:100%;height:120px;overflow:auto;border:solid black 1px;'></textarea><br />";html=t.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;father=d.getElementById(id).parentNode;next=d.getElementById(id).nextSibling;if(next==null)father.appendChild(span); | |
3 | +else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){t.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(t.isIE){t.init_ie_textarea(id);}var area=eAs[id];for(i=0;i<area["settings"]["tab_toolbar"].length;i++){html_toolbar_content+=t.get_control_html(area["settings"]["tab_toolbar"][i],area["settings"]["language"]);}html_toolbar_content=t.translate(html_toolbar_content,area["settings"]["language"],"template");if(!t.iframe_script){t.iframe_script="";for(i=0;i<t.sub_scripts_to_load.length;i++)t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+t.sub_scripts_to_load[i]+'.js"></script>';}for(i=0;i<area["settings"]["plugins"].length;i++){if(!t.all_plugins_loaded)t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/'+area["settings"]["plugins"][i]+'.js"></script>';t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/langs/'+area["settings"]["language"]+'.js"></script>';}if(!t.iframe_css){t.iframe_css="<link href='"+t.baseURL+"edit_area.css' rel='stylesheet' type='text/css' />";}template=t.template.replace(/\[__BASEURL__\]/g,t.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=t.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",t.iframe_css);template=template.replace("[__JSCODE__]",t.iframe_script);template=template.replace("[__EA_VERSION__]",t.version);area.textarea=d.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];father=area.textarea.parentNode;content=d.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";next=area.textarea.nextSibling;if(next==null)father.appendChild(content); | |
4 | +else father.insertBefore(content,next);f=window.frames["frame_"+area["settings"]["id"]];f.document.open();f.eAs=eAs;f.area_id=area["settings"]["id"];f.document.area_id=area["settings"]["id"];f.document.write(template);f.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true&&toggle_to=="off"){this.toggle_off(id);} | |
5 | +else if(eAs[id]["displayed"]==false&&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];if(f.editArea.fullscreen['isFull'])f.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;t.wrap="off";setAttribute(t,"wrap","off");parNod=t.parentNode;nxtSib=t.nextSibling;parNod.removeChild(t);parNod.insertBefore(t,nxtSib);t.value=f.editArea.textarea.value;selStart=f.editArea.last_selection["selectionStart"];selEnd=f.editArea.last_selection["selectionEnd"];scrollTop=f.document.getElementById("result").scrollTop;scrollLeft=f.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';t.style.display="inline";try{t.focus();}catch(e){};if(this.isIE){t.selectionStart=selStart;t.selectionEnd=selEnd;t.focused=true;set_IE_selection(t);} | |
6 | +else{if(this.isOpera&&this.isOpera < 9.6){t.setSelectionRange(0,0);}try{t.setSelectionRange(selStart,selEnd);}catch(e){};}t.scrollTop=scrollTop;t.scrollLeft=scrollLeft;f.editArea.execCommand("toggle_off");}},toggle_on:function(id){var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];area=f.editArea;area.textarea.value=t.value;curPos=eAs[id]["settings"]["cursor_position"];if(t.use_last==true){selStart=t.last_selectionStart;selEnd=t.last_selectionEnd;scrollTop=t.last_scrollTop;scrollLeft=t.last_scrollLeft;t.use_last=false;} | |
7 | +else if(curPos=="auto"){try{selStart=t.selectionStart;selEnd=t.selectionEnd;scrollTop=t.scrollTop;scrollLeft=t.scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id,document.getElementById("frame_"+id));t.style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");f.document.getElementById("result").scrollTop=scrollTop;f.document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart,selEnd-selStart);area.execCommand("toggle_on");} | |
8 | +else{elem=document.getElementById(id);elem.last_selectionStart=elem.selectionStart;elem.last_selectionEnd=elem.selectionEnd;elem.last_scrollTop=elem.scrollTop;elem.last_scrollLeft=elem.scrollLeft;elem.use_last=true;eAL.start(id);}},set_editarea_size_from_textarea:function(id,frame){var elem,width,height;elem=document.getElementById(id);width=Math.max(eAs[id]["settings"]["min_width"],elem.offsetWidth)+"px";height=Math.max(eAs[id]["settings"]["min_height"],elem.offsetHeight)+"px";if(elem.style.width.indexOf("%")!=-1)width=elem.style.width;if(elem.style.height.indexOf("%")!=-1)height=elem.style.height;frame.style.width=width;frame.style.height=height;},set_base_url:function(){var t=this,elems,i,docBasePath;if(!this.baseURL){elems=document.getElementsByTagName('script');for(i=0;i<elems.length;i++){if(elems[i].src&&elems[i].src.match(/edit_area_[^\\\/]*$/i)){var src=unescape(elems[i].src);src=src.substring(0,src.lastIndexOf('/'));this.baseURL=src;this.file_name=elems[i].src.substr(elems[i].src.lastIndexOf("/")+1);break;}}}docBasePath=document.location.href;if(docBasePath.indexOf('?')!=-1)docBasePath=docBasePath.substring(0,docBasePath.indexOf('?'));docBasePath=docBasePath.substring(0,docBasePath.lastIndexOf('/'));if(t.baseURL.indexOf('://')==-1&&t.baseURL.charAt(0)!='/'){t.baseURL=docBasePath+"/"+t.baseURL;}t.baseURL+="/";},get_button_html:function(id,img,exec,isFileSpecific,baseURL){var cmd,html;if(!baseURL)baseURL=this.baseURL;cmd='editArea.execCommand(\''+exec+'\')';html='<a id="a_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+';return false;" onmousedown="return false;" target="_self" fileSpecific="'+(isFileSpecific?'yes':'no')+'">';html+='<img id="'+id+'" src="'+baseURL+'images/'+img+'" title="{$'+id+'}" width="20" height="20" class="editAreaButtonNormal" onmouseover="editArea.switchClass(this,\'editAreaButtonOver\');" onmouseout="editArea.restoreClass(this);" onmousedown="editArea.restoreAndSwitchClass(this,\'editAreaButtonDown\');" /></a>';return html;},get_control_html:function(button_name,lang){var t=this,i,but,html,si;for(i=0;i<t.advanced_buttons.length;i++){but=t.advanced_buttons[i];if(but[0]==button_name){return t.get_button_html(but[0],but[1],but[2],but[3]);}}switch(button_name){case "*":case "return":return "<br />";case "|":case "separator":return '<img src="'+t.baseURL+'images/spacer.gif" width="1" height="15" class="editAreaSeparatorLine">';case "select_font":html="<select id='area_font_size' onchange='javascript:editArea.execCommand(\"change_font_size\")' fileSpecific='yes'>";html+="<option value='-1'>{$font_size}</option>";si=[8,9,10,11,12,14];for(i=0;i<si.length;i++){html+="<option value='"+si[i]+"'>"+si[i]+" pt</option>";}html+="</select>";return html;case "syntax_selection":html="<select id='syntax_selection' onchange='javascript:editArea.execCommand(\"change_syntax\",this.value)' fileSpecific='yes'>";html+="<option value='-1'>{$syntax_selection}</option>";html+="</select>";return html;}return "<span id='tmp_tool_"+button_name+"'>["+button_name+"]</span>";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); | |
9 | +else if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP"); | |
10 | +else{alert("XMLHTTPRequest not supported. EditArea not loaded");return;}xhr_object.open("GET",this.baseURL+"template.html",false);xhr_object.send(null);if(xhr_object.readyState==4)this.template=xhr_object.responseText; | |
11 | +else this.has_error();}},translate:function(text,lang,mode){if(mode=="word")text=eAL.get_word_translation(text,lang); | |
12 | +else if(mode="template"){eAL.current_language=lang;text=text.replace(/\{\$([^\}]+)\}/gm,eAL.translate_template);}return text;},translate_template:function(){return eAL.get_word_translation(EAL.prototype.translate_template.arguments[1],eAL.current_language);},get_word_translation:function(val,lang){var i;for(i in eAL.lang[lang]){if(i==val)return eAL.lang[lang][i];}return "_"+val;},load_script:function(url){var t=this,d=document,script,head;if(t.loadedFiles[url])return;try{script=d.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";d.getElementsByTagName("head")[0].appendChild(script);}catch(e){d.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'" charset="UTF-8"></sc'+'ript>');}t.loadedFiles[url]=true;},add_event:function(obj,name,handler){try{if(obj.attachEvent){obj.attachEvent("on"+name,handler);} | |
13 | +else{obj.addEventListener(name,handler,false);}}catch(e){}},remove_event:function(obj,name,handler){try{if(obj.detachEvent)obj.detachEvent("on"+name,handler); | |
14 | +else obj.removeEventListener(name,handler,false);}catch(e){}},reset:function(e){var formObj,is_child,i,x;formObj=eAL.isIE ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(i in eAs){is_child=false;for(x=0;x<formObj.elements.length;x++){if(formObj.elements[x].id==i)is_child=true;}if(window.frames["frame_"+i]&&is_child&&eAs[i]["displayed"]==true){var exec='window.frames["frame_'+i+'"].editArea.textarea.value=document.getElementById("'+i+'").value;';exec+='window.frames["frame_'+i+'"].editArea.execCommand("focus");';exec+='window.frames["frame_'+i+'"].editArea.check_line_selection();';exec+='window.frames["frame_'+i+'"].editArea.execCommand("reset");';window.setTimeout(exec,10);}}return;},submit:function(e){var formObj,is_child,fs=window.frames,i,x;formObj=eAL.isIE ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(i in eAs){is_child=false;for(x=0;x<formObj.elements.length;x++){if(formObj.elements[x].id==i)is_child=true;}if(is_child){if(fs["frame_"+i]&&eAs[i]["displayed"]==true)document.getElementById(i).value=fs["frame_"+i].editArea.textarea.value;eAL.execCommand(i,"EA_submit");}}if(typeof(formObj.edit_area_replaced_submit)=="function"){res=formObj.edit_area_replaced_submit();if(res==false){if(eAL.isIE)return false; | |
15 | +else e.preventDefault();}}return;},getValue:function(id){if(window.frames["frame_"+id]&&eAs[id]["displayed"]==true){return window.frames["frame_"+id].editArea.textarea.value;} | |
16 | +else if(elem=document.getElementById(id)){return elem.value;}return false;},setValue:function(id,new_val){var fs=window.frames;if((f=fs["frame_"+id])&&eAs[id]["displayed"]==true){f.editArea.textarea.value=new_val;f.editArea.execCommand("focus");f.editArea.check_line_selection(false);f.editArea.execCommand("onchange");} | |
17 | +else if(elem=document.getElementById(id)){elem.value=new_val;}},getSelectionRange:function(id){var sel,eA,fs=window.frames;sel={"start":0,"end":0};if(fs["frame_"+id]&&eAs[id]["displayed"]==true){eA=fs["frame_"+id].editArea;sel["start"]=eA.textarea.selectionStart;sel["end"]=eA.textarea.selectionEnd;} | |
18 | +else if(elem=document.getElementById(id)){sel=getSelectionRange(elem);}return sel;},setSelectionRange:function(id,new_start,new_end){var fs=window.frames;if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].editArea.area_select(new_start,new_end-new_start);if(!this.isIE){fs["frame_"+id].editArea.check_line_selection(false);fs["frame_"+id].editArea.scroll_to_view();}} | |
19 | +else if(elem=document.getElementById(id)){setSelectionRange(elem,new_start,new_end);}},getSelectedText:function(id){var sel=this.getSelectionRange(id);return this.getValue(id).substring(sel["start"],sel["end"]);},setSelectedText:function(id,new_val){var fs=window.frames,d=document,sel,text,scrollTop,scrollLeft,new_sel_end;new_val=new_val.replace(/\r/g,"");sel=this.getSelectionRange(id);text=this.getValue(id);if(fs["frame_"+id]&&eAs[id]["displayed"]==true){scrollTop=fs["frame_"+id].document.getElementById("result").scrollTop;scrollLeft=fs["frame_"+id].document.getElementById("result").scrollLeft;} | |
20 | +else{scrollTop=d.getElementById(id).scrollTop;scrollLeft=d.getElementById(id).scrollLeft;}text=text.substring(0,sel["start"])+new_val+text.substring(sel["end"]);this.setValue(id,text);new_sel_end=sel["start"]+new_val.length;this.setSelectionRange(id,sel["start"],new_sel_end);if(new_val !=this.getSelectedText(id).replace(/\r/g,"")){this.setSelectionRange(id,sel["start"],new_sel_end+new_val.split("\n").length-1);}if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].document.getElementById("result").scrollTop=scrollTop;fs["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;fs["frame_"+id].editArea.execCommand("onchange");} | |
21 | +else{d.getElementById(id).scrollTop=scrollTop;d.getElementById(id).scrollLeft=scrollLeft;}},insertTags:function(id,open_tag,close_tag){var old_sel,new_sel;old_sel=this.getSelectionRange(id);text=open_tag+this.getSelectedText(id)+close_tag;eAL.setSelectedText(id,text);new_sel=this.getSelectionRange(id);if(old_sel["end"] > old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); | |
22 | +else this.setSelectionRange(id,old_sel["start"]+open_tag.length,old_sel["start"]+open_tag.length);},hide:function(id){var fs=window.frames,d=document,t=this,scrollTop,scrollLeft,span;if(d.getElementById(id)&&!t.hidden[id]){t.hidden[id]={};t.hidden[id]["selectionRange"]=t.getSelectionRange(id);if(d.getElementById(id).style.display!="none"){t.hidden[id]["scrollTop"]=d.getElementById(id).scrollTop;t.hidden[id]["scrollLeft"]=d.getElementById(id).scrollLeft;}if(fs["frame_"+id]){t.hidden[id]["toggle"]=eAs[id]["displayed"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){scrollTop=fs["frame_"+id].document.getElementById("result").scrollTop;scrollLeft=fs["frame_"+id].document.getElementById("result").scrollLeft;} | |
23 | +else{scrollTop=d.getElementById(id).scrollTop;scrollLeft=d.getElementById(id).scrollLeft;}t.hidden[id]["scrollTop"]=scrollTop;t.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true)eAL.toggle_off(id);}span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}d.getElementById(id).style.display="none";}},show:function(id){var fs=window.frames,d=document,t=this,span;if((elem=d.getElementById(id))&&t.hidden[id]){elem.style.display="inline";elem.scrollTop=t.hidden[id]["scrollTop"];elem.scrollLeft=t.hidden[id]["scrollLeft"];span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(fs["frame_"+id]){elem.style.display="inline";if(t.hidden[id]["toggle"]==true)eAL.toggle_on(id);scrollTop=t.hidden[id]["scrollTop"];scrollLeft=t.hidden[id]["scrollLeft"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].document.getElementById("result").scrollTop=scrollTop;fs["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;} | |
24 | +else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=t.hidden[id]["selectionRange"];t.setSelectionRange(id,sel["start"],sel["end"]);delete t.hidden[id];}},getCurrentFile:function(id){return this.execCommand(id,'get_file',this.execCommand(id,'curr_file'));},getFile:function(id,file_id){return this.execCommand(id,'get_file',file_id);},getAllFiles:function(id){return this.execCommand(id,'get_all_files()');},openFile:function(id,file_infos){return this.execCommand(id,'open_file',file_infos);},closeFile:function(id,file_id){return this.execCommand(id,'close_file',file_id);},setFileEditedMode:function(id,file_id,to){var reg1,reg2;reg1=new RegExp('\\\\','g');reg2=new RegExp('"','g');return this.execCommand(id,'set_file_edited_mode("'+file_id.replace(reg1,'\\\\').replace(reg2,'\\"')+'",'+to+')');},execCommand:function(id,cmd,fct_param){switch(cmd){case "EA_init":if(eAs[id]['settings']["EA_init_callback"].length>0)eval(eAs[id]['settings']["EA_init_callback"]+"('"+id+"');");break;case "EA_delete":if(eAs[id]['settings']["EA_delete_callback"].length>0)eval(eAs[id]['settings']["EA_delete_callback"]+"('"+id+"');");break;case "EA_submit":if(eAs[id]['settings']["submit_callback"].length>0)eval(eAs[id]['settings']["submit_callback"]+"('"+id+"');");break;}if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(fct_param!=undefined)return eval('window.frames["frame_'+id+'"].editArea.'+cmd+'(fct_param);'); | |
25 | +else return eval('window.frames["frame_'+id+'"].editArea.'+cmd+';');}return false;}};var eAL=new EAL();var eAs={}; function getAttribute(elm,aName){var aValue,taName,i;try{aValue=elm.getAttribute(aName);}catch(exept){}if(! aValue){for(i=0;i < elm.attributes.length;i++){taName=elm.attributes[i] .name.toLowerCase();if(taName==aName){aValue=elm.attributes[i] .value;return aValue;}}}return aValue;};function setAttribute(elm,attr,val){if(attr=="class"){elm.setAttribute("className",val);elm.setAttribute("class",val);} | |
26 | +else{elm.setAttribute(attr,val);}};function getChildren(elem,elem_type,elem_attribute,elem_attribute_match,option,depth){if(!option)var option="single";if(!depth)var depth=-1;if(elem){var children=elem.childNodes;var result=null;var results=[];for(var x=0;x<children.length;x++){strTagName=new String(children[x].tagName);children_class="?";if(strTagName!="undefined"){child_attribute=getAttribute(children[x],elem_attribute);if((strTagName.toLowerCase()==elem_type.toLowerCase()||elem_type=="")&&(elem_attribute==""||child_attribute==elem_attribute_match)){if(option=="all"){results.push(children[x]);} | |
27 | +else{return children[x];}}if(depth!=0){result=getChildren(children[x],elem_type,elem_attribute,elem_attribute_match,option,depth-1);if(option=="all"){if(result.length>0){results=results.concat(result);}} | |
28 | +else if(result!=null){return result;}}}}if(option=="all")return results;}return null;};function isChildOf(elem,parent){if(elem){if(elem==parent)return true;while(elem.parentNode !='undefined'){return isChildOf(elem.parentNode,parent);}}return false;};function getMouseX(e){if(e!=null&&typeof(e.pageX)!="undefined"){return e.pageX;} | |
29 | +else{return(e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} | |
30 | +else{return(e!=null?e.y:event.y)+document.documentElement.scrollTop;}};function calculeOffsetLeft(r){return calculeOffset(r,"offsetLeft")};function calculeOffsetTop(r){return calculeOffset(r,"offsetTop")};function calculeOffset(element,attr){var offset=0;while(element){offset+=element[attr];element=element.offsetParent}return offset;};function get_css_property(elem,prop){if(document.defaultView){return document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop);} | |
31 | +else if(elem.currentStyle){var prop=prop.replace(/-\D/gi,function(sMatch){return sMatch.charAt(sMatch.length-1).toUpperCase();});return elem.currentStyle[prop];} | |
32 | +else return null;}var _mCE;function start_move_element(e,id,frame){var elem_id=(e.target||e.srcElement).id;if(id)elem_id=id;if(!frame)frame=window;if(frame.event)e=frame.event;_mCE=frame.document.getElementById(elem_id);_mCE.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);_mCE.start_pos_x=mouse_x-(_mCE.style.left.replace("px","")||calculeOffsetLeft(_mCE));_mCE.start_pos_y=mouse_y-(_mCE.style.top.replace("px","")||calculeOffsetTop(_mCE));return false;};function end_move_element(e){_mCE.frame.document.onmousemove="";_mCE.frame.document.onmouseup="";_mCE=null;};function move_element(e){var newTop,newLeft,maxLeft;if(_mCE.frame&&_mCE.frame.event)e=_mCE.frame.event;newTop=getMouseY(e)-_mCE.start_pos_y;newLeft=getMouseX(e)-_mCE.start_pos_x;maxLeft=_mCE.frame.document.body.offsetWidth-_mCE.offsetWidth;max_top=_mCE.frame.document.body.offsetHeight-_mCE.offsetHeight;newTop=Math.min(Math.max(0,newTop),max_top);newLeft=Math.min(Math.max(0,newLeft),maxLeft);_mCE.style.top=newTop+"px";_mCE.style.left=newLeft+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return{"start":textarea.selectionStart,"end":textarea.selectionEnd};};function setSelectionRange(t,start,end){t.focus();start=Math.max(0,Math.min(t.value.length,start));end=Math.max(start,Math.min(t.value.length,end));if(nav.isOpera&&nav.isOpera < 9.6){t.selectionEnd=1;t.selectionStart=0;t.selectionEnd=1;t.selectionStart=0;}t.selectionStart=start;t.selectionEnd=end;if(nav.isIE)set_IE_selection(t);};function get_IE_selection(t){var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab;if(t&&t.focused){if(!t.ea_line_height){div=d.createElement("div");div.style.fontFamily=get_css_property(t,"font-family");div.style.fontSize=get_css_property(t,"font-size");div.style.visibility="hidden";div.innerHTML="0";d.body.appendChild(div);t.ea_line_height=div.offsetHeight;d.body.removeChild(div);}range=d.selection.createRange();try{stored_range=range.duplicate();stored_range.moveToElementText(t);stored_range.setEndPoint('EndToEnd',range);if(stored_range.parentElement()==t){elem=t;scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}relative_top=range.offsetTop-calculeOffsetTop(t)+scrollTop;line_start=Math.round((relative_top / t.ea_line_height)+1);line_nb=Math.round(range.boundingHeight / t.ea_line_height);range_start=stored_range.text.length-range.text.length;tab=t.value.substr(0,range_start).split("\n");range_start+=(line_start-tab.length)*2;t.selectionStart=range_start;range_end=t.selectionStart+range.text.length;tab=t.value.substr(0,range_start+range.text.length).split("\n");range_end+=(line_start+line_nb-1-tab.length)*2;t.selectionEnd=range_end;}}catch(e){}}if(t&&t.id){setTimeout("get_IE_selection(document.getElementById('"+t.id+"'));",50);}};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(t){var nbLineStart,nbLineStart,nbLineEnd,range;if(!window.closed){nbLineStart=t.value.substr(0,t.selectionStart).split("\n").length-1;nbLineEnd=t.value.substr(0,t.selectionEnd).split("\n").length-1;try{range=document.selection.createRange();range.moveToElementText(t);range.setEndPoint('EndToStart',range);range.moveStart('character',t.selectionStart-nbLineStart);range.moveEnd('character',t.selectionEnd-nbLineEnd-(t.selectionStart-nbLineStart));range.select();}catch(e){}}};eAL.waiting_loading["elements_functions.js"]="loaded"; | |
33 | + EAL.prototype.start_resize_area=function(){var d=document,a,div,width,height,father;d.onmouseup=eAL.end_resize_area;d.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);a=eAs[eAL.resize["id"]]["textarea"];div=d.getElementById("edit_area_resize");if(!div){div=d.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}width=a.offsetWidth-2;height=a.offsetHeight-2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";father=a.parentNode;father.insertBefore(div,a);a.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){var d=document,div,a,width,height;d.onmouseup="";d.onmousemove="";div=d.getElementById("edit_area_resize");a=eAs[eAL.resize["id"]]["textarea"];width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.isIE==6){width-=2;height-=2;}a.style.width=width+"px";a.style.height=height+"px";div.style.display="none";a.style.display="inline";a.selectionStart=eAL.resize["selectionStart"];a.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow,newHeight,newWidth;allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){newHeight=Math.max(20,getMouseY(e)-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=newHeight+"px";}if(allow=="both"||allow=="x"){newWidth=Math.max(20,getMouseX(e)-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=newWidth+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; | |
34 | + EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i<text_array.length;i++){if(i>0)res+="|";res+=this.get_escaped_regexp(text_array[i]);}res+=")(\\b)";reg=new RegExp(res);return res;};EAL.prototype.get_escaped_regexp=function(str){return str.toString().replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style={};for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]={};this.syntax[lang]["keywords_reg_exp"]={};this.keywords_reg_exp_nb=0;if(this.load_syntax[lang]['KEYWORDS']){param="g";if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false)param+="i";for(var i in this.load_syntax[lang]['KEYWORDS']){if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function")continue;this.syntax[lang]["keywords_reg_exp"][i]=new RegExp(this.get_regexp(this.load_syntax[lang]['KEYWORDS'][i]),param);this.keywords_reg_exp_nb++;}}if(this.load_syntax[lang]['OPERATORS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['OPERATORS']){if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);nb++;}if(str.length>0)this.syntax[lang]["operators_reg_exp"]=new RegExp("("+str+")","g");}if(this.load_syntax[lang]['DELIMITERS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['DELIMITERS']){if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);nb++;}if(str.length>0)this.syntax[lang]["delimiters_reg_exp"]=new RegExp("("+str+")","g");}var syntax_trace=[];this.syntax[lang]["quotes"]={};var quote_tab=[];if(this.load_syntax[lang]['QUOTEMARKS']){for(var i in this.load_syntax[lang]['QUOTEMARKS']){if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);this.syntax[lang]["quotes"][x]=x;quote_tab[quote_tab.length]="("+x+"(\\\\.|[^"+x+"])*(?:"+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]={};if(this.load_syntax[lang]['COMMENT_SINGLE']){for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";syntax_trace.push(x);this.syntax[lang]["comments"][x]="\n";}}if(this.load_syntax[lang]['COMMENT_MULTI']){for(var i in this.load_syntax[lang]['COMMENT_MULTI']){if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function")continue;var start=this.get_escaped_regexp(i);var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";syntax_trace.push(start);syntax_trace.push(end);this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];}}if(quote_tab.length>0)this.syntax[lang]["comment_or_quote_reg_exp"]=new RegExp("("+quote_tab.join("|")+")","gi");if(syntax_trace.length>0)this.syntax[lang]["syntax_trace_regexp"]=new RegExp("((.|\n)*?)(\\\\*("+syntax_trace.join("|")+"|$))","gmi");if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){this.syntax[lang]["script_delimiters"]={};for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function")continue;this.syntax[lang]["script_delimiters"][i]=this.load_syntax[lang]['SCRIPT_DELIMITERS'];}}this.syntax[lang]["custom_regexp"]={};if(this.load_syntax[lang]['REGEXPS']){for(var i in this.load_syntax[lang]['REGEXPS']){if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function")continue;var val=this.load_syntax[lang]['REGEXPS'][i];if(!this.syntax[lang]["custom_regexp"][val['execute']])this.syntax[lang]["custom_regexp"][val['execute']]={};this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp':new RegExp(val['search'],val['modifiers']),'class':val['class']};}}if(this.load_syntax[lang]['STYLES']){lang_style[lang]={};for(var i in this.load_syntax[lang]['STYLES']){if(typeof(this.load_syntax[lang]['STYLES'][i])=="function")continue;if(typeof(this.load_syntax[lang]['STYLES'][i])!="string"){for(var j in this.load_syntax[lang]['STYLES'][i]){lang_style[lang][j]=this.load_syntax[lang]['STYLES'][i][j];}} | |
35 | +else{lang_style[lang][i]=this.load_syntax[lang]['STYLES'][i];}}}var style="";for(var i in lang_style[lang]){if(lang_style[lang][i].length>0){style+="."+lang+" ."+i.toLowerCase()+" span{"+lang_style[lang][i]+"}\n";style+="."+lang+" ."+i.toLowerCase()+"{"+lang_style[lang][i]+"}\n";}}this.syntax[lang]["styles"]=style;}}};eAL.waiting_loading["reg_syntax.js"]="loaded"; | |
36 | +var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= "<script type='text/javascript'> Ã EA(){var t=Á;t.error=Ì;t.inlinePopup=[{popup_id:\"area_search_replace\",icon_id:\"search\"},{popup_id:\"edit_area_help\",icon_id:\"help\"}];t.plugins={};t.line_number=0;È.eAL.set_browser_infos(t);if(t.isIE >=8)t.isIE=7;t.É={};t.last_text_to_highlight=\"\";t.last_hightlighted_text=\"\";t.syntax_list=[];t.allready_used_syntax={};t.check_line_selection_timer=50;t.ÂFocused=Ì;t.highlight_selection_line=null;t.previous=[];t.next=[];t.last_undo=\"\";t.files={};t.filesIdAssoc={};t.curr_file='';t.assocBracket={};t.revertAssocBracket={};t.assocBracket[\"(\"]=\")\";t.assocBracket[\"{\"]=\"}\";t.assocBracket[\"[\"]=\"]\";for(var index in t.assocBracket){t.revertAssocBracket[t.assocBracket[index]]=index;}t.is_editable=Ë;t.lineHeight=16;t.tab_nb_char=8;if(t.isOpera)t.tab_nb_char=6;t.is_tabbing=Ì;t.fullscreen={'isFull':Ì};t.isResizing=Ì;t.id=area_id;t.Å=eAs[t.id][\"Å\"];if((\"\"+t.Å['replace_tab_by_spaces']).match(/^[0-9]+$/)){t.tab_nb_char=t.Å['replace_tab_by_spaces'];t.tabulation=\"\";for(var i=0;i<t.tab_nb_char;i++)t.tabulation+=\" \";}\nelse{t.tabulation=\"\t\";}if(t.Å[\"syntax_selection_allow\"]&&t.Å[\"syntax_selection_allow\"].Æ>0)t.syntax_list=t.Å[\"syntax_selection_allow\"].replace(/ /g,\"\").split(\",\");if(t.Å['syntax'])t.allready_used_syntax[t.Å['syntax']]=Ë;};EA.Ä.init=Ã(){var t=Á,a,s=t.Å;t.Â=_$(\"Â\");t.container=_$(\"container\");t.result=_$(\"result\");t.content_highlight=_$(\"content_highlight\");t.selection_field=_$(\"selection_field\");t.selection_field_text=_$(\"selection_field_text\");t.processing_screen=_$(\"processing\");t.editor_area=_$(\"editor\");t.tab_browsing_area=_$(\"tab_browsing_area\");t.test_font_size=_$(\"test_font_size\");a=t.Â;if(!s['is_editable'])t.set_editable(Ì);t.set_show_line_colors(s['show_line_colors']);if(syntax_selec=_$(\"syntax_selection\")){for(var i=0;i<t.syntax_list.Æ;i++){var syntax=t.syntax_list[i];var option=document.createElement(\"option\");option.Ê=syntax;if(syntax==s['syntax'])option.selected=\"selected\";dispSyntax=È.eAL.syntax_display_name[ syntax ];option.innerHTML=typeof(dispSyntax)=='undefined' ? syntax.substring(0,1).toUpperCase()+syntax.substring(1):dispSyntax;syntax_selec.appendChild(option);}}spans=È.getChildren(_$(\"toolbar_1\"),\"span\",\"\",\"\",\"all\",-1);for(var i=0;i<spans.Æ;i++){id=spans[i].id.replace(/tmp_tool_(.*)/,\"$1\");if(id!=spans[i].id){for(var j in t.plugins){if(typeof(t.plugins[j].get_control_html)==\"Ã\"){html=t.plugins[j].get_control_html(id);if(html!=Ì){html=t.get_translation(html,\"template\");var new_span=document.createElement(\"span\");new_span.innerHTML=html;var father=spans[i].ÈNode;spans[i].ÈNode.replaceChild(new_span,spans[i]);break;}}}}}if(s[\"debug\"]){t.debug=È.document.getElementById(\"edit_area_debug_\"+t.id);}if(_$(\"redo\")!=null)t.switchClassSticky(_$(\"redo\"),'editAreaButtonDisabled',Ë);if(typeof(È.eAL.syntax[s[\"syntax\"]])!=\"undefined\"){for(var i in È.eAL.syntax){if(typeof(È.eAL.syntax[i][\"Çs\"])!=\"undefined\"){t.add_Ç(È.eAL.syntax[i][\"Çs\"]);}}}if(t.isOpera)_$(\"editor\").onkeypress=keyDown;\nelse _$(\"editor\").onkeydown=keyDown;for(var i=0;i<t.inlinePopup.Æ;i++){if(t.isOpera)_$(t.inlinePopup[i][\"popup_id\"]).onkeypress=keyDown;\nelse _$(t.inlinePopup[i][\"popup_id\"]).onkeydown=keyDown;}if(s[\"allow_resize\"]==\"both\"||s[\"allow_resize\"]==\"x\"||s[\"allow_resize\"]==\"y\")t.allow_resize(Ë);È.eAL.toggle(t.id,\"on\");t.change_smooth_selection_mode(eA.smooth_selection);t.execCommand(\"change_highlight\",s[\"start_highlight\"]);t.set_font(eA.Å[\"font_family\"],eA.Å[\"font_size\"]);children=È.getChildren(document.body,\"\",\"selec\",\"none\",\"all\",-1);for(var i=0;i<children.Æ;i++){if(t.isIE)children[i].unselectable=Ë;\nelse children[i].onmousedown=Ã(){return Ì};}a.spellcheck=s[\"gecko_spellcheck\"];if(t.isFirefox >='3'){t.content_highlight.Ç.paddingLeft=\"1px\";t.selection_field.Ç.paddingLeft=\"1px\";t.selection_field_text.Ç.paddingLeft=\"1px\";}if(t.isIE&&t.isIE < 8){a.Ç.marginTop=\"-1px\";}if(t.isSafari){t.editor_area.Ç.position=\"absolute\";a.Ç.marginLeft=\"-3px\";if(t.isSafari < 3.2)a.Ç.marginTop=\"1px\";}È.eAL.add_event(t.result,\"click\",Ã(e){if((e.target||e.srcElement)==eA.result){eA.area_select(eA.Â.Ê.Æ,0);}});if(s['is_multi_files']!=Ì)t.open_file({'id':t.curr_file,'text':''});t.set_word_wrap(s['word_wrap']);setTimeout(\"eA.focus();eA.manage_size();eA.execCommand('EA_load');\",10);t.check_undo();t.check_line_selection(Ë);t.scroll_to_view();for(var i in t.plugins){if(typeof(t.plugins[i].onload)==\"Ã\")t.plugins[i].onload();}if(s['fullscreen']==Ë)t.toggle_full_screen(Ë);È.eAL.add_event(window,\"resize\",eA.update_size);È.eAL.add_event(È.window,\"resize\",eA.update_size);È.eAL.add_event(top.window,\"resize\",eA.update_size);È.eAL.add_event(window,\"unload\",Ã(){if(È.eAL){È.eAL.remove_event(È.window,\"resize\",eA.update_size);È.eAL.remove_event(top.window,\"resize\",eA.update_size);}if(eAs[eA.id]&&eAs[eA.id][\"displayed\"]){eA.execCommand(\"EA_unload\");}});};EA.Ä.update_size=Ã(){var d=document,pd=È.document,height,width,popup,maxLeft,maxTop;if(typeof eAs !='undefined'&&eAs[eA.id]&&eAs[eA.id][\"displayed\"]==Ë){if(eA.fullscreen['isFull']){pd.getElementById(\"frame_\"+eA.id).Ç.width=pd.getElementsByTagName(\"html\")[0].clientWidth+\"px\";pd.getElementById(\"frame_\"+eA.id).Ç.height=pd.getElementsByTagName(\"html\")[0].clientHeight+\"px\";}if(eA.tab_browsing_area.Ç.display=='block'&&(!eA.isIE||eA.isIE >=8)){eA.tab_browsing_area.Ç.height=\"0px\";eA.tab_browsing_area.Ç.height=(eA.result.offsetTop-eA.tab_browsing_area.offsetTop-1)+\"px\";}height=d.body.offsetHeight-eA.get_all_toolbar_height()-4;eA.result.Ç.height=height+\"px\";width=d.body.offsetWidth-2;eA.result.Ç.width=width+\"px\";for(i=0;i < eA.inlinePopup.Æ;i++){popup=_$(eA.inlinePopup[i][\"popup_id\"]);maxLeft=d.body.offsetWidth-popup.offsetWidth;maxTop=d.body.offsetHeight-popup.offsetHeight;if(popup.offsetTop > maxTop)popup.Ç.top=maxTop+\"px\";if(popup.offsetLeft > maxLeft)popup.Ç.left=maxLeft+\"px\";}eA.manage_size(Ë);eA.fixLinesHeight(eA.Â.Ê,0,-1);}};EA.Ä.manage_size=Ã(onlyOneTime){if(!eAs[Á.id])return Ì;if(eAs[Á.id][\"displayed\"]==Ë&&Á.ÂFocused){var area_height,resized=Ì;if(!Á.Å['word_wrap']){var area_width=Á.Â.scrollWidth;area_height=Á.Â.scrollHeight;if(Á.isOpera&&Á.isOpera < 9.6){area_width=10000;}if(Á.Â.previous_scrollWidth!=area_width){Á.container.Ç.width=area_width+\"px\";Á.Â.Ç.width=area_width+\"px\";Á.content_highlight.Ç.width=area_width+\"px\";Á.Â.previous_scrollWidth=area_width;resized=Ë;}}if(Á.Å['word_wrap']){newW=Á.Â.offsetWidth;if(Á.isFirefox||Á.isIE)newW-=2;if(Á.isSafari)newW-=6;Á.content_highlight.Ç.width=Á.selection_field_text.Ç.width=Á.selection_field.Ç.width=Á.test_font_size.Ç.width=newW+\"px\";}if(Á.isOpera||Á.isFirefox||Á.isSafari){area_height=Á.getLinePosTop(Á.É[\"nb_line\"]+1);}\nelse{area_height=Á.Â.scrollHeight;}if(Á.Â.previous_scrollHeight!=area_height){Á.container.Ç.height=(area_height+2)+\"px\";Á.Â.Ç.height=area_height+\"px\";Á.content_highlight.Ç.height=area_height+\"px\";Á.Â.previous_scrollHeight=area_height;resized=Ë;}if(Á.É[\"nb_line\"] >=Á.line_number){var newLines='',destDiv=_$(\"line_number\"),start=Á.line_number,end=Á.É[\"nb_line\"]+100;for(i=start+1;i < end;i++){newLines+='<div id=\"line_'+i+'\">'+i+\"</div>\";Á.line_number++;}destDiv.innerHTML=destDiv.innerHTML+newLines;if(Á.Å['word_wrap']){Á.fixLinesHeight(Á.Â.Ê,start,-1);}}Á.Â.scrollTop=\"0px\";Á.Â.scrollLeft=\"0px\";if(resized==Ë){Á.scroll_to_view();}}if(!onlyOneTime)setTimeout(\"eA.manage_size();\",100);};EA.Ä.execCommand=Ã(cmd,param){for(var i in Á.plugins){if(typeof(Á.plugins[i].execCommand)==\"Ã\"){if(!Á.plugins[i].execCommand(cmd,param))return;}}switch(cmd){case \"save\":if(Á.Å[\"save_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"save_callback\"]+\"('\"+Á.id+\"',eA.Â.Ê);\");break;case \"load\":if(Á.Å[\"load_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"load_callback\"]+\"('\"+Á.id+\"');\");break;case \"onchange\":if(Á.Å[\"change_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"change_callback\"]+\"('\"+Á.id+\"');\");break;case \"EA_load\":if(Á.Å[\"EA_load_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_load_callback\"]+\"('\"+Á.id+\"');\");break;case \"EA_unload\":if(Á.Å[\"EA_unload_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_unload_callback\"]+\"('\"+Á.id+\"');\");break;case \"toggle_on\":if(Á.Å[\"EA_toggle_on_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_toggle_on_callback\"]+\"('\"+Á.id+\"');\");break;case \"toggle_off\":if(Á.Å[\"EA_toggle_off_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_toggle_off_callback\"]+\"('\"+Á.id+\"');\");break;case \"re_sync\":if(!Á.do_highlight)break;case \"file_switch_on\":if(Á.Å[\"EA_file_switch_on_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_file_switch_on_callback\"]+\"(param);\");break;case \"file_switch_off\":if(Á.Å[\"EA_file_switch_off_callback\"].Æ>0)eval(\"È.\"+Á.Å[\"EA_file_switch_off_callback\"]+\"(param);\");break;case \"file_close\":if(Á.Å[\"EA_file_close_callback\"].Æ>0)return eval(\"È.\"+Á.Å[\"EA_file_close_callback\"]+\"(param);\");break;default:if(typeof(eval(\"eA.\"+cmd))==\"Ã\"){if(Á.Å[\"debug\"])eval(\"eA.\"+cmd+\"(param);\");\nelse try{eval(\"eA.\"+cmd+\"(param);\");}catch(e){};}}};EA.Ä.get_translation=Ã(word,mode){if(mode==\"template\")return È.eAL.translate(word,Á.Å[\"language\"],mode);\nelse return È.eAL.get_word_translation(word,Á.Å[\"language\"]);};EA.Ä.add_plugin=Ã(plug_name,plug_obj){for(var i=0;i<Á.Å[\"plugins\"].Æ;i++){if(Á.Å[\"plugins\"][i]==plug_name){Á.plugins[plug_name]=plug_obj;plug_obj.baseURL=È.eAL.baseURL+\"plugins/\"+plug_name+\"/\";if(typeof(plug_obj.init)==\"Ã\")plug_obj.init();}}};EA.Ä.load_css=Ã(url){try{link=document.createElement(\"link\");link.type=\"text/css\";link.rel=\"Çsheet\";link.media=\"all\";link.href=url;head=document.getElementsByTagName(\"head\");head[0].appendChild(link);}catch(e){document.write(\"<link href='\"+url+\"' rel='Çsheet' type='text/css' />\");}};EA.Ä.load_script=Ã(url){try{script=document.createElement(\"script\");script.type=\"text/javascript\";script.src=url;script.charset=\"UTF-8\";head=document.getElementsByTagName(\"head\");head[0].appendChild(script);}catch(e){document.write(\"<script type='text/javascript' src='\"+url+\"' charset=\\\"UTF-8\\\"><\"+\"/script>\");}};EA.Ä.add_lang=Ã(language,Ês){if(!È.eAL.lang[language])È.eAL.lang[language]={};for(var i in Ês)È.eAL.lang[language][i]=Ês[i];};Ã _$(id){return document.getElementById(id);};var eA=new EA();È.eAL.add_event(window,\"load\",init);Ã init(){setTimeout(\"eA.init();\",10);}; EA.Ä.focus=Ã(){Á.Â.focus();Á.ÂFocused=Ë;};EA.Ä.check_line_selection=Ã(timer_checkup){var changes,infos,new_top,new_width,i;var t1=t2=t2_1=t3=tLines=tend=new Date().getTime();if(!eAs[Á.id])return Ì;if(!Á.smooth_selection&&!Á.do_highlight){}\nelse if(Á.ÂFocused&&eAs[Á.id][\"displayed\"]==Ë&&Á.isResizing==Ì){infos=Á.get_selection_infos();changes=Á.checkTextEvolution(typeof(Á.É['full_text'])=='undefined' ? '':Á.É['full_text'],infos['full_text']);t2=new Date().getTime();if(Á.É[\"line_start\"] !=infos[\"line_start\"]||Á.É[\"line_nb\"] !=infos[\"line_nb\"]||infos[\"full_text\"] !=Á.É[\"full_text\"]||Á.reload_highlight||Á.É[\"selectionStart\"] !=infos[\"selectionStart\"]||Á.É[\"selectionEnd\"] !=infos[\"selectionEnd\"]||!timer_checkup){new_top=Á.getLinePosTop(infos[\"line_start\"]);new_width=Math.max(Á.Â.scrollWidth,Á.container.clientWidth-50);Á.selection_field.Ç.top=Á.selection_field_text.Ç.top=new_top+\"px\";if(!Á.Å['word_wrap']){Á.selection_field.Ç.width=Á.selection_field_text.Ç.width=Á.test_font_size.Ç.width=new_width+\"px\";}if(Á.do_highlight==Ë){var curr_text=infos[\"full_text\"].split(\"\\n\");var content=\"\";var start=Math.max(0,infos[\"line_start\"]-1);var end=Math.min(curr_text.Æ,infos[\"line_start\"]+infos[\"line_nb\"]-1);for(i=start;i< end;i++){content+=curr_text[i]+\"\\n\";}selLength=infos['selectionEnd']-infos['selectionStart'];content=content.substr(0,infos[\"curr_pos\"]-1)+\"\\r\\r\"+content.substr(infos[\"curr_pos\"]-1,selLength)+\"\\r\\r\"+content.substr(infos[\"curr_pos\"]-1+selLength);content='<span>'+content.replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(\"\\r\\r\",'</span><strong>').replace(\"\\r\\r\",'</strong><span>')+'</span>';if(Á.isIE||(Á.isOpera&&Á.isOpera < 9.6)){Á.selection_field.innerHTML=\"<pre>\"+content.replace(/^\\r?\\n/,\"<br>\")+\"</pre>\";}\nelse{Á.selection_field.innerHTML=content;}Á.selection_field_text.innerHTML=Á.selection_field.innerHTML;t2_1=new Date().getTime();if(Á.reload_highlight||(infos[\"full_text\"] !=Á.last_text_to_highlight&&(Á.É[\"line_start\"]!=infos[\"line_start\"]||Á.show_line_colors||Á.Å['word_wrap']||Á.É[\"line_nb\"]!=infos[\"line_nb\"]||Á.É[\"nb_line\"]!=infos[\"nb_line\"]))){Á.maj_highlight(infos);}}}t3=new Date().getTime();if(Á.Å['word_wrap']&&infos[\"full_text\"] !=Á.É[\"full_text\"]){if(changes.newText.split(\"\\n\").Æ==1&&Á.É['nb_line']&&infos['nb_line']==Á.É['nb_line']){Á.fixLinesHeight(infos['full_text'],changes.lineStart,changes.lineStart);}\nelse{Á.fixLinesHeight(infos['full_text'],changes.lineStart,-1);}}tLines=new Date().getTime();if(infos[\"line_start\"] !=Á.É[\"line_start\"]||infos[\"curr_pos\"] !=Á.É[\"curr_pos\"]||infos[\"full_text\"].Æ!=Á.É[\"full_text\"].Æ||Á.reload_highlight||!timer_checkup){var selec_char=infos[\"curr_line\"].charAt(infos[\"curr_pos\"]-1);var no_real_move=Ë;if(infos[\"line_nb\"]==1&&(Á.assocBracket[selec_char]||Á.revertAssocBracket[selec_char])){no_real_move=Ì;if(Á.findEndBracket(infos,selec_char)===Ë){_$(\"end_bracket\").Ç.visibility=\"visible\";_$(\"cursor_pos\").Ç.visibility=\"visible\";_$(\"cursor_pos\").innerHTML=selec_char;_$(\"end_bracket\").innerHTML=(Á.assocBracket[selec_char]||Á.revertAssocBracket[selec_char]);}\nelse{_$(\"end_bracket\").Ç.visibility=\"hidden\";_$(\"cursor_pos\").Ç.visibility=\"hidden\";}}\nelse{_$(\"cursor_pos\").Ç.visibility=\"hidden\";_$(\"end_bracket\").Ç.visibility=\"hidden\";}Á.displayToCursorPosition(\"cursor_pos\",infos[\"line_start\"],infos[\"curr_pos\"]-1,infos[\"curr_line\"],no_real_move);if(infos[\"line_nb\"]==1&&infos[\"line_start\"]!=Á.É[\"line_start\"])Á.scroll_to_view();}Á.É=infos;}tend=new Date().getTime();if(timer_checkup){setTimeout(\"eA.check_line_selection(Ë)\",Á.check_line_selection_timer);}};EA.Ä.get_selection_infos=Ã(){var sel={},start,end,len,str;Á.getIESelection();start=Á.Â.selectionStart;end=Á.Â.selectionEnd;if(Á.É[\"selectionStart\"]==start&&Á.É[\"selectionEnd\"]==end&&Á.É[\"full_text\"]==Á.Â.Ê){return Á.É;}if(Á.tabulation!=\"\t\"&&Á.Â.Ê.indexOf(\"\t\")!=-1){len=Á.Â.Ê.Æ;Á.Â.Ê=Á.replace_tab(Á.Â.Ê);start=end=start+(Á.Â.Ê.Æ-len);Á.area_select(start,0);}sel[\"selectionStart\"]=start;sel[\"selectionEnd\"]=end;sel[\"full_text\"]=Á.Â.Ê;sel[\"line_start\"]=1;sel[\"line_nb\"]=1;sel[\"curr_pos\"]=0;sel[\"curr_line\"]=\"\";sel[\"indexOfCursor\"]=0;sel[\"selec_direction\"]=Á.É[\"selec_direction\"];var splitTab=sel[\"full_text\"].split(\"\\n\");var nbLine=Math.max(0,splitTab.Æ);var nbChar=Math.max(0,sel[\"full_text\"].Æ-(nbLine-1));if(sel[\"full_text\"].indexOf(\"\\r\")!=-1)nbChar=nbChar-(nbLine-1);sel[\"nb_line\"]=nbLine;sel[\"nb_char\"]=nbChar;if(start>0){str=sel[\"full_text\"].substr(0,start);sel[\"curr_pos\"]=start-str.lastIndexOf(\"\\n\");sel[\"line_start\"]=Math.max(1,str.split(\"\\n\").Æ);}\nelse{sel[\"curr_pos\"]=1;}if(end>start){sel[\"line_nb\"]=sel[\"full_text\"].substring(start,end).split(\"\\n\").Æ;}sel[\"indexOfCursor\"]=start;sel[\"curr_line\"]=splitTab[Math.max(0,sel[\"line_start\"]-1)];if(sel[\"selectionStart\"]==Á.É[\"selectionStart\"]){if(sel[\"selectionEnd\"]>Á.É[\"selectionEnd\"])sel[\"selec_direction\"]=\"down\";\nelse if(sel[\"selectionEnd\"]==Á.É[\"selectionStart\"])sel[\"selec_direction\"]=Á.É[\"selec_direction\"];}\nelse if(sel[\"selectionStart\"]==Á.É[\"selectionEnd\"]&&sel[\"selectionEnd\"]>Á.É[\"selectionEnd\"]){sel[\"selec_direction\"]=\"down\";}\nelse{sel[\"selec_direction\"]=\"up\";}_$(\"nbLine\").innerHTML=nbLine;_$(\"nbChar\").innerHTML=nbChar;_$(\"linePos\").innerHTML=sel[\"line_start\"];_$(\"currPos\").innerHTML=sel[\"curr_pos\"];return sel;};EA.Ä.getIESelection=Ã(){var selectionStart,selectionEnd,range,stored_range;if(!Á.isIE)return Ì;if(Á.Å['word_wrap'])Á.Â.wrap='off';try{range=document.selection.createRange();stored_range=range.duplicate();stored_range.moveToElementText(Á.Â);stored_range.setEndPoint('EndToEnd',range);if(stored_range.ÈElement()!=Á.Â)throw \"invalid focus\";var scrollTop=Á.result.scrollTop+document.body.scrollTop;var relative_top=range.offsetTop-È.calculeOffsetTop(Á.Â)+scrollTop;var line_start=Math.round((relative_top / Á.lineHeight)+1);var line_nb=Math.round(range.boundingHeight / Á.lineHeight);selectionStart=stored_range.text.Æ-range.text.Æ;selectionStart+=(line_start-Á.Â.Ê.substr(0,selectionStart).split(\"\\n\").Æ)*2;selectionStart-=(line_start-Á.Â.Ê.substr(0,selectionStart).split(\"\\n\").Æ)* 2;selectionEnd=selectionStart+range.text.Æ;selectionEnd+=(line_start+line_nb-1-Á.Â.Ê.substr(0,selectionEnd).split(\"\\n\").Æ)*2;Á.Â.selectionStart=selectionStart;Á.Â.selectionEnd=selectionEnd;}catch(e){}if(Á.Å['word_wrap'])Á.Â.wrap='soft';};EA.Ä.setIESelection=Ã(){var a=Á.Â,nbLineStart,nbLineEnd,range;if(!Á.isIE)return Ì;nbLineStart=a.Ê.substr(0,a.selectionStart).split(\"\\n\").Æ-1;nbLineEnd=a.Ê.substr(0,a.selectionEnd).split(\"\\n\").Æ-1;range=document.selection.createRange();range.moveToElementText(a);range.setEndPoint('EndToStart',range);range.moveStart('character',a.selectionStart-nbLineStart);range.moveEnd('character',a.selectionEnd-nbLineEnd-(a.selectionStart-nbLineStart));range.select();};EA.Ä.checkTextEvolution=Ã(lastText,newText){var ch={},baseStep=200,cpt=0,end,step,tStart=new Date().getTime();end=Math.min(newText.Æ,lastText.Æ);step=baseStep;while(cpt<end&&step>=1){if(lastText.substr(cpt,step)==newText.substr(cpt,step)){cpt+=step;}\nelse{step=Math.floor(step/2);}}ch.posStart=cpt;ch.lineStart=newText.substr(0,ch.posStart).split(\"\\n\").Æ-1;cpt_last=lastText.Æ;cpt=newText.Æ;step=baseStep;while(cpt>=0&&cpt_last>=0&&step>=1){if(lastText.substr(cpt_last-step,step)==newText.substr(cpt-step,step)){cpt-=step;cpt_last-=step;}\nelse{step=Math.floor(step/2);}}ch.posNewEnd=cpt;ch.posLastEnd=cpt_last;if(ch.posNewEnd<=ch.posStart){if(lastText.Æ < newText.Æ){ch.posNewEnd=ch.posStart+newText.Æ-lastText.Æ;ch.posLastEnd=ch.posStart;}\nelse{ch.posLastEnd=ch.posStart+lastText.Æ-newText.Æ;ch.posNewEnd=ch.posStart;}}ch.newText=newText.substring(ch.posStart,ch.posNewEnd);ch.lastText=lastText.substring(ch.posStart,ch.posLastEnd);ch.lineNewEnd=newText.substr(0,ch.posNewEnd).split(\"\\n\").Æ-1;ch.lineLastEnd=lastText.substr(0,ch.posLastEnd).split(\"\\n\").Æ-1;ch.newTextLine=newText.split(\"\\n\").slice(ch.lineStart,ch.lineNewEnd+1).join(\"\\n\");ch.lastTextLine=lastText.split(\"\\n\").slice(ch.lineStart,ch.lineLastEnd+1).join(\"\\n\");return ch;};EA.Ä.tab_selection=Ã(){if(Á.is_tabbing)return;Á.is_tabbing=Ë;Á.getIESelection();var start=Á.Â.selectionStart;var end=Á.Â.selectionEnd;var insText=Á.Â.Ê.substring(start,end);var pos_start=start;var pos_end=end;if(insText.Æ==0){Á.Â.Ê=Á.Â.Ê.substr(0,start)+Á.tabulation+Á.Â.Ê.substr(end);pos_start=start+Á.tabulation.Æ;pos_end=pos_start;}\nelse{start=Math.max(0,Á.Â.Ê.substr(0,start).lastIndexOf(\"\\n\")+1);endText=Á.Â.Ê.substr(end);startText=Á.Â.Ê.substr(0,start);tmp=Á.Â.Ê.substring(start,end).split(\"\\n\");insText=Á.tabulation+tmp.join(\"\\n\"+Á.tabulation);Á.Â.Ê=startText+insText+endText;pos_start=start;pos_end=Á.Â.Ê.indexOf(\"\\n\",startText.Æ+insText.Æ);if(pos_end==-1)pos_end=Á.Â.Ê.Æ;}Á.Â.selectionStart=pos_start;Á.Â.selectionEnd=pos_end;if(Á.isIE){Á.setIESelection();setTimeout(\"eA.is_tabbing=Ì;\",100);}\nelse{Á.is_tabbing=Ì;}};EA.Ä.invert_tab_selection=Ã(){var t=Á,a=Á.Â;if(t.is_tabbing)return;t.is_tabbing=Ë;t.getIESelection();var start=a.selectionStart;var end=a.selectionEnd;var insText=a.Ê.substring(start,end);var pos_start=start;var pos_end=end;if(insText.Æ==0){if(a.Ê.substring(start-t.tabulation.Æ,start)==t.tabulation){a.Ê=a.Ê.substr(0,start-t.tabulation.Æ)+a.Ê.substr(end);pos_start=Math.max(0,start-t.tabulation.Æ);pos_end=pos_start;}}\nelse{start=a.Ê.substr(0,start).lastIndexOf(\"\\n\")+1;endText=a.Ê.substr(end);startText=a.Ê.substr(0,start);tmp=a.Ê.substring(start,end).split(\"\\n\");insText=\"\";for(i=0;i<tmp.Æ;i++){for(j=0;j<t.tab_nb_char;j++){if(tmp[i].charAt(0)==\"\t\"){tmp[i]=tmp[i].substr(1);j=t.tab_nb_char;}\nelse if(tmp[i].charAt(0)==\" \")tmp[i]=tmp[i].substr(1);}insText+=tmp[i];if(i<tmp.Æ-1)insText+=\"\\n\";}a.Ê=startText+insText+endText;pos_start=start;pos_end=a.Ê.indexOf(\"\\n\",startText.Æ+insText.Æ);if(pos_end==-1)pos_end=a.Ê.Æ;}a.selectionStart=pos_start;a.selectionEnd=pos_end;if(t.isIE){t.setIESelection();setTimeout(\"eA.is_tabbing=Ì;\",100);}\nelse t.is_tabbing=Ì;};EA.Ä.press_enter=Ã(){if(!Á.smooth_selection)return Ì;Á.getIESelection();var scrollTop=Á.result.scrollTop;var scrollLeft=Á.result.scrollLeft;var start=Á.Â.selectionStart;var end=Á.Â.selectionEnd;var start_last_line=Math.max(0,Á.Â.Ê.substring(0,start).lastIndexOf(\"\\n\")+1);var begin_line=Á.Â.Ê.substring(start_last_line,start).replace(/^([ \t]*).*/gm,\"$1\");var lineStart=Á.Â.Ê.substring(0,start).split(\"\\n\").Æ;if(begin_line==\"\\n\"||begin_line==\"\\r\"||begin_line.Æ==0){return Ì;}if(Á.isIE||(Á.isOpera&&Á.isOpera < 9.6)){begin_line=\"\\r\\n\"+begin_line;}\nelse{begin_line=\"\\n\"+begin_line;}Á.Â.Ê=Á.Â.Ê.substring(0,start)+begin_line+Á.Â.Ê.substring(end);Á.area_select(start+begin_line.Æ,0);if(Á.isIE){Á.result.scrollTop=scrollTop;Á.result.scrollLeft=scrollLeft;}return Ë;};EA.Ä.findEndBracket=Ã(infos,bracket){var start=infos[\"indexOfCursor\"];var normal_order=Ë;if(Á.assocBracket[bracket])endBracket=Á.assocBracket[bracket];\nelse if(Á.revertAssocBracket[bracket]){endBracket=Á.revertAssocBracket[bracket];normal_order=Ì;}var end=-1;var nbBracketOpen=0;for(var i=start;i<infos[\"full_text\"].Æ&&i>=0;){if(infos[\"full_text\"].charAt(i)==endBracket){nbBracketOpen--;if(nbBracketOpen<=0){end=i;break;}}\nelse if(infos[\"full_text\"].charAt(i)==bracket)nbBracketOpen++;if(normal_order)i++;\nelse i--;}if(end==-1)return Ì;var endLastLine=infos[\"full_text\"].substr(0,end).lastIndexOf(\"\\n\");if(endLastLine==-1)line=1;\nelse line=infos[\"full_text\"].substr(0,endLastLine).split(\"\\n\").Æ+1;var curPos=end-endLastLine-1;var endLineLength=infos[\"full_text\"].substring(end).split(\"\\n\")[0].Æ;Á.displayToCursorPosition(\"end_bracket\",line,curPos,infos[\"full_text\"].substring(endLastLine+1,end+endLineLength));return Ë;};EA.Ä.displayToCursorPosition=Ã(id,start_line,cur_pos,lineContent,no_real_move){var elem,dest,content,posLeft=0,posTop,fixPadding,topOffset,endElem;elem=Á.test_font_size;dest=_$(id);content=\"<span id='test_font_size_inner'>\"+lineContent.substr(0,cur_pos).replace(/&/g,\"&\").replace(/</g,\"<\")+\"</span><span id='endTestFont'>\"+lineContent.substr(cur_pos).replace(/&/g,\"&\").replace(/</g,\"<\")+\"</span>\";if(Á.isIE||(Á.isOpera&&Á.isOpera < 9.6)){elem.innerHTML=\"<pre>\"+content.replace(/^\\r?\\n/,\"<br>\")+\"</pre>\";}\nelse{elem.innerHTML=content;}endElem=_$('endTestFont');topOffset=endElem.offsetTop;fixPadding=parseInt(Á.content_highlight.Ç.paddingLeft.replace(\"px\",\"\"));posLeft=45+endElem.offsetLeft+(!isNaN(fixPadding)&&topOffset > 0 ? fixPadding:0);posTop=Á.getLinePosTop(start_line)+topOffset;if(Á.isIE&&cur_pos > 0&&endElem.offsetLeft==0){posTop+=Á.lineHeight;}if(no_real_move!=Ë){dest.Ç.top=posTop+\"px\";dest.Ç.left=posLeft+\"px\";}dest.cursor_top=posTop;dest.cursor_left=posLeft;};EA.Ä.getLinePosTop=Ã(start_line){var elem=_$('line_'+start_line),posTop=0;if(elem)posTop=elem.offsetTop;\nelse posTop=Á.lineHeight *(start_line-1);return posTop;};EA.Ä.getTextHeight=Ã(text){var t=Á,elem,height;elem=t.test_font_size;content=text.replace(/&/g,\"&\").replace(/</g,\"<\");if(t.isIE||(Á.isOpera&&Á.isOpera < 9.6)){elem.innerHTML=\"<pre>\"+content.replace(/^\\r?\\n/,\"<br>\")+\"</pre>\";}\nelse{elem.innerHTML=content;}height=elem.offsetHeight;height=Math.max(1,Math.floor(elem.offsetHeight / Á.lineHeight))* Á.lineHeight;return height;};EA.Ä.fixLinesHeight=Ã(textValue,lineStart,lineEnd){var aText=textValue.split(\"\\n\");if(lineEnd==-1)lineEnd=aText.Æ-1;for(var i=Math.max(0,lineStart);i <=lineEnd;i++){if(elem=_$('line_'+(i+1))){elem.Ç.height=typeof(aText[i])!=\"undefined\" ? Á.getTextHeight(aText[i])+\"px\":Á.lineHeight;}}};EA.Ä.area_select=Ã(start,Æ){Á.Â.focus();start=Math.max(0,Math.min(Á.Â.Ê.Æ,start));end=Math.max(start,Math.min(Á.Â.Ê.Æ,start+Æ));if(Á.isIE){Á.Â.selectionStart=start;Á.Â.selectionEnd=end;Á.setIESelection();}\nelse{if(Á.isOpera&&Á.isOpera < 9.6){Á.Â.setSelectionRange(0,0);}Á.Â.setSelectionRange(start,end);}Á.check_line_selection();};EA.Ä.area_get_selection=Ã(){var text=\"\";if(document.selection){var range=document.selection.createRange();text=range.text;}\nelse{text=Á.Â.Ê.substring(Á.Â.selectionStart,Á.Â.selectionEnd);}return text;}; EA.Ä.replace_tab=Ã(text){return text.replace(/((\\n?)([^\t\\n]*)\t)/gi,eA.smartTab);};EA.Ä.smartTab=Ã(){val=\" \";return EA.Ä.smartTab.arguments[2]+EA.Ä.smartTab.arguments[3]+val.substr(0,eA.tab_nb_char-(EA.Ä.smartTab.arguments[3].Æ)%eA.tab_nb_char);};EA.Ä.show_waiting_screen=Ã(){width=Á.editor_area.offsetWidth;height=Á.editor_area.offsetHeight;if(!(Á.isIE&&Á.isIE<6)){width-=2;height-=2;}Á.processing_screen.Ç.display=\"block\";Á.processing_screen.Ç.width=width+\"px\";Á.processing_screen.Ç.height=height+\"px\";Á.waiting_screen_displayed=Ë;};EA.Ä.hide_waiting_screen=Ã(){Á.processing_screen.Ç.display=\"none\";Á.waiting_screen_displayed=Ì;};EA.Ä.add_Ç=Ã(Çs){if(Çs.Æ>0){newcss=document.createElement(\"Ç\");newcss.type=\"text/css\";newcss.media=\"all\";if(newcss.ÇSheet){newcss.ÇSheet.cssText=Çs;}\nelse{newcss.appendChild(document.createTextNode(Çs));}document.getElementsByTagName(\"head\")[0].appendChild(newcss);}};EA.Ä.set_font=Ã(family,size){var t=Á,a=Á.Â,s=Á.Å,elem_font,i,elem;var elems=[\"Â\",\"content_highlight\",\"cursor_pos\",\"end_bracket\",\"selection_field\",\"selection_field_text\",\"line_number\"];if(family&&family!=\"\")s[\"font_family\"]=family;if(size&&size>0)s[\"font_size\"]=size;if(t.isOpera&&t.isOpera < 9.6)s['font_family']=\"monospace\";if(elem_font=_$(\"area_font_size\")){for(i=0;i < elem_font.Æ;i++){if(elem_font.options[i].Ê&&elem_font.options[i].Ê==s[\"font_size\"])elem_font.options[i].selected=Ë;}}if(t.isFirefox){var nbTry=3;do{var div1=document.createElement('div'),text1=document.createElement('Â');var Çs={width:'40px',overflow:'scroll',zIndex:50,visibility:'hidden',fontFamily:s[\"font_family\"],fontSize:s[\"font_size\"]+\"pt\",lineHeight:t.lineHeight+\"px\",padding:'0',margin:'0',border:'none',whiteSpace:'nowrap'};var diff,changed=Ì;for(i in Çs){div1.Ç[ i ]=Çs[i];text1.Ç[ i ]=Çs[i];}text1.wrap='off';text1.setAttribute('wrap','off');t.container.appendChild(div1);t.container.appendChild(text1);div1.innerHTML=text1.Ê='azertyuiopqsdfghjklm';div1.innerHTML=text1.Ê=text1.Ê+'wxcvbn^p*ù$!:;,,';diff=text1.scrollWidth-div1.scrollWidth;if(Math.abs(diff)>=2){s[\"font_size\"]++;changed=Ë;}t.container.removeChild(div1);t.container.removeChild(text1);nbTry--;}while(changed&&nbTry > 0);}elem=t.test_font_size;elem.Ç.fontFamily=\"\"+s[\"font_family\"];elem.Ç.fontSize=s[\"font_size\"]+\"pt\";elem.innerHTML=\"0\";t.lineHeight=elem.offsetHeight;for(i=0;i<elems.Æ;i++){elem=_$(elems[i]);elem.Ç.fontFamily=s[\"font_family\"];elem.Ç.fontSize=s[\"font_size\"]+\"pt\";elem.Ç.lineHeight=t.lineHeight+\"px\";}t.add_Ç(\"pre{font-family:\"+s[\"font_family\"]+\"}\");if((t.isOpera&&t.isOpera < 9.6)||t.isIE >=8){var parNod=a.ÈNode,nxtSib=a.nextSibling,start=a.selectionStart,end=a.selectionEnd;parNod.removeChild(a);parNod.insertBefore(a,nxtSib);t.area_select(start,end-start);}Á.focus();Á.update_size();Á.check_line_selection();};EA.Ä.change_font_size=Ã(){var size=_$(\"area_font_size\").Ê;if(size>0)Á.set_font(\"\",size);};EA.Ä.open_inline_popup=Ã(popup_id){Á.close_all_inline_popup();var popup=_$(popup_id);var editor=_$(\"editor\");for(var i=0;i<Á.inlinePopup.Æ;i++){if(Á.inlinePopup[i][\"popup_id\"]==popup_id){var icon=_$(Á.inlinePopup[i][\"icon_id\"]);if(icon){Á.switchClassSticky(icon,'editAreaButtonSelected',Ë);break;}}}popup.Ç.height=\"auto\";popup.Ç.overflow=\"visible\";if(document.body.offsetHeight< popup.offsetHeight){popup.Ç.height=(document.body.offsetHeight-10)+\"px\";popup.Ç.overflow=\"auto\";}if(!popup.positionned){var new_left=editor.offsetWidth /2-popup.offsetWidth /2;var new_top=editor.offsetHeight /2-popup.offsetHeight /2;popup.Ç.left=new_left+\"px\";popup.Ç.top=new_top+\"px\";popup.positionned=Ë;}popup.Ç.visibility=\"visible\";};EA.Ä.close_inline_popup=Ã(popup_id){var popup=_$(popup_id);for(var i=0;i<Á.inlinePopup.Æ;i++){if(Á.inlinePopup[i][\"popup_id\"]==popup_id){var icon=_$(Á.inlinePopup[i][\"icon_id\"]);if(icon){Á.switchClassSticky(icon,'editAreaButtonNormal',Ì);break;}}}popup.Ç.visibility=\"hidden\";};EA.Ä.close_all_inline_popup=Ã(e){for(var i=0;i<Á.inlinePopup.Æ;i++){Á.close_inline_popup(Á.inlinePopup[i][\"popup_id\"]);}Á.Â.focus();};EA.Ä.show_help=Ã(){Á.open_inline_popup(\"edit_area_help\");};EA.Ä.new_document=Ã(){Á.Â.Ê=\"\";Á.area_select(0,0);};EA.Ä.get_all_toolbar_height=Ã(){var area=_$(\"editor\");var results=È.getChildren(area,\"div\",\"class\",\"area_toolbar\",\"all\",\"0\");var height=0;for(var i=0;i<results.Æ;i++){height+=results[i].offsetHeight;}return height;};EA.Ä.go_to_line=Ã(line){if(!line){var icon=_$(\"go_to_line\");if(icon !=null){Á.restoreClass(icon);Á.switchClassSticky(icon,'editAreaButtonSelected',Ë);}line=prompt(Á.get_translation(\"go_to_line_prompt\"));if(icon !=null)Á.switchClassSticky(icon,'editAreaButtonNormal',Ì);}if(line&&line!=null&&line.search(/^[0-9]+$/)!=-1){var start=0;var lines=Á.Â.Ê.split(\"\\n\");if(line > lines.Æ)start=Á.Â.Ê.Æ;\nelse{for(var i=0;i<Math.min(line-1,lines.Æ);i++)start+=lines[i].Æ+1;}Á.area_select(start,0);}};EA.Ä.change_smooth_selection_mode=Ã(setTo){if(Á.do_highlight)return;if(setTo !=null){if(setTo===Ì)Á.smooth_selection=Ë;\nelse Á.smooth_selection=Ì;}var icon=_$(\"change_smooth_selection\");Á.Â.focus();if(Á.smooth_selection===Ë){Á.switchClassSticky(icon,'editAreaButtonNormal',Ì);Á.smooth_selection=Ì;Á.selection_field.Ç.display=\"none\";_$(\"cursor_pos\").Ç.display=\"none\";_$(\"end_bracket\").Ç.display=\"none\";}\nelse{Á.switchClassSticky(icon,'editAreaButtonSelected',Ì);Á.smooth_selection=Ë;Á.selection_field.Ç.display=\"block\";_$(\"cursor_pos\").Ç.display=\"block\";_$(\"end_bracket\").Ç.display=\"block\";}};EA.Ä.scroll_to_view=Ã(show){var zone,lineElem;if(!Á.smooth_selection)return;zone=_$(\"result\");var cursor_pos_top=_$(\"cursor_pos\").cursor_top;if(show==\"bottom\"){cursor_pos_top+=Á.getLinePosTop(Á.É['line_start']+Á.É['line_nb']-1);}var max_height_visible=zone.clientHeight+zone.scrollTop;var miss_top=cursor_pos_top+Á.lineHeight-max_height_visible;if(miss_top>0){zone.scrollTop=zone.scrollTop+miss_top;}\nelse if(zone.scrollTop > cursor_pos_top){zone.scrollTop=cursor_pos_top;}var cursor_pos_left=_$(\"cursor_pos\").cursor_left;var max_width_visible=zone.clientWidth+zone.scrollLeft;var miss_left=cursor_pos_left+10-max_width_visible;if(miss_left>0){zone.scrollLeft=zone.scrollLeft+miss_left+50;}\nelse if(zone.scrollLeft > cursor_pos_left){zone.scrollLeft=cursor_pos_left;}\nelse if(zone.scrollLeft==45){zone.scrollLeft=0;}};EA.Ä.check_undo=Ã(only_once){if(!eAs[Á.id])return Ì;if(Á.ÂFocused&&eAs[Á.id][\"displayed\"]==Ë){var text=Á.Â.Ê;if(Á.previous.Æ<=1)Á.switchClassSticky(_$(\"undo\"),'editAreaButtonDisabled',Ë);if(!Á.previous[Á.previous.Æ-1]||Á.previous[Á.previous.Æ-1][\"text\"] !=text){Á.previous.push({\"text\":text,\"selStart\":Á.Â.selectionStart,\"selEnd\":Á.Â.selectionEnd});if(Á.previous.Æ > Á.Å[\"max_undo\"]+1)Á.previous.shift();}if(Á.previous.Æ >=2)Á.switchClassSticky(_$(\"undo\"),'editAreaButtonNormal',Ì);}if(!only_once)setTimeout(\"eA.check_undo()\",3000);};EA.Ä.undo=Ã(){if(Á.previous.Æ > 0){Á.getIESelection();Á.next.push({\"text\":Á.Â.Ê,\"selStart\":Á.Â.selectionStart,\"selEnd\":Á.Â.selectionEnd});var prev=Á.previous.pop();if(prev[\"text\"]==Á.Â.Ê&&Á.previous.Æ > 0)prev=Á.previous.pop();Á.Â.Ê=prev[\"text\"];Á.last_undo=prev[\"text\"];Á.area_select(prev[\"selStart\"],prev[\"selEnd\"]-prev[\"selStart\"]);Á.switchClassSticky(_$(\"redo\"),'editAreaButtonNormal',Ì);Á.resync_highlight(Ë);Á.check_file_changes();}};EA.Ä.redo=Ã(){if(Á.next.Æ > 0){var next=Á.next.pop();Á.previous.push(next);Á.Â.Ê=next[\"text\"];Á.last_undo=next[\"text\"];Á.area_select(next[\"selStart\"],next[\"selEnd\"]-next[\"selStart\"]);Á.switchClassSticky(_$(\"undo\"),'editAreaButtonNormal',Ì);Á.resync_highlight(Ë);Á.check_file_changes();}if(Á.next.Æ==0)Á.switchClassSticky(_$(\"redo\"),'editAreaButtonDisabled',Ë);};EA.Ä.check_redo=Ã(){if(eA.next.Æ==0||eA.Â.Ê!=eA.last_undo){eA.next=[];eA.switchClassSticky(_$(\"redo\"),'editAreaButtonDisabled',Ë);}\nelse{Á.switchClassSticky(_$(\"redo\"),'editAreaButtonNormal',Ì);}};EA.Ä.switchClass=Ã(element,class_name,lock_state){var lockChanged=Ì;if(typeof(lock_state)!=\"undefined\"&&element !=null){element.classLock=lock_state;lockChanged=Ë;}if(element !=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};EA.Ä.restoreAndSwitchClass=Ã(element,class_name){if(element !=null&&!element.classLock){Á.restoreClass(element);Á.switchClass(element,class_name);}};EA.Ä.restoreClass=Ã(element){if(element !=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};EA.Ä.setClassLock=Ã(element,lock_state){if(element !=null)element.classLock=lock_state;};EA.Ä.switchClassSticky=Ã(element,class_name,lock_state){var lockChanged=Ì;if(typeof(lock_state)!=\"undefined\"&&element !=null){element.classLock=lock_state;lockChanged=Ë;}if(element !=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;}};EA.Ä.scroll_page=Ã(params){var dir=params[\"dir\"],shift_pressed=params[\"shift\"];var lines=Á.Â.Ê.split(\"\\n\");var new_pos=0,Æ=0,char_left=0,line_nb=0,curLine=0;var toScrollAmount=_$(\"result\").clientHeight-30;var nbLineToScroll=0,diff=0;if(dir==\"up\"){nbLineToScroll=Math.ceil(toScrollAmount / Á.lineHeight);for(i=Á.É[\"line_start\"];i-diff > Á.É[\"line_start\"]-nbLineToScroll;i--){if(elem=_$('line_'+i)){diff+=Math.floor((elem.offsetHeight-1)/ Á.lineHeight);}}nbLineToScroll-=diff;if(Á.É[\"selec_direction\"]==\"up\"){for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]-nbLineToScroll,lines.Æ);line_nb++){new_pos+=lines[line_nb].Æ+1;}char_left=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"]-1);if(shift_pressed)Æ=Á.É[\"selectionEnd\"]-new_pos-char_left;Á.area_select(new_pos+char_left,Æ);view=\"top\";}\nelse{view=\"bottom\";for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]+Á.É[\"line_nb\"]-1-nbLineToScroll,lines.Æ);line_nb++){new_pos+=lines[line_nb].Æ+1;}char_left=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"]-1);if(shift_pressed){start=Math.min(Á.É[\"selectionStart\"],new_pos+char_left);Æ=Math.max(new_pos+char_left,Á.É[\"selectionStart\"])-start;if(new_pos+char_left < Á.É[\"selectionStart\"])view=\"top\";}\nelse start=new_pos+char_left;Á.area_select(start,Æ);}}\nelse{var nbLineToScroll=Math.floor(toScrollAmount / Á.lineHeight);for(i=Á.É[\"line_start\"];i+diff < Á.É[\"line_start\"]+nbLineToScroll;i++){if(elem=_$('line_'+i)){diff+=Math.floor((elem.offsetHeight-1)/ Á.lineHeight);}}nbLineToScroll-=diff;if(Á.É[\"selec_direction\"]==\"down\"){view=\"bottom\";for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]+Á.É[\"line_nb\"]-2+nbLineToScroll,lines.Æ);line_nb++){if(line_nb==Á.É[\"line_start\"]-1)char_left=Á.É[\"selectionStart\"]-new_pos;new_pos+=lines[line_nb].Æ+1;}if(shift_pressed){Æ=Math.abs(Á.É[\"selectionStart\"]-new_pos);Æ+=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"]);Á.area_select(Math.min(Á.É[\"selectionStart\"],new_pos),Æ);}\nelse{Á.area_select(new_pos+char_left,0);}}\nelse{view=\"top\";for(line_nb=0;line_nb< Math.min(Á.É[\"line_start\"]+nbLineToScroll-1,lines.Æ,lines.Æ);line_nb++){if(line_nb==Á.É[\"line_start\"]-1)char_left=Á.É[\"selectionStart\"]-new_pos;new_pos+=lines[line_nb].Æ+1;}if(shift_pressed){Æ=Math.abs(Á.É[\"selectionEnd\"]-new_pos-char_left);Æ+=Math.min(lines[Math.min(lines.Æ-1,line_nb)].Æ,Á.É[\"curr_pos\"])-char_left-1;Á.area_select(Math.min(Á.É[\"selectionEnd\"],new_pos+char_left),Æ);if(new_pos+char_left > Á.É[\"selectionEnd\"])view=\"bottom\";}\nelse{Á.area_select(new_pos+char_left,0);}}}Á.check_line_selection();Á.scroll_to_view(view);};EA.Ä.start_resize=Ã(e){È.eAL.resize[\"id\"]=eA.id;È.eAL.resize[\"start_x\"]=(e)? e.pageX:event.x+document.body.scrollLeft;È.eAL.resize[\"start_y\"]=(e)? e.pageY:event.y+document.body.scrollTop;if(eA.isIE){eA.Â.focus();eA.getIESelection();}È.eAL.resize[\"selectionStart\"]=eA.Â.selectionStart;È.eAL.resize[\"selectionEnd\"]=eA.Â.selectionEnd;È.eAL.start_resize_area();};EA.Ä.toggle_full_screen=Ã(to){var t=Á,p=È,a=t.Â,html,frame,selStart,selEnd,old,icon;if(typeof(to)==\"undefined\")to=!t.fullscreen['isFull'];old=t.fullscreen['isFull'];t.fullscreen['isFull']=to;icon=_$(\"fullscreen\");selStart=t.Â.selectionStart;selEnd=t.Â.selectionEnd;html=p.document.getElementsByTagName(\"html\")[0];frame=p.document.getElementById(\"frame_\"+t.id);if(to&&to!=old){t.fullscreen['old_overflow']=p.get_css_property(html,\"overflow\");t.fullscreen['old_height']=p.get_css_property(html,\"height\");t.fullscreen['old_width']=p.get_css_property(html,\"width\");t.fullscreen['old_scrollTop']=html.scrollTop;t.fullscreen['old_scrollLeft']=html.scrollLeft;t.fullscreen['old_zIndex']=p.get_css_property(frame,\"z-index\");if(t.isOpera){html.Ç.height=\"100%\";html.Ç.width=\"100%\";}html.Ç.overflow=\"hidden\";html.scrollTop=0;html.scrollLeft=0;frame.Ç.position=\"absolute\";frame.Ç.width=html.clientWidth+\"px\";frame.Ç.height=html.clientHeight+\"px\";frame.Ç.display=\"block\";frame.Ç.zIndex=\"999999\";frame.Ç.top=\"0px\";frame.Ç.left=\"0px\";frame.Ç.top=\"-\"+p.calculeOffsetTop(frame)+\"px\";frame.Ç.left=\"-\"+p.calculeOffsetLeft(frame)+\"px\";t.switchClassSticky(icon,'editAreaButtonSelected',Ì);t.fullscreen['allow_resize']=t.resize_allowed;t.allow_resize(Ì);if(t.isFirefox){p.eAL.execCommand(t.id,\"update_size();\");t.area_select(selStart,selEnd-selStart);t.scroll_to_view();t.focus();}\nelse{setTimeout(\"È.eAL.execCommand('\"+t.id+\"','update_size();');eA.focus();\",10);}}\nelse if(to!=old){frame.Ç.position=\"static\";frame.Ç.zIndex=t.fullscreen['old_zIndex'];if(t.isOpera){html.Ç.height=\"auto\";html.Ç.width=\"auto\";html.Ç.overflow=\"auto\";}\nelse if(t.isIE&&p!=top){html.Ç.overflow=\"auto\";}\nelse{html.Ç.overflow=t.fullscreen['old_overflow'];}html.scrollTop=t.fullscreen['old_scrollTop'];html.scrollLeft=t.fullscreen['old_scrollLeft'];p.eAL.hide(t.id);p.eAL.show(t.id);t.switchClassSticky(icon,'editAreaButtonNormal',Ì);if(t.fullscreen['allow_resize'])t.allow_resize(t.fullscreen['allow_resize']);if(t.isFirefox){t.area_select(selStart,selEnd-selStart);setTimeout(\"eA.scroll_to_view();\",10);}}};EA.Ä.allow_resize=Ã(allow){var resize=_$(\"resize_area\");if(allow){resize.Ç.visibility=\"visible\";È.eAL.add_event(resize,\"mouseup\",eA.start_resize);}\nelse{resize.Ç.visibility=\"hidden\";È.eAL.remove_event(resize,\"mouseup\",eA.start_resize);}Á.resize_allowed=allow;};EA.Ä.change_syntax=Ã(new_syntax,is_waiting){if(new_syntax==Á.Å['syntax'])return Ë;var founded=Ì;for(var i=0;i<Á.syntax_list.Æ;i++){if(Á.syntax_list[i]==new_syntax)founded=Ë;}if(founded==Ë){if(!È.eAL.load_syntax[new_syntax]){if(!is_waiting)È.eAL.load_script(È.eAL.baseURL+\"reg_syntax/\"+new_syntax+\".js\");setTimeout(\"eA.change_syntax('\"+new_syntax+\"',Ë);\",100);Á.show_waiting_screen();}\nelse{if(!Á.allready_used_syntax[new_syntax]){È.eAL.init_syntax_regexp();Á.add_Ç(È.eAL.syntax[new_syntax][\"Çs\"]);Á.allready_used_syntax[new_syntax]=Ë;}var sel=_$(\"syntax_selection\");if(sel&&sel.Ê!=new_syntax){for(var i=0;i<sel.Æ;i++){if(sel.options[i].Ê&&sel.options[i].Ê==new_syntax)sel.options[i].selected=Ë;}}Á.Å['syntax']=new_syntax;Á.resync_highlight(Ë);Á.hide_waiting_screen();return Ë;}}return Ì;};EA.Ä.set_editable=Ã(is_editable){if(is_editable){document.body.className=\"\";Á.Â.readOnly=Ì;Á.is_editable=Ë;}\nelse{document.body.className=\"non_editable\";Á.Â.readOnly=Ë;Á.is_editable=Ì;}if(eAs[Á.id][\"displayed\"]==Ë)Á.update_size();};EA.Ä.toggle_word_wrap=Ã(){Á.set_word_wrap(!Á.Å['word_wrap']);};EA.Ä.set_word_wrap=Ã(to){var t=Á,a=t.Â;if(t.isOpera&&t.isOpera < 9.8){Á.Å['word_wrap']=Ì;t.switchClassSticky(_$(\"word_wrap\"),'editAreaButtonDisabled',Ë);return Ì;}if(to){wrap_mode='soft';Á.container.className+=' word_wrap';Á.container.Ç.width=\"\";Á.content_highlight.Ç.width=\"\";a.Ç.width=\"100%\";if(t.isIE&&t.isIE < 7){a.Ç.width=(a.offsetWidth-5)+\"px\";}t.switchClassSticky(_$(\"word_wrap\"),'editAreaButtonSelected',Ì);}\nelse{wrap_mode='off';Á.container.className=Á.container.className.replace(/word_wrap/g,'');t.switchClassSticky(_$(\"word_wrap\"),'editAreaButtonNormal',Ë);}Á.Â.previous_scrollWidth='';Á.Â.previous_scrollHeight='';a.wrap=wrap_mode;a.setAttribute('wrap',wrap_mode);if(!Á.isIE){var start=a.selectionStart,end=a.selectionEnd;var parNod=a.ÈNode,nxtSib=a.nextSibling;parNod.removeChild(a);parNod.insertBefore(a,nxtSib);Á.area_select(start,end-start);}Á.Å['word_wrap']=to;Á.focus();Á.update_size();Á.check_line_selection();};EA.Ä.open_file=Ã(Å){if(Å['id']!=\"undefined\"){var id=Å['id'];var new_file={};new_file['id']=id;new_file['title']=id;new_file['text']=\"\";new_file['É']=\"\";new_file['last_text_to_highlight']=\"\";new_file['last_hightlighted_text']=\"\";new_file['previous']=[];new_file['next']=[];new_file['last_undo']=\"\";new_file['smooth_selection']=Á.Å['smooth_selection'];new_file['do_highlight']=Á.Å['start_highlight'];new_file['syntax']=Á.Å['syntax'];new_file['scroll_top']=0;new_file['scroll_left']=0;new_file['selection_start']=0;new_file['selection_end']=0;new_file['edited']=Ì;new_file['font_size']=Á.Å[\"font_size\"];new_file['font_family']=Á.Å[\"font_family\"];new_file['word_wrap']=Á.Å[\"word_wrap\"];new_file['toolbar']={'links':{},'selects':{}};new_file['compare_edited_text']=new_file['text'];Á.files[id]=new_file;Á.update_file(id,Å);Á.files[id]['compare_edited_text']=Á.files[id]['text'];var html_id='tab_file_'+encodeURIComponent(id);Á.filesIdAssoc[html_id]=id;Á.files[id]['html_id']=html_id;if(!_$(Á.files[id]['html_id'])&&id!=\"\"){Á.tab_browsing_area.Ç.display=\"block\";var elem=document.createElement('li');elem.id=Á.files[id]['html_id'];var close=\"<img src=\\\"\"+È.eAL.baseURL+\"images/close.gif\\\" title=\\\"\"+Á.get_translation('close_tab','word')+\"\\\" onclick=\\\"eA.execCommand('close_file',eA.filesIdAssoc['\"+html_id+\"']);return Ì;\\\" class=\\\"hidden\\\" onmouseover=\\\"Á.className=''\\\" onmouseout=\\\"Á.className='hidden'\\\" />\";elem.innerHTML=\"<a onclick=\\\"javascript:eA.execCommand('switch_to_file',eA.filesIdAssoc['\"+html_id+\"']);\\\" selec=\\\"none\\\"><b><span><strong class=\\\"edited\\\">*</strong>\"+Á.files[id]['title']+close+\"</span></b></a>\";_$('tab_browsing_list').appendChild(elem);var elem=document.createElement('text');Á.update_size();}if(id!=\"\")Á.execCommand('file_open',Á.files[id]);Á.switch_to_file(id,Ë);return Ë;}\nelse return Ì;};EA.Ä.close_file=Ã(id){if(Á.files[id]){Á.save_file(id);if(Á.execCommand('file_close',Á.files[id])!==Ì){var li=_$(Á.files[id]['html_id']);li.ÈNode.removeChild(li);if(id==Á.curr_file){var next_file=\"\";var is_next=Ì;for(var i in Á.files){if(is_next){next_file=i;break;}\nelse if(i==id)is_next=Ë;\nelse next_file=i;}Á.switch_to_file(next_file);}delete(Á.files[id]);Á.update_size();}}};EA.Ä.save_file=Ã(id){var t=Á,save,a_links,a_selects,save_butt,img,i;if(t.files[id]){var save=t.files[id];save['É']=t.É;save['last_text_to_highlight']=t.last_text_to_highlight;save['last_hightlighted_text']=t.last_hightlighted_text;save['previous']=t.previous;save['next']=t.next;save['last_undo']=t.last_undo;save['smooth_selection']=t.smooth_selection;save['do_highlight']=t.do_highlight;save['syntax']=t.Å['syntax'];save['text']=t.Â.Ê;save['scroll_top']=t.result.scrollTop;save['scroll_left']=t.result.scrollLeft;save['selection_start']=t.É[\"selectionStart\"];save['selection_end']=t.É[\"selectionEnd\"];save['font_size']=t.Å[\"font_size\"];save['font_family']=t.Å[\"font_family\"];save['word_wrap']=t.Å[\"word_wrap\"];save['toolbar']={'links':{},'selects':{}};a_links=_$(\"toolbar_1\").getElementsByTagName(\"a\");for(i=0;i<a_links.Æ;i++){if(a_links[i].getAttribute('fileSpecific')=='yes'){save_butt={};img=a_links[i].getElementsByTagName('img')[0];save_butt['classLock']=img.classLock;save_butt['className']=img.className;save_butt['oldClassName']=img.oldClassName;save['toolbar']['links'][a_links[i].id]=save_butt;}}a_selects=_$(\"toolbar_1\").getElementsByTagName(\"select\");for(i=0;i<a_selects.Æ;i++){if(a_selects[i].getAttribute('fileSpecific')=='yes'){save['toolbar']['selects'][a_selects[i].id]=a_selects[i].Ê;}}t.files[id]=save;return save;}return Ì;};EA.Ä.update_file=Ã(id,new_Ês){for(var i in new_Ês){Á.files[id][i]=new_Ês[i];}};EA.Ä.display_file=Ã(id){var t=Á,a=t.Â,new_file,a_lis,a_selects,a_links,a_options,i,j;if(id==''){a.readOnly=Ë;t.tab_browsing_area.Ç.display=\"none\";_$(\"no_file_selected\").Ç.display=\"block\";t.result.className=\"empty\";if(!t.files['']){t.open_file({id:''});}}\nelse if(typeof(t.files[id])=='undefined'){return Ì;}\nelse{t.result.className=\"\";a.readOnly=!t.is_editable;_$(\"no_file_selected\").Ç.display=\"none\";t.tab_browsing_area.Ç.display=\"block\";}t.check_redo(Ë);t.check_undo(Ë);t.curr_file=id;a_lis=t.tab_browsing_area.getElementsByTagName('li');for(i=0;i<a_lis.Æ;i++){if(a_lis[i].id==t.files[id]['html_id'])a_lis[i].className='selected';\nelse a_lis[i].className='';}new_file=t.files[id];a.Ê=new_file['text'];t.set_font(new_file['font_family'],new_file['font_size']);t.area_select(new_file['selection_start'],new_file['selection_end']-new_file['selection_start']);t.manage_size(Ë);t.result.scrollTop=new_file['scroll_top'];t.result.scrollLeft=new_file['scroll_left'];t.previous=new_file['previous'];t.next=new_file['next'];t.last_undo=new_file['last_undo'];t.check_redo(Ë);t.check_undo(Ë);t.execCommand(\"change_highlight\",new_file['do_highlight']);t.execCommand(\"change_syntax\",new_file['syntax']);t.execCommand(\"change_smooth_selection_mode\",new_file['smooth_selection']);t.execCommand(\"set_word_wrap\",new_file['word_wrap']);a_links=new_file['toolbar']['links'];for(i in a_links){if(img=_$(i).getElementsByTagName('img')[0]){img.classLock=a_links[i]['classLock'];img.className=a_links[i]['className'];img.oldClassName=a_links[i]['oldClassName'];}}a_selects=new_file['toolbar']['selects'];for(i in a_selects){a_options=_$(i).options;for(j=0;j<a_options.Æ;j++){if(a_options[j].Ê==a_selects[i])_$(i).options[j].selected=Ë;}}};EA.Ä.switch_to_file=Ã(file_to_show,force_refresh){if(file_to_show!=Á.curr_file||force_refresh){Á.save_file(Á.curr_file);if(Á.curr_file!='')Á.execCommand('file_switch_off',Á.files[Á.curr_file]);Á.display_file(file_to_show);if(file_to_show!='')Á.execCommand('file_switch_on',Á.files[file_to_show]);}};EA.Ä.get_file=Ã(id){if(id==Á.curr_file)Á.save_file(id);return Á.files[id];};EA.Ä.get_all_files=Ã(){tmp_files=Á.files;Á.save_file(Á.curr_file);if(tmp_files[''])delete(Á.files['']);return tmp_files;};EA.Ä.check_file_changes=Ã(){var id=Á.curr_file;if(Á.files[id]&&Á.files[id]['compare_edited_text']!=undefined){if(Á.files[id]['compare_edited_text'].Æ==Á.Â.Ê.Æ&&Á.files[id]['compare_edited_text']==Á.Â.Ê){if(Á.files[id]['edited']!=Ì)Á.set_file_edited_mode(id,Ì);}\nelse{if(Á.files[id]['edited']!=Ë)Á.set_file_edited_mode(id,Ë);}}};EA.Ä.set_file_edited_mode=Ã(id,to){if(Á.files[id]&&_$(Á.files[id]['html_id'])){var link=_$(Á.files[id]['html_id']).getElementsByTagName('a')[0];if(to==Ë){link.className='edited';}\nelse{link.className='';if(id==Á.curr_file)text=Á.Â.Ê;\nelse text=Á.files[id]['text'];Á.files[id]['compare_edited_text']=text;}Á.files[id]['edited']=to;}};EA.Ä.set_show_line_colors=Ã(new_Ê){Á.show_line_colors=new_Ê;if(new_Ê)Á.selection_field.className+=' show_colors';\nelse Á.selection_field.className=Á.selection_field.className.replace(/ show_colors/g,'');};var EA_keys={8:\"Retour arriere\",9:\"Tabulation\",12:\"Milieu(pave numerique)\",13:\"Entrer\",16:\"Shift\",17:\"Ctrl\",18:\"Alt\",19:\"Pause\",20:\"Verr Maj\",27:\"Esc\",32:\"Space\",33:\"Page up\",34:\"Page down\",35:\"End\",36:\"Begin\",37:\"Left\",38:\"Up\",39:\"Right\",40:\"Down\",44:\"Impr ecran\",45:\"Inser\",46:\"Suppr\",91:\"Menu Demarrer Windows / touche pomme Mac\",92:\"Menu Demarrer Windows\",93:\"Menu contextuel Windows\",112:\"F1\",113:\"F2\",114:\"F3\",115:\"F4\",116:\"F5\",117:\"F6\",118:\"F7\",119:\"F8\",120:\"F9\",121:\"F10\",122:\"F11\",123:\"F12\",144:\"Verr Num\",145:\"Arret defil\"};Ã keyDown(e){if(!e){e=event;}for(var i in eA.plugins){if(typeof(eA.plugins[i].onkeydown)==\"Ã\"){if(eA.plugins[i].onkeydown(e)===Ì){if(eA.isIE)e.keyCode=0;return Ì;}}}var target_id=(e.target||e.srcElement).id;var use=Ì;if(EA_keys[e.keyCode])letter=EA_keys[e.keyCode];\nelse letter=String.fromCharCode(e.keyCode);var low_letter=letter.toLowerCase();if(letter==\"Page up\"&&!AltPressed(e)&&!eA.isOpera){eA.execCommand(\"scroll_page\",{\"dir\":\"up\",\"shift\":ShiftPressed(e)});use=Ë;}\nelse if(letter==\"Page down\"&&!AltPressed(e)&&!eA.isOpera){eA.execCommand(\"scroll_page\",{\"dir\":\"down\",\"shift\":ShiftPressed(e)});use=Ë;}\nelse if(eA.is_editable==Ì){return Ë;}\nelse if(letter==\"Tabulation\"&&target_id==\"Â\"&&!CtrlPressed(e)&&!AltPressed(e)){if(ShiftPressed(e))eA.execCommand(\"invert_tab_selection\");\nelse eA.execCommand(\"tab_selection\");use=Ë;if(eA.isOpera||(eA.isFirefox&&eA.isMac))setTimeout(\"eA.execCommand('focus');\",1);}\nelse if(letter==\"Entrer\"&&target_id==\"Â\"){if(eA.press_enter())use=Ë;}\nelse if(letter==\"Entrer\"&&target_id==\"area_search\"){eA.execCommand(\"area_search\");use=Ë;}\nelse if(letter==\"Esc\"){eA.execCommand(\"close_all_inline_popup\",e);use=Ë;}\nelse if(CtrlPressed(e)&&!AltPressed(e)&&!ShiftPressed(e)){switch(low_letter){case \"f\":eA.execCommand(\"area_search\");use=Ë;break;case \"r\":eA.execCommand(\"area_replace\");use=Ë;break;case \"q\":eA.execCommand(\"close_all_inline_popup\",e);use=Ë;break;case \"h\":eA.execCommand(\"change_highlight\");use=Ë;break;case \"g\":setTimeout(\"eA.execCommand('go_to_line');\",5);use=Ë;break;case \"e\":eA.execCommand(\"show_help\");use=Ë;break;case \"z\":use=Ë;eA.execCommand(\"undo\");break;case \"y\":use=Ë;eA.execCommand(\"redo\");break;default:break;}}if(eA.next.Æ > 0){setTimeout(\"eA.check_redo();\",10);}setTimeout(\"eA.check_file_changes();\",10);if(use){if(eA.isIE)e.keyCode=0;return Ì;}return Ë;};Ã AltPressed(e){if(window.event){return(window.event.altKey);}\nelse{if(e.modifiers)return(e.altKey||(e.modifiers % 2));\nelse return e.altKey;}};Ã CtrlPressed(e){if(window.event){return(window.event.ctrlKey);}\nelse{return(e.ctrlKey||(e.modifiers==2)||(e.modifiers==3)||(e.modifiers>5));}};Ã ShiftPressed(e){if(window.event){return(window.event.shiftKey);}\nelse{return(e.shiftKey||(e.modifiers>3));}}; EA.Ä.show_search=Ã(){if(_$(\"area_search_replace\").Ç.visibility==\"visible\"){Á.hidden_search();}\nelse{Á.open_inline_popup(\"area_search_replace\");var text=Á.area_get_selection();var search=text.split(\"\\n\")[0];_$(\"area_search\").Ê=search;_$(\"area_search\").focus();}};EA.Ä.hidden_search=Ã(){Á.close_inline_popup(\"area_search_replace\");};EA.Ä.area_search=Ã(mode){if(!mode)mode=\"search\";_$(\"area_search_msg\").innerHTML=\"\";var search=_$(\"area_search\").Ê;Á.Â.focus();Á.Â.ÂFocused=Ë;var infos=Á.get_selection_infos();var start=infos[\"selectionStart\"];var pos=-1;var pos_begin=-1;var Æ=search.Æ;if(_$(\"area_search_replace\").Ç.visibility!=\"visible\"){Á.show_search();return;}if(search.Æ==0){_$(\"area_search_msg\").innerHTML=Á.get_translation(\"search_field_empty\");return;}if(mode!=\"replace\"){if(_$(\"area_search_reg_exp\").checked)start++;\nelse start+=search.Æ;}if(_$(\"area_search_reg_exp\").checked){var opt=\"m\";if(!_$(\"area_search_match_case\").checked)opt+=\"i\";var reg=new RegExp(search,opt);pos=infos[\"full_text\"].substr(start).search(reg);pos_begin=infos[\"full_text\"].search(reg);if(pos!=-1){pos+=start;Æ=infos[\"full_text\"].substr(start).match(reg)[0].Æ;}\nelse if(pos_begin!=-1){Æ=infos[\"full_text\"].match(reg)[0].Æ;}}\nelse{if(_$(\"area_search_match_case\").checked){pos=infos[\"full_text\"].indexOf(search,start);pos_begin=infos[\"full_text\"].indexOf(search);}\nelse{pos=infos[\"full_text\"].toLowerCase().indexOf(search.toLowerCase(),start);pos_begin=infos[\"full_text\"].toLowerCase().indexOf(search.toLowerCase());}}if(pos==-1&&pos_begin==-1){_$(\"area_search_msg\").innerHTML=\"<strong>\"+search+\"</strong> \"+Á.get_translation(\"not_found\");return;}\nelse if(pos==-1&&pos_begin !=-1){begin=pos_begin;_$(\"area_search_msg\").innerHTML=Á.get_translation(\"restart_search_at_begin\");}\nelse begin=pos;if(mode==\"replace\"&&pos==infos[\"indexOfCursor\"]){var replace=_$(\"area_replace\").Ê;var new_text=\"\";if(_$(\"area_search_reg_exp\").checked){var opt=\"m\";if(!_$(\"area_search_match_case\").checked)opt+=\"i\";var reg=new RegExp(search,opt);new_text=infos[\"full_text\"].substr(0,begin)+infos[\"full_text\"].substr(start).replace(reg,replace);}\nelse{new_text=infos[\"full_text\"].substr(0,begin)+replace+infos[\"full_text\"].substr(begin+Æ);}Á.Â.Ê=new_text;Á.area_select(begin,Æ);Á.area_search();}\nelse Á.area_select(begin,Æ);};EA.Ä.area_replace=Ã(){Á.area_search(\"replace\");};EA.Ä.area_replace_all=Ã(){var base_text=Á.Â.Ê;var search=_$(\"area_search\").Ê;var replace=_$(\"area_replace\").Ê;if(search.Æ==0){_$(\"area_search_msg\").innerHTML=Á.get_translation(\"search_field_empty\");return;}var new_text=\"\";var nb_change=0;if(_$(\"area_search_reg_exp\").checked){var opt=\"mg\";if(!_$(\"area_search_match_case\").checked)opt+=\"i\";var reg=new RegExp(search,opt);nb_change=infos[\"full_text\"].match(reg).Æ;new_text=infos[\"full_text\"].replace(reg,replace);}\nelse{if(_$(\"area_search_match_case\").checked){var tmp_tab=base_text.split(search);nb_change=tmp_tab.Æ-1;new_text=tmp_tab.join(replace);}\nelse{var lower_Ê=base_text.toLowerCase();var lower_search=search.toLowerCase();var start=0;var pos=lower_Ê.indexOf(lower_search);while(pos!=-1){nb_change++;new_text+=Á.Â.Ê.substring(start,pos)+replace;start=pos+search.Æ;pos=lower_Ê.indexOf(lower_search,pos+1);}new_text+=Á.Â.Ê.substring(start);}}if(new_text==base_text){_$(\"area_search_msg\").innerHTML=\"<strong>\"+search+\"</strong> \"+Á.get_translation(\"not_found\");}\nelse{Á.Â.Ê=new_text;_$(\"area_search_msg\").innerHTML=\"<strong>\"+nb_change+\"</strong> \"+Á.get_translation(\"occurrence_replaced\");setTimeout(\"eA.Â.focus();eA.Â.ÂFocused=Ë;\",100);}}; EA.Ä.change_highlight=Ã(change_to){if(Á.Å[\"syntax\"].Æ==0&&change_to==Ì){Á.switchClassSticky(_$(\"highlight\"),'editAreaButtonDisabled',Ë);Á.switchClassSticky(_$(\"reset_highlight\"),'editAreaButtonDisabled',Ë);return Ì;}if(Á.do_highlight==change_to)return Ì;Á.getIESelection();var pos_start=Á.Â.selectionStart;var pos_end=Á.Â.selectionEnd;if(Á.do_highlight===Ë||change_to==Ì)Á.disable_highlight();\nelse Á.enable_highlight();Á.Â.focus();Á.Â.selectionStart=pos_start;Á.Â.selectionEnd=pos_end;Á.setIESelection();};EA.Ä.disable_highlight=Ã(displayOnly){var t=Á,a=t.Â,new_Obj,old_class,new_class;t.selection_field.innerHTML=\"\";t.selection_field_text.innerHTML=\"\";t.content_highlight.Ç.visibility=\"hidden\";new_Obj=t.content_highlight.cloneNode(Ì);new_Obj.innerHTML=\"\";t.content_highlight.ÈNode.insertBefore(new_Obj,t.content_highlight);t.content_highlight.ÈNode.removeChild(t.content_highlight);t.content_highlight=new_Obj;old_class=È.getAttribute(a,\"class\");if(old_class){new_class=old_class.replace(\"hidden\",\"\");È.setAttribute(a,\"class\",new_class);}a.Ç.backgroundColor=\"transÈ\";t.switchClassSticky(_$(\"highlight\"),'editAreaButtonNormal',Ë);t.switchClassSticky(_$(\"reset_highlight\"),'editAreaButtonDisabled',Ë);t.do_highlight=Ì;t.switchClassSticky(_$(\"change_smooth_selection\"),'editAreaButtonSelected',Ë);if(typeof(t.smooth_selection_before_highlight)!=\"undefined\"&&t.smooth_selection_before_highlight===Ì){t.change_smooth_selection_mode(Ì);}};EA.Ä.enable_highlight=Ã(){var t=Á,a=t.Â,new_class;t.show_waiting_screen();t.content_highlight.Ç.visibility=\"visible\";new_class=È.getAttribute(a,\"class\")+\" hidden\";È.setAttribute(a,\"class\",new_class);if(t.isIE)a.Ç.backgroundColor=\"#FFFFFF\";t.switchClassSticky(_$(\"highlight\"),'editAreaButtonSelected',Ì);t.switchClassSticky(_$(\"reset_highlight\"),'editAreaButtonNormal',Ì);t.smooth_selection_before_highlight=t.smooth_selection;if(!t.smooth_selection)t.change_smooth_selection_mode(Ë);t.switchClassSticky(_$(\"change_smooth_selection\"),'editAreaButtonDisabled',Ë);t.do_highlight=Ë;t.resync_highlight();t.hide_waiting_screen();};EA.Ä.maj_highlight=Ã(infos){var debug_opti=\"\",tps_start=new Date().getTime(),tps_middle_opti=new Date().getTime();var t=Á,hightlighted_text,updated_highlight;var textToHighlight=infos[\"full_text\"],doSyntaxOpti=Ì,doHtmlOpti=Ì,stay_begin=\"\",stay_end=\"\",trace_new,trace_last;if(t.last_text_to_highlight==infos[\"full_text\"]&&t.resync_highlight!==Ë)return;if(t.reload_highlight===Ë){t.reload_highlight=Ì;}\nelse if(textToHighlight.Æ==0){textToHighlight=\"\\n \";}\nelse{changes=t.checkTextEvolution(t.last_text_to_highlight,textToHighlight);trace_new=t.get_syntax_trace(changes.newTextLine).replace(/\\r/g,'');trace_last=t.get_syntax_trace(changes.lastTextLine).replace(/\\r/g,'');doSyntaxOpti=(trace_new==trace_last);if(!doSyntaxOpti&&trace_new==\"\\n\"+trace_last&&/^[ \t\s]*\\n[ \t\s]*$/.test(changes.newText.replace(/\\r/g,''))&&changes.lastText==\"\"){doSyntaxOpti=Ë;}if(doSyntaxOpti){tps_middle_opti=new Date().getTime();stay_begin=t.last_hightlighted_text.split(\"\\n\").slice(0,changes.lineStart).join(\"\\n\");if(changes.lineStart>0)stay_begin+=\"\\n\";stay_end=t.last_hightlighted_text.split(\"\\n\").slice(changes.lineLastEnd+1).join(\"\\n\");if(stay_end.Æ>0)stay_end=\"\\n\"+stay_end;if(stay_begin.split('<span').Æ !=stay_begin.split('</span').Æ||stay_end.split('<span').Æ !=stay_end.split('</span').Æ){doSyntaxOpti=Ì;stay_end='';stay_begin='';}\nelse{if(stay_begin.Æ==0&&changes.posLastEnd==-1)changes.newTextLine+=\"\\n\";textToHighlight=changes.newTextLine;}}if(t.Å[\"debug\"]){var ch=changes;debug_opti=(doSyntaxOpti?\"Optimisation\":\"No optimisation\")+\" start:\"+ch.posStart+\"(\"+ch.lineStart+\")\"+\" end_new:\"+ch.posNewEnd+\"(\"+ch.lineNewEnd+\")\"+\" end_last:\"+ch.posLastEnd+\"(\"+ch.lineLastEnd+\")\"+\"\\nchanged_text:\"+ch.newText+\"=> trace:\"+trace_new+\"\\nchanged_last_text:\"+ch.lastText+\"=> trace:\"+trace_last+\"\\nchanged_line:\"+ch.newTextLine+\"\\nlast_changed_line:\"+ch.lastTextLine+\"\\nstay_begin:\"+stay_begin.slice(-100)+\"\\nstay_end:\"+stay_end.substr(0,100);+\"\\n\";}}tps_end_opti=new Date().getTime();updated_highlight=t.colorize_text(textToHighlight);tpsAfterReg=new Date().getTime();doSyntaxOpti=doHtmlOpti=Ì;if(doSyntaxOpti){try{var replacedBloc,i,nbStart='',nbEnd='',newHtml,ÆOld,ÆNew;replacedBloc=t.last_hightlighted_text.substring(stay_begin.Æ,t.last_hightlighted_text.Æ-stay_end.Æ);ÆOld=replacedBloc.Æ;ÆNew=updated_highlight.Æ;for(i=0;i < ÆOld&&i < ÆNew&&replacedBloc.charAt(i)==updated_highlight.charAt(i);i++){}nbStart=i;for(i=0;i+nbStart < ÆOld&&i+nbStart < ÆNew&&replacedBloc.charAt(ÆOld-i-1)==updated_highlight.charAt(ÆNew-i-1);i++){}nbEnd=i;lastHtml=replacedBloc.substring(nbStart,ÆOld-nbEnd);newHtml=updated_highlight.substring(nbStart,ÆNew-nbEnd);if(newHtml.indexOf('<span')==-1&&newHtml.indexOf('</span')==-1&&lastHtml.indexOf('<span')==-1&&lastHtml.indexOf('</span')==-1){var beginStr,nbOpendedSpan,nbClosedSpan,nbUnchangedChars,span,textNode;doHtmlOpti=Ë;beginStr=t.last_hightlighted_text.substr(0,stay_begin.Æ+nbStart);newHtml=newHtml.replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');nbOpendedSpan=beginStr.split('<span').Æ-1;nbClosedSpan=beginStr.split('</span').Æ-1;span=t.content_highlight.getElementsByTagName('span')[ nbOpendedSpan ];ÈSpan=span;maxStartOffset=maxEndOffset=0;if(nbOpendedSpan==nbClosedSpan){while(ÈSpan.ÈNode !=t.content_highlight&&ÈSpan.ÈNode.tagName !='PRE'){ÈSpan=ÈSpan.ÈNode;}}\nelse{maxStartOffset=maxEndOffset=beginStr.Æ+1;nbClosed=beginStr.substr(Math.max(0,beginStr.lastIndexOf('<span',maxStartOffset-1))).split('</span').Æ-1;while(nbClosed > 0){nbClosed--;ÈSpan=ÈSpan.ÈNode;}while(ÈSpan.ÈNode !=t.content_highlight&&ÈSpan.ÈNode.tagName !='PRE'&&(tmpMaxStartOffset=Math.max(0,beginStr.lastIndexOf('<span',maxStartOffset-1)))<(tmpMaxEndOffset=Math.max(0,beginStr.lastIndexOf('</span',maxEndOffset-1)))){maxStartOffset=tmpMaxStartOffset;maxEndOffset=tmpMaxEndOffset;}}if(ÈSpan.ÈNode==t.content_highlight||ÈSpan.ÈNode.tagName=='PRE'){maxStartOffset=Math.max(0,beginStr.indexOf('<span'));}if(maxStartOffset==beginStr.Æ){nbSubSpanBefore=0;}\nelse{lastEndPos=Math.max(0,beginStr.lastIndexOf('>',maxStartOffset));nbSubSpanBefore=beginStr.substr(lastEndPos).split('<span').Æ-1;}if(nbSubSpanBefore==0){textNode=ÈSpan.firstChild;}\nelse{lastSubSpan=ÈSpan.getElementsByTagName('span')[ nbSubSpanBefore-1 ];while(lastSubSpan.ÈNode !=ÈSpan){lastSubSpan=lastSubSpan.ÈNode;}if(lastSubSpan.nextSibling==null||lastSubSpan.nextSibling.nodeType !=3){textNode=document.createTextNode('');lastSubSpan.ÈNode.insertBefore(textNode,lastSubSpan.nextSibling);}\nelse{textNode=lastSubSpan.nextSibling;}}if((lastIndex=beginStr.lastIndexOf('>'))==-1){nbUnchangedChars=beginStr.Æ;}\nelse{nbUnchangedChars=beginStr.substr(lastIndex+1).replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&').Æ;}if(t.isIE){nbUnchangedChars-=(beginStr.substr(beginStr.Æ-nbUnchangedChars).split(\"\\n\").Æ-1);textNode.replaceData(nbUnchangedChars,lastHtml.replace(/\\n/g,'').Æ,newHtml.replace(/\\n/g,''));}\nelse{textNode.replaceData(nbUnchangedChars,lastHtml.Æ,newHtml);}}}catch(e){doHtmlOpti=Ì;}}tpsAfterOpti2=new Date().getTime();hightlighted_text=stay_begin+updated_highlight+stay_end;if(!doHtmlOpti){var new_Obj=t.content_highlight.cloneNode(Ì);if((t.isIE&&t.isIE < 8)||(t.isOpera&&t.isOpera < 9.6))new_Obj.innerHTML=\"<pre><span class='\"+t.Å[\"syntax\"]+\"'>\"+hightlighted_text+\"</span></pre>\";\nelse new_Obj.innerHTML=\"<span class='\"+t.Å[\"syntax\"]+\"'>\"+hightlighted_text+\"</span>\";t.content_highlight.ÈNode.replaceChild(new_Obj,t.content_highlight);t.content_highlight=new_Obj;}t.last_text_to_highlight=infos[\"full_text\"];t.last_hightlighted_text=hightlighted_text;tps3=new Date().getTime();if(t.Å[\"debug\"]){t.debug.Ê=\"Tps optimisation \"+(tps_end_opti-tps_start)+\" | tps reg exp:\"+(tpsAfterReg-tps_end_opti)+\" | tps opti HTML:\"+(tpsAfterOpti2-tpsAfterReg)+' '+(doHtmlOpti ? 'yes':'no')+\" | tps update highlight content:\"+(tps3-tpsAfterOpti2)+\" | tpsTotal:\"+(tps3-tps_start)+\"(\"+tps3+\")\\n\"+debug_opti;}};EA.Ä.resync_highlight=Ã(reload_now){Á.reload_highlight=Ë;Á.last_text_to_highlight=\"\";Á.focus();if(reload_now)Á.check_line_selection(Ì);}; EA.Ä.comment_or_quote=Ã(){var new_class=\"\",close_tag=\"\",sy,arg,i;sy=È.eAL.syntax[eA.current_code_lang];arg=EA.Ä.comment_or_quote.arguments[0];for(i in sy[\"quotes\"]){if(arg.indexOf(i)==0){new_class=\"quotesmarks\";close_tag=sy[\"quotes\"][i];}}if(new_class.Æ==0){for(var i in sy[\"comments\"]){if(arg.indexOf(i)==0){new_class=\"comments\";close_tag=sy[\"comments\"][i];}}}if(close_tag==\"\\n\"){return \"µ__\"+new_class+\"__µ\"+arg.replace(/(\\r?\\n)?$/m,\"µ_END_µ$1\");}\nelse{reg=new RegExp(È.eAL.get_escaped_regexp(close_tag)+\"$\",\"m\");if(arg.search(reg)!=-1)return \"µ__\"+new_class+\"__µ\"+arg+\"µ_END_µ\";\nelse return \"µ__\"+new_class+\"__µ\"+arg;}};EA.Ä.get_syntax_trace=Ã(text){if(Á.Å[\"syntax\"].Æ>0&&È.eAL.syntax[Á.Å[\"syntax\"]][\"syntax_trace_regexp\"])return text.replace(È.eAL.syntax[Á.Å[\"syntax\"]][\"syntax_trace_regexp\"],\"$3\");};EA.Ä.colorize_text=Ã(text){text=\" \"+text;if(Á.Å[\"syntax\"].Æ>0)text=Á.apply_syntax(text,Á.Å[\"syntax\"]);return text.substr(1).replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(/µ_END_µ/g,\"</span>\").replace(/µ__([a-zA-Z0-9]+)__µ/g,\"<span class='$1'>\");};EA.Ä.apply_syntax=Ã(text,lang){var sy;Á.current_code_lang=lang;if(!È.eAL.syntax[lang])return text;sy=È.eAL.syntax[lang];if(sy[\"custom_regexp\"]['before']){for(var i in sy[\"custom_regexp\"]['before']){var convert=\"$1µ__\"+sy[\"custom_regexp\"]['before'][i]['class']+\"__µ$2µ_END_µ$3\";text=text.replace(sy[\"custom_regexp\"]['before'][i]['regexp'],convert);}}if(sy[\"comment_or_quote_reg_exp\"]){text=text.replace(sy[\"comment_or_quote_reg_exp\"],Á.comment_or_quote);}if(sy[\"keywords_reg_exp\"]){for(var i in sy[\"keywords_reg_exp\"]){text=text.replace(sy[\"keywords_reg_exp\"][i],'µ__'+i+'__µ$2µ_END_µ');}}if(sy[\"delimiters_reg_exp\"]){text=text.replace(sy[\"delimiters_reg_exp\"],'µ__delimiters__µ$1µ_END_µ');}if(sy[\"operators_reg_exp\"]){text=text.replace(sy[\"operators_reg_exp\"],'µ__operators__µ$1µ_END_µ');}if(sy[\"custom_regexp\"]['after']){for(var i in sy[\"custom_regexp\"]['after']){var convert=\"$1µ__\"+sy[\"custom_regexp\"]['after'][i]['class']+\"__µ$2µ_END_µ$3\";text=text.replace(sy[\"custom_regexp\"]['after'][i]['regexp'],convert);}}return text;};var editArea= eA;EditArea=EA;</script>".replace(/Á/g,'this').replace(/Â/g,'textarea').replace(/Ã/g,'function').replace(/Ä/g,'prototype').replace(/Å/g,'settings').replace(/Æ/g,'length').replace(/Ç/g,'style').replace(/È/g,'parent').replace(/É/g,'last_selection').replace(/Ê/g,'value').replace(/Ë/g,'true').replace(/Ì/g,'false'); | |
37 | +editAreaLoader.template= "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" > <head> <title>EditArea</title> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/> [__CSSRULES__] [__JSCODE__] </head> <body> <div id='editor'> <div class='area_toolbar' id='toolbar_1'>[__TOOLBAR__]</div> <div class='area_toolbar' id='tab_browsing_area'><ul id='tab_browsing_list' class='menu'> <li> </li> </ul></div> <div id='result'> <div id='no_file_selected'></div> <div id='container'> <div id='cursor_pos' class='edit_area_cursor'> </div> <div id='end_bracket' class='edit_area_cursor'> </div> <div id='selection_field'></div> <div id='line_number' selec='none'></div> <div id='content_highlight'></div> <div id='test_font_size'></div> <div id='selection_field_text'></div> <textarea id='textarea' wrap='off' onchange='editArea.execCommand(\"onchange\");' onfocus='javascript:editArea.textareaFocused=true;' onblur='javascript:editArea.textareaFocused=false;'> </textarea> </div> </div> <div class='area_toolbar' id='toolbar_2'> <table class='statusbar' cellspacing='0' cellpadding='0'> <tr> <td class='total' selec='none'>{$position}:</td> <td class='infos' selec='none'> {$line_abbr} <span id='linePos'>0</span>, {$char_abbr} <span id='currPos'>0</span> </td> <td class='total' selec='none'>{$total}:</td> <td class='infos' selec='none'> {$line_abbr} <span id='nbLine'>0</span>, {$char_abbr} <span id='nbChar'>0</span> </td> <td class='resize'> <span id='resize_area'><img src='[__BASEURL__]images/statusbar_resize.gif' alt='resize' selec='none'></span> </td> </tr> </table> </div> </div> <div id='processing'> <div id='processing_text'> {$processing} </div> </div> <div id='area_search_replace' class='editarea_popup'> <table cellspacing='2' cellpadding='0' style='width: 100%'> <tr> <td selec='none'>{$search}</td> <td><input type='text' id='area_search' /></td> <td id='close_area_search_replace'> <a onclick='Javascript:editArea.execCommand(\"hidden_search\")'><img selec='none' src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a><br /> </tr><tr> <td selec='none'>{$replace}</td> <td><input type='text' id='area_replace' /></td> <td><img id='move_area_search_replace' onmousedown='return parent.start_move_element(event,\"area_search_replace\", parent.frames[\"frame_\"+editArea.id]);' src='[__BASEURL__]images/move.gif' alt='{$move_popup}' title='{$move_popup}' /></td> </tr> </table> <div class='button'> <input type='checkbox' id='area_search_match_case' /><label for='area_search_match_case' selec='none'>{$match_case}</label> <input type='checkbox' id='area_search_reg_exp' /><label for='area_search_reg_exp' selec='none'>{$reg_exp}</label> <br /> <a onclick='Javascript:editArea.execCommand(\"area_search\")' selec='none'>{$find_next}</a> <a onclick='Javascript:editArea.execCommand(\"area_replace\")' selec='none'>{$replace}</a> <a onclick='Javascript:editArea.execCommand(\"area_replace_all\")' selec='none'>{$replace_all}</a><br /> </div> <div id='area_search_msg' selec='none'></div> </div> <div id='edit_area_help' class='editarea_popup'> <div class='close_popup'> <a onclick='Javascript:editArea.execCommand(\"close_all_inline_popup\")'><img src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a> </div> <div><h2>Editarea [__EA_VERSION__]</h2><br /> <h3>{$shortcuts}:</h3> {$tab}: {$add_tab}<br /> {$shift}+{$tab}: {$remove_tab}<br /> {$ctrl}+f: {$search_command}<br /> {$ctrl}+r: {$replace_command}<br /> {$ctrl}+h: {$highlight}<br /> {$ctrl}+g: {$go_to_line}<br /> {$ctrl}+z: {$undo}<br /> {$ctrl}+y: {$redo}<br /> {$ctrl}+e: {$help}<br /> {$ctrl}+q, {$esc}: {$close_popup}<br /> {$accesskey} E: {$toggle}<br /> <br /> <em>{$about_notice}</em> <br /><div class='copyright'>© Christophe Dolivet 2007-2010</div> </div> </div> </body> </html> "; | |
38 | +editAreaLoader.iframe_css= "<style>body,html{margin:0;padding:0;height:100%;border:none;overflow:hidden;background-color:#FFF;}body,html,table,form,textarea{font:12px monospace,sans-serif;}#editor{border:solid #888 1px;overflow:hidden;}#result{z-index:4;overflow-x:auto;overflow-y:scroll;border-top:solid #888 1px;border-bottom:solid #888 1px;position:relative;clear:both;}#result.empty{overflow:hidden;}#container{overflow:hidden;border:solid blue 0;position:relative;z-index:10;padding:0 5px 0 45px;}#textarea{position:relative;top:0;left:0;margin:0;padding:0;width:100%;height:100%;overflow:hidden;z-index:7;border-width:0;background-color:transparent;resize:none;}#textarea,#textarea:hover{outline:none;}#content_highlight{white-space:pre;margin:0;padding:0;position:absolute;z-index:4;overflow:visible;}#selection_field,#selection_field_text{margin:0;background-color:#E1F2F9;position:absolute;z-index:5;top:-100px;padding:0;white-space:pre;overflow:hidden;}#selection_field.show_colors {z-index:3;background-color:#EDF9FC;}#selection_field strong{font-weight:normal;}#selection_field.show_colors *,#selection_field_text * {visibility:hidden;}#selection_field_text{background-color:transparent;}#selection_field_text strong{font-weight:normal;background-color:#3399FE;color:#FFF;visibility:visible;}#container.word_wrap #content_highlight,#container.word_wrap #selection_field,#container.word_wrap #selection_field_text,#container.word_wrap #test_font_size{white-space:pre-wrap;white-space:-moz-pre-wrap !important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;width:99%;}#line_number{position:absolute;overflow:hidden;border-right:solid black 1px;z-index:8;width:38px;padding:0 5px 0 0;margin:0 0 0 -45px;text-align:right;color:#AAAAAA;}#test_font_size{padding:0;margin:0;visibility:hidden;position:absolute;white-space:pre;}pre{margin:0;padding:0;}.hidden{opacity:0.2;filter:alpha(opacity=20);}#result .edit_area_cursor{position:absolute;z-index:6;background-color:#FF6633;top:-100px;margin:0;}#result .edit_area_selection_field .overline{background-color:#996600;}.editarea_popup{border:solid 1px #888888;background-color:#ECE9D8;width:250px;padding:4px;position:absolute;visibility:hidden;z-index:15;top:-500px;}.editarea_popup,.editarea_popup table{font-family:sans-serif;font-size:10pt;}.editarea_popup img{border:0;}.editarea_popup .close_popup{float:right;line-height:16px;border:0;padding:0;}.editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{margin:0;padding:0;}.editarea_popup .copyright{text-align:right;}div#area_search_replace{}div#area_search_replace img{border:0;}div#area_search_replace div.button{text-align:center;line-height:1.7em;}div#area_search_replace .button a{cursor:pointer;border:solid 1px #888888;background-color:#DEDEDE;text-decoration:none;padding:0 2px;color:#000000;white-space:nowrap;}div#area_search_replace a:hover{background-color:#EDEDED;}div#area_search_replace #move_area_search_replace{cursor:move;border:solid 1px #888;}div#area_search_replace #close_area_search_replace{text-align:right;vertical-align:top;white-space:nowrap;}div#area_search_replace #area_search_msg{height:18px;overflow:hidden;border-top:solid 1px #888;margin-top:3px;}#edit_area_help{width:350px;}#edit_area_help div.close_popup{float:right;}.area_toolbar{width:100%;margin:0;padding:0;background-color:#ECE9D8;text-align:center;}.area_toolbar,.area_toolbar table{font:11px sans-serif;}.area_toolbar img{border:0;vertical-align:middle;}.area_toolbar input{margin:0;padding:0;}.area_toolbar select{font-family:'MS Sans Serif',sans-serif,Verdana,Arial;font-size:7pt;font-weight:normal;margin:2px 0 0 0 ;padding:0;vertical-align:top;background-color:#F0F0EE;}table.statusbar{width:100%;}.area_toolbar td.infos{text-align:center;width:130px;border-right:solid 1px #888;border-width:0 1px 0 0;padding:0;}.area_toolbar td.total{text-align:right;width:50px;padding:0;}.area_toolbar td.resize{text-align:right;}.area_toolbar span#resize_area{cursor:nw-resize;visibility:hidden;}.editAreaButtonNormal,.editAreaButtonOver,.editAreaButtonDown,.editAreaSeparator,.editAreaSeparatorLine,.editAreaButtonDisabled,.editAreaButtonSelected {border:0; margin:0; padding:0; background:transparent;margin-top:0;margin-left:1px;padding:0;}.editAreaButtonNormal {border:1px solid #ECE9D8 !important;cursor:pointer;}.editAreaButtonOver {border:1px solid #0A246A !important;cursor:pointer;background-color:#B6BDD2;}.editAreaButtonDown {cursor:pointer;border:1px solid #0A246A !important;background-color:#8592B5;}.editAreaButtonSelected {border:1px solid #C0C0BB !important;cursor:pointer;background-color:#F4F2E8;}.editAreaButtonDisabled {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);-moz-opacity:0.3;opacity:0.3;border:1px solid #F0F0EE !important;cursor:pointer;}.editAreaSeparatorLine {margin:1px 2px;background-color:#C0C0BB;width:2px;height:18px;}#processing{display:none;background-color:#ECE9D8;border:solid #888 1px;position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;text-align:center;}#processing_text{position:absolute;left:50%;top:50%;width:200px;height:20px;margin-left:-100px;margin-top:-10px;text-align:center;}#tab_browsing_area{display:none;background-color:#CCC9A8;border-top:1px solid #888;text-align:left;margin:0;}#tab_browsing_list {padding:0;margin:0;list-style-type:none;white-space:nowrap;}#tab_browsing_list li {float:left;margin:-1px;}#tab_browsing_list a {position:relative;display:block;text-decoration:none;float:left;cursor:pointer;line-height:14px;}#tab_browsing_list a span {display:block;color:#000;background:#ECE9D8;border:1px solid #888;border-width:1px 1px 0;text-align:center;padding:2px 2px 1px 4px;position:relative;}#tab_browsing_list a b {display:block;border-bottom:2px solid #617994;}#tab_browsing_list a .edited {display:none;}#tab_browsing_list a.edited .edited {display:inline;}#tab_browsing_list a img{margin-left:7px;}#tab_browsing_list a.edited img{margin-left:3px;}#tab_browsing_list a:hover span {background:#F4F2E8;border-color:#0A246A;}#tab_browsing_list .selected a span{background:#046380;color:#FFF;}#no_file_selected{height:100%;width:150%;background:#CCC;display:none;z-index:20;position:absolute;}.non_editable #editor{border-width:0 1px;}.non_editable .area_toolbar{display:none;}#auto_completion_area{background:#FFF;border:solid 1px #888;position:absolute;z-index:15;width:280px;height:180px;overflow:auto;display:none;}#auto_completion_area a,#auto_completion_area a:visited{display:block;padding:0 2px 1px;color:#000;text-decoration:none;}#auto_completion_area a:hover,#auto_completion_area a:focus,#auto_completion_area a.focus{background:#D6E1FE;text-decoration:none;}#auto_completion_area ul{margin:0;padding:0;list-style:none inside;}#auto_completion_area li{padding:0;}#auto_completion_area .prefix{font-style:italic;padding:0 3px;}</style>"; | ... | ... |
docs/js/editarea_0_8_2/edit_area/edit_area_functions.js
0 → 100644
1 | + //replace tabulation by the good number of white spaces | |
2 | + EditArea.prototype.replace_tab= function(text){ | |
3 | + return text.replace(/((\n?)([^\t\n]*)\t)/gi, editArea.smartTab); // slower than simple replace... | |
4 | + }; | |
5 | + | |
6 | + // call by the replace_tab function | |
7 | + EditArea.prototype.smartTab= function(){ | |
8 | + val=" "; | |
9 | + return EditArea.prototype.smartTab.arguments[2] + EditArea.prototype.smartTab.arguments[3] + val.substr(0, editArea.tab_nb_char - (EditArea.prototype.smartTab.arguments[3].length)%editArea.tab_nb_char); | |
10 | + }; | |
11 | + | |
12 | + EditArea.prototype.show_waiting_screen= function(){ | |
13 | + width = this.editor_area.offsetWidth; | |
14 | + height = this.editor_area.offsetHeight; | |
15 | + if( !(this.isIE && this.isIE<6) ) | |
16 | + { | |
17 | + width -= 2; | |
18 | + height -= 2; | |
19 | + } | |
20 | + this.processing_screen.style.display= "block"; | |
21 | + this.processing_screen.style.width = width+"px"; | |
22 | + this.processing_screen.style.height = height+"px"; | |
23 | + this.waiting_screen_displayed = true; | |
24 | + }; | |
25 | + | |
26 | + EditArea.prototype.hide_waiting_screen= function(){ | |
27 | + this.processing_screen.style.display="none"; | |
28 | + this.waiting_screen_displayed= false; | |
29 | + }; | |
30 | + | |
31 | + EditArea.prototype.add_style= function(styles){ | |
32 | + if(styles.length>0){ | |
33 | + newcss = document.createElement("style"); | |
34 | + newcss.type="text/css"; | |
35 | + newcss.media="all"; | |
36 | + if(newcss.styleSheet){ // IE | |
37 | + newcss.styleSheet.cssText = styles; | |
38 | + } else { // W3C | |
39 | + newcss.appendChild(document.createTextNode(styles)); | |
40 | + } | |
41 | + document.getElementsByTagName("head")[0].appendChild(newcss); | |
42 | + } | |
43 | + }; | |
44 | + | |
45 | + EditArea.prototype.set_font= function(family, size){ | |
46 | + var t=this, a=this.textarea, s=this.settings, elem_font, i, elem; | |
47 | + // list all elements concerned by font changes | |
48 | + var elems= ["textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "selection_field_text", "line_number"]; | |
49 | + | |
50 | + if(family && family!="") | |
51 | + s["font_family"]= family; | |
52 | + if(size && size>0) | |
53 | + s["font_size"] = size; | |
54 | + if( t.isOpera && t.isOpera < 9.6 ) // opera<9.6 can't manage non monospace font | |
55 | + s['font_family']="monospace"; | |
56 | + | |
57 | + // update the select tag | |
58 | + if( elem_font = _$("area_font_size") ) | |
59 | + { | |
60 | + for( i = 0; i < elem_font.length; i++ ) | |
61 | + { | |
62 | + if( elem_font.options[i].value && elem_font.options[i].value == s["font_size"] ) | |
63 | + elem_font.options[i].selected=true; | |
64 | + } | |
65 | + } | |
66 | + | |
67 | + /* | |
68 | + * somethimes firefox has rendering mistake with non-monospace font for text width in textarea vs in div for changing font size (eg: verdana change between 11pt to 12pt) | |
69 | + * => looks like a browser internal random bug as text width can change while content_highlight is updated | |
70 | + * we'll check if the font-size produce the same text width inside textarea and div and if not, we'll increment the font-size | |
71 | + * | |
72 | + * This is an ugly fix | |
73 | + */ | |
74 | + if( t.isFirefox ) | |
75 | + { | |
76 | + var nbTry = 3; | |
77 | + do { | |
78 | + var div1 = document.createElement( 'div' ), text1 = document.createElement( 'textarea' ); | |
79 | + var styles = { | |
80 | + width: '40px', | |
81 | + overflow: 'scroll', | |
82 | + zIndex: 50, | |
83 | + visibility: 'hidden', | |
84 | + fontFamily: s["font_family"], | |
85 | + fontSize: s["font_size"]+"pt", | |
86 | + lineHeight: t.lineHeight+"px", | |
87 | + padding: '0', | |
88 | + margin: '0', | |
89 | + border: 'none', | |
90 | + whiteSpace: 'nowrap' | |
91 | + }; | |
92 | + var diff, changed = false; | |
93 | + for( i in styles ) | |
94 | + { | |
95 | + div1.style[ i ] = styles[i]; | |
96 | + text1.style[ i ] = styles[i]; | |
97 | + } | |
98 | + // no wrap for this text | |
99 | + text1.wrap = 'off'; | |
100 | + text1.setAttribute('wrap', 'off'); | |
101 | + t.container.appendChild( div1 ); | |
102 | + t.container.appendChild( text1 ); | |
103 | + // try to make FF to bug | |
104 | + div1.innerHTML = text1.value = 'azertyuiopqsdfghjklm'; | |
105 | + div1.innerHTML = text1.value = text1.value+'wxcvbn^p*ù$!:;,,'; | |
106 | + diff = text1.scrollWidth - div1.scrollWidth; | |
107 | + | |
108 | + // firefox return here a diff of 1 px between equals scrollWidth (can't explain) | |
109 | + if( Math.abs( diff ) >= 2 ) | |
110 | + { | |
111 | + s["font_size"]++; | |
112 | + changed = true; | |
113 | + } | |
114 | + t.container.removeChild( div1 ); | |
115 | + t.container.removeChild( text1 ); | |
116 | + nbTry--; | |
117 | + }while( changed && nbTry > 0 ); | |
118 | + } | |
119 | + | |
120 | + | |
121 | + // calc line height | |
122 | + elem = t.test_font_size; | |
123 | + elem.style.fontFamily = ""+s["font_family"]; | |
124 | + elem.style.fontSize = s["font_size"]+"pt"; | |
125 | + elem.innerHTML = "0"; | |
126 | + t.lineHeight = elem.offsetHeight; | |
127 | + | |
128 | + // update font for all concerned elements | |
129 | + for( i=0; i<elems.length; i++) | |
130 | + { | |
131 | + elem = _$(elems[i]); | |
132 | + elem.style.fontFamily = s["font_family"]; | |
133 | + elem.style.fontSize = s["font_size"]+"pt"; | |
134 | + elem.style.lineHeight = t.lineHeight+"px"; | |
135 | + } | |
136 | + // define a css for <pre> tags | |
137 | + t.add_style("pre{font-family:"+s["font_family"]+"}"); | |
138 | + | |
139 | + // old opera and IE>=8 doesn't update font changes to the textarea | |
140 | + if( ( t.isOpera && t.isOpera < 9.6 ) || t.isIE >= 8 ) | |
141 | + { | |
142 | + var parNod = a.parentNode, nxtSib = a.nextSibling, start= a.selectionStart, end= a.selectionEnd; | |
143 | + parNod.removeChild(a); | |
144 | + parNod.insertBefore(a, nxtSib); | |
145 | + t.area_select(start, end-start); | |
146 | + } | |
147 | + | |
148 | + // force update of selection field | |
149 | + this.focus(); | |
150 | + this.update_size(); | |
151 | + this.check_line_selection(); | |
152 | + }; | |
153 | + | |
154 | + EditArea.prototype.change_font_size= function(){ | |
155 | + var size=_$("area_font_size").value; | |
156 | + if(size>0) | |
157 | + this.set_font("", size); | |
158 | + }; | |
159 | + | |
160 | + | |
161 | + EditArea.prototype.open_inline_popup= function(popup_id){ | |
162 | + this.close_all_inline_popup(); | |
163 | + var popup= _$(popup_id); | |
164 | + var editor= _$("editor"); | |
165 | + | |
166 | + // search matching icon | |
167 | + for(var i=0; i<this.inlinePopup.length; i++){ | |
168 | + if(this.inlinePopup[i]["popup_id"]==popup_id){ | |
169 | + var icon= _$(this.inlinePopup[i]["icon_id"]); | |
170 | + if(icon){ | |
171 | + this.switchClassSticky(icon, 'editAreaButtonSelected', true); | |
172 | + break; | |
173 | + } | |
174 | + } | |
175 | + } | |
176 | + // check size | |
177 | + popup.style.height="auto"; | |
178 | + popup.style.overflow= "visible"; | |
179 | + | |
180 | + if(document.body.offsetHeight< popup.offsetHeight){ | |
181 | + popup.style.height= (document.body.offsetHeight-10)+"px"; | |
182 | + popup.style.overflow= "auto"; | |
183 | + } | |
184 | + | |
185 | + if(!popup.positionned){ | |
186 | + var new_left= editor.offsetWidth /2 - popup.offsetWidth /2; | |
187 | + var new_top= editor.offsetHeight /2 - popup.offsetHeight /2; | |
188 | + //var new_top= area.offsetHeight /2 - popup.offsetHeight /2; | |
189 | + //var new_left= area.offsetWidth /2 - popup.offsetWidth /2; | |
190 | + //alert("new_top: ("+new_top+") = calculeOffsetTop(area) ("+calculeOffsetTop(area)+") + area.offsetHeight /2("+ area.offsetHeight /2+") - popup.offsetHeight /2("+popup.offsetHeight /2+") - scrollTop: "+document.body.scrollTop); | |
191 | + popup.style.left= new_left+"px"; | |
192 | + popup.style.top= new_top+"px"; | |
193 | + popup.positionned=true; | |
194 | + } | |
195 | + popup.style.visibility="visible"; | |
196 | + | |
197 | + //popup.style.display="block"; | |
198 | + }; | |
199 | + | |
200 | + EditArea.prototype.close_inline_popup= function(popup_id){ | |
201 | + var popup= _$(popup_id); | |
202 | + // search matching icon | |
203 | + for(var i=0; i<this.inlinePopup.length; i++){ | |
204 | + if(this.inlinePopup[i]["popup_id"]==popup_id){ | |
205 | + var icon= _$(this.inlinePopup[i]["icon_id"]); | |
206 | + if(icon){ | |
207 | + this.switchClassSticky(icon, 'editAreaButtonNormal', false); | |
208 | + break; | |
209 | + } | |
210 | + } | |
211 | + } | |
212 | + | |
213 | + popup.style.visibility="hidden"; | |
214 | + }; | |
215 | + | |
216 | + EditArea.prototype.close_all_inline_popup= function(e){ | |
217 | + for(var i=0; i<this.inlinePopup.length; i++){ | |
218 | + this.close_inline_popup(this.inlinePopup[i]["popup_id"]); | |
219 | + } | |
220 | + this.textarea.focus(); | |
221 | + }; | |
222 | + | |
223 | + EditArea.prototype.show_help= function(){ | |
224 | + | |
225 | + this.open_inline_popup("edit_area_help"); | |
226 | + | |
227 | + }; | |
228 | + | |
229 | + EditArea.prototype.new_document= function(){ | |
230 | + this.textarea.value=""; | |
231 | + this.area_select(0,0); | |
232 | + }; | |
233 | + | |
234 | + EditArea.prototype.get_all_toolbar_height= function(){ | |
235 | + var area= _$("editor"); | |
236 | + var results= parent.getChildren(area, "div", "class", "area_toolbar", "all", "0"); // search only direct children | |
237 | + //results= results.concat(getChildren(area, "table", "class", "area_toolbar", "all", "0")); | |
238 | + var height=0; | |
239 | + for(var i=0; i<results.length; i++){ | |
240 | + height+= results[i].offsetHeight; | |
241 | + } | |
242 | + //alert("toolbar height: "+height); | |
243 | + return height; | |
244 | + }; | |
245 | + | |
246 | + EditArea.prototype.go_to_line= function(line){ | |
247 | + if(!line) | |
248 | + { | |
249 | + var icon= _$("go_to_line"); | |
250 | + if(icon != null){ | |
251 | + this.restoreClass(icon); | |
252 | + this.switchClassSticky(icon, 'editAreaButtonSelected', true); | |
253 | + } | |
254 | + | |
255 | + line= prompt(this.get_translation("go_to_line_prompt")); | |
256 | + if(icon != null) | |
257 | + this.switchClassSticky(icon, 'editAreaButtonNormal', false); | |
258 | + } | |
259 | + if(line && line!=null && line.search(/^[0-9]+$/)!=-1){ | |
260 | + var start=0; | |
261 | + var lines= this.textarea.value.split("\n"); | |
262 | + if(line > lines.length) | |
263 | + start= this.textarea.value.length; | |
264 | + else{ | |
265 | + for(var i=0; i<Math.min(line-1, lines.length); i++) | |
266 | + start+= lines[i].length + 1; | |
267 | + } | |
268 | + this.area_select(start, 0); | |
269 | + } | |
270 | + | |
271 | + | |
272 | + }; | |
273 | + | |
274 | + | |
275 | + EditArea.prototype.change_smooth_selection_mode= function(setTo){ | |
276 | + //alert("setTo: "+setTo); | |
277 | + if(this.do_highlight) | |
278 | + return; | |
279 | + | |
280 | + if(setTo != null){ | |
281 | + if(setTo === false) | |
282 | + this.smooth_selection=true; | |
283 | + else | |
284 | + this.smooth_selection=false; | |
285 | + } | |
286 | + var icon= _$("change_smooth_selection"); | |
287 | + this.textarea.focus(); | |
288 | + if(this.smooth_selection===true){ | |
289 | + //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") ); | |
290 | + /*setAttribute(icon, "oldClassName", "editAreaButtonNormal" ); | |
291 | + setAttribute(icon, "className", "editAreaButtonNormal" );*/ | |
292 | + //this.restoreClass(icon); | |
293 | + //this.restoreAndSwitchClass(icon,'editAreaButtonNormal'); | |
294 | + this.switchClassSticky(icon, 'editAreaButtonNormal', false); | |
295 | + | |
296 | + this.smooth_selection=false; | |
297 | + this.selection_field.style.display= "none"; | |
298 | + _$("cursor_pos").style.display= "none"; | |
299 | + _$("end_bracket").style.display= "none"; | |
300 | + }else{ | |
301 | + //setAttribute(icon, "class", getAttribute(icon, "class") + " selected"); | |
302 | + //this.switchClass(icon,'editAreaButtonSelected'); | |
303 | + this.switchClassSticky(icon, 'editAreaButtonSelected', false); | |
304 | + this.smooth_selection=true; | |
305 | + this.selection_field.style.display= "block"; | |
306 | + _$("cursor_pos").style.display= "block"; | |
307 | + _$("end_bracket").style.display= "block"; | |
308 | + } | |
309 | + }; | |
310 | + | |
311 | + // the auto scroll of the textarea has some lacks when it have to show cursor in the visible area when the textarea size change | |
312 | + // show specifiy whereas it is the "top" or "bottom" of the selection that is showned | |
313 | + EditArea.prototype.scroll_to_view= function(show){ | |
314 | + var zone, lineElem; | |
315 | + if(!this.smooth_selection) | |
316 | + return; | |
317 | + zone= _$("result"); | |
318 | + | |
319 | + // manage height scroll | |
320 | + var cursor_pos_top= _$("cursor_pos").cursor_top; | |
321 | + if(show=="bottom") | |
322 | + { | |
323 | + //cursor_pos_top+= (this.last_selection["line_nb"]-1)* this.lineHeight; | |
324 | + cursor_pos_top+= this.getLinePosTop( this.last_selection['line_start'] + this.last_selection['line_nb'] - 1 ); | |
325 | + } | |
326 | + | |
327 | + var max_height_visible= zone.clientHeight + zone.scrollTop; | |
328 | + var miss_top = cursor_pos_top + this.lineHeight - max_height_visible; | |
329 | + if(miss_top>0){ | |
330 | + //alert(miss_top); | |
331 | + zone.scrollTop= zone.scrollTop + miss_top; | |
332 | + }else if( zone.scrollTop > cursor_pos_top){ | |
333 | + // when erase all the content -> does'nt scroll back to the top | |
334 | + //alert("else: "+cursor_pos_top); | |
335 | + zone.scrollTop= cursor_pos_top; | |
336 | + } | |
337 | + | |
338 | + // manage left scroll | |
339 | + //var cursor_pos_left= parseInt(_$("cursor_pos").style.left.replace("px","")); | |
340 | + var cursor_pos_left= _$("cursor_pos").cursor_left; | |
341 | + var max_width_visible= zone.clientWidth + zone.scrollLeft; | |
342 | + var miss_left= cursor_pos_left + 10 - max_width_visible; | |
343 | + if(miss_left>0){ | |
344 | + zone.scrollLeft= zone.scrollLeft + miss_left + 50; | |
345 | + }else if( zone.scrollLeft > cursor_pos_left){ | |
346 | + zone.scrollLeft= cursor_pos_left ; | |
347 | + }else if( zone.scrollLeft == 45){ | |
348 | + // show the line numbers if textarea align to it's left | |
349 | + zone.scrollLeft=0; | |
350 | + } | |
351 | + }; | |
352 | + | |
353 | + EditArea.prototype.check_undo= function(only_once){ | |
354 | + if(!editAreas[this.id]) | |
355 | + return false; | |
356 | + if(this.textareaFocused && editAreas[this.id]["displayed"]==true){ | |
357 | + var text=this.textarea.value; | |
358 | + if(this.previous.length<=1) | |
359 | + this.switchClassSticky(_$("undo"), 'editAreaButtonDisabled', true); | |
360 | + | |
361 | + if(!this.previous[this.previous.length-1] || this.previous[this.previous.length-1]["text"] != text){ | |
362 | + this.previous.push({"text": text, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd}); | |
363 | + if(this.previous.length > this.settings["max_undo"]+1) | |
364 | + this.previous.shift(); | |
365 | + | |
366 | + } | |
367 | + if(this.previous.length >= 2) | |
368 | + this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false); | |
369 | + } | |
370 | + | |
371 | + if(!only_once) | |
372 | + setTimeout("editArea.check_undo()", 3000); | |
373 | + }; | |
374 | + | |
375 | + EditArea.prototype.undo= function(){ | |
376 | + //alert("undo"+this.previous.length); | |
377 | + if(this.previous.length > 0) | |
378 | + { | |
379 | + this.getIESelection(); | |
380 | + // var pos_cursor=this.textarea.selectionStart; | |
381 | + this.next.push( { "text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd } ); | |
382 | + var prev= this.previous.pop(); | |
383 | + if( prev["text"] == this.textarea.value && this.previous.length > 0 ) | |
384 | + prev =this.previous.pop(); | |
385 | + this.textarea.value = prev["text"]; | |
386 | + this.last_undo = prev["text"]; | |
387 | + this.area_select(prev["selStart"], prev["selEnd"]-prev["selStart"]); | |
388 | + this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false); | |
389 | + this.resync_highlight(true); | |
390 | + //alert("undo"+this.previous.length); | |
391 | + this.check_file_changes(); | |
392 | + } | |
393 | + }; | |
394 | + | |
395 | + EditArea.prototype.redo= function(){ | |
396 | + if(this.next.length > 0) | |
397 | + { | |
398 | + /*this.getIESelection();*/ | |
399 | + //var pos_cursor=this.textarea.selectionStart; | |
400 | + var next= this.next.pop(); | |
401 | + this.previous.push(next); | |
402 | + this.textarea.value= next["text"]; | |
403 | + this.last_undo= next["text"]; | |
404 | + this.area_select(next["selStart"], next["selEnd"]-next["selStart"]); | |
405 | + this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false); | |
406 | + this.resync_highlight(true); | |
407 | + this.check_file_changes(); | |
408 | + } | |
409 | + if( this.next.length == 0) | |
410 | + this.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); | |
411 | + }; | |
412 | + | |
413 | + EditArea.prototype.check_redo= function(){ | |
414 | + if(editArea.next.length == 0 || editArea.textarea.value!=editArea.last_undo){ | |
415 | + editArea.next= []; // undo the ability to use "redo" button | |
416 | + editArea.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); | |
417 | + } | |
418 | + else | |
419 | + { | |
420 | + this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false); | |
421 | + } | |
422 | + }; | |
423 | + | |
424 | + | |
425 | + // functions that manage icons roll over, disabled, etc... | |
426 | + EditArea.prototype.switchClass = function(element, class_name, lock_state) { | |
427 | + var lockChanged = false; | |
428 | + | |
429 | + if (typeof(lock_state) != "undefined" && element != null) { | |
430 | + element.classLock = lock_state; | |
431 | + lockChanged = true; | |
432 | + } | |
433 | + | |
434 | + if (element != null && (lockChanged || !element.classLock)) { | |
435 | + element.oldClassName = element.className; | |
436 | + element.className = class_name; | |
437 | + } | |
438 | + }; | |
439 | + | |
440 | + EditArea.prototype.restoreAndSwitchClass = function(element, class_name) { | |
441 | + if (element != null && !element.classLock) { | |
442 | + this.restoreClass(element); | |
443 | + this.switchClass(element, class_name); | |
444 | + } | |
445 | + }; | |
446 | + | |
447 | + EditArea.prototype.restoreClass = function(element) { | |
448 | + if (element != null && element.oldClassName && !element.classLock) { | |
449 | + element.className = element.oldClassName; | |
450 | + element.oldClassName = null; | |
451 | + } | |
452 | + }; | |
453 | + | |
454 | + EditArea.prototype.setClassLock = function(element, lock_state) { | |
455 | + if (element != null) | |
456 | + element.classLock = lock_state; | |
457 | + }; | |
458 | + | |
459 | + EditArea.prototype.switchClassSticky = function(element, class_name, lock_state) { | |
460 | + var lockChanged = false; | |
461 | + if (typeof(lock_state) != "undefined" && element != null) { | |
462 | + element.classLock = lock_state; | |
463 | + lockChanged = true; | |
464 | + } | |
465 | + | |
466 | + if (element != null && (lockChanged || !element.classLock)) { | |
467 | + element.className = class_name; | |
468 | + element.oldClassName = class_name; | |
469 | + } | |
470 | + }; | |
471 | + | |
472 | + //make the "page up" and "page down" buttons works correctly | |
473 | + EditArea.prototype.scroll_page= function(params){ | |
474 | + var dir= params["dir"], shift_pressed= params["shift"]; | |
475 | + var lines= this.textarea.value.split("\n"); | |
476 | + var new_pos=0, length=0, char_left=0, line_nb=0, curLine=0; | |
477 | + var toScrollAmount = _$("result").clientHeight -30; | |
478 | + var nbLineToScroll = 0, diff= 0; | |
479 | + | |
480 | + if(dir=="up"){ | |
481 | + nbLineToScroll = Math.ceil( toScrollAmount / this.lineHeight ); | |
482 | + | |
483 | + // fix number of line to scroll | |
484 | + for( i = this.last_selection["line_start"]; i - diff > this.last_selection["line_start"] - nbLineToScroll ; i-- ) | |
485 | + { | |
486 | + if( elem = _$('line_'+ i) ) | |
487 | + { | |
488 | + diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight ); | |
489 | + } | |
490 | + } | |
491 | + nbLineToScroll -= diff; | |
492 | + | |
493 | + if(this.last_selection["selec_direction"]=="up"){ | |
494 | + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-nbLineToScroll, lines.length); line_nb++){ | |
495 | + new_pos+= lines[line_nb].length + 1; | |
496 | + } | |
497 | + char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1); | |
498 | + if(shift_pressed) | |
499 | + length=this.last_selection["selectionEnd"]-new_pos-char_left; | |
500 | + this.area_select(new_pos+char_left, length); | |
501 | + view="top"; | |
502 | + }else{ | |
503 | + view="bottom"; | |
504 | + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-nbLineToScroll, lines.length); line_nb++){ | |
505 | + new_pos+= lines[line_nb].length + 1; | |
506 | + } | |
507 | + char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1); | |
508 | + if(shift_pressed){ | |
509 | + //length=this.last_selection["selectionEnd"]-new_pos-char_left; | |
510 | + start= Math.min(this.last_selection["selectionStart"], new_pos+char_left); | |
511 | + length= Math.max(new_pos+char_left, this.last_selection["selectionStart"] )- start ; | |
512 | + if(new_pos+char_left < this.last_selection["selectionStart"]) | |
513 | + view="top"; | |
514 | + }else | |
515 | + start=new_pos+char_left; | |
516 | + this.area_select(start, length); | |
517 | + | |
518 | + } | |
519 | + } | |
520 | + else | |
521 | + { | |
522 | + var nbLineToScroll= Math.floor( toScrollAmount / this.lineHeight ); | |
523 | + // fix number of line to scroll | |
524 | + for( i = this.last_selection["line_start"]; i + diff < this.last_selection["line_start"] + nbLineToScroll ; i++ ) | |
525 | + { | |
526 | + if( elem = _$('line_'+ i) ) | |
527 | + { | |
528 | + diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight ); | |
529 | + } | |
530 | + } | |
531 | + nbLineToScroll -= diff; | |
532 | + | |
533 | + if(this.last_selection["selec_direction"]=="down"){ | |
534 | + view="bottom"; | |
535 | + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+nbLineToScroll, lines.length); line_nb++){ | |
536 | + if(line_nb==this.last_selection["line_start"]-1) | |
537 | + char_left= this.last_selection["selectionStart"] -new_pos; | |
538 | + new_pos+= lines[line_nb].length + 1; | |
539 | + | |
540 | + } | |
541 | + if(shift_pressed){ | |
542 | + length=Math.abs(this.last_selection["selectionStart"]-new_pos); | |
543 | + length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]); | |
544 | + //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left); | |
545 | + this.area_select(Math.min(this.last_selection["selectionStart"], new_pos), length); | |
546 | + }else{ | |
547 | + this.area_select(new_pos+char_left, 0); | |
548 | + } | |
549 | + | |
550 | + }else{ | |
551 | + view="top"; | |
552 | + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+nbLineToScroll-1, lines.length, lines.length); line_nb++){ | |
553 | + if(line_nb==this.last_selection["line_start"]-1) | |
554 | + char_left= this.last_selection["selectionStart"] -new_pos; | |
555 | + new_pos+= lines[line_nb].length + 1; | |
556 | + } | |
557 | + if(shift_pressed){ | |
558 | + length=Math.abs(this.last_selection["selectionEnd"]-new_pos-char_left); | |
559 | + length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"])- char_left-1; | |
560 | + //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left); | |
561 | + this.area_select(Math.min(this.last_selection["selectionEnd"], new_pos+char_left), length); | |
562 | + if(new_pos+char_left > this.last_selection["selectionEnd"]) | |
563 | + view="bottom"; | |
564 | + }else{ | |
565 | + this.area_select(new_pos+char_left, 0); | |
566 | + } | |
567 | + | |
568 | + } | |
569 | + } | |
570 | + //console.log( new_pos, char_left, length, nbLineToScroll, toScrollAmount, _$("result").clientHeigh ); | |
571 | + this.check_line_selection(); | |
572 | + this.scroll_to_view(view); | |
573 | + }; | |
574 | + | |
575 | + EditArea.prototype.start_resize= function(e){ | |
576 | + parent.editAreaLoader.resize["id"] = editArea.id; | |
577 | + parent.editAreaLoader.resize["start_x"] = (e)? e.pageX : event.x + document.body.scrollLeft; | |
578 | + parent.editAreaLoader.resize["start_y"] = (e)? e.pageY : event.y + document.body.scrollTop; | |
579 | + if(editArea.isIE) | |
580 | + { | |
581 | + editArea.textarea.focus(); | |
582 | + editArea.getIESelection(); | |
583 | + } | |
584 | + parent.editAreaLoader.resize["selectionStart"] = editArea.textarea.selectionStart; | |
585 | + parent.editAreaLoader.resize["selectionEnd"] = editArea.textarea.selectionEnd; | |
586 | + parent.editAreaLoader.start_resize_area(); | |
587 | + }; | |
588 | + | |
589 | + EditArea.prototype.toggle_full_screen= function(to){ | |
590 | + var t=this, p=parent, a=t.textarea, html, frame, selStart, selEnd, old, icon; | |
591 | + if(typeof(to)=="undefined") | |
592 | + to= !t.fullscreen['isFull']; | |
593 | + old = t.fullscreen['isFull']; | |
594 | + t.fullscreen['isFull']= to; | |
595 | + icon = _$("fullscreen"); | |
596 | + selStart = t.textarea.selectionStart; | |
597 | + selEnd = t.textarea.selectionEnd; | |
598 | + html = p.document.getElementsByTagName("html")[0]; | |
599 | + frame = p.document.getElementById("frame_"+t.id); | |
600 | + | |
601 | + if(to && to!=old) | |
602 | + { // toogle on fullscreen | |
603 | + | |
604 | + t.fullscreen['old_overflow'] = p.get_css_property(html, "overflow"); | |
605 | + t.fullscreen['old_height'] = p.get_css_property(html, "height"); | |
606 | + t.fullscreen['old_width'] = p.get_css_property(html, "width"); | |
607 | + t.fullscreen['old_scrollTop'] = html.scrollTop; | |
608 | + t.fullscreen['old_scrollLeft'] = html.scrollLeft; | |
609 | + t.fullscreen['old_zIndex'] = p.get_css_property(frame, "z-index"); | |
610 | + if(t.isOpera){ | |
611 | + html.style.height = "100%"; | |
612 | + html.style.width = "100%"; | |
613 | + } | |
614 | + html.style.overflow = "hidden"; | |
615 | + html.scrollTop = 0; | |
616 | + html.scrollLeft = 0; | |
617 | + | |
618 | + frame.style.position = "absolute"; | |
619 | + frame.style.width = html.clientWidth+"px"; | |
620 | + frame.style.height = html.clientHeight+"px"; | |
621 | + frame.style.display = "block"; | |
622 | + frame.style.zIndex = "999999"; | |
623 | + frame.style.top = "0px"; | |
624 | + frame.style.left = "0px"; | |
625 | + | |
626 | + // if the iframe was in a div with position absolute, the top and left are the one of the div, | |
627 | + // so I fix it by seeing at witch position the iframe start and correcting it | |
628 | + frame.style.top = "-"+p.calculeOffsetTop(frame)+"px"; | |
629 | + frame.style.left = "-"+p.calculeOffsetLeft(frame)+"px"; | |
630 | + | |
631 | + // parent.editAreaLoader.execCommand(t.id, "update_size();"); | |
632 | + // var body=parent.document.getElementsByTagName("body")[0]; | |
633 | + // body.appendChild(frame); | |
634 | + | |
635 | + t.switchClassSticky(icon, 'editAreaButtonSelected', false); | |
636 | + t.fullscreen['allow_resize']= t.resize_allowed; | |
637 | + t.allow_resize(false); | |
638 | + | |
639 | + //t.area_select(selStart, selEnd-selStart); | |
640 | + | |
641 | + | |
642 | + // opera can't manage to do a direct size update | |
643 | + if(t.isFirefox){ | |
644 | + p.editAreaLoader.execCommand(t.id, "update_size();"); | |
645 | + t.area_select(selStart, selEnd-selStart); | |
646 | + t.scroll_to_view(); | |
647 | + t.focus(); | |
648 | + }else{ | |
649 | + setTimeout("parent.editAreaLoader.execCommand('"+ t.id +"', 'update_size();');editArea.focus();", 10); | |
650 | + } | |
651 | + | |
652 | + | |
653 | + } | |
654 | + else if(to!=old) | |
655 | + { // toogle off fullscreen | |
656 | + frame.style.position="static"; | |
657 | + frame.style.zIndex= t.fullscreen['old_zIndex']; | |
658 | + | |
659 | + if(t.isOpera) | |
660 | + { | |
661 | + html.style.height = "auto"; | |
662 | + html.style.width = "auto"; | |
663 | + html.style.overflow = "auto"; | |
664 | + } | |
665 | + else if(t.isIE && p!=top) | |
666 | + { // IE doesn't manage html overflow in frames like in normal page... | |
667 | + html.style.overflow = "auto"; | |
668 | + } | |
669 | + else | |
670 | + { | |
671 | + html.style.overflow = t.fullscreen['old_overflow']; | |
672 | + } | |
673 | + html.scrollTop = t.fullscreen['old_scrollTop']; | |
674 | + html.scrollLeft = t.fullscreen['old_scrollLeft']; | |
675 | + | |
676 | + p.editAreaLoader.hide(t.id); | |
677 | + p.editAreaLoader.show(t.id); | |
678 | + | |
679 | + t.switchClassSticky(icon, 'editAreaButtonNormal', false); | |
680 | + if(t.fullscreen['allow_resize']) | |
681 | + t.allow_resize(t.fullscreen['allow_resize']); | |
682 | + if(t.isFirefox){ | |
683 | + t.area_select(selStart, selEnd-selStart); | |
684 | + setTimeout("editArea.scroll_to_view();", 10); | |
685 | + } | |
686 | + | |
687 | + //p.editAreaLoader.remove_event(p.window, "resize", editArea.update_size); | |
688 | + } | |
689 | + | |
690 | + }; | |
691 | + | |
692 | + EditArea.prototype.allow_resize= function(allow){ | |
693 | + var resize= _$("resize_area"); | |
694 | + if(allow){ | |
695 | + | |
696 | + resize.style.visibility="visible"; | |
697 | + parent.editAreaLoader.add_event(resize, "mouseup", editArea.start_resize); | |
698 | + }else{ | |
699 | + resize.style.visibility="hidden"; | |
700 | + parent.editAreaLoader.remove_event(resize, "mouseup", editArea.start_resize); | |
701 | + } | |
702 | + this.resize_allowed= allow; | |
703 | + }; | |
704 | + | |
705 | + | |
706 | + EditArea.prototype.change_syntax= function(new_syntax, is_waiting){ | |
707 | + // alert("cahnge to "+new_syntax); | |
708 | + // the syntax is the same | |
709 | + if(new_syntax==this.settings['syntax']) | |
710 | + return true; | |
711 | + | |
712 | + // check that the syntax is one allowed | |
713 | + var founded= false; | |
714 | + for(var i=0; i<this.syntax_list.length; i++) | |
715 | + { | |
716 | + if(this.syntax_list[i]==new_syntax) | |
717 | + founded= true; | |
718 | + } | |
719 | + | |
720 | + if(founded==true) | |
721 | + { | |
722 | + // the reg syntax file is not loaded | |
723 | + if(!parent.editAreaLoader.load_syntax[new_syntax]) | |
724 | + { | |
725 | + // load the syntax file and wait for file loading | |
726 | + if(!is_waiting) | |
727 | + parent.editAreaLoader.load_script(parent.editAreaLoader.baseURL + "reg_syntax/" + new_syntax + ".js"); | |
728 | + setTimeout("editArea.change_syntax('"+ new_syntax +"', true);", 100); | |
729 | + this.show_waiting_screen(); | |
730 | + } | |
731 | + else | |
732 | + { | |
733 | + if(!this.allready_used_syntax[new_syntax]) | |
734 | + { // the syntax has still not been used | |
735 | + // rebuild syntax definition for new languages | |
736 | + parent.editAreaLoader.init_syntax_regexp(); | |
737 | + // add style to the new list | |
738 | + this.add_style(parent.editAreaLoader.syntax[new_syntax]["styles"]); | |
739 | + this.allready_used_syntax[new_syntax]=true; | |
740 | + } | |
741 | + // be sure that the select option is correctly updated | |
742 | + var sel= _$("syntax_selection"); | |
743 | + if(sel && sel.value!=new_syntax) | |
744 | + { | |
745 | + for(var i=0; i<sel.length; i++){ | |
746 | + if(sel.options[i].value && sel.options[i].value == new_syntax) | |
747 | + sel.options[i].selected=true; | |
748 | + } | |
749 | + } | |
750 | + | |
751 | + /* if(this.settings['syntax'].length==0) | |
752 | + { | |
753 | + this.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', false); | |
754 | + this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false); | |
755 | + this.change_highlight(true); | |
756 | + } | |
757 | + */ | |
758 | + this.settings['syntax']= new_syntax; | |
759 | + this.resync_highlight(true); | |
760 | + this.hide_waiting_screen(); | |
761 | + return true; | |
762 | + } | |
763 | + } | |
764 | + return false; | |
765 | + }; | |
766 | + | |
767 | + | |
768 | + // check if the file has changed | |
769 | + EditArea.prototype.set_editable= function(is_editable){ | |
770 | + if(is_editable) | |
771 | + { | |
772 | + document.body.className= ""; | |
773 | + this.textarea.readOnly= false; | |
774 | + this.is_editable= true; | |
775 | + } | |
776 | + else | |
777 | + { | |
778 | + document.body.className= "non_editable"; | |
779 | + this.textarea.readOnly= true; | |
780 | + this.is_editable= false; | |
781 | + } | |
782 | + | |
783 | + if(editAreas[this.id]["displayed"]==true) | |
784 | + this.update_size(); | |
785 | + }; | |
786 | + | |
787 | + /***** Wrap mode *****/ | |
788 | + | |
789 | + // toggling function for set_wrap_mode | |
790 | + EditArea.prototype.toggle_word_wrap= function(){ | |
791 | + this.set_word_wrap( !this.settings['word_wrap'] ); | |
792 | + }; | |
793 | + | |
794 | + | |
795 | + // open a new tab for the given file | |
796 | + EditArea.prototype.set_word_wrap= function(to){ | |
797 | + var t=this, a= t.textarea; | |
798 | + if( t.isOpera && t.isOpera < 9.8 ) | |
799 | + { | |
800 | + this.settings['word_wrap']= false; | |
801 | + t.switchClassSticky( _$("word_wrap"), 'editAreaButtonDisabled', true ); | |
802 | + return false; | |
803 | + } | |
804 | + | |
805 | + if( to ) | |
806 | + { | |
807 | + wrap_mode = 'soft'; | |
808 | + this.container.className+= ' word_wrap'; | |
809 | + this.container.style.width=""; | |
810 | + this.content_highlight.style.width=""; | |
811 | + a.style.width="100%"; | |
812 | + if( t.isIE && t.isIE < 7 ) // IE 6 count 50 px too much | |
813 | + { | |
814 | + a.style.width = ( a.offsetWidth-5 )+"px"; | |
815 | + } | |
816 | + | |
817 | + t.switchClassSticky( _$("word_wrap"), 'editAreaButtonSelected', false ); | |
818 | + } | |
819 | + else | |
820 | + { | |
821 | + wrap_mode = 'off'; | |
822 | + this.container.className = this.container.className.replace(/word_wrap/g, ''); | |
823 | + t.switchClassSticky( _$("word_wrap"), 'editAreaButtonNormal', true ); | |
824 | + } | |
825 | + this.textarea.previous_scrollWidth = ''; | |
826 | + this.textarea.previous_scrollHeight = ''; | |
827 | + | |
828 | + a.wrap= wrap_mode; | |
829 | + a.setAttribute('wrap', wrap_mode); | |
830 | + // only IE can change wrap mode on the fly without element reloading | |
831 | + if(!this.isIE) | |
832 | + { | |
833 | + var start=a.selectionStart, end= a.selectionEnd; | |
834 | + var parNod = a.parentNode, nxtSib = a.nextSibling; | |
835 | + parNod.removeChild(a); | |
836 | + parNod.insertBefore(a, nxtSib); | |
837 | + this.area_select(start, end-start); | |
838 | + } | |
839 | + // reset some optimisation | |
840 | + this.settings['word_wrap'] = to; | |
841 | + this.focus(); | |
842 | + this.update_size(); | |
843 | + this.check_line_selection(); | |
844 | + }; | |
845 | + /***** tabbed files managing functions *****/ | |
846 | + | |
847 | + // open a new tab for the given file | |
848 | + EditArea.prototype.open_file= function(settings){ | |
849 | + | |
850 | + if(settings['id']!="undefined") | |
851 | + { | |
852 | + var id= settings['id']; | |
853 | + // create a new file object with defautl values | |
854 | + var new_file= {}; | |
855 | + new_file['id'] = id; | |
856 | + new_file['title'] = id; | |
857 | + new_file['text'] = ""; | |
858 | + new_file['last_selection'] = ""; | |
859 | + new_file['last_text_to_highlight'] = ""; | |
860 | + new_file['last_hightlighted_text'] = ""; | |
861 | + new_file['previous'] = []; | |
862 | + new_file['next'] = []; | |
863 | + new_file['last_undo'] = ""; | |
864 | + new_file['smooth_selection'] = this.settings['smooth_selection']; | |
865 | + new_file['do_highlight']= this.settings['start_highlight']; | |
866 | + new_file['syntax'] = this.settings['syntax']; | |
867 | + new_file['scroll_top'] = 0; | |
868 | + new_file['scroll_left'] = 0; | |
869 | + new_file['selection_start']= 0; | |
870 | + new_file['selection_end']= 0; | |
871 | + new_file['edited'] = false; | |
872 | + new_file['font_size'] = this.settings["font_size"]; | |
873 | + new_file['font_family'] = this.settings["font_family"]; | |
874 | + new_file['word_wrap'] = this.settings["word_wrap"]; | |
875 | + new_file['toolbar'] = {'links':{}, 'selects': {}}; | |
876 | + new_file['compare_edited_text']= new_file['text']; | |
877 | + | |
878 | + | |
879 | + this.files[id]= new_file; | |
880 | + this.update_file(id, settings); | |
881 | + this.files[id]['compare_edited_text']= this.files[id]['text']; | |
882 | + | |
883 | + | |
884 | + var html_id= 'tab_file_'+encodeURIComponent(id); | |
885 | + this.filesIdAssoc[html_id]= id; | |
886 | + this.files[id]['html_id']= html_id; | |
887 | + | |
888 | + if(!_$(this.files[id]['html_id']) && id!="") | |
889 | + { | |
890 | + // be sure the tab browsing area is displayed | |
891 | + this.tab_browsing_area.style.display= "block"; | |
892 | + var elem= document.createElement('li'); | |
893 | + elem.id= this.files[id]['html_id']; | |
894 | + var close= "<img src=\""+ parent.editAreaLoader.baseURL +"images/close.gif\" title=\""+ this.get_translation('close_tab', 'word') +"\" onclick=\"editArea.execCommand('close_file', editArea.filesIdAssoc['"+ html_id +"']);return false;\" class=\"hidden\" onmouseover=\"this.className=''\" onmouseout=\"this.className='hidden'\" />"; | |
895 | + elem.innerHTML= "<a onclick=\"javascript:editArea.execCommand('switch_to_file', editArea.filesIdAssoc['"+ html_id +"']);\" selec=\"none\"><b><span><strong class=\"edited\">*</strong>"+ this.files[id]['title'] + close +"</span></b></a>"; | |
896 | + _$('tab_browsing_list').appendChild(elem); | |
897 | + var elem= document.createElement('text'); | |
898 | + this.update_size(); | |
899 | + } | |
900 | + | |
901 | + // open file callback (for plugin) | |
902 | + if(id!="") | |
903 | + this.execCommand('file_open', this.files[id]); | |
904 | + | |
905 | + this.switch_to_file(id, true); | |
906 | + return true; | |
907 | + } | |
908 | + else | |
909 | + return false; | |
910 | + }; | |
911 | + | |
912 | + // close the given file | |
913 | + EditArea.prototype.close_file= function(id){ | |
914 | + if(this.files[id]) | |
915 | + { | |
916 | + this.save_file(id); | |
917 | + | |
918 | + // close file callback | |
919 | + if(this.execCommand('file_close', this.files[id])!==false) | |
920 | + { | |
921 | + // remove the tab in the toolbar | |
922 | + var li= _$(this.files[id]['html_id']); | |
923 | + li.parentNode.removeChild(li); | |
924 | + // select a new file | |
925 | + if(id== this.curr_file) | |
926 | + { | |
927 | + var next_file= ""; | |
928 | + var is_next= false; | |
929 | + for(var i in this.files) | |
930 | + { | |
931 | + if( is_next ) | |
932 | + { | |
933 | + next_file = i; | |
934 | + break; | |
935 | + } | |
936 | + else if( i == id ) | |
937 | + is_next = true; | |
938 | + else | |
939 | + next_file = i; | |
940 | + } | |
941 | + // display the next file | |
942 | + this.switch_to_file(next_file); | |
943 | + } | |
944 | + // clear datas | |
945 | + delete (this.files[id]); | |
946 | + this.update_size(); | |
947 | + } | |
948 | + } | |
949 | + }; | |
950 | + | |
951 | + // backup current file datas | |
952 | + EditArea.prototype.save_file= function(id){ | |
953 | + var t= this, save, a_links, a_selects, save_butt, img, i; | |
954 | + if(t.files[id]) | |
955 | + { | |
956 | + var save= t.files[id]; | |
957 | + save['last_selection'] = t.last_selection; | |
958 | + save['last_text_to_highlight'] = t.last_text_to_highlight; | |
959 | + save['last_hightlighted_text'] = t.last_hightlighted_text; | |
960 | + save['previous'] = t.previous; | |
961 | + save['next'] = t.next; | |
962 | + save['last_undo'] = t.last_undo; | |
963 | + save['smooth_selection'] = t.smooth_selection; | |
964 | + save['do_highlight'] = t.do_highlight; | |
965 | + save['syntax'] = t.settings['syntax']; | |
966 | + save['text'] = t.textarea.value; | |
967 | + save['scroll_top'] = t.result.scrollTop; | |
968 | + save['scroll_left'] = t.result.scrollLeft; | |
969 | + save['selection_start'] = t.last_selection["selectionStart"]; | |
970 | + save['selection_end'] = t.last_selection["selectionEnd"]; | |
971 | + save['font_size'] = t.settings["font_size"]; | |
972 | + save['font_family'] = t.settings["font_family"]; | |
973 | + save['word_wrap'] = t.settings["word_wrap"]; | |
974 | + save['toolbar'] = {'links':{}, 'selects': {}}; | |
975 | + | |
976 | + // save toolbar buttons state for fileSpecific buttons | |
977 | + a_links= _$("toolbar_1").getElementsByTagName("a"); | |
978 | + for( i=0; i<a_links.length; i++ ) | |
979 | + { | |
980 | + if( a_links[i].getAttribute('fileSpecific') == 'yes' ) | |
981 | + { | |
982 | + save_butt = {}; | |
983 | + img = a_links[i].getElementsByTagName('img')[0]; | |
984 | + save_butt['classLock'] = img.classLock; | |
985 | + save_butt['className'] = img.className; | |
986 | + save_butt['oldClassName'] = img.oldClassName; | |
987 | + | |
988 | + save['toolbar']['links'][a_links[i].id]= save_butt; | |
989 | + } | |
990 | + } | |
991 | + | |
992 | + // save toolbar select state for fileSpecific buttons | |
993 | + a_selects= _$("toolbar_1").getElementsByTagName("select"); | |
994 | + for( i=0; i<a_selects.length; i++) | |
995 | + { | |
996 | + if(a_selects[i].getAttribute('fileSpecific')=='yes') | |
997 | + { | |
998 | + save['toolbar']['selects'][a_selects[i].id]= a_selects[i].value; | |
999 | + } | |
1000 | + } | |
1001 | + | |
1002 | + t.files[id]= save; | |
1003 | + | |
1004 | + return save; | |
1005 | + } | |
1006 | + | |
1007 | + return false; | |
1008 | + }; | |
1009 | + | |
1010 | + // update file_datas | |
1011 | + EditArea.prototype.update_file= function(id, new_values){ | |
1012 | + for(var i in new_values) | |
1013 | + { | |
1014 | + this.files[id][i]= new_values[i]; | |
1015 | + } | |
1016 | + }; | |
1017 | + | |
1018 | + // display file datas | |
1019 | + EditArea.prototype.display_file= function(id){ | |
1020 | + var t = this, a= t.textarea, new_file, a_lis, a_selects, a_links, a_options, i, j; | |
1021 | + | |
1022 | + // we're showing the empty file | |
1023 | + if(id=='') | |
1024 | + { | |
1025 | + a.readOnly= true; | |
1026 | + t.tab_browsing_area.style.display= "none"; | |
1027 | + _$("no_file_selected").style.display= "block"; | |
1028 | + t.result.className= "empty"; | |
1029 | + // clear current datas | |
1030 | + if(!t.files['']) | |
1031 | + { | |
1032 | + t.open_file({id: ''}); | |
1033 | + } | |
1034 | + } | |
1035 | + // we try to show a non existent file, so we left | |
1036 | + else if( typeof( t.files[id] ) == 'undefined' ) | |
1037 | + { | |
1038 | + return false; | |
1039 | + } | |
1040 | + // display a normal file | |
1041 | + else | |
1042 | + { | |
1043 | + t.result.className= ""; | |
1044 | + a.readOnly= !t.is_editable; | |
1045 | + _$("no_file_selected").style.display= "none"; | |
1046 | + t.tab_browsing_area.style.display= "block"; | |
1047 | + } | |
1048 | + | |
1049 | + // ensure to have last state for undo/redo actions | |
1050 | + t.check_redo(true); | |
1051 | + t.check_undo(true); | |
1052 | + t.curr_file= id; | |
1053 | + | |
1054 | + // replace selected tab file | |
1055 | + a_lis= t.tab_browsing_area.getElementsByTagName('li'); | |
1056 | + for( i=0; i<a_lis.length; i++) | |
1057 | + { | |
1058 | + if(a_lis[i].id == t.files[id]['html_id']) | |
1059 | + a_lis[i].className='selected'; | |
1060 | + else | |
1061 | + a_lis[i].className=''; | |
1062 | + } | |
1063 | + | |
1064 | + // replace next files datas | |
1065 | + new_file= t.files[id]; | |
1066 | + | |
1067 | + // restore text content | |
1068 | + a.value= new_file['text']; | |
1069 | + | |
1070 | + // restore font-size | |
1071 | + t.set_font(new_file['font_family'], new_file['font_size']); | |
1072 | + | |
1073 | + // restore selection and scroll | |
1074 | + t.area_select(new_file['selection_start'], new_file['selection_end'] - new_file['selection_start']); | |
1075 | + t.manage_size(true); | |
1076 | + t.result.scrollTop= new_file['scroll_top']; | |
1077 | + t.result.scrollLeft= new_file['scroll_left']; | |
1078 | + | |
1079 | + // restore undo, redo | |
1080 | + t.previous= new_file['previous']; | |
1081 | + t.next= new_file['next']; | |
1082 | + t.last_undo= new_file['last_undo']; | |
1083 | + t.check_redo(true); | |
1084 | + t.check_undo(true); | |
1085 | + | |
1086 | + // restore highlight | |
1087 | + t.execCommand("change_highlight", new_file['do_highlight']); | |
1088 | + t.execCommand("change_syntax", new_file['syntax']); | |
1089 | + | |
1090 | + // smooth mode | |
1091 | + t.execCommand("change_smooth_selection_mode", new_file['smooth_selection']); | |
1092 | + | |
1093 | + // word_wrap | |
1094 | + t.execCommand("set_word_wrap", new_file['word_wrap']); | |
1095 | + | |
1096 | + // restore links state in toolbar | |
1097 | + a_links= new_file['toolbar']['links']; | |
1098 | + for( i in a_links) | |
1099 | + { | |
1100 | + if( img = _$(i).getElementsByTagName('img')[0] ) | |
1101 | + { | |
1102 | + img.classLock = a_links[i]['classLock']; | |
1103 | + img.className = a_links[i]['className']; | |
1104 | + img.oldClassName= a_links[i]['oldClassName']; | |
1105 | + } | |
1106 | + } | |
1107 | + | |
1108 | + // restore select state in toolbar | |
1109 | + a_selects = new_file['toolbar']['selects']; | |
1110 | + for( i in a_selects) | |
1111 | + { | |
1112 | + a_options = _$(i).options; | |
1113 | + for( j=0; j<a_options.length; j++) | |
1114 | + { | |
1115 | + if( a_options[j].value == a_selects[i] ) | |
1116 | + _$(i).options[j].selected=true; | |
1117 | + } | |
1118 | + } | |
1119 | + | |
1120 | + }; | |
1121 | + | |
1122 | + // change tab for displaying a new one | |
1123 | + EditArea.prototype.switch_to_file= function(file_to_show, force_refresh){ | |
1124 | + if(file_to_show!=this.curr_file || force_refresh) | |
1125 | + { | |
1126 | + this.save_file(this.curr_file); | |
1127 | + if(this.curr_file!='') | |
1128 | + this.execCommand('file_switch_off', this.files[this.curr_file]); | |
1129 | + this.display_file(file_to_show); | |
1130 | + if(file_to_show!='') | |
1131 | + this.execCommand('file_switch_on', this.files[file_to_show]); | |
1132 | + } | |
1133 | + }; | |
1134 | + | |
1135 | + // get all infos for the given file | |
1136 | + EditArea.prototype.get_file= function(id){ | |
1137 | + if(id==this.curr_file) | |
1138 | + this.save_file(id); | |
1139 | + return this.files[id]; | |
1140 | + }; | |
1141 | + | |
1142 | + // get all available files infos | |
1143 | + EditArea.prototype.get_all_files= function(){ | |
1144 | + tmp_files= this.files; | |
1145 | + this.save_file(this.curr_file); | |
1146 | + if(tmp_files['']) | |
1147 | + delete(this.files['']); | |
1148 | + return tmp_files; | |
1149 | + }; | |
1150 | + | |
1151 | + | |
1152 | + // check if the file has changed | |
1153 | + EditArea.prototype.check_file_changes= function(){ | |
1154 | + | |
1155 | + var id= this.curr_file; | |
1156 | + if(this.files[id] && this.files[id]['compare_edited_text']!=undefined) | |
1157 | + { | |
1158 | + if(this.files[id]['compare_edited_text'].length==this.textarea.value.length && this.files[id]['compare_edited_text']==this.textarea.value) | |
1159 | + { | |
1160 | + if(this.files[id]['edited']!= false) | |
1161 | + this.set_file_edited_mode(id, false); | |
1162 | + } | |
1163 | + else | |
1164 | + { | |
1165 | + if(this.files[id]['edited']!= true) | |
1166 | + this.set_file_edited_mode(id, true); | |
1167 | + } | |
1168 | + } | |
1169 | + }; | |
1170 | + | |
1171 | + // set if the file is edited or not | |
1172 | + EditArea.prototype.set_file_edited_mode= function(id, to){ | |
1173 | + // change CSS for edited tab | |
1174 | + if(this.files[id] && _$(this.files[id]['html_id'])) | |
1175 | + { | |
1176 | + var link= _$(this.files[id]['html_id']).getElementsByTagName('a')[0]; | |
1177 | + if(to==true) | |
1178 | + { | |
1179 | + link.className= 'edited'; | |
1180 | + } | |
1181 | + else | |
1182 | + { | |
1183 | + link.className= ''; | |
1184 | + if(id==this.curr_file) | |
1185 | + text= this.textarea.value; | |
1186 | + else | |
1187 | + text= this.files[id]['text']; | |
1188 | + this.files[id]['compare_edited_text']= text; | |
1189 | + } | |
1190 | + | |
1191 | + this.files[id]['edited']= to; | |
1192 | + } | |
1193 | + }; | |
1194 | + | |
1195 | + EditArea.prototype.set_show_line_colors = function(new_value){ | |
1196 | + this.show_line_colors = new_value; | |
1197 | + | |
1198 | + if( new_value ) | |
1199 | + this.selection_field.className += ' show_colors'; | |
1200 | + else | |
1201 | + this.selection_field.className = this.selection_field.className.replace( / show_colors/g, '' ); | |
1202 | + }; | |
0 | 1203 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/edit_area_loader.js
0 → 100644
1 | +/****** | |
2 | + * | |
3 | + * EditArea | |
4 | + * Developped by Christophe Dolivet | |
5 | + * Released under LGPL, Apache and BSD licenses (use the one you want) | |
6 | + * | |
7 | +******/ | |
8 | + | |
9 | +function EditAreaLoader(){ | |
10 | + var t=this; | |
11 | + t.version= "0.8.2"; | |
12 | + date= new Date(); | |
13 | + t.start_time=date.getTime(); | |
14 | + t.win= "loading"; // window loading state | |
15 | + t.error= false; // to know if load is interrrupt | |
16 | + t.baseURL=""; | |
17 | + //t.suffix=""; | |
18 | + t.template=""; | |
19 | + t.lang= {}; // array of loaded speech language | |
20 | + t.load_syntax= {}; // array of loaded syntax language for highlight mode | |
21 | + t.syntax= {}; // array of initilized syntax language for highlight mode | |
22 | + t.loadedFiles= []; | |
23 | + t.waiting_loading= {}; // files that must be loaded in order to allow the script to really start | |
24 | + // scripts that must be loaded in the iframe | |
25 | + t.scripts_to_load= ["elements_functions", "resize_area", "reg_syntax"]; | |
26 | + t.sub_scripts_to_load= ["edit_area", "manage_area" ,"edit_area_functions", "keyboard", "search_replace", "highlight", "regexp"]; | |
27 | + t.syntax_display_name= { /*syntax_display_name_AUTO-FILL-BY-COMPRESSOR*/ }; | |
28 | + | |
29 | + t.resize= []; // contain resizing datas | |
30 | + t.hidden= {}; // store datas of the hidden textareas | |
31 | + | |
32 | + t.default_settings= { | |
33 | + //id: "src" // id of the textarea to transform | |
34 | + debug: false | |
35 | + ,smooth_selection: true | |
36 | + ,font_size: "10" // not for IE | |
37 | + ,font_family: "monospace" // can be "verdana,monospace". Allow non monospace font but Firefox get smaller tabulation with non monospace fonts. IE doesn't change the tabulation width and Opera doesn't take this option into account... | |
38 | + ,start_highlight: false // if start with highlight | |
39 | + ,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help" | |
40 | + ,begin_toolbar: "" // "new_document, save, load, |" | |
41 | + ,end_toolbar: "" // or end_toolbar | |
42 | + ,is_multi_files: false // enable the multi file mode (the textarea content is ignored) | |
43 | + ,allow_resize: "both" // possible values: "no", "both", "x", "y" | |
44 | + ,show_line_colors: false // if the highlight is disabled for the line currently beeing edited (if enabled => heavy CPU use) | |
45 | + ,min_width: 400 | |
46 | + ,min_height: 125 | |
47 | + ,replace_tab_by_spaces: false | |
48 | + ,allow_toggle: true // true or false | |
49 | + ,language: "en" | |
50 | + ,syntax: "" | |
51 | + ,syntax_selection_allow: "basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml" | |
52 | + ,display: "onload" // onload or later | |
53 | + ,max_undo: 30 | |
54 | + ,browsers: "known" // all or known | |
55 | + ,plugins: "" // comma separated plugin list | |
56 | + ,gecko_spellcheck: false // enable/disable by default the gecko_spellcheck | |
57 | + ,fullscreen: false | |
58 | + ,is_editable: true | |
59 | + ,cursor_position: "begin" | |
60 | + ,word_wrap: false // define if the text is wrapped of not in the textarea | |
61 | + ,autocompletion: false // NOT IMPLEMENTED | |
62 | + ,load_callback: "" // click on load button (function name) | |
63 | + ,save_callback: "" // click on save button (function name) | |
64 | + ,change_callback: "" // textarea onchange trigger (function name) | |
65 | + ,submit_callback: "" // form submited (function name) | |
66 | + ,EA_init_callback: "" // EditArea initiliazed (function name) | |
67 | + ,EA_delete_callback: "" // EditArea deleted (function name) | |
68 | + ,EA_load_callback: "" // EditArea fully loaded and displayed (function name) | |
69 | + ,EA_unload_callback: "" // EditArea delete while being displayed (function name) | |
70 | + ,EA_toggle_on_callback: "" // EditArea toggled on (function name) | |
71 | + ,EA_toggle_off_callback: "" // EditArea toggled off (function name) | |
72 | + ,EA_file_switch_on_callback: "" // a new tab is selected (called for the newly selected file) | |
73 | + ,EA_file_switch_off_callback: "" // a new tab is selected (called for the previously selected file) | |
74 | + ,EA_file_close_callback: "" // close a tab | |
75 | + }; | |
76 | + | |
77 | + t.advanced_buttons = [ | |
78 | + // id, button img, command (it will try to find the translation of "id"), is_file_specific | |
79 | + ['new_document', 'newdocument.gif', 'new_document', false], | |
80 | + ['search', 'search.gif', 'show_search', false], | |
81 | + ['go_to_line', 'go_to_line.gif', 'go_to_line', false], | |
82 | + ['undo', 'undo.gif', 'undo', true], | |
83 | + ['redo', 'redo.gif', 'redo', true], | |
84 | + ['change_smooth_selection', 'smooth_selection.gif', 'change_smooth_selection_mode', true], | |
85 | + ['reset_highlight', 'reset_highlight.gif', 'resync_highlight', true], | |
86 | + ['highlight', 'highlight.gif','change_highlight', true], | |
87 | + ['help', 'help.gif', 'show_help', false], | |
88 | + ['save', 'save.gif', 'save', false], | |
89 | + ['load', 'load.gif', 'load', false], | |
90 | + ['fullscreen', 'fullscreen.gif', 'toggle_full_screen', false], | |
91 | + ['word_wrap', 'word_wrap.gif', 'toggle_word_wrap', true], | |
92 | + ['autocompletion', 'autocompletion.gif', 'toggle_autocompletion', true] | |
93 | + ]; | |
94 | + | |
95 | + // navigator identification | |
96 | + t.set_browser_infos(t); | |
97 | + | |
98 | + if(t.isIE>=6 || t.isGecko || ( t.isWebKit && !t.isSafari<3 ) || t.isOpera>=9 || t.isCamino ) | |
99 | + t.isValidBrowser=true; | |
100 | + else | |
101 | + t.isValidBrowser=false; | |
102 | + | |
103 | + t.set_base_url(); | |
104 | + | |
105 | + for(var i=0; i<t.scripts_to_load.length; i++){ | |
106 | + setTimeout("editAreaLoader.load_script('"+t.baseURL + t.scripts_to_load[i]+ ".js');", 1); // let the time to Object editAreaLoader to be created before loading additionnal scripts | |
107 | + t.waiting_loading[t.scripts_to_load[i]+ ".js"]= false; | |
108 | + } | |
109 | + t.add_event(window, "load", EditAreaLoader.prototype.window_loaded); | |
110 | +}; | |
111 | + | |
112 | +EditAreaLoader.prototype ={ | |
113 | + has_error : function(){ | |
114 | + this.error= true; | |
115 | + // set to empty all EditAreaLoader functions | |
116 | + for(var i in EditAreaLoader.prototype){ | |
117 | + EditAreaLoader.prototype[i]=function(){}; | |
118 | + } | |
119 | + }, | |
120 | + | |
121 | + // add browser informations to the object passed in parameter | |
122 | + set_browser_infos : function(o){ | |
123 | + ua= navigator.userAgent; | |
124 | + | |
125 | + // general detection | |
126 | + o.isWebKit = /WebKit/.test(ua); | |
127 | + o.isGecko = !o.isWebKit && /Gecko/.test(ua); | |
128 | + o.isMac = /Mac/.test(ua); | |
129 | + | |
130 | + o.isIE = (navigator.appName == "Microsoft Internet Explorer"); | |
131 | + if(o.isIE){ | |
132 | + o.isIE = ua.replace(/^.*?MSIE\s+([0-9\.]+).*$/, "$1"); | |
133 | + if(o.isIE<6) | |
134 | + o.has_error(); | |
135 | + } | |
136 | + | |
137 | + if(o.isOpera = (ua.indexOf('Opera') != -1)){ | |
138 | + o.isOpera= ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i, "$1"); | |
139 | + if(o.isOpera<9) | |
140 | + o.has_error(); | |
141 | + o.isIE=false; | |
142 | + } | |
143 | + | |
144 | + if(o.isFirefox =(ua.indexOf('Firefox') != -1)) | |
145 | + o.isFirefox = ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i, "$1"); | |
146 | + // Firefox clones | |
147 | + if( ua.indexOf('Iceweasel') != -1 ) | |
148 | + o.isFirefox = ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i, "$1"); | |
149 | + if( ua.indexOf('GranParadiso') != -1 ) | |
150 | + o.isFirefox = ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i, "$1"); | |
151 | + if( ua.indexOf('BonEcho') != -1 ) | |
152 | + o.isFirefox = ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i, "$1"); | |
153 | + if( ua.indexOf('SeaMonkey') != -1) | |
154 | + o.isFirefox = (ua.replace(/^.*?SeaMonkey.*?([0-9\.]+).*$/i, "$1") ) + 1; | |
155 | + | |
156 | + if(o.isCamino =(ua.indexOf('Camino') != -1)) | |
157 | + o.isCamino = ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i, "$1"); | |
158 | + | |
159 | + if(o.isSafari =(ua.indexOf('Safari') != -1)) | |
160 | + o.isSafari= ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i, "$1"); | |
161 | + | |
162 | + if(o.isChrome =(ua.indexOf('Chrome') != -1)) { | |
163 | + o.isChrome = ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i, "$1"); | |
164 | + o.isSafari = false; | |
165 | + } | |
166 | + | |
167 | + }, | |
168 | + | |
169 | + window_loaded : function(){ | |
170 | + editAreaLoader.win="loaded"; | |
171 | + | |
172 | + // add events on forms | |
173 | + if (document.forms) { | |
174 | + for (var i=0; i<document.forms.length; i++) { | |
175 | + var form = document.forms[i]; | |
176 | + form.edit_area_replaced_submit=null; | |
177 | + try { | |
178 | + | |
179 | + form.edit_area_replaced_submit = form.onsubmit; | |
180 | + form.onsubmit=""; | |
181 | + } catch (e) {// Do nothing | |
182 | + } | |
183 | + editAreaLoader.add_event(form, "submit", EditAreaLoader.prototype.submit); | |
184 | + editAreaLoader.add_event(form, "reset", EditAreaLoader.prototype.reset); | |
185 | + } | |
186 | + } | |
187 | + editAreaLoader.add_event(window, "unload", function(){for(var i in editAreas){editAreaLoader.delete_instance(i);}}); // ini callback | |
188 | + }, | |
189 | + | |
190 | + // init the checkup of the selection of the IE textarea | |
191 | + init_ie_textarea : function(id){ | |
192 | + var a=document.getElementById(id); | |
193 | + try{ | |
194 | + if(a && typeof(a.focused)=="undefined"){ | |
195 | + a.focus(); | |
196 | + a.focused=true; | |
197 | + a.selectionStart= a.selectionEnd= 0; | |
198 | + get_IE_selection(a); | |
199 | + editAreaLoader.add_event(a, "focus", IE_textarea_focus); | |
200 | + editAreaLoader.add_event(a, "blur", IE_textarea_blur); | |
201 | + | |
202 | + } | |
203 | + }catch(ex){} | |
204 | + }, | |
205 | + | |
206 | + init : function(settings){ | |
207 | + var t=this,s=settings,i; | |
208 | + | |
209 | + if(!s["id"]) | |
210 | + t.has_error(); | |
211 | + if(t.error) | |
212 | + return; | |
213 | + // if an instance of the editor already exists for this textarea => delete the previous one | |
214 | + if(editAreas[s["id"]]) | |
215 | + t.delete_instance(s["id"]); | |
216 | + | |
217 | + // init settings | |
218 | + for(i in t.default_settings){ | |
219 | + if(typeof(s[i])=="undefined") | |
220 | + s[i]=t.default_settings[i]; | |
221 | + } | |
222 | + | |
223 | + if(s["browsers"]=="known" && t.isValidBrowser==false){ | |
224 | + return; | |
225 | + } | |
226 | + | |
227 | + if(s["begin_toolbar"].length>0) | |
228 | + s["toolbar"]= s["begin_toolbar"] +","+ s["toolbar"]; | |
229 | + if(s["end_toolbar"].length>0) | |
230 | + s["toolbar"]= s["toolbar"] +","+ s["end_toolbar"]; | |
231 | + s["tab_toolbar"]= s["toolbar"].replace(/ /g,"").split(","); | |
232 | + | |
233 | + s["plugins"]= s["plugins"].replace(/ /g,"").split(","); | |
234 | + for(i=0; i<s["plugins"].length; i++){ | |
235 | + if(s["plugins"][i].length==0) | |
236 | + s["plugins"].splice(i,1); | |
237 | + } | |
238 | + // alert(settings["plugins"].length+": "+ settings["plugins"].join(",")); | |
239 | + t.get_template(); | |
240 | + t.load_script(t.baseURL + "langs/"+ s["language"] + ".js"); | |
241 | + | |
242 | + if(s["syntax"].length>0){ | |
243 | + s["syntax"]=s["syntax"].toLowerCase(); | |
244 | + t.load_script(t.baseURL + "reg_syntax/"+ s["syntax"] + ".js"); | |
245 | + } | |
246 | + //alert(this.template); | |
247 | + | |
248 | + editAreas[s["id"]]= {"settings": s}; | |
249 | + editAreas[s["id"]]["displayed"]=false; | |
250 | + editAreas[s["id"]]["hidden"]=false; | |
251 | + | |
252 | + //if(settings["display"]=="onload") | |
253 | + t.start(s["id"]); | |
254 | + }, | |
255 | + | |
256 | + // delete an instance of an EditArea | |
257 | + delete_instance : function(id){ | |
258 | + var d=document,fs=window.frames,span,iframe; | |
259 | + editAreaLoader.execCommand(id, "EA_delete"); | |
260 | + if(fs["frame_"+id] && fs["frame_"+id].editArea) | |
261 | + { | |
262 | + if(editAreas[id]["displayed"]) | |
263 | + editAreaLoader.toggle(id, "off"); | |
264 | + fs["frame_"+id].editArea.execCommand("EA_unload"); | |
265 | + } | |
266 | + | |
267 | + // remove toggle infos and debug textarea | |
268 | + span= d.getElementById("EditAreaArroundInfos_"+id); | |
269 | + if(span) | |
270 | + span.parentNode.removeChild(span); | |
271 | + | |
272 | + // remove the iframe | |
273 | + iframe= d.getElementById("frame_"+id); | |
274 | + if(iframe){ | |
275 | + iframe.parentNode.removeChild(iframe); | |
276 | + //delete iframe; | |
277 | + try { | |
278 | + delete fs["frame_"+id]; | |
279 | + } catch (e) {// Do nothing | |
280 | + } | |
281 | + } | |
282 | + | |
283 | + delete editAreas[id]; | |
284 | + }, | |
285 | + | |
286 | + | |
287 | + start : function(id){ | |
288 | + var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i; | |
289 | + | |
290 | + // check that the window is loaded | |
291 | + if(t.win!="loaded"){ | |
292 | + setTimeout("editAreaLoader.start('"+id+"');", 50); | |
293 | + return; | |
294 | + } | |
295 | + | |
296 | + // check that all needed scripts are loaded | |
297 | + for( i in t.waiting_loading){ | |
298 | + if(t.waiting_loading[i]!="loaded" && typeof(t.waiting_loading[i])!="function"){ | |
299 | + setTimeout("editAreaLoader.start('"+id+"');", 50); | |
300 | + return; | |
301 | + } | |
302 | + } | |
303 | + | |
304 | + // wait until language and syntax files are loaded | |
305 | + if(!t.lang[editAreas[id]["settings"]["language"]] || (editAreas[id]["settings"]["syntax"].length>0 && !t.load_syntax[editAreas[id]["settings"]["syntax"]]) ){ | |
306 | + setTimeout("editAreaLoader.start('"+id+"');", 50); | |
307 | + return; | |
308 | + } | |
309 | + // init the regexp for syntax highlight | |
310 | + if(editAreas[id]["settings"]["syntax"].length>0) | |
311 | + t.init_syntax_regexp(); | |
312 | + | |
313 | + | |
314 | + // display toggle option and debug area | |
315 | + if(!d.getElementById("EditAreaArroundInfos_"+id) && (editAreas[id]["settings"]["debug"] || editAreas[id]["settings"]["allow_toggle"])) | |
316 | + { | |
317 | + span= d.createElement("span"); | |
318 | + span.id= "EditAreaArroundInfos_"+id; | |
319 | + if(editAreas[id]["settings"]["allow_toggle"]){ | |
320 | + checked=(editAreas[id]["settings"]["display"]=="onload")?"checked='checked'":""; | |
321 | + html+="<div id='edit_area_toggle_"+i+"'>"; | |
322 | + html+="<input id='edit_area_toggle_checkbox_"+ id +"' class='toggle_"+ id +"' type='checkbox' onclick='editAreaLoader.toggle(\""+ id +"\");' accesskey='e' "+checked+" />"; | |
323 | + html+="<label for='edit_area_toggle_checkbox_"+ id +"'>{$toggle}</label></div>"; | |
324 | + } | |
325 | + if(editAreas[id]["settings"]["debug"]) | |
326 | + html+="<textarea id='edit_area_debug_"+ id +"' spellcheck='off' style='z-index: 20; width: 100%; height: 120px;overflow: auto; border: solid black 1px;'></textarea><br />"; | |
327 | + html= t.translate(html, editAreas[id]["settings"]["language"]); | |
328 | + span.innerHTML= html; | |
329 | + father= d.getElementById(id).parentNode; | |
330 | + next= d.getElementById(id).nextSibling; | |
331 | + if(next==null) | |
332 | + father.appendChild(span); | |
333 | + else | |
334 | + father.insertBefore(span, next); | |
335 | + } | |
336 | + | |
337 | + if(!editAreas[id]["initialized"]) | |
338 | + { | |
339 | + t.execCommand(id, "EA_init"); // ini callback | |
340 | + if(editAreas[id]["settings"]["display"]=="later"){ | |
341 | + editAreas[id]["initialized"]= true; | |
342 | + return; | |
343 | + } | |
344 | + } | |
345 | + | |
346 | + if(t.isIE){ // launch IE selection checkup | |
347 | + t.init_ie_textarea(id); | |
348 | + } | |
349 | + | |
350 | + // get toolbar content | |
351 | + var area=editAreas[id]; | |
352 | + | |
353 | + for(i=0; i<area["settings"]["tab_toolbar"].length; i++){ | |
354 | + // alert(this.tab_toolbar[i]+"\n"+ this.get_control_html(this.tab_toolbar[i])); | |
355 | + html_toolbar_content+= t.get_control_html(area["settings"]["tab_toolbar"][i], area["settings"]["language"]); | |
356 | + } | |
357 | + // translate toolbar text here for chrome 2 | |
358 | + html_toolbar_content = t.translate(html_toolbar_content, area["settings"]["language"], "template"); | |
359 | + | |
360 | + | |
361 | + // create javascript import rules for the iframe if the javascript has not been already loaded by the compressor | |
362 | + if(!t.iframe_script){ | |
363 | + t.iframe_script=""; | |
364 | + for(i=0; i<t.sub_scripts_to_load.length; i++) | |
365 | + t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + t.sub_scripts_to_load[i] +'.js"></script>'; | |
366 | + } | |
367 | + | |
368 | + // add plugins scripts if not already loaded by the compressor (but need to load language in all the case) | |
369 | + for(i=0; i<area["settings"]["plugins"].length; i++){ | |
370 | + //if(typeof(area["settings"]["plugins"][i])=="function") continue; | |
371 | + if(!t.all_plugins_loaded) | |
372 | + t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + 'plugins/' + area["settings"]["plugins"][i] + '/' + area["settings"]["plugins"][i] +'.js"></script>'; | |
373 | + t.iframe_script+='<script language="javascript" type="text/javascript" src="'+ t.baseURL + 'plugins/' + area["settings"]["plugins"][i] + '/langs/' + area["settings"]["language"] +'.js"></script>'; | |
374 | + } | |
375 | + | |
376 | + | |
377 | + // create css link for the iframe if the whole css text has not been already loaded by the compressor | |
378 | + if(!t.iframe_css){ | |
379 | + t.iframe_css="<link href='"+ t.baseURL +"edit_area.css' rel='stylesheet' type='text/css' />"; | |
380 | + } | |
381 | + | |
382 | + | |
383 | + // create template | |
384 | + template= t.template.replace(/\[__BASEURL__\]/g, t.baseURL); | |
385 | + template= template.replace("[__TOOLBAR__]",html_toolbar_content); | |
386 | + | |
387 | + | |
388 | + // fill template with good language sentences | |
389 | + template= t.translate(template, area["settings"]["language"], "template"); | |
390 | + | |
391 | + // add css_code | |
392 | + template= template.replace("[__CSSRULES__]", t.iframe_css); | |
393 | + // add js_code | |
394 | + template= template.replace("[__JSCODE__]", t.iframe_script); | |
395 | + | |
396 | + // add version_code | |
397 | + template= template.replace("[__EA_VERSION__]", t.version); | |
398 | + //template=template.replace(/\{\$([^\}]+)\}/gm, this.traduc_template); | |
399 | + | |
400 | + //editAreas[area["settings"]["id"]]["template"]= template; | |
401 | + | |
402 | + area.textarea=d.getElementById(area["settings"]["id"]); | |
403 | + editAreas[area["settings"]["id"]]["textarea"]=area.textarea; | |
404 | + | |
405 | + // if removing previous instances from DOM before (fix from Marcin) | |
406 | + if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined') | |
407 | + delete window.frames["frame_"+area["settings"]["id"]]; | |
408 | + | |
409 | + // insert template in the document after the textarea | |
410 | + father= area.textarea.parentNode; | |
411 | + /* var container= document.createElement("div"); | |
412 | + container.id= "EditArea_frame_container_"+area["settings"]["id"]; | |
413 | + */ | |
414 | + content= d.createElement("iframe"); | |
415 | + content.name= "frame_"+area["settings"]["id"]; | |
416 | + content.id= "frame_"+area["settings"]["id"]; | |
417 | + content.style.borderWidth= "0px"; | |
418 | + setAttribute(content, "frameBorder", "0"); // IE | |
419 | + content.style.overflow="hidden"; | |
420 | + content.style.display="none"; | |
421 | + | |
422 | + | |
423 | + next= area.textarea.nextSibling; | |
424 | + if(next==null) | |
425 | + father.appendChild(content); | |
426 | + else | |
427 | + father.insertBefore(content, next) ; | |
428 | + f=window.frames["frame_"+area["settings"]["id"]]; | |
429 | + f.document.open(); | |
430 | + f.editAreas=editAreas; | |
431 | + f.area_id= area["settings"]["id"]; | |
432 | + f.document.area_id= area["settings"]["id"]; | |
433 | + f.document.write(template); | |
434 | + f.document.close(); | |
435 | + | |
436 | + // frame.editAreaLoader=this; | |
437 | + //editAreas[area["settings"]["id"]]["displayed"]=true; | |
438 | + | |
439 | + }, | |
440 | + | |
441 | + toggle : function(id, toggle_to){ | |
442 | + | |
443 | + /* if((editAreas[id]["displayed"]==true && toggle_to!="on") || toggle_to=="off"){ | |
444 | + this.toggle_off(id); | |
445 | + }else if((editAreas[id]["displayed"]==false && toggle_to!="off") || toggle_to=="on"){ | |
446 | + this.toggle_on(id); | |
447 | + }*/ | |
448 | + if(!toggle_to) | |
449 | + toggle_to= (editAreas[id]["displayed"]==true)?"off":"on"; | |
450 | + if(editAreas[id]["displayed"]==true && toggle_to=="off"){ | |
451 | + this.toggle_off(id); | |
452 | + }else if(editAreas[id]["displayed"]==false && toggle_to=="on"){ | |
453 | + this.toggle_on(id); | |
454 | + } | |
455 | + | |
456 | + return false; | |
457 | + }, | |
458 | + | |
459 | + // static function | |
460 | + toggle_off : function(id){ | |
461 | + var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft; | |
462 | + if(fs["frame_"+id]) | |
463 | + { | |
464 | + f = fs["frame_"+id]; | |
465 | + t = editAreas[id]["textarea"]; | |
466 | + if(f.editArea.fullscreen['isFull']) | |
467 | + f.editArea.toggle_full_screen(false); | |
468 | + editAreas[id]["displayed"]=false; | |
469 | + | |
470 | + // set wrap to off to keep same display mode (some browser get problem with this, so it need more complex operation | |
471 | + t.wrap = "off"; // for IE | |
472 | + setAttribute(t, "wrap", "off"); // for Firefox | |
473 | + parNod = t.parentNode; | |
474 | + nxtSib = t.nextSibling; | |
475 | + parNod.removeChild(t); | |
476 | + parNod.insertBefore(t, nxtSib); | |
477 | + | |
478 | + // restore values | |
479 | + t.value= f.editArea.textarea.value; | |
480 | + selStart = f.editArea.last_selection["selectionStart"]; | |
481 | + selEnd = f.editArea.last_selection["selectionEnd"]; | |
482 | + scrollTop = f.document.getElementById("result").scrollTop; | |
483 | + scrollLeft = f.document.getElementById("result").scrollLeft; | |
484 | + | |
485 | + | |
486 | + document.getElementById("frame_"+id).style.display='none'; | |
487 | + | |
488 | + t.style.display="inline"; | |
489 | + | |
490 | + try{ // IE will give an error when trying to focus an invisible or disabled textarea | |
491 | + t.focus(); | |
492 | + } catch(e){}; | |
493 | + if(this.isIE){ | |
494 | + t.selectionStart= selStart; | |
495 | + t.selectionEnd = selEnd; | |
496 | + t.focused = true; | |
497 | + set_IE_selection(t); | |
498 | + }else{ | |
499 | + if(this.isOpera && this.isOpera < 9.6 ){ // Opera bug when moving selection start and selection end | |
500 | + t.setSelectionRange(0, 0); | |
501 | + } | |
502 | + try{ | |
503 | + t.setSelectionRange(selStart, selEnd); | |
504 | + } catch(e) {}; | |
505 | + } | |
506 | + t.scrollTop= scrollTop; | |
507 | + t.scrollLeft= scrollLeft; | |
508 | + f.editArea.execCommand("toggle_off"); | |
509 | + | |
510 | + } | |
511 | + }, | |
512 | + | |
513 | + // static function | |
514 | + toggle_on : function(id){ | |
515 | + var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem; | |
516 | + | |
517 | + if(fs["frame_"+id]) | |
518 | + { | |
519 | + f = fs["frame_"+id]; | |
520 | + t = editAreas[id]["textarea"]; | |
521 | + area= f.editArea; | |
522 | + area.textarea.value= t.value; | |
523 | + | |
524 | + // store display values; | |
525 | + curPos = editAreas[id]["settings"]["cursor_position"]; | |
526 | + | |
527 | + if(t.use_last==true) | |
528 | + { | |
529 | + selStart = t.last_selectionStart; | |
530 | + selEnd = t.last_selectionEnd; | |
531 | + scrollTop = t.last_scrollTop; | |
532 | + scrollLeft = t.last_scrollLeft; | |
533 | + t.use_last=false; | |
534 | + } | |
535 | + else if( curPos == "auto" ) | |
536 | + { | |
537 | + try{ | |
538 | + selStart = t.selectionStart; | |
539 | + selEnd = t.selectionEnd; | |
540 | + scrollTop = t.scrollTop; | |
541 | + scrollLeft = t.scrollLeft; | |
542 | + //alert(scrollTop); | |
543 | + }catch(ex){} | |
544 | + } | |
545 | + | |
546 | + // set to good size | |
547 | + this.set_editarea_size_from_textarea(id, document.getElementById("frame_"+id)); | |
548 | + t.style.display="none"; | |
549 | + document.getElementById("frame_"+id).style.display="inline"; | |
550 | + area.execCommand("focus"); // without this focus opera doesn't manage well the iframe body height | |
551 | + | |
552 | + | |
553 | + // restore display values | |
554 | + editAreas[id]["displayed"]=true; | |
555 | + area.execCommand("update_size"); | |
556 | + | |
557 | + f.document.getElementById("result").scrollTop= scrollTop; | |
558 | + f.document.getElementById("result").scrollLeft= scrollLeft; | |
559 | + area.area_select(selStart, selEnd-selStart); | |
560 | + area.execCommand("toggle_on"); | |
561 | + | |
562 | + | |
563 | + } | |
564 | + else | |
565 | + { | |
566 | + /* if(this.isIE) | |
567 | + get_IE_selection(document.getElementById(id)); */ | |
568 | + elem= document.getElementById(id); | |
569 | + elem.last_selectionStart= elem.selectionStart; | |
570 | + elem.last_selectionEnd= elem.selectionEnd; | |
571 | + elem.last_scrollTop= elem.scrollTop; | |
572 | + elem.last_scrollLeft= elem.scrollLeft; | |
573 | + elem.use_last=true; | |
574 | + editAreaLoader.start(id); | |
575 | + } | |
576 | + }, | |
577 | + | |
578 | + set_editarea_size_from_textarea : function(id, frame){ | |
579 | + var elem,width,height; | |
580 | + elem = document.getElementById(id); | |
581 | + | |
582 | + width = Math.max(editAreas[id]["settings"]["min_width"], elem.offsetWidth)+"px"; | |
583 | + height = Math.max(editAreas[id]["settings"]["min_height"], elem.offsetHeight)+"px"; | |
584 | + if(elem.style.width.indexOf("%")!=-1) | |
585 | + width = elem.style.width; | |
586 | + if(elem.style.height.indexOf("%")!=-1) | |
587 | + height = elem.style.height; | |
588 | + //alert("h: "+height+" w: "+width); | |
589 | + | |
590 | + frame.style.width= width; | |
591 | + frame.style.height= height; | |
592 | + }, | |
593 | + | |
594 | + set_base_url : function(){ | |
595 | + var t=this,elems,i,docBasePath; | |
596 | + | |
597 | + if( !this.baseURL ){ | |
598 | + elems = document.getElementsByTagName('script'); | |
599 | + | |
600 | + for( i=0; i<elems.length; i++ ){ | |
601 | + if (elems[i].src && elems[i].src.match(/edit_area_[^\\\/]*$/i) ) { | |
602 | + var src = unescape( elems[i].src ); // use unescape for utf-8 encoded urls | |
603 | + src = src.substring(0, src.lastIndexOf('/')); | |
604 | + this.baseURL = src; | |
605 | + this.file_name= elems[i].src.substr(elems[i].src.lastIndexOf("/")+1); | |
606 | + break; | |
607 | + } | |
608 | + } | |
609 | + } | |
610 | + | |
611 | + docBasePath = document.location.href; | |
612 | + if (docBasePath.indexOf('?') != -1) | |
613 | + docBasePath = docBasePath.substring(0, docBasePath.indexOf('?')); | |
614 | + docBasePath = docBasePath.substring(0, docBasePath.lastIndexOf('/')); | |
615 | + | |
616 | + // If not HTTP absolute | |
617 | + if (t.baseURL.indexOf('://') == -1 && t.baseURL.charAt(0) != '/') { | |
618 | + // If site absolute | |
619 | + t.baseURL = docBasePath + "/" + t.baseURL; | |
620 | + } | |
621 | + t.baseURL +="/"; | |
622 | + }, | |
623 | + | |
624 | + get_button_html : function(id, img, exec, isFileSpecific, baseURL) { | |
625 | + var cmd,html; | |
626 | + if(!baseURL) | |
627 | + baseURL= this.baseURL; | |
628 | + cmd = 'editArea.execCommand(\'' + exec + '\')'; | |
629 | + html = '<a id="a_'+ id +'" href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self" fileSpecific="'+ (isFileSpecific?'yes':'no') +'">'; | |
630 | + html += '<img id="' + id + '" src="'+ baseURL +'images/' + img + '" title="{$' + id + '}" width="20" height="20" class="editAreaButtonNormal" onmouseover="editArea.switchClass(this,\'editAreaButtonOver\');" onmouseout="editArea.restoreClass(this);" onmousedown="editArea.restoreAndSwitchClass(this,\'editAreaButtonDown\');" /></a>'; | |
631 | + return html; | |
632 | + }, | |
633 | + | |
634 | + get_control_html : function(button_name, lang) { | |
635 | + var t=this,i,but,html,si; | |
636 | + for (i=0; i<t.advanced_buttons.length; i++) | |
637 | + { | |
638 | + but = t.advanced_buttons[i]; | |
639 | + if (but[0] == button_name) | |
640 | + { | |
641 | + return t.get_button_html(but[0], but[1], but[2], but[3]); | |
642 | + } | |
643 | + } | |
644 | + | |
645 | + switch (button_name){ | |
646 | + case "*": | |
647 | + case "return": | |
648 | + return "<br />"; | |
649 | + case "|": | |
650 | + case "separator": | |
651 | + return '<img src="'+ t.baseURL +'images/spacer.gif" width="1" height="15" class="editAreaSeparatorLine">'; | |
652 | + case "select_font": | |
653 | + html= "<select id='area_font_size' onchange='javascript:editArea.execCommand(\"change_font_size\")' fileSpecific='yes'>"; | |
654 | + html+="<option value='-1'>{$font_size}</option>"; | |
655 | + si=[8,9,10,11,12,14]; | |
656 | + for( i=0;i<si.length;i++){ | |
657 | + html+="<option value='"+si[i]+"'>"+si[i]+" pt</option>"; | |
658 | + } | |
659 | + html+="</select>"; | |
660 | + return html; | |
661 | + case "syntax_selection": | |
662 | + html= "<select id='syntax_selection' onchange='javascript:editArea.execCommand(\"change_syntax\", this.value)' fileSpecific='yes'>"; | |
663 | + html+="<option value='-1'>{$syntax_selection}</option>"; | |
664 | + html+="</select>"; | |
665 | + return html; | |
666 | + } | |
667 | + | |
668 | + return "<span id='tmp_tool_"+button_name+"'>["+button_name+"]</span>"; | |
669 | + }, | |
670 | + | |
671 | + | |
672 | + get_template : function(){ | |
673 | + if(this.template=="") | |
674 | + { | |
675 | + var xhr_object = null; | |
676 | + if(window.XMLHttpRequest) // Firefox | |
677 | + xhr_object = new XMLHttpRequest(); | |
678 | + else if(window.ActiveXObject) // Internet Explorer | |
679 | + xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); | |
680 | + else { // XMLHttpRequest not supported | |
681 | + alert("XMLHTTPRequest not supported. EditArea not loaded"); | |
682 | + return; | |
683 | + } | |
684 | + | |
685 | + xhr_object.open("GET", this.baseURL+"template.html", false); | |
686 | + xhr_object.send(null); | |
687 | + if(xhr_object.readyState == 4) | |
688 | + this.template=xhr_object.responseText; | |
689 | + else | |
690 | + this.has_error(); | |
691 | + } | |
692 | + }, | |
693 | + | |
694 | + // translate text | |
695 | + translate : function(text, lang, mode){ | |
696 | + if(mode=="word") | |
697 | + text=editAreaLoader.get_word_translation(text, lang); | |
698 | + else if(mode="template"){ | |
699 | + editAreaLoader.current_language= lang; | |
700 | + text=text.replace(/\{\$([^\}]+)\}/gm, editAreaLoader.translate_template); | |
701 | + } | |
702 | + return text; | |
703 | + }, | |
704 | + | |
705 | + translate_template : function(){ | |
706 | + return editAreaLoader.get_word_translation(EditAreaLoader.prototype.translate_template.arguments[1], editAreaLoader.current_language); | |
707 | + }, | |
708 | + | |
709 | + get_word_translation : function(val, lang){ | |
710 | + var i; | |
711 | + | |
712 | + for( i in editAreaLoader.lang[lang]){ | |
713 | + if(i == val) | |
714 | + return editAreaLoader.lang[lang][i]; | |
715 | + } | |
716 | + return "_"+val; | |
717 | + }, | |
718 | + | |
719 | + load_script : function(url){ | |
720 | + var t=this,d=document,script,head; | |
721 | + | |
722 | + if( t.loadedFiles[url] ) | |
723 | + return; | |
724 | + //alert("load: "+url); | |
725 | + try{ | |
726 | + script= d.createElement("script"); | |
727 | + script.type= "text/javascript"; | |
728 | + script.src= url; | |
729 | + script.charset= "UTF-8"; | |
730 | + d.getElementsByTagName("head")[0].appendChild(script); | |
731 | + }catch(e){ | |
732 | + d.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '" charset="UTF-8"></sc'+'ript>'); | |
733 | + } | |
734 | + | |
735 | + t.loadedFiles[url] = true; | |
736 | + }, | |
737 | + | |
738 | + add_event : function(obj, name, handler) { | |
739 | + try{ | |
740 | + if (obj.attachEvent) { | |
741 | + obj.attachEvent("on" + name, handler); | |
742 | + } else{ | |
743 | + obj.addEventListener(name, handler, false); | |
744 | + } | |
745 | + }catch(e){} | |
746 | + }, | |
747 | + | |
748 | + remove_event : function(obj, name, handler){ | |
749 | + try{ | |
750 | + if (obj.detachEvent) | |
751 | + obj.detachEvent("on" + name, handler); | |
752 | + else | |
753 | + obj.removeEventListener(name, handler, false); | |
754 | + }catch(e){} | |
755 | + }, | |
756 | + | |
757 | + | |
758 | + // reset all the editareas in the form that have been reseted | |
759 | + reset : function(e){ | |
760 | + var formObj,is_child,i,x; | |
761 | + | |
762 | + formObj = editAreaLoader.isIE ? window.event.srcElement : e.target; | |
763 | + if(formObj.tagName!='FORM') | |
764 | + formObj= formObj.form; | |
765 | + | |
766 | + for( i in editAreas ){ | |
767 | + is_child= false; | |
768 | + for( x=0;x<formObj.elements.length;x++ ) { | |
769 | + if(formObj.elements[x].id == i) | |
770 | + is_child=true; | |
771 | + } | |
772 | + | |
773 | + if(window.frames["frame_"+i] && is_child && editAreas[i]["displayed"]==true){ | |
774 | + | |
775 | + var exec= 'window.frames["frame_'+ i +'"].editArea.textarea.value= document.getElementById("'+ i +'").value;'; | |
776 | + exec+= 'window.frames["frame_'+ i +'"].editArea.execCommand("focus");'; | |
777 | + exec+= 'window.frames["frame_'+ i +'"].editArea.check_line_selection();'; | |
778 | + exec+= 'window.frames["frame_'+ i +'"].editArea.execCommand("reset");'; | |
779 | + window.setTimeout(exec, 10); | |
780 | + } | |
781 | + } | |
782 | + return; | |
783 | + }, | |
784 | + | |
785 | + | |
786 | + // prepare all the textarea replaced by an editarea to be submited | |
787 | + submit : function(e){ | |
788 | + var formObj,is_child,fs=window.frames,i,x; | |
789 | + formObj = editAreaLoader.isIE ? window.event.srcElement : e.target; | |
790 | + if(formObj.tagName!='FORM') | |
791 | + formObj= formObj.form; | |
792 | + | |
793 | + for( i in editAreas){ | |
794 | + is_child= false; | |
795 | + for( x=0;x<formObj.elements.length;x++ ) { | |
796 | + if(formObj.elements[x].id == i) | |
797 | + is_child=true; | |
798 | + } | |
799 | + | |
800 | + if(is_child) | |
801 | + { | |
802 | + if(fs["frame_"+i] && editAreas[i]["displayed"]==true) | |
803 | + document.getElementById(i).value= fs["frame_"+ i].editArea.textarea.value; | |
804 | + editAreaLoader.execCommand(i,"EA_submit"); | |
805 | + } | |
806 | + } | |
807 | + if( typeof(formObj.edit_area_replaced_submit) == "function" ){ | |
808 | + res= formObj.edit_area_replaced_submit(); | |
809 | + if(res==false){ | |
810 | + if(editAreaLoader.isIE) | |
811 | + return false; | |
812 | + else | |
813 | + e.preventDefault(); | |
814 | + } | |
815 | + } | |
816 | + return; | |
817 | + }, | |
818 | + | |
819 | + // allow to get the value of the editarea | |
820 | + getValue : function(id){ | |
821 | + if(window.frames["frame_"+id] && editAreas[id]["displayed"]==true){ | |
822 | + return window.frames["frame_"+ id].editArea.textarea.value; | |
823 | + }else if(elem=document.getElementById(id)){ | |
824 | + return elem.value; | |
825 | + } | |
826 | + return false; | |
827 | + }, | |
828 | + | |
829 | + // allow to set the value of the editarea | |
830 | + setValue : function(id, new_val){ | |
831 | + var fs=window.frames; | |
832 | + | |
833 | + if( ( f=fs["frame_"+id] ) && editAreas[id]["displayed"]==true){ | |
834 | + f.editArea.textarea.value= new_val; | |
835 | + f.editArea.execCommand("focus"); | |
836 | + f.editArea.check_line_selection(false); | |
837 | + f.editArea.execCommand("onchange"); | |
838 | + }else if(elem=document.getElementById(id)){ | |
839 | + elem.value= new_val; | |
840 | + } | |
841 | + }, | |
842 | + | |
843 | + // allow to get infos on the selection: array(start, end) | |
844 | + getSelectionRange : function(id){ | |
845 | + var sel,eA,fs=window.frames; | |
846 | + | |
847 | + sel= {"start": 0, "end": 0}; | |
848 | + if(fs["frame_"+id] && editAreas[id]["displayed"]==true){ | |
849 | + eA= fs["frame_"+ id].editArea; | |
850 | + | |
851 | + sel["start"] = eA.textarea.selectionStart; | |
852 | + sel["end"] = eA.textarea.selectionEnd; | |
853 | + | |
854 | + }else if( elem=document.getElementById(id) ){ | |
855 | + sel= getSelectionRange(elem); | |
856 | + } | |
857 | + return sel; | |
858 | + }, | |
859 | + | |
860 | + // allow to set the selection with the given start and end positions | |
861 | + setSelectionRange : function(id, new_start, new_end){ | |
862 | + var fs=window.frames; | |
863 | + | |
864 | + if(fs["frame_"+id] && editAreas[id]["displayed"]==true){ | |
865 | + fs["frame_"+ id].editArea.area_select(new_start, new_end-new_start); | |
866 | + // make an auto-scroll to the selection | |
867 | + if(!this.isIE){ | |
868 | + fs["frame_"+ id].editArea.check_line_selection(false); | |
869 | + fs["frame_"+ id].editArea.scroll_to_view(); | |
870 | + } | |
871 | + }else if(elem=document.getElementById(id)){ | |
872 | + setSelectionRange(elem, new_start, new_end); | |
873 | + } | |
874 | + }, | |
875 | + | |
876 | + getSelectedText : function(id){ | |
877 | + var sel= this.getSelectionRange(id); | |
878 | + | |
879 | + return this.getValue(id).substring(sel["start"], sel["end"]); | |
880 | + }, | |
881 | + | |
882 | + setSelectedText : function(id, new_val){ | |
883 | + var fs=window.frames,d=document,sel,text,scrollTop,scrollLeft,new_sel_end; | |
884 | + | |
885 | + new_val = new_val.replace(/\r/g, ""); | |
886 | + sel = this.getSelectionRange(id); | |
887 | + text = this.getValue(id); | |
888 | + if(fs["frame_"+id] && editAreas[id]["displayed"]==true){ | |
889 | + scrollTop = fs["frame_"+ id].document.getElementById("result").scrollTop; | |
890 | + scrollLeft = fs["frame_"+ id].document.getElementById("result").scrollLeft; | |
891 | + }else{ | |
892 | + scrollTop = d.getElementById(id).scrollTop; | |
893 | + scrollLeft = d.getElementById(id).scrollLeft; | |
894 | + } | |
895 | + | |
896 | + text = text.substring(0, sel["start"])+ new_val +text.substring(sel["end"]); | |
897 | + this.setValue(id, text); | |
898 | + new_sel_end = sel["start"]+ new_val.length; | |
899 | + this.setSelectionRange(id, sel["start"], new_sel_end); | |
900 | + | |
901 | + | |
902 | + // fix \r problem for selection length count on IE & Opera | |
903 | + if(new_val != this.getSelectedText(id).replace(/\r/g, "")){ | |
904 | + this.setSelectionRange(id, sel["start"], new_sel_end+ new_val.split("\n").length -1); | |
905 | + } | |
906 | + // restore scrolling position | |
907 | + if(fs["frame_"+id] && editAreas[id]["displayed"]==true){ | |
908 | + fs["frame_"+ id].document.getElementById("result").scrollTop= scrollTop; | |
909 | + fs["frame_"+ id].document.getElementById("result").scrollLeft= scrollLeft; | |
910 | + fs["frame_"+ id].editArea.execCommand("onchange"); | |
911 | + }else{ | |
912 | + d.getElementById(id).scrollTop= scrollTop; | |
913 | + d.getElementById(id).scrollLeft= scrollLeft; | |
914 | + } | |
915 | + }, | |
916 | + | |
917 | + insertTags : function(id, open_tag, close_tag){ | |
918 | + var old_sel,new_sel; | |
919 | + | |
920 | + old_sel = this.getSelectionRange(id); | |
921 | + text = open_tag + this.getSelectedText(id) + close_tag; | |
922 | + | |
923 | + editAreaLoader.setSelectedText(id, text); | |
924 | + | |
925 | + new_sel = this.getSelectionRange(id); | |
926 | + if(old_sel["end"] > old_sel["start"]) // if text was selected, cursor at the end | |
927 | + this.setSelectionRange(id, new_sel["end"], new_sel["end"]); | |
928 | + else // cursor in the middle | |
929 | + this.setSelectionRange(id, old_sel["start"]+open_tag.length, old_sel["start"]+open_tag.length); | |
930 | + }, | |
931 | + | |
932 | + // hide both EditArea and normal textarea | |
933 | + hide : function(id){ | |
934 | + var fs= window.frames,d=document,t=this,scrollTop,scrollLeft,span; | |
935 | + if(d.getElementById(id) && !t.hidden[id]) | |
936 | + { | |
937 | + t.hidden[id]= {}; | |
938 | + t.hidden[id]["selectionRange"]= t.getSelectionRange(id); | |
939 | + if(d.getElementById(id).style.display!="none") | |
940 | + { | |
941 | + t.hidden[id]["scrollTop"]= d.getElementById(id).scrollTop; | |
942 | + t.hidden[id]["scrollLeft"]= d.getElementById(id).scrollLeft; | |
943 | + } | |
944 | + | |
945 | + if(fs["frame_"+id]) | |
946 | + { | |
947 | + t.hidden[id]["toggle"]= editAreas[id]["displayed"]; | |
948 | + | |
949 | + if(fs["frame_"+id] && editAreas[id]["displayed"]==true){ | |
950 | + scrollTop = fs["frame_"+ id].document.getElementById("result").scrollTop; | |
951 | + scrollLeft = fs["frame_"+ id].document.getElementById("result").scrollLeft; | |
952 | + }else{ | |
953 | + scrollTop = d.getElementById(id).scrollTop; | |
954 | + scrollLeft = d.getElementById(id).scrollLeft; | |
955 | + } | |
956 | + t.hidden[id]["scrollTop"]= scrollTop; | |
957 | + t.hidden[id]["scrollLeft"]= scrollLeft; | |
958 | + | |
959 | + if(editAreas[id]["displayed"]==true) | |
960 | + editAreaLoader.toggle_off(id); | |
961 | + } | |
962 | + | |
963 | + // hide toggle button and debug box | |
964 | + span= d.getElementById("EditAreaArroundInfos_"+id); | |
965 | + if(span){ | |
966 | + span.style.display='none'; | |
967 | + } | |
968 | + | |
969 | + // hide textarea | |
970 | + d.getElementById(id).style.display= "none"; | |
971 | + } | |
972 | + }, | |
973 | + | |
974 | + // restore hidden EditArea and normal textarea | |
975 | + show : function(id){ | |
976 | + var fs= window.frames,d=document,t=this,span; | |
977 | + if((elem=d.getElementById(id)) && t.hidden[id]) | |
978 | + { | |
979 | + elem.style.display= "inline"; | |
980 | + elem.scrollTop= t.hidden[id]["scrollTop"]; | |
981 | + elem.scrollLeft= t.hidden[id]["scrollLeft"]; | |
982 | + span= d.getElementById("EditAreaArroundInfos_"+id); | |
983 | + if(span){ | |
984 | + span.style.display='inline'; | |
985 | + } | |
986 | + | |
987 | + if(fs["frame_"+id]) | |
988 | + { | |
989 | + | |
990 | + // restore toggle button and debug box | |
991 | + | |
992 | + | |
993 | + // restore textarea | |
994 | + elem.style.display= "inline"; | |
995 | + | |
996 | + // restore EditArea | |
997 | + if(t.hidden[id]["toggle"]==true) | |
998 | + editAreaLoader.toggle_on(id); | |
999 | + | |
1000 | + scrollTop = t.hidden[id]["scrollTop"]; | |
1001 | + scrollLeft = t.hidden[id]["scrollLeft"]; | |
1002 | + | |
1003 | + if(fs["frame_"+id] && editAreas[id]["displayed"]==true){ | |
1004 | + fs["frame_"+ id].document.getElementById("result").scrollTop = scrollTop; | |
1005 | + fs["frame_"+ id].document.getElementById("result").scrollLeft = scrollLeft; | |
1006 | + }else{ | |
1007 | + elem.scrollTop = scrollTop; | |
1008 | + elem.scrollLeft = scrollLeft; | |
1009 | + } | |
1010 | + | |
1011 | + } | |
1012 | + // restore selection | |
1013 | + sel = t.hidden[id]["selectionRange"]; | |
1014 | + t.setSelectionRange(id, sel["start"], sel["end"]); | |
1015 | + delete t.hidden[id]; | |
1016 | + } | |
1017 | + }, | |
1018 | + | |
1019 | + // get the current file datas (for multi file editing mode) | |
1020 | + getCurrentFile : function(id){ | |
1021 | + return this.execCommand(id, 'get_file', this.execCommand(id, 'curr_file')); | |
1022 | + }, | |
1023 | + | |
1024 | + // get the given file datas (for multi file editing mode) | |
1025 | + getFile : function(id, file_id){ | |
1026 | + return this.execCommand(id, 'get_file', file_id); | |
1027 | + }, | |
1028 | + | |
1029 | + // get all the openned files datas (for multi file editing mode) | |
1030 | + getAllFiles : function(id){ | |
1031 | + return this.execCommand(id, 'get_all_files()'); | |
1032 | + }, | |
1033 | + | |
1034 | + // open a file (for multi file editing mode) | |
1035 | + openFile : function(id, file_infos){ | |
1036 | + return this.execCommand(id, 'open_file', file_infos); | |
1037 | + }, | |
1038 | + | |
1039 | + // close the given file (for multi file editing mode) | |
1040 | + closeFile : function(id, file_id){ | |
1041 | + return this.execCommand(id, 'close_file', file_id); | |
1042 | + }, | |
1043 | + | |
1044 | + // close the given file (for multi file editing mode) | |
1045 | + setFileEditedMode : function(id, file_id, to){ | |
1046 | + var reg1,reg2; | |
1047 | + reg1 = new RegExp('\\\\', 'g'); | |
1048 | + reg2 = new RegExp('"', 'g'); | |
1049 | + return this.execCommand(id, 'set_file_edited_mode("'+ file_id.replace(reg1, '\\\\').replace(reg2, '\\"') +'", '+ to +')'); | |
1050 | + }, | |
1051 | + | |
1052 | + | |
1053 | + // allow to access to editarea functions and datas (for advanced users only) | |
1054 | + execCommand : function(id, cmd, fct_param){ | |
1055 | + switch(cmd){ | |
1056 | + case "EA_init": | |
1057 | + if(editAreas[id]['settings']["EA_init_callback"].length>0) | |
1058 | + eval(editAreas[id]['settings']["EA_init_callback"]+"('"+ id +"');"); | |
1059 | + break; | |
1060 | + case "EA_delete": | |
1061 | + if(editAreas[id]['settings']["EA_delete_callback"].length>0) | |
1062 | + eval(editAreas[id]['settings']["EA_delete_callback"]+"('"+ id +"');"); | |
1063 | + break; | |
1064 | + case "EA_submit": | |
1065 | + if(editAreas[id]['settings']["submit_callback"].length>0) | |
1066 | + eval(editAreas[id]['settings']["submit_callback"]+"('"+ id +"');"); | |
1067 | + break; | |
1068 | + } | |
1069 | + if(window.frames["frame_"+id] && window.frames["frame_"+ id].editArea){ | |
1070 | + if(fct_param!=undefined) | |
1071 | + return eval('window.frames["frame_'+ id +'"].editArea.'+ cmd +'(fct_param);'); | |
1072 | + else | |
1073 | + return eval('window.frames["frame_'+ id +'"].editArea.'+ cmd +';'); | |
1074 | + } | |
1075 | + return false; | |
1076 | + } | |
1077 | +}; | |
1078 | + | |
1079 | + var editAreaLoader= new EditAreaLoader(); | |
1080 | + var editAreas= {}; | |
1081 | + | ... | ... |
docs/js/editarea_0_8_2/edit_area/elements_functions.js
0 → 100644
1 | +/**** | |
2 | + * This page contains some general usefull functions for javascript | |
3 | + * | |
4 | + ****/ | |
5 | + | |
6 | + | |
7 | + // need to redefine this functiondue to IE problem | |
8 | + function getAttribute( elm, aName ) { | |
9 | + var aValue,taName,i; | |
10 | + try{ | |
11 | + aValue = elm.getAttribute( aName ); | |
12 | + }catch(exept){} | |
13 | + | |
14 | + if( ! aValue ){ | |
15 | + for( i = 0; i < elm.attributes.length; i ++ ) { | |
16 | + taName = elm.attributes[i] .name.toLowerCase(); | |
17 | + if( taName == aName ) { | |
18 | + aValue = elm.attributes[i] .value; | |
19 | + return aValue; | |
20 | + } | |
21 | + } | |
22 | + } | |
23 | + return aValue; | |
24 | + }; | |
25 | + | |
26 | + // need to redefine this function due to IE problem | |
27 | + function setAttribute( elm, attr, val ) { | |
28 | + if(attr=="class"){ | |
29 | + elm.setAttribute("className", val); | |
30 | + elm.setAttribute("class", val); | |
31 | + }else{ | |
32 | + elm.setAttribute(attr, val); | |
33 | + } | |
34 | + }; | |
35 | + | |
36 | + /* return a child element | |
37 | + elem: element we are searching in | |
38 | + elem_type: type of the eleemnt we are searching (DIV, A, etc...) | |
39 | + elem_attribute: attribute of the searched element that must match | |
40 | + elem_attribute_match: value that elem_attribute must match | |
41 | + option: "all" if must return an array of all children, otherwise return the first match element | |
42 | + depth: depth of search (-1 or no set => unlimited) | |
43 | + */ | |
44 | + function getChildren(elem, elem_type, elem_attribute, elem_attribute_match, option, depth) | |
45 | + { | |
46 | + if(!option) | |
47 | + var option="single"; | |
48 | + if(!depth) | |
49 | + var depth=-1; | |
50 | + if(elem){ | |
51 | + var children= elem.childNodes; | |
52 | + var result=null; | |
53 | + var results= []; | |
54 | + for (var x=0;x<children.length;x++) { | |
55 | + strTagName = new String(children[x].tagName); | |
56 | + children_class="?"; | |
57 | + if(strTagName!= "undefined"){ | |
58 | + child_attribute= getAttribute(children[x],elem_attribute); | |
59 | + if((strTagName.toLowerCase()==elem_type.toLowerCase() || elem_type=="") && (elem_attribute=="" || child_attribute==elem_attribute_match)){ | |
60 | + if(option=="all"){ | |
61 | + results.push(children[x]); | |
62 | + }else{ | |
63 | + return children[x]; | |
64 | + } | |
65 | + } | |
66 | + if(depth!=0){ | |
67 | + result=getChildren(children[x], elem_type, elem_attribute, elem_attribute_match, option, depth-1); | |
68 | + if(option=="all"){ | |
69 | + if(result.length>0){ | |
70 | + results= results.concat(result); | |
71 | + } | |
72 | + }else if(result!=null){ | |
73 | + return result; | |
74 | + } | |
75 | + } | |
76 | + } | |
77 | + } | |
78 | + if(option=="all") | |
79 | + return results; | |
80 | + } | |
81 | + return null; | |
82 | + }; | |
83 | + | |
84 | + function isChildOf(elem, parent){ | |
85 | + if(elem){ | |
86 | + if(elem==parent) | |
87 | + return true; | |
88 | + while(elem.parentNode != 'undefined'){ | |
89 | + return isChildOf(elem.parentNode, parent); | |
90 | + } | |
91 | + } | |
92 | + return false; | |
93 | + }; | |
94 | + | |
95 | + function getMouseX(e){ | |
96 | + | |
97 | + if(e!=null && typeof(e.pageX)!="undefined"){ | |
98 | + return e.pageX; | |
99 | + }else{ | |
100 | + return (e!=null?e.x:event.x)+ document.documentElement.scrollLeft; | |
101 | + } | |
102 | + }; | |
103 | + | |
104 | + function getMouseY(e){ | |
105 | + if(e!=null && typeof(e.pageY)!="undefined"){ | |
106 | + return e.pageY; | |
107 | + }else{ | |
108 | + return (e!=null?e.y:event.y)+ document.documentElement.scrollTop; | |
109 | + } | |
110 | + }; | |
111 | + | |
112 | + function calculeOffsetLeft(r){ | |
113 | + return calculeOffset(r,"offsetLeft") | |
114 | + }; | |
115 | + | |
116 | + function calculeOffsetTop(r){ | |
117 | + return calculeOffset(r,"offsetTop") | |
118 | + }; | |
119 | + | |
120 | + function calculeOffset(element,attr){ | |
121 | + var offset=0; | |
122 | + while(element){ | |
123 | + offset+=element[attr]; | |
124 | + element=element.offsetParent | |
125 | + } | |
126 | + return offset; | |
127 | + }; | |
128 | + | |
129 | + /** return the computed style | |
130 | + * @param: elem: the reference to the element | |
131 | + * @param: prop: the name of the css property | |
132 | + */ | |
133 | + function get_css_property(elem, prop) | |
134 | + { | |
135 | + if(document.defaultView) | |
136 | + { | |
137 | + return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop); | |
138 | + } | |
139 | + else if(elem.currentStyle) | |
140 | + { | |
141 | + var prop = prop.replace(/-\D/gi, function(sMatch) | |
142 | + { | |
143 | + return sMatch.charAt(sMatch.length - 1).toUpperCase(); | |
144 | + }); | |
145 | + return elem.currentStyle[prop]; | |
146 | + } | |
147 | + else return null; | |
148 | + } | |
149 | + | |
150 | +/**** | |
151 | + * Moving an element | |
152 | + ***/ | |
153 | + | |
154 | + var _mCE; // currently moving element | |
155 | + | |
156 | + /* allow to move an element in a window | |
157 | + e: the event | |
158 | + id: the id of the element | |
159 | + frame: the frame of the element | |
160 | + ex of use: | |
161 | + in html: <img id='move_area_search_replace' onmousedown='return parent.start_move_element(event,"area_search_replace", parent.frames["this_frame_id"]);' .../> | |
162 | + or | |
163 | + in javascript: document.getElementById("my_div").onmousedown= start_move_element | |
164 | + */ | |
165 | + function start_move_element(e, id, frame){ | |
166 | + var elem_id=(e.target || e.srcElement).id; | |
167 | + if(id) | |
168 | + elem_id=id; | |
169 | + if(!frame) | |
170 | + frame=window; | |
171 | + if(frame.event) | |
172 | + e=frame.event; | |
173 | + | |
174 | + _mCE= frame.document.getElementById(elem_id); | |
175 | + _mCE.frame=frame; | |
176 | + frame.document.onmousemove= move_element; | |
177 | + frame.document.onmouseup= end_move_element; | |
178 | + /*_mCE.onmousemove= move_element; | |
179 | + _mCE.onmouseup= end_move_element;*/ | |
180 | + | |
181 | + //alert(_mCE.frame.document.body.offsetHeight); | |
182 | + | |
183 | + mouse_x= getMouseX(e); | |
184 | + mouse_y= getMouseY(e); | |
185 | + //window.status=frame+ " elem: "+elem_id+" elem: "+ _mCE + " mouse_x: "+mouse_x; | |
186 | + _mCE.start_pos_x = mouse_x - (_mCE.style.left.replace("px","") || calculeOffsetLeft(_mCE)); | |
187 | + _mCE.start_pos_y = mouse_y - (_mCE.style.top.replace("px","") || calculeOffsetTop(_mCE)); | |
188 | + return false; | |
189 | + }; | |
190 | + | |
191 | + function end_move_element(e){ | |
192 | + _mCE.frame.document.onmousemove= ""; | |
193 | + _mCE.frame.document.onmouseup= ""; | |
194 | + _mCE=null; | |
195 | + }; | |
196 | + | |
197 | + function move_element(e){ | |
198 | + var newTop,newLeft,maxLeft; | |
199 | + | |
200 | + if( _mCE.frame && _mCE.frame.event ) | |
201 | + e=_mCE.frame.event; | |
202 | + newTop = getMouseY(e) - _mCE.start_pos_y; | |
203 | + newLeft = getMouseX(e) - _mCE.start_pos_x; | |
204 | + | |
205 | + maxLeft = _mCE.frame.document.body.offsetWidth- _mCE.offsetWidth; | |
206 | + max_top = _mCE.frame.document.body.offsetHeight- _mCE.offsetHeight; | |
207 | + newTop = Math.min(Math.max(0, newTop), max_top); | |
208 | + newLeft = Math.min(Math.max(0, newLeft), maxLeft); | |
209 | + | |
210 | + _mCE.style.top = newTop+"px"; | |
211 | + _mCE.style.left = newLeft+"px"; | |
212 | + return false; | |
213 | + }; | |
214 | + | |
215 | +/*** | |
216 | + * Managing a textarea (this part need the navigator infos from editAreaLoader | |
217 | + ***/ | |
218 | + | |
219 | + var nav= editAreaLoader.nav; | |
220 | + | |
221 | + // allow to get infos on the selection: array(start, end) | |
222 | + function getSelectionRange(textarea){ | |
223 | + return {"start": textarea.selectionStart, "end": textarea.selectionEnd}; | |
224 | + }; | |
225 | + | |
226 | + // allow to set the selection | |
227 | + function setSelectionRange(t, start, end){ | |
228 | + t.focus(); | |
229 | + | |
230 | + start = Math.max(0, Math.min(t.value.length, start)); | |
231 | + end = Math.max(start, Math.min(t.value.length, end)); | |
232 | + | |
233 | + if( nav.isOpera && nav.isOpera < 9.6 ){ // Opera bug when moving selection start and selection end | |
234 | + t.selectionEnd = 1; | |
235 | + t.selectionStart = 0; | |
236 | + t.selectionEnd = 1; | |
237 | + t.selectionStart = 0; | |
238 | + } | |
239 | + t.selectionStart = start; | |
240 | + t.selectionEnd = end; | |
241 | + //textarea.setSelectionRange(start, end); | |
242 | + | |
243 | + if(nav.isIE) | |
244 | + set_IE_selection(t); | |
245 | + }; | |
246 | + | |
247 | + | |
248 | + // set IE position in Firefox mode (textarea.selectionStart and textarea.selectionEnd). should work as a repeated task | |
249 | + function get_IE_selection(t){ | |
250 | + var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab; | |
251 | + if(t && t.focused) | |
252 | + { | |
253 | + if(!t.ea_line_height) | |
254 | + { // calculate the lineHeight | |
255 | + div= d.createElement("div"); | |
256 | + div.style.fontFamily= get_css_property(t, "font-family"); | |
257 | + div.style.fontSize= get_css_property(t, "font-size"); | |
258 | + div.style.visibility= "hidden"; | |
259 | + div.innerHTML="0"; | |
260 | + d.body.appendChild(div); | |
261 | + t.ea_line_height= div.offsetHeight; | |
262 | + d.body.removeChild(div); | |
263 | + } | |
264 | + //t.focus(); | |
265 | + range = d.selection.createRange(); | |
266 | + try | |
267 | + { | |
268 | + stored_range = range.duplicate(); | |
269 | + stored_range.moveToElementText( t ); | |
270 | + stored_range.setEndPoint( 'EndToEnd', range ); | |
271 | + if(stored_range.parentElement() == t){ | |
272 | + // the range don't take care of empty lines in the end of the selection | |
273 | + elem = t; | |
274 | + scrollTop = 0; | |
275 | + while(elem.parentNode){ | |
276 | + scrollTop+= elem.scrollTop; | |
277 | + elem = elem.parentNode; | |
278 | + } | |
279 | + | |
280 | + // var scrollTop= t.scrollTop + document.body.scrollTop; | |
281 | + | |
282 | + // var relative_top= range.offsetTop - calculeOffsetTop(t) + scrollTop; | |
283 | + relative_top= range.offsetTop - calculeOffsetTop(t)+ scrollTop; | |
284 | + // alert("rangeoffset: "+ range.offsetTop +"\ncalcoffsetTop: "+ calculeOffsetTop(t) +"\nrelativeTop: "+ relative_top); | |
285 | + line_start = Math.round((relative_top / t.ea_line_height) +1); | |
286 | + | |
287 | + line_nb = Math.round(range.boundingHeight / t.ea_line_height); | |
288 | + | |
289 | + range_start = stored_range.text.length - range.text.length; | |
290 | + tab = t.value.substr(0, range_start).split("\n"); | |
291 | + range_start += (line_start - tab.length)*2; // add missing empty lines to the selection | |
292 | + t.selectionStart = range_start; | |
293 | + | |
294 | + range_end = t.selectionStart + range.text.length; | |
295 | + tab = t.value.substr(0, range_start + range.text.length).split("\n"); | |
296 | + range_end += (line_start + line_nb - 1 - tab.length)*2; | |
297 | + t.selectionEnd = range_end; | |
298 | + } | |
299 | + } | |
300 | + catch(e){} | |
301 | + } | |
302 | + if( t && t.id ) | |
303 | + { | |
304 | + setTimeout("get_IE_selection(document.getElementById('"+ t.id +"'));", 50); | |
305 | + } | |
306 | + }; | |
307 | + | |
308 | + function IE_textarea_focus(){ | |
309 | + event.srcElement.focused= true; | |
310 | + } | |
311 | + | |
312 | + function IE_textarea_blur(){ | |
313 | + event.srcElement.focused= false; | |
314 | + } | |
315 | + | |
316 | + // select the text for IE (take into account the \r difference) | |
317 | + function set_IE_selection( t ){ | |
318 | + var nbLineStart,nbLineStart,nbLineEnd,range; | |
319 | + if(!window.closed){ | |
320 | + nbLineStart=t.value.substr(0, t.selectionStart).split("\n").length - 1; | |
321 | + nbLineEnd=t.value.substr(0, t.selectionEnd).split("\n").length - 1; | |
322 | + try | |
323 | + { | |
324 | + range = document.selection.createRange(); | |
325 | + range.moveToElementText( t ); | |
326 | + range.setEndPoint( 'EndToStart', range ); | |
327 | + range.moveStart('character', t.selectionStart - nbLineStart); | |
328 | + range.moveEnd('character', t.selectionEnd - nbLineEnd - (t.selectionStart - nbLineStart) ); | |
329 | + range.select(); | |
330 | + } | |
331 | + catch(e){} | |
332 | + } | |
333 | + }; | |
334 | + | |
335 | + | |
336 | + editAreaLoader.waiting_loading["elements_functions.js"]= "loaded"; | ... | ... |
docs/js/editarea_0_8_2/edit_area/highlight.js
0 → 100644
1 | + // change_to: "on" or "off" | |
2 | + EditArea.prototype.change_highlight= function(change_to){ | |
3 | + if(this.settings["syntax"].length==0 && change_to==false){ | |
4 | + this.switchClassSticky(_$("highlight"), 'editAreaButtonDisabled', true); | |
5 | + this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonDisabled', true); | |
6 | + return false; | |
7 | + } | |
8 | + | |
9 | + if(this.do_highlight==change_to) | |
10 | + return false; | |
11 | + | |
12 | + | |
13 | + this.getIESelection(); | |
14 | + var pos_start= this.textarea.selectionStart; | |
15 | + var pos_end= this.textarea.selectionEnd; | |
16 | + | |
17 | + if(this.do_highlight===true || change_to==false) | |
18 | + this.disable_highlight(); | |
19 | + else | |
20 | + this.enable_highlight(); | |
21 | + this.textarea.focus(); | |
22 | + this.textarea.selectionStart = pos_start; | |
23 | + this.textarea.selectionEnd = pos_end; | |
24 | + this.setIESelection(); | |
25 | + | |
26 | + }; | |
27 | + | |
28 | + EditArea.prototype.disable_highlight= function(displayOnly){ | |
29 | + var t= this, a=t.textarea, new_Obj, old_class, new_class; | |
30 | + | |
31 | + t.selection_field.innerHTML=""; | |
32 | + t.selection_field_text.innerHTML=""; | |
33 | + t.content_highlight.style.visibility="hidden"; | |
34 | + // replacing the node is far more faster than deleting it's content in firefox | |
35 | + new_Obj= t.content_highlight.cloneNode(false); | |
36 | + new_Obj.innerHTML= ""; | |
37 | + t.content_highlight.parentNode.insertBefore(new_Obj, t.content_highlight); | |
38 | + t.content_highlight.parentNode.removeChild(t.content_highlight); | |
39 | + t.content_highlight= new_Obj; | |
40 | + old_class= parent.getAttribute( a,"class" ); | |
41 | + if(old_class){ | |
42 | + new_class= old_class.replace( "hidden","" ); | |
43 | + parent.setAttribute( a, "class", new_class ); | |
44 | + } | |
45 | + | |
46 | + a.style.backgroundColor="transparent"; // needed in order to see the bracket finders | |
47 | + | |
48 | + //var icon= document.getElementById("highlight"); | |
49 | + //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") ); | |
50 | + //t.restoreClass(icon); | |
51 | + //t.switchClass(icon,'editAreaButtonNormal'); | |
52 | + t.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', true); | |
53 | + t.switchClassSticky(_$("reset_highlight"), 'editAreaButtonDisabled', true); | |
54 | + | |
55 | + t.do_highlight=false; | |
56 | + | |
57 | + t.switchClassSticky(_$("change_smooth_selection"), 'editAreaButtonSelected', true); | |
58 | + if(typeof(t.smooth_selection_before_highlight)!="undefined" && t.smooth_selection_before_highlight===false){ | |
59 | + t.change_smooth_selection_mode(false); | |
60 | + } | |
61 | + | |
62 | + // this.textarea.style.backgroundColor="#FFFFFF"; | |
63 | + }; | |
64 | + | |
65 | + EditArea.prototype.enable_highlight= function(){ | |
66 | + var t=this, a=t.textarea, new_class; | |
67 | + t.show_waiting_screen(); | |
68 | + | |
69 | + t.content_highlight.style.visibility="visible"; | |
70 | + new_class =parent.getAttribute(a,"class")+" hidden"; | |
71 | + parent.setAttribute( a, "class", new_class ); | |
72 | + | |
73 | + // IE can't manage mouse click outside text range without this | |
74 | + if( t.isIE ) | |
75 | + a.style.backgroundColor="#FFFFFF"; | |
76 | + | |
77 | + t.switchClassSticky(_$("highlight"), 'editAreaButtonSelected', false); | |
78 | + t.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false); | |
79 | + | |
80 | + t.smooth_selection_before_highlight=t.smooth_selection; | |
81 | + if(!t.smooth_selection) | |
82 | + t.change_smooth_selection_mode(true); | |
83 | + t.switchClassSticky(_$("change_smooth_selection"), 'editAreaButtonDisabled', true); | |
84 | + | |
85 | + | |
86 | + t.do_highlight=true; | |
87 | + t.resync_highlight(); | |
88 | + | |
89 | + t.hide_waiting_screen(); | |
90 | + }; | |
91 | + | |
92 | + /** | |
93 | + * Ask to update highlighted text | |
94 | + * @param Array infos - Array of datas returned by EditArea.get_selection_infos() | |
95 | + */ | |
96 | + EditArea.prototype.maj_highlight= function(infos){ | |
97 | + // for speed mesure | |
98 | + var debug_opti="",tps_start= new Date().getTime(), tps_middle_opti=new Date().getTime(); | |
99 | + var t=this, hightlighted_text, updated_highlight; | |
100 | + var textToHighlight=infos["full_text"], doSyntaxOpti = false, doHtmlOpti = false, stay_begin="", stay_end="", trace_new , trace_last; | |
101 | + | |
102 | + if(t.last_text_to_highlight==infos["full_text"] && t.resync_highlight!==true) | |
103 | + return; | |
104 | + | |
105 | + // OPTIMISATION: will search to update only changed lines | |
106 | + if(t.reload_highlight===true){ | |
107 | + t.reload_highlight=false; | |
108 | + }else if(textToHighlight.length==0){ | |
109 | + textToHighlight="\n "; | |
110 | + }else{ | |
111 | + // get text change datas | |
112 | + changes = t.checkTextEvolution(t.last_text_to_highlight,textToHighlight); | |
113 | + | |
114 | + // check if it can only reparse the changed text | |
115 | + trace_new = t.get_syntax_trace(changes.newTextLine).replace(/\r/g, ''); | |
116 | + trace_last = t.get_syntax_trace(changes.lastTextLine).replace(/\r/g, ''); | |
117 | + doSyntaxOpti = ( trace_new == trace_last ); | |
118 | + | |
119 | + // check if the difference comes only from a new line created | |
120 | + // => we have to remember that the editor can automaticaly add tabulation or space after the new line) | |
121 | + if( !doSyntaxOpti && trace_new == "\n"+trace_last && /^[ \t\s]*\n[ \t\s]*$/.test( changes.newText.replace(/\r/g, '') ) && changes.lastText =="" ) | |
122 | + { | |
123 | + doSyntaxOpti = true; | |
124 | + } | |
125 | + | |
126 | + // we do the syntax optimisation | |
127 | + if( doSyntaxOpti ){ | |
128 | + | |
129 | + tps_middle_opti=new Date().getTime(); | |
130 | + | |
131 | + stay_begin= t.last_hightlighted_text.split("\n").slice(0, changes.lineStart).join("\n"); | |
132 | + if(changes.lineStart>0) | |
133 | + stay_begin+= "\n"; | |
134 | + stay_end= t.last_hightlighted_text.split("\n").slice(changes.lineLastEnd+1).join("\n"); | |
135 | + if(stay_end.length>0) | |
136 | + stay_end= "\n"+stay_end; | |
137 | + | |
138 | + // Final check to see that we're not in the middle of span tags | |
139 | + if( stay_begin.split('<span').length != stay_begin.split('</span').length | |
140 | + || stay_end.split('<span').length != stay_end.split('</span').length ) | |
141 | + { | |
142 | + doSyntaxOpti = false; | |
143 | + stay_end = ''; | |
144 | + stay_begin = ''; | |
145 | + } | |
146 | + else | |
147 | + { | |
148 | + if(stay_begin.length==0 && changes.posLastEnd==-1) | |
149 | + changes.newTextLine+="\n"; | |
150 | + textToHighlight=changes.newTextLine; | |
151 | + } | |
152 | + } | |
153 | + if(t.settings["debug"]){ | |
154 | + var ch =changes; | |
155 | + debug_opti= ( doSyntaxOpti?"Optimisation": "No optimisation" ) | |
156 | + +" start: "+ch.posStart +"("+ch.lineStart+")" | |
157 | + +" end_new: "+ ch.posNewEnd+"("+ch.lineNewEnd+")" | |
158 | + +" end_last: "+ ch.posLastEnd+"("+ch.lineLastEnd+")" | |
159 | + +"\nchanged_text: "+ch.newText+" => trace: "+trace_new | |
160 | + +"\nchanged_last_text: "+ch.lastText+" => trace: "+trace_last | |
161 | + //debug_opti+= "\nchanged: "+ infos["full_text"].substring(ch.posStart, ch.posNewEnd); | |
162 | + + "\nchanged_line: "+ch.newTextLine | |
163 | + + "\nlast_changed_line: "+ch.lastTextLine | |
164 | + +"\nstay_begin: "+ stay_begin.slice(-100) | |
165 | + +"\nstay_end: "+ stay_end.substr( 0, 100 ); | |
166 | + //debug_opti="start: "+stay_begin_len+ "("+nb_line_start_unchanged+") end: "+ (stay_end_len)+ "("+(splited.length-nb_line_end_unchanged)+") "; | |
167 | + //debug_opti+="changed: "+ textToHighlight.substring(stay_begin_len, textToHighlight.length-stay_end_len)+" \n"; | |
168 | + | |
169 | + //debug_opti+="changed: "+ stay_begin.substr(stay_begin.length-200)+ "----------"+ textToHighlight+"------------------"+ stay_end.substr(0,200) +"\n"; | |
170 | + +"\n"; | |
171 | + } | |
172 | + | |
173 | + | |
174 | + // END OPTIMISATION | |
175 | + } | |
176 | + | |
177 | + tps_end_opti = new Date().getTime(); | |
178 | + | |
179 | + // apply highlight | |
180 | + updated_highlight = t.colorize_text(textToHighlight); | |
181 | + tpsAfterReg = new Date().getTime(); | |
182 | + | |
183 | + /*** | |
184 | + * see if we can optimize for updating only the required part of the HTML code | |
185 | + * | |
186 | + * The goal here will be to find the text node concerned by the modification and to update it | |
187 | + */ | |
188 | + //------------------------------------------- | |
189 | + | |
190 | + // disable latest optimization tricks (introduced in 0.8.1 and removed in 0.8.2), TODO: check for another try later | |
191 | + doSyntaxOpti = doHtmlOpti = false; | |
192 | + if( doSyntaxOpti ) | |
193 | + { | |
194 | + try | |
195 | + { | |
196 | + var replacedBloc, i, nbStart = '', nbEnd = '', newHtml, lengthOld, lengthNew; | |
197 | + replacedBloc = t.last_hightlighted_text.substring( stay_begin.length, t.last_hightlighted_text.length - stay_end.length ); | |
198 | + | |
199 | + lengthOld = replacedBloc.length; | |
200 | + lengthNew = updated_highlight.length; | |
201 | + | |
202 | + // find the identical caracters at the beginning | |
203 | + for( i=0; i < lengthOld && i < lengthNew && replacedBloc.charAt(i) == updated_highlight.charAt(i) ; i++ ) | |
204 | + { | |
205 | + } | |
206 | + nbStart = i; | |
207 | + // find the identical caracters at the end | |
208 | + for( i=0; i + nbStart < lengthOld && i + nbStart < lengthNew && replacedBloc.charAt(lengthOld-i-1) == updated_highlight.charAt(lengthNew-i-1) ; i++ ) | |
209 | + { | |
210 | + } | |
211 | + nbEnd = i; | |
212 | + //console.log( nbStart, nbEnd, replacedBloc, updated_highlight ); | |
213 | + // get the changes | |
214 | + lastHtml = replacedBloc.substring( nbStart, lengthOld - nbEnd ); | |
215 | + newHtml = updated_highlight.substring( nbStart, lengthNew - nbEnd ); | |
216 | + | |
217 | + // We can do the optimisation only if we havn't touch to span elements | |
218 | + if( newHtml.indexOf('<span') == -1 && newHtml.indexOf('</span') == -1 | |
219 | + && lastHtml.indexOf('<span') == -1 && lastHtml.indexOf('</span') == -1 ) | |
220 | + { | |
221 | + var beginStr, nbOpendedSpan, nbClosedSpan, nbUnchangedChars, span, textNode; | |
222 | + doHtmlOpti = true; | |
223 | + beginStr = t.last_hightlighted_text.substr( 0, stay_begin.length + nbStart ); | |
224 | + // fix special chars | |
225 | + newHtml = newHtml.replace( /</g, '<').replace( />/g, '>').replace( /&/g, '&'); | |
226 | + | |
227 | + nbOpendedSpan = beginStr.split('<span').length - 1; | |
228 | + nbClosedSpan = beginStr.split('</span').length - 1; | |
229 | + // retrieve the previously opened span (Add 1 for the first level span?) | |
230 | + span = t.content_highlight.getElementsByTagName('span')[ nbOpendedSpan ]; | |
231 | + | |
232 | + //--------[ | |
233 | + // get the textNode to update | |
234 | + | |
235 | + // if we're inside a span, we'll take the one that is opened (can be a parent of the current span) | |
236 | + parentSpan = span; | |
237 | + maxStartOffset = maxEndOffset = 0; | |
238 | + | |
239 | + // it will be in the child of the root node | |
240 | + if( nbOpendedSpan == nbClosedSpan ) | |
241 | + { | |
242 | + while( parentSpan.parentNode != t.content_highlight && parentSpan.parentNode.tagName != 'PRE' ) | |
243 | + { | |
244 | + parentSpan = parentSpan.parentNode; | |
245 | + } | |
246 | + } | |
247 | + // get the last opened span | |
248 | + else | |
249 | + { | |
250 | + maxStartOffset = maxEndOffset = beginStr.length + 1; | |
251 | + // move to parent node for each closed span found after the lastest open span | |
252 | + nbClosed = beginStr.substr( Math.max( 0, beginStr.lastIndexOf( '<span', maxStartOffset - 1 ) ) ).split('</span').length - 1; | |
253 | + while( nbClosed > 0 ) | |
254 | + { | |
255 | + nbClosed--; | |
256 | + parentSpan = parentSpan.parentNode; | |
257 | + } | |
258 | + | |
259 | + // find the position of the last opended tag | |
260 | + while( parentSpan.parentNode != t.content_highlight && parentSpan.parentNode.tagName != 'PRE' && ( tmpMaxStartOffset = Math.max( 0, beginStr.lastIndexOf( '<span', maxStartOffset - 1 ) ) ) < ( tmpMaxEndOffset = Math.max( 0, beginStr.lastIndexOf( '</span', maxEndOffset - 1 ) ) ) ) | |
261 | + { | |
262 | + maxStartOffset = tmpMaxStartOffset; | |
263 | + maxEndOffset = tmpMaxEndOffset; | |
264 | + } | |
265 | + } | |
266 | + // Note: maxEndOffset is no more used but maxStartOffset will be used | |
267 | + | |
268 | + if( parentSpan.parentNode == t.content_highlight || parentSpan.parentNode.tagName == 'PRE' ) | |
269 | + { | |
270 | + maxStartOffset = Math.max( 0, beginStr.indexOf( '<span' ) ); | |
271 | + } | |
272 | + | |
273 | + // find the matching text node (this will be one that will be at the end of the beginStr | |
274 | + if( maxStartOffset == beginStr.length ) | |
275 | + { | |
276 | + nbSubSpanBefore = 0; | |
277 | + } | |
278 | + else | |
279 | + { | |
280 | + lastEndPos = Math.max( 0, beginStr.lastIndexOf( '>', maxStartOffset ) ); | |
281 | + | |
282 | + // count the number of sub spans | |
283 | + nbSubSpanBefore = beginStr.substr( lastEndPos ).split('<span').length-1; | |
284 | + } | |
285 | + | |
286 | + // there is no sub-span before | |
287 | + if( nbSubSpanBefore == 0 ) | |
288 | + { | |
289 | + textNode = parentSpan.firstChild; | |
290 | + } | |
291 | + // we need to find where is the text node modified | |
292 | + else | |
293 | + { | |
294 | + // take the last direct child (no sub-child) | |
295 | + lastSubSpan = parentSpan.getElementsByTagName('span')[ nbSubSpanBefore - 1 ]; | |
296 | + while( lastSubSpan.parentNode != parentSpan ) | |
297 | + { | |
298 | + lastSubSpan = lastSubSpan.parentNode; | |
299 | + } | |
300 | + | |
301 | + // associate to next text node following the last sub span | |
302 | + if( lastSubSpan.nextSibling == null || lastSubSpan.nextSibling.nodeType != 3 ) | |
303 | + { | |
304 | + textNode = document.createTextNode(''); | |
305 | + lastSubSpan.parentNode.insertBefore( textNode, lastSubSpan.nextSibling ); | |
306 | + } | |
307 | + else | |
308 | + { | |
309 | + textNode = lastSubSpan.nextSibling; | |
310 | + } | |
311 | + } | |
312 | + //--------] | |
313 | + | |
314 | + | |
315 | + //--------[ | |
316 | + // update the textNode content | |
317 | + | |
318 | + // number of caracters after the last opened of closed span | |
319 | + //nbUnchangedChars = ( lastIndex = beginStr.lastIndexOf( '>' ) ) == -1 ? beginStr.length : beginStr.length - ( lastIndex + 1 ); | |
320 | + //nbUnchangedChars = ? beginStr.length : beginStr.substr( lastIndex + 1 ).replace( /</g, '<').replace( />/g, '>').replace( /&/g, '&').length; | |
321 | + | |
322 | + if( ( lastIndex = beginStr.lastIndexOf( '>' ) ) == -1 ) | |
323 | + { | |
324 | + nbUnchangedChars = beginStr.length; | |
325 | + } | |
326 | + else | |
327 | + { | |
328 | + nbUnchangedChars = beginStr.substr( lastIndex + 1 ).replace( /</g, '<').replace( />/g, '>').replace( /&/g, '&').length; | |
329 | + //nbUnchangedChars += beginStr.substr( ).replace( /&/g, '&').replace( /</g, '<').replace( />/g, '>').length - beginStr.length; | |
330 | + } | |
331 | + //alert( nbUnchangedChars ); | |
332 | + // console.log( span, textNode, nbOpendedSpan,nbClosedSpan, span.nextSibling, textNode.length, nbUnchangedChars, lastHtml, lastHtml.length, newHtml, newHtml.length ); | |
333 | + // alert( textNode.parentNode.className +'-'+ textNode.parentNode.tagName+"\n"+ textNode.data +"\n"+ nbUnchangedChars +"\n"+ lastHtml.length +"\n"+ newHtml +"\n"+ newHtml.length ); | |
334 | + // console.log( nbUnchangedChars, lastIndex, beginStr.length, beginStr.replace(/&/g, '&'), lastHtml.length, '|', newHtml.replace( /\t/g, 't').replace( /\n/g, 'n').replace( /\r/g, 'r'), lastHtml.replace( /\t/g, 't').replace( /\n/g, 'n').replace( /\r/, 'r') ); | |
335 | + // console.log( textNode.data.replace(/&/g, '&') ); | |
336 | + // IE only manage \r for cariage return in textNode and not \n or \r\n | |
337 | + if( t.isIE ) | |
338 | + { | |
339 | + nbUnchangedChars -= ( beginStr.substr( beginStr.length - nbUnchangedChars ).split("\n").length - 1 ); | |
340 | + //alert( textNode.data.replace(/\r/g, '_r').replace(/\n/g, '_n')); | |
341 | + textNode.replaceData( nbUnchangedChars, lastHtml.replace(/\n/g, '').length, newHtml.replace(/\n/g, '') ); | |
342 | + } | |
343 | + else | |
344 | + { | |
345 | + textNode.replaceData( nbUnchangedChars, lastHtml.length, newHtml ); | |
346 | + } | |
347 | + //--------] | |
348 | + } | |
349 | + } | |
350 | + // an exception shouldn't occured but if replaceData failed at least it won't break everything | |
351 | + catch( e ) | |
352 | + { | |
353 | + // throw e; | |
354 | + // console.log( e ); | |
355 | + doHtmlOpti = false; | |
356 | + } | |
357 | + | |
358 | + } | |
359 | + | |
360 | + /*** END HTML update's optimisation ***/ | |
361 | + // end test | |
362 | + | |
363 | + // console.log( (TPS6-TPS5), (TPS5-TPS4), (TPS4-TPS3), (TPS3-TPS2), (TPS2-TPS1), _CPT ); | |
364 | + // get the new highlight content | |
365 | + tpsAfterOpti2 = new Date().getTime(); | |
366 | + hightlighted_text = stay_begin + updated_highlight + stay_end; | |
367 | + if( !doHtmlOpti ) | |
368 | + { | |
369 | + // update the content of the highlight div by first updating a clone node (as there is no display in the same time for t node it's quite faster (5*)) | |
370 | + var new_Obj= t.content_highlight.cloneNode(false); | |
371 | + if( ( t.isIE && t.isIE < 8 ) || ( t.isOpera && t.isOpera < 9.6 ) ) | |
372 | + new_Obj.innerHTML= "<pre><span class='"+ t.settings["syntax"] +"'>" + hightlighted_text + "</span></pre>"; | |
373 | + else | |
374 | + new_Obj.innerHTML= "<span class='"+ t.settings["syntax"] +"'>"+ hightlighted_text +"</span>"; | |
375 | + | |
376 | + t.content_highlight.parentNode.replaceChild(new_Obj, t.content_highlight); | |
377 | + | |
378 | + t.content_highlight= new_Obj; | |
379 | + } | |
380 | + | |
381 | + t.last_text_to_highlight= infos["full_text"]; | |
382 | + t.last_hightlighted_text= hightlighted_text; | |
383 | + | |
384 | + tps3=new Date().getTime(); | |
385 | + | |
386 | + if(t.settings["debug"]){ | |
387 | + //lineNumber=tab_text.length; | |
388 | + //t.debug.value+=" \nNB char: "+_$("src").value.length+" Nb line: "+ lineNumber; | |
389 | + | |
390 | + t.debug.value= "Tps optimisation "+(tps_end_opti-tps_start) | |
391 | + +" | tps reg exp: "+ (tpsAfterReg-tps_end_opti) | |
392 | + +" | tps opti HTML : "+ (tpsAfterOpti2-tpsAfterReg) + ' '+ ( doHtmlOpti ? 'yes' : 'no' ) | |
393 | + +" | tps update highlight content: "+ (tps3-tpsAfterOpti2) | |
394 | + +" | tpsTotal: "+ (tps3-tps_start) | |
395 | + + "("+tps3+")\n"+ debug_opti; | |
396 | + // t.debug.value+= "highlight\n"+hightlighted_text;*/ | |
397 | + } | |
398 | + | |
399 | + }; | |
400 | + | |
401 | + EditArea.prototype.resync_highlight= function(reload_now){ | |
402 | + this.reload_highlight=true; | |
403 | + this.last_text_to_highlight=""; | |
404 | + this.focus(); | |
405 | + if(reload_now) | |
406 | + this.check_line_selection(false); | |
407 | + }; | ... | ... |
docs/js/editarea_0_8_2/edit_area/images/autocompletion.gif
0 → 100644
359 Bytes
docs/js/editarea_0_8_2/edit_area/images/close.gif
0 → 100644
102 Bytes
docs/js/editarea_0_8_2/edit_area/images/fullscreen.gif
0 → 100644
198 Bytes
docs/js/editarea_0_8_2/edit_area/images/go_to_line.gif
0 → 100644
1.03 KB
docs/js/editarea_0_8_2/edit_area/images/help.gif
0 → 100644
295 Bytes
docs/js/editarea_0_8_2/edit_area/images/highlight.gif
0 → 100644
256 Bytes
docs/js/editarea_0_8_2/edit_area/images/load.gif
0 → 100644
1.02 KB
docs/js/editarea_0_8_2/edit_area/images/move.gif
0 → 100644
257 Bytes
docs/js/editarea_0_8_2/edit_area/images/newdocument.gif
0 → 100644
170 Bytes
docs/js/editarea_0_8_2/edit_area/images/opacity.png
0 → 100644
147 Bytes
docs/js/editarea_0_8_2/edit_area/images/processing.gif
0 → 100644
825 Bytes
docs/js/editarea_0_8_2/edit_area/images/redo.gif
0 → 100644
169 Bytes
docs/js/editarea_0_8_2/edit_area/images/reset_highlight.gif
0 → 100644
168 Bytes
docs/js/editarea_0_8_2/edit_area/images/save.gif
0 → 100644
285 Bytes
docs/js/editarea_0_8_2/edit_area/images/search.gif
0 → 100644
191 Bytes
docs/js/editarea_0_8_2/edit_area/images/smooth_selection.gif
0 → 100644
174 Bytes
docs/js/editarea_0_8_2/edit_area/images/spacer.gif
0 → 100644
43 Bytes
docs/js/editarea_0_8_2/edit_area/images/statusbar_resize.gif
0 → 100644
79 Bytes
docs/js/editarea_0_8_2/edit_area/images/undo.gif
0 → 100644
175 Bytes
docs/js/editarea_0_8_2/edit_area/images/word_wrap.gif
0 → 100644
951 Bytes
docs/js/editarea_0_8_2/edit_area/keyboard.js
0 → 100644
1 | +var EA_keys = {8:"Retour arriere",9:"Tabulation",12:"Milieu (pave numerique)",13:"Entrer",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"Verr Maj",27:"Esc",32:"Space",33:"Page up",34:"Page down",35:"End",36:"Begin",37:"Left",38:"Up",39:"Right",40:"Down",44:"Impr ecran",45:"Inser",46:"Suppr",91:"Menu Demarrer Windows / touche pomme Mac",92:"Menu Demarrer Windows",93:"Menu contextuel Windows",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Verr Num",145:"Arret defil"}; | |
2 | + | |
3 | + | |
4 | + | |
5 | +function keyDown(e){ | |
6 | + if(!e){ // if IE | |
7 | + e=event; | |
8 | + } | |
9 | + | |
10 | + // send the event to the plugins | |
11 | + for(var i in editArea.plugins){ | |
12 | + if(typeof(editArea.plugins[i].onkeydown)=="function"){ | |
13 | + if(editArea.plugins[i].onkeydown(e)===false){ // stop propaging | |
14 | + if(editArea.isIE) | |
15 | + e.keyCode=0; | |
16 | + return false; | |
17 | + } | |
18 | + } | |
19 | + } | |
20 | + | |
21 | + var target_id=(e.target || e.srcElement).id; | |
22 | + var use=false; | |
23 | + if (EA_keys[e.keyCode]) | |
24 | + letter=EA_keys[e.keyCode]; | |
25 | + else | |
26 | + letter=String.fromCharCode(e.keyCode); | |
27 | + | |
28 | + var low_letter= letter.toLowerCase(); | |
29 | + | |
30 | + if(letter=="Page up" && !AltPressed(e) && !editArea.isOpera){ | |
31 | + editArea.execCommand("scroll_page", {"dir": "up", "shift": ShiftPressed(e)}); | |
32 | + use=true; | |
33 | + }else if(letter=="Page down" && !AltPressed(e) && !editArea.isOpera){ | |
34 | + editArea.execCommand("scroll_page", {"dir": "down", "shift": ShiftPressed(e)}); | |
35 | + use=true; | |
36 | + }else if(editArea.is_editable==false){ | |
37 | + // do nothing but also do nothing else (allow to navigate with page up and page down) | |
38 | + return true; | |
39 | + }else if(letter=="Tabulation" && target_id=="textarea" && !CtrlPressed(e) && !AltPressed(e)){ | |
40 | + if(ShiftPressed(e)) | |
41 | + editArea.execCommand("invert_tab_selection"); | |
42 | + else | |
43 | + editArea.execCommand("tab_selection"); | |
44 | + | |
45 | + use=true; | |
46 | + if(editArea.isOpera || (editArea.isFirefox && editArea.isMac) ) // opera && firefox mac can't cancel tabulation events... | |
47 | + setTimeout("editArea.execCommand('focus');", 1); | |
48 | + }else if(letter=="Entrer" && target_id=="textarea"){ | |
49 | + if(editArea.press_enter()) | |
50 | + use=true; | |
51 | + }else if(letter=="Entrer" && target_id=="area_search"){ | |
52 | + editArea.execCommand("area_search"); | |
53 | + use=true; | |
54 | + }else if(letter=="Esc"){ | |
55 | + editArea.execCommand("close_all_inline_popup", e); | |
56 | + use=true; | |
57 | + }else if(CtrlPressed(e) && !AltPressed(e) && !ShiftPressed(e)){ | |
58 | + switch(low_letter){ | |
59 | + case "f": | |
60 | + editArea.execCommand("area_search"); | |
61 | + use=true; | |
62 | + break; | |
63 | + case "r": | |
64 | + editArea.execCommand("area_replace"); | |
65 | + use=true; | |
66 | + break; | |
67 | + case "q": | |
68 | + editArea.execCommand("close_all_inline_popup", e); | |
69 | + use=true; | |
70 | + break; | |
71 | + case "h": | |
72 | + editArea.execCommand("change_highlight"); | |
73 | + use=true; | |
74 | + break; | |
75 | + case "g": | |
76 | + setTimeout("editArea.execCommand('go_to_line');", 5); // the prompt stop the return false otherwise | |
77 | + use=true; | |
78 | + break; | |
79 | + case "e": | |
80 | + editArea.execCommand("show_help"); | |
81 | + use=true; | |
82 | + break; | |
83 | + case "z": | |
84 | + use=true; | |
85 | + editArea.execCommand("undo"); | |
86 | + break; | |
87 | + case "y": | |
88 | + use=true; | |
89 | + editArea.execCommand("redo"); | |
90 | + break; | |
91 | + default: | |
92 | + break; | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + // check to disable the redo possibility if the textarea content change | |
97 | + if(editArea.next.length > 0){ | |
98 | + setTimeout("editArea.check_redo();", 10); | |
99 | + } | |
100 | + | |
101 | + setTimeout("editArea.check_file_changes();", 10); | |
102 | + | |
103 | + | |
104 | + if(use){ | |
105 | + // in case of a control that sould'nt be used by IE but that is used => THROW a javascript error that will stop key action | |
106 | + if(editArea.isIE) | |
107 | + e.keyCode=0; | |
108 | + return false; | |
109 | + } | |
110 | + //alert("Test: "+ letter + " ("+e.keyCode+") ALT: "+ AltPressed(e) + " CTRL "+ CtrlPressed(e) + " SHIFT "+ ShiftPressed(e)); | |
111 | + | |
112 | + return true; | |
113 | + | |
114 | +}; | |
115 | + | |
116 | + | |
117 | +// return true if Alt key is pressed | |
118 | +function AltPressed(e) { | |
119 | + if (window.event) { | |
120 | + return (window.event.altKey); | |
121 | + } else { | |
122 | + if(e.modifiers) | |
123 | + return (e.altKey || (e.modifiers % 2)); | |
124 | + else | |
125 | + return e.altKey; | |
126 | + } | |
127 | +}; | |
128 | + | |
129 | +// return true if Ctrl key is pressed | |
130 | +function CtrlPressed(e) { | |
131 | + if (window.event) { | |
132 | + return (window.event.ctrlKey); | |
133 | + } else { | |
134 | + return (e.ctrlKey || (e.modifiers==2) || (e.modifiers==3) || (e.modifiers>5)); | |
135 | + } | |
136 | +}; | |
137 | + | |
138 | +// return true if Shift key is pressed | |
139 | +function ShiftPressed(e) { | |
140 | + if (window.event) { | |
141 | + return (window.event.shiftKey); | |
142 | + } else { | |
143 | + return (e.shiftKey || (e.modifiers>3)); | |
144 | + } | |
145 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/bg.js
0 → 100644
1 | +/* | |
2 | + * Bulgarian translation | |
3 | + * Author: Valentin Hristov | |
4 | + * Company: SOFTKIT Bulgarian | |
5 | + * Site: http://www.softkit-bg.com | |
6 | + */ | |
7 | +editAreaLoader.lang["bg"]={ | |
8 | +new_document: "нов документ", | |
9 | +search_button: "търсене и замяна", | |
10 | +search_command: "търси следващия / отвори прозорец с търсачка", | |
11 | +search: "търсене", | |
12 | +replace: "замяна", | |
13 | +replace_command: "замяна / отвори прозорец с търсачка", | |
14 | +find_next: "намери следващия", | |
15 | +replace_all: "замени всички", | |
16 | +reg_exp: "реголярни изрази", | |
17 | +match_case: "чуствителен към регистъра", | |
18 | +not_found: "няма резултат.", | |
19 | +occurrence_replaced: "замяната е осъществена.", | |
20 | +search_field_empty: "Полето за търсене е празно", | |
21 | +restart_search_at_begin: "До края на документа. Почни с началото.", | |
22 | +move_popup: "премести прозореца с търсачката", | |
23 | +font_size: "--Размер на шрифта--", | |
24 | +go_to_line: "премени към реда", | |
25 | +go_to_line_prompt: "премени към номера на реда:", | |
26 | +undo: "отмени", | |
27 | +redo: "върни", | |
28 | +change_smooth_selection: "включи/изключи някой от функциите за преглед (по красиво, но повече натоварва)", | |
29 | +highlight: "превключване на оцветяване на синтаксиса включена/изключена", | |
30 | +reset_highlight: "въстанови оцветяване на синтаксиса (ако не е синхронизиран с текста)", | |
31 | +word_wrap: "режим на пренасяне на дълги редове", | |
32 | +help: "за програмата", | |
33 | +save: "съхрани", | |
34 | +load: "зареди", | |
35 | +line_abbr: "Стр", | |
36 | +char_abbr: "Стлб", | |
37 | +position: "Позиция", | |
38 | +total: "Всичко", | |
39 | +close_popup: "затвори прозореца", | |
40 | +shortcuts: "Бързи клавиши", | |
41 | +add_tab: "добави табулация в текста", | |
42 | +remove_tab: "премахни табулацията в текста", | |
43 | +about_notice: "Внимание: използвайте функцията оцветяване на синтаксиса само за малки текстове", | |
44 | +toggle: "Превключи редактор", | |
45 | +accesskey: "Бърз клавиш", | |
46 | +tab: "Tab", | |
47 | +shift: "Shift", | |
48 | +ctrl: "Ctrl", | |
49 | +esc: "Esc", | |
50 | +processing: "Зареждане...", | |
51 | +fullscreen: "на цял екран", | |
52 | +syntax_selection: "--Синтаксис--", | |
53 | +close_tab: "Затвори файла" | |
54 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/cs.js
0 → 100644
1 | +editAreaLoader.lang["cs"]={ | |
2 | +new_document: "Nový dokument", | |
3 | +search_button: "Najdi a nahraď", | |
4 | +search_command: "Hledej další / otevři vyhledávací pole", | |
5 | +search: "Hledej", | |
6 | +replace: "Nahraď", | |
7 | +replace_command: "Nahraď / otevři vyhledávací pole", | |
8 | +find_next: "Najdi další", | |
9 | +replace_all: "Nahraď vše", | |
10 | +reg_exp: "platné výrazy", | |
11 | +match_case: "vyhodnocené výrazy", | |
12 | +not_found: "nenalezené.", | |
13 | +occurrence_replaced: "výskyty nahrazené.", | |
14 | +search_field_empty: "Pole vyhledávání je prázdné", | |
15 | +restart_search_at_begin: "Dosažen konec souboru, začínám od začátku.", | |
16 | +move_popup: "Přesuň vyhledávací okno", | |
17 | +font_size: "--Velikost textu--", | |
18 | +go_to_line: "Přejdi na řádek", | |
19 | +go_to_line_prompt: "Přejdi na řádek:", | |
20 | +undo: "krok zpět", | |
21 | +redo: "znovu", | |
22 | +change_smooth_selection: "Povolit nebo zakázat některé ze zobrazených funkcí (účelnější zobrazení požaduje větší zatížení procesoru)", | |
23 | +highlight: "Zvýrazňování syntaxe zap./vyp.", | |
24 | +reset_highlight: "Obnovit zvýraznění (v případě nesrovnalostí)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "O programu", | |
27 | +save: "Uložit", | |
28 | +load: "Otevřít", | |
29 | +line_abbr: "Ř.", | |
30 | +char_abbr: "S.", | |
31 | +position: "Pozice", | |
32 | +total: "Celkem", | |
33 | +close_popup: "Zavřít okno", | |
34 | +shortcuts: "Zkratky", | |
35 | +add_tab: "Přidat tabulování textu", | |
36 | +remove_tab: "Odtsranit tabulování textu", | |
37 | +about_notice: "Upozornění! Funkce zvýrazňování textu je k dispozici pouze pro malý text", | |
38 | +toggle: "Přepnout editor", | |
39 | +accesskey: "Přístupová klávesa", | |
40 | +tab: "Záložka", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Zpracovávám ...", | |
45 | +fullscreen: "Celá obrazovka", | |
46 | +syntax_selection: "--vyber zvýrazňovač--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/de.js
0 → 100644
1 | +editAreaLoader.lang["de"]={ | |
2 | +new_document: "Neues Dokument", | |
3 | +search_button: "Suchen und Ersetzen", | |
4 | +search_command: "Weitersuchen / öffne Suchfeld", | |
5 | +search: "Suchen", | |
6 | +replace: "Ersetzen", | |
7 | +replace_command: "Ersetzen / öffne Suchfeld", | |
8 | +find_next: "Weitersuchen", | |
9 | +replace_all: "Ersetze alle Treffer", | |
10 | +reg_exp: "reguläre Ausdrücke", | |
11 | +match_case: "passt auf den Begriff<br />", | |
12 | +not_found: "Nicht gefunden.", | |
13 | +occurrence_replaced: "Die Vorkommen wurden ersetzt.", | |
14 | +search_field_empty: "Leeres Suchfeld", | |
15 | +restart_search_at_begin: "Ende des zu durchsuchenden Bereiches erreicht. Es wird die Suche von Anfang an fortgesetzt.", //find a shorter translation | |
16 | +move_popup: "Suchfenster bewegen", | |
17 | +font_size: "--Schriftgröße--", | |
18 | +go_to_line: "Gehe zu Zeile", | |
19 | +go_to_line_prompt: "Gehe zu Zeilennummmer:", | |
20 | +undo: "Rückgängig", | |
21 | +redo: "Wiederherstellen", | |
22 | +change_smooth_selection: "Aktiviere/Deaktiviere einige Features (weniger Bildschirmnutzung aber mehr CPU-Belastung)", | |
23 | +highlight: "Syntax Highlighting an- und ausschalten", | |
24 | +reset_highlight: "Highlighting zurücksetzen (falls mit Text nicht konform)", | |
25 | +word_wrap: "Toggle word wrapping mode", | |
26 | +help: "Info", | |
27 | +save: "Speichern", | |
28 | +load: "Öffnen", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Position", | |
32 | +total: "Gesamt", | |
33 | +close_popup: "Popup schließen", | |
34 | +shortcuts: "Shortcuts", | |
35 | +add_tab: "Tab zum Text hinzufügen", | |
36 | +remove_tab: "Tab aus Text entfernen", | |
37 | +about_notice: "Bemerkung: Syntax Highlighting ist nur für kurze Texte", | |
38 | +toggle: "Editor an- und ausschalten", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "In Bearbeitung...", | |
45 | +fullscreen: "Full-Screen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/dk.js
0 → 100644
1 | +editAreaLoader.lang["dk"]={ | |
2 | +new_document: "nyt tomt dokument", | |
3 | +search_button: "søg og erstat", | |
4 | +search_command: "find næste / åben søgefelt", | |
5 | +search: "søg", | |
6 | +replace: "erstat", | |
7 | +replace_command: "erstat / åben søgefelt", | |
8 | +find_next: "find næste", | |
9 | +replace_all: "erstat alle", | |
10 | +reg_exp: "regular expressions", | |
11 | +match_case: "forskel på store/små bogstaver<br />", | |
12 | +not_found: "not found.", | |
13 | +occurrence_replaced: "occurences replaced.", | |
14 | +search_field_empty: "Search field empty", | |
15 | +restart_search_at_begin: "End of area reached. Restart at begin.", | |
16 | +move_popup: "flyt søgepopup", | |
17 | +font_size: "--Skriftstørrelse--", | |
18 | +go_to_line: "gå til linie", | |
19 | +go_to_line_prompt: "gå til linienummer:", | |
20 | +undo: "fortryd", | |
21 | +redo: "gentag", | |
22 | +change_smooth_selection: "slå display funktioner til/fra (smartere display men mere CPU krævende)", | |
23 | +highlight: "slå syntax highlight til/fra", | |
24 | +reset_highlight: "nulstil highlight (hvis den er desynkroniseret fra teksten)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "om", | |
27 | +save: "gem", | |
28 | +load: "hent", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Position", | |
32 | +total: "Total", | |
33 | +close_popup: "luk popup", | |
34 | +shortcuts: "Genveje", | |
35 | +add_tab: "tilføj tabulation til tekst", | |
36 | +remove_tab: "fjern tabulation fra tekst", | |
37 | +about_notice: "Husk: syntax highlight funktionen bør kun bruge til små tekster", | |
38 | +toggle: "Slå editor til / fra", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Skift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Processing...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/en.js
0 → 100644
1 | +editAreaLoader.lang["en"]={ | |
2 | +new_document: "new empty document", | |
3 | +search_button: "search and replace", | |
4 | +search_command: "search next / open search area", | |
5 | +search: "search", | |
6 | +replace: "replace", | |
7 | +replace_command: "replace / open search area", | |
8 | +find_next: "find next", | |
9 | +replace_all: "replace all", | |
10 | +reg_exp: "regular expressions", | |
11 | +match_case: "match case", | |
12 | +not_found: "not found.", | |
13 | +occurrence_replaced: "occurences replaced.", | |
14 | +search_field_empty: "Search field empty", | |
15 | +restart_search_at_begin: "End of area reached. Restart at begin.", | |
16 | +move_popup: "move search popup", | |
17 | +font_size: "--Font size--", | |
18 | +go_to_line: "go to line", | |
19 | +go_to_line_prompt: "go to line number:", | |
20 | +undo: "undo", | |
21 | +redo: "redo", | |
22 | +change_smooth_selection: "enable/disable some display features (smarter display but more CPU charge)", | |
23 | +highlight: "toggle syntax highlight on/off", | |
24 | +reset_highlight: "reset highlight (if desyncronized from text)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "about", | |
27 | +save: "save", | |
28 | +load: "load", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Position", | |
32 | +total: "Total", | |
33 | +close_popup: "close popup", | |
34 | +shortcuts: "Shortcuts", | |
35 | +add_tab: "add tabulation to text", | |
36 | +remove_tab: "remove tabulation to text", | |
37 | +about_notice: "Notice: syntax highlight function is only for small text", | |
38 | +toggle: "Toggle editor", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Processing...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/eo.js
0 → 100644
1 | +editAreaLoader.lang["eo"]={ | |
2 | +new_document: "nova dokumento (vakigas la enhavon)", | |
3 | +search_button: "serĉi / anstataŭigi", | |
4 | +search_command: "pluserĉi / malfermi la serĉo-fenestron", | |
5 | +search: "serĉi", | |
6 | +replace: "anstataŭigi", | |
7 | +replace_command: "anstataŭigi / malfermi la serĉo-fenestron", | |
8 | +find_next: "serĉi", | |
9 | +replace_all: "anstataŭigi ĉion", | |
10 | +reg_exp: "regula esprimo", | |
11 | +match_case: "respekti la usklecon", | |
12 | +not_found: "ne trovita.", | |
13 | +occurrence_replaced: "anstataŭigoj plenumitaj.", | |
14 | +search_field_empty: "La kampo estas malplena.", | |
15 | +restart_search_at_begin: "Fino de teksto ĝisrirata, ĉu daŭrigi el la komenco?", | |
16 | +move_popup: "movi la serĉo-fenestron", | |
17 | +font_size: "--Tipara grando--", | |
18 | +go_to_line: "iri al la linio", | |
19 | +go_to_line_prompt: "iri al la linio numero:", | |
20 | +undo: "rezigni", | |
21 | +redo: "refari", | |
22 | +change_smooth_selection: "ebligi/malebligi la funkcioj de vidigo (pli bona vidigo, sed pli da ŝarĝo de la ĉeforgano)", | |
23 | +highlight: "ebligi/malebligi la sintaksan kolorigon", | |
24 | +reset_highlight: "repravalorizi la sintaksan kolorigon (se malsinkronigon de la teksto)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "pri", | |
27 | +save: "registri", | |
28 | +load: "ŝarĝi", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Sg", | |
31 | +position: "Pozicio", | |
32 | +total: "Sumo", | |
33 | +close_popup: "fermi la ŝprucfenestron", | |
34 | +shortcuts: "Fulmoklavo", | |
35 | +add_tab: "aldoni tabon en la tekston", | |
36 | +remove_tab: "forigi tablon el la teksto", | |
37 | +about_notice: "Noto: la sintaksa kolorigo estas nur prikalkulita por mallongaj tekstoj.", | |
38 | +toggle: "baskuligi la redaktilon", | |
39 | +accesskey: "Fulmoklavo", | |
40 | +tab: "Tab", | |
41 | +shift: "Maj", | |
42 | +ctrl: "Ktrl", | |
43 | +esc: "Esk", | |
44 | +processing: "ŝargante...", | |
45 | +fullscreen: "plenekrane", | |
46 | +syntax_selection: "--Sintakso--", | |
47 | +close_tab: "Fermi la dosieron" | |
48 | +}; | |
0 | 49 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/es.js
0 → 100644
1 | +editAreaLoader.lang["es"]={ | |
2 | +new_document: "nuevo documento vacío", | |
3 | +search_button: "buscar y reemplazar", | |
4 | +search_command: "buscar siguiente / abrir área de búsqueda", | |
5 | +search: "buscar", | |
6 | +replace: "reemplazar", | |
7 | +replace_command: "reemplazar / abrir área de búsqueda", | |
8 | +find_next: "encontrar siguiente", | |
9 | +replace_all: "reemplazar todos", | |
10 | +reg_exp: "expresiones regulares", | |
11 | +match_case: "coincidir capitalización", | |
12 | +not_found: "no encontrado.", | |
13 | +occurrence_replaced: "ocurrencias reemplazadas.", | |
14 | +search_field_empty: "Campo de búsqueda vacío", | |
15 | +restart_search_at_begin: "Se ha llegado al final del área. Se va a seguir desde el principio.", | |
16 | +move_popup: "mover la ventana de búsqueda", | |
17 | +font_size: "--Tamaño de la fuente--", | |
18 | +go_to_line: "ir a la línea", | |
19 | +go_to_line_prompt: "ir a la línea número:", | |
20 | +undo: "deshacer", | |
21 | +redo: "rehacer", | |
22 | +change_smooth_selection: "activar/desactivar algunas características de visualización (visualización más inteligente pero más carga de CPU)", | |
23 | +highlight: "intercambiar resaltado de sintaxis", | |
24 | +reset_highlight: "reinicializar resaltado (si no esta sincronizado con el texto)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "acerca", | |
27 | +save: "guardar", | |
28 | +load: "cargar", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Posición", | |
32 | +total: "Total", | |
33 | +close_popup: "recuadro de cierre", | |
34 | +shortcuts: "Atajos", | |
35 | +add_tab: "añadir tabulado al texto", | |
36 | +remove_tab: "borrar tabulado del texto", | |
37 | +about_notice: "Aviso: el resaltado de sintaxis sólo funciona para texto pequeño", | |
38 | +toggle: "Cambiar editor", | |
39 | +accesskey: "Tecla de acceso", | |
40 | +tab: "Tab", | |
41 | +shift: "Mayúsc", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Procesando...", | |
45 | +fullscreen: "pantalla completa", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/fi.js
0 → 100644
1 | +editAreaLoader.lang["fi"]={ | |
2 | +new_document: "uusi tyhjä dokumentti", | |
3 | +search_button: "etsi ja korvaa", | |
4 | +search_command: "etsi seuraava / avaa etsintävalikko", | |
5 | +search: "etsi", | |
6 | +replace: "korvaa", | |
7 | +replace_command: "korvaa / avaa etsintävalikko", | |
8 | +find_next: "etsi seuraava", | |
9 | +replace_all: "korvaa kaikki", | |
10 | +reg_exp: "säännölliset lausekkeet", | |
11 | +match_case: "täsmää kirjainkokoon", | |
12 | +not_found: "ei löytynyt.", | |
13 | +occurrence_replaced: "esiintymää korvattu.", | |
14 | +search_field_empty: "Haettava merkkijono on tyhjä", | |
15 | +restart_search_at_begin: "Alueen loppu saavutettiin. Aloitetaan alusta.", | |
16 | +move_popup: "siirrä etsintävalikkoa", | |
17 | +font_size: "--Fontin koko--", | |
18 | +go_to_line: "siirry riville", | |
19 | +go_to_line_prompt: "mene riville:", | |
20 | +undo: "peruuta", | |
21 | +redo: "tee uudelleen", | |
22 | +change_smooth_selection: "kytke/sammuta joitakin näyttötoimintoja (Älykkäämpi toiminta, mutta suurempi CPU kuormitus)", | |
23 | +highlight: "kytke syntaksikorostus päälle/pois", | |
24 | +reset_highlight: "resetoi syntaksikorostus (jos teksti ei ole synkassa korostuksen kanssa)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "tietoja", | |
27 | +save: "tallenna", | |
28 | +load: "lataa", | |
29 | +line_abbr: "Rv", | |
30 | +char_abbr: "Pos", | |
31 | +position: "Paikka", | |
32 | +total: "Yhteensä", | |
33 | +close_popup: "sulje valikko", | |
34 | +shortcuts: "Pikatoiminnot", | |
35 | +add_tab: "lisää sisennys tekstiin", | |
36 | +remove_tab: "poista sisennys tekstistä", | |
37 | +about_notice: "Huomautus: syntaksinkorostus toimii vain pienelle tekstille", | |
38 | +toggle: "Kytke editori", | |
39 | +accesskey: "Pikanäppäin", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Odota...", | |
45 | +fullscreen: "koko ruutu", | |
46 | +syntax_selection: "--Syntaksi--", | |
47 | +close_tab: "Sulje tiedosto" | |
48 | +}; | |
0 | 49 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/fr.js
0 → 100644
1 | +editAreaLoader.lang["fr"]={ | |
2 | +new_document: "nouveau document (efface le contenu)", | |
3 | +search_button: "rechercher / remplacer", | |
4 | +search_command: "rechercher suivant / ouvrir la fenêtre de recherche", | |
5 | +search: "rechercher", | |
6 | +replace: "remplacer", | |
7 | +replace_command: "remplacer / ouvrir la fenêtre de recherche", | |
8 | +find_next: "rechercher", | |
9 | +replace_all: "tout remplacer", | |
10 | +reg_exp: "expr. régulière", | |
11 | +match_case: "respecter la casse", | |
12 | +not_found: "pas trouvé.", | |
13 | +occurrence_replaced: "remplacements éffectués.", | |
14 | +search_field_empty: "Le champ de recherche est vide.", | |
15 | +restart_search_at_begin: "Fin du texte atteint, poursuite au début.", | |
16 | +move_popup: "déplacer la fenêtre de recherche", | |
17 | +font_size: "--Taille police--", | |
18 | +go_to_line: "aller à la ligne", | |
19 | +go_to_line_prompt: "aller a la ligne numero:", | |
20 | +undo: "annuler", | |
21 | +redo: "refaire", | |
22 | +change_smooth_selection: "activer/désactiver des fonctions d'affichage (meilleur affichage mais plus de charge processeur)", | |
23 | +highlight: "activer/désactiver la coloration syntaxique", | |
24 | +reset_highlight: "réinitialiser la coloration syntaxique (si désyncronisée du texte)", | |
25 | +word_wrap: "activer/désactiver les retours à la ligne automatiques", | |
26 | +help: "à propos", | |
27 | +save: "sauvegarder", | |
28 | +load: "charger", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Position", | |
32 | +total: "Total", | |
33 | +close_popup: "fermer le popup", | |
34 | +shortcuts: "Racourcis clavier", | |
35 | +add_tab: "ajouter une tabulation dans le texte", | |
36 | +remove_tab: "retirer une tabulation dans le texte", | |
37 | +about_notice: "Note: la coloration syntaxique n'est prévue que pour de courts textes.", | |
38 | +toggle: "basculer l'éditeur", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Maj", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "chargement...", | |
45 | +fullscreen: "plein écran", | |
46 | +syntax_selection: "--Syntaxe--", | |
47 | +close_tab: "Fermer le fichier" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/hr.js
0 → 100644
1 | +editAreaLoader.lang["hr"]={ | |
2 | +new_document: "Novi dokument", | |
3 | +search_button: "Traži i izmijeni", | |
4 | +search_command: "Traži dalje / Otvori prozor za traženje", | |
5 | +search: "Traži", | |
6 | +replace: "Izmijeni", | |
7 | +replace_command: "Izmijeni / Otvori prozor za traženje", | |
8 | +find_next: "Traži dalje", | |
9 | +replace_all: "Izmjeni sve", | |
10 | +reg_exp: "Regularni izrazi", | |
11 | +match_case: "Bitna vel. slova", | |
12 | +not_found: "nije naðeno.", | |
13 | +occurrence_replaced: "izmjenjenih.", | |
14 | +search_field_empty: "Prazno polje za traženje!", | |
15 | +restart_search_at_begin: "Došao do kraja. Poèeo od poèetka.", | |
16 | +move_popup: "Pomakni prozor", | |
17 | +font_size: "--Velièina teksta--", | |
18 | +go_to_line: "Odi na redak", | |
19 | +go_to_line_prompt: "Odi na redak:", | |
20 | +undo: "Vrati natrag", | |
21 | +redo: "Napravi ponovo", | |
22 | +change_smooth_selection: "Ukljuèi/iskljuèi neke moguænosti prikaza (pametniji prikaz, ali zagušeniji CPU)", | |
23 | +highlight: "Ukljuèi/iskljuèi bojanje sintakse", | |
24 | +reset_highlight: "Ponovi kolorizaciju (ako je nesinkronizirana s tekstom)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "O edit_area", | |
27 | +save: "Spremi", | |
28 | +load: "Uèitaj", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Zn", | |
31 | +position: "Pozicija", | |
32 | +total: "Ukupno", | |
33 | +close_popup: "Zatvori prozor", | |
34 | +shortcuts: "Kratice", | |
35 | +add_tab: "Dodaj tabulaciju", | |
36 | +remove_tab: "Makni tabulaciju", | |
37 | +about_notice: "Napomena: koloriziranje sintakse je samo za kratke kodove", | |
38 | +toggle: "Prebaci naèin ureðivanja", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Procesiram...", | |
45 | +fullscreen: "Cijeli prozor", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/it.js
0 → 100644
1 | +editAreaLoader.lang["it"]={ | |
2 | +new_document: "nuovo documento vuoto", | |
3 | +search_button: "cerca e sostituisci", | |
4 | +search_command: "trova successivo / apri finestra di ricerca", | |
5 | +search: "cerca", | |
6 | +replace: "sostituisci", | |
7 | +replace_command: "sostituisci / apri finestra di ricerca", | |
8 | +find_next: "trova successivo", | |
9 | +replace_all: "sostituisci tutti", | |
10 | +reg_exp: "espressioni regolari", | |
11 | +match_case: "confronta maiuscole/minuscole<br />", | |
12 | +not_found: "non trovato.", | |
13 | +occurrence_replaced: "occorrenze sostituite.", | |
14 | +search_field_empty: "Campo ricerca vuoto", | |
15 | +restart_search_at_begin: "Fine del testo raggiunta. Ricomincio dall'inizio.", | |
16 | +move_popup: "sposta popup di ricerca", | |
17 | +font_size: "-- Dimensione --", | |
18 | +go_to_line: "vai alla linea", | |
19 | +go_to_line_prompt: "vai alla linea numero:", | |
20 | +undo: "annulla", | |
21 | +redo: "ripeti", | |
22 | +change_smooth_selection: "abilita/disabilita alcune caratteristiche della visualizzazione", | |
23 | +highlight: "abilita/disabilita colorazione della sintassi", | |
24 | +reset_highlight: "aggiorna colorazione (se non sincronizzata)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "informazioni su...", | |
27 | +save: "salva", | |
28 | +load: "carica", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Posizione", | |
32 | +total: "Totale", | |
33 | +close_popup: "chiudi popup", | |
34 | +shortcuts: "Scorciatoie", | |
35 | +add_tab: "aggiungi tabulazione", | |
36 | +remove_tab: "rimuovi tabulazione", | |
37 | +about_notice: "Avviso: la colorazione della sintassi vale solo con testo piccolo", | |
38 | +toggle: "Abilita/disabilita editor", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "In corso...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/ja.js
0 → 100644
1 | +editAreaLoader.lang["ja"]={ | |
2 | +new_document: "新規作成", | |
3 | +search_button: "検索・置換", | |
4 | +search_command: "次を検索 / 検索窓を表示", | |
5 | +search: "検索", | |
6 | +replace: "置換", | |
7 | +replace_command: "置換 / 置換窓を表示", | |
8 | +find_next: "次を検索", | |
9 | +replace_all: "全置換", | |
10 | +reg_exp: "正規表現", | |
11 | +match_case: "大文字小文字の区別", | |
12 | +not_found: "見つかりません。", | |
13 | +occurrence_replaced: "置換しました。", | |
14 | +search_field_empty: "検索対象文字列が空です。", | |
15 | +restart_search_at_begin: "終端に達しました、始めに戻ります", | |
16 | +move_popup: "検索窓を移動", | |
17 | +font_size: "--フォントサイズ--", | |
18 | +go_to_line: "指定行へ移動", | |
19 | +go_to_line_prompt: "指定行へ移動します:", | |
20 | +undo: "元に戻す", | |
21 | +redo: "やり直し", | |
22 | +change_smooth_selection: "スムース表示の切り替え(CPUを使います)", | |
23 | +highlight: "構文強調表示の切り替え", | |
24 | +reset_highlight: "構文強調表示のリセット", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "ヘルプを表示", | |
27 | +save: "保存", | |
28 | +load: "読み込み", | |
29 | +line_abbr: "行", | |
30 | +char_abbr: "文字", | |
31 | +position: "位置", | |
32 | +total: "合計", | |
33 | +close_popup: "ポップアップを閉じる", | |
34 | +shortcuts: "ショートカット", | |
35 | +add_tab: "タブを挿入する", | |
36 | +remove_tab: "タブを削除する", | |
37 | +about_notice: "注意:構文強調表示は短いテキストでしか有効に機能しません。", | |
38 | +toggle: "テキストエリアとeditAreaの切り替え", | |
39 | +accesskey: "アクセスキー", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "処理中です...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/mk.js
0 → 100644
1 | +editAreaLoader.lang["mk"]={ | |
2 | +new_document: "Нов документ", | |
3 | +search_button: "Најди и замени", | |
4 | +search_command: "Барај следно / Отвори нов прозорец за пребарување", | |
5 | +search: "Барај", | |
6 | +replace: "Замени", | |
7 | +replace_command: "Замени / Отвори прозорец за пребарување", | |
8 | +find_next: "најди следно", | |
9 | +replace_all: "Замени ги сите", | |
10 | +reg_exp: "Регуларни изрази", | |
11 | +match_case: "Битна е големината на буквите", | |
12 | +not_found: "не е пронајдено.", | |
13 | +occurrence_replaced: "замени.", | |
14 | +search_field_empty: "Полето за пребарување е празно", | |
15 | +restart_search_at_begin: "Крај на областа. Стартувај од почеток.", | |
16 | +move_popup: "Помести го прозорецот", | |
17 | +font_size: "--Големина на текстот--", | |
18 | +go_to_line: "Оди на линија", | |
19 | +go_to_line_prompt: "Оди на линија со број:", | |
20 | +undo: "Врати", | |
21 | +redo: "Повтори", | |
22 | +change_smooth_selection: "Вклучи/исклучи некои карактеристики за приказ (попаметен приказ, но поголемо оптеретување за процесорот)", | |
23 | +highlight: "Вклучи/исклучи осветлување на синтакса", | |
24 | +reset_highlight: "Ресетирај го осветлувањето на синтакса (доколку е десинхронизиранo со текстот)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "За", | |
27 | +save: "Зачувај", | |
28 | +load: "Вчитај", | |
29 | +line_abbr: "Лн", | |
30 | +char_abbr: "Зн", | |
31 | +position: "Позиција", | |
32 | +total: "Вкупно", | |
33 | +close_popup: "Затвори го прозорецот", | |
34 | +shortcuts: "Кратенки", | |
35 | +add_tab: "Додај табулација на текстот", | |
36 | +remove_tab: "Отстрани ја табулацијата", | |
37 | +about_notice: "Напомена: Осветлувањето на синтанса е само за краток текст", | |
38 | +toggle: "Смени начин на уредување", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Обработувам...", | |
45 | +fullscreen: "Цел прозорец", | |
46 | +syntax_selection: "--Синтакса--", | |
47 | +close_tab: "Избери датотека" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/nl.js
0 → 100644
1 | +editAreaLoader.lang["nl"]={ | |
2 | +new_document: "nieuw leeg document", | |
3 | +search_button: "zoek en vervang", | |
4 | +search_command: "zoek volgende / zoekscherm openen", | |
5 | +search: "zoek", | |
6 | +replace: "vervang", | |
7 | +replace_command: "vervang / zoekscherm openen", | |
8 | +find_next: "volgende vinden", | |
9 | +replace_all: "alles vervangen", | |
10 | +reg_exp: "reguliere expressies", | |
11 | +match_case: "hoofdletter gevoelig", | |
12 | +not_found: "niet gevonden.", | |
13 | +occurrence_replaced: "object vervangen.", | |
14 | +search_field_empty: "Zoek veld leeg", | |
15 | +restart_search_at_begin: "Niet meer instanties gevonden, begin opnieuw", | |
16 | +move_popup: "versleep zoek scherm", | |
17 | +font_size: "--Letter grootte--", | |
18 | +go_to_line: "Ga naar regel", | |
19 | +go_to_line_prompt: "Ga naar regel nummer:", | |
20 | +undo: "Ongedaan maken", | |
21 | +redo: "Opnieuw doen", | |
22 | +change_smooth_selection: "zet wat schermopties aan/uit (kan langzamer zijn)", | |
23 | +highlight: "zet syntax highlight aan/uit", | |
24 | +reset_highlight: "reset highlight (indien gedesynchronizeerd)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "informatie", | |
27 | +save: "opslaan", | |
28 | +load: "laden", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Positie", | |
32 | +total: "Totaal", | |
33 | +close_popup: "Popup sluiten", | |
34 | +shortcuts: "Snelkoppelingen", | |
35 | +add_tab: "voeg tabs toe in tekst", | |
36 | +remove_tab: "verwijder tabs uit tekst", | |
37 | +about_notice: "Notitie: syntax highlight functie is alleen voor kleine tekst", | |
38 | +toggle: "geavanceerde bewerkingsopties", | |
39 | +accesskey: "Accessknop", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Verwerken...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/pl.js
0 → 100644
1 | +editAreaLoader.lang["pl"]={ | |
2 | +new_document: "nowy dokument", | |
3 | +search_button: "znajdź i zamień", | |
4 | +search_command: "znajdź następny", | |
5 | +search: "znajdź", | |
6 | +replace: "zamień", | |
7 | +replace_command: "zamień", | |
8 | +find_next: "następny", | |
9 | +replace_all: "zamień wszystko", | |
10 | +reg_exp: "wyrażenie regularne", | |
11 | +match_case: "uwzględnij wielkość liter<br />", | |
12 | +not_found: "nie znaleziono.", | |
13 | +occurrence_replaced: "wystąpień zamieniono.", | |
14 | +search_field_empty: "Nie wprowadzono tekstu", | |
15 | +restart_search_at_begin: "Koniec dokumentu. Wyszukiwanie od początku.", | |
16 | +move_popup: "przesuń okienko wyszukiwania", | |
17 | +font_size: "Rozmiar", | |
18 | +go_to_line: "idź do linii", | |
19 | +go_to_line_prompt: "numer linii:", | |
20 | +undo: "cofnij", | |
21 | +redo: "przywróć", | |
22 | +change_smooth_selection: "włącz/wyłącz niektóre opcje wyglądu (zaawansowane opcje wyglądu obciążają procesor)", | |
23 | +highlight: "włącz/wyłącz podświetlanie składni", | |
24 | +reset_highlight: "odśwież podświetlanie składni (jeśli rozsynchronizowało się z tekstem)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "o programie", | |
27 | +save: "zapisz", | |
28 | +load: "otwórz", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Zn", | |
31 | +position: "Pozycja", | |
32 | +total: "W sumie", | |
33 | +close_popup: "zamknij okienko", | |
34 | +shortcuts: "Skróty klawiaturowe", | |
35 | +add_tab: "dodaj wcięcie do zaznaczonego tekstu", | |
36 | +remove_tab: "usuń wcięcie", | |
37 | +about_notice: "Uwaga: podświetlanie składni nie jest zalecane dla długich tekstów", | |
38 | +toggle: "Włącz/wyłącz edytor", | |
39 | +accesskey: "Alt+", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Przetwarzanie...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/pt.js
0 → 100644
1 | +editAreaLoader.lang["pt"]={ | |
2 | +new_document: "Novo documento", | |
3 | +search_button: "Localizar e substituir", | |
4 | +search_command: "Localizar próximo", | |
5 | +search: "Localizar", | |
6 | +replace: "Substituir", | |
7 | +replace_command: "Substituir", | |
8 | +find_next: "Localizar", | |
9 | +replace_all: "Subst. tudo", | |
10 | +reg_exp: "Expressões regulares", | |
11 | +match_case: "Diferenciar maiúsculas e minúsculas", | |
12 | +not_found: "Não encontrado.", | |
13 | +occurrence_replaced: "Ocorrências substituidas", | |
14 | +search_field_empty: "Campo localizar vazio.", | |
15 | +restart_search_at_begin: "Fim das ocorrências. Recomeçar do inicio.", | |
16 | +move_popup: "Mover janela", | |
17 | +font_size: "--Tamanho da fonte--", | |
18 | +go_to_line: "Ir para linha", | |
19 | +go_to_line_prompt: "Ir para a linha:", | |
20 | +undo: "Desfazer", | |
21 | +redo: "Refazer", | |
22 | +change_smooth_selection: "Opções visuais", | |
23 | +highlight: "Cores de sintaxe", | |
24 | +reset_highlight: "Resetar cores (se não sincronizado)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "Sobre", | |
27 | +save: "Salvar", | |
28 | +load: "Carregar", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Posição", | |
32 | +total: "Total", | |
33 | +close_popup: "Fechar", | |
34 | +shortcuts: "Shortcuts", | |
35 | +add_tab: "Adicionar tabulação", | |
36 | +remove_tab: "Remover tabulação", | |
37 | +about_notice: "Atenção: Cores de sintaxe são indicados somente para textos pequenos", | |
38 | +toggle: "Exibir editor", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Processando...", | |
45 | +fullscreen: "fullscreen", | |
46 | +syntax_selection: "--Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/ru.js
0 → 100644
1 | +editAreaLoader.lang["ru"]={ | |
2 | +new_document: "новый пустой документ", | |
3 | +search_button: "поиск и замена", | |
4 | +search_command: "искать следующий / открыть панель поиска", | |
5 | +search: "поиск", | |
6 | +replace: "замена", | |
7 | +replace_command: "заменить / открыть панель поиска", | |
8 | +find_next: "найти следующее", | |
9 | +replace_all: "заменить все", | |
10 | +reg_exp: "регулярное выражение", | |
11 | +match_case: "учитывать регистр", | |
12 | +not_found: "не найдено.", | |
13 | +occurrence_replaced: "вхождение заменено.", | |
14 | +search_field_empty: "Поле поиска пустое", | |
15 | +restart_search_at_begin: "Достигнут конец документа. Начинаю с начала.", | |
16 | +move_popup: "переместить окно поиска", | |
17 | +font_size: "--Размер шрифта--", | |
18 | +go_to_line: "перейти к строке", | |
19 | +go_to_line_prompt: "перейти к строке номер:", | |
20 | +undo: "отменить", | |
21 | +redo: "вернуть", | |
22 | +change_smooth_selection: "включить/отключить некоторые функции просмотра (более красиво, но больше использует процессор)", | |
23 | +highlight: "переключить подсветку синтаксиса включена/выключена", | |
24 | +reset_highlight: "восстановить подсветку (если разсинхронизирована от текста)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "о программе", | |
27 | +save: "сохранить", | |
28 | +load: "загрузить", | |
29 | +line_abbr: "Стр", | |
30 | +char_abbr: "Стлб", | |
31 | +position: "Позиция", | |
32 | +total: "Всего", | |
33 | +close_popup: "закрыть всплывающее окно", | |
34 | +shortcuts: "Горячие клавиши", | |
35 | +add_tab: "добавить табуляцию в текст", | |
36 | +remove_tab: "убрать табуляцию из текста", | |
37 | +about_notice: "Внимание: функция подсветки синтаксиса только для небольших текстов", | |
38 | +toggle: "Переключить редактор", | |
39 | +accesskey: "Горячая клавиша", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Обработка...", | |
45 | +fullscreen: "полный экран", | |
46 | +syntax_selection: "--Синтакс--", | |
47 | +close_tab: "Закрыть файл" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/sk.js
0 → 100644
1 | +editAreaLoader.lang["sk"]={ | |
2 | +new_document: "nový prázdy dokument", | |
3 | +search_button: "vyhľadaj a nahraď", | |
4 | +search_command: "hľadaj ďalsšie / otvor vyhľadávacie pole", | |
5 | +search: "hľadaj", | |
6 | +replace: "nahraď", | |
7 | +replace_command: "nahraď / otvor vyhľadávacie pole", | |
8 | +find_next: "nájdi ďalšie", | |
9 | +replace_all: "nahraď všetko", | |
10 | +reg_exp: "platné výrazy", | |
11 | +match_case: "zhodujúce sa výrazy", | |
12 | +not_found: "nenájdené.", | |
13 | +occurrence_replaced: "výskyty nahradené.", | |
14 | +search_field_empty: "Pole vyhľadávanie je prádzne", | |
15 | +restart_search_at_begin: "End of area reached. Restart at begin.", | |
16 | +move_popup: "presuň vyhľadávacie okno", | |
17 | +font_size: "--Veľkosť textu--", | |
18 | +go_to_line: "prejdi na riadok", | |
19 | +go_to_line_prompt: "prejdi na riadok:", | |
20 | +undo: "krok späť", | |
21 | +redo: "prepracovať", | |
22 | +change_smooth_selection: "povoliť/zamietnúť niektoré zo zobrazených funkcií (účelnejšie zobrazenie vyžaduje väčšie zaťaženie procesora CPU)", | |
23 | +highlight: "prepnúť zvýrazňovanie syntaxe zap/vyp", | |
24 | +reset_highlight: "zrušiť zvýrazňovanie (ak je nesynchronizované s textom)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "o programe", | |
27 | +save: "uložiť", | |
28 | +load: "načítať", | |
29 | +line_abbr: "Ln", | |
30 | +char_abbr: "Ch", | |
31 | +position: "Pozícia", | |
32 | +total: "Spolu", | |
33 | +close_popup: "zavrieť okno", | |
34 | +shortcuts: "Skratky", | |
35 | +add_tab: "pridať tabulovanie textu", | |
36 | +remove_tab: "odstrániť tabulovanie textu", | |
37 | +about_notice: "Upozornenie: funkcia zvýrazňovania syntaxe je dostupná iba pre malý text", | |
38 | +toggle: "Prepnúť editor", | |
39 | +accesskey: "Accesskey", | |
40 | +tab: "Záložka", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "Spracúvam...", | |
45 | +fullscreen: "cel=a obrazovka", | |
46 | +syntax_selection: "--Vyber Syntax--", | |
47 | +close_tab: "Close file" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/langs/zh.js
0 → 100644
1 | +editAreaLoader.lang["zh"]={ | |
2 | +new_document: "新建空白文档", | |
3 | +search_button: "查找与替换", | |
4 | +search_command: "查找下一个 / 打开查找框", | |
5 | +search: "查找", | |
6 | +replace: "替换", | |
7 | +replace_command: "替换 / 打开查找框", | |
8 | +find_next: "查找下一个", | |
9 | +replace_all: "全部替换", | |
10 | +reg_exp: "正则表达式", | |
11 | +match_case: "匹配大小写", | |
12 | +not_found: "未找到.", | |
13 | +occurrence_replaced: "处被替换.", | |
14 | +search_field_empty: "查找框没有内容", | |
15 | +restart_search_at_begin: "已到到文档末尾. 从头重新查找.", | |
16 | +move_popup: "移动查找对话框", | |
17 | +font_size: "--字体大小--", | |
18 | +go_to_line: "转到行", | |
19 | +go_to_line_prompt: "转到行:", | |
20 | +undo: "恢复", | |
21 | +redo: "重做", | |
22 | +change_smooth_selection: "启用/禁止一些显示特性(更好看但更耗费资源)", | |
23 | +highlight: "启用/禁止语法高亮", | |
24 | +reset_highlight: "重置语法高亮(当文本显示不同步时)", | |
25 | +word_wrap: "toggle word wrapping mode", | |
26 | +help: "关于", | |
27 | +save: "保存", | |
28 | +load: "加载", | |
29 | +line_abbr: "行", | |
30 | +char_abbr: "字符", | |
31 | +position: "位置", | |
32 | +total: "总计", | |
33 | +close_popup: "关闭对话框", | |
34 | +shortcuts: "快捷键", | |
35 | +add_tab: "添加制表符(Tab)", | |
36 | +remove_tab: "移除制表符(Tab)", | |
37 | +about_notice: "注意:语法高亮功能仅用于较少内容的文本(文件内容太大会导致浏览器反应慢)", | |
38 | +toggle: "切换编辑器", | |
39 | +accesskey: "快捷键", | |
40 | +tab: "Tab", | |
41 | +shift: "Shift", | |
42 | +ctrl: "Ctrl", | |
43 | +esc: "Esc", | |
44 | +processing: "正在处理中...", | |
45 | +fullscreen: "全屏编辑", | |
46 | +syntax_selection: "--语法--", | |
47 | +close_tab: "关闭文件" | |
48 | +}; | ... | ... |
docs/js/editarea_0_8_2/edit_area/license_apache.txt
0 → 100644
1 | +Copyright 2008 Christophe Dolivet | |
2 | + | |
3 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at | |
4 | + | |
5 | + http://www.apache.org/licenses/LICENSE-2.0 | |
6 | + | |
7 | +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | |
0 | 8 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/license_bsd.txt
0 → 100644
1 | +Copyright (c) 2008, Christophe Dolivet | |
2 | +All rights reserved. | |
3 | + | |
4 | +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
5 | + | |
6 | + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
7 | + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
8 | + * Neither the name of EditArea nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |
9 | + | |
10 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
0 | 11 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/license_lgpl.txt
0 → 100644
1 | + GNU LESSER GENERAL PUBLIC LICENSE | |
2 | + Version 2.1, February 1999 | |
3 | + | |
4 | + Copyright (C) 1991, 1999 Free Software Foundation, Inc. | |
5 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
6 | + Everyone is permitted to copy and distribute verbatim copies | |
7 | + of this license document, but changing it is not allowed. | |
8 | + | |
9 | +[This is the first released version of the Lesser GPL. It also counts | |
10 | + as the successor of the GNU Library Public License, version 2, hence | |
11 | + the version number 2.1.] | |
12 | + | |
13 | + Preamble | |
14 | + | |
15 | + The licenses for most software are designed to take away your | |
16 | +freedom to share and change it. By contrast, the GNU General Public | |
17 | +Licenses are intended to guarantee your freedom to share and change | |
18 | +free software--to make sure the software is free for all its users. | |
19 | + | |
20 | + This license, the Lesser General Public License, applies to some | |
21 | +specially designated software packages--typically libraries--of the | |
22 | +Free Software Foundation and other authors who decide to use it. You | |
23 | +can use it too, but we suggest you first think carefully about whether | |
24 | +this license or the ordinary General Public License is the better | |
25 | +strategy to use in any particular case, based on the explanations below. | |
26 | + | |
27 | + When we speak of free software, we are referring to freedom of use, | |
28 | +not price. Our General Public Licenses are designed to make sure that | |
29 | +you have the freedom to distribute copies of free software (and charge | |
30 | +for this service if you wish); that you receive source code or can get | |
31 | +it if you want it; that you can change the software and use pieces of | |
32 | +it in new free programs; and that you are informed that you can do | |
33 | +these things. | |
34 | + | |
35 | + To protect your rights, we need to make restrictions that forbid | |
36 | +distributors to deny you these rights or to ask you to surrender these | |
37 | +rights. These restrictions translate to certain responsibilities for | |
38 | +you if you distribute copies of the library or if you modify it. | |
39 | + | |
40 | + For example, if you distribute copies of the library, whether gratis | |
41 | +or for a fee, you must give the recipients all the rights that we gave | |
42 | +you. You must make sure that they, too, receive or can get the source | |
43 | +code. If you link other code with the library, you must provide | |
44 | +complete object files to the recipients, so that they can relink them | |
45 | +with the library after making changes to the library and recompiling | |
46 | +it. And you must show them these terms so they know their rights. | |
47 | + | |
48 | + We protect your rights with a two-step method: (1) we copyright the | |
49 | +library, and (2) we offer you this license, which gives you legal | |
50 | +permission to copy, distribute and/or modify the library. | |
51 | + | |
52 | + To protect each distributor, we want to make it very clear that | |
53 | +there is no warranty for the free library. Also, if the library is | |
54 | +modified by someone else and passed on, the recipients should know | |
55 | +that what they have is not the original version, so that the original | |
56 | +author's reputation will not be affected by problems that might be | |
57 | +introduced by others. | |
58 | + | |
59 | + Finally, software patents pose a constant threat to the existence of | |
60 | +any free program. We wish to make sure that a company cannot | |
61 | +effectively restrict the users of a free program by obtaining a | |
62 | +restrictive license from a patent holder. Therefore, we insist that | |
63 | +any patent license obtained for a version of the library must be | |
64 | +consistent with the full freedom of use specified in this license. | |
65 | + | |
66 | + Most GNU software, including some libraries, is covered by the | |
67 | +ordinary GNU General Public License. This license, the GNU Lesser | |
68 | +General Public License, applies to certain designated libraries, and | |
69 | +is quite different from the ordinary General Public License. We use | |
70 | +this license for certain libraries in order to permit linking those | |
71 | +libraries into non-free programs. | |
72 | + | |
73 | + When a program is linked with a library, whether statically or using | |
74 | +a shared library, the combination of the two is legally speaking a | |
75 | +combined work, a derivative of the original library. The ordinary | |
76 | +General Public License therefore permits such linking only if the | |
77 | +entire combination fits its criteria of freedom. The Lesser General | |
78 | +Public License permits more lax criteria for linking other code with | |
79 | +the library. | |
80 | + | |
81 | + We call this license the "Lesser" General Public License because it | |
82 | +does Less to protect the user's freedom than the ordinary General | |
83 | +Public License. It also provides other free software developers Less | |
84 | +of an advantage over competing non-free programs. These disadvantages | |
85 | +are the reason we use the ordinary General Public License for many | |
86 | +libraries. However, the Lesser license provides advantages in certain | |
87 | +special circumstances. | |
88 | + | |
89 | + For example, on rare occasions, there may be a special need to | |
90 | +encourage the widest possible use of a certain library, so that it becomes | |
91 | +a de-facto standard. To achieve this, non-free programs must be | |
92 | +allowed to use the library. A more frequent case is that a free | |
93 | +library does the same job as widely used non-free libraries. In this | |
94 | +case, there is little to gain by limiting the free library to free | |
95 | +software only, so we use the Lesser General Public License. | |
96 | + | |
97 | + In other cases, permission to use a particular library in non-free | |
98 | +programs enables a greater number of people to use a large body of | |
99 | +free software. For example, permission to use the GNU C Library in | |
100 | +non-free programs enables many more people to use the whole GNU | |
101 | +operating system, as well as its variant, the GNU/Linux operating | |
102 | +system. | |
103 | + | |
104 | + Although the Lesser General Public License is Less protective of the | |
105 | +users' freedom, it does ensure that the user of a program that is | |
106 | +linked with the Library has the freedom and the wherewithal to run | |
107 | +that program using a modified version of the Library. | |
108 | + | |
109 | + The precise terms and conditions for copying, distribution and | |
110 | +modification follow. Pay close attention to the difference between a | |
111 | +"work based on the library" and a "work that uses the library". The | |
112 | +former contains code derived from the library, whereas the latter must | |
113 | +be combined with the library in order to run. | |
114 | + | |
115 | + GNU LESSER GENERAL PUBLIC LICENSE | |
116 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
117 | + | |
118 | + 0. This License Agreement applies to any software library or other | |
119 | +program which contains a notice placed by the copyright holder or | |
120 | +other authorized party saying it may be distributed under the terms of | |
121 | +this Lesser General Public License (also called "this License"). | |
122 | +Each licensee is addressed as "you". | |
123 | + | |
124 | + A "library" means a collection of software functions and/or data | |
125 | +prepared so as to be conveniently linked with application programs | |
126 | +(which use some of those functions and data) to form executables. | |
127 | + | |
128 | + The "Library", below, refers to any such software library or work | |
129 | +which has been distributed under these terms. A "work based on the | |
130 | +Library" means either the Library or any derivative work under | |
131 | +copyright law: that is to say, a work containing the Library or a | |
132 | +portion of it, either verbatim or with modifications and/or translated | |
133 | +straightforwardly into another language. (Hereinafter, translation is | |
134 | +included without limitation in the term "modification".) | |
135 | + | |
136 | + "Source code" for a work means the preferred form of the work for | |
137 | +making modifications to it. For a library, complete source code means | |
138 | +all the source code for all modules it contains, plus any associated | |
139 | +interface definition files, plus the scripts used to control compilation | |
140 | +and installation of the library. | |
141 | + | |
142 | + Activities other than copying, distribution and modification are not | |
143 | +covered by this License; they are outside its scope. The act of | |
144 | +running a program using the Library is not restricted, and output from | |
145 | +such a program is covered only if its contents constitute a work based | |
146 | +on the Library (independent of the use of the Library in a tool for | |
147 | +writing it). Whether that is true depends on what the Library does | |
148 | +and what the program that uses the Library does. | |
149 | + | |
150 | + 1. You may copy and distribute verbatim copies of the Library's | |
151 | +complete source code as you receive it, in any medium, provided that | |
152 | +you conspicuously and appropriately publish on each copy an | |
153 | +appropriate copyright notice and disclaimer of warranty; keep intact | |
154 | +all the notices that refer to this License and to the absence of any | |
155 | +warranty; and distribute a copy of this License along with the | |
156 | +Library. | |
157 | + | |
158 | + You may charge a fee for the physical act of transferring a copy, | |
159 | +and you may at your option offer warranty protection in exchange for a | |
160 | +fee. | |
161 | + | |
162 | + 2. You may modify your copy or copies of the Library or any portion | |
163 | +of it, thus forming a work based on the Library, and copy and | |
164 | +distribute such modifications or work under the terms of Section 1 | |
165 | +above, provided that you also meet all of these conditions: | |
166 | + | |
167 | + a) The modified work must itself be a software library. | |
168 | + | |
169 | + b) You must cause the files modified to carry prominent notices | |
170 | + stating that you changed the files and the date of any change. | |
171 | + | |
172 | + c) You must cause the whole of the work to be licensed at no | |
173 | + charge to all third parties under the terms of this License. | |
174 | + | |
175 | + d) If a facility in the modified Library refers to a function or a | |
176 | + table of data to be supplied by an application program that uses | |
177 | + the facility, other than as an argument passed when the facility | |
178 | + is invoked, then you must make a good faith effort to ensure that, | |
179 | + in the event an application does not supply such function or | |
180 | + table, the facility still operates, and performs whatever part of | |
181 | + its purpose remains meaningful. | |
182 | + | |
183 | + (For example, a function in a library to compute square roots has | |
184 | + a purpose that is entirely well-defined independent of the | |
185 | + application. Therefore, Subsection 2d requires that any | |
186 | + application-supplied function or table used by this function must | |
187 | + be optional: if the application does not supply it, the square | |
188 | + root function must still compute square roots.) | |
189 | + | |
190 | +These requirements apply to the modified work as a whole. If | |
191 | +identifiable sections of that work are not derived from the Library, | |
192 | +and can be reasonably considered independent and separate works in | |
193 | +themselves, then this License, and its terms, do not apply to those | |
194 | +sections when you distribute them as separate works. But when you | |
195 | +distribute the same sections as part of a whole which is a work based | |
196 | +on the Library, the distribution of the whole must be on the terms of | |
197 | +this License, whose permissions for other licensees extend to the | |
198 | +entire whole, and thus to each and every part regardless of who wrote | |
199 | +it. | |
200 | + | |
201 | +Thus, it is not the intent of this section to claim rights or contest | |
202 | +your rights to work written entirely by you; rather, the intent is to | |
203 | +exercise the right to control the distribution of derivative or | |
204 | +collective works based on the Library. | |
205 | + | |
206 | +In addition, mere aggregation of another work not based on the Library | |
207 | +with the Library (or with a work based on the Library) on a volume of | |
208 | +a storage or distribution medium does not bring the other work under | |
209 | +the scope of this License. | |
210 | + | |
211 | + 3. You may opt to apply the terms of the ordinary GNU General Public | |
212 | +License instead of this License to a given copy of the Library. To do | |
213 | +this, you must alter all the notices that refer to this License, so | |
214 | +that they refer to the ordinary GNU General Public License, version 2, | |
215 | +instead of to this License. (If a newer version than version 2 of the | |
216 | +ordinary GNU General Public License has appeared, then you can specify | |
217 | +that version instead if you wish.) Do not make any other change in | |
218 | +these notices. | |
219 | + | |
220 | + Once this change is made in a given copy, it is irreversible for | |
221 | +that copy, so the ordinary GNU General Public License applies to all | |
222 | +subsequent copies and derivative works made from that copy. | |
223 | + | |
224 | + This option is useful when you wish to copy part of the code of | |
225 | +the Library into a program that is not a library. | |
226 | + | |
227 | + 4. You may copy and distribute the Library (or a portion or | |
228 | +derivative of it, under Section 2) in object code or executable form | |
229 | +under the terms of Sections 1 and 2 above provided that you accompany | |
230 | +it with the complete corresponding machine-readable source code, which | |
231 | +must be distributed under the terms of Sections 1 and 2 above on a | |
232 | +medium customarily used for software interchange. | |
233 | + | |
234 | + If distribution of object code is made by offering access to copy | |
235 | +from a designated place, then offering equivalent access to copy the | |
236 | +source code from the same place satisfies the requirement to | |
237 | +distribute the source code, even though third parties are not | |
238 | +compelled to copy the source along with the object code. | |
239 | + | |
240 | + 5. A program that contains no derivative of any portion of the | |
241 | +Library, but is designed to work with the Library by being compiled or | |
242 | +linked with it, is called a "work that uses the Library". Such a | |
243 | +work, in isolation, is not a derivative work of the Library, and | |
244 | +therefore falls outside the scope of this License. | |
245 | + | |
246 | + However, linking a "work that uses the Library" with the Library | |
247 | +creates an executable that is a derivative of the Library (because it | |
248 | +contains portions of the Library), rather than a "work that uses the | |
249 | +library". The executable is therefore covered by this License. | |
250 | +Section 6 states terms for distribution of such executables. | |
251 | + | |
252 | + When a "work that uses the Library" uses material from a header file | |
253 | +that is part of the Library, the object code for the work may be a | |
254 | +derivative work of the Library even though the source code is not. | |
255 | +Whether this is true is especially significant if the work can be | |
256 | +linked without the Library, or if the work is itself a library. The | |
257 | +threshold for this to be true is not precisely defined by law. | |
258 | + | |
259 | + If such an object file uses only numerical parameters, data | |
260 | +structure layouts and accessors, and small macros and small inline | |
261 | +functions (ten lines or less in length), then the use of the object | |
262 | +file is unrestricted, regardless of whether it is legally a derivative | |
263 | +work. (Executables containing this object code plus portions of the | |
264 | +Library will still fall under Section 6.) | |
265 | + | |
266 | + Otherwise, if the work is a derivative of the Library, you may | |
267 | +distribute the object code for the work under the terms of Section 6. | |
268 | +Any executables containing that work also fall under Section 6, | |
269 | +whether or not they are linked directly with the Library itself. | |
270 | + | |
271 | + 6. As an exception to the Sections above, you may also combine or | |
272 | +link a "work that uses the Library" with the Library to produce a | |
273 | +work containing portions of the Library, and distribute that work | |
274 | +under terms of your choice, provided that the terms permit | |
275 | +modification of the work for the customer's own use and reverse | |
276 | +engineering for debugging such modifications. | |
277 | + | |
278 | + You must give prominent notice with each copy of the work that the | |
279 | +Library is used in it and that the Library and its use are covered by | |
280 | +this License. You must supply a copy of this License. If the work | |
281 | +during execution displays copyright notices, you must include the | |
282 | +copyright notice for the Library among them, as well as a reference | |
283 | +directing the user to the copy of this License. Also, you must do one | |
284 | +of these things: | |
285 | + | |
286 | + a) Accompany the work with the complete corresponding | |
287 | + machine-readable source code for the Library including whatever | |
288 | + changes were used in the work (which must be distributed under | |
289 | + Sections 1 and 2 above); and, if the work is an executable linked | |
290 | + with the Library, with the complete machine-readable "work that | |
291 | + uses the Library", as object code and/or source code, so that the | |
292 | + user can modify the Library and then relink to produce a modified | |
293 | + executable containing the modified Library. (It is understood | |
294 | + that the user who changes the contents of definitions files in the | |
295 | + Library will not necessarily be able to recompile the application | |
296 | + to use the modified definitions.) | |
297 | + | |
298 | + b) Use a suitable shared library mechanism for linking with the | |
299 | + Library. A suitable mechanism is one that (1) uses at run time a | |
300 | + copy of the library already present on the user's computer system, | |
301 | + rather than copying library functions into the executable, and (2) | |
302 | + will operate properly with a modified version of the library, if | |
303 | + the user installs one, as long as the modified version is | |
304 | + interface-compatible with the version that the work was made with. | |
305 | + | |
306 | + c) Accompany the work with a written offer, valid for at | |
307 | + least three years, to give the same user the materials | |
308 | + specified in Subsection 6a, above, for a charge no more | |
309 | + than the cost of performing this distribution. | |
310 | + | |
311 | + d) If distribution of the work is made by offering access to copy | |
312 | + from a designated place, offer equivalent access to copy the above | |
313 | + specified materials from the same place. | |
314 | + | |
315 | + e) Verify that the user has already received a copy of these | |
316 | + materials or that you have already sent this user a copy. | |
317 | + | |
318 | + For an executable, the required form of the "work that uses the | |
319 | +Library" must include any data and utility programs needed for | |
320 | +reproducing the executable from it. However, as a special exception, | |
321 | +the materials to be distributed need not include anything that is | |
322 | +normally distributed (in either source or binary form) with the major | |
323 | +components (compiler, kernel, and so on) of the operating system on | |
324 | +which the executable runs, unless that component itself accompanies | |
325 | +the executable. | |
326 | + | |
327 | + It may happen that this requirement contradicts the license | |
328 | +restrictions of other proprietary libraries that do not normally | |
329 | +accompany the operating system. Such a contradiction means you cannot | |
330 | +use both them and the Library together in an executable that you | |
331 | +distribute. | |
332 | + | |
333 | + 7. You may place library facilities that are a work based on the | |
334 | +Library side-by-side in a single library together with other library | |
335 | +facilities not covered by this License, and distribute such a combined | |
336 | +library, provided that the separate distribution of the work based on | |
337 | +the Library and of the other library facilities is otherwise | |
338 | +permitted, and provided that you do these two things: | |
339 | + | |
340 | + a) Accompany the combined library with a copy of the same work | |
341 | + based on the Library, uncombined with any other library | |
342 | + facilities. This must be distributed under the terms of the | |
343 | + Sections above. | |
344 | + | |
345 | + b) Give prominent notice with the combined library of the fact | |
346 | + that part of it is a work based on the Library, and explaining | |
347 | + where to find the accompanying uncombined form of the same work. | |
348 | + | |
349 | + 8. You may not copy, modify, sublicense, link with, or distribute | |
350 | +the Library except as expressly provided under this License. Any | |
351 | +attempt otherwise to copy, modify, sublicense, link with, or | |
352 | +distribute the Library is void, and will automatically terminate your | |
353 | +rights under this License. However, parties who have received copies, | |
354 | +or rights, from you under this License will not have their licenses | |
355 | +terminated so long as such parties remain in full compliance. | |
356 | + | |
357 | + 9. You are not required to accept this License, since you have not | |
358 | +signed it. However, nothing else grants you permission to modify or | |
359 | +distribute the Library or its derivative works. These actions are | |
360 | +prohibited by law if you do not accept this License. Therefore, by | |
361 | +modifying or distributing the Library (or any work based on the | |
362 | +Library), you indicate your acceptance of this License to do so, and | |
363 | +all its terms and conditions for copying, distributing or modifying | |
364 | +the Library or works based on it. | |
365 | + | |
366 | + 10. Each time you redistribute the Library (or any work based on the | |
367 | +Library), the recipient automatically receives a license from the | |
368 | +original licensor to copy, distribute, link with or modify the Library | |
369 | +subject to these terms and conditions. You may not impose any further | |
370 | +restrictions on the recipients' exercise of the rights granted herein. | |
371 | +You are not responsible for enforcing compliance by third parties with | |
372 | +this License. | |
373 | + | |
374 | + 11. If, as a consequence of a court judgment or allegation of patent | |
375 | +infringement or for any other reason (not limited to patent issues), | |
376 | +conditions are imposed on you (whether by court order, agreement or | |
377 | +otherwise) that contradict the conditions of this License, they do not | |
378 | +excuse you from the conditions of this License. If you cannot | |
379 | +distribute so as to satisfy simultaneously your obligations under this | |
380 | +License and any other pertinent obligations, then as a consequence you | |
381 | +may not distribute the Library at all. For example, if a patent | |
382 | +license would not permit royalty-free redistribution of the Library by | |
383 | +all those who receive copies directly or indirectly through you, then | |
384 | +the only way you could satisfy both it and this License would be to | |
385 | +refrain entirely from distribution of the Library. | |
386 | + | |
387 | +If any portion of this section is held invalid or unenforceable under any | |
388 | +particular circumstance, the balance of the section is intended to apply, | |
389 | +and the section as a whole is intended to apply in other circumstances. | |
390 | + | |
391 | +It is not the purpose of this section to induce you to infringe any | |
392 | +patents or other property right claims or to contest validity of any | |
393 | +such claims; this section has the sole purpose of protecting the | |
394 | +integrity of the free software distribution system which is | |
395 | +implemented by public license practices. Many people have made | |
396 | +generous contributions to the wide range of software distributed | |
397 | +through that system in reliance on consistent application of that | |
398 | +system; it is up to the author/donor to decide if he or she is willing | |
399 | +to distribute software through any other system and a licensee cannot | |
400 | +impose that choice. | |
401 | + | |
402 | +This section is intended to make thoroughly clear what is believed to | |
403 | +be a consequence of the rest of this License. | |
404 | + | |
405 | + 12. If the distribution and/or use of the Library is restricted in | |
406 | +certain countries either by patents or by copyrighted interfaces, the | |
407 | +original copyright holder who places the Library under this License may add | |
408 | +an explicit geographical distribution limitation excluding those countries, | |
409 | +so that distribution is permitted only in or among countries not thus | |
410 | +excluded. In such case, this License incorporates the limitation as if | |
411 | +written in the body of this License. | |
412 | + | |
413 | + 13. The Free Software Foundation may publish revised and/or new | |
414 | +versions of the Lesser General Public License from time to time. | |
415 | +Such new versions will be similar in spirit to the present version, | |
416 | +but may differ in detail to address new problems or concerns. | |
417 | + | |
418 | +Each version is given a distinguishing version number. If the Library | |
419 | +specifies a version number of this License which applies to it and | |
420 | +"any later version", you have the option of following the terms and | |
421 | +conditions either of that version or of any later version published by | |
422 | +the Free Software Foundation. If the Library does not specify a | |
423 | +license version number, you may choose any version ever published by | |
424 | +the Free Software Foundation. | |
425 | + | |
426 | + 14. If you wish to incorporate parts of the Library into other free | |
427 | +programs whose distribution conditions are incompatible with these, | |
428 | +write to the author to ask for permission. For software which is | |
429 | +copyrighted by the Free Software Foundation, write to the Free | |
430 | +Software Foundation; we sometimes make exceptions for this. Our | |
431 | +decision will be guided by the two goals of preserving the free status | |
432 | +of all derivatives of our free software and of promoting the sharing | |
433 | +and reuse of software generally. | |
434 | + | |
435 | + NO WARRANTY | |
436 | + | |
437 | + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO | |
438 | +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. | |
439 | +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR | |
440 | +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY | |
441 | +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE | |
442 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
443 | +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE | |
444 | +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME | |
445 | +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
446 | + | |
447 | + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN | |
448 | +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY | |
449 | +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU | |
450 | +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR | |
451 | +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE | |
452 | +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | |
453 | +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | |
454 | +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | |
455 | +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |
456 | +DAMAGES. | |
457 | + | |
458 | + END OF TERMS AND CONDITIONS | ... | ... |
docs/js/editarea_0_8_2/edit_area/manage_area.js
0 → 100644
1 | + EditArea.prototype.focus = function() { | |
2 | + this.textarea.focus(); | |
3 | + this.textareaFocused=true; | |
4 | + }; | |
5 | + | |
6 | + | |
7 | + EditArea.prototype.check_line_selection= function(timer_checkup){ | |
8 | + var changes, infos, new_top, new_width,i; | |
9 | + | |
10 | + var t1=t2=t2_1=t3=tLines=tend= new Date().getTime(); | |
11 | + // l'editeur n'existe plus => on quitte | |
12 | + if(!editAreas[this.id]) | |
13 | + return false; | |
14 | + | |
15 | + if(!this.smooth_selection && !this.do_highlight) | |
16 | + { | |
17 | + //do nothing | |
18 | + } | |
19 | + else if(this.textareaFocused && editAreas[this.id]["displayed"]==true && this.isResizing==false) | |
20 | + { | |
21 | + infos = this.get_selection_infos(); | |
22 | + changes = this.checkTextEvolution( typeof( this.last_selection['full_text'] ) == 'undefined' ? '' : this.last_selection['full_text'], infos['full_text'] ); | |
23 | + | |
24 | + t2= new Date().getTime(); | |
25 | + | |
26 | + // if selection change | |
27 | + if(this.last_selection["line_start"] != infos["line_start"] || this.last_selection["line_nb"] != infos["line_nb"] || infos["full_text"] != this.last_selection["full_text"] || this.reload_highlight || this.last_selection["selectionStart"] != infos["selectionStart"] || this.last_selection["selectionEnd"] != infos["selectionEnd"] || !timer_checkup ) | |
28 | + { | |
29 | + // move and adjust text selection elements | |
30 | + new_top = this.getLinePosTop( infos["line_start"] ); | |
31 | + new_width = Math.max(this.textarea.scrollWidth, this.container.clientWidth -50); | |
32 | + this.selection_field.style.top=this.selection_field_text.style.top=new_top+"px"; | |
33 | + if(!this.settings['word_wrap']){ | |
34 | + this.selection_field.style.width=this.selection_field_text.style.width=this.test_font_size.style.width=new_width+"px"; | |
35 | + } | |
36 | + | |
37 | + // usefull? => _$("cursor_pos").style.top=new_top+"px"; | |
38 | + | |
39 | + if(this.do_highlight==true) | |
40 | + { | |
41 | + // fill selection elements | |
42 | + var curr_text = infos["full_text"].split("\n"); | |
43 | + var content = ""; | |
44 | + //alert("length: "+curr_text.length+ " i: "+ Math.max(0,infos["line_start"]-1)+ " end: "+Math.min(curr_text.length, infos["line_start"]+infos["line_nb"]-1)+ " line: "+infos["line_start"]+" [0]: "+curr_text[0]+" [1]: "+curr_text[1]); | |
45 | + var start = Math.max(0,infos["line_start"]-1); | |
46 | + var end = Math.min(curr_text.length, infos["line_start"]+infos["line_nb"]-1); | |
47 | + | |
48 | + //curr_text[start]= curr_text[start].substr(0,infos["curr_pos"]-1) +"¤_overline_¤"+ curr_text[start].substr(infos["curr_pos"]-1); | |
49 | + for(i=start; i< end; i++){ | |
50 | + content+= curr_text[i]+"\n"; | |
51 | + } | |
52 | + | |
53 | + // add special chars arround selected characters | |
54 | + selLength = infos['selectionEnd'] - infos['selectionStart']; | |
55 | + content = content.substr( 0, infos["curr_pos"] - 1 ) + "\r\r" + content.substr( infos["curr_pos"] - 1, selLength ) + "\r\r" + content.substr( infos["curr_pos"] - 1 + selLength ); | |
56 | + content = '<span>'+ content.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace("\r\r", '</span><strong>').replace("\r\r", '</strong><span>') +'</span>'; | |
57 | + | |
58 | + if( this.isIE || ( this.isOpera && this.isOpera < 9.6 ) ) { | |
59 | + this.selection_field.innerHTML= "<pre>" + content.replace(/^\r?\n/, "<br>") + "</pre>"; | |
60 | + } else { | |
61 | + this.selection_field.innerHTML= content; | |
62 | + } | |
63 | + this.selection_field_text.innerHTML = this.selection_field.innerHTML; | |
64 | + t2_1 = new Date().getTime(); | |
65 | + // check if we need to update the highlighted background | |
66 | + if(this.reload_highlight || (infos["full_text"] != this.last_text_to_highlight && (this.last_selection["line_start"]!=infos["line_start"] || this.show_line_colors || this.settings['word_wrap'] || this.last_selection["line_nb"]!=infos["line_nb"] || this.last_selection["nb_line"]!=infos["nb_line"]) ) ) | |
67 | + { | |
68 | + this.maj_highlight(infos); | |
69 | + } | |
70 | + } | |
71 | + } | |
72 | + t3= new Date().getTime(); | |
73 | + | |
74 | + // manage line heights | |
75 | + if( this.settings['word_wrap'] && infos["full_text"] != this.last_selection["full_text"]) | |
76 | + { | |
77 | + // refresh only 1 line if text change concern only one line and that the total line number has not changed | |
78 | + if( changes.newText.split("\n").length == 1 && this.last_selection['nb_line'] && infos['nb_line'] == this.last_selection['nb_line'] ) | |
79 | + { | |
80 | + this.fixLinesHeight( infos['full_text'], changes.lineStart, changes.lineStart ); | |
81 | + } | |
82 | + else | |
83 | + { | |
84 | + this.fixLinesHeight( infos['full_text'], changes.lineStart, -1 ); | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + tLines= new Date().getTime(); | |
89 | + // manage bracket finding | |
90 | + if( infos["line_start"] != this.last_selection["line_start"] || infos["curr_pos"] != this.last_selection["curr_pos"] || infos["full_text"].length!=this.last_selection["full_text"].length || this.reload_highlight || !timer_checkup ) | |
91 | + { | |
92 | + // move _cursor_pos | |
93 | + var selec_char= infos["curr_line"].charAt(infos["curr_pos"]-1); | |
94 | + var no_real_move=true; | |
95 | + if(infos["line_nb"]==1 && (this.assocBracket[selec_char] || this.revertAssocBracket[selec_char]) ){ | |
96 | + | |
97 | + no_real_move=false; | |
98 | + //findEndBracket(infos["line_start"], infos["curr_pos"], selec_char); | |
99 | + if(this.findEndBracket(infos, selec_char) === true){ | |
100 | + _$("end_bracket").style.visibility ="visible"; | |
101 | + _$("cursor_pos").style.visibility ="visible"; | |
102 | + _$("cursor_pos").innerHTML = selec_char; | |
103 | + _$("end_bracket").innerHTML = (this.assocBracket[selec_char] || this.revertAssocBracket[selec_char]); | |
104 | + }else{ | |
105 | + _$("end_bracket").style.visibility ="hidden"; | |
106 | + _$("cursor_pos").style.visibility ="hidden"; | |
107 | + } | |
108 | + }else{ | |
109 | + _$("cursor_pos").style.visibility ="hidden"; | |
110 | + _$("end_bracket").style.visibility ="hidden"; | |
111 | + } | |
112 | + //alert("move cursor"); | |
113 | + this.displayToCursorPosition("cursor_pos", infos["line_start"], infos["curr_pos"]-1, infos["curr_line"], no_real_move); | |
114 | + if(infos["line_nb"]==1 && infos["line_start"]!=this.last_selection["line_start"]) | |
115 | + this.scroll_to_view(); | |
116 | + } | |
117 | + this.last_selection=infos; | |
118 | + } | |
119 | + | |
120 | + tend= new Date().getTime(); | |
121 | + //if( (tend-t1) > 7 ) | |
122 | + // console.log( "tps total: "+ (tend-t1) + " tps get_infos: "+ (t2-t1)+ " tps selec: "+ (t2_1-t2)+ " tps highlight: "+ (t3-t2_1) +" tps lines: "+ (tLines-t3) +" tps cursor+lines: "+ (tend-tLines)+" \n" ); | |
123 | + | |
124 | + | |
125 | + if(timer_checkup){ | |
126 | + setTimeout("editArea.check_line_selection(true)", this.check_line_selection_timer); | |
127 | + } | |
128 | + }; | |
129 | + | |
130 | + | |
131 | + EditArea.prototype.get_selection_infos= function(){ | |
132 | + var sel={}, start, end, len, str; | |
133 | + | |
134 | + this.getIESelection(); | |
135 | + start = this.textarea.selectionStart; | |
136 | + end = this.textarea.selectionEnd; | |
137 | + | |
138 | + if( this.last_selection["selectionStart"] == start && this.last_selection["selectionEnd"] == end && this.last_selection["full_text"] == this.textarea.value ) | |
139 | + { | |
140 | + return this.last_selection; | |
141 | + } | |
142 | + | |
143 | + if(this.tabulation!="\t" && this.textarea.value.indexOf("\t")!=-1) | |
144 | + { // can append only after copy/paste | |
145 | + len = this.textarea.value.length; | |
146 | + this.textarea.value = this.replace_tab(this.textarea.value); | |
147 | + start = end = start+(this.textarea.value.length-len); | |
148 | + this.area_select( start, 0 ); | |
149 | + } | |
150 | + | |
151 | + sel["selectionStart"] = start; | |
152 | + sel["selectionEnd"] = end; | |
153 | + sel["full_text"] = this.textarea.value; | |
154 | + sel["line_start"] = 1; | |
155 | + sel["line_nb"] = 1; | |
156 | + sel["curr_pos"] = 0; | |
157 | + sel["curr_line"] = ""; | |
158 | + sel["indexOfCursor"] = 0; | |
159 | + sel["selec_direction"] = this.last_selection["selec_direction"]; | |
160 | + | |
161 | + //return sel; | |
162 | + var splitTab= sel["full_text"].split("\n"); | |
163 | + var nbLine = Math.max(0, splitTab.length); | |
164 | + var nbChar = Math.max(0, sel["full_text"].length - (nbLine - 1)); // (remove \n caracters from the count) | |
165 | + if( sel["full_text"].indexOf("\r") != -1 ) | |
166 | + nbChar = nbChar - ( nbLine - 1 ); // (remove \r caracters from the count) | |
167 | + sel["nb_line"] = nbLine; | |
168 | + sel["nb_char"] = nbChar; | |
169 | + | |
170 | + if(start>0){ | |
171 | + str = sel["full_text"].substr(0,start); | |
172 | + sel["curr_pos"] = start - str.lastIndexOf("\n"); | |
173 | + sel["line_start"] = Math.max(1, str.split("\n").length); | |
174 | + }else{ | |
175 | + sel["curr_pos"]=1; | |
176 | + } | |
177 | + if(end>start){ | |
178 | + sel["line_nb"]=sel["full_text"].substring(start,end).split("\n").length; | |
179 | + } | |
180 | + sel["indexOfCursor"]=start; | |
181 | + sel["curr_line"]=splitTab[Math.max(0,sel["line_start"]-1)]; | |
182 | + | |
183 | + // determine in which direction the selection grow | |
184 | + if(sel["selectionStart"] == this.last_selection["selectionStart"]){ | |
185 | + if(sel["selectionEnd"]>this.last_selection["selectionEnd"]) | |
186 | + sel["selec_direction"]= "down"; | |
187 | + else if(sel["selectionEnd"] == this.last_selection["selectionStart"]) | |
188 | + sel["selec_direction"]= this.last_selection["selec_direction"]; | |
189 | + }else if(sel["selectionStart"] == this.last_selection["selectionEnd"] && sel["selectionEnd"]>this.last_selection["selectionEnd"]){ | |
190 | + sel["selec_direction"]= "down"; | |
191 | + }else{ | |
192 | + sel["selec_direction"]= "up"; | |
193 | + } | |
194 | + | |
195 | + _$("nbLine").innerHTML = nbLine; | |
196 | + _$("nbChar").innerHTML = nbChar; | |
197 | + _$("linePos").innerHTML = sel["line_start"]; | |
198 | + _$("currPos").innerHTML = sel["curr_pos"]; | |
199 | + | |
200 | + return sel; | |
201 | + }; | |
202 | + | |
203 | + // set IE position in Firefox mode (textarea.selectionStart and textarea.selectionEnd) | |
204 | + EditArea.prototype.getIESelection= function(){ | |
205 | + var selectionStart, selectionEnd, range, stored_range; | |
206 | + | |
207 | + if( !this.isIE ) | |
208 | + return false; | |
209 | + | |
210 | + // make it work as nowrap mode (easier for range manipulation with lineHeight) | |
211 | + if( this.settings['word_wrap'] ) | |
212 | + this.textarea.wrap='off'; | |
213 | + | |
214 | + try{ | |
215 | + range = document.selection.createRange(); | |
216 | + stored_range = range.duplicate(); | |
217 | + stored_range.moveToElementText( this.textarea ); | |
218 | + stored_range.setEndPoint( 'EndToEnd', range ); | |
219 | + if( stored_range.parentElement() != this.textarea ) | |
220 | + throw "invalid focus"; | |
221 | + | |
222 | + // the range don't take care of empty lines in the end of the selection | |
223 | + var scrollTop = this.result.scrollTop + document.body.scrollTop; | |
224 | + var relative_top= range.offsetTop - parent.calculeOffsetTop(this.textarea) + scrollTop; | |
225 | + var line_start = Math.round((relative_top / this.lineHeight) +1); | |
226 | + var line_nb = Math.round( range.boundingHeight / this.lineHeight ); | |
227 | + | |
228 | + selectionStart = stored_range.text.length - range.text.length; | |
229 | + selectionStart += ( line_start - this.textarea.value.substr(0, selectionStart).split("\n").length)*2; // count missing empty \r to the selection | |
230 | + selectionStart -= ( line_start - this.textarea.value.substr(0, selectionStart).split("\n").length ) * 2; | |
231 | + | |
232 | + selectionEnd = selectionStart + range.text.length; | |
233 | + selectionEnd += (line_start + line_nb - 1 - this.textarea.value.substr(0, selectionEnd ).split("\n").length)*2; | |
234 | + | |
235 | + this.textarea.selectionStart = selectionStart; | |
236 | + this.textarea.selectionEnd = selectionEnd; | |
237 | + } | |
238 | + catch(e){} | |
239 | + | |
240 | + // restore wrap mode | |
241 | + if( this.settings['word_wrap'] ) | |
242 | + this.textarea.wrap='soft'; | |
243 | + }; | |
244 | + | |
245 | + // select the text for IE (and take care of \r caracters) | |
246 | + EditArea.prototype.setIESelection= function(){ | |
247 | + var a = this.textarea, nbLineStart, nbLineEnd, range; | |
248 | + | |
249 | + if( !this.isIE ) | |
250 | + return false; | |
251 | + | |
252 | + nbLineStart = a.value.substr(0, a.selectionStart).split("\n").length - 1; | |
253 | + nbLineEnd = a.value.substr(0, a.selectionEnd).split("\n").length - 1; | |
254 | + range = document.selection.createRange(); | |
255 | + range.moveToElementText( a ); | |
256 | + range.setEndPoint( 'EndToStart', range ); | |
257 | + | |
258 | + range.moveStart('character', a.selectionStart - nbLineStart); | |
259 | + range.moveEnd('character', a.selectionEnd - nbLineEnd - (a.selectionStart - nbLineStart) ); | |
260 | + range.select(); | |
261 | + }; | |
262 | + | |
263 | + | |
264 | + | |
265 | + EditArea.prototype.checkTextEvolution=function(lastText,newText){ | |
266 | + // ch will contain changes datas | |
267 | + var ch={},baseStep=200, cpt=0, end, step,tStart=new Date().getTime(); | |
268 | + | |
269 | + end = Math.min(newText.length, lastText.length); | |
270 | + step = baseStep; | |
271 | + // find how many chars are similar at the begin of the text | |
272 | + while( cpt<end && step>=1 ){ | |
273 | + if(lastText.substr(cpt, step) == newText.substr(cpt, step)){ | |
274 | + cpt+= step; | |
275 | + }else{ | |
276 | + step= Math.floor(step/2); | |
277 | + } | |
278 | + } | |
279 | + | |
280 | + ch.posStart = cpt; | |
281 | + ch.lineStart= newText.substr(0, ch.posStart).split("\n").length -1; | |
282 | + | |
283 | + cpt_last = lastText.length; | |
284 | + cpt = newText.length; | |
285 | + step = baseStep; | |
286 | + // find how many chars are similar at the end of the text | |
287 | + while( cpt>=0 && cpt_last>=0 && step>=1 ){ | |
288 | + if(lastText.substr(cpt_last-step, step) == newText.substr(cpt-step, step)){ | |
289 | + cpt-= step; | |
290 | + cpt_last-= step; | |
291 | + }else{ | |
292 | + step= Math.floor(step/2); | |
293 | + } | |
294 | + } | |
295 | + | |
296 | + ch.posNewEnd = cpt; | |
297 | + ch.posLastEnd = cpt_last; | |
298 | + if(ch.posNewEnd<=ch.posStart){ | |
299 | + if(lastText.length < newText.length){ | |
300 | + ch.posNewEnd= ch.posStart + newText.length - lastText.length; | |
301 | + ch.posLastEnd= ch.posStart; | |
302 | + }else{ | |
303 | + ch.posLastEnd= ch.posStart + lastText.length - newText.length; | |
304 | + ch.posNewEnd= ch.posStart; | |
305 | + } | |
306 | + } | |
307 | + ch.newText = newText.substring(ch.posStart, ch.posNewEnd); | |
308 | + ch.lastText = lastText.substring(ch.posStart, ch.posLastEnd); | |
309 | + | |
310 | + ch.lineNewEnd = newText.substr(0, ch.posNewEnd).split("\n").length -1; | |
311 | + ch.lineLastEnd = lastText.substr(0, ch.posLastEnd).split("\n").length -1; | |
312 | + | |
313 | + ch.newTextLine = newText.split("\n").slice(ch.lineStart, ch.lineNewEnd+1).join("\n"); | |
314 | + ch.lastTextLine = lastText.split("\n").slice(ch.lineStart, ch.lineLastEnd+1).join("\n"); | |
315 | + //console.log( ch ); | |
316 | + return ch; | |
317 | + }; | |
318 | + | |
319 | + EditArea.prototype.tab_selection= function(){ | |
320 | + if(this.is_tabbing) | |
321 | + return; | |
322 | + this.is_tabbing=true; | |
323 | + //infos=getSelectionInfos(); | |
324 | + //if( document.selection ){ | |
325 | + this.getIESelection(); | |
326 | + /* Insertion du code de formatage */ | |
327 | + var start = this.textarea.selectionStart; | |
328 | + var end = this.textarea.selectionEnd; | |
329 | + var insText = this.textarea.value.substring(start, end); | |
330 | + | |
331 | + /* Insert tabulation and ajust cursor position */ | |
332 | + var pos_start=start; | |
333 | + var pos_end=end; | |
334 | + if (insText.length == 0) { | |
335 | + // if only one line selected | |
336 | + this.textarea.value = this.textarea.value.substr(0, start) + this.tabulation + this.textarea.value.substr(end); | |
337 | + pos_start = start + this.tabulation.length; | |
338 | + pos_end=pos_start; | |
339 | + } else { | |
340 | + start= Math.max(0, this.textarea.value.substr(0, start).lastIndexOf("\n")+1); | |
341 | + endText=this.textarea.value.substr(end); | |
342 | + startText=this.textarea.value.substr(0, start); | |
343 | + tmp= this.textarea.value.substring(start, end).split("\n"); | |
344 | + insText= this.tabulation+tmp.join("\n"+this.tabulation); | |
345 | + this.textarea.value = startText + insText + endText; | |
346 | + pos_start = start; | |
347 | + pos_end= this.textarea.value.indexOf("\n", startText.length + insText.length); | |
348 | + if(pos_end==-1) | |
349 | + pos_end=this.textarea.value.length; | |
350 | + //pos = start + repdeb.length + insText.length + ; | |
351 | + } | |
352 | + this.textarea.selectionStart = pos_start; | |
353 | + this.textarea.selectionEnd = pos_end; | |
354 | + | |
355 | + //if( document.selection ){ | |
356 | + if(this.isIE) | |
357 | + { | |
358 | + this.setIESelection(); | |
359 | + setTimeout("editArea.is_tabbing=false;", 100); // IE can't accept to make 2 tabulation without a little break between both | |
360 | + } | |
361 | + else | |
362 | + { | |
363 | + this.is_tabbing=false; | |
364 | + } | |
365 | + | |
366 | + }; | |
367 | + | |
368 | + EditArea.prototype.invert_tab_selection= function(){ | |
369 | + var t=this, a=this.textarea; | |
370 | + if(t.is_tabbing) | |
371 | + return; | |
372 | + t.is_tabbing=true; | |
373 | + //infos=getSelectionInfos(); | |
374 | + //if( document.selection ){ | |
375 | + t.getIESelection(); | |
376 | + | |
377 | + var start = a.selectionStart; | |
378 | + var end = a.selectionEnd; | |
379 | + var insText = a.value.substring(start, end); | |
380 | + | |
381 | + /* Tab remove and cursor seleciton adjust */ | |
382 | + var pos_start=start; | |
383 | + var pos_end=end; | |
384 | + if (insText.length == 0) { | |
385 | + if(a.value.substring(start-t.tabulation.length, start)==t.tabulation) | |
386 | + { | |
387 | + a.value = a.value.substr(0, start-t.tabulation.length) + a.value.substr(end); | |
388 | + pos_start = Math.max(0, start-t.tabulation.length); | |
389 | + pos_end = pos_start; | |
390 | + } | |
391 | + /* | |
392 | + a.value = a.value.substr(0, start) + t.tabulation + insText + a.value.substr(end); | |
393 | + pos_start = start + t.tabulation.length; | |
394 | + pos_end=pos_start;*/ | |
395 | + } else { | |
396 | + start = a.value.substr(0, start).lastIndexOf("\n")+1; | |
397 | + endText = a.value.substr(end); | |
398 | + startText = a.value.substr(0, start); | |
399 | + tmp = a.value.substring(start, end).split("\n"); | |
400 | + insText = ""; | |
401 | + for(i=0; i<tmp.length; i++){ | |
402 | + for(j=0; j<t.tab_nb_char; j++){ | |
403 | + if(tmp[i].charAt(0)=="\t"){ | |
404 | + tmp[i]=tmp[i].substr(1); | |
405 | + j=t.tab_nb_char; | |
406 | + }else if(tmp[i].charAt(0)==" ") | |
407 | + tmp[i]=tmp[i].substr(1); | |
408 | + } | |
409 | + insText+=tmp[i]; | |
410 | + if(i<tmp.length-1) | |
411 | + insText+="\n"; | |
412 | + } | |
413 | + //insText+="_"; | |
414 | + a.value = startText + insText + endText; | |
415 | + pos_start = start; | |
416 | + pos_end = a.value.indexOf("\n", startText.length + insText.length); | |
417 | + if(pos_end==-1) | |
418 | + pos_end=a.value.length; | |
419 | + //pos = start + repdeb.length + insText.length + ; | |
420 | + } | |
421 | + a.selectionStart = pos_start; | |
422 | + a.selectionEnd = pos_end; | |
423 | + | |
424 | + //if( document.selection ){ | |
425 | + if(t.isIE){ | |
426 | + // select the text for IE | |
427 | + t.setIESelection(); | |
428 | + setTimeout("editArea.is_tabbing=false;", 100); // IE can accept to make 2 tabulation without a little break between both | |
429 | + }else | |
430 | + t.is_tabbing=false; | |
431 | + }; | |
432 | + | |
433 | + EditArea.prototype.press_enter= function(){ | |
434 | + if(!this.smooth_selection) | |
435 | + return false; | |
436 | + this.getIESelection(); | |
437 | + var scrollTop= this.result.scrollTop; | |
438 | + var scrollLeft= this.result.scrollLeft; | |
439 | + var start=this.textarea.selectionStart; | |
440 | + var end= this.textarea.selectionEnd; | |
441 | + var start_last_line= Math.max(0 , this.textarea.value.substring(0, start).lastIndexOf("\n") + 1 ); | |
442 | + var begin_line= this.textarea.value.substring(start_last_line, start).replace(/^([ \t]*).*/gm, "$1"); | |
443 | + var lineStart = this.textarea.value.substring(0, start).split("\n").length; | |
444 | + if(begin_line=="\n" || begin_line=="\r" || begin_line.length==0) | |
445 | + { | |
446 | + return false; | |
447 | + } | |
448 | + | |
449 | + if(this.isIE || ( this.isOpera && this.isOpera < 9.6 ) ){ | |
450 | + begin_line="\r\n"+ begin_line; | |
451 | + }else{ | |
452 | + begin_line="\n"+ begin_line; | |
453 | + } | |
454 | + //alert(start_last_line+" strat: "+start +"\n"+this.textarea.value.substring(start_last_line, start)+"\n_"+begin_line+"_") | |
455 | + this.textarea.value= this.textarea.value.substring(0, start) + begin_line + this.textarea.value.substring(end); | |
456 | + | |
457 | + this.area_select(start+ begin_line.length ,0); | |
458 | + // during this process IE scroll back to the top of the textarea | |
459 | + if(this.isIE){ | |
460 | + this.result.scrollTop = scrollTop; | |
461 | + this.result.scrollLeft = scrollLeft; | |
462 | + } | |
463 | + return true; | |
464 | + | |
465 | + }; | |
466 | + | |
467 | + EditArea.prototype.findEndBracket= function(infos, bracket){ | |
468 | + | |
469 | + var start=infos["indexOfCursor"]; | |
470 | + var normal_order=true; | |
471 | + //curr_text=infos["full_text"].split("\n"); | |
472 | + if(this.assocBracket[bracket]) | |
473 | + endBracket=this.assocBracket[bracket]; | |
474 | + else if(this.revertAssocBracket[bracket]){ | |
475 | + endBracket=this.revertAssocBracket[bracket]; | |
476 | + normal_order=false; | |
477 | + } | |
478 | + var end=-1; | |
479 | + var nbBracketOpen=0; | |
480 | + | |
481 | + for(var i=start; i<infos["full_text"].length && i>=0; ){ | |
482 | + if(infos["full_text"].charAt(i)==endBracket){ | |
483 | + nbBracketOpen--; | |
484 | + if(nbBracketOpen<=0){ | |
485 | + //i=infos["full_text"].length; | |
486 | + end=i; | |
487 | + break; | |
488 | + } | |
489 | + }else if(infos["full_text"].charAt(i)==bracket) | |
490 | + nbBracketOpen++; | |
491 | + if(normal_order) | |
492 | + i++; | |
493 | + else | |
494 | + i--; | |
495 | + } | |
496 | + | |
497 | + //end=infos["full_text"].indexOf("}", start); | |
498 | + if(end==-1) | |
499 | + return false; | |
500 | + var endLastLine=infos["full_text"].substr(0, end).lastIndexOf("\n"); | |
501 | + if(endLastLine==-1) | |
502 | + line=1; | |
503 | + else | |
504 | + line= infos["full_text"].substr(0, endLastLine).split("\n").length + 1; | |
505 | + | |
506 | + var curPos= end - endLastLine - 1; | |
507 | + var endLineLength = infos["full_text"].substring(end).split("\n")[0].length; | |
508 | + this.displayToCursorPosition("end_bracket", line, curPos, infos["full_text"].substring(endLastLine +1, end + endLineLength)); | |
509 | + return true; | |
510 | + }; | |
511 | + | |
512 | + EditArea.prototype.displayToCursorPosition= function(id, start_line, cur_pos, lineContent, no_real_move){ | |
513 | + var elem,dest,content,posLeft=0,posTop,fixPadding,topOffset,endElem; | |
514 | + | |
515 | + elem = this.test_font_size; | |
516 | + dest = _$(id); | |
517 | + content = "<span id='test_font_size_inner'>"+lineContent.substr(0, cur_pos).replace(/&/g,"&").replace(/</g,"<")+"</span><span id='endTestFont'>"+lineContent.substr(cur_pos).replace(/&/g,"&").replace(/</g,"<")+"</span>"; | |
518 | + if( this.isIE || ( this.isOpera && this.isOpera < 9.6 ) ) { | |
519 | + elem.innerHTML= "<pre>" + content.replace(/^\r?\n/, "<br>") + "</pre>"; | |
520 | + } else { | |
521 | + elem.innerHTML= content; | |
522 | + } | |
523 | + | |
524 | + | |
525 | + endElem = _$('endTestFont'); | |
526 | + topOffset = endElem.offsetTop; | |
527 | + fixPadding = parseInt( this.content_highlight.style.paddingLeft.replace("px", "") ); | |
528 | + posLeft = 45 + endElem.offsetLeft + ( !isNaN( fixPadding ) && topOffset > 0 ? fixPadding : 0 ); | |
529 | + posTop = this.getLinePosTop( start_line ) + topOffset;// + Math.floor( ( endElem.offsetHeight - 1 ) / this.lineHeight ) * this.lineHeight; | |
530 | + | |
531 | + // detect the case where the span start on a line but has no display on it | |
532 | + if( this.isIE && cur_pos > 0 && endElem.offsetLeft == 0 ) | |
533 | + { | |
534 | + posTop += this.lineHeight; | |
535 | + } | |
536 | + if(no_real_move!=true){ // when the cursor is hidden no need to move him | |
537 | + dest.style.top=posTop+"px"; | |
538 | + dest.style.left=posLeft+"px"; | |
539 | + } | |
540 | + // usefull for smarter scroll | |
541 | + dest.cursor_top=posTop; | |
542 | + dest.cursor_left=posLeft; | |
543 | + // _$(id).style.marginLeft=posLeft+"px"; | |
544 | + }; | |
545 | + | |
546 | + EditArea.prototype.getLinePosTop= function(start_line){ | |
547 | + var elem= _$('line_'+ start_line), posTop=0; | |
548 | + if( elem ) | |
549 | + posTop = elem.offsetTop; | |
550 | + else | |
551 | + posTop = this.lineHeight * (start_line-1); | |
552 | + return posTop; | |
553 | + }; | |
554 | + | |
555 | + | |
556 | + // return the dislpayed height of a text (take word-wrap into account) | |
557 | + EditArea.prototype.getTextHeight= function(text){ | |
558 | + var t=this,elem,height; | |
559 | + elem = t.test_font_size; | |
560 | + content = text.replace(/&/g,"&").replace(/</g,"<"); | |
561 | + if( t.isIE || ( this.isOpera && this.isOpera < 9.6 ) ) { | |
562 | + elem.innerHTML= "<pre>" + content.replace(/^\r?\n/, "<br>") + "</pre>"; | |
563 | + } else { | |
564 | + elem.innerHTML= content; | |
565 | + } | |
566 | + height = elem.offsetHeight; | |
567 | + height = Math.max( 1, Math.floor( elem.offsetHeight / this.lineHeight ) ) * this.lineHeight; | |
568 | + return height; | |
569 | + }; | |
570 | + | |
571 | + /** | |
572 | + * Fix line height for the given lines | |
573 | + * @param Integer linestart | |
574 | + * @param Integer lineEnd End line or -1 to cover all lines | |
575 | + */ | |
576 | + EditArea.prototype.fixLinesHeight= function( textValue, lineStart,lineEnd ){ | |
577 | + var aText = textValue.split("\n"); | |
578 | + if( lineEnd == -1 ) | |
579 | + lineEnd = aText.length-1; | |
580 | + for( var i = Math.max(0, lineStart); i <= lineEnd; i++ ) | |
581 | + { | |
582 | + if( elem = _$('line_'+ ( i+1 ) ) ) | |
583 | + { | |
584 | + elem.style.height= typeof( aText[i] ) != "undefined" ? this.getTextHeight( aText[i] )+"px" : this.lineHeight; | |
585 | + } | |
586 | + } | |
587 | + }; | |
588 | + | |
589 | + EditArea.prototype.area_select= function(start, length){ | |
590 | + this.textarea.focus(); | |
591 | + | |
592 | + start = Math.max(0, Math.min(this.textarea.value.length, start)); | |
593 | + end = Math.max(start, Math.min(this.textarea.value.length, start+length)); | |
594 | + | |
595 | + if(this.isIE) | |
596 | + { | |
597 | + this.textarea.selectionStart = start; | |
598 | + this.textarea.selectionEnd = end; | |
599 | + this.setIESelection(); | |
600 | + } | |
601 | + else | |
602 | + { | |
603 | + // Opera bug when moving selection start and selection end | |
604 | + if(this.isOpera && this.isOpera < 9.6 ) | |
605 | + { | |
606 | + this.textarea.setSelectionRange(0, 0); | |
607 | + } | |
608 | + this.textarea.setSelectionRange(start, end); | |
609 | + } | |
610 | + this.check_line_selection(); | |
611 | + }; | |
612 | + | |
613 | + | |
614 | + EditArea.prototype.area_get_selection= function(){ | |
615 | + var text=""; | |
616 | + if( document.selection ){ | |
617 | + var range = document.selection.createRange(); | |
618 | + text=range.text; | |
619 | + }else{ | |
620 | + text= this.textarea.value.substring(this.textarea.selectionStart, this.textarea.selectionEnd); | |
621 | + } | |
622 | + return text; | |
623 | + }; | |
0 | 624 | \ No newline at end of file | ... | ... |
docs/js/editarea_0_8_2/edit_area/plugins/charmap/charmap.js
0 → 100644
1 | +/** | |
2 | + * Charmap plugin | |
3 | + * by Christophe Dolivet | |
4 | + * v0.1 (2006/09/22) | |
5 | + * | |
6 | + * | |
7 | + * This plugin allow to use a visual keyboard allowing to insert any UTF-8 characters in the text. | |
8 | + * | |
9 | + * - plugin name to add to the plugin list: "charmap" | |
10 | + * - plugin name to add to the toolbar list: "charmap" | |
11 | + * - possible parameters to add to EditAreaLoader.init(): | |
12 | + * "charmap_default": (String) define the name of the default character range displayed on popup display | |
13 | + * (default: "arrows") | |
14 | + * | |
15 | + * | |
16 | + */ | |
17 | + | |
18 | +var EditArea_charmap= { | |
19 | + /** | |
20 | + * Get called once this file is loaded (editArea still not initialized) | |
21 | + * | |
22 | + * @return nothing | |
23 | + */ | |
24 | + init: function(){ | |
25 | + this.default_language="Arrows"; | |
26 | + } | |
27 | + | |
28 | + /** | |
29 | + * Returns the HTML code for a specific control string or false if this plugin doesn't have that control. | |
30 | + * A control can be a button, select list or any other HTML item to present in the EditArea user interface. | |
31 | + * Language variables such as {$lang_somekey} will also be replaced with contents from | |
32 | + * the language packs. | |
33 | + * | |
34 | + * @param {string} ctrl_name: the name of the control to add | |
35 | + * @return HTML code for a specific control or false. | |
36 | + * @type string or boolean | |
37 | + */ | |
38 | + ,get_control_html: function(ctrl_name){ | |
39 | + switch(ctrl_name){ | |
40 | + case "charmap": | |
41 | + // Control id, button img, command | |
42 | + return parent.editAreaLoader.get_button_html('charmap_but', 'charmap.gif', 'charmap_press', false, this.baseURL); | |
43 | + } | |
44 | + return false; | |
45 | + } | |
46 | + /** | |
47 | + * Get called once EditArea is fully loaded and initialised | |
48 | + * | |
49 | + * @return nothing | |
50 | + */ | |
51 | + ,onload: function(){ | |
52 | + if(editArea.settings["charmap_default"] && editArea.settings["charmap_default"].length>0) | |
53 | + this.default_language= editArea.settings["charmap_default"]; | |
54 | + } | |
55 | + | |
56 | + /** | |
57 | + * Is called each time the user touch a keyboard key. | |
58 | + * | |
59 | + * @param (event) e: the keydown event | |
60 | + * @return true - pass to next handler in chain, false - stop chain execution | |
61 | + * @type boolean | |
62 | + */ | |
63 | + ,onkeydown: function(e){ | |
64 | + | |
65 | + } | |
66 | + | |
67 | + /** | |
68 | + * Executes a specific command, this function handles plugin commands. | |
69 | + * | |
70 | + * @param {string} cmd: the name of the command being executed | |
71 | + * @param {unknown} param: the parameter of the command | |
72 | + * @return true - pass to next handler in chain, false - stop chain execution | |
73 | + * @type boolean | |
74 | + */ | |
75 | + ,execCommand: function(cmd, param){ | |
76 | + // Handle commands | |
77 | + switch(cmd){ | |
78 | + case "charmap_press": | |
79 | + win= window.open(this.baseURL+"popup.html", "charmap", "width=500,height=270,scrollbars=yes,resizable=yes"); | |
80 | + win.focus(); | |
81 | + return false; | |
82 | + } | |
83 | + // Pass to next handler in chain | |
84 | + return true; | |
85 | + } | |
86 | + | |
87 | +}; | |
88 | + | |
89 | +// Adds the plugin class to the list of available EditArea plugins | |
90 | +editArea.add_plugin("charmap", EditArea_charmap); | ... | ... |
docs/js/editarea_0_8_2/edit_area/plugins/charmap/css/charmap.css
0 → 100644
1 | +body{ | |
2 | + background-color: #F0F0EE; | |
3 | + font: 12px monospace, sans-serif; | |
4 | +} | |
5 | + | |
6 | +select{ | |
7 | + background-color: #F9F9F9; | |
8 | + border: solid 1px #888888; | |
9 | +} | |
10 | + | |
11 | +h1, h2, h3, h4, h5, h6{ | |
12 | + margin: 0; | |
13 | + padding: 0; | |
14 | + color: #2B6FB6; | |
15 | +} | |
16 | + | |
17 | +h1{ | |
18 | + font-size: 1.5em; | |
19 | +} | |
20 | + | |
21 | +div#char_list{ | |
22 | + height: 200px; | |
23 | + overflow: auto; | |
24 | + padding: 1px; | |
25 | + border: 1px solid #0A246A; | |
26 | + background-color: #F9F9F9; | |
27 | + clear: both; | |
28 | + margin-top: 5px; | |
29 | +} | |
30 | + | |
31 | +a.char{ | |
32 | + display: block; | |
33 | + float: left; | |
34 | + width: 20px; | |
35 | + height: 20px; | |
36 | + line-height: 20px; | |
37 | + margin: 1px; | |
38 | + border: solid 1px #888888; | |
39 | + text-align: center; | |
40 | + cursor: pointer; | |
41 | +} | |
42 | + | |
43 | +a.char:hover{ | |
44 | + background-color: #CCCCCC; | |
45 | +} | |
46 | + | |
47 | +.preview{ | |
48 | + border: solid 1px #888888; | |
49 | + width: 50px; | |
50 | + padding: 2px 5px; | |
51 | + height: 35px; | |
52 | + line-height: 35px; | |
53 | + text-align:center; | |
54 | + background-color: #CCCCCC; | |
55 | + font-size: 2em; | |
56 | + float: right; | |
57 | + font-weight: bold; | |
58 | + margin: 0 0 5px 5px; | |
59 | +} | |
60 | + | |
61 | +#preview_code{ | |
62 | + font-size: 1.1em; | |
63 | + width: 70px; | |
64 | +} | ... | ... |
docs/js/editarea_0_8_2/edit_area/plugins/charmap/images/charmap.gif
0 → 100644
245 Bytes
docs/js/editarea_0_8_2/edit_area/plugins/charmap/jscripts/map.js
0 → 100644
1 | +var editArea; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * UTF-8 list taken from http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=dec | |
6 | + */ | |
7 | + | |
8 | + | |
9 | +/* | |
10 | +var char_range_list={ | |
11 | +"Basic Latin":"0021,007F", | |
12 | +"Latin-1 Supplement":"0080,00FF", | |
13 | +"Latin Extended-A":"0100,017F", | |
14 | +"Latin Extended-B":"0180,024F", | |
15 | +"IPA Extensions":"0250,02AF", | |
16 | +"Spacing Modifier Letters":"02B0,02FF", | |
17 | + | |
18 | +"Combining Diacritical Marks":"0300,036F", | |
19 | +"Greek and Coptic":"0370,03FF", | |
20 | +"Cyrillic":"0400,04FF", | |
21 | +"Cyrillic Supplement":"0500,052F", | |
22 | +"Armenian":"0530,058F", | |
23 | +"Hebrew":"0590,05FF", | |
24 | +"Arabic":"0600,06FF", | |
25 | +"Syriac":"0700,074F", | |
26 | +"Arabic Supplement":"0750,077F", | |
27 | + | |
28 | +"Thaana":"0780,07BF", | |
29 | +"Devanagari":"0900,097F", | |
30 | +"Bengali":"0980,09FF", | |
31 | +"Gurmukhi":"0A00,0A7F", | |
32 | +"Gujarati":"0A80,0AFF", | |
33 | +"Oriya":"0B00,0B7F", | |
34 | +"Tamil":"0B80,0BFF", | |
35 | +"Telugu":"0C00,0C7F", | |
36 | +"Kannada":"0C80,0CFF", | |
37 | + | |
38 | +"Malayalam":"0D00,0D7F", | |
39 | +"Sinhala":"0D80,0DFF", | |
40 | +"Thai":"0E00,0E7F", | |
41 | +"Lao":"0E80,0EFF", | |
42 | +"Tibetan":"0F00,0FFF", | |
43 | +"Myanmar":"1000,109F", | |
44 | +"Georgian":"10A0,10FF", | |
45 | +"Hangul Jamo":"1100,11FF", | |
46 | +"Ethiopic":"1200,137F", | |
47 | + | |
48 | +"Ethiopic Supplement":"1380,139F", | |
49 | +"Cherokee":"13A0,13FF", | |
50 | +"Unified Canadian Aboriginal Syllabics":"1400,167F", | |
51 | +"Ogham":"1680,169F", | |
52 | +"Runic":"16A0,16FF", | |
53 | +"Tagalog":"1700,171F", | |
54 | +"Hanunoo":"1720,173F", | |
55 | +"Buhid":"1740,175F", | |
56 | +"Tagbanwa":"1760,177F", | |
57 | + | |
58 | +"Khmer":"1780,17FF", | |
59 | +"Mongolian":"1800,18AF", | |
60 | +"Limbu":"1900,194F", | |
61 | +"Tai Le":"1950,197F", | |
62 | +"New Tai Lue":"1980,19DF", | |
63 | +"Khmer Symbols":"19E0,19FF", | |
64 | +"Buginese":"1A00,1A1F", | |
65 | +"Phonetic Extensions":"1D00,1D7F", | |
66 | +"Phonetic Extensions Supplement":"1D80,1DBF", | |
67 | + | |
68 | +"Combining Diacritical Marks Supplement":"1DC0,1DFF", | |
69 | +"Latin Extended Additional":"1E00,1EFF", | |
70 | +"Greek Extended":"1F00,1FFF", | |
71 | +"General Punctuation":"2000,206F", | |
72 | +"Superscripts and Subscripts":"2070,209F", | |
73 | +"Currency Symbols":"20A0,20CF", | |
74 | +"Combining Diacritical Marks for Symbols":"20D0,20FF", | |
75 | +"Letterlike Symbols":"2100,214F", | |
76 | +"Number Forms":"2150,218F", | |
77 | + | |
78 | +"Arrows":"2190,21FF", | |
79 | +"Mathematical Operators":"2200,22FF", | |
80 | +"Miscellaneous Technical":"2300,23FF", | |
81 | +"Control Pictures":"2400,243F", | |
82 | +"Optical Character Recognition":"2440,245F", | |
83 | +"Enclosed Alphanumerics":"2460,24FF", | |
84 | +"Box Drawing":"2500,257F", | |
85 | +"Block Elements":"2580,259F", | |
86 | +"Geometric Shapes":"25A0,25FF", | |
87 | + | |
88 | +"Miscellaneous Symbols":"2600,26FF", | |
89 | +"Dingbats":"2700,27BF", | |
90 | +"Miscellaneous Mathematical Symbols-A":"27C0,27EF", | |
91 | +"Supplemental Arrows-A":"27F0,27FF", | |
92 | +"Braille Patterns":"2800,28FF", | |
93 | +"Supplemental Arrows-B":"2900,297F", | |
94 | +"Miscellaneous Mathematical Symbols-B":"2980,29FF", | |
95 | +"Supplemental Mathematical Operators":"2A00,2AFF", | |
96 | +"Miscellaneous Symbols and Arrows":"2B00,2BFF", | |
97 | + | |
98 | +"Glagolitic":"2C00,2C5F", | |
99 | +"Coptic":"2C80,2CFF", | |
100 | +"Georgian Supplement":"2D00,2D2F", | |
101 | +"Tifinagh":"2D30,2D7F", | |
102 | +"Ethiopic Extended":"2D80,2DDF", | |
103 | +"Supplemental Punctuation":"2E00,2E7F", | |
104 | +"CJK Radicals Supplement":"2E80,2EFF", | |
105 | +"Kangxi Radicals":"2F00,2FDF", | |
106 | +"Ideographic Description Characters":"2FF0,2FFF", | |
107 | + | |
108 | +"CJK Symbols and Punctuation":"3000,303F", | |
109 | +"Hiragana":"3040,309F", | |
110 | +"Katakana":"30A0,30FF", | |
111 | +"Bopomofo":"3100,312F", | |
112 | +"Hangul Compatibility Jamo":"3130,318F", | |
113 | +"Kanbun":"3190,319F", | |
114 | +"Bopomofo Extended":"31A0,31BF", | |
115 | +"CJK Strokes":"31C0,31EF", | |
116 | +"Katakana Phonetic Extensions":"31F0,31FF", | |
117 | + | |
118 | +"Enclosed CJK Letters and Months":"3200,32FF", | |
119 | +"CJK Compatibility":"3300,33FF", | |
120 | +"CJK Unified Ideographs Extension A":"3400,4DBF", | |
121 | +"Yijing Hexagram Symbols":"4DC0,4DFF", | |
122 | +"CJK Unified Ideographs":"4E00,9FFF", | |
123 | +"Yi Syllables":"A000,A48F", | |
124 | +"Yi Radicals":"A490,A4CF", | |
125 | +"Modifier Tone Letters":"A700,A71F", | |
126 | +"Syloti Nagri":"A800,A82F", | |
127 | + | |
128 | +"Hangul Syllables":"AC00,D7AF", | |
129 | +"High Surrogates":"D800,DB7F", | |
130 | +"High Private Use Surrogates":"DB80,DBFF", | |
131 | +"Low Surrogates":"DC00,DFFF", | |
132 | +"Private Use Area":"E000,F8FF", | |
133 | +"CJK Compatibility Ideographs":"F900,FAFF", | |
134 | +"Alphabetic Presentation Forms":"FB00,FB4F", | |
135 | +"Arabic Presentation Forms-A":"FB50,FDFF", | |
136 | +"Variation Selectors":"FE00,FE0F", | |
137 | + | |
138 | +"Vertical Forms":"FE10,FE1F", | |
139 | +"Combining Half Marks":"FE20,FE2F", | |
140 | +"CJK Compatibility Forms":"FE30,FE4F", | |
141 | +"Small Form Variants":"FE50,FE6F", | |
142 | +"Arabic Presentation Forms-B":"FE70,FEFF", | |
143 | +"Halfwidth and Fullwidth Forms":"FF00,FFEF", | |
144 | +"Specials":"FFF0,FFFF", | |
145 | +"Linear B Syllabary":"10000,1007F", | |
146 | +"Linear B Ideograms":"10080,100FF", | |
147 | + | |
148 | +"Aegean Numbers":"10100,1013F", | |
149 | +"Ancient Greek Numbers":"10140,1018F", | |
150 | +"Old Italic":"10300,1032F", | |
151 | +"Gothic":"10330,1034F", | |
152 | +"Ugaritic":"10380,1039F", | |
153 | +"Old Persian":"103A0,103DF", | |
154 | +"Deseret":"10400,1044F", | |
155 | +"Shavian":"10450,1047F", | |
156 | +"Osmanya":"10480,104AF", | |
157 | + | |
158 | +"Cypriot Syllabary":"10800,1083F", | |
159 | +"Kharoshthi":"10A00,10A5F", | |
160 | +"Byzantine Musical Symbols":"1D000,1D0FF", | |
161 | +"Musical Symbols":"1D100,1D1FF", | |
162 | +"Ancient Greek Musical Notation":"1D200,1D24F", | |
163 | +"Tai Xuan Jing Symbols":"1D300,1D35F", | |
164 | +"Mathematical Alphanumeric Symbols":"1D400,1D7FF", | |
165 | +"CJK Unified Ideographs Extension B":"20000,2A6DF", | |
166 | +"CJK Compatibility Ideographs Supplement":"2F800,2FA1F", | |
167 | +"Tags":"E0000,E007F", | |
168 | +"Variation Selectors Supplement":"E0100,E01EF" | |
169 | +}; | |
170 | +*/ | |
171 | +var char_range_list={ | |
172 | +"Aegean Numbers":"10100,1013F", | |
173 | +"Alphabetic Presentation Forms":"FB00,FB4F", | |
174 | +"Ancient Greek Musical Notation":"1D200,1D24F", | |
175 | +"Ancient Greek Numbers":"10140,1018F", | |
176 | +"Arabic":"0600,06FF", | |
177 | +"Arabic Presentation Forms-A":"FB50,FDFF", | |
178 | +"Arabic Presentation Forms-B":"FE70,FEFF", | |
179 | +"Arabic Supplement":"0750,077F", | |
180 | +"Armenian":"0530,058F", | |
181 | +"Arrows":"2190,21FF", | |
182 | +"Basic Latin":"0020,007F", | |
183 | +"Bengali":"0980,09FF", | |
184 | +"Block Elements":"2580,259F", | |
185 | +"Bopomofo Extended":"31A0,31BF", | |
186 | +"Bopomofo":"3100,312F", | |
187 | +"Box Drawing":"2500,257F", | |
188 | +"Braille Patterns":"2800,28FF", | |
189 | +"Buginese":"1A00,1A1F", | |
190 | +"Buhid":"1740,175F", | |
191 | +"Byzantine Musical Symbols":"1D000,1D0FF", | |
192 | +"CJK Compatibility Forms":"FE30,FE4F", | |
193 | +"CJK Compatibility Ideographs Supplement":"2F800,2FA1F", | |
194 | +"CJK Compatibility Ideographs":"F900,FAFF", | |
195 | +"CJK Compatibility":"3300,33FF", | |
196 | +"CJK Radicals Supplement":"2E80,2EFF", | |
197 | +"CJK Strokes":"31C0,31EF", | |
198 | +"CJK Symbols and Punctuation":"3000,303F", | |
199 | +"CJK Unified Ideographs Extension A":"3400,4DBF", | |
200 | +"CJK Unified Ideographs Extension B":"20000,2A6DF", | |
201 | +"CJK Unified Ideographs":"4E00,9FFF", | |
202 | +"Cherokee":"13A0,13FF", | |
203 | +"Combining Diacritical Marks Supplement":"1DC0,1DFF", | |
204 | +"Combining Diacritical Marks for Symbols":"20D0,20FF", | |
205 | +"Combining Diacritical Marks":"0300,036F", | |
206 | +"Combining Half Marks":"FE20,FE2F", | |
207 | +"Control Pictures":"2400,243F", | |
208 | +"Coptic":"2C80,2CFF", | |
209 | +"Currency Symbols":"20A0,20CF", | |
210 | +"Cypriot Syllabary":"10800,1083F", | |
211 | +"Cyrillic Supplement":"0500,052F", | |
212 | +"Cyrillic":"0400,04FF", | |
213 | +"Deseret":"10400,1044F", | |
214 | +"Devanagari":"0900,097F", | |
215 | +"Dingbats":"2700,27BF", | |
216 | +"Enclosed Alphanumerics":"2460,24FF", | |
217 | +"Enclosed CJK Letters and Months":"3200,32FF", | |
218 | +"Ethiopic Extended":"2D80,2DDF", | |
219 | +"Ethiopic Supplement":"1380,139F", | |
220 | +"Ethiopic":"1200,137F", | |
221 | +"General Punctuation":"2000,206F", | |
222 | +"Geometric Shapes":"25A0,25FF", | |
223 | +"Georgian Supplement":"2D00,2D2F", | |
224 | +"Georgian":"10A0,10FF", | |
225 | +"Glagolitic":"2C00,2C5F", | |
226 | +"Gothic":"10330,1034F", | |
227 | +"Greek Extended":"1F00,1FFF", | |
228 | +"Greek and Coptic":"0370,03FF", | |
229 | +"Gujarati":"0A80,0AFF", | |
230 | +"Gurmukhi":"0A00,0A7F", | |
231 | +"Halfwidth and Fullwidth Forms":"FF00,FFEF", | |
232 | +"Hangul Compatibility Jamo":"3130,318F", | |
233 | +"Hangul Jamo":"1100,11FF", | |
234 | +"Hangul Syllables":"AC00,D7AF", | |
235 | +"Hanunoo":"1720,173F", | |
236 | +"Hebrew":"0590,05FF", | |
237 | +"High Private Use Surrogates":"DB80,DBFF", | |
238 | +"High Surrogates":"D800,DB7F", | |
239 | +"Hiragana":"3040,309F", | |
240 | +"IPA Extensions":"0250,02AF", | |
241 | +"Ideographic Description Characters":"2FF0,2FFF", | |
242 | +"Kanbun":"3190,319F", | |
243 | +"Kangxi Radicals":"2F00,2FDF", | |
244 | +"Kannada":"0C80,0CFF", | |
245 | +"Katakana Phonetic Extensions":"31F0,31FF", | |
246 | +"Katakana":"30A0,30FF", | |
247 | +"Kharoshthi":"10A00,10A5F", | |
248 | +"Khmer Symbols":"19E0,19FF", | |
249 | +"Khmer":"1780,17FF", | |
250 | +"Lao":"0E80,0EFF", | |
251 | +"Latin Extended Additional":"1E00,1EFF", | |
252 | +"Latin Extended-A":"0100,017F", | |
253 | +"Latin Extended-B":"0180,024F", | |
254 | +"Latin-1 Supplement":"0080,00FF", | |
255 | +"Letterlike Symbols":"2100,214F", | |
256 | +"Limbu":"1900,194F", | |
257 | +"Linear B Ideograms":"10080,100FF", | |
258 | +"Linear B Syllabary":"10000,1007F", | |
259 | +"Low Surrogates":"DC00,DFFF", | |
260 | +"Malayalam":"0D00,0D7F", | |
261 | +"Mathematical Alphanumeric Symbols":"1D400,1D7FF", | |
262 | +"Mathematical Operators":"2200,22FF", | |
263 | +"Miscellaneous Mathematical Symbols-A":"27C0,27EF", | |
264 | +"Miscellaneous Mathematical Symbols-B":"2980,29FF", | |
265 | +"Miscellaneous Symbols and Arrows":"2B00,2BFF", | |
266 | +"Miscellaneous Symbols":"2600,26FF", | |
267 | +"Miscellaneous Technical":"2300,23FF", | |
268 | +"Modifier Tone Letters":"A700,A71F", | |
269 | +"Mongolian":"1800,18AF", | |
270 | +"Musical Symbols":"1D100,1D1FF", | |
271 | +"Myanmar":"1000,109F", | |
272 | +"New Tai Lue":"1980,19DF", | |
273 | +"Number Forms":"2150,218F", | |
274 | +"Ogham":"1680,169F", | |
275 | +"Old Italic":"10300,1032F", | |
276 | +"Old Persian":"103A0,103DF", | |
277 | +"Optical Character Recognition":"2440,245F", | |
278 | +"Oriya":"0B00,0B7F", | |
279 | +"Osmanya":"10480,104AF", | |
280 | +"Phonetic Extensions Supplement":"1D80,1DBF", | |
281 | +"Phonetic Extensions":"1D00,1D7F", | |
282 | +"Private Use Area":"E000,F8FF", | |
283 | +"Runic":"16A0,16FF", | |
284 | +"Shavian":"10450,1047F", | |
285 | +"Sinhala":"0D80,0DFF", | |
286 | +"Small Form Variants":"FE50,FE6F", | |
287 | +"Spacing Modifier Letters":"02B0,02FF", | |
288 | +"Specials":"FFF0,FFFF", | |
289 | +"Superscripts and Subscripts":"2070,209F", | |
290 | +"Supplemental Arrows-A":"27F0,27FF", | |
291 | +"Supplemental Arrows-B":"2900,297F", | |
292 | +"Supplemental Mathematical Operators":"2A00,2AFF", | |
293 | +"Supplemental Punctuation":"2E00,2E7F", | |
294 | +"Syloti Nagri":"A800,A82F", | |
295 | +"Syriac":"0700,074F", | |
296 | +"Tagalog":"1700,171F", | |
297 | +"Tagbanwa":"1760,177F", | |
298 | +"Tags":"E0000,E007F", | |
299 | +"Tai Le":"1950,197F", | |
300 | +"Tai Xuan Jing Symbols":"1D300,1D35F", | |
301 | +"Tamil":"0B80,0BFF", | |
302 | +"Telugu":"0C00,0C7F", | |
303 | +"Thaana":"0780,07BF", | |
304 | +"Thai":"0E00,0E7F", | |
305 | +"Tibetan":"0F00,0FFF", | |
306 | +"Tifinagh":"2D30,2D7F", | |
307 | +"Ugaritic":"10380,1039F", | |
308 | +"Unified Canadian Aboriginal Syllabics":"1400,167F", | |
309 | +"Variation Selectors Supplement":"E0100,E01EF", | |
310 | +"Variation Selectors":"FE00,FE0F", | |
311 | +"Vertical Forms":"FE10,FE1F", | |
312 | +"Yi Radicals":"A490,A4CF", | |
313 | +"Yi Syllables":"A000,A48F", | |
314 | +"Yijing Hexagram Symbols":"4DC0,4DFF" | |
315 | +}; | |
316 | + | |
317 | +var insert="charmap_insert"; | |
318 | + | |
319 | +function map_load(){ | |
320 | + editArea=opener.editArea; | |
321 | + // translate the document | |
322 | + insert= editArea.get_translation(insert, "word"); | |
323 | + //alert(document.title); | |
324 | + document.title= editArea.get_translation(document.title, "template"); | |
325 | + document.body.innerHTML= editArea.get_translation(document.body.innerHTML, "template"); | |
326 | + //document.title= editArea.get_translation(document.getElementBytitle, "template"); | |
327 | + | |
328 | + var selected_lang=opener.EditArea_charmap.default_language.toLowerCase(); | |
329 | + var selected=0; | |
330 | + | |
331 | + var select= document.getElementById("select_range") | |
332 | + for(var i in char_range_list){ | |
333 | + if(i.toLowerCase()==selected_lang) | |
334 | + selected=select.options.length; | |
335 | + select.options[select.options.length]=new Option(i, char_range_list[i]); | |
336 | + } | |
337 | + select.options[selected].selected=true; | |
338 | +/* start=0; | |
339 | + end=127; | |
340 | + content=""; | |
341 | + for(var i=start; i<end; i++){ | |
342 | + content+="&#"+i+"; "; | |
343 | + } | |
344 | + document.getElementById("char_list").innerHTML=content;*/ | |
345 | + renderCharMapHTML(); | |
346 | +} | |
347 | + | |
348 | + | |
349 | +function renderCharMapHTML() { | |
350 | + range= document.getElementById("select_range").value.split(","); | |
351 | + | |
352 | + start= parseInt(range[0],16); | |
353 | + end= parseInt(range[1],16); | |
354 | + var charsPerRow = 20, tdWidth=20, tdHeight=20; | |
355 | + html=""; | |
356 | + for (var i=start; i<end; i++) { | |
357 | + html+="<a class='char' onmouseover='previewChar(\""+ i + "\");' onclick='insertChar(\""+ i + "\");' title='"+ insert +"'>"+ String.fromCharCode(i) +"</a>"; | |
358 | + } | |
359 | + document.getElementById("char_list").innerHTML= html; | |
360 | + document.getElementById("preview_char").innerHTML=""; | |
361 | +} | |
362 | + | |
363 | +function previewChar(i){ | |
364 | + document.getElementById("preview_char").innerHTML= String.fromCharCode(i); | |
365 | + document.getElementById("preview_code").innerHTML= "&#"+ i +";"; | |
366 | +} | |
367 | + | |
368 | +function insertChar(i){ | |
369 | + opener.parent.editAreaLoader.setSelectedText(editArea.id, String.fromCharCode( i)); | |
370 | + range= opener.parent.editAreaLoader.getSelectionRange(editArea.id); | |
371 | + opener.parent.editAreaLoader.setSelectionRange(editArea.id, range["end"], range["end"]); | |
372 | + window.focus(); | |
373 | +} | ... | ... |
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/bg.js
0 → 100644
1 | +/* | |
2 | + * Bulgarian translation | |
3 | + * Author: Valentin Hristov | |
4 | + * Company: SOFTKIT Bulgarian | |
5 | + * Site: http://www.softkit-bg.com | |
6 | + */ | |
7 | +editArea.add_lang("bg",{ | |
8 | +charmap_but: "Виртуална клавиатура", | |
9 | +charmap_title: "Виртуална клавиатура", | |
10 | +charmap_choose_block: "избери езиков блок", | |
11 | +charmap_insert:"постави този символ" | |
12 | +}); | ... | ... |
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/cs.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/de.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/dk.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/en.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/eo.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/es.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/fr.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/hr.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/it.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/ja.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/mk.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/nl.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/pl.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/pt.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/ru.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/sk.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/langs/zh.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/charmap/popup.html
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > | |
4 | +<head> | |
5 | +<title>{$charmap_title}</title> | |
6 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
7 | +<link rel="stylesheet" type="text/css" href="css/charmap.css" /> | |
8 | +<script language="Javascript" type="text/javascript" src="jscripts/map.js"> | |
9 | +</script> | |
10 | +</head> | |
11 | +<body onload='map_load()'> | |
12 | +<div id='preview_code' class='preview'></div> | |
13 | +<div id='preview_char' class='preview'></div> | |
14 | +<h1>{$charmap_title}:</h1> | |
15 | +<select id='select_range' onchange='renderCharMapHTML()' title='{$charmap_choose_block}'> | |
16 | +</select> | |
17 | +<div id='char_list'> | |
18 | + | |
19 | +</div> | |
20 | + | |
21 | + | |
22 | + | |
23 | +</body> | |
24 | +</html> | ... | ... |
docs/js/editarea_0_8_2/edit_area/plugins/test/css/test.css
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/test/images/Thumbs.db
0 → 100644
No preview for this file type
docs/js/editarea_0_8_2/edit_area/plugins/test/images/test.gif
0 → 100644
87 Bytes
docs/js/editarea_0_8_2/edit_area/plugins/test/langs/bg.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/test/langs/cs.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/test/langs/de.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/test/langs/dk.js
0 → 100644
docs/js/editarea_0_8_2/edit_area/plugins/test/langs/en.js
0 → 100644