diff options
Diffstat (limited to 'sources/core/_bootstrap.js')
-rw-r--r-- | sources/core/_bootstrap.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/sources/core/_bootstrap.js b/sources/core/_bootstrap.js new file mode 100644 index 00000000..dac236bd --- /dev/null +++ b/sources/core/_bootstrap.js | |||
@@ -0,0 +1,74 @@ | |||
1 | /** | ||
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | ||
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | ||
4 | */ | ||
5 | |||
6 | /** | ||
7 | * @fileOverview API initialization code. | ||
8 | */ | ||
9 | |||
10 | ( function() { | ||
11 | // Disable HC detection in WebKit. (#5429) | ||
12 | if ( CKEDITOR.env.webkit ) | ||
13 | CKEDITOR.env.hc = false; | ||
14 | else { | ||
15 | // Check whether high contrast is active by creating a colored border. | ||
16 | var hcDetect = CKEDITOR.dom.element.createFromHtml( '<div style="width:0;height:0;position:absolute;left:-10000px;' + | ||
17 | 'border:1px solid;border-color:red blue"></div>', CKEDITOR.document ); | ||
18 | |||
19 | hcDetect.appendTo( CKEDITOR.document.getHead() ); | ||
20 | |||
21 | // Update CKEDITOR.env. | ||
22 | // Catch exception needed sometimes for FF. (#4230) | ||
23 | try { | ||
24 | var top = hcDetect.getComputedStyle( 'border-top-color' ), | ||
25 | right = hcDetect.getComputedStyle( 'border-right-color' ); | ||
26 | |||
27 | // We need to check if getComputedStyle returned any value, because on FF | ||
28 | // it returnes empty string if CKEditor is loaded in hidden iframe. (#11121) | ||
29 | CKEDITOR.env.hc = !!( top && top == right ); | ||
30 | } catch ( e ) { | ||
31 | CKEDITOR.env.hc = false; | ||
32 | } | ||
33 | |||
34 | hcDetect.remove(); | ||
35 | } | ||
36 | |||
37 | if ( CKEDITOR.env.hc ) | ||
38 | CKEDITOR.env.cssClass += ' cke_hc'; | ||
39 | |||
40 | // Initially hide UI spaces when relevant skins are loading, later restored by skin css. | ||
41 | CKEDITOR.document.appendStyleText( '.cke{visibility:hidden;}' ); | ||
42 | |||
43 | // Mark the editor as fully loaded. | ||
44 | CKEDITOR.status = 'loaded'; | ||
45 | CKEDITOR.fireOnce( 'loaded' ); | ||
46 | |||
47 | // Process all instances created by the "basic" implementation. | ||
48 | var pending = CKEDITOR._.pending; | ||
49 | if ( pending ) { | ||
50 | delete CKEDITOR._.pending; | ||
51 | |||
52 | for ( var i = 0; i < pending.length; i++ ) { | ||
53 | CKEDITOR.editor.prototype.constructor.apply( pending[ i ][ 0 ], pending[ i ][ 1 ] ); | ||
54 | CKEDITOR.add( pending[ i ][ 0 ] ); | ||
55 | } | ||
56 | } | ||
57 | } )(); | ||
58 | |||
59 | /** | ||
60 | * Indicates that CKEditor is running on a High Contrast environment. | ||
61 | * | ||
62 | * if ( CKEDITOR.env.hc ) | ||
63 | * alert( 'You\'re running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' ); | ||
64 | * | ||
65 | * @property {Boolean} hc | ||
66 | * @member CKEDITOR.env | ||
67 | */ | ||
68 | |||
69 | /** | ||
70 | * Fired when a CKEDITOR core object is fully loaded and ready for interaction. | ||
71 | * | ||
72 | * @event loaded | ||
73 | * @member CKEDITOR | ||
74 | */ | ||