1fa5f5e3bb6cdf3d305ac6e041efedb69abec2da
[ckeditor.git] / _source / core / _bootstrap.js
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
5
6 /**
7 * @fileOverview API initialization code.
8 */
9
10 (function()
11 {
12 // Disable HC detaction in WebKit. (#5429)
13 if ( CKEDITOR.env.webkit )
14 {
15 CKEDITOR.env.hc = false;
16 return;
17 }
18
19 // Check whether high contrast is active by creating a colored border.
20 var hcDetect = CKEDITOR.dom.element.createFromHtml(
21 '<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
22 'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
23
24 hcDetect.appendTo( CKEDITOR.document.getHead() );
25
26 // Update CKEDITOR.env.
27 // Catch exception needed sometimes for FF. (#4230)
28 try
29 {
30 CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
31 }
32 catch (e)
33 {
34 CKEDITOR.env.hc = false;
35 }
36
37 if ( CKEDITOR.env.hc )
38 CKEDITOR.env.cssClass += ' cke_hc';
39
40 hcDetect.remove();
41 })();
42
43 // Load core plugins.
44 CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
45 {
46 CKEDITOR.status = 'loaded';
47 CKEDITOR.fire( 'loaded' );
48
49 // Process all instances created by the "basic" implementation.
50 var pending = CKEDITOR._.pending;
51 if ( pending )
52 {
53 delete CKEDITOR._.pending;
54
55 for ( var i = 0 ; i < pending.length ; i++ )
56 CKEDITOR.add( pending[ i ] );
57 }
58 });
59
60 // Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
61 if ( CKEDITOR.env.ie )
62 {
63 // Remove IE mouse flickering on IE6 because of background images.
64 try
65 {
66 document.execCommand( 'BackgroundImageCache', false, true );
67 }
68 catch (e)
69 {
70 // We have been reported about loading problems caused by the above
71 // line. For safety, let's just ignore errors.
72 }
73 }
74
75 /**
76 * Indicates that CKEditor is running on a High Contrast environment.
77 * @name CKEDITOR.env.hc
78 * @example
79 * if ( CKEDITOR.env.hc )
80 * alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
81 */
82
83 /**
84 * Fired when a CKEDITOR core object is fully loaded and ready for interaction.
85 * @name CKEDITOR#loaded
86 * @event
87 */