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