_bootstrap.js 2.2 KB

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