1 /*
  2  * CKEditor - The text editor for Internet - http://ckeditor.com
  3  * Copyright (C) 2003-2008 Frederico Caldeira Knabben
  4  *
  5  * == BEGIN LICENSE ==
  6  *
  7  * Licensed under the terms of any of the following licenses at your
  8  * choice:
  9  *
 10  *  - GNU General Public License Version 2 or later (the "GPL")
 11  *    http://www.gnu.org/licenses/gpl.html
 12  *
 13  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 14  *    http://www.gnu.org/licenses/lgpl.html
 15  *
 16  *  - Mozilla Public License Version 1.1 or later (the "MPL")
 17  *    http://www.mozilla.org/MPL/MPL-1.1.html
 18  *
 19  * == END LICENSE ==
 20  */
 21 
 22 // #### Compressed Code
 23 // Must be updated on changes in the script, as well as updated in the
 24 // ckeditor.js and ckeditor_basic.js files.
 25 
 26 // if (!window.CKEDITOR){window.CKEDITOR=(function(){return {status:'unloaded',basePath:(function(){var A='';var B=document.getElementsByTagName('script');for (var i=0;i<B.length;i++){var C=B[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (C){A=C[1];break;}};if (A.indexOf('://')==-1){if (A.indexOf('/')==0) A=location.href.match(/^.*?:\/\/[^\/]*/)[0]+A;else A=location.href.match(/^[^\?]*\//)[0]+A;};return A;})()};})();};
 27 
 28 // #### Raw code
 29 // ATTENTION: read the above "Compressed Code" notes when changing this code.
 30 
 31 if ( !window.CKEDITOR )
 32 {
 33 	/**
 34 	 * This is the API entry point. The entire CKEditor code runs under this object.
 35 	 * @name CKEDITOR
 36 	 * @namespace
 37 	 * @example
 38 	 */
 39 	window.CKEDITOR = (function()
 40 	{
 41 		/** @lends CKEDITOR */
 42 		return {
 43 			/**
 44 			 * Indicates the API loading status:
 45 			 *		<ul>
 46 			 *			<li><b>unloaded</b>: the API is not yet loaded.</li>
 47 			 *			<li><b>basic_loaded</b>: the basic API features are available.</li>
 48 			 *			<li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
 49 			 *			<li><b>loading</b>: the full API is being loaded.</li>
 50 			 *			<li><b>ready</b>: the API can be fully used.</li>
 51 			 *		</ul>
 52 			 * @type string
 53 			 * @example
 54 			 * if ( <b>CKEDITOR.status</b> == 'ready' )
 55 			 * {
 56 			 *     // The API can now be fully used.
 57 			 * }
 58 			 */
 59 			status : 'unloaded',
 60 
 61 			/**
 62 			 * Contains the full URL for the CKEditor installation directory.
 63 			 * @type string
 64 			 * @example
 65 			 * // Alerts "http://www.example.com/ckeditor/" (e.g.)
 66 			 * alert( <b>CKEDITOR.basePath</b> );
 67 			 */
 68 			basePath : (function()
 69 			{
 70 				// ATTENTION: fixes on this code must be ported to
 71 				// loader.basePath (core/loader.js).
 72 			
 73 				// Find out the editor directory path, based on its <script> tag.
 74 				var path = '';
 75 				var scripts = document.getElementsByTagName( 'script' );
 76 
 77 				for ( var i = 0 ; i < scripts.length ; i++ )
 78 				{
 79 					var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i );
 80 
 81 					if ( match )
 82 					{
 83 						path = match[1];
 84 						break;
 85 					}
 86 				}
 87 
 88 				// In IE (only) the script.src string is the raw valued entered in the
 89 				// HTML. Other browsers return the full resolved URL instead.
 90 				if ( path.indexOf('://') == -1 )
 91 				{
 92 					// Absolute path.
 93 					if ( path.indexOf( '/' ) == 0 )
 94 						path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
 95 					// Relative path.
 96 					else
 97 						path = location.href.match( /^[^\?]*\// )[0] + path;
 98 				}
 99 
100 				return path;
101 			})()
102 		};
103 	})();
104 }
105