2 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.html or http://ckeditor.com/license
6 // Create support tools
7 var appTools
= (function(){
10 var _init = function(handler
) {
11 if (window
.addEventListener
) {
12 window
.addEventListener('message', handler
, false);
14 window
.attachEvent("onmessage", handler
);
18 var unbindHandler = function(handler
) {
19 if (window
.removeEventListener
) {
20 window
.removeEventListener('message', handler
, false);
22 window
.detachEvent('onmessage', handler
);
26 var _sendCmd = function(o
) {
28 type
= Object
.prototype.toString
,
29 objObject
= "[object Object]",
32 target
= o
.target
|| window
,
33 message
= o
.message
|| {
37 if (o
.message
&& type
.call(o
.message
) == objObject
) {
38 (o
.message
.id
) ? o
.message
.id : o
.message
.id
= id
;
42 str
= window
.JSON
.stringify(message
, fn
);
43 target
.postMessage(str
, '*');
46 var _hashCreate = function(o
, fn
) {
48 var str
= window
.JSON
.stringify(o
, fn
);
52 var _hashParse = function(str
, fn
) {
54 return window
.JSON
.parse(str
, fn
);
57 var setCookie = function(name
, value
, options
) {
58 options
= options
|| {};
60 var expires
= options
.expires
;
62 if (typeof expires
== "number" && expires
) {
64 d
.setTime(d
.getTime() + expires
*1000);
65 expires
= options
.expires
= d
;
67 if (expires
&& expires
.toUTCString
) {
68 options
.expires
= expires
.toUTCString();
71 value
= encodeURIComponent(value
);
72 var updatedCookie
= name
+ "=" + value
;
74 for(var propName
in options
) {
75 var propValue
= options
[propName
];
76 updatedCookie
+= "; " + propName
;
77 if (propValue
!== true) {
78 updatedCookie
+= "=" + propValue
;
81 document
.cookie
= updatedCookie
;
84 var getCookie = function(name
) {
85 var matches
= document
.cookie
.match(new RegExp(
86 "(?:^|; )" + name
.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
88 return matches
? decodeURIComponent(matches
[1]) : undefined;
91 var deleteCookie = function(name
) {
92 setCookie(name
, "", { expires: -1 });
95 var findFocusable = function(ckEl
) {
97 focusableSelectors
= 'a[href], area[href], input, select, textarea, button, *[tabindex], *[contenteditable]';
100 result
= ckEl
.find(focusableSelectors
);
106 var getStyle = function(el
, prop
) {
107 if(document
.defaultView
&& document
.defaultView
.getComputedStyle
) {
108 return document
.defaultView
.getComputedStyle(el
, null)[prop
];
109 } else if(el
.currentStyle
) {
110 return el
.currentStyle
[prop
];
112 return el
.style
[prop
];
116 var isHidden = function(el
) {
117 return el
.offsetWidth
=== 0 || el
.offsetHeight
== 0 || getStyle(el
, 'display') === 'none';
120 var isVisible = function(el
) {
121 return !isHidden(el
);
124 var hasClass = function (obj
, cname
) {
125 return !!(obj
.className
? obj
.className
.match(new RegExp('(\\s|^)'+cname
+'(\\s|$)')) : false);
132 unbindHandler: unbindHandler
149 findFocusable: findFocusable
,
150 isVisible: isVisible
,
157 NS
.TextAreaNumber
= null;
162 "GrammTab": 'grammar'
165 NS
.optionNode
= null;
166 NS
.selectNode
= null;
167 NS
.grammerSuggest
= null;
169 NS
.iframeMain
= null;
171 NS
.div_overlay
= null;
172 NS
.textNodeInfo
= {};
174 NS
.selectNodeResponce
= {};
176 NS
.langSelectbox
= null;
178 NS
.show_grammar
= null;
179 NS
.div_overlay_no_check
= null;
180 NS
.targetFromFrame
= {};
181 NS
.onLoadOverlay
= null;
182 NS
.LocalizationComing
= {};
183 NS
.OverlayPlace
= null;
185 NS
.LocalizationButton
= {
188 'text' : 'Change to',
189 'localizationID': 'ChangeTo'
194 'text' : 'Change All'
199 'text' : 'Ignore word'
204 'text' : 'Ignore all words'
220 'FinishChecking_button': {
222 'text' : 'Finish Checking',
223 'localizationID': 'FinishChecking'
226 'FinishChecking_button_block': {
228 'text' : 'Finish Checking',
229 'localizationID': 'FinishChecking'
233 NS
.LocalizationLabel
= {
236 'text' : 'Change to',
237 'localizationID': 'ChangeTo'
242 'text' : 'Suggestions'
247 'text' : 'Categories'
256 var SetLocalizationButton = function(obj
) {
257 var el
, localizationID
;
260 el
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, i
);
263 el
= el
.getElement();
265 el
= obj
[i
].instance
.getElement().getFirst() || obj
[i
].instance
.getElement();
268 localizationID
= obj
[i
].localizationID
|| i
;
269 el
.setText(NS
.LocalizationComing
[localizationID
]);
273 var SetLocalizationLabel = function(obj
) {
274 var el
, localizationID
;
277 el
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, i
);
280 el
= obj
[i
].instance
;
284 localizationID
= obj
[i
].localizationID
|| i
;
285 el
.setLabel(NS
.LocalizationComing
[localizationID
] + ':');
289 var OptionsConfirm = function(state
) {
291 nameNode
.setValue('');
295 var iframeOnload
= false;
296 var nameNode
, selectNode
, frameId
;
298 NS
.framesetHtml = function(tab
) {
299 var str
= '<iframe id=' + NS
.iframeNumber
+ '_' + tab
+ ' frameborder="0" allowtransparency="1" style="width:100%;border: 1px solid #AEB3B9;overflow: auto;background:#fff; border-radius: 3px;"></iframe>';
303 NS
.setIframe = function(that
, nameTab
) {
305 str
= NS
.framesetHtml(nameTab
),
306 iframeId
= NS
.iframeNumber
+ '_' + nameTab
,
307 // tmp.html from wsc/dialogs
312 '<meta charset="UTF-8">' +
313 '<title>iframe</title>' +
319 'font: 13px/1.555 "Trebuchet MS", sans-serif;' +
323 'font-weight: bold;' +
324 'text-decoration: none;' +
325 'border-bottom: 1px solid #888;' +
329 'padding: 3px 5px;' +
330 'text-align: justify;' +
332 '.main-box p{margin: 0 0 14px;}' +
335 'border-bottom-color: #f00000;' +
340 '<div id="content" class="main-box"></div>' +
341 '<iframe src="" frameborder="0" id="spelltext" name="spelltext" style="display:none; width: 100%" ></iframe>' +
342 '<iframe src="" frameborder="0" id="loadsuggestfirst" name="loadsuggestfirst" style="display:none; width: 100%" ></iframe>' +
343 '<iframe src="" frameborder="0" id="loadspellsuggestall" name="loadspellsuggestall" style="display:none; width: 100%" ></iframe>' +
344 '<iframe src="" frameborder="0" id="loadOptionsForm" name="loadOptionsForm" style="display:none; width: 100%" ></iframe>' +
346 '(function(window) {' +
347 // Constructor Manager PostMessage
349 'var ManagerPostMessage = function() {' +
350 'var _init = function(handler) {' +
351 'if (document.addEventListener) {' +
352 'window.addEventListener("message", handler, false);' +
354 'window.attachEvent("onmessage", handler);' +
357 'var _sendCmd = function(o) {' +
359 'type = Object.prototype.toString,' +
360 'fn = o.fn || null,' +
362 'target = o.target || window,' +
363 'message = o.message || { "id": id };' +
365 'if (o.message && type.call(o.message) == "[object Object]") {' +
366 '(o.message["id"]) ? o.message["id"] : o.message["id"] = id;' +
367 'message = o.message;' +
370 'str = JSON.stringify(message, fn);' +
371 'target.postMessage(str, "*");' +
380 'var manageMessageTmp = new ManagerPostMessage;' +
383 'var appString = (function(){' +
384 'var spell = parent.CKEDITOR.config.wsc.DefaultParams.scriptPath;' +
385 'var serverUrl = parent.CKEDITOR.config.wsc.DefaultParams.serviceHost;' +
386 'return serverUrl + spell;' +
389 'function loadScript(src, callback) {' +
390 'var scriptTag = document.createElement("script");' +
391 'scriptTag.type = "text/javascript";' +
392 'callback ? callback : callback = function() {};' +
393 'if(scriptTag.readyState) {' +
395 'scriptTag.onreadystatechange = function() {' +
396 'if (scriptTag.readyState == "loaded" ||' +
397 'scriptTag.readyState == "complete") {' +
398 'scriptTag.onreadystatechange = null;' +
399 'setTimeout(function(){scriptTag.parentNode.removeChild(scriptTag)},1);' +
405 'scriptTag.onload = function() {' +
406 'setTimeout(function(){scriptTag.parentNode.removeChild(scriptTag)},1);' +
410 'scriptTag.src = src;' +
411 'document.getElementsByTagName("head")[0].appendChild(scriptTag);' +
415 'window.onload = function(){' +
416 'loadScript(appString, function(){' +
417 'manageMessageTmp.send({' +
418 '"id": "iframeOnload",' +
419 '"target": window.parent' +
428 that
.getElement().setHtml(str
);
429 iframe
= document
.getElementById(iframeId
);
430 iframe
= (iframe
.contentWindow
) ? iframe
.contentWindow : (iframe
.contentDocument
.document
) ? iframe
.contentDocument
.document : iframe
.contentDocument
;
431 iframe
.document
.open();
432 iframe
.document
.write(iframeInnerHtml
);
433 iframe
.document
.close();
436 NS
.setCurrentIframe = function(currentTab
) {
437 var that
= NS
.dialog
._
.contents
[currentTab
].Content
,
440 NS
.setIframe(that
, currentTab
);
444 NS
.setHeightBannerFrame = function() {
446 bannerPlaceSpellTab
= NS
.dialog
.getContentElement('SpellTab', 'banner').getElement(),
447 bannerPlaceGrammTab
= NS
.dialog
.getContentElement('GrammTab', 'banner').getElement(),
448 bannerPlaceThesaurus
= NS
.dialog
.getContentElement('Thesaurus', 'banner').getElement();
450 bannerPlaceSpellTab
.setStyle('height', height
);
451 bannerPlaceGrammTab
.setStyle('height', height
);
452 bannerPlaceThesaurus
.setStyle('height', height
);
455 NS
.setHeightFrame = function() {
456 var currentTab
= NS
.dialog
._
.currentTabId
,
457 tabID
= NS
.iframeNumber
+ '_' + currentTab
,
458 iframe
= document
.getElementById(tabID
);
460 iframe
.style
.height
= '240px';
463 NS
.sendData = function(scope
) {
464 var currentTab
= scope
._
.currentTabId
,
465 that
= scope
._
.contents
[currentTab
].Content
,
468 NS
.previousTab
= currentTab
;
469 NS
.setIframe(that
, currentTab
);
471 var loadNewTab = function(event
) {
472 currentTab
= scope
._
.currentTabId
;
473 event
= event
|| window
.event
;
475 if (!event
.data
.getTarget().is('a')) {
479 if(currentTab
=== NS
.previousTab
) return;
480 NS
.previousTab
= currentTab
;
482 that
= scope
._
.contents
[currentTab
].Content
;
483 tabID
= NS
.iframeNumber
+ '_' + currentTab
;
484 NS
.div_overlay
.setEnable();
486 if (!that
.getElement().getChildCount()) {
487 NS
.setIframe(that
, currentTab
);
488 iframe
= document
.getElementById(tabID
);
489 NS
.targetFromFrame
[tabID
] = iframe
.contentWindow
;
491 sendData(NS
.targetFromFrame
[tabID
], NS
.cmd
[currentTab
]);
495 scope
.parts
.tabs
.removeListener('click', loadNewTab
);
496 scope
.parts
.tabs
.on('click', loadNewTab
);
499 NS
.buildSelectLang = function(aId
) {
500 var divContainer
= new CKEDITOR
.dom
.element('div'),
501 selectContainer
= new CKEDITOR
.dom
.element('select'),
502 id
= "wscLang" + aId
;
504 divContainer
.addClass("cke_dialog_ui_input_select");
505 divContainer
.setAttribute("role", "presentation");
506 divContainer
.setStyles({
508 'position': 'absolute',
512 'white-space': 'normal'
515 selectContainer
.setAttribute('id', id
);
516 selectContainer
.addClass("cke_dialog_ui_input_select");
517 selectContainer
.setStyles({
520 var currentTabId
= NS
.dialog
._
.currentTabId
,
521 frameId
= NS
.iframeNumber
+ '_' + currentTabId
;
523 divContainer
.append(selectContainer
);
529 NS
.buildOptionLang = function(key
, aId
) {
530 var id
= "wscLang" + aId
;
531 var select
= document
.getElementById(id
),
532 fragment
= document
.createDocumentFragment(),
533 create_option
, txt_option
,
536 if(select
.options
.length
=== 0) {
537 for (var lang
in key
) {
538 sort
.push([lang
, key
[lang
]]);
542 for (var i
= 0; i
< sort
.length
; i
++) {
543 create_option
=document
.createElement("option");
544 create_option
.setAttribute("value", sort
[i
][1]);
545 txt_option
= document
.createTextNode(sort
[i
][0]);
546 create_option
.appendChild(txt_option
);
548 fragment
.appendChild(create_option
);
550 select
.appendChild(fragment
);
553 // make appropriate option selected according to current selected language
554 for (var j
= 0; j
< select
.options
.length
; j
++) {
555 if (select
.options
[j
].value
== NS
.selectingLang
) {
556 select
.options
[j
].selected
= "selected";
561 NS
.buildOptionSynonyms = function(key
) {
562 var syn
= NS
.selectNodeResponce
[key
];
564 var select
= getSelect( NS
.selectNode
['Synonyms'] );
566 NS
.selectNode
['Synonyms'].clear();
568 for (var i
= 0; i
< syn
.length
; i
++) {
569 var option
= document
.createElement('option');
570 option
.text
= syn
[i
];
571 option
.value
= syn
[i
];
573 select
.$.add(option
, i
);
576 NS
.selectNode
['Synonyms'].getInputElement().$.firstChild
.selected
= true;
577 NS
.textNode
['Thesaurus'].setValue(NS
.selectNode
['Synonyms'].getInputElement().getValue());
580 var setBannerInPlace = function(htmlBanner
) {
581 var findBannerPlace
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'banner').getElement();
582 findBannerPlace
.setHtml(htmlBanner
);
586 var overlayBlock
= function overlayBlock(opt
) {
587 var progress
= opt
.progress
|| "",
589 target
= opt
.target
|| doc
.body
,
590 overlayId
= opt
.id
|| "overlayBlock",
591 opacity
= opt
.opacity
|| "0.9",
592 background
= opt
.background
|| "#f1f1f1",
593 getOverlay
= doc
.getElementById(overlayId
),
594 thisOverlay
= getOverlay
|| doc
.createElement("div");
596 thisOverlay
.style
.cssText
= "position: absolute;" +
604 "background:" + background
+ ";" +
605 "opacity: " + opacity
+ ";" +
606 "filter: alpha(opacity=" + opacity
* 100 + ");" +
608 thisOverlay
.id
= overlayId
;
611 target
.appendChild(thisOverlay
);
615 setDisable: function() {
616 thisOverlay
.style
.display
= "none";
618 setEnable: function() {
619 thisOverlay
.style
.display
= "block";
624 var buildRadioInputs = function(key
, value
, check
) {
625 var divContainer
= new CKEDITOR
.dom
.element('div'),
626 radioButton
= new CKEDITOR
.dom
.element('input'),
627 radioLabel
= new CKEDITOR
.dom
.element('label'),
628 id
= "wscGrammerSuggest" + key
+ "_" + value
;
630 divContainer
.addClass("cke_dialog_ui_input_radio");
631 divContainer
.setAttribute("role", "presentation");
632 divContainer
.setStyles({
635 'white-space': 'normal'
638 radioButton
.setAttributes({
641 name: 'wscGrammerSuggest',
644 radioButton
.setStyles({
648 radioButton
.on("click", function(data
) {
649 NS
.textNode
['GrammTab'].setValue(data
.sender
.getValue());
652 (check
) ? radioButton
.setAttribute("checked", true) : false;
654 radioButton
.addClass("cke_dialog_ui_radio_input");
656 radioLabel
.appendText(key
);
657 radioLabel
.setAttribute("for", id
);
658 radioLabel
.setStyles({
660 'line-height': '16px',
661 'margin-left': '18px',
662 'white-space': 'normal'
665 divContainer
.append(radioButton
);
666 divContainer
.append(radioLabel
);
671 var statusGrammarTab = function(aState
) { //#19221
672 aState
= aState
|| 'true';
673 if(aState
!== null && aState
== 'false'){
678 var langConstructor = function(lang
) {
679 var langSelectBox
= new __constructLangSelectbox(lang
),
680 selectId
= "wscLang" + NS
.dialog
.getParentEditor().name
,
681 selectContainer
= document
.getElementById(selectId
),
682 currentTabId
= NS
.dialog
._
.currentTabId
,
683 frameId
= NS
.iframeNumber
+ '_' + currentTabId
;
685 NS
.buildOptionLang(langSelectBox
.setLangList
, NS
.dialog
.getParentEditor().name
);
686 tabView
[langSelectBox
.getCurrentLangGroup(NS
.selectingLang
)].onShow();
687 statusGrammarTab(NS
.show_grammar
);
689 selectContainer
.onchange = function(e
) {
690 var langGroup
= langSelectBox
.getCurrentLangGroup(this.value
),
691 currentTabId
= NS
.dialog
._
.currentTabId
,
694 e
= e
|| window
.event
;
696 tabView
[langGroup
].onShow();
697 statusGrammarTab(NS
.show_grammar
);
698 NS
.div_overlay
.setEnable();
699 NS
.selectingLang
= this.value
;
701 // get command for current opened tan
702 cmd
= NS
.cmd
[currentTabId
];
703 // check whether current tab can be opened after language switching
704 if(!langGroup
|| !tabView
[langGroup
] || !tabView
[langGroup
].allowedTabCommands
[cmd
]) {
705 // if not so - set default tab to open after reload
706 cmd
= tabView
[langGroup
].defaultTabCommand
;
709 for(var key
in NS
.cmd
) {
710 if(NS
.cmd
[key
] == cmd
) {
711 NS
.previousTab
= key
;
716 appTools
.postMessage
.send({
718 'changeLang': NS
.selectingLang
,
722 'target': NS
.targetFromFrame
[frameId
],
723 'id': 'selectionLang_outer__page'
729 var disableButtonSuggest = function(word
) {
730 var changeToButton
, changeAllButton
,
731 styleDisable = function(instanceButton
) {
732 var button
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, instanceButton
) || NS
.LocalizationButton
[instanceButton
].instance
;
733 button
.getElement().hasClass('cke_disabled') ? button
.getElement().setStyle('color', '#a0a0a0') : button
.disable();
735 styleEnable = function(instanceButton
) {
736 var button
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, instanceButton
) || NS
.LocalizationButton
[instanceButton
].instance
;
738 button
.getElement().setStyle('color', '#333');
741 if (word
== 'no_any_suggestions') {
742 word
= 'No suggestions';
744 changeToButton
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'ChangeTo_button') || NS
.LocalizationButton
['ChangeTo_button'].instance
;
745 changeToButton
.disable();
746 changeAllButton
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'ChangeAll') || NS
.LocalizationButton
['ChangeAll'].instance
;
747 changeAllButton
.disable();
749 styleDisable('ChangeTo_button');
750 styleDisable('ChangeAll');
754 styleEnable('ChangeTo_button');
755 styleEnable('ChangeAll');
761 function getSelect( obj
) {
762 if ( obj
&& obj
.domId
&& obj
.getInputElement().$ )
763 return obj
.getInputElement();
764 else if ( obj
&& obj
.$ )
770 iframeOnload: function(response
) {
771 NS
.div_overlay
.setEnable();
773 var currentTab
= NS
.dialog
._
.currentTabId
,
774 tabId
= NS
.iframeNumber
+ '_' + currentTab
;
775 sendData(NS
.targetFromFrame
[tabId
], NS
.cmd
[currentTab
]);
778 suggestlist: function(response
) {
780 NS
.div_overlay_no_check
.setDisable();
781 hideCurrentFinishChecking();
782 langConstructor(NS
.langList
);
784 var word
= disableButtonSuggest(response
.word
),
785 suggestionsList
= '';
787 if (word
instanceof Array
) {
788 word
= response
.word
[0];
791 word
= word
.split(',');
792 suggestionsList
= word
;
794 NS
.textNode
['SpellTab'].setValue(suggestionsList
[0]);
796 var select
= getSelect( selectNode
);
800 for (var i
= 0; i
< suggestionsList
.length
; i
++) {
801 var option
= document
.createElement('option');
802 option
.text
= suggestionsList
[i
];
803 option
.value
= suggestionsList
[i
];
805 select
.$.add(option
, i
);
809 NS
.div_overlay
.setDisable();
813 grammerSuggest: function(response
) {
815 delete response
.mocklangs
;
817 hideCurrentFinishChecking();
818 langConstructor(NS
.langList
); // Show select language for this command CKEDITOR.config.wsc_cmd
819 var firstSuggestValue
= response
.grammSuggest
[0];// ? firstSuggestValue = response.grammSuggest[0] : firstSuggestValue = 'No suggestion for this words';
820 NS
.grammerSuggest
.getElement().setHtml('');
822 NS
.textNode
['GrammTab'].reset();
823 NS
.textNode
['GrammTab'].setValue(firstSuggestValue
);
825 NS
.textNodeInfo
['GrammTab'].getElement().setHtml('');
826 NS
.textNodeInfo
['GrammTab'].getElement().setText(response
.info
);
828 var arr
= response
.grammSuggest
,
832 for (var i
= 0; i
< len
; i
++) {
833 NS
.grammerSuggest
.getElement().append(buildRadioInputs(arr
[i
], arr
[i
], check
));
838 NS
.div_overlay
.setDisable();
841 thesaurusSuggest: function(response
) {
843 delete response
.mocklangs
;
845 hideCurrentFinishChecking();
846 langConstructor(NS
.langList
); // Show select language for this command CKEDITOR.config.wsc_cmd
847 NS
.selectNodeResponce
= response
;
849 NS
.textNode
['Thesaurus'].reset();
851 var select
= getSelect( NS
.selectNode
['Categories'] ),
854 NS
.selectNode
['Categories'].clear();
856 for (var i
in response
) {
858 var option
= document
.createElement('option');
862 select
.$.add(option
, count
);
866 var synKey
= NS
.selectNode
['Categories'].getInputElement().getChildren().$[0].value
;
867 NS
.selectNode
['Categories'].getInputElement().getChildren().$[0].selected
= true;
868 NS
.buildOptionSynonyms(synKey
);
871 NS
.div_overlay
.setDisable();
874 finish: function(response
) {
878 showCurrentFinishChecking();
879 NS
.div_overlay
.setDisable();
881 settext: function(response
) {
884 var command
= NS
.dialog
.getParentEditor().getCommand( 'checkspell' ),
885 editor
= NS
.dialog
.getParentEditor();
887 //set local storage for synchronization before scayt reinit
888 if (editor
.scayt
&& editor
.wsc
.isSsrvSame
) {
889 var wscUDN
= editor
.wsc
.udn
;
892 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary_name', '');
894 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary_name', wscUDN
);
903 editor
.setData(response
.text
, function(){
905 editor
.unlockSelection();
906 editor
.fire('saveSnapshot');
911 ReplaceText: function(response
) {
914 NS
.div_overlay
.setEnable();
916 NS
.dataTemp
= response
.text
;
917 NS
.selectingLang
= response
.currentLang
;
919 if (response
.cmd
= 'spell' && response
.len
!== '0' && response
.len
) {
920 NS
.div_overlay
.setDisable();
922 window
.setTimeout(function() {
924 NS
.div_overlay
.setDisable();
929 SetLocalizationButton(NS
.LocalizationButton
);
930 SetLocalizationLabel(NS
.LocalizationLabel
);
933 options_checkbox_send: function(response
) {
937 'osp': appTools
.cookie
.get('osp'),
938 'udn': appTools
.cookie
.get('udn'),
939 'cust_dic_ids': NS
.cust_dic_ids
942 var currentTabId
= NS
.dialog
._
.currentTabId
,
943 frameId
= NS
.iframeNumber
+ '_' + currentTabId
;
945 appTools
.postMessage
.send({
947 'target': NS
.targetFromFrame
[frameId
],
948 'id': 'options_outer__page'
952 getOptions: function(response
) {
953 var udn
= response
.DefOptions
.udn
;
954 NS
.LocalizationComing
= response
.DefOptions
.localizationButtonsAndText
;
955 NS
.show_grammar
= response
.show_grammar
;
956 NS
.langList
= response
.lang
;
957 NS
.bnr
= response
.bannerId
;
958 NS
.sessionid
= response
.sessionid
;
959 if (response
.bannerId
) {
960 NS
.setHeightBannerFrame();
961 setBannerInPlace(response
.banner
);
966 if (udn
== 'undefined') {
967 if (NS
.userDictionaryName
) {
968 udn
= NS
.userDictionaryName
;
971 'osp': appTools
.cookie
.get('osp'),
972 'udn': NS
.userDictionaryName
,
973 'cust_dic_ids': NS
.cust_dic_ids
,
974 'id': 'options_dic_send',
978 appTools
.postMessage
.send({
980 'target': NS
.targetFromFrame
[frameId
]
988 appTools
.cookie
.set('osp', response
.DefOptions
.osp
);
989 appTools
.cookie
.set('udn', udn
);
990 appTools
.cookie
.set('cust_dic_ids', response
.DefOptions
.cust_dic_ids
);
992 appTools
.postMessage
.send({
997 options_dic_send: function(response
) {
1000 'osp': appTools
.cookie
.get('osp'),
1001 'udn': appTools
.cookie
.get('udn'),
1002 'cust_dic_ids': NS
.cust_dic_ids
,
1003 'id': 'options_dic_send',
1004 'udnCmd': appTools
.cookie
.get('udnCmd')
1007 var currentTabId
= NS
.dialog
._
.currentTabId
,
1008 frameId
= NS
.iframeNumber
+ '_' + currentTabId
;
1010 appTools
.postMessage
.send({
1012 'target': NS
.targetFromFrame
[frameId
]
1015 data: function(response
) {
1019 giveOptions: function() {
1023 setOptionsConfirmF:function() {
1024 OptionsConfirm(false);
1027 setOptionsConfirmT:function() {
1028 OptionsConfirm(true);
1031 clickBusy: function() {
1032 NS
.div_overlay
.setEnable();
1035 suggestAllCame: function() {
1036 NS
.div_overlay
.setDisable();
1037 NS
.div_overlay_no_check
.setDisable();
1040 TextCorrect: function() {
1041 langConstructor(NS
.langList
);
1046 var handlerIncomingData = function(event
) {
1047 event
= event
|| window
.event
;
1048 var response
= window
.JSON
.parse(event
.data
);
1050 if(response
&& response
.id
) {
1051 handlerId
[response
.id
](response
);
1055 var handlerButtonOptions = function(event
) {
1056 event
= event
|| window
.event
;
1058 var currentTabId
= NS
.dialog
._
.currentTabId
,
1059 frameId
= NS
.iframeNumber
+ '_' + currentTabId
;
1061 appTools
.postMessage
.send({
1065 'target': NS
.targetFromFrame
[frameId
],
1071 var sendData = function(frameTarget
, cmd
, sendText
, reset_suggest
) {
1072 cmd
= cmd
|| CKEDITOR
.config
.wsc_cmd
;
1073 reset_suggest
= reset_suggest
|| false;
1074 sendText
= sendText
|| NS
.dataTemp
;
1076 appTools
.postMessage
.send({
1078 'customerId': NS
.wsc_customerId
,
1080 'txt_ctrl': NS
.TextAreaNumber
,
1082 'cust_dic_ids': NS
.cust_dic_ids
,
1083 'udn': NS
.userDictionaryName
,
1084 'slang': NS
.selectingLang
,
1085 'reset_suggest': reset_suggest
,
1086 'sessionid': NS
.sessionid
1088 'target': frameTarget
,
1089 'id': 'data_outer__page'
1092 NS
.div_overlay
.setEnable();
1097 onShow: function() {
1102 allowedTabCommands: {
1107 defaultTabCommand: "spell"
1110 onShow: function() {
1115 allowedTabCommands: {
1118 defaultTabCommand: "spell"
1121 onShow: function() {
1126 allowedTabCommands: {
1129 defaultTabCommand: "spell"
1132 onShow: function() {
1137 allowedTabCommands: {
1141 defaultTabCommand: "spell"
1144 onShow: function() {
1149 allowedTabCommands: {
1153 defaultTabCommand: "spell"
1157 var showFirstTab = function(scope
) {
1158 var cmdManger = function(cmdView
) {
1160 var _getCmd = function(cmd
) {
1161 for (var tabId
in cmdView
) {
1162 obj
[cmdView
[tabId
]] = tabId
;
1167 getCmdByTab: _getCmd
1171 var cmdM
= new cmdManger(NS
.cmd
),
1172 tabToOpen
= cmdM
.getCmdByTab(CKEDITOR
.config
.wsc_cmd
);
1174 scope
.selectPage(tabToOpen
);
1178 var showThesaurusTab = function() {
1179 NS
.dialog
.showPage('Thesaurus');
1182 var hideThesaurusTab = function() {
1183 NS
.dialog
.hidePage('Thesaurus');
1186 var showGrammTab = function() {
1187 NS
.dialog
.showPage('GrammTab');
1190 var hideGrammTab = function() {
1191 NS
.dialog
.hidePage('GrammTab');
1194 var showSpellTab = function() {
1195 NS
.dialog
.showPage('SpellTab');
1198 var hideSpellTab = function() {
1199 NS
.dialog
.hidePage('SpellTab');
1202 var showCurrentTabs = function() {
1203 var target
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'bottomGroup').getElement();
1205 target
.removeStyle('display');
1206 target
.removeStyle('position');
1207 target
.removeStyle('left');
1212 var hideCurrentTabs = function() {
1213 var target
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'bottomGroup').getElement(),
1214 activeElement
= document
.activeElement
,
1219 position: 'absolute',
1223 setTimeout(function() {
1224 target
.removeStyle('display');
1225 target
.removeStyle('position');
1226 target
.removeStyle('left');
1230 NS
.dialog
._
.editor
.focusManager
.currentActive
.focusNext();
1232 focusableElements
= appTools
.misc
.findFocusable(NS
.dialog
.parts
.contents
);
1233 if(!appTools
.misc
.hasClass(activeElement
, 'cke_dialog_tab') && !appTools
.misc
.hasClass(activeElement
, 'cke_dialog_contents_body') && appTools
.misc
.isVisible(activeElement
)) {
1235 activeElement
.focus();
1238 for(var i
= 0, tmpCkEl
; i
< focusableElements
.count(); i
++) {
1239 tmpCkEl
= focusableElements
.getItem(i
);
1240 if(appTools
.misc
.isVisible(tmpCkEl
.$)) {
1252 var showCurrentFinishChecking = function() {
1253 var target
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'BlockFinishChecking').getElement();
1255 target
.removeStyle('display');
1256 target
.removeStyle('position');
1257 target
.removeStyle('left');
1262 var hideCurrentFinishChecking = function() {
1263 var target
= NS
.dialog
.getContentElement(NS
.dialog
._
.currentTabId
, 'BlockFinishChecking').getElement(),
1264 activeElement
= document
.activeElement
,
1269 position: 'absolute',
1273 setTimeout(function() {
1274 target
.removeStyle('display');
1275 target
.removeStyle('position');
1276 target
.removeStyle('left');
1280 NS
.dialog
._
.editor
.focusManager
.currentActive
.focusNext();
1282 focusableElements
= appTools
.misc
.findFocusable(NS
.dialog
.parts
.contents
);
1283 if(!appTools
.misc
.hasClass(activeElement
, 'cke_dialog_tab') && !appTools
.misc
.hasClass(activeElement
, 'cke_dialog_contents_body') && appTools
.misc
.isVisible(activeElement
)) {
1285 activeElement
.focus();
1288 for(var i
= 0, tmpCkEl
; i
< focusableElements
.count(); i
++) {
1289 tmpCkEl
= focusableElements
.getItem(i
);
1290 if(appTools
.misc
.isVisible(tmpCkEl
.$)) {
1304 function __constructLangSelectbox(languageGroup
) {
1305 if( !languageGroup
) { throw "Languages-by-groups list are required for construct selectbox"; }
1310 priorLangTitle
= "",
1311 currLang
= NS
.selectingLang
;
1313 for ( var group
in languageGroup
){
1314 for ( var langCode
in languageGroup
[group
]){
1315 var langName
= languageGroup
[group
][langCode
];
1316 if ( langName
== priorLang
) {
1317 priorLangTitle
= langName
;
1319 o_arr
.push( langName
);
1325 if(priorLangTitle
) {
1326 o_arr
.unshift( priorLangTitle
);
1329 var searchGroup = function ( code
){
1330 for ( var group
in languageGroup
){
1331 for ( var langCode
in languageGroup
[group
]){
1332 if ( langCode
.toUpperCase() === code
.toUpperCase() ) {
1340 var _setLangList = function() {
1343 for (var group
in languageGroup
) {
1344 for ( var langCode
in languageGroup
[group
]){
1345 langList
[languageGroup
[group
][langCode
]] = langCode
;
1352 getCurrentLangGroup: function(code
) {
1353 return searchGroup(code
);
1355 setLangList: _setLangList()
1361 CKEDITOR
.dialog
.add('checkspell', function(editor
) {
1362 var handlerButtons = function(event
) {
1363 event
= event
|| window
.event
;
1365 // because in chrome and safary document.activeElement returns <body> tag. We need to signal that clicked element is active
1366 this.getElement().focus();
1368 NS
.div_overlay
.setEnable();
1369 var currentTabId
= NS
.dialog
._
.currentTabId
,
1370 frameId
= NS
.iframeNumber
+ '_' + currentTabId
,
1371 new_word
= NS
.textNode
[currentTabId
].getValue(),
1372 cmd
= this.getElement().getAttribute("title-cmd");
1374 appTools
.postMessage
.send({
1377 'tabId': currentTabId
,
1378 'new_word': new_word
1380 'target': NS
.targetFromFrame
[frameId
],
1381 'id': 'cmd_outer__page'
1384 if (cmd
== 'ChangeTo' || cmd
== 'ChangeAll') {
1385 editor
.fire('saveSnapshot');
1388 if (cmd
== 'FinishChecking') {
1389 editor
.config
.wsc_onFinish
.call(CKEDITOR
.document
.getWindow().getFrame());
1398 function initView(dialog
) {
1399 var newViewSettings
= {
1400 left: parseInt(editor
.config
.wsc_left
, 10),
1401 top: parseInt(editor
.config
.wsc_top
, 10),
1402 width: parseInt(editor
.config
.wsc_width
, 10),
1403 height: parseInt(editor
.config
.wsc_height
, 10)
1405 viewSize
= CKEDITOR
.document
.getWindow().getViewPaneSize(),
1406 currentPosition
= dialog
.getPosition(),
1407 currentSize
= dialog
.getSize(),
1410 if(!dialog
._
.resized
) {
1411 var wrapperHeight
= currentSize
.height
- dialog
.parts
.contents
.getSize('height', !(CKEDITOR
.env
.gecko
|| CKEDITOR
.env
.opera
|| CKEDITOR
.env
.ie
&& CKEDITOR
.env
.quirks
)),
1412 wrapperWidth
= currentSize
.width
- dialog
.parts
.contents
.getSize('width', 1);
1414 if(newViewSettings
.width
< constraints
.minWidth
|| isNaN(newViewSettings
.width
)) {
1415 newViewSettings
.width
= constraints
.minWidth
;
1417 if(newViewSettings
.width
> viewSize
.width
- wrapperWidth
) {
1418 newViewSettings
.width
= viewSize
.width
- wrapperWidth
;
1421 if(newViewSettings
.height
< constraints
.minHeight
|| isNaN(newViewSettings
.height
)) {
1422 newViewSettings
.height
= constraints
.minHeight
;
1424 if(newViewSettings
.height
> viewSize
.height
- wrapperHeight
) {
1425 newViewSettings
.height
= viewSize
.height
- wrapperHeight
;
1428 currentSize
.width
= newViewSettings
.width
+ wrapperWidth
;
1429 currentSize
.height
= newViewSettings
.height
+ wrapperHeight
;
1431 dialog
._
.fromResizeEvent
= false;
1432 dialog
.resize(newViewSettings
.width
, newViewSettings
.height
);
1433 setTimeout(function() {
1434 dialog
._
.fromResizeEvent
= false;
1435 CKEDITOR
.dialog
.fire('resize', {
1437 width: newViewSettings
.width
,
1438 height: newViewSettings
.height
1443 if(!dialog
._
.moved
) {
1444 savePosition
= isNaN(newViewSettings
.left
) && isNaN(newViewSettings
.top
) ? 0 : 1;
1446 if(isNaN(newViewSettings
.left
)) {
1447 newViewSettings
.left
= (viewSize
.width
- currentSize
.width
) / 2;
1449 if(newViewSettings
.left
< 0) {
1450 newViewSettings
.left
= 0;
1452 if(newViewSettings
.left
> viewSize
.width
- currentSize
.width
) {
1453 newViewSettings
.left
= viewSize
.width
- currentSize
.width
;
1456 if(isNaN(newViewSettings
.top
)) {
1457 newViewSettings
.top
= (viewSize
.height
- currentSize
.height
) / 2;
1459 if(newViewSettings
.top
< 0) {
1460 newViewSettings
.top
= 0;
1462 if(newViewSettings
.top
> viewSize
.height
- currentSize
.height
) {
1463 newViewSettings
.top
= viewSize
.height
- currentSize
.height
;
1466 dialog
.move(newViewSettings
.left
, newViewSettings
.top
, savePosition
);
1470 function createWscObjectForUdAndUdnSyncrhonization() {
1473 //DataStorage object for cookies and localStorage manipulation
1474 (function( object
) {
1477 var DataTypeManager
= {
1479 getDataType: function(value
) {
1482 if(typeof value
=== 'undefined') {
1484 } else if(value
=== null) {
1487 type
= Object
.prototype.toString
.call(value
).slice(8, -1);
1491 convertDataToString: function(value
) {
1493 type
= this.getDataType(value
).toLowerCase();
1495 str
= type
+ this.separator
+ value
;
1498 // get value type and convert value due to type, since all stored values are String
1499 restoreDataFromString: function(str
) {
1502 separatorStartIndex
;
1504 // @TODO: remove this line much later. Support of old format for options
1505 str
= this.backCompatibility(str
);
1507 if(typeof str
=== 'string') {
1508 separatorStartIndex
= str
.indexOf(this.separator
);
1509 type
= str
.substring(0, separatorStartIndex
);
1510 value
= str
.substring(separatorStartIndex
+ this.separator
.length
);
1514 value
= value
=== 'true';
1517 value
= parseFloat(value
);
1519 // we assume that we will store string values only, due to performance
1521 value
= value
=== '' ? [] : value
.split(',');
1533 // old data type support
1534 // here we trying to convert data from old format into new
1535 // @TODO: remove this function much later
1536 backCompatibility: function(str
) {
1537 var convertedStr
= str
,
1539 separatorStartIndex
;
1541 if(typeof str
=== 'string') {
1542 separatorStartIndex
= str
.indexOf(this.separator
);
1543 // is it old format?
1544 if(separatorStartIndex
< 0) {
1545 // try to get number from string
1546 value
= parseFloat(str
);
1547 // is it not a number?
1549 // yes, this is not a number. Lets check is this is an array "[comma,separated,values]"
1550 if((str
[0] === '[') && (str
[str
.length
- 1] === ']')) {
1551 // this is an array. Lets remove brackets symbols and extract the words
1552 str
= str
.replace('[', '');
1553 str
= str
.replace(']', '');
1557 value
= str
.split(',');
1559 // value = str === '[]' ? [] : str.split(',');
1560 } else if(str
=== 'true' || str
=== 'false') {
1561 // this is boolean value
1562 value
= str
=== 'true';
1569 convertedStr
= this.convertDataToString(value
);
1573 return convertedStr
;
1577 var LocalStorage
= {
1579 get: function( key
) {
1580 var value
= DataTypeManager
.restoreDataFromString( window
.localStorage
.getItem(key
) );
1584 set: function( key
, value
) {
1585 var _value
= DataTypeManager
.convertDataToString( value
);
1586 window
.localStorage
.setItem( key
, _value
);
1589 del: function( key
) {
1590 window
.localStorage
.removeItem( key
);
1594 window
.localStorage
.clear();
1598 var CookiesStorage
= {
1600 expiration: (function() {
1601 return 60 * 60 * 24 * 366;
1604 get: function(key
) {
1605 var value
= DataTypeManager
.restoreDataFromString(this.getCookie(key
));
1609 set: function(key
, value
) {
1610 var _value
= DataTypeManager
.convertDataToString(value
);
1611 this.setCookie(key
, _value
, {expires: this.expiration
});
1614 del: function(key
) {
1615 this.deleteCookie(key
);
1618 getCookie: function(name
) {
1619 var matches
= document
.cookie
.match(new RegExp("(?:^|; )" + name
.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"));
1620 return matches
? decodeURIComponent(matches
[1]) : undefined;
1623 setCookie: function(name
, value
, props
) {
1624 props
= props
|| {};
1625 var exp
= props
.expires
;
1627 if (typeof exp
=== "number" && exp
) {
1630 d
.setTime(d
.getTime() + exp
* 1000);
1631 exp
= props
.expires
= d
;
1634 if(exp
&& exp
.toUTCString
) {
1635 props
.expires
= exp
.toUTCString();
1638 value
= encodeURIComponent(value
);
1639 var updatedCookie
= name
+ "=" + value
;
1641 for(var propName
in props
) {
1642 var propValue
= props
[propName
];
1644 updatedCookie
+= "; " + propName
;
1646 if(propValue
!== true) {
1647 updatedCookie
+= "=" + propValue
;
1651 document
.cookie
= updatedCookie
;
1654 deleteCookie: function(name
) {
1655 this.setCookie(name
, null, {expires: -1});
1658 // delete all cookies
1660 var cookies
= document
.cookie
.split(";");
1662 for (var i
= 0; i
< cookies
.length
; i
++) {
1663 var cookie
= cookies
[i
];
1664 var eqPos
= cookie
.indexOf("=");
1665 var name
= eqPos
> -1 ? cookie
.substr(0, eqPos
) : cookie
;
1667 this.deleteCookie(name
);
1672 var strategy
= window
.localStorage
? LocalStorage : CookiesStorage
;
1675 // Get data within storage for key
1676 getData: function( key
) {
1677 return strategy
.get( key
);
1680 // Set data within storage
1681 setData: function( key
, value
) {
1682 strategy
.set( key
, value
);
1685 // Delete data within storage for key
1686 deleteData: function( key
) {
1687 strategy
.del( key
);
1696 // Static Module of Storage Data in the localStorage.
1697 object
.DataStorage
= DataStorage
;
1700 editor
.wsc
.operationWithUDN = function(command
, UDName
) {
1703 'id': 'operationWithUDN',
1706 var currentTabId
= NS
.dialog
._
.currentTabId
,
1707 frameId
= NS
.iframeNumber
+ '_' + currentTabId
;
1709 appTools
.postMessage
.send({
1711 'target': NS
.targetFromFrame
[frameId
]
1714 editor
.wsc
.getLocalStorageUDN = function() {
1715 var udn
= editor
.wsc
.DataStorage
.getData('scayt_user_dictionary_name');
1723 editor
.wsc
.getLocalStorageUD = function() {
1724 var ud
= editor
.wsc
.DataStorage
.getData('scayt_user_dictionary');
1732 editor
.wsc
.addWords = function(words
, callback
) {
1733 var url
= editor
.config
.wsc
.DefaultParams
.serviceHost
+ editor
.config
.wsc
.DefaultParams
.ssrvHost
+
1734 '?cmd=dictionary&format=json&' +
1735 'customerid=1%3AncttD3-fIoSf2-huzwE4-Y5muI2-mD0Tt-kG9Wz-UEDFC-tYu243-1Uq474-d9Z2l3&' +
1736 'action=addword&word='+ words
+ '&callback=toString&synchronization=true',
1737 script
= document
.createElement('script');
1739 script
['type'] = 'text/javascript';
1740 script
['src'] = url
;
1741 document
.getElementsByTagName("head")[0].appendChild(script
);
1743 //chrome, firefox, safari
1744 script
.onload
= callback
;
1747 script
.onreadystatechange = function() {
1748 if (this.readyState
=== 'loaded') {
1753 editor
.wsc
.cgiOrigin = function() {
1754 var wscServiceHostString
= editor
.config
.wsc
.DefaultParams
.serviceHost
,
1755 wscServiceHostArray
= wscServiceHostString
.split('/'),
1756 cgiOrigin
= wscServiceHostArray
[0] + '//' + wscServiceHostArray
[2];
1760 editor
.wsc
.isSsrvSame
= false;
1764 title: editor
.config
.wsc_dialogTitle
|| editor
.lang
.wsc
.title
,
1765 minWidth: constraints
.minWidth
,
1766 minHeight: constraints
.minHeight
,
1767 buttons: [CKEDITOR
.dialog
.cancelButton
],
1768 onLoad: function() {
1774 //creating wsc object for UD synchronization between wsc and scayt
1775 if (editor
.plugins
.scayt
) {
1776 createWscObjectForUdAndUdnSyncrhonization();
1779 onShow: function() {
1782 editor
.lockSelection(editor
.getSelection());
1784 NS
.TextAreaNumber
= 'cke_textarea_' + editor
.name
;
1785 appTools
.postMessage
.init(handlerIncomingData
);
1786 NS
.dataTemp
= editor
.getData();
1787 //NS.div_overlay.setDisable();
1788 NS
.OverlayPlace
= NS
.dialog
.parts
.tabs
.getParent().$;
1789 if(CKEDITOR
&& CKEDITOR
.config
){
1790 NS
.wsc_customerId
= editor
.config
.wsc_customerId
;
1791 NS
.cust_dic_ids
= editor
.config
.wsc_customDictionaryIds
;
1792 NS
.userDictionaryName
= editor
.config
.wsc_userDictionaryName
;
1793 NS
.defaultLanguage
= CKEDITOR
.config
.defaultLanguage
;
1794 var protocol
= document
.location
.protocol
== "file:" ? "http:" : document
.location
.protocol
;
1795 var wscCoreUrl
= editor
.config
.wsc_customLoaderScript
|| ( protocol
+ '//loader.webspellchecker.net/sproxy_fck/sproxy.php?plugin=fck2&customerid=' + NS
.wsc_customerId
+ '&cmd=script&doc=wsc&schema=22');
1803 CKEDITOR
.scriptLoader
.load(wscCoreUrl
, function(success
) {
1804 if(CKEDITOR
.config
&& CKEDITOR
.config
.wsc
&& CKEDITOR
.config
.wsc
.DefaultParams
){
1805 NS
.serverLocationHash
= CKEDITOR
.config
.wsc
.DefaultParams
.serviceHost
;
1806 NS
.logotype
= CKEDITOR
.config
.wsc
.DefaultParams
.logoPath
;
1807 NS
.loadIcon
= CKEDITOR
.config
.wsc
.DefaultParams
.iconPath
;
1808 NS
.loadIconEmptyEditor
= CKEDITOR
.config
.wsc
.DefaultParams
.iconPathEmptyEditor
;
1809 NS
.LangComparer
= new CKEDITOR
.config
.wsc
.DefaultParams
._SP_FCK_LangCompare();
1811 NS
.serverLocationHash
= DefaultParams
.serviceHost
;
1812 NS
.logotype
= DefaultParams
.logoPath
;
1813 NS
.loadIcon
= DefaultParams
.iconPath
;
1814 NS
.loadIconEmptyEditor
= DefaultParams
.iconPathEmptyEditor
;
1815 NS
.LangComparer
= new _SP_FCK_LangCompare();
1818 NS
.pluginPath
= CKEDITOR
.getUrl(editor
.plugins
.wsc
.path
);
1819 NS
.iframeNumber
= NS
.TextAreaNumber
;
1820 NS
.templatePath
= NS
.pluginPath
+ 'dialogs/tmp.html';
1821 NS
.LangComparer
.setDefaulLangCode( NS
.defaultLanguage
);
1822 NS
.currentLang
= editor
.config
.wsc_lang
|| NS
.LangComparer
.getSPLangCode( editor
.langCode
) || 'en_US';
1823 NS
.selectingLang
= NS
.currentLang
;
1824 NS
.div_overlay
= new overlayBlock({
1826 background: "#fff url(" + NS
.loadIcon
+ ") no-repeat 50% 50%",
1827 target: NS
.OverlayPlace
1831 var number_ck
= NS
.dialog
.parts
.tabs
.getId(),
1832 dialogPartsTab
= CKEDITOR
.document
.getById(number_ck
);
1834 dialogPartsTab
.setStyle('width', '97%');
1835 if (!dialogPartsTab
.getElementsByTag('DIV').count()){
1836 dialogPartsTab
.append(NS
.buildSelectLang(NS
.dialog
.getParentEditor().name
));
1839 NS
.div_overlay_no_check
= new overlayBlock({
1841 id: 'no_check_over',
1842 background: "#fff url(" + NS
.loadIconEmptyEditor
+ ") no-repeat 50% 50%",
1843 target: NS
.OverlayPlace
1847 showFirstTab(NS
.dialog
);
1848 NS
.dialog
.setupContent(NS
.dialog
);
1851 if (editor
.plugins
.scayt
) {
1852 //is ssrv.cgi path for WSC and scayt same
1853 editor
.wsc
.isSsrvSame
= (function() {
1854 var wscSsrvWholePath
,
1855 wscServiceHost
= CKEDITOR
.config
.wsc
.DefaultParams
.serviceHost
.replace('lf/22/js/../../../', '').split('//')[1],
1856 wscSsrvHost
= CKEDITOR
.config
.wsc
.DefaultParams
.ssrvHost
,
1862 scaytSrcUrl
= editor
.config
.scayt_srcUrl
,
1863 scaytSsrvSrcUrlSsrvProtocol
,
1864 scaytSsrvSrcUrlSsrvHost
,
1865 scaytSsrvSrcUrlSsrvPath
,
1868 scaytBasePathSsrvProtocol
,
1869 scaytBasePathSsrvHost
,
1870 scaytBasePathSsrvPath
;
1872 if (window
.SCAYT
&& window
.SCAYT
.CKSCAYT
) {
1873 scaytBasePath
= SCAYT
.CKSCAYT
.prototype.basePath
;
1874 scaytBasePathSsrvProtocol
= scaytBasePath
.split('//')[0];
1875 scaytBasePathSsrvHost
= scaytBasePath
.split('//')[1].split('/')[0];
1876 scaytBasePathSsrvPath
= scaytBasePath
.split(scaytBasePathSsrvHost
+ '/')[1].replace('/lf/scayt3/ckscayt/', '') + '/script/ssrv.cgi';
1879 if (scaytSrcUrl
&& !scaytBasePath
&& !editor
.config
.scayt_servicePath
) {
1880 scaytSsrvSrcUrlSsrvProtocol
= scaytSrcUrl
.split('//')[0];
1881 scaytSsrvSrcUrlSsrvHost
= scaytSrcUrl
.split('//')[1].split('/')[0];
1882 scaytSsrvSrcUrlSsrvPath
= scaytSrcUrl
.split(scaytSsrvSrcUrlSsrvHost
+ '/')[1].replace('/lf/scayt3/ckscayt/ckscayt.js', '') + '/script/ssrv.cgi';
1885 scaytSsrvProtocol
= editor
.config
.scayt_serviceProtocol
|| scaytBasePathSsrvProtocol
|| scaytSsrvSrcUrlSsrvProtocol
;
1886 scaytSsrvHost
= editor
.config
.scayt_serviceHost
|| scaytBasePathSsrvHost
|| scaytSsrvSrcUrlSsrvHost
;
1887 scaytSsrvPath
= editor
.config
.scayt_servicePath
|| scaytBasePathSsrvPath
|| scaytSsrvSrcUrlSsrvPath
;
1889 wscSsrvWholePath
= '//' + wscServiceHost
+ wscSsrvHost
;
1890 scaytSsrvWholePath
= '//' + scaytSsrvHost
+ '/' + scaytSsrvPath
;
1892 return wscSsrvWholePath
=== scaytSsrvWholePath
;
1896 //wsc on scayt UserDictionary and UserDictionaryName synchronization
1897 if (window
.SCAYT
&& editor
.wsc
&& editor
.wsc
.isSsrvSame
) {
1898 var cgiOrigin
= editor
.wsc
.cgiOrigin();
1899 editor
.wsc
.syncIsDone
= false;
1901 var getUdOrUdn = function (e
) {
1902 if (e
.origin
=== cgiOrigin
) {
1903 var data
= JSON
.parse(e
.data
);
1905 if (data
.ud
&& data
.ud
!== 'undefined') {
1906 editor
.wsc
.ud
= data
.ud
;
1907 } else if (data
.ud
=== 'undefined') {
1908 editor
.wsc
.ud
= undefined;
1911 if (data
.udn
&& data
.udn
!== 'undefined') {
1912 editor
.wsc
.udn
= data
.udn
;
1913 } else if (data
.udn
=== 'undefined') {
1914 editor
.wsc
.udn
= undefined;
1917 if (!editor
.wsc
.syncIsDone
) {
1918 udSynchronization(editor
.wsc
.ud
);
1919 editor
.wsc
.syncIsDone
= true;
1924 var udSynchronization = function(cookieUd
) {
1925 var localStorageUdArray
= editor
.wsc
.getLocalStorageUD(),
1928 if (localStorageUdArray
instanceof Array
) {
1929 newUd
= localStorageUdArray
.toString();
1932 if (newUd
!== undefined && newUd
!== '') {
1933 setTimeout(function() {
1934 editor
.wsc
.addWords(newUd
, function() {
1935 showFirstTab(NS
.dialog
);
1936 NS
.dialog
.setupContent(NS
.dialog
);
1942 if (window
.addEventListener
){
1943 addEventListener("message", getUdOrUdn
, false);
1945 window
.attachEvent("onmessage", getUdOrUdn
);
1948 //wsc on scayt UserDictionaryName synchronization
1951 var udn
= editor
.wsc
.getLocalStorageUDN();
1953 if (udn
!== undefined) {
1954 editor
.wsc
.operationWithUDN('restore', udn
);
1958 500); //need to wait spell.js file to load
1964 onHide: function() {
1965 var scaytPlugin
= CKEDITOR
.plugins
.scayt
,
1966 scaytInstance
= editor
.scayt
;
1968 editor
.unlockSelection();
1970 if(scaytPlugin
&& scaytInstance
&& scaytPlugin
.state
[editor
.name
]) {
1971 scaytInstance
.setMarkupPaused(false);
1976 appTools
.postMessage
.unbindHandler(handlerIncomingData
);
1978 //scayt on wsc UserDictionary and UserDictionaryName synchronization
1979 if (editor
.plugins
.scayt
&& editor
.wsc
&& editor
.wsc
.isSsrvSame
) {
1980 var wscUDN
= editor
.wsc
.udn
,
1981 wscUD
= editor
.wsc
.ud
,
1985 if (editor
.scayt
) { // if SCAYT active
1987 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary_name', '');
1988 editor
.scayt
.removeUserDictionary();
1990 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary_name', wscUDN
);
1991 editor
.scayt
.restoreUserDictionary(wscUDN
);
1995 setTimeout(function() {
1996 wscUDarray
= wscUD
.split(',');
1997 for (i
= 0; i
< wscUDarray
.length
; i
+= 1) {
1998 editor
.scayt
.addWordToUserDictionary(wscUDarray
[i
]);
2000 }, 200); //wait for 'removeUserDictionary' command response
2004 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary', []);
2007 } else { //if SCAYT not active
2010 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary_name', '');
2012 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary_name', wscUDN
);
2016 wscUDarray
= wscUD
.split(',');
2017 editor
.wsc
.DataStorage
.setData('scayt_user_dictionary', wscUDarray
);
2025 label: 'SpellChecker',
2038 label: 'spellContent',
2040 setup: function(dialog
) {
2041 var tabId
= NS
.iframeNumber
+ '_' + dialog
._
.currentTabId
;
2042 var iframe
= document
.getElementById(tabId
);
2043 NS
.targetFromFrame
[tabId
] = iframe
.contentWindow
;
2049 style: 'width:560px; margin: 0 auto;',
2050 widths: ['50%', '50%'],
2061 widths: ['50%', '50%'],
2065 id: 'ChangeTo_label',
2066 label: NS
.LocalizationLabel
['ChangeTo_label'].text
+ ':',
2067 labelLayout: 'horizontal',
2068 labelStyle: 'font: 12px/25px arial, sans-serif;',
2071 onShow: function() {
2072 NS
.textNode
['SpellTab'] = this;
2073 NS
.LocalizationLabel
['ChangeTo_label'].instance
= this;
2075 onHide: function() {
2087 id: 'rightCol_col__left',
2091 id: 'labelSuggestions',
2092 label: NS
.LocalizationLabel
['Suggestions'].text
+ ':',
2093 onShow: function() {
2094 NS
.LocalizationLabel
['Suggestions'].instance
= this;
2095 this.getInputElement().setStyles({
2103 html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
2104 setup: function(dialog
) {
2105 this.getElement().$.src
= NS
.logotype
;
2106 this.getElement().getParent().setStyles({
2107 "text-align": "left"
2115 id: 'list_of_suggestions',
2116 labelStyle: 'font: 12px/25px arial, sans-serif;',
2118 inputStyle: 'width: 140px; height: auto;',
2119 items: [['loading...']],
2120 onShow: function() {
2123 onChange: function() {
2124 NS
.textNode
['SpellTab'].setValue(this.getValue());
2141 id: 'rightCol_col__left',
2142 widths: ['50%', '50%', '50%', '50%'],
2146 id: 'ChangeTo_button',
2147 label: NS
.LocalizationButton
['ChangeTo_button'].text
,
2149 style: 'width: 100%;',
2150 onLoad: function() {
2151 this.getElement().setAttribute("title-cmd", 'ChangeTo');
2152 NS
.LocalizationButton
['ChangeTo_button'].instance
= this;
2154 onClick: handlerButtons
2159 label: NS
.LocalizationButton
['ChangeAll'].text
,
2160 title: 'Change All',
2161 style: 'width: 100%;',
2162 onLoad: function() {
2163 this.getElement().setAttribute("title-cmd", this.id
);
2164 NS
.LocalizationButton
['ChangeAll'].instance
= this;
2166 onClick: handlerButtons
2171 label: NS
.LocalizationButton
['AddWord'].text
,
2173 style: 'width: 100%;',
2174 onLoad: function() {
2175 this.getElement().setAttribute("title-cmd", this.id
);
2176 NS
.LocalizationButton
['AddWord'].instance
= this;
2178 onClick: handlerButtons
2182 id: 'FinishChecking_button',
2183 label: NS
.LocalizationButton
['FinishChecking_button'].text
,
2184 title: 'Finish Checking',
2185 style: 'width: 100%;margin-top: 9px;',
2186 onLoad: function() {
2187 this.getElement().setAttribute("title-cmd", 'FinishChecking');
2188 NS
.LocalizationButton
['FinishChecking_button'].instance
= this;
2190 onClick: handlerButtons
2196 id: 'rightCol_col__right',
2197 widths: ['50%', '50%', '50%'],
2202 label: NS
.LocalizationButton
['IgnoreWord'].text
,
2203 title: 'Ignore word',
2204 style: 'width: 100%;',
2205 onLoad: function() {
2206 this.getElement().setAttribute("title-cmd", this.id
);
2207 NS
.LocalizationButton
['IgnoreWord'].instance
= this;
2209 onClick: handlerButtons
2213 id: 'IgnoreAllWords',
2214 label: NS
.LocalizationButton
['IgnoreAllWords'].text
,
2215 title: 'Ignore all words',
2216 style: 'width: 100%;',
2217 onLoad: function() {
2218 this.getElement().setAttribute("title-cmd", this.id
);
2219 NS
.LocalizationButton
['IgnoreAllWords'].instance
= this;
2221 onClick: handlerButtons
2226 label: NS
.LocalizationButton
['Options'].text
,
2228 style: 'width: 100%;',
2229 onLoad: function() {
2230 NS
.LocalizationButton
['Options'].instance
= this;
2231 if (document
.location
.protocol
== "file:") {
2235 onClick: function() {
2236 // because in chrome and safary document.activeElement returns <body> tag. We need to signal that clicked element is active
2237 this.getElement().focus();
2239 if (document
.location
.protocol
== "file:") {
2240 alert('WSC: Options functionality is disabled when runing from file system');
2242 activeElement
= document
.activeElement
;
2243 editor
.openDialog('options');
2255 id: 'BlockFinishChecking',
2256 style: 'width:560px; margin: 0 auto;',
2257 widths: ['70%', '30%'],
2258 onShow: function() {
2259 this.getElement().setStyles({
2261 position: 'absolute',
2265 onHide: showCurrentTabs
,
2277 this.getChild()[0].getElement().$.src
= NS
.logotype
;
2278 this.getChild()[0].getElement().getParent().setStyles({
2279 "text-align": "center"
2286 html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">'
2300 id: 'rightCol_col__left',
2304 id: 'Option_button',
2305 label: NS
.LocalizationButton
['Options'].text
,
2307 style: 'width: 100%;',
2308 onLoad: function() {
2309 this.getElement().setAttribute("title-cmd", this.id
);
2310 if (document
.location
.protocol
== "file:") {
2314 onClick: function() {
2315 // because in chrome and safary document.activeElement returns <body> tag. We need to signal that clicked element is active
2316 this.getElement().focus();
2318 if (document
.location
.protocol
== "file:") {
2319 alert('WSC: Options functionality is disabled when runing from file system');
2321 activeElement
= document
.activeElement
;
2322 editor
.openDialog('options');
2328 id: 'FinishChecking_button_block',
2329 label: NS
.LocalizationButton
['FinishChecking_button_block'].text
,
2330 title: 'Finish Checking',
2331 style: 'width: 100%;',
2332 onLoad: function() {
2333 this.getElement().setAttribute("title-cmd", 'FinishChecking');
2335 onClick: handlerButtons
2360 label: 'GrammarContent',
2363 var tabId
= NS
.iframeNumber
+ '_' + NS
.dialog
._
.currentTabId
;
2364 var iframe
= document
.getElementById(tabId
);
2365 NS
.targetFromFrame
[tabId
] = iframe
.contentWindow
;
2371 style: 'width:560px; margin: 0 auto;',
2376 widths: ['66%', '34%'],
2384 label: "Change to:",
2385 labelLayout: 'horizontal',
2386 labelStyle: 'font: 12px/25px arial, sans-serif;',
2387 inputStyle: 'float: right; width: 200px;',
2389 onShow: function() {
2390 NS
.textNode
['GrammTab'] = this;
2392 onHide: function() {
2399 html: "<div style='min-height: 17px; line-height: 17px; padding: 5px; text-align: left;background: #F1F1F1;color: #595959; white-space: normal!important;'></div>",
2400 onShow: function(e
) {
2401 NS
.textNodeInfo
['GrammTab'] = this;
2408 onShow: function() {
2409 NS
.grammerSuggest
= this;
2419 id: 'ChangeTo_button',
2422 style: 'width: 133px; float: right;',
2423 onLoad: function() {
2424 this.getElement().setAttribute("title-cmd", 'ChangeTo');
2426 onClick: handlerButtons
2431 label: 'Ignore word',
2432 title: 'Ignore word',
2433 style: 'width: 133px; float: right;',
2434 onLoad: function() {
2435 this.getElement().setAttribute("title-cmd", this.id
);
2437 onClick: handlerButtons
2441 id: 'IgnoreAllWords',
2442 label: 'Ignore Problem',
2443 title: 'Ignore Problem',
2444 style: 'width: 133px; float: right;',
2445 onLoad: function() {
2446 this.getElement().setAttribute("title-cmd", this.id
);
2448 onClick: handlerButtons
2452 id: 'FinishChecking_button',
2453 label: NS
.LocalizationButton
['FinishChecking_button'].text
,
2454 title: 'Finish Checking',
2455 style: 'width: 133px; float: right; margin-top: 9px;',
2456 onLoad: function() {
2457 this.getElement().setAttribute("title-cmd", 'FinishChecking');
2459 onClick: handlerButtons
2469 id: 'BlockFinishChecking',
2470 style: 'width:560px; margin: 0 auto;',
2471 widths: ['70%', '30%'],
2472 onShow: function() {
2473 this.getElement().setStyles({
2475 position: 'absolute',
2479 onHide: showCurrentTabs
,
2494 html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
2496 this.getElement().$.src
= NS
.logotype
;
2497 this.getElement().getParent().setStyles({
2498 "text-align": "center"
2514 id: 'rightCol_col__left',
2518 id: 'FinishChecking_button_block',
2519 label: NS
.LocalizationButton
['FinishChecking_button_block'].text
,
2520 title: 'Finish Checking',
2521 style: 'width: 100%;',
2522 onLoad: function() {
2523 this.getElement().setAttribute("title-cmd", 'FinishChecking');
2525 onClick: handlerButtons
2550 label: 'spellContent',
2553 var tabId
= NS
.iframeNumber
+ '_' + NS
.dialog
._
.currentTabId
;
2554 var iframe
= document
.getElementById(tabId
);
2555 NS
.targetFromFrame
[tabId
] = iframe
.contentWindow
;
2561 style: 'width:560px; margin: -10px auto; overflow: hidden;',
2565 widths: ['75%', '25%'],
2572 widths: ['65%', '35%'],
2576 id: 'ChangeTo_label',
2577 label: NS
.LocalizationLabel
['ChangeTo_label'].text
+ ':',
2578 labelLayout: 'horizontal',
2579 inputStyle: 'width: 160px;',
2580 labelStyle: 'font: 12px/25px arial, sans-serif;',
2582 onShow: function(e
) {
2583 NS
.textNode
['Thesaurus'] = this;
2584 NS
.LocalizationLabel
['ChangeTo_label'].instance
= this;
2586 onHide: function() {
2592 id: 'ChangeTo_button',
2593 label: NS
.LocalizationButton
['ChangeTo_button'].text
,
2595 style: 'width: 121px; margin-top: 1px;',
2596 onLoad: function() {
2597 this.getElement().setAttribute("title-cmd", 'ChangeTo');
2598 NS
.LocalizationButton
['ChangeTo_button'].instance
= this;
2600 onClick: handlerButtons
2610 label: NS
.LocalizationLabel
['Categories'].text
+ ':',
2611 labelStyle: 'font: 12px/25px arial, sans-serif;',
2613 inputStyle: 'width: 180px; height: auto;',
2615 onShow: function() {
2616 NS
.selectNode
['Categories'] = this;
2617 NS
.LocalizationLabel
['Categories'].instance
= this;
2619 onChange: function() {
2620 NS
.buildOptionSynonyms(this.getValue());
2626 label: NS
.LocalizationLabel
['Synonyms'].text
+ ':',
2627 labelStyle: 'font: 12px/25px arial, sans-serif;',
2629 inputStyle: 'width: 180px; height: auto;',
2631 onShow: function() {
2632 NS
.selectNode
['Synonyms'] = this;
2633 NS
.textNode
['Thesaurus'].setValue(this.getValue());
2634 NS
.LocalizationLabel
['Synonyms'].instance
= this;
2636 onChange: function(e
) {
2637 NS
.textNode
['Thesaurus'].setValue(this.getValue());
2647 style: "margin-top:46px;",
2652 label: 'WebSpellChecker.net',
2653 html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
2655 this.getElement().$.src
= NS
.logotype
;
2656 this.getElement().getParent().setStyles({
2657 "text-align": "center"
2663 id: 'FinishChecking_button',
2664 label: NS
.LocalizationButton
['FinishChecking_button'].text
,
2665 title: 'Finish Checking',
2666 style: 'width: 100%; float: right; margin-top: 9px;',
2667 onLoad: function() {
2668 this.getElement().setAttribute("title-cmd", 'FinishChecking');
2670 onClick: handlerButtons
2680 id: 'BlockFinishChecking',
2681 style: 'width:560px; margin: 0 auto;',
2682 widths: ['70%', '30%'],
2683 onShow: function() {
2684 this.getElement().setStyles({
2686 position: 'absolute',
2704 html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
2706 this.getElement().$.src
= NS
.logotype
;
2707 this.getElement().getParent().setStyles({
2708 "text-align": "center"
2724 id: 'rightCol_col__left',
2728 id: 'FinishChecking_button_block',
2729 label: NS
.LocalizationButton
['FinishChecking_button_block'].text
,
2730 title: 'Finish Checking',
2731 style: 'width: 100%;',
2732 onLoad: function() {
2733 this.getElement().setAttribute("title-cmd", 'FinishChecking');
2735 onClick: handlerButtons
2749 var activeElement
= null;
2752 CKEDITOR
.dialog
.add('options', function(editor
) {
2754 var linkOnCheckbox
= {};
2755 var checkboxState
= {};
2756 var ospString
= null;
2757 var OptionsTextError
= null;
2761 var dictionaryState
= {
2762 'udn': appTools
.cookie
.get('udn'),
2763 'osp': appTools
.cookie
.get('osp')
2766 var setHandlerOptions = function() {
2767 var osp
= appTools
.cookie
.get('osp'),
2768 strToArr
= osp
.split("");
2770 checkboxState
['IgnoreAllCapsWords'] = strToArr
[0];
2771 checkboxState
['IgnoreWordsNumbers'] = strToArr
[1];
2772 checkboxState
['IgnoreMixedCaseWords'] = strToArr
[2];
2773 checkboxState
['IgnoreDomainNames'] = strToArr
[3];
2776 var sendDicOptions = function(event
) {
2777 event
= event
|| window
.event
;
2778 cmd
= this.getElement().getAttribute("title-cmd");
2781 osp
[0] = checkboxState
['IgnoreAllCapsWords'];
2782 osp
[1] = checkboxState
['IgnoreWordsNumbers'];
2783 osp
[2] = checkboxState
['IgnoreMixedCaseWords'];
2784 osp
[3] = checkboxState
['IgnoreDomainNames'];
2786 osp
= osp
.toString().replace(/,/g
, "");
2789 appTools
.cookie
.set('osp', osp
);
2790 appTools
.cookie
.set('udnCmd', cmd
? cmd : 'ignore');
2791 if (cmd
== "delete") {
2793 appTools
.postMessage
.send({
2794 'id': 'options_dic_send'
2798 if(nameNode
.getValue() !== ''){
2799 udn
= nameNode
.getValue();
2801 appTools
.cookie
.set('udn', udn
);
2802 appTools
.postMessage
.send({
2803 'id': 'options_dic_send'
2810 var sendAllOptions = function() {
2813 osp
[0] = checkboxState
['IgnoreAllCapsWords'];
2814 osp
[1] = checkboxState
['IgnoreWordsNumbers'];
2815 osp
[2] = checkboxState
['IgnoreMixedCaseWords'];
2816 osp
[3] = checkboxState
['IgnoreDomainNames'];
2818 osp
= osp
.toString().replace(/,/g
, "");
2820 appTools
.cookie
.set('osp', osp
);
2822 appTools
.postMessage
.send({
2823 'id': 'options_checkbox_send'
2829 var cameOptions = function() {
2830 OptionsTextError
.getElement().setHtml(NS
.LocalizationComing
['error']);
2831 OptionsTextError
.getElement().show();
2835 title: NS
.LocalizationComing
['Options'],
2838 resizable: CKEDITOR
.DIALOG_RESIZE_NONE
,
2847 id: 'options_error',
2851 style: "display: block;text-align: center;white-space: normal!important; font-size: 12px;color:red",
2852 html: '<div></div>',
2853 onShow: function() {
2854 OptionsTextError
= this;
2861 id: 'Options_content',
2865 id: 'Options_manager',
2866 widths: ['52%', '48%'],
2870 label: 'Spell Checking Options',
2871 style: 'border: none;margin-top: 13px;padding: 10px 0 10px 10px',
2872 onShow: function() {
2873 this.getInputElement().$.children
[0].innerHTML
= NS
.LocalizationComing
['SpellCheckingOptions'];
2878 id: 'Options_checkbox',
2882 id: 'IgnoreAllCapsWords',
2883 label: 'Ignore All-Caps Words',
2884 labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
2885 style: "float:left; min-height: 16px;",
2887 onClick: function() {
2888 checkboxState
[this.id
] = (!this.getValue()) ? 0 : 1;
2893 id: 'IgnoreWordsNumbers',
2894 label: 'Ignore Words with Numbers',
2895 labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
2896 style: "float:left; min-height: 16px;",
2898 onClick: function() {
2899 checkboxState
[this.id
] = (!this.getValue()) ? 0 : 1;
2904 id: 'IgnoreMixedCaseWords',
2905 label: 'Ignore Mixed-Case Words',
2906 labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
2907 style: "float:left; min-height: 16px;",
2909 onClick: function() {
2910 checkboxState
[this.id
] = (!this.getValue()) ? 0 : 1;
2915 id: 'IgnoreDomainNames',
2916 label: 'Ignore Domain Names',
2917 labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
2918 style: "float:left; min-height: 16px;",
2920 onClick: function() {
2921 checkboxState
[this.id
] = (!this.getValue()) ? 0 : 1;
2930 id: 'Options_DictionaryName',
2934 id: 'DictionaryName',
2935 style: 'margin-bottom: 10px',
2936 label: 'Dictionary Name:',
2937 labelLayout: 'vertical',
2938 labelStyle: 'font: 12px/25px arial, sans-serif;',
2940 onLoad: function() {
2942 var udn
= NS
.userDictionaryName
? NS
.userDictionaryName : appTools
.cookie
.get('udn') && undefined ? ' ' : this.getValue();
2945 onShow: function() {
2947 var udn
= !appTools
.cookie
.get('udn') ? this.getValue() : appTools
.cookie
.get('udn');
2949 this.setLabel(NS
.LocalizationComing
['DictionaryName']);
2951 onHide: function() {
2957 id: 'Options_buttons',
2961 id: 'Options_leftCol_col',
2962 widths: ['50%', '50%'],
2969 style: 'width: 100%;',
2970 onLoad: function() {
2971 this.getElement().setAttribute("title-cmd", this.id
);
2973 onShow: function() {
2974 var el
= this.getElement().getFirst() || this.getElement();
2976 el
.setText(NS
.LocalizationComing
['Create']);
2978 onClick: sendDicOptions
2985 style: 'width: 100%;',
2986 onLoad: function() {
2987 this.getElement().setAttribute("title-cmd", this.id
);
2989 onShow: function() {
2990 var el
= this.getElement().getFirst() || this.getElement();
2992 el
.setText(NS
.LocalizationComing
['Restore']);
2994 onClick: sendDicOptions
3000 id: 'Options_rightCol_col',
3001 widths: ['50%', '50%'],
3008 style: 'width: 100%;',
3009 onLoad: function() {
3010 this.getElement().setAttribute("title-cmd", this.id
);
3012 onShow: function() {
3013 var el
= this.getElement().getFirst() || this.getElement();
3015 el
.setText(NS
.LocalizationComing
['Rename']);
3017 onClick: sendDicOptions
3024 style: 'width: 100%;',
3025 onLoad: function() {
3026 this.getElement().setAttribute("title-cmd", this.id
);
3028 onShow: function() {
3029 var el
= this.getElement().getFirst() || this.getElement();
3031 el
.setText(NS
.LocalizationComing
['Remove']);
3033 onClick: sendDicOptions
3049 style: "text-align: justify;margin-top: 15px;white-space: normal!important; font-size: 12px;color:#777;",
3050 html: "<div>" + NS
.LocalizationComing
['OptionsTextIntro'] + "</div>",
3051 onShow: function() {
3052 this.getElement().setText(NS
.LocalizationComing
['OptionsTextIntro']);
3062 buttons: [CKEDITOR
.dialog
.okButton
, CKEDITOR
.dialog
.cancelButton
],
3065 OptionsTextError
.getElement().hide();
3066 OptionsTextError
.getElement().setHtml(' ');
3068 onLoad: function() {
3070 // appTools.postMessage.init(cameOptions);
3072 linkOnCheckbox
['IgnoreAllCapsWords'] = dialog
.getContentElement('OptionsTab', 'IgnoreAllCapsWords');
3073 linkOnCheckbox
['IgnoreWordsNumbers'] = dialog
.getContentElement('OptionsTab', 'IgnoreWordsNumbers');
3074 linkOnCheckbox
['IgnoreMixedCaseWords'] = dialog
.getContentElement('OptionsTab', 'IgnoreMixedCaseWords');
3075 linkOnCheckbox
['IgnoreDomainNames'] = dialog
.getContentElement('OptionsTab', 'IgnoreDomainNames');
3078 onShow: function() {
3079 appTools
.postMessage
.init(cameOptions
);
3080 setHandlerOptions();
3082 (!parseInt(checkboxState
['IgnoreAllCapsWords'], 10)) ? linkOnCheckbox
['IgnoreAllCapsWords'].setValue('', false) : linkOnCheckbox
['IgnoreAllCapsWords'].setValue('checked', false);
3083 (!parseInt(checkboxState
['IgnoreWordsNumbers'], 10)) ? linkOnCheckbox
['IgnoreWordsNumbers'].setValue('', false) : linkOnCheckbox
['IgnoreWordsNumbers'].setValue('checked', false);
3084 (!parseInt(checkboxState
['IgnoreMixedCaseWords'], 10)) ? linkOnCheckbox
['IgnoreMixedCaseWords'].setValue('', false) : linkOnCheckbox
['IgnoreMixedCaseWords'].setValue('checked', false);
3085 (!parseInt(checkboxState
['IgnoreDomainNames'], 10)) ? linkOnCheckbox
['IgnoreDomainNames'].setValue('', false) : linkOnCheckbox
['IgnoreDomainNames'].setValue('checked', false);
3087 checkboxState
['IgnoreAllCapsWords'] = (!linkOnCheckbox
['IgnoreAllCapsWords'].getValue()) ? 0 : 1;
3088 checkboxState
['IgnoreWordsNumbers'] = (!linkOnCheckbox
['IgnoreWordsNumbers'].getValue()) ? 0 : 1;
3089 checkboxState
['IgnoreMixedCaseWords'] = (!linkOnCheckbox
['IgnoreMixedCaseWords'].getValue()) ? 0 : 1;
3090 checkboxState
['IgnoreDomainNames'] = (!linkOnCheckbox
['IgnoreDomainNames'].getValue()) ? 0 : 1;
3092 linkOnCheckbox
['IgnoreAllCapsWords'].getElement().$.lastChild
.innerHTML
= NS
.LocalizationComing
['IgnoreAllCapsWords'];
3093 linkOnCheckbox
['IgnoreWordsNumbers'].getElement().$.lastChild
.innerHTML
= NS
.LocalizationComing
['IgnoreWordsWithNumbers'];
3094 linkOnCheckbox
['IgnoreMixedCaseWords'].getElement().$.lastChild
.innerHTML
= NS
.LocalizationComing
['IgnoreMixedCaseWords'];
3095 linkOnCheckbox
['IgnoreDomainNames'].getElement().$.lastChild
.innerHTML
= NS
.LocalizationComing
['IgnoreDomainNames'];
3097 onHide: function() {
3098 appTools
.postMessage
.unbindHandler(cameOptions
);
3101 activeElement
.focus();
3108 // Expand the spell-check frame when dialog resized. (#6829)
3109 CKEDITOR
.dialog
.on( 'resize', function( evt
) {
3110 var data
= evt
.data
,
3111 dialog
= data
.dialog
,
3112 currentTabId
= dialog
._
.currentTabId
,
3113 tabID
= NS
.iframeNumber
+ '_' + currentTabId
,
3114 iframe
= CKEDITOR
.document
.getById(tabID
);
3116 if ( dialog
._
.name
== 'checkspell' ) {
3118 iframe
&& iframe
.setSize( 'height', data
.height
- '310' );
3120 iframe
&& iframe
.setSize( 'height', data
.height
- '220' );
3123 // add flag that indicate whether dialog has been resized by user
3124 if(dialog
._
.fromResizeEvent
&& !dialog
._
.resized
) {
3125 dialog
._
.resized
= true;
3127 dialog
._
.fromResizeEvent
= true;
3131 CKEDITOR
.on('dialogDefinition', function(dialogDefinitionEvent
) {
3133 if(dialogDefinitionEvent
.data
.name
=== 'checkspell') {
3134 var dialogDefinition
= dialogDefinitionEvent
.data
.definition
;
3136 NS
.onLoadOverlay
= new overlayBlock({
3139 target: dialogDefinition
.dialog
.parts
.tabs
.getParent().$
3142 NS
.onLoadOverlay
.setEnable();
3144 dialogDefinition
.dialog
.on('cancel', function(cancelEvent
) {
3145 dialogDefinition
.dialog
.getParentEditor().config
.wsc_onClose
.call(this.document
.getWindow().getFrame());
3146 NS
.div_overlay
.setDisable();
3147 NS
.onLoadOverlay
.setDisable();