JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
f351ce616a7ba633718ebf87a8e3c0b197f96ed3
[ckeditor.git] / _source / core / _bootstrap.js
1 /*\r
2 Copyright (c) 2003-2010, 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 is High Contrast is active by creating a temporary element with a\r
20         // background image.\r
21 \r
22         var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7,\r
23                 useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7;\r
24 \r
25         var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) :\r
26                                                          useBlank ? 'about:blank' : 'data:image/png;base64,';\r
27 \r
28         var hcDetect = CKEDITOR.dom.element.createFromHtml(\r
29                 '<div style="width:0px;height:0px;' +\r
30                         'position:absolute;left:-10000px;' +\r
31                         'background-image:url(' + backgroundImageUrl + ')"></div>', CKEDITOR.document );\r
32 \r
33         hcDetect.appendTo( CKEDITOR.document.getHead() );\r
34 \r
35         // Update CKEDITOR.env.\r
36         // Catch exception needed sometimes for FF. (#4230)\r
37         try\r
38         {\r
39                 CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' );\r
40         }\r
41         catch (e)\r
42         {\r
43                 CKEDITOR.env.hc = false;\r
44         }\r
45 \r
46         if ( CKEDITOR.env.hc )\r
47                 CKEDITOR.env.cssClass += ' cke_hc';\r
48 \r
49         hcDetect.remove();\r
50 })();\r
51 \r
52 // Load core plugins.\r
53 CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()\r
54         {\r
55                 CKEDITOR.status = 'loaded';\r
56                 CKEDITOR.fire( 'loaded' );\r
57 \r
58                 // Process all instances created by the "basic" implementation.\r
59                 var pending = CKEDITOR._.pending;\r
60                 if ( pending )\r
61                 {\r
62                         delete CKEDITOR._.pending;\r
63 \r
64                         for ( var i = 0 ; i < pending.length ; i++ )\r
65                                 CKEDITOR.add( pending[ i ] );\r
66                 }\r
67         });\r
68 \r
69 /*\r
70 TODO: Enable the following and check if effective.\r
71 \r
72 if ( CKEDITOR.env.ie )\r
73 {\r
74         // Remove IE mouse flickering on IE6 because of background images.\r
75         try\r
76         {\r
77                 document.execCommand( 'BackgroundImageCache', false, true );\r
78         }\r
79         catch (e)\r
80         {\r
81                 // We have been reported about loading problems caused by the above\r
82                 // line. For safety, let's just ignore errors.\r
83         }\r
84 }\r
85 */\r
86 \r
87 /**\r
88  * Fired when a CKEDITOR core object is fully loaded and ready for interaction.\r
89  * @name CKEDITOR#loaded\r
90  * @event\r
91  */\r