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