1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
|
---|
2 | <!--
|
---|
3 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
---|
4 | * Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
---|
5 | *
|
---|
6 | * == BEGIN LICENSE ==
|
---|
7 | *
|
---|
8 | * Licensed under the terms of any of the following licenses at your
|
---|
9 | * choice:
|
---|
10 | *
|
---|
11 | * - GNU General Public License Version 2 or later (the "GPL")
|
---|
12 | * http://www.gnu.org/licenses/gpl.html
|
---|
13 | *
|
---|
14 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
---|
15 | * http://www.gnu.org/licenses/lgpl.html
|
---|
16 | *
|
---|
17 | * - Mozilla Public License Version 1.1 or later (the "MPL")
|
---|
18 | * http://www.mozilla.org/MPL/MPL-1.1.html
|
---|
19 | *
|
---|
20 | * == END LICENSE ==
|
---|
21 | -->
|
---|
22 | <html>
|
---|
23 | <head>
|
---|
24 | <title>SCAYT Properties</title>
|
---|
25 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
---|
26 | <meta content="noindex, nofollow" name="robots">
|
---|
27 | <script src="common/fck_dialog_common.js" type="text/javascript"></script>
|
---|
28 | <link type="text/css" href="fck_scayt/scayt_dialog.css" rel="stylesheet" />
|
---|
29 | <script type="text/javascript">
|
---|
30 |
|
---|
31 | var dialog = window.parent ;
|
---|
32 | var oEditor = dialog.InnerDialogLoaded() ;
|
---|
33 | var FCKLang = oEditor.FCKLang;
|
---|
34 | var scayt = oEditor.scayt;
|
---|
35 | var scayt_control = oEditor.scayt_control;
|
---|
36 | var lang_list = {};
|
---|
37 | var sLang;
|
---|
38 | var fckLang;
|
---|
39 | var chosed_lang;
|
---|
40 | var options;
|
---|
41 | var tabs = scayt_control.uiTags || [1,1,0,1];
|
---|
42 | var userDicActive = tabs[2] == 1;
|
---|
43 | var captions;
|
---|
44 | var dic_buttons = [
|
---|
45 | // [0] contains buttons for creating
|
---|
46 | "dic_create,dic_restore",
|
---|
47 | // [1] contains buton for manipulation
|
---|
48 | "dic_rename,dic_delete"
|
---|
49 | ];
|
---|
50 |
|
---|
51 | var get =
|
---|
52 | new function(){
|
---|
53 |
|
---|
54 | var mergeObjs = function(obj1, obj2)
|
---|
55 | {
|
---|
56 | for (var k in obj1)
|
---|
57 | obj2[k] = obj1[k];
|
---|
58 |
|
---|
59 | return obj2;
|
---|
60 | };
|
---|
61 |
|
---|
62 | var removeWhitespaces = function( s )
|
---|
63 | {
|
---|
64 | s = s.replace( new RegExp("^ +| +$"), '' ) ;
|
---|
65 | return s ;
|
---|
66 | };
|
---|
67 |
|
---|
68 | var addEvent = function( el ,sEventName, fTodo )
|
---|
69 | {
|
---|
70 | if (el.addEventListener) {
|
---|
71 | el.addEventListener (sEventName,fTodo,false);
|
---|
72 |
|
---|
73 | } else if (el.attachEvent) {
|
---|
74 | el.attachEvent ("on"+sEventName,fTodo);
|
---|
75 |
|
---|
76 | } else {
|
---|
77 | el["on"+sEventName] = fTodo;
|
---|
78 | }
|
---|
79 | };
|
---|
80 |
|
---|
81 | var getElementsByClassName = function (node,classname ,strTag) {
|
---|
82 | strTag = strTag || "*";
|
---|
83 | node = node || document;
|
---|
84 | if (node.getElementsByClassName)
|
---|
85 | return node.getElementsByClassName(classname);
|
---|
86 | else {
|
---|
87 | var objColl = node.getElementsByTagName(strTag);
|
---|
88 | if (!objColl.length && strTag == "*" && node.all) objColl = node.all;
|
---|
89 | var arr = new Array();
|
---|
90 | var delim = classname.indexOf('|') != -1 ? '|' : ' ';
|
---|
91 | var arrClass = classname.split(delim);
|
---|
92 | for (var i = 0, j = objColl.length; i < j; i++) {
|
---|
93 | var arrObjClass = objColl[i].className.split(' ');
|
---|
94 | if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
|
---|
95 | var c = 0;
|
---|
96 | comparisonLoop:
|
---|
97 | for ( var k = 0, l = arrObjClass.length ; k < l ; k++ )
|
---|
98 | {
|
---|
99 | for ( var m = 0, n = arrClass.length ; m < n ; m++ )
|
---|
100 | {
|
---|
101 | if ( arrClass[m] == arrObjClass[k] )
|
---|
102 | c++ ;
|
---|
103 |
|
---|
104 | if ( ( delim == '|' && c == 1 ) || ( delim == ' ' && c == arrClass.length ) )
|
---|
105 | {
|
---|
106 | arr.push( objColl[i] ) ;
|
---|
107 | break comparisonLoop ;
|
---|
108 | }
|
---|
109 | }
|
---|
110 | }
|
---|
111 | }
|
---|
112 | return arr;
|
---|
113 | }
|
---|
114 | };
|
---|
115 |
|
---|
116 | var hasClassName = function ( sClassName, elem ) {
|
---|
117 | //.split(/\s+/);
|
---|
118 | var aCnames = elem.className.split(/\s+/) || [];
|
---|
119 | for (var i=0, l=aCnames.length; i<l ; i++){
|
---|
120 | if (sClassName == aCnames[i])
|
---|
121 | return true;
|
---|
122 | }
|
---|
123 | return false;
|
---|
124 | }
|
---|
125 |
|
---|
126 | var single = {
|
---|
127 | addClass : function ( sClassName ) {
|
---|
128 | //console.info( sClassName, this.className, );
|
---|
129 | if ( hasClassName(sClassName , this) )
|
---|
130 | return this;
|
---|
131 | var s = removeWhitespaces(this.className + " " +sClassName);
|
---|
132 | this.className = s;
|
---|
133 | return this;
|
---|
134 |
|
---|
135 | },
|
---|
136 | removeClass : function ( sClassName ) {
|
---|
137 | var s = removeWhitespaces(this.className.replace(sClassName,""));
|
---|
138 | this.className = s;
|
---|
139 | return this;
|
---|
140 | },
|
---|
141 | setStyle : function( oStyles )
|
---|
142 | {
|
---|
143 | for ( var style in oStyles )
|
---|
144 | {
|
---|
145 | this.style[style] = oStyles[style] ;
|
---|
146 | }
|
---|
147 | return this ;
|
---|
148 | },
|
---|
149 | bindOnclick : function ( handler ) {
|
---|
150 | //addEvent( this, "click" , handler);
|
---|
151 | this.onclick = handler;
|
---|
152 | return this;
|
---|
153 | },
|
---|
154 | bindOnchange : function ( handler ) {
|
---|
155 | //addEvent( this, "change" , handler);
|
---|
156 | this.onchange = handler;
|
---|
157 | return this;
|
---|
158 | },
|
---|
159 | getAttr : function ( sAttrName )
|
---|
160 | {
|
---|
161 | if ( !sAttrName )
|
---|
162 | return null;
|
---|
163 |
|
---|
164 | return this[sAttrName];
|
---|
165 | },
|
---|
166 | setAttr : function ( sAttrName , attrVal )
|
---|
167 | {
|
---|
168 | if ( !sAttrName || !attrVal )
|
---|
169 | return null;
|
---|
170 |
|
---|
171 | this[sAttrName] = attrVal;
|
---|
172 |
|
---|
173 | return this;
|
---|
174 | },
|
---|
175 | remAttr : function ( sAttrName )
|
---|
176 | {
|
---|
177 | if ( !sAttrName )
|
---|
178 | return null;
|
---|
179 | }
|
---|
180 | };
|
---|
181 |
|
---|
182 | var singleCaller = function ( sMethod,args ) {
|
---|
183 | for ( var i=0, l=this.length; i<l ; i++ ){
|
---|
184 | var oItem = mergeObjs( single, this[i] );
|
---|
185 | oItem[sMethod].apply(this[i],args);
|
---|
186 | }
|
---|
187 | };
|
---|
188 |
|
---|
189 |
|
---|
190 | var collection = {
|
---|
191 |
|
---|
192 | addClass : function ( sClassName ){
|
---|
193 | singleCaller.call(this, "addClass", [sClassName])
|
---|
194 | return this;
|
---|
195 | },
|
---|
196 | removeClass : function ( sClassName ) {
|
---|
197 | singleCaller.call(this, "removeClass", [sClassName])
|
---|
198 | return this;
|
---|
199 | },
|
---|
200 | setStyle : function ( oStyles ) {
|
---|
201 | singleCaller.call(this, "setStyle", [oStyles])
|
---|
202 | return this;
|
---|
203 | },
|
---|
204 | bindOnclick : function ( f ) {
|
---|
205 | singleCaller.call(this, "bindOnclick", [f])
|
---|
206 | return this;
|
---|
207 | },
|
---|
208 | bindOnchange : function ( f ) {
|
---|
209 | singleCaller.call(this, "bindOnchange", [f])
|
---|
210 | return this;
|
---|
211 | },
|
---|
212 |
|
---|
213 | forEach : function ( fTodo ) {
|
---|
214 | //el,i
|
---|
215 | for (var i=0, l=this.length; i<l ; i++){
|
---|
216 | fTodo.apply(this[i], [this[i],i ]);
|
---|
217 | }
|
---|
218 | return this;
|
---|
219 | }
|
---|
220 |
|
---|
221 | };
|
---|
222 |
|
---|
223 |
|
---|
224 |
|
---|
225 | this.byClass = function( sClassName ){
|
---|
226 | var o = getElementsByClassName(document, sClassName );
|
---|
227 | return o ? mergeObjs( collection, o ) : o;
|
---|
228 | };
|
---|
229 |
|
---|
230 | this.byId = function( sId ){
|
---|
231 | var o = document.getElementById( sId );
|
---|
232 | return o ? mergeObjs( single, o ) : o;
|
---|
233 | };
|
---|
234 |
|
---|
235 | this.gup = function ( name ){
|
---|
236 | name = name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) ;
|
---|
237 | var regexS = '[\\?&]' + name + '=([^&#]*)' ;
|
---|
238 | var regex = new RegExp( regexS ) ;
|
---|
239 | var results = regex.exec( window.location.href ) ;
|
---|
240 |
|
---|
241 | if( results == null )
|
---|
242 | return '' ;
|
---|
243 | else
|
---|
244 | return results[ 1 ] ;
|
---|
245 | };
|
---|
246 | this.wrap = function ( o ) {
|
---|
247 | return o ? mergeObjs( single, o ) : o;
|
---|
248 | };
|
---|
249 | this.forEach = function ( oScope, fTodo ){
|
---|
250 | collection.forEach.apply( oScope,[fTodo] );
|
---|
251 | };
|
---|
252 |
|
---|
253 | };
|
---|
254 |
|
---|
255 |
|
---|
256 |
|
---|
257 | // Add the dialog tabs.
|
---|
258 | tabs[0] == 1 && dialog.AddTab( 'options', 'Options' ) ;
|
---|
259 | tabs[1] == 1 && dialog.AddTab( 'langs', 'Languages' ) ;
|
---|
260 | tabs[2] == 1 && dialog.AddTab( 'dictionary', 'Dictionary' ) ;
|
---|
261 | tabs[3] == 1 && dialog.AddTab( 'about', 'About' ) ;
|
---|
262 |
|
---|
263 | // Function called when a dialog tab is selected.
|
---|
264 | function OnDialogTabChange( tabCode )
|
---|
265 | {
|
---|
266 | ShowE('inner_options' , ( tabCode == 'options' ) ) ;
|
---|
267 | ShowE('inner_langs' , ( tabCode == 'langs' ) ) ;
|
---|
268 | ShowE('inner_dictionary' , ( tabCode == 'dictionary' ) ) ;
|
---|
269 | ShowE('inner_about' , ( tabCode == 'about' ) ) ;
|
---|
270 | }
|
---|
271 |
|
---|
272 |
|
---|
273 |
|
---|
274 |
|
---|
275 |
|
---|
276 | window.onload = function()
|
---|
277 | {
|
---|
278 | // Things to do when the page is loaded.
|
---|
279 |
|
---|
280 | if ( document.location.search.length )
|
---|
281 | dialog.SetSelectedTab( document.location.search.substr(1) ) ;
|
---|
282 |
|
---|
283 | dialog.SetOkButton( true ) ;
|
---|
284 |
|
---|
285 |
|
---|
286 | if (!scayt) throw "SCAYT is undefined";
|
---|
287 | if (!scayt_control) throw "SCAYT_CONTROL is undefined";
|
---|
288 |
|
---|
289 | // show alowed tabs
|
---|
290 | tabs = scayt_control.uiTags || [1,1,1,0];
|
---|
291 |
|
---|
292 |
|
---|
293 | sLang = scayt_control.getLang();
|
---|
294 | fckLang = "en";
|
---|
295 | options = scayt_control.option();
|
---|
296 | // apply captions
|
---|
297 | scayt.getCaption( fckLang, function( caps )
|
---|
298 | {
|
---|
299 | //console.info( "scayt.getCaption runned" )
|
---|
300 | captions = caps;
|
---|
301 | apllyCaptions();
|
---|
302 | //lang_list = scayt.getLangList();
|
---|
303 | lang_list = scayt.getLangList() ;//|| {ltr: {"en_US" : "English","en_GB" : "British English","pt_BR" : "Brazilian Portuguese","da_DK" : "Danish","nl_NL" : "Dutch","en_CA" : "English Canadian","fi_FI" : "Finnish","fr_FR" : "French","fr_CA" : "French Canadian","de_DE" : "German","el_GR" : "Greek","hu_HU" : "Hungarian","it_IT" : "Italian","nb_NO" : "Norwegian","pl_PL" : "Polish","pt_PT" : "Portuguese","ru_RU" : "Russian","es_ES" : "Spanish","sv_SE" : "Swedish","tr_TR" : "Turkish","uk_UA" : "Ukrainian","cy_GB" : "Welsh"},rtl: {"ar_EG" : "Arabic"}};
|
---|
304 |
|
---|
305 |
|
---|
306 |
|
---|
307 |
|
---|
308 | // ** animate options
|
---|
309 | get.byClass("_scayt_option").forEach(function(el,i){
|
---|
310 |
|
---|
311 | if ('undefined' != typeof(options[el.name])) {
|
---|
312 | // *** set default values
|
---|
313 |
|
---|
314 | if ( 1 == options[ el.name ] ){
|
---|
315 | //el.setAttribute("checked","true");
|
---|
316 | get.wrap(el).setAttr("checked" ,true)
|
---|
317 | //document.all_options[el.name].checked = "true";
|
---|
318 | //el.checked = true;
|
---|
319 | //alert( options[ dojo.attr(el ,'name') ] + " el " )
|
---|
320 | }
|
---|
321 | //console.info(options)
|
---|
322 | // *** bind events
|
---|
323 | get.wrap(el).bindOnclick( function(ev){
|
---|
324 |
|
---|
325 | var that = get.wrap(this);
|
---|
326 | var isCheck = that.getAttr("checked");
|
---|
327 | //console.info(isCheck)
|
---|
328 | if ( isCheck == false ) {
|
---|
329 |
|
---|
330 | //that.setAttr("checked",false);
|
---|
331 | options[ this.name ] = 0;
|
---|
332 | }else{
|
---|
333 | //that.setAttr("checked",true);
|
---|
334 | options[ this.name ] = 1;
|
---|
335 | }
|
---|
336 | //console.info(options)
|
---|
337 | });
|
---|
338 | }
|
---|
339 | });
|
---|
340 |
|
---|
341 |
|
---|
342 | // * Create languages tab
|
---|
343 | // ** convert langs obj to array
|
---|
344 | var lang_arr = [];
|
---|
345 |
|
---|
346 | for (var k in lang_list.rtl){
|
---|
347 | // find curent lang
|
---|
348 | if ( k == sLang)
|
---|
349 | chosed_lang = lang_list.rtl[k] + "::" + k;
|
---|
350 | lang_arr[lang_arr.length] = lang_list.rtl[k] + "::" + k;
|
---|
351 |
|
---|
352 | }
|
---|
353 | for (var k in lang_list.ltr){
|
---|
354 | // find curent lang
|
---|
355 | if ( k == sLang)
|
---|
356 | chosed_lang = lang_list.ltr[k] + "::" + k;
|
---|
357 | lang_arr[lang_arr.length] = lang_list.ltr[k] + "::" + k;
|
---|
358 | }
|
---|
359 | lang_arr.sort();
|
---|
360 |
|
---|
361 | // ** find lang containers
|
---|
362 |
|
---|
363 | var lcol = get.byId("lcolid");
|
---|
364 | var rcol = get.byId("rcolid");
|
---|
365 | // ** place langs in DOM
|
---|
366 |
|
---|
367 | get.forEach(lang_arr , function( l , i ){
|
---|
368 |
|
---|
369 | //console.info( l,i );
|
---|
370 |
|
---|
371 | var l_arr = l.split('::');
|
---|
372 | var l_name = l_arr[0];
|
---|
373 | var l_code = l_arr[1];
|
---|
374 | var row = document.createElement('div');
|
---|
375 | row.id = l_code;
|
---|
376 | row.className = "li";
|
---|
377 | // split langs on half
|
---|
378 | var col = ( i < lang_arr.length/2 ) ? lcol:rcol ;
|
---|
379 |
|
---|
380 | // append row
|
---|
381 | //console.dir( col )
|
---|
382 | col.appendChild(row);
|
---|
383 | var row_dom = get.byId( l_code )
|
---|
384 | row_dom.innerHTML = l_name;
|
---|
385 |
|
---|
386 | var checkActiveLang = function( id ){
|
---|
387 | return chosed_lang.split("::")[1] == id;
|
---|
388 | };
|
---|
389 | // bind click
|
---|
390 | row_dom.bindOnclick(function(ev){
|
---|
391 |
|
---|
392 | if ( checkActiveLang(this.id) ) return false;
|
---|
393 | var elId = this.id;
|
---|
394 | get.byId(this.id)
|
---|
395 | .addClass("Button")
|
---|
396 | .removeClass("DarkBackground");
|
---|
397 |
|
---|
398 | window.setTimeout( function (){ get.byId(elId).setStyle({opacity:"0.5",cursor:"no-drop"}); } ,300 );
|
---|
399 |
|
---|
400 | get.byId(chosed_lang.split("::")[1])
|
---|
401 | .addClass("DarkBackground")
|
---|
402 | .removeClass("Button")
|
---|
403 | .setStyle({opacity:"1",cursor:"pointer"});
|
---|
404 |
|
---|
405 | chosed_lang = this.innerHTML + "::" + this.id;
|
---|
406 | return true;
|
---|
407 | })
|
---|
408 | .setStyle({
|
---|
409 | cursor:"pointer"
|
---|
410 | });
|
---|
411 | // select current lang
|
---|
412 | if (l == chosed_lang)
|
---|
413 | row_dom.addClass("Button").setStyle({opacity:"0.5",cursor:"no-drop"});
|
---|
414 | else
|
---|
415 | row_dom.addClass("DarkBackground").setStyle({opacity:"1"});
|
---|
416 |
|
---|
417 | });
|
---|
418 | // * user dictionary
|
---|
419 | if ( userDicActive ){
|
---|
420 | initUserDictionary()
|
---|
421 |
|
---|
422 | }
|
---|
423 | });
|
---|
424 |
|
---|
425 |
|
---|
426 |
|
---|
427 | }
|
---|
428 |
|
---|
429 |
|
---|
430 |
|
---|
431 |
|
---|
432 | var buttons = [ 'dic_create','dic_delete','dic_rename','dic_restore' ];
|
---|
433 | var labels = [ 'mixedCase','mixedWithDigits','allCaps','ignoreDomainNames' ];
|
---|
434 |
|
---|
435 |
|
---|
436 | function apllyCaptions ( )
|
---|
437 | {
|
---|
438 |
|
---|
439 | // fill tabs headers
|
---|
440 | // add missing captions
|
---|
441 |
|
---|
442 | get.byClass("PopupTab").forEach(function(el,i){
|
---|
443 |
|
---|
444 | if ( tabs[i] == 1 ){
|
---|
445 | el.style.display = "block";
|
---|
446 | }
|
---|
447 | el.innerHTML = captions['tab_'+el.id];
|
---|
448 |
|
---|
449 | });
|
---|
450 |
|
---|
451 | // Fill options labels.
|
---|
452 | for ( i in labels )
|
---|
453 | {
|
---|
454 | var label = 'label_' + labels[ i ],
|
---|
455 | labelElement = document.getElementById( label );
|
---|
456 |
|
---|
457 | if ( 'undefined' != typeof labelElement
|
---|
458 | && 'undefined' != typeof captions[ label ] && captions[ label ] !== ""
|
---|
459 | && 'undefined' != typeof options[labels[ i ]] )
|
---|
460 | {
|
---|
461 | labelElement.innerHTML = captions[ label ];
|
---|
462 | var labelParent = labelElement.parentNode;
|
---|
463 | labelParent.style.display = "block";
|
---|
464 | }
|
---|
465 | }
|
---|
466 | // fill dictionary section
|
---|
467 | for ( var i in buttons )
|
---|
468 | {
|
---|
469 | var button = buttons[ i ];
|
---|
470 | get.byId( button ).innerHTML = '<span>' + captions[ 'button_' + button] +'</span>' ;
|
---|
471 | }
|
---|
472 | get.byId("dname").innerHTML = captions['label_dname'];
|
---|
473 | get.byId( 'dic_info' ).innerHTML = captions[ 'dic_info' ];
|
---|
474 |
|
---|
475 | // fill about tab
|
---|
476 | var about = '<p>' + captions[ 'about_throwt_image' ] + '</p>'+
|
---|
477 | '<p>' + captions[ 'version' ] + scayt.version.toString() + '</p>' +
|
---|
478 | '<p>' + captions[ 'about_throwt_copy' ] + '</p>';
|
---|
479 |
|
---|
480 | get.byId( 'scayt_about' ).innerHTML = about;
|
---|
481 |
|
---|
482 | }
|
---|
483 |
|
---|
484 |
|
---|
485 | function initUserDictionary () {
|
---|
486 |
|
---|
487 | scayt.getNameUserDictionary(
|
---|
488 | function( o )
|
---|
489 | {
|
---|
490 | var dic_name = o.dname;
|
---|
491 | if ( dic_name )
|
---|
492 | {
|
---|
493 | get.byId( 'dic_name' ).value = dic_name;
|
---|
494 | display_dic_buttons( dic_buttons[1] );
|
---|
495 | }
|
---|
496 | else
|
---|
497 | display_dic_buttons( dic_buttons[0] );
|
---|
498 |
|
---|
499 | },
|
---|
500 | function ()
|
---|
501 | {
|
---|
502 | get.byId( 'dic_name' ).value("");
|
---|
503 | dic_error_message(captions["err_dic_enable"] || "Used dictionary are unaveilable now.")
|
---|
504 | }
|
---|
505 | );
|
---|
506 |
|
---|
507 | dic_success_message("");
|
---|
508 |
|
---|
509 | // ** bind event listeners
|
---|
510 | get.byClass("button").bindOnclick(function( ){
|
---|
511 |
|
---|
512 | // get dic name
|
---|
513 | var dic_name = get.byId('dic_name').value ;
|
---|
514 | // check common dictionary rules
|
---|
515 | if (!dic_name) {
|
---|
516 | dic_error_message(" Dictionary name should not be empty. ");
|
---|
517 | return false;
|
---|
518 | }
|
---|
519 | //apply handler
|
---|
520 | window[this.id].apply( window, [this, dic_name, dic_buttons ] );
|
---|
521 |
|
---|
522 | //console.info( typeof window[this.id], window[this.id].calle )
|
---|
523 | return false;
|
---|
524 | });
|
---|
525 |
|
---|
526 | }
|
---|
527 |
|
---|
528 | dic_create = function( el, dic_name , dic_buttons )
|
---|
529 | {
|
---|
530 | // comma separated button's ids include repeats if exists
|
---|
531 | var all_buttons = dic_buttons[0] + ',' + dic_buttons[1];
|
---|
532 |
|
---|
533 | var err_massage = captions["err_dic_create"];
|
---|
534 | var suc_massage = captions["succ_dic_create"];
|
---|
535 | //console.info("--plugin ");
|
---|
536 |
|
---|
537 | scayt.createUserDictionary(dic_name,
|
---|
538 | function(arg)
|
---|
539 | {
|
---|
540 | //console.info( "dic_create callback called with args" , arg );
|
---|
541 | hide_dic_buttons ( all_buttons );
|
---|
542 | display_dic_buttons ( dic_buttons[1] );
|
---|
543 | suc_massage = suc_massage.replace("%s" , arg.dname );
|
---|
544 | dic_success_message (suc_massage);
|
---|
545 | },
|
---|
546 | function(arg)
|
---|
547 | {
|
---|
548 | //console.info( "dic_create errorback called with args" , arg )
|
---|
549 | err_massage = err_massage.replace("%s" ,arg.dname );
|
---|
550 | dic_error_message ( err_massage + "( "+ (arg.message || "") +")");
|
---|
551 | });
|
---|
552 |
|
---|
553 | };
|
---|
554 |
|
---|
555 | dic_rename = function( el, dic_name , dic_buttons )
|
---|
556 | {
|
---|
557 | //
|
---|
558 | // try to rename dictionary
|
---|
559 | // @TODO: rename dict
|
---|
560 | //console.info ( captions["err_dic_rename"] )
|
---|
561 | var err_massage = captions["err_dic_rename"] || "";
|
---|
562 | var suc_massage = captions["succ_dic_rename"] || "";
|
---|
563 | scayt.renameUserDictionary(dic_name,
|
---|
564 | function(arg)
|
---|
565 | {
|
---|
566 | //console.info( "dic_rename callback called with args" , arg );
|
---|
567 | suc_massage = suc_massage.replace("%s" , arg.dname );
|
---|
568 | set_dic_name( dic_name );
|
---|
569 | dic_success_message ( suc_massage );
|
---|
570 | },
|
---|
571 | function(arg)
|
---|
572 | {
|
---|
573 | //console.info( "dic_rename errorback called with args" , arg )
|
---|
574 | err_massage = err_massage.replace("%s" , arg.dname );
|
---|
575 | set_dic_name( dic_name );
|
---|
576 | dic_error_message( err_massage + "( " + ( arg.message || "" ) + " )" );
|
---|
577 | });
|
---|
578 | };
|
---|
579 |
|
---|
580 | dic_delete = function ( el, dic_name , dic_buttons )
|
---|
581 | {
|
---|
582 | var all_buttons = dic_buttons[0] + ',' + dic_buttons[1];
|
---|
583 | var err_massage = captions["err_dic_delete"];
|
---|
584 | var suc_massage = captions["succ_dic_delete"];
|
---|
585 |
|
---|
586 | // try to delete dictionary
|
---|
587 | // @TODO: delete dict
|
---|
588 | scayt.deleteUserDictionary(
|
---|
589 | function(arg)
|
---|
590 | {
|
---|
591 | //console.info( "dic_delete callback " , dic_name ,arg );
|
---|
592 | suc_massage = suc_massage.replace("%s" , arg.dname );
|
---|
593 | hide_dic_buttons ( all_buttons );
|
---|
594 | display_dic_buttons ( dic_buttons[0] );
|
---|
595 | set_dic_name( "" ); // empty input field
|
---|
596 | dic_success_message( suc_massage );
|
---|
597 | },
|
---|
598 | function(arg)
|
---|
599 | {
|
---|
600 | //console.info( " dic_delete errorback called with args" , arg )
|
---|
601 | err_massage = err_massage.replace("%s" , arg.dname );
|
---|
602 | dic_error_message(err_massage);
|
---|
603 | });
|
---|
604 | };
|
---|
605 |
|
---|
606 | dic_restore = dialog.dic_restore || function ( el, dic_name , dic_buttons )
|
---|
607 | {
|
---|
608 | // try to restore existing dictionary
|
---|
609 | var all_buttons = dic_buttons[0] + ',' + dic_buttons[1];
|
---|
610 | var err_massage = captions["err_dic_restore"];
|
---|
611 | var suc_massage = captions["succ_dic_restore"];
|
---|
612 |
|
---|
613 | scayt.restoreUserDictionary(dic_name,
|
---|
614 | function(arg)
|
---|
615 | {
|
---|
616 | //console.info( "dic_restore callback called with args" , arg );
|
---|
617 | suc_massage = suc_massage.replace("%s" , arg.dname );
|
---|
618 | hide_dic_buttons ( all_buttons );
|
---|
619 | display_dic_buttons(dic_buttons[1]);
|
---|
620 | dic_success_message( suc_massage );
|
---|
621 | },
|
---|
622 | function(arg)
|
---|
623 | {
|
---|
624 | //console.info( " dic_restore errorback called with args" , arg )
|
---|
625 | err_massage = err_massage.replace("%s" , arg.dname );
|
---|
626 | dic_error_message( err_massage );
|
---|
627 | });
|
---|
628 | };
|
---|
629 |
|
---|
630 | function dic_error_message( m )
|
---|
631 | {
|
---|
632 | if ( !m )
|
---|
633 | return ;
|
---|
634 |
|
---|
635 | get.byId('dic_message').innerHTML = '<span class="error">' + m + '</span>' ;
|
---|
636 | }
|
---|
637 |
|
---|
638 | function dic_success_message( m )
|
---|
639 | {
|
---|
640 | if ( !m )
|
---|
641 | return ;
|
---|
642 |
|
---|
643 | get.byId('dic_message').innerHTML = '<span class="success">' + m + '</span>' ;
|
---|
644 | }
|
---|
645 |
|
---|
646 | function display_dic_buttons ( sIds ){
|
---|
647 | sIds = new String( sIds );
|
---|
648 | get.forEach( sIds.split(','), function ( id,i) {
|
---|
649 | get.byId(id).setStyle({display:"inline"});
|
---|
650 | });
|
---|
651 | }
|
---|
652 | function hide_dic_buttons ( sIds ){
|
---|
653 | sIds = new String( sIds );
|
---|
654 | get.forEach( sIds.split(','), function ( id,i) {
|
---|
655 | get.byId(id).setStyle({display:"none"});
|
---|
656 | });
|
---|
657 | }
|
---|
658 | function set_dic_name ( dic_name ) {
|
---|
659 | get.byId('dic_name').value = dic_name;
|
---|
660 | }
|
---|
661 | function display_dic_tab () {
|
---|
662 | get.byId("dic_tab").style.display = "block";
|
---|
663 | }
|
---|
664 |
|
---|
665 | function Ok()
|
---|
666 | {
|
---|
667 | // Things to do when the Ok button is clicked.
|
---|
668 | var c = 0;
|
---|
669 | // set upp options if any was set
|
---|
670 | var o = scayt_control.option();
|
---|
671 | //console.info(options)
|
---|
672 | for ( var oN in options ) {
|
---|
673 |
|
---|
674 | if ( o[oN] != options[oN] && c == 0){
|
---|
675 | //console.info( "set option " )
|
---|
676 | scayt_control.option( options );
|
---|
677 | c++;
|
---|
678 | }
|
---|
679 | }
|
---|
680 | //setup languge if it was change
|
---|
681 | var csLang = chosed_lang.split("::")[1];
|
---|
682 | if ( csLang && sLang != csLang ){
|
---|
683 | scayt_control.setLang( csLang );
|
---|
684 | //console.info(sLang+" -> "+csLang , scayt_control)
|
---|
685 | c++;
|
---|
686 | }
|
---|
687 |
|
---|
688 | if ( c > 0 ) scayt_control.refresh();
|
---|
689 |
|
---|
690 | return dialog.Cancel();
|
---|
691 |
|
---|
692 | }
|
---|
693 |
|
---|
694 | </script>
|
---|
695 | </head>
|
---|
696 | <body style="OVERFLOW: hidden" scroll="no">
|
---|
697 | <div class="tab_container" id="inner_options">
|
---|
698 |
|
---|
699 | <ul id="scayt_options">
|
---|
700 | <li class="_scayt_options">
|
---|
701 | <input class="_scayt_option" type="checkbox" value="0" name="allCaps" />
|
---|
702 | <label for="allCaps" id="label_allCaps"></label>
|
---|
703 | </li>
|
---|
704 | <li>
|
---|
705 | <input class="_scayt_option" type="checkbox" value="0" name="ignoreDomainNames" />
|
---|
706 | <label for="ignoreDomainNames" id="label_ignoreDomainNames"></label>
|
---|
707 | </li>
|
---|
708 | <li>
|
---|
709 | <input class="_scayt_option" type="checkbox" value="0" name="mixedCase" />
|
---|
710 | <label for="mixedCase" id="label_mixedCase"></label>
|
---|
711 | </li>
|
---|
712 | <li>
|
---|
713 | <input class="_scayt_option" type="checkbox" value="0" name="mixedWithDigits" />
|
---|
714 | <label for="mixedWithDigits" id="label_mixedWithDigits"></label>
|
---|
715 | </li>
|
---|
716 | </ul>
|
---|
717 | </div>
|
---|
718 | <div class="tab_container" id="inner_langs">
|
---|
719 |
|
---|
720 | <div class="lcol" id="lcolid"></div>
|
---|
721 | <div class="rcol" id="rcolid"></div>
|
---|
722 | </div>
|
---|
723 | <div class="tab_container" id="inner_dictionary">
|
---|
724 |
|
---|
725 | <div id="dic_message"></div>
|
---|
726 | <div id="_off_dic_tab" class="dictionary" >
|
---|
727 | <div style="padding-left:10px;">
|
---|
728 | <label id="dname" for="dname"></label>
|
---|
729 | <input type="text" size="14" maxlength="15" value="" id="dic_name" name="dic_name"/>
|
---|
730 | </div>
|
---|
731 | <div class="dic_buttons">
|
---|
732 | <a href="#" id="dic_create" class="button"> </a>
|
---|
733 | <a href="#" id="dic_delete" class="button"> </a>
|
---|
734 | <a href="#" id="dic_rename" class="button"> </a>
|
---|
735 | <a href="#" id="dic_restore" class="button"> </a>
|
---|
736 | </div>
|
---|
737 |
|
---|
738 | <div id="dic_info"></div>
|
---|
739 |
|
---|
740 | </div>
|
---|
741 | </div>
|
---|
742 | <div id="inner_about" class="tab_container">
|
---|
743 | <div id="scayt_about"></div>
|
---|
744 | </div>
|
---|
745 | </body>
|
---|
746 | </html>
|
---|