]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/plugins/wsc/dialogs/wsc_ie.js
f47e507fde8d221a70c945921f43b64b106eecdb
2 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.html or http://ckeditor.com/license
6 CKEDITOR
.dialog
.add( 'checkspell', function( editor
) {
7 var number
= CKEDITOR
.tools
.getNextNumber(),
8 iframeId
= 'cke_frame_' + number
,
9 textareaId
= 'cke_data_' + number
,
10 errorBoxId
= 'cke_error_' + number
,
12 protocol
= document
.location
.protocol
|| 'http:',
13 errorMsg
= editor
.lang
.wsc
.notAvailable
;
17 ' style="display: none"' +
18 ' id="' + textareaId
+ '"' +
22 ' id="' + errorBoxId
+ '"' +
23 ' style="display:none;color:red;font-size:16px;font-weight:bold;padding-top:160px;text-align:center;z-index:11;">' +
26 ' style="width:100%;background-color:#f1f1e3;"' +
28 ' name="' + iframeId
+ '"' +
29 ' id="' + iframeId
+ '"' +
30 ' allowtransparency="1">' +
33 var wscCoreUrl
= editor
.config
.wsc_customLoaderScript
|| ( protocol
+ '//loader.webspellchecker.net/sproxy_fck/sproxy.php' + '?plugin=fck2'
34 + '&customerid=' + editor
.config
.wsc_customerId
35 + '&cmd=script&doc=wsc&schema=22'
38 if ( editor
.config
.wsc_customLoaderScript
) {
39 errorMsg
+= '<p style="color:#000;font-size:11px;font-weight: normal;text-align:center;padding-top:10px">' +
40 editor
.lang
.wsc
.errorLoading
.replace( /%s/g, editor
.config
.wsc_customLoaderScript
) + '</p>';
43 function burnSpelling( dialog
, errorMsg
) {
46 if ( typeof( window
.doSpell
) == 'function' ) {
47 //Call from window.setInteval expected at once.
48 if ( typeof( interval
) != 'undefined' )
49 window
.clearInterval( interval
);
51 initAndSpell( dialog
);
52 } else if ( i
++ == 180 ) // Timeout: 180 * 250ms = 45s.
53 window
._cancelOnError( errorMsg
);
57 window
._cancelOnError = function( m
) {
58 if ( typeof( window
.WSC_Error
) == 'undefined' ) {
59 CKEDITOR
.document
.getById( iframeId
).setStyle( 'display', 'none' );
60 var errorBox
= CKEDITOR
.document
.getById( errorBoxId
);
61 errorBox
.setStyle( 'display', 'block' );
62 errorBox
.setHtml( m
|| editor
.lang
.wsc
.notAvailable
);
66 function initAndSpell( dialog
) {
67 var LangComparer
= new window
._SP_FCK_LangCompare(),
68 // Language abbr standarts comparer.
69 pluginPath
= CKEDITOR
.getUrl( editor
.plugins
.wsc
.path
+ 'dialogs/' ),
70 // Service paths corecting/preparing.
71 framesetPath
= pluginPath
+ 'tmpFrameset.html';
73 // global var is used in FCK specific core
74 // change on equal var used in fckplugin.js
75 window
.gFCKPluginName
= 'wsc';
77 LangComparer
.setDefaulLangCode( editor
.config
.defaultLanguage
);
82 lang: editor
.config
.wsc_lang
|| LangComparer
.getSPLangCode( editor
.langCode
),
83 intLang: editor
.config
.wsc_uiLang
|| LangComparer
.getSPLangCode( editor
.langCode
),
84 winType: iframeId
, // If not defined app will run on winpopup.
86 // Callback binding section.
87 onCancel: function() {
90 onFinish: function( dT
) {
92 dialog
.getParentEditor().setData( dT
.value
);
96 // Some manipulations with client static pages.
97 staticFrame: framesetPath
,
98 framesetPath: framesetPath
,
99 iframePath: pluginPath
+ 'ciframe.html',
102 schemaURI: pluginPath
+ 'wsc.css',
104 userDictionaryName: editor
.config
.wsc_userDictionaryName
,
105 customDictionaryName: editor
.config
.wsc_customDictionaryIds
&& editor
.config
.wsc_customDictionaryIds
.split( "," ),
106 domainName: editor
.config
.wsc_domainName
110 // Hide user message console (if application was loaded more then after timeout).
111 CKEDITOR
.document
.getById( errorBoxId
).setStyle( 'display', 'none' );
112 CKEDITOR
.document
.getById( iframeId
).setStyle( 'display', 'block' );
116 title: editor
.config
.wsc_dialogTitle
|| editor
.lang
.wsc
.title
,
119 buttons: [ CKEDITOR
.dialog
.cancelButton
],
121 var contentArea
= this.getContentElement( 'general', 'content' ).getElement();
122 contentArea
.setHtml( pasteArea
);
123 contentArea
.getChild( 2 ).setStyle( 'height', this._
.contentSize
.height
+ 'px' );
125 if ( typeof( window
.doSpell
) != 'function' ) {
127 CKEDITOR
.document
.getHead().append( CKEDITOR
.document
.createElement( 'script', {
129 type: 'text/javascript',
135 var sData
= editor
.getData(); // Get the data to be checked.
137 CKEDITOR
.document
.getById( textareaId
).setValue( sData
);
139 interval
= window
.setInterval( burnSpelling( this, errorMsg
), 250 );
142 window
.ooo
= undefined;
143 window
.int_framsetLoaded
= undefined;
144 window
.framesetLoaded
= undefined;
145 window
.is_window_opened
= false;
150 label: editor
.config
.wsc_dialogTitle
|| editor
.lang
.wsc
.title
,
164 // Expand the spell-check frame when dialog resized. (#6829)
165 CKEDITOR
.dialog
.on( 'resize', function( evt
) {
167 dialog
= data
.dialog
;
169 if ( dialog
._
.name
== 'checkspell' ) {
170 var content
= dialog
.getContentElement( 'general', 'content' ).getElement(),
171 iframe
= content
&& content
.getChild( 2 );
173 iframe
&& iframe
.setSize( 'height', data
.height
);
174 iframe
&& iframe
.setSize( 'width', data
.width
);